@backstage/plugin-scaffolder-react 1.14.3-next.2 → 1.14.4-next.0

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.4-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3edf7e7: Add schema output return type to the `makeFieldSchema` function return
8
+ - Updated dependencies
9
+ - @backstage/frontend-plugin-api@0.9.5-next.0
10
+ - @backstage/catalog-client@1.9.1
11
+ - @backstage/catalog-model@1.7.3
12
+ - @backstage/core-components@0.16.3
13
+ - @backstage/core-plugin-api@1.10.3
14
+ - @backstage/theme@0.6.3
15
+ - @backstage/types@1.2.1
16
+ - @backstage/version-bridge@1.0.10
17
+ - @backstage/plugin-catalog-react@1.15.2-next.0
18
+ - @backstage/plugin-permission-react@0.4.30
19
+ - @backstage/plugin-scaffolder-common@1.5.9
20
+
21
+ ## 1.14.3
22
+
23
+ ### Patch Changes
24
+
25
+ - 91bb99a: Fix field extension validation not working when field is in dependencies in an array field
26
+ - d8f9079: Updated dependency `@rjsf/utils` to `5.23.2`.
27
+ Updated dependency `@rjsf/core` to `5.23.2`.
28
+ Updated dependency `@rjsf/material-ui` to `5.23.2`.
29
+ Updated dependency `@rjsf/validator-ajv8` to `5.23.2`.
30
+ - 37421bc: Fixed scaffolder form fields not resolving correctly in the `useCustomFieldExtensions` hook.
31
+ - 4756287: Added support for `FormDecoratorBlueprint` to create form decorators in the Scaffolder plugin
32
+ - Updated dependencies
33
+ - @backstage/plugin-catalog-react@1.15.1
34
+ - @backstage/frontend-plugin-api@0.9.4
35
+ - @backstage/core-plugin-api@1.10.3
36
+ - @backstage/types@1.2.1
37
+ - @backstage/core-components@0.16.3
38
+ - @backstage/catalog-client@1.9.1
39
+ - @backstage/catalog-model@1.7.3
40
+ - @backstage/theme@0.6.3
41
+ - @backstage/version-bridge@1.0.10
42
+ - @backstage/plugin-permission-react@0.4.30
43
+ - @backstage/plugin-scaffolder-common@1.5.9
44
+
3
45
  ## 1.14.3-next.2
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;;;;"}
package/dist/index.d.ts CHANGED
@@ -686,6 +686,7 @@ interface FieldSchema<TReturn, TUiOptions> {
686
686
  readonly uiOptionsType: TUiOptions;
687
687
  readonly schema: CustomFieldExtensionSchema;
688
688
  readonly TProps: FieldExtensionComponentProps<TReturn, TUiOptions>;
689
+ readonly TOutput: TReturn;
689
690
  }
690
691
 
691
692
  export { type Action, type ActionExample, type CustomFieldExtensionSchema, type CustomFieldValidator, type FieldExtensionComponent, type FieldExtensionComponentProps, type FieldExtensionOptions, type FieldExtensionUiSchema, type FieldSchema, type FormProps, type LayoutComponent, type LayoutOptions, type LayoutTemplate, type ListActionsResponse, type LogEvent, type ReviewStepProps, type ScaffolderApi, type ScaffolderDryRunOptions, type ScaffolderDryRunResponse, ScaffolderFieldExtensions, type ScaffolderGetIntegrationsListOptions, type ScaffolderGetIntegrationsListResponse, ScaffolderLayouts, type ScaffolderOutputLink, type ScaffolderOutputText, type ScaffolderRJSFField, type ScaffolderRJSFFieldProps, type ScaffolderRJSFFormProps, type ScaffolderRJSFRegistryFieldsType, type ScaffolderScaffoldOptions, type ScaffolderScaffoldResponse, type ScaffolderStep, type ScaffolderStreamLogsOptions, type ScaffolderTask, type ScaffolderTaskOutput, type ScaffolderTaskStatus, type ScaffolderUseTemplateSecrets, SecretsContextProvider, type TaskStream, type TemplateGroupFilter, type TemplateParameterSchema, createScaffolderFieldExtension, createScaffolderLayout, makeFieldSchema, scaffolderApiRef, useCustomFieldExtensions, useCustomLayouts, useTaskEventStream, useTemplateSecrets };
@@ -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;;;;"}
package/dist/utils.esm.js CHANGED
@@ -5,6 +5,7 @@ function makeFieldSchema(options) {
5
5
  const { output, uiOptions } = options;
6
6
  return {
7
7
  TProps: void 0,
8
+ TOutput: void 0,
8
9
  schema: {
9
10
  returnValue: zodToJsonSchema(output(z)),
10
11
  uiOptions: uiOptions && zodToJsonSchema(uiOptions(z))
@@ -1 +1 @@
1
- {"version":3,"file":"utils.esm.js","sources":["../src/utils.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 zodToJsonSchema from 'zod-to-json-schema';\nimport { JSONSchema7 } from 'json-schema';\nimport { z } from 'zod';\nimport {\n CustomFieldExtensionSchema,\n FieldExtensionComponentProps,\n} from './extensions';\n\n/** @public */\nexport function makeFieldSchema<\n TReturnType extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(options: {\n output: (zImpl: typeof z) => TReturnType;\n uiOptions?: (zImpl: typeof z) => TUiOptions;\n}): FieldSchema<z.output<TReturnType>, z.output<TUiOptions>> {\n const { output, uiOptions } = options;\n return {\n TProps: undefined as any,\n schema: {\n returnValue: zodToJsonSchema(output(z)) as JSONSchema7,\n uiOptions: uiOptions && (zodToJsonSchema(uiOptions(z)) as JSONSchema7),\n },\n\n // These will be removed - just here for backwards compat whilst we're moving across\n type: undefined as any,\n uiOptionsType: undefined as any,\n };\n}\n\n/**\n * @public\n * FieldSchema encapsulates a JSONSchema7 along with the\n * matching FieldExtensionComponentProps type for a field extension.\n */\nexport interface FieldSchema<TReturn, TUiOptions> {\n /** @deprecated use TProps instead */\n readonly type: FieldExtensionComponentProps<TReturn, TUiOptions>;\n /** @deprecated will be removed */\n readonly uiOptionsType: TUiOptions;\n\n readonly schema: CustomFieldExtensionSchema;\n readonly TProps: FieldExtensionComponentProps<TReturn, TUiOptions>;\n}\n"],"names":[],"mappings":";;;AAyBO,SAAS,gBAGd,OAG2D,EAAA;AAC3D,EAAM,MAAA,EAAE,MAAQ,EAAA,SAAA,EAAc,GAAA,OAAA;AAC9B,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,KAAA,CAAA;AAAA,IACR,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA,eAAA,CAAgB,MAAO,CAAA,CAAC,CAAC,CAAA;AAAA,MACtC,SAAW,EAAA,SAAA,IAAc,eAAgB,CAAA,SAAA,CAAU,CAAC,CAAC;AAAA,KACvD;AAAA;AAAA,IAGA,IAAM,EAAA,KAAA,CAAA;AAAA,IACN,aAAe,EAAA,KAAA;AAAA,GACjB;AACF;;;;"}
1
+ {"version":3,"file":"utils.esm.js","sources":["../src/utils.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 zodToJsonSchema from 'zod-to-json-schema';\nimport { JSONSchema7 } from 'json-schema';\nimport { z } from 'zod';\nimport {\n CustomFieldExtensionSchema,\n FieldExtensionComponentProps,\n} from './extensions';\n\n/** @public */\nexport function makeFieldSchema<\n TReturnType extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(options: {\n output: (zImpl: typeof z) => TReturnType;\n uiOptions?: (zImpl: typeof z) => TUiOptions;\n}): FieldSchema<z.output<TReturnType>, z.output<TUiOptions>> {\n const { output, uiOptions } = options;\n return {\n TProps: undefined as any,\n TOutput: undefined as any,\n schema: {\n returnValue: zodToJsonSchema(output(z)) as JSONSchema7,\n uiOptions: uiOptions && (zodToJsonSchema(uiOptions(z)) as JSONSchema7),\n },\n\n // These will be removed - just here for backwards compat whilst we're moving across\n type: undefined as any,\n uiOptionsType: undefined as any,\n };\n}\n\n/**\n * @public\n * FieldSchema encapsulates a JSONSchema7 along with the\n * matching FieldExtensionComponentProps type for a field extension.\n */\nexport interface FieldSchema<TReturn, TUiOptions> {\n /** @deprecated use TProps instead */\n readonly type: FieldExtensionComponentProps<TReturn, TUiOptions>;\n /** @deprecated will be removed */\n readonly uiOptionsType: TUiOptions;\n\n readonly schema: CustomFieldExtensionSchema;\n readonly TProps: FieldExtensionComponentProps<TReturn, TUiOptions>;\n readonly TOutput: TReturn;\n}\n"],"names":[],"mappings":";;;AAyBO,SAAS,gBAGd,OAG2D,EAAA;AAC3D,EAAM,MAAA,EAAE,MAAQ,EAAA,SAAA,EAAc,GAAA,OAAA;AAC9B,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,KAAA,CAAA;AAAA,IACR,OAAS,EAAA,KAAA,CAAA;AAAA,IACT,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA,eAAA,CAAgB,MAAO,CAAA,CAAC,CAAC,CAAA;AAAA,MACtC,SAAW,EAAA,SAAA,IAAc,eAAgB,CAAA,SAAA,CAAU,CAAC,CAAC;AAAA,KACvD;AAAA;AAAA,IAGA,IAAM,EAAA,KAAA,CAAA;AAAA,IACN,aAAe,EAAA,KAAA;AAAA,GACjB;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.14.3-next.2",
3
+ "version": "1.14.4-next.0",
4
4
  "description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -66,16 +66,16 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/catalog-client": "1.9.1-next.0",
70
- "@backstage/catalog-model": "1.7.3-next.0",
71
- "@backstage/core-components": "0.16.3-next.0",
72
- "@backstage/core-plugin-api": "1.10.3-next.0",
73
- "@backstage/frontend-plugin-api": "0.9.4-next.0",
74
- "@backstage/plugin-catalog-react": "1.15.1-next.1",
75
- "@backstage/plugin-permission-react": "0.4.30-next.0",
76
- "@backstage/plugin-scaffolder-common": "1.5.9-next.0",
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.5-next.0",
74
+ "@backstage/plugin-catalog-react": "1.15.2-next.0",
75
+ "@backstage/plugin-permission-react": "0.4.30",
76
+ "@backstage/plugin-scaffolder-common": "1.5.9",
77
77
  "@backstage/theme": "0.6.3",
78
- "@backstage/types": "1.2.1-next.0",
78
+ "@backstage/types": "1.2.1",
79
79
  "@backstage/version-bridge": "1.0.10",
80
80
  "@material-ui/core": "^4.12.2",
81
81
  "@material-ui/icons": "^4.9.1",
@@ -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.1",
106
- "@backstage/core-app-api": "1.15.4-next.0",
107
- "@backstage/plugin-catalog": "1.26.1-next.1",
108
- "@backstage/plugin-catalog-common": "1.1.3-next.0",
109
- "@backstage/plugin-permission-common": "0.8.4-next.0",
110
- "@backstage/test-utils": "1.7.4-next.0",
105
+ "@backstage/cli": "0.30.0-next.0",
106
+ "@backstage/core-app-api": "1.15.4",
107
+ "@backstage/plugin-catalog": "1.26.2-next.0",
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",