@backstage/plugin-scaffolder-react 1.19.2 → 1.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/alpha.d.ts +1 -1
- package/dist/next/api/FormFieldsApi.esm.js +1 -0
- package/dist/next/api/FormFieldsApi.esm.js.map +1 -1
- package/dist/next/hooks/useTemplateSchema.esm.js +2 -3
- package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-react
|
|
2
2
|
|
|
3
|
+
## 1.19.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 886a8a1: Fixed a bug in the Scaffolder's template parsing in the `useTemplateSchema` hook by removing the title instead of setting it to `undefined`
|
|
8
|
+
- 05f60e1: Refactored constructor parameter properties to explicit property declarations for compatibility with TypeScript's `erasableSyntaxOnly` setting. This internal refactoring maintains all existing functionality while ensuring TypeScript compilation compatibility.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/frontend-plugin-api@0.13.0
|
|
11
|
+
- @backstage/plugin-catalog-react@1.21.3
|
|
12
|
+
- @backstage/core-components@0.18.3
|
|
13
|
+
- @backstage/core-plugin-api@1.12.0
|
|
14
|
+
- @backstage/plugin-permission-react@0.4.38
|
|
15
|
+
- @backstage/catalog-model@1.7.6
|
|
16
|
+
- @backstage/catalog-client@1.12.1
|
|
17
|
+
- @backstage/plugin-scaffolder-common@1.7.3
|
|
18
|
+
|
|
19
|
+
## 1.19.3-next.0
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 886a8a1: Fixed a bug in the Scaffolder's template parsing in the `useTemplateSchema` hook by removing the title instead of setting it to `undefined`
|
|
24
|
+
- 05f60e1: Refactored constructor parameter properties to explicit property declarations for compatibility with TypeScript's `erasableSyntaxOnly` setting. This internal refactoring maintains all existing functionality while ensuring TypeScript compilation compatibility.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @backstage/plugin-permission-react@0.4.38-next.0
|
|
27
|
+
- @backstage/plugin-catalog-react@1.21.3-next.0
|
|
28
|
+
- @backstage/core-plugin-api@1.11.2-next.0
|
|
29
|
+
- @backstage/core-components@0.18.3-next.0
|
|
30
|
+
- @backstage/catalog-model@1.7.6-next.0
|
|
31
|
+
- @backstage/frontend-plugin-api@0.12.2-next.0
|
|
32
|
+
- @backstage/catalog-client@1.12.1-next.0
|
|
33
|
+
- @backstage/theme@0.7.0
|
|
34
|
+
- @backstage/types@1.2.2
|
|
35
|
+
- @backstage/version-bridge@1.0.11
|
|
36
|
+
- @backstage/plugin-scaffolder-common@1.7.3-next.0
|
|
37
|
+
|
|
3
38
|
## 1.19.2
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ interface FormField {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/** @alpha */
|
|
118
|
-
declare const formFieldsApi: _backstage_frontend_plugin_api.
|
|
118
|
+
declare const formFieldsApi: _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
119
119
|
config: {};
|
|
120
120
|
configInput: {};
|
|
121
121
|
output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
|
|
@@ -5,6 +5,7 @@ import { FormFieldBlueprint } from '../blueprints/FormFieldBlueprint.esm.js';
|
|
|
5
5
|
import { OpaqueFormField } from '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
|
|
6
6
|
|
|
7
7
|
class DefaultScaffolderFormFieldsApi {
|
|
8
|
+
formFieldLoaders;
|
|
8
9
|
constructor(formFieldLoaders = []) {
|
|
9
10
|
this.formFieldLoaders = formFieldLoaders;
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldsApi.esm.js","sources":["../../../src/next/api/FormFieldsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { FormField, ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n
|
|
1
|
+
{"version":3,"file":"FormFieldsApi.esm.js","sources":["../../../src/next/api/FormFieldsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { FormField, ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n private readonly formFieldLoaders: Array<() => Promise<FormField>>;\n\n constructor(formFieldLoaders: Array<() => Promise<FormField>> = []) {\n this.formFieldLoaders = formFieldLoaders;\n }\n\n async getFormFields() {\n const formFields = await Promise.all(\n this.formFieldLoaders.map(loader => loader()),\n );\n\n const internalFormFields = formFields.map(OpaqueFormField.toInternal);\n\n return internalFormFields;\n }\n}\n\n/** @alpha */\nexport const formFieldsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-fields',\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(e =>\n e.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n\n return originalFactory(defineParams =>\n defineParams({\n api: formFieldsApiRef,\n deps: {},\n factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,8BAAA,CAAkE;AAAA,EACrD,gBAAA;AAAA,EAEjB,WAAA,CAAY,gBAAA,GAAoD,EAAC,EAAG;AAClE,IAAA,IAAA,CAAK,gBAAA,GAAmB,gBAAA;AAAA,EAC1B;AAAA,EAEA,MAAM,aAAA,GAAgB;AACpB,IAAA,MAAM,UAAA,GAAa,MAAM,OAAA,CAAQ,GAAA;AAAA,MAC/B,IAAA,CAAK,gBAAA,CAAiB,GAAA,CAAI,CAAA,MAAA,KAAU,QAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAA,GAAqB,UAAA,CAAW,GAAA,CAAI,eAAA,CAAgB,UAAU,CAAA;AAEpE,IAAA,OAAO,kBAAA;AAAA,EACT;AACF;AAGO,MAAM,aAAA,GAAgB,aAAa,iBAAA,CAAkB;AAAA,EAC1D,IAAA,EAAM,aAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,YAAY,oBAAA,CAAqB;AAAA,MAC/B,mBAAmB,QAAA,CAAS;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,MAAM,gBAAA,GAAmB,OAAO,UAAA,CAAW,GAAA;AAAA,MAAI,CAAA,CAAA,KAC7C,CAAA,CAAE,GAAA,CAAI,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AAEA,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MAAM,IAAI,8BAAA,CAA+B,gBAAgB;AAAA,OACnE;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -13,12 +13,11 @@ const useTemplateSchema = (manifest) => {
|
|
|
13
13
|
const stepFeatureFlag = step.uiSchema["ui:backstage"]?.featureFlag;
|
|
14
14
|
return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;
|
|
15
15
|
}).map((step) => {
|
|
16
|
+
const { title, ...stepSchema } = step.schema;
|
|
16
17
|
const strippedSchema = {
|
|
17
18
|
...step,
|
|
18
19
|
schema: {
|
|
19
|
-
...
|
|
20
|
-
// Title is rendered at the top of the page, so let's ignore this from jsonschemaform
|
|
21
|
-
title: void 0
|
|
20
|
+
...stepSchema
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
23
|
if (step.schema?.properties || !step.schema?.dependencies) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTemplateSchema.esm.js","sources":["../../../src/next/hooks/useTemplateSchema.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): {\n steps: ParsedTemplateSchema[];\n presentation?: TemplatePresentationV1beta3;\n} => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => {\n
|
|
1
|
+
{"version":3,"file":"useTemplateSchema.esm.js","sources":["../../../src/next/hooks/useTemplateSchema.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): {\n steps: ParsedTemplateSchema[];\n presentation?: TemplatePresentationV1beta3;\n} => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => {\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n const { title, ...stepSchema } = step.schema;\n\n const strippedSchema = {\n ...step,\n schema: {\n ...stepSchema,\n },\n } as ParsedTemplateSchema;\n\n if (step.schema?.properties || !step.schema?.dependencies) {\n strippedSchema.schema.properties = Object.fromEntries(\n Object.entries((step.schema?.properties ?? {}) as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n );\n }\n\n return strippedSchema;\n });\n\n return {\n presentation: manifest.presentation,\n steps: returningSteps,\n };\n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AA,CAAa,QAAA,CAAS,eAAe,CAAA,GACrC,IAAA;AAAA,UACN;AAAA;AACF,OACF;AAAA,IACF;AAEA,IAAA,OAAO,cAAA;AAAA,EACT,CAAC,CAAA;AAEH,EAAA,OAAO;AAAA,IACL,cAAc,QAAA,CAAS,YAAA;AAAA,IACvB,KAAA,EAAO;AAAA,GACT;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-react",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.3",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"test": "backstage-cli package test"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@backstage/catalog-client": "^1.12.
|
|
70
|
-
"@backstage/catalog-model": "^1.7.
|
|
71
|
-
"@backstage/core-components": "^0.18.
|
|
72
|
-
"@backstage/core-plugin-api": "^1.
|
|
73
|
-
"@backstage/frontend-plugin-api": "^0.
|
|
74
|
-
"@backstage/plugin-catalog-react": "^1.21.
|
|
75
|
-
"@backstage/plugin-permission-react": "^0.4.
|
|
76
|
-
"@backstage/plugin-scaffolder-common": "^1.7.
|
|
69
|
+
"@backstage/catalog-client": "^1.12.1",
|
|
70
|
+
"@backstage/catalog-model": "^1.7.6",
|
|
71
|
+
"@backstage/core-components": "^0.18.3",
|
|
72
|
+
"@backstage/core-plugin-api": "^1.12.0",
|
|
73
|
+
"@backstage/frontend-plugin-api": "^0.13.0",
|
|
74
|
+
"@backstage/plugin-catalog-react": "^1.21.3",
|
|
75
|
+
"@backstage/plugin-permission-react": "^0.4.38",
|
|
76
|
+
"@backstage/plugin-scaffolder-common": "^1.7.3",
|
|
77
77
|
"@backstage/theme": "^0.7.0",
|
|
78
78
|
"@backstage/types": "^1.2.2",
|
|
79
79
|
"@backstage/version-bridge": "^1.0.11",
|
|
@@ -104,12 +104,12 @@
|
|
|
104
104
|
"zod-to-json-schema": "^3.20.4"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@backstage/cli": "^0.34.
|
|
108
|
-
"@backstage/core-app-api": "^1.19.
|
|
109
|
-
"@backstage/plugin-catalog": "^1.
|
|
110
|
-
"@backstage/plugin-catalog-common": "^1.1.
|
|
111
|
-
"@backstage/plugin-permission-common": "^0.9.
|
|
112
|
-
"@backstage/test-utils": "^1.7.
|
|
107
|
+
"@backstage/cli": "^0.34.5",
|
|
108
|
+
"@backstage/core-app-api": "^1.19.2",
|
|
109
|
+
"@backstage/plugin-catalog": "^1.32.0",
|
|
110
|
+
"@backstage/plugin-catalog-common": "^1.1.7",
|
|
111
|
+
"@backstage/plugin-permission-common": "^0.9.3",
|
|
112
|
+
"@backstage/test-utils": "^1.7.13",
|
|
113
113
|
"@testing-library/dom": "^10.0.0",
|
|
114
114
|
"@testing-library/jest-dom": "^6.0.0",
|
|
115
115
|
"@testing-library/react": "^16.0.0",
|