{"_id":"@batzionrotman123/backstage-plugin-orchestrator-form-api","_rev":"1-b476238882f62802d1a356297ea0db16","name":"@batzionrotman123/backstage-plugin-orchestrator-form-api","dist-tags":{"latest":"1.2.2"},"versions":{"0.1.0":{"name":"@batzionrotman123/backstage-plugin-orchestrator-form-api","version":"0.1.0","license":"Apache-2.0","_id":"@batzionrotman123/backstage-plugin-orchestrator-form-api@0.1.0","maintainers":[{"name":"batzionrotman123","email":"batzionrotman@gmail.com"}],"dist":{"shasum":"ac1e19fa5d14084cf530027ac72b078c84360622","tarball":"https://registry.npmjs.org/@batzionrotman123/backstage-plugin-orchestrator-form-api/-/backstage-plugin-orchestrator-form-api-0.1.0.tgz","fileCount":11,"integrity":"sha512-quZUv4KKyke6toOcx5BVmmk5kznOY6eL5zfyY6BGD5y6Ulne3HXThm3i9b4ngUbtVPubeMXogAE04KUiHNwsUA==","signatures":[{"sig":"MEUCIQCLlseWPlUNHgglihMzkkPK6qOZ7tpJqWbRFmkR88HDoAIgBgdS6csBRb17gOyEXMQrmRvCJ5XFTsXel0OADzP4/LI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6366},"main":"src/index.ts","types":"src/index.ts","private":false,"scripts":{"tsc":"tsc","lint":"backstage-cli package lint","build":"backstage-cli package build","clean":"backstage-cli package clean","prepack":"backstage-cli package prepack","postpack":"backstage-cli package postpack"},"_npmUser":{"name":"batzionrotman123","email":"batzionrotman@gmail.com"},"backstage":{"role":"web-library"},"description":"library for orchestrator form api, enabling creating a factory to extend the workflow execution form","directories":{},"sideEffects":false,"dependencies":{"@backstage/types":"^1.1.1","@backstage/core-plugin-api":"^1.9.3"},"publishConfig":{"main":"dist/index.esm.js","types":"dist/index.d.ts","access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@backstage/cli":"0.26.11","@types/json-schema":"^7.0.15"},"peerDependencies":{"react":"^16.13.1 || ^17.0.0 || ^18.0.0","@rjsf/core":"^5.17.1"},"_npmOperationalInternal":{"tmp":"tmp/backstage-plugin-orchestrator-form-api_0.1.0_1723720649489_0.6434443912452483","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"@batzionrotman123/backstage-plugin-orchestrator-form-api","description":"library for orchestrator form api, enabling creating a factory to extend the workflow execution form","version":"1.2.2","main":"src/index.ts","types":"src/index.ts","license":"Apache-2.0","publishConfig":{"access":"public","main":"dist/index.esm.js","types":"dist/index.d.ts"},"backstage":{"role":"web-library"},"sideEffects":false,"scripts":{"build":"backstage-cli package build","lint":"backstage-cli package lint","clean":"backstage-cli package clean","prepack":"backstage-cli package prepack","postpack":"backstage-cli package postpack","tsc":"tsc"},"dependencies":{"@backstage/core-plugin-api":"^1.9.3","@backstage/types":"^1.1.1","@rjsf/core":"5.18.5","@rjsf/utils":"5.18.5"},"peerDependencies":{"react":"^16.13.1 || ^17.0.0 || ^18.0.0"},"devDependencies":{"@backstage/cli":"0.26.11","@types/json-schema":"^7.0.15"},"maintainers":[{"name":"batzionrotman123","email":"batzionrotman@gmail.com"}],"_id":"@batzionrotman123/backstage-plugin-orchestrator-form-api@1.2.2","dist":{"shasum":"51bb934b25d8e26e45894949cc2c32db0f9f0e5c","integrity":"sha512-u8LLwt8xmlsi7Pukg0jyFxdsfPJkB+GTP8ZyF/1TZnZgP+NNQ1QTibfeNsrt4xm5PB5fEgvIcJyrlcFLEu0yxA==","tarball":"https://registry.npmjs.org/@batzionrotman123/backstage-plugin-orchestrator-form-api/-/backstage-plugin-orchestrator-form-api-1.2.2.tgz","fileCount":11,"unpackedSize":9556,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDP0XAocXWYtbYesn4Hn3UZ5tOnMVDmAT3cpf7f+40ZbAiAIuBefWxoHJckYP8KI1hR7Ns0skXW4+yDzCmdhB+5J7A=="}]},"_npmUser":{"name":"batzionrotman123","email":"batzionrotman@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/backstage-plugin-orchestrator-form-api_1.2.2_1730735135739_0.5862612532215827"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-15T11:17:29.385Z","modified":"2024-11-04T15:45:36.095Z","0.1.0":"2024-08-15T11:17:29.629Z","1.2.2":"2024-11-04T15:45:35.944Z"},"license":"Apache-2.0","description":"library for orchestrator form api, enabling creating a factory to extend the workflow execution form","maintainers":[{"name":"batzionrotman123","email":"batzionrotman@gmail.com"}],"readme":"# @janus-idp/backstage-plugin-orchestrator-form-api\n\n### Overview\n\nThis library offers the flexibility to override a selected list of [properties](https://rjsf-team.github.io/react-jsonschema-form/docs/api-reference/form-props) of the `react-jsonschema-form` workflow execution form component. It allows customers to provide a custom decorator for the form component in a backstage plugin. This decorator enables users to:\n\n- **Custom Validations:** Two types of custom validations can be added on top of the JSON schema validation provided by default:\n  - Synchronous validation through the `customValidate` property\n  - Asynchronous validation through the `getExtraErrors` property. Handles validations that require backend calls.\n- **Custom Components:** Replace default components by overriding the `widgets` property.\n- **Correlated Field Values:** Implement complex inter-field dependencies by overriding the `onChange` and the `formData` properties.\n\nThe decorator will be provided through a factory method that leverages a [Backstage utility API](https://backstage.io/docs/api/utility-apis) offered by the orchestrator.\n\n### Interface Provided in this package\n\n```typescript\nexport type FormDecoratorProps = Pick<\n  FormProps<JsonObject, JSONSchema7>,\n  'formData' | 'formContext' | 'widgets' | 'onChange' | 'customValidate'\n> & {\n  getExtraErrors?: (\n    formData: JsonObject,\n  ) => Promise<ErrorSchema<JsonObject>> | undefined;\n};\n\nexport type FormDecorator = (\n  FormComponent: React.ComponentType<FormDecoratorProps>,\n) => React.ComponentType;\n\nexport interface FormExtensionsApi {\n  getFormDecorator(schema: JSONSchema7): FormDecorator;\n}\n```\n\n### Example API Implementation\n\n```typescript\nclass CustomFormExtensionsApi implements FormExtensionsApi {\n  getFormDecorator(schema: JSONSchema7) {\n    return (FormComponent: React.ComponentType<FormDecoratorProps>>) => {\n      const widgets = {CountryWidget};\n      return () => <FormComponent widgets={widgets} />;\n    };\n  }\n}\n```\n\n### Plugin Creation Example\n\n```typescript\nexport const formApiFactory = createApiFactory({\n  api: orchestratorFormApiRef,\n  deps: {},\n  factory() {\n    return new CustomApi();\n  },\n});\n\nexport const testFactoryPlugin = createPlugin({\n  id: 'testfactory',\n  apis: [formApiFactory],\n});\n```\n\n### Schema example for above plugin\n\n```typescript\n{\n  \"title\": \"Product\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"type\": \"string\",\n      \"title\": \"Name\"\n    },\n    \"country\": {\n      \"type\": \"string\",\n      \"title\": \"Country\",\n      \"description\": \"Country of residence\",\n      \"ui:widget\": \"CountryWidget\"\n    }\n  },\n  \"required\": [\"name\", \"country\"]\n}\n```\n\n### dynamic plugin configuration\n\nadd the following to app-config.local.yaml for integrating the dynamic plugin.\n\n```yaml\ndynamicPlugins:\n  frontend:\n    backstage-plugin-testfactory:\n      apiFactories:\n        - importName: formApiFactory\n```\n\n### Additional Details\n\nThe workflow execution schema adheres to the [json-schema](https://json-schema.org/) format, which allows for extending the schema with custom properties beyond the official specification. This flexibility enables the inclusion of additional [UiSchema](https://rjsf-team.github.io/react-jsonschema-form/docs/api-reference/uiSchema/) fields directly within the schema, as demonstrated in the example above.\n\nThe orchestrator plugin handles the separation of UI schema fields from the main schema. It also organizes the form into wizard steps based on an additional hierarchical structure within the JSON schema.\n\nFull plugin example is available [here](https://github.com/parodos-dev/extended-form-example-plugin).\n","readmeFilename":"README.md"}