@backstage/plugin-scaffolder 1.27.2-next.2 → 1.27.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 CHANGED
@@ -1,5 +1,39 @@
1
1
  # @backstage/plugin-scaffolder
2
2
 
3
+ ## 1.27.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9cadaf1: Fix issue with `secrets` not being forwarded properly to the backend when creating a task
8
+
9
+ ## 1.27.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 3c62a50: Experimental support for `formDecorators` to enable secret collection and mutations to the parameters for scaffolder tasks
14
+ - c4ffd13: Added the autocomplete feature to GitlabRepoUrlPicker
15
+ - 9951ba4: Updated dependency `@rjsf/utils` to `5.23.1`.
16
+ Updated dependency `@rjsf/core` to `5.23.1`.
17
+ Updated dependency `@rjsf/material-ui` to `5.23.1`.
18
+ Updated dependency `@rjsf/validator-ajv8` to `5.23.1`.
19
+ - 184161f: Scaffolder field extensions registered with `FormFieldBlueprint` are now collected in the `useCustomFieldExtensions` hook, enabling them for use in the scaffolder.
20
+ - Updated dependencies
21
+ - @backstage/plugin-catalog-react@1.15.0
22
+ - @backstage/integration@1.16.0
23
+ - @backstage/plugin-scaffolder-common@1.5.8
24
+ - @backstage/plugin-scaffolder-react@1.14.2
25
+ - @backstage/catalog-client@1.9.0
26
+ - @backstage/core-compat-api@0.3.4
27
+ - @backstage/frontend-plugin-api@0.9.3
28
+ - @backstage/core-components@0.16.2
29
+ - @backstage/errors@1.2.6
30
+ - @backstage/catalog-model@1.7.2
31
+ - @backstage/core-plugin-api@1.10.2
32
+ - @backstage/integration-react@1.2.2
33
+ - @backstage/types@1.2.0
34
+ - @backstage/plugin-catalog-common@1.1.2
35
+ - @backstage/plugin-permission-react@0.4.29
36
+
3
37
  ## 1.27.2-next.2
4
38
 
5
39
  ### Patch Changes
@@ -42,7 +42,7 @@ const useFormDecorators = ({
42
42
  return {
43
43
  run: async (opts) => {
44
44
  let formState = { ...opts.formState };
45
- let secrets = {};
45
+ let secrets = { ...opts.secrets };
46
46
  if (manifest?.EXPERIMENTAL_formDecorators) {
47
47
  await Promise.all(
48
48
  manifest.EXPERIMENTAL_formDecorators.map(async (decorator) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useFormDecorators.esm.js","sources":["../../../src/alpha/hooks/useFormDecorators.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 */\nimport { errorApiRef, useApi, useApiHolder } from '@backstage/core-plugin-api';\nimport { formDecoratorsApiRef } from '../api/ref';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useMemo } from 'react';\nimport { ScaffolderFormDecoratorContext } from '@backstage/plugin-scaffolder-react/alpha';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\n\n/** @internal */\ntype BoundFieldDecorator = {\n decorator: (ctx: ScaffolderFormDecoratorContext) => Promise<void>;\n};\n\nexport const useFormDecorators = ({\n manifest,\n}: {\n manifest?: TemplateParameterSchema;\n}) => {\n const formDecoratorsApi = useApi(formDecoratorsApiRef);\n const errorApi = useApi(errorApiRef);\n const { value: decorators } = useAsync(\n () => formDecoratorsApi.getFormDecorators(),\n [],\n );\n const apiHolder = useApiHolder();\n\n const boundDecorators = useMemo(() => {\n const decoratorsMap = new Map<string, BoundFieldDecorator>();\n\n for (const decorator of decorators ?? []) {\n try {\n const { decorator: decoratorFn, deps } =\n OpaqueFormDecorator.toInternal(decorator);\n\n const resolvedDeps = Object.entries(deps ?? {}).map(([key, value]) => {\n const api = apiHolder.get(value);\n if (!api) {\n throw new Error(\n `Failed to resolve apiRef ${value.id} for form decorator ${decorator.id} it will be disabled`,\n );\n }\n return [key, api];\n });\n\n decoratorsMap.set(decorator.id, {\n decorator: ctx => decoratorFn(ctx, Object.fromEntries(resolvedDeps)),\n });\n } catch (ex) {\n errorApi.post(ex);\n return undefined;\n }\n }\n return decoratorsMap;\n }, [apiHolder, decorators, errorApi]);\n\n return {\n run: async (opts: {\n formState: Record<string, JsonValue>;\n secrets: Record<string, string>;\n }) => {\n let formState: Record<string, JsonValue> = { ...opts.formState };\n let secrets: Record<string, string> = {};\n\n if (manifest?.EXPERIMENTAL_formDecorators) {\n // for each of the form decorators, go and call the decorator with the context\n await Promise.all(\n manifest.EXPERIMENTAL_formDecorators.map(async decorator => {\n const formDecorator = boundDecorators?.get(decorator.id);\n if (!formDecorator) {\n errorApi.post(\n new Error(`Failed to find form decorator ${decorator.id}`),\n );\n return;\n }\n\n await formDecorator.decorator({\n setSecrets: (\n handler: (\n oldState: Record<string, string>,\n ) => Record<string, string>,\n ) => {\n secrets = { ...handler(secrets) };\n },\n setFormState: (\n handler: (\n oldState: Record<string, JsonValue>,\n ) => Record<string, JsonValue>,\n ) => {\n formState = { ...handler(formState) };\n },\n formState,\n input: decorator.input ?? {},\n });\n }),\n );\n }\n\n return { formState, secrets };\n },\n };\n};\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AACF,CAEM,KAAA;AACJ,EAAM,MAAA,iBAAA,GAAoB,OAAO,oBAAoB,CAAA;AACrD,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,EAAE,KAAO,EAAA,UAAA,EAAe,GAAA,QAAA;AAAA,IAC5B,MAAM,kBAAkB,iBAAkB,EAAA;AAAA,IAC1C;AAAC,GACH;AACA,EAAA,MAAM,YAAY,YAAa,EAAA;AAE/B,EAAM,MAA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AAU,2BAA6B,EAAA;AAEzC,QAAA,MAAM,OAAQ,CAAA,GAAA;AAAA,UACZ,QAAS,CAAA,2BAAA,CAA4B,GAAI,CAAA,OAAM,SAAa,KAAA;AAC1D,YAAA,MAAM,aAAgB,GAAA,eAAA,EAAiB,GAAI,CAAA,SAAA,CAAU,EAAE,CAAA;AACvD,YAAA,IAAI,CAAC,aAAe,EAAA;AAClB,cAAS,QAAA,CAAA,IAAA;AAAA,gBACP,IAAI,KAAA,CAAM,CAAiC,8BAAA,EAAA,SAAA,CAAU,EAAE,CAAE,CAAA;AAAA,eAC3D;AACA,cAAA;AAAA;AAGF,YAAA,MAAM,cAAc,SAAU,CAAA;AAAA,cAC5B,UAAA,EAAY,CACV,OAGG,KAAA;AACH,gBAAA,OAAA,GAAU,EAAE,GAAG,OAAQ,CAAA,OAAO,CAAE,EAAA;AAAA,eAClC;AAAA,cACA,YAAA,EAAc,CACZ,OAGG,KAAA;AACH,gBAAA,SAAA,GAAY,EAAE,GAAG,OAAQ,CAAA,SAAS,CAAE,EAAA;AAAA,eACtC;AAAA,cACA,SAAA;AAAA,cACA,KAAA,EAAO,SAAU,CAAA,KAAA,IAAS;AAAC,aAC5B,CAAA;AAAA,WACF;AAAA,SACH;AAAA;AAGF,MAAO,OAAA,EAAE,WAAW,OAAQ,EAAA;AAAA;AAC9B,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useFormDecorators.esm.js","sources":["../../../src/alpha/hooks/useFormDecorators.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 */\nimport { errorApiRef, useApi, useApiHolder } from '@backstage/core-plugin-api';\nimport { formDecoratorsApiRef } from '../api/ref';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useMemo } from 'react';\nimport { ScaffolderFormDecoratorContext } from '@backstage/plugin-scaffolder-react/alpha';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\n\n/** @internal */\ntype BoundFieldDecorator = {\n decorator: (ctx: ScaffolderFormDecoratorContext) => Promise<void>;\n};\n\nexport const useFormDecorators = ({\n manifest,\n}: {\n manifest?: TemplateParameterSchema;\n}) => {\n const formDecoratorsApi = useApi(formDecoratorsApiRef);\n const errorApi = useApi(errorApiRef);\n const { value: decorators } = useAsync(\n () => formDecoratorsApi.getFormDecorators(),\n [],\n );\n const apiHolder = useApiHolder();\n\n const boundDecorators = useMemo(() => {\n const decoratorsMap = new Map<string, BoundFieldDecorator>();\n\n for (const decorator of decorators ?? []) {\n try {\n const { decorator: decoratorFn, deps } =\n OpaqueFormDecorator.toInternal(decorator);\n\n const resolvedDeps = Object.entries(deps ?? {}).map(([key, value]) => {\n const api = apiHolder.get(value);\n if (!api) {\n throw new Error(\n `Failed to resolve apiRef ${value.id} for form decorator ${decorator.id} it will be disabled`,\n );\n }\n return [key, api];\n });\n\n decoratorsMap.set(decorator.id, {\n decorator: ctx => decoratorFn(ctx, Object.fromEntries(resolvedDeps)),\n });\n } catch (ex) {\n errorApi.post(ex);\n return undefined;\n }\n }\n return decoratorsMap;\n }, [apiHolder, decorators, errorApi]);\n\n return {\n run: async (opts: {\n formState: Record<string, JsonValue>;\n secrets: Record<string, string>;\n }) => {\n let formState: Record<string, JsonValue> = { ...opts.formState };\n let secrets: Record<string, string> = { ...opts.secrets };\n\n if (manifest?.EXPERIMENTAL_formDecorators) {\n // for each of the form decorators, go and call the decorator with the context\n await Promise.all(\n manifest.EXPERIMENTAL_formDecorators.map(async decorator => {\n const formDecorator = boundDecorators?.get(decorator.id);\n if (!formDecorator) {\n errorApi.post(\n new Error(`Failed to find form decorator ${decorator.id}`),\n );\n return;\n }\n\n await formDecorator.decorator({\n setSecrets: (\n handler: (\n oldState: Record<string, string>,\n ) => Record<string, string>,\n ) => {\n secrets = { ...handler(secrets) };\n },\n setFormState: (\n handler: (\n oldState: Record<string, JsonValue>,\n ) => Record<string, JsonValue>,\n ) => {\n formState = { ...handler(formState) };\n },\n formState,\n input: decorator.input ?? {},\n });\n }),\n );\n }\n\n return { formState, secrets };\n },\n };\n};\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AACF,CAEM,KAAA;AACJ,EAAM,MAAA,iBAAA,GAAoB,OAAO,oBAAoB,CAAA;AACrD,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,EAAE,KAAO,EAAA,UAAA,EAAe,GAAA,QAAA;AAAA,IAC5B,MAAM,kBAAkB,iBAAkB,EAAA;AAAA,IAC1C;AAAC,GACH;AACA,EAAA,MAAM,YAAY,YAAa,EAAA;AAE/B,EAAM,MAAA,eAAA,GAAkB,QAAQ,MAAM;AACpC,IAAM,MAAA,aAAA,uBAAoB,GAAiC,EAAA;AAE3D,IAAW,KAAA,MAAA,SAAA,IAAa,UAAc,IAAA,EAAI,EAAA;AACxC,MAAI,IAAA;AACF,QAAA,MAAM,EAAE,SAAW,EAAA,WAAA,EAAa,MAC9B,GAAA,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAE1C,QAAA,MAAM,YAAe,GAAA,MAAA,CAAO,OAAQ,CAAA,IAAA,IAAQ,EAAE,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,GAAK,EAAA,KAAK,CAAM,KAAA;AACpE,UAAM,MAAA,GAAA,GAAM,SAAU,CAAA,GAAA,CAAI,KAAK,CAAA;AAC/B,UAAA,IAAI,CAAC,GAAK,EAAA;AACR,YAAA,MAAM,IAAI,KAAA;AAAA,cACR,CAA4B,yBAAA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AA,OAAO,CAAE,EAAA;AAAA,eAClC;AAAA,cACA,YAAA,EAAc,CACZ,OAGG,KAAA;AACH,gBAAA,SAAA,GAAY,EAAE,GAAG,OAAQ,CAAA,SAAS,CAAE,EAAA;AAAA,eACtC;AAAA,cACA,SAAA;AAAA,cACA,KAAA,EAAO,SAAU,CAAA,KAAA,IAAS;AAAC,aAC5B,CAAA;AAAA,WACF;AAAA,SACH;AAAA;AAGF,MAAO,OAAA,EAAE,WAAW,OAAQ,EAAA;AAAA;AAC9B,GACF;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
- "version": "1.27.2-next.2",
3
+ "version": "1.27.3",
4
4
  "description": "The Backstage plugin that helps you create new things",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -67,21 +67,21 @@
67
67
  "test": "backstage-cli package test"
68
68
  },
69
69
  "dependencies": {
70
- "@backstage/catalog-client": "1.9.0-next.2",
71
- "@backstage/catalog-model": "1.7.2-next.0",
72
- "@backstage/core-compat-api": "0.3.4-next.2",
73
- "@backstage/core-components": "0.16.2-next.2",
74
- "@backstage/core-plugin-api": "1.10.2-next.0",
75
- "@backstage/errors": "1.2.6-next.0",
76
- "@backstage/frontend-plugin-api": "0.9.3-next.2",
77
- "@backstage/integration": "1.16.0-next.1",
78
- "@backstage/integration-react": "1.2.2-next.1",
79
- "@backstage/plugin-catalog-common": "1.1.2-next.0",
80
- "@backstage/plugin-catalog-react": "1.14.3-next.2",
81
- "@backstage/plugin-permission-react": "0.4.29-next.0",
82
- "@backstage/plugin-scaffolder-common": "1.5.8-next.1",
83
- "@backstage/plugin-scaffolder-react": "1.14.2-next.2",
84
- "@backstage/types": "1.2.0",
70
+ "@backstage/catalog-client": "^1.9.0",
71
+ "@backstage/catalog-model": "^1.7.2",
72
+ "@backstage/core-compat-api": "^0.3.4",
73
+ "@backstage/core-components": "^0.16.2",
74
+ "@backstage/core-plugin-api": "^1.10.2",
75
+ "@backstage/errors": "^1.2.6",
76
+ "@backstage/frontend-plugin-api": "^0.9.3",
77
+ "@backstage/integration": "^1.16.0",
78
+ "@backstage/integration-react": "^1.2.2",
79
+ "@backstage/plugin-catalog-common": "^1.1.2",
80
+ "@backstage/plugin-catalog-react": "^1.15.0",
81
+ "@backstage/plugin-permission-react": "^0.4.29",
82
+ "@backstage/plugin-scaffolder-common": "^1.5.8",
83
+ "@backstage/plugin-scaffolder-react": "^1.14.2",
84
+ "@backstage/types": "^1.2.0",
85
85
  "@codemirror/language": "^6.0.0",
86
86
  "@codemirror/legacy-modes": "^6.1.0",
87
87
  "@codemirror/view": "^6.0.0",
@@ -114,12 +114,12 @@
114
114
  "zod-to-json-schema": "^3.20.4"
115
115
  },
116
116
  "devDependencies": {
117
- "@backstage/cli": "0.29.3-next.2",
118
- "@backstage/core-app-api": "1.15.3-next.1",
119
- "@backstage/dev-utils": "1.1.5-next.2",
120
- "@backstage/plugin-catalog": "1.26.0-next.2",
121
- "@backstage/plugin-permission-common": "0.8.3-next.0",
122
- "@backstage/test-utils": "1.7.3-next.1",
117
+ "@backstage/cli": "^0.29.4",
118
+ "@backstage/core-app-api": "^1.15.3",
119
+ "@backstage/dev-utils": "^1.1.5",
120
+ "@backstage/plugin-catalog": "^1.26.0",
121
+ "@backstage/plugin-permission-common": "^0.8.3",
122
+ "@backstage/test-utils": "^1.7.3",
123
123
  "@testing-library/dom": "^10.0.0",
124
124
  "@testing-library/jest-dom": "^6.0.0",
125
125
  "@testing-library/react": "^16.0.0",