@backstage/plugin-scaffolder-react 1.14.3-next.1 → 1.14.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,47 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.14.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 91bb99a: Fix field extension validation not working when field is in dependencies in an array field
8
+ - d8f9079: Updated dependency `@rjsf/utils` to `5.23.2`.
9
+ Updated dependency `@rjsf/core` to `5.23.2`.
10
+ Updated dependency `@rjsf/material-ui` to `5.23.2`.
11
+ Updated dependency `@rjsf/validator-ajv8` to `5.23.2`.
12
+ - 37421bc: Fixed scaffolder form fields not resolving correctly in the `useCustomFieldExtensions` hook.
13
+ - 4756287: Added support for `FormDecoratorBlueprint` to create form decorators in the Scaffolder plugin
14
+ - Updated dependencies
15
+ - @backstage/plugin-catalog-react@1.15.1
16
+ - @backstage/frontend-plugin-api@0.9.4
17
+ - @backstage/core-plugin-api@1.10.3
18
+ - @backstage/types@1.2.1
19
+ - @backstage/core-components@0.16.3
20
+ - @backstage/catalog-client@1.9.1
21
+ - @backstage/catalog-model@1.7.3
22
+ - @backstage/theme@0.6.3
23
+ - @backstage/version-bridge@1.0.10
24
+ - @backstage/plugin-permission-react@0.4.30
25
+ - @backstage/plugin-scaffolder-common@1.5.9
26
+
27
+ ## 1.14.3-next.2
28
+
29
+ ### Patch Changes
30
+
31
+ - 91bb99a: Fix field extension validation not working when field is in dependencies in an array field
32
+ - Updated dependencies
33
+ - @backstage/frontend-plugin-api@0.9.4-next.0
34
+ - @backstage/core-plugin-api@1.10.3-next.0
35
+ - @backstage/types@1.2.1-next.0
36
+ - @backstage/plugin-catalog-react@1.15.1-next.1
37
+ - @backstage/core-components@0.16.3-next.0
38
+ - @backstage/plugin-permission-react@0.4.30-next.0
39
+ - @backstage/catalog-model@1.7.3-next.0
40
+ - @backstage/plugin-scaffolder-common@1.5.9-next.0
41
+ - @backstage/catalog-client@1.9.1-next.0
42
+ - @backstage/theme@0.6.3
43
+ - @backstage/version-bridge@1.0.10
44
+
3
45
  ## 1.14.3-next.1
4
46
 
5
47
  ### Patch Changes
package/dist/alpha.d.ts CHANGED
@@ -7,7 +7,7 @@ import * as React from 'react';
7
7
  import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
8
8
  import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
9
9
  import { UiSchema, FieldValidation, WidgetProps } from '@rjsf/utils';
10
- import { ApiHolder, IconComponent, AnyApiRef } from '@backstage/core-plugin-api';
10
+ import { AnyApiRef, ApiHolder, IconComponent } from '@backstage/core-plugin-api';
11
11
  import { Overrides } from '@material-ui/core/styles/overrides';
12
12
  import { StyleRules } from '@material-ui/core/styles/withStyles';
13
13
 
@@ -52,6 +52,66 @@ declare const formFieldsApi: _backstage_frontend_plugin_api.ExtensionDefinition<
52
52
  };
53
53
  }>;
54
54
 
55
+ /** @alpha */
56
+ type ScaffolderFormDecoratorContext<TInput extends JsonObject = JsonObject> = {
57
+ input: TInput;
58
+ formState: Record<string, JsonValue>;
59
+ setFormState: (fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>) => void;
60
+ setSecrets: (fn: (currentState: Record<string, string>) => Record<string, string>) => void;
61
+ };
62
+ /** @alpha */
63
+ type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {
64
+ readonly $$type: '@backstage/scaffolder/FormDecorator';
65
+ readonly id: string;
66
+ readonly TInput: TInput;
67
+ };
68
+ /**
69
+ * Method for creating decorators which can be used to collect
70
+ * secrets from the user before submitting to the backend.
71
+ * @alpha
72
+ */
73
+ declare function createScaffolderFormDecorator<TInputSchema extends {
74
+ [key in string]: (zImpl: typeof z) => z.ZodType;
75
+ } = {
76
+ [key in string]: (zImpl: typeof z) => z.ZodType;
77
+ }, TDeps extends {
78
+ [key in string]: AnyApiRef;
79
+ } = {
80
+ [key in string]: AnyApiRef;
81
+ }, TInput extends JsonObject = {
82
+ [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;
83
+ }>(options: {
84
+ id: string;
85
+ schema?: {
86
+ input?: TInputSchema;
87
+ };
88
+ deps?: TDeps;
89
+ decorator: (ctx: ScaffolderFormDecoratorContext<TInput>, deps: TDeps extends {
90
+ [key in string]: AnyApiRef;
91
+ } ? {
92
+ [key in keyof TDeps]: TDeps[key]['T'];
93
+ } : never) => Promise<void>;
94
+ }): ScaffolderFormDecorator<TInput>;
95
+
96
+ /**
97
+ * @alpha
98
+ * Creates extensions that are Field Extensions for the Scaffolder
99
+ * */
100
+ declare const FormDecoratorBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
101
+ kind: "scaffolder-form-decorator";
102
+ name: undefined;
103
+ params: {
104
+ decorator: ScaffolderFormDecorator;
105
+ };
106
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<ScaffolderFormDecorator, "scaffolder.form-decorator-loader", {}>;
107
+ inputs: {};
108
+ config: {};
109
+ configInput: {};
110
+ dataRefs: {
111
+ formDecoratorLoader: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<ScaffolderFormDecorator, "scaffolder.form-decorator-loader", {}>;
112
+ };
113
+ }>;
114
+
55
115
  /** @alpha */
56
116
  type FormFieldExtensionData<TReturnValue extends z.ZodType = z.ZodType, TUiOptions extends z.ZodType = z.ZodType> = {
57
117
  name: string;
@@ -400,45 +460,4 @@ declare module '@backstage/theme' {
400
460
  }
401
461
  }
402
462
 
403
- /** @alpha */
404
- type ScaffolderFormDecoratorContext<TInput extends JsonObject = JsonObject> = {
405
- input: TInput;
406
- formState: Record<string, JsonValue>;
407
- setFormState: (fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>) => void;
408
- setSecrets: (fn: (currentState: Record<string, string>) => Record<string, string>) => void;
409
- };
410
- /** @alpha */
411
- type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {
412
- readonly $$type: '@backstage/scaffolder/FormDecorator';
413
- readonly id: string;
414
- readonly TInput: TInput;
415
- };
416
- /**
417
- * Method for creating decorators which can be used to collect
418
- * secrets from the user before submitting to the backend.
419
- * @alpha
420
- */
421
- declare function createScaffolderFormDecorator<TInputSchema extends {
422
- [key in string]: (zImpl: typeof z) => z.ZodType;
423
- } = {
424
- [key in string]: (zImpl: typeof z) => z.ZodType;
425
- }, TDeps extends {
426
- [key in string]: AnyApiRef;
427
- } = {
428
- [key in string]: AnyApiRef;
429
- }, TInput extends JsonObject = {
430
- [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;
431
- }>(options: {
432
- id: string;
433
- schema?: {
434
- input?: TInputSchema;
435
- };
436
- deps?: TDeps;
437
- decorator: (ctx: ScaffolderFormDecoratorContext<TInput>, deps: TDeps extends {
438
- [key in string]: AnyApiRef;
439
- } ? {
440
- [key in keyof TDeps]: TDeps[key]['T'];
441
- } : never) => Promise<void>;
442
- }): ScaffolderFormDecorator<TInput>;
443
-
444
- export { type BackstageOverrides, type BackstageTemplateStepperClassKey, DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormFieldBlueprint, type FormFieldExtensionData, type FormValidation, type ParsedTemplateSchema, ReviewState, type ReviewStateProps, ScaffolderField, type ScaffolderFieldProps, type ScaffolderFormDecorator, type ScaffolderFormDecoratorContext, type ScaffolderFormFieldsApi, ScaffolderPageContextMenu, type ScaffolderPageContextMenuProps, type ScaffolderReactComponentsNameToClassKey, type ScaffolderReactTemplateCategoryPickerClassKey, SecretWidget, Stepper, type StepperProps, TaskLogStream, TaskSteps, type TaskStepsProps, TemplateCard, type TemplateCardProps, TemplateCategoryPicker, TemplateGroup, type TemplateGroupProps, TemplateGroups, type TemplateGroupsProps, Workflow, type WorkflowProps, createAsyncValidators, createFieldValidation, createFormField, createScaffolderFormDecorator, extractSchemaFromStep, formFieldsApi, formFieldsApiRef, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
463
+ export { type BackstageOverrides, type BackstageTemplateStepperClassKey, DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormDecoratorBlueprint, FormFieldBlueprint, type FormFieldExtensionData, type FormValidation, type ParsedTemplateSchema, ReviewState, type ReviewStateProps, ScaffolderField, type ScaffolderFieldProps, type ScaffolderFormDecorator, type ScaffolderFormDecoratorContext, type ScaffolderFormFieldsApi, ScaffolderPageContextMenu, type ScaffolderPageContextMenuProps, type ScaffolderReactComponentsNameToClassKey, type ScaffolderReactTemplateCategoryPickerClassKey, SecretWidget, Stepper, type StepperProps, TaskLogStream, TaskSteps, type TaskStepsProps, TemplateCard, type TemplateCardProps, TemplateCategoryPicker, TemplateGroup, type TemplateGroupProps, TemplateGroups, type TemplateGroupsProps, Workflow, type WorkflowProps, createAsyncValidators, createFieldValidation, createFormField, createScaffolderFormDecorator, extractSchemaFromStep, formFieldsApi, formFieldsApiRef, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
package/dist/alpha.esm.js CHANGED
@@ -20,6 +20,7 @@ export { useFormDataFromQuery } from './next/hooks/useFormDataFromQuery.esm.js';
20
20
  export { useTemplateSchema } from './next/hooks/useTemplateSchema.esm.js';
21
21
  export { useTemplateParameterSchema } from './next/hooks/useTemplateParameterSchema.esm.js';
22
22
  export { useFilteredSchemaProperties } from './next/hooks/useFilteredSchemaProperties.esm.js';
23
+ export { FormDecoratorBlueprint } from './next/blueprints/FormDecoratorBlueprint.esm.js';
23
24
  export { FormFieldBlueprint, createFormField } from './next/blueprints/FormFieldBlueprint.esm.js';
24
25
  export { createScaffolderFormDecorator } from './next/extensions/createScaffolderFormDecorator.esm.js';
25
26
  //# sourceMappingURL=alpha.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -40,6 +40,7 @@ import 'qs';
40
40
  import 'react-use/esm/useAsync';
41
41
  import '../api/ref.esm.js';
42
42
  import 'lodash/cloneDeep';
43
+ import '../next/blueprints/FormDecoratorBlueprint.esm.js';
43
44
  import '../next/blueprints/FormFieldBlueprint.esm.js';
44
45
  import { FIELD_EXTENSION_WRAPPER_KEY, FIELD_EXTENSION_KEY } from '../extensions/keys.esm.js';
45
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomFieldExtensions.esm.js","sources":["../../src/hooks/useCustomFieldExtensions.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useApi, useElementFilter } from '@backstage/core-plugin-api';\nimport { formFieldsApiRef } from '../next';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n // todo(blam): this shouldn't be here, should remove this, but this is a breaking change to remove the generic.\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n // Get custom fields created with FormFieldBlueprint\n const formFieldsApi = useApi(formFieldsApiRef);\n const [{ result: blueprintFields }, { execute }] = useAsync(\n () => formFieldsApi.getFormFields(),\n [],\n );\n useMountEffect(execute);\n\n // Get custom fields created with ScaffolderFieldExtensions\n const outletFields = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n\n // This should really be a different type moving foward, but we do this to keep type compatibility.\n // should probably also move the defaults into the API eventually too, but that will come with the move\n // to the new frontend system.\n const blueprintsToLegacy: FieldExtensionOptions[] = blueprintFields?.map(\n field => ({\n component: field.component,\n name: field.name,\n validation: field.validation,\n schema: field.schema?.schema,\n }),\n );\n\n return [...blueprintsToLegacy, ...outletFields] as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Ba,MAAA,wBAAA,GAA2B,CAItC,MACG,KAAA;AAEH,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,CAAC,EAAE,MAAQ,EAAA,eAAA,IAAmB,EAAE,OAAA,EAAS,CAAI,GAAA,QAAA;AAAA,IACjD,MAAM,cAAc,aAAc,EAAA;AAAA,IAClC;AAAC,GACH;AACA,EAAA,cAAA,CAAe,OAAO,CAAA;AAGtB,EAAA,MAAM,YAAe,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AAKA,EAAA,MAAM,qBAA8C,eAAiB,EAAA,GAAA;AAAA,IACnE,CAAU,KAAA,MAAA;AAAA,MACR,WAAW,KAAM,CAAA,SAAA;AAAA,MACjB,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,MAAA,EAAQ,MAAM,MAAQ,EAAA;AAAA,KACxB;AAAA,GACF;AAEA,EAAA,OAAO,CAAC,GAAG,kBAAoB,EAAA,GAAG,YAAY,CAAA;AAChD;;;;"}
1
+ {"version":3,"file":"useCustomFieldExtensions.esm.js","sources":["../../src/hooks/useCustomFieldExtensions.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useApi, useElementFilter } from '@backstage/core-plugin-api';\nimport { formFieldsApiRef } from '../next';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n // todo(blam): this shouldn't be here, should remove this, but this is a breaking change to remove the generic.\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n // Get custom fields created with FormFieldBlueprint\n const formFieldsApi = useApi(formFieldsApiRef);\n const [{ result: blueprintFields }, { execute }] = useAsync(\n () => formFieldsApi.getFormFields(),\n [],\n );\n useMountEffect(execute);\n\n // Get custom fields created with ScaffolderFieldExtensions\n const outletFields = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n\n // This should really be a different type moving foward, but we do this to keep type compatibility.\n // should probably also move the defaults into the API eventually too, but that will come with the move\n // to the new frontend system.\n const blueprintsToLegacy: FieldExtensionOptions[] = blueprintFields?.map(\n field => ({\n component: field.component,\n name: field.name,\n validation: field.validation,\n schema: field.schema?.schema,\n }),\n );\n\n return [...blueprintsToLegacy, ...outletFields] as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Ba,MAAA,wBAAA,GAA2B,CAItC,MACG,KAAA;AAEH,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,CAAC,EAAE,MAAQ,EAAA,eAAA,IAAmB,EAAE,OAAA,EAAS,CAAI,GAAA,QAAA;AAAA,IACjD,MAAM,cAAc,aAAc,EAAA;AAAA,IAClC;AAAC,GACH;AACA,EAAA,cAAA,CAAe,OAAO,CAAA;AAGtB,EAAA,MAAM,YAAe,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AAKA,EAAA,MAAM,qBAA8C,eAAiB,EAAA,GAAA;AAAA,IACnE,CAAU,KAAA,MAAA;AAAA,MACR,WAAW,KAAM,CAAA,SAAA;AAAA,MACjB,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,MAAA,EAAQ,MAAM,MAAQ,EAAA;AAAA,KACxB;AAAA,GACF;AAEA,EAAA,OAAO,CAAC,GAAG,kBAAoB,EAAA,GAAG,YAAY,CAAA;AAChD;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { ApiBlueprint, createExtensionInput, createApiFactory } from '@backstage/frontend-plugin-api';
2
2
  import { formFieldsApiRef } from './ref.esm.js';
3
+ import '../blueprints/FormDecoratorBlueprint.esm.js';
3
4
  import { FormFieldBlueprint } from '../blueprints/FormFieldBlueprint.esm.js';
4
5
  import { OpaqueFormField } from '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
5
6
 
@@ -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 createApiFactory,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { FormField, OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n constructor(\n private readonly formFieldLoaders: Array<() => Promise<FormField>> = [],\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({\n factory: createApiFactory({\n api: formFieldsApiRef,\n deps: {},\n factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders),\n }),\n });\n },\n});\n"],"names":[],"mappings":";;;;;AA0BA,MAAM,8BAAkE,CAAA;AAAA,EACtE,WAAA,CACmB,gBAAoD,GAAA,EACrE,EAAA;AADiB,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA;AAChB,EAEH,MAAM,aAAgB,GAAA;AACpB,IAAM,MAAA,UAAA,GAAa,MAAM,OAAQ,CAAA,GAAA;AAAA,MAC/B,IAAK,CAAA,gBAAA,CAAiB,GAAI,CAAA,CAAA,MAAA,KAAU,QAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAqB,GAAA,UAAA,CAAW,GAAI,CAAA,eAAA,CAAgB,UAAU,CAAA;AAEpE,IAAO,OAAA,kBAAA;AAAA;AAEX;AAGa,MAAA,aAAA,GAAgB,aAAa,iBAAkB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AAEA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAS,EAAA,MAAM,IAAI,8BAAA,CAA+B,gBAAgB;AAAA,OACnE;AAAA,KACF,CAAA;AAAA;AAEL,CAAC;;;;"}
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 createApiFactory,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { FormField, OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n constructor(\n private readonly formFieldLoaders: Array<() => Promise<FormField>> = [],\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({\n factory: createApiFactory({\n api: formFieldsApiRef,\n deps: {},\n factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders),\n }),\n });\n },\n});\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,8BAAkE,CAAA;AAAA,EACtE,WAAA,CACmB,gBAAoD,GAAA,EACrE,EAAA;AADiB,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA;AAChB,EAEH,MAAM,aAAgB,GAAA;AACpB,IAAM,MAAA,UAAA,GAAa,MAAM,OAAQ,CAAA,GAAA;AAAA,MAC/B,IAAK,CAAA,gBAAA,CAAiB,GAAI,CAAA,CAAA,MAAA,KAAU,QAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAqB,GAAA,UAAA,CAAW,GAAI,CAAA,eAAA,CAAgB,UAAU,CAAA;AAEpE,IAAO,OAAA,kBAAA;AAAA;AAEX;AAGa,MAAA,aAAA,GAAgB,aAAa,iBAAkB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AAEA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAS,EAAA,MAAM,IAAI,8BAAA,CAA+B,gBAAgB;AAAA,OACnE;AAAA,KACF,CAAA;AAAA;AAEL,CAAC;;;;"}
@@ -0,0 +1,19 @@
1
+ import { createExtensionDataRef, createExtensionBlueprint } from '@backstage/frontend-plugin-api';
2
+
3
+ const formDecoratorExtensionDataRef = createExtensionDataRef().with({
4
+ id: "scaffolder.form-decorator-loader"
5
+ });
6
+ const FormDecoratorBlueprint = createExtensionBlueprint({
7
+ kind: "scaffolder-form-decorator",
8
+ attachTo: { id: "api:scaffolder/form-decorators", input: "formDecorators" },
9
+ dataRefs: {
10
+ formDecoratorLoader: formDecoratorExtensionDataRef
11
+ },
12
+ output: [formDecoratorExtensionDataRef],
13
+ *factory(params) {
14
+ yield formDecoratorExtensionDataRef(params.decorator);
15
+ }
16
+ });
17
+
18
+ export { FormDecoratorBlueprint };
19
+ //# sourceMappingURL=FormDecoratorBlueprint.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormDecoratorBlueprint.esm.js","sources":["../../../src/next/blueprints/FormDecoratorBlueprint.tsx"],"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 {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecorator } from '../extensions';\n\nconst formDecoratorExtensionDataRef =\n createExtensionDataRef<ScaffolderFormDecorator>().with({\n id: 'scaffolder.form-decorator-loader',\n });\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormDecoratorBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-decorator',\n attachTo: { id: 'api:scaffolder/form-decorators', input: 'formDecorators' },\n dataRefs: {\n formDecoratorLoader: formDecoratorExtensionDataRef,\n },\n output: [formDecoratorExtensionDataRef],\n *factory(params: { decorator: ScaffolderFormDecorator }) {\n yield formDecoratorExtensionDataRef(params.decorator);\n },\n});\n"],"names":[],"mappings":";;AAqBA,MAAM,6BAAA,GACJ,sBAAgD,EAAA,CAAE,IAAK,CAAA;AAAA,EACrD,EAAI,EAAA;AACN,CAAC,CAAA;AAMI,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,2BAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,gCAAA,EAAkC,OAAO,gBAAiB,EAAA;AAAA,EAC1E,QAAU,EAAA;AAAA,IACR,mBAAqB,EAAA;AAAA,GACvB;AAAA,EACA,MAAA,EAAQ,CAAC,6BAA6B,CAAA;AAAA,EACtC,CAAC,QAAQ,MAAgD,EAAA;AACvD,IAAM,MAAA,6BAAA,CAA8B,OAAO,SAAS,CAAA;AAAA;AAExD,CAAC;;;;"}
@@ -64,6 +64,24 @@ const createAsyncValidators = (rootSchema, validators, context) => {
64
64
  for (const [, propValue] of Object.entries(properties)) {
65
65
  await doValidate(propValue);
66
66
  }
67
+ if (Array.isArray(value)) {
68
+ for (const [_, v] of Object.entries(value)) {
69
+ const { schema: itemSchema, uiSchema: itemUiSchema } = extractSchemaFromStep(definitionInSchema.items);
70
+ if (isObject(v)) {
71
+ for (const [pK, pV] of Object.entries(v)) {
72
+ if ("ui:field" in itemUiSchema[pK]) {
73
+ await validateForm(
74
+ itemUiSchema[pK]["ui:field"],
75
+ pK,
76
+ pV,
77
+ itemSchema,
78
+ itemUiSchema
79
+ );
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
67
85
  } else if (isObject(value)) {
68
86
  formValidation[key] = await validate(formData, pointer, value);
69
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createAsyncValidators.esm.js","sources":["../../../../src/next/components/Stepper/createAsyncValidators.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 */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport type { JsonObject, JsonValue } from '@backstage/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport {\n Draft07 as JSONSchema,\n JsonError,\n JsonSchema,\n} from 'json-schema-library';\nimport { createFieldValidation, extractSchemaFromStep } from '../../lib';\nimport {\n CustomFieldValidator,\n FieldExtensionUiSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport { isObject } from './utils';\n\n/** @alpha */\nexport type FormValidation = {\n [name: string]: FieldValidation | FormValidation;\n};\n\nconst isJsonError = (\n value: JsonError | JsonSchema,\n): value is { type: 'error'; message: string } =>\n 'type' in value && value.type === 'error';\n\n/** @alpha */\nexport const createAsyncValidators = (\n rootSchema: JsonObject,\n validators: Record<\n string,\n undefined | CustomFieldValidator<unknown, unknown>\n >,\n context: {\n apiHolder: ApiHolder;\n },\n) => {\n async function validate(\n formData: JsonObject,\n pathPrefix: string = '#',\n current: JsonObject = formData,\n ): Promise<FormValidation> {\n const parsedSchema = new JSONSchema(rootSchema);\n const formValidation: FormValidation = {};\n\n const validateForm = async (\n validatorName: string,\n key: string,\n value: JsonValue | undefined,\n schema: JsonObject,\n uiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n const validator = validators[validatorName];\n if (validator) {\n const fieldValidation = createFieldValidation();\n try {\n await validator(value, fieldValidation, {\n ...context,\n formData,\n schema,\n uiSchema,\n });\n } catch (ex) {\n fieldValidation.addError(ex.message);\n }\n formValidation[key] = fieldValidation;\n }\n };\n\n for (const [key, value] of Object.entries(current)) {\n const pointer = `${pathPrefix}/${key}`;\n const definitionInSchema = parsedSchema.getSchema({\n pointer,\n data: formData,\n });\n\n if (!definitionInSchema) {\n continue;\n }\n\n if (isJsonError(definitionInSchema)) {\n throw new Error(definitionInSchema.message);\n }\n\n const { schema, uiSchema } = extractSchemaFromStep(\n definitionInSchema as JsonObject,\n );\n\n const hasItems = definitionInSchema && definitionInSchema.items;\n\n const doValidateItem = async (\n propValue: JsonObject,\n itemSchema: JsonObject,\n itemUiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n await validateForm(\n propValue['ui:field'] as string,\n key,\n value,\n itemSchema,\n itemUiSchema,\n );\n };\n\n const doValidate = async (propValue: JsonObject) => {\n if ('ui:field' in propValue) {\n const { schema: itemsSchema, uiSchema: itemsUiSchema } =\n extractSchemaFromStep(definitionInSchema.items);\n await doValidateItem(propValue, itemsSchema, itemsUiSchema);\n }\n };\n\n if ('ui:field' in definitionInSchema) {\n await doValidateItem(definitionInSchema, schema, uiSchema);\n } else if (hasItems && 'ui:field' in definitionInSchema.items) {\n await doValidate(definitionInSchema.items);\n } else if (hasItems && definitionInSchema.items.type === 'object') {\n const properties = (definitionInSchema.items?.properties ??\n []) as JsonObject[];\n for (const [, propValue] of Object.entries(properties)) {\n await doValidate(propValue);\n }\n } else if (isObject(value)) {\n formValidation[key] = await validate(formData, pointer, value);\n }\n }\n\n return formValidation;\n }\n\n return async (formData: JsonObject) => {\n return await validate(formData);\n };\n};\n"],"names":["JSONSchema"],"mappings":";;;;AAoCA,MAAM,cAAc,CAClB,KAAA,KAEA,MAAU,IAAA,KAAA,IAAS,MAAM,IAAS,KAAA,OAAA;AAG7B,MAAM,qBAAwB,GAAA,CACnC,UACA,EAAA,UAAA,EAIA,OAGG,KAAA;AACH,EAAA,eAAe,QACb,CAAA,QAAA,EACA,UAAqB,GAAA,GAAA,EACrB,UAAsB,QACG,EAAA;AACzB,IAAM,MAAA,YAAA,GAAe,IAAIA,OAAA,CAAW,UAAU,CAAA;AAC9C,IAAA,MAAM,iBAAiC,EAAC;AAExC,IAAA,MAAM,eAAe,OACnB,aAAA,EACA,GACA,EAAA,KAAA,EACA,QACA,QACG,KAAA;AACH,MAAM,MAAA,SAAA,GAAY,WAAW,aAAa,CAAA;AAC1C,MAAA,IAAI,SAAW,EAAA;AACb,QAAA,MAAM,kBAAkB,qBAAsB,EAAA;AAC9C,QAAI,IAAA;AACF,UAAM,MAAA,SAAA,CAAU,OAAO,eAAiB,EAAA;AAAA,YACtC,GAAG,OAAA;AAAA,YACH,QAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,iBACM,EAAI,EAAA;AACX,UAAgB,eAAA,CAAA,QAAA,CAAS,GAAG,OAAO,CAAA;AAAA;AAErC,QAAA,cAAA,CAAe,GAAG,CAAI,GAAA,eAAA;AAAA;AACxB,KACF;AAEA,IAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,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AW,mBAAmB,KAAK,CAAA;AAAA,OAChC,MAAA,IAAA,QAAA,IAAY,kBAAmB,CAAA,KAAA,CAAM,SAAS,QAAU,EAAA;AACjE,QAAA,MAAM,UAAc,GAAA,kBAAA,CAAmB,KAAO,EAAA,UAAA,IAC5C,EAAC;AACH,QAAA,KAAA,MAAW,GAAG,SAAS,KAAK,MAAO,CAAA,OAAA,CAAQ,UAAU,CAAG,EAAA;AACtD,UAAA,MAAM,WAAW,SAAS,CAAA;AAAA;AAC5B,OACF,MAAA,IAAW,QAAS,CAAA,KAAK,CAAG,EAAA;AAC1B,QAAA,cAAA,CAAe,GAAG,CAAI,GAAA,MAAM,QAAS,CAAA,QAAA,EAAU,SAAS,KAAK,CAAA;AAAA;AAC/D;AAGF,IAAO,OAAA,cAAA;AAAA;AAGT,EAAA,OAAO,OAAO,QAAyB,KAAA;AACrC,IAAO,OAAA,MAAM,SAAS,QAAQ,CAAA;AAAA,GAChC;AACF;;;;"}
1
+ {"version":3,"file":"createAsyncValidators.esm.js","sources":["../../../../src/next/components/Stepper/createAsyncValidators.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 */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport type { JsonObject, JsonValue } from '@backstage/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport {\n Draft07 as JSONSchema,\n JsonError,\n JsonSchema,\n} from 'json-schema-library';\nimport { createFieldValidation, extractSchemaFromStep } from '../../lib';\nimport {\n CustomFieldValidator,\n FieldExtensionUiSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport { isObject } from './utils';\n\n/** @alpha */\nexport type FormValidation = {\n [name: string]: FieldValidation | FormValidation;\n};\n\nconst isJsonError = (\n value: JsonError | JsonSchema,\n): value is { type: 'error'; message: string } =>\n 'type' in value && value.type === 'error';\n\n/** @alpha */\nexport const createAsyncValidators = (\n rootSchema: JsonObject,\n validators: Record<\n string,\n undefined | CustomFieldValidator<unknown, unknown>\n >,\n context: {\n apiHolder: ApiHolder;\n },\n) => {\n async function validate(\n formData: JsonObject,\n pathPrefix: string = '#',\n current: JsonObject = formData,\n ): Promise<FormValidation> {\n const parsedSchema = new JSONSchema(rootSchema);\n const formValidation: FormValidation = {};\n\n const validateForm = async (\n validatorName: string,\n key: string,\n value: JsonValue | undefined,\n schema: JsonObject,\n uiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n const validator = validators[validatorName];\n if (validator) {\n const fieldValidation = createFieldValidation();\n try {\n await validator(value, fieldValidation, {\n ...context,\n formData,\n schema,\n uiSchema,\n });\n } catch (ex) {\n fieldValidation.addError(ex.message);\n }\n formValidation[key] = fieldValidation;\n }\n };\n\n for (const [key, value] of Object.entries(current)) {\n const pointer = `${pathPrefix}/${key}`;\n const definitionInSchema = parsedSchema.getSchema({\n pointer,\n data: formData,\n });\n\n if (!definitionInSchema) {\n continue;\n }\n\n if (isJsonError(definitionInSchema)) {\n throw new Error(definitionInSchema.message);\n }\n\n const { schema, uiSchema } = extractSchemaFromStep(\n definitionInSchema as JsonObject,\n );\n\n const hasItems = definitionInSchema && definitionInSchema.items;\n\n const doValidateItem = async (\n propValue: JsonObject,\n itemSchema: JsonObject,\n itemUiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n await validateForm(\n propValue['ui:field'] as string,\n key,\n value,\n itemSchema,\n itemUiSchema,\n );\n };\n\n const doValidate = async (propValue: JsonObject) => {\n if ('ui:field' in propValue) {\n const { schema: itemsSchema, uiSchema: itemsUiSchema } =\n extractSchemaFromStep(definitionInSchema.items);\n await doValidateItem(propValue, itemsSchema, itemsUiSchema);\n }\n };\n\n if ('ui:field' in definitionInSchema) {\n await doValidateItem(definitionInSchema, schema, uiSchema);\n } else if (hasItems && 'ui:field' in definitionInSchema.items) {\n await doValidate(definitionInSchema.items);\n } else if (hasItems && definitionInSchema.items.type === 'object') {\n const properties = (definitionInSchema.items?.properties ??\n []) as JsonObject[];\n for (const [, propValue] of Object.entries(properties)) {\n await doValidate(propValue);\n }\n if (Array.isArray(value)) {\n for (const [_, v] of Object.entries(value)) {\n const { schema: itemSchema, uiSchema: itemUiSchema } =\n extractSchemaFromStep(definitionInSchema.items);\n\n if (isObject(v)) {\n for (const [pK, pV] of Object.entries(v)) {\n if ('ui:field' in itemUiSchema[pK]) {\n await validateForm(\n itemUiSchema[pK]['ui:field'],\n pK,\n pV,\n itemSchema,\n itemUiSchema,\n );\n }\n }\n }\n }\n }\n } else if (isObject(value)) {\n formValidation[key] = await validate(formData, pointer, value);\n }\n }\n\n return formValidation;\n }\n\n return async (formData: JsonObject) => {\n return await validate(formData);\n };\n};\n"],"names":["JSONSchema"],"mappings":";;;;AAoCA,MAAM,cAAc,CAClB,KAAA,KAEA,MAAU,IAAA,KAAA,IAAS,MAAM,IAAS,KAAA,OAAA;AAG7B,MAAM,qBAAwB,GAAA,CACnC,UACA,EAAA,UAAA,EAIA,OAGG,KAAA;AACH,EAAA,eAAe,QACb,CAAA,QAAA,EACA,UAAqB,GAAA,GAAA,EACrB,UAAsB,QACG,EAAA;AACzB,IAAM,MAAA,YAAA,GAAe,IAAIA,OAAA,CAAW,UAAU,CAAA;AAC9C,IAAA,MAAM,iBAAiC,EAAC;AAExC,IAAA,MAAM,eAAe,OACnB,aAAA,EACA,GACA,EAAA,KAAA,EACA,QACA,QACG,KAAA;AACH,MAAM,MAAA,SAAA,GAAY,WAAW,aAAa,CAAA;AAC1C,MAAA,IAAI,SAAW,EAAA;AACb,QAAA,MAAM,kBAAkB,qBAAsB,EAAA;AAC9C,QAAI,IAAA;AACF,UAAM,MAAA,SAAA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AA,oBACA,UAAA;AAAA,oBACA;AAAA,mBACF;AAAA;AACF;AACF;AACF;AACF;AACF,OACF,MAAA,IAAW,QAAS,CAAA,KAAK,CAAG,EAAA;AAC1B,QAAA,cAAA,CAAe,GAAG,CAAI,GAAA,MAAM,QAAS,CAAA,QAAA,EAAU,SAAS,KAAK,CAAA;AAAA;AAC/D;AAGF,IAAO,OAAA,cAAA;AAAA;AAGT,EAAA,OAAO,OAAO,QAAyB,KAAA;AACrC,IAAO,OAAA,MAAM,SAAS,QAAQ,CAAA;AAAA,GAChC;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.14.3-next.1",
3
+ "version": "1.14.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,17 +66,17 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/catalog-client": "1.9.0",
70
- "@backstage/catalog-model": "1.7.2",
71
- "@backstage/core-components": "0.16.2",
72
- "@backstage/core-plugin-api": "1.10.2",
73
- "@backstage/frontend-plugin-api": "0.9.3",
74
- "@backstage/plugin-catalog-react": "1.15.1-next.0",
75
- "@backstage/plugin-permission-react": "0.4.29",
76
- "@backstage/plugin-scaffolder-common": "1.5.8",
77
- "@backstage/theme": "0.6.3",
78
- "@backstage/types": "1.2.0",
79
- "@backstage/version-bridge": "1.0.10",
69
+ "@backstage/catalog-client": "^1.9.1",
70
+ "@backstage/catalog-model": "^1.7.3",
71
+ "@backstage/core-components": "^0.16.3",
72
+ "@backstage/core-plugin-api": "^1.10.3",
73
+ "@backstage/frontend-plugin-api": "^0.9.4",
74
+ "@backstage/plugin-catalog-react": "^1.15.1",
75
+ "@backstage/plugin-permission-react": "^0.4.30",
76
+ "@backstage/plugin-scaffolder-common": "^1.5.9",
77
+ "@backstage/theme": "^0.6.3",
78
+ "@backstage/types": "^1.2.1",
79
+ "@backstage/version-bridge": "^1.0.10",
80
80
  "@material-ui/core": "^4.12.2",
81
81
  "@material-ui/icons": "^4.9.1",
82
82
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -102,12 +102,12 @@
102
102
  "zod-to-json-schema": "^3.20.4"
103
103
  },
104
104
  "devDependencies": {
105
- "@backstage/cli": "0.29.5-next.0",
106
- "@backstage/core-app-api": "1.15.3",
107
- "@backstage/plugin-catalog": "1.26.1-next.0",
108
- "@backstage/plugin-catalog-common": "1.1.2",
109
- "@backstage/plugin-permission-common": "0.8.3",
110
- "@backstage/test-utils": "1.7.3",
105
+ "@backstage/cli": "^0.29.5",
106
+ "@backstage/core-app-api": "^1.15.4",
107
+ "@backstage/plugin-catalog": "^1.26.1",
108
+ "@backstage/plugin-catalog-common": "^1.1.3",
109
+ "@backstage/plugin-permission-common": "^0.8.4",
110
+ "@backstage/test-utils": "^1.7.4",
111
111
  "@testing-library/dom": "^10.0.0",
112
112
  "@testing-library/jest-dom": "^6.0.0",
113
113
  "@testing-library/react": "^16.0.0",