@backstage/plugin-scaffolder-react 1.14.0 → 1.14.2-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,28 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.14.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3c62a50: Experimental support for `formDecorators` to enable secret collection and mutations to the parameters for scaffolder tasks
8
+ - c4ffd13: Added the autocomplete feature to GitlabRepoUrlPicker
9
+ - 9951ba4: Updated dependency `@rjsf/utils` to `5.23.1`.
10
+ Updated dependency `@rjsf/core` to `5.23.1`.
11
+ Updated dependency `@rjsf/material-ui` to `5.23.1`.
12
+ Updated dependency `@rjsf/validator-ajv8` to `5.23.1`.
13
+ - Updated dependencies
14
+ - @backstage/plugin-scaffolder-common@1.5.8-next.0
15
+ - @backstage/plugin-catalog-react@1.14.3-next.0
16
+ - @backstage/frontend-plugin-api@0.9.3-next.0
17
+ - @backstage/theme@0.6.3-next.0
18
+ - @backstage/catalog-client@1.8.1-next.0
19
+ - @backstage/catalog-model@1.7.1
20
+ - @backstage/core-components@0.16.2-next.0
21
+ - @backstage/core-plugin-api@1.10.1
22
+ - @backstage/types@1.2.0
23
+ - @backstage/version-bridge@1.0.10
24
+ - @backstage/plugin-permission-react@0.4.28
25
+
3
26
  ## 1.14.0
4
27
 
5
28
  ### Minor Changes
package/dist/alpha.d.ts CHANGED
@@ -5,7 +5,7 @@ import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactEleme
5
5
  import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
6
6
  import { UiSchema, FieldValidation, WidgetProps } from '@rjsf/utils';
7
7
  import { TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, CustomFieldValidator, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep, FieldExtensionComponentProps, FieldSchema } from '@backstage/plugin-scaffolder-react';
8
- import { ApiHolder, IconComponent } from '@backstage/core-plugin-api';
8
+ import { ApiHolder, IconComponent, AnyApiRef } from '@backstage/core-plugin-api';
9
9
  import { Overrides } from '@material-ui/core/styles/overrides';
10
10
  import { StyleRules } from '@material-ui/core/styles/withStyles';
11
11
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
@@ -294,9 +294,9 @@ declare const useFormDataFromQuery: (initialState?: Record<string, JsonValue>) =
294
294
  * @alpha
295
295
  */
296
296
  declare const useTemplateParameterSchema: (templateRef: string) => {
297
- manifest: TemplateParameterSchema | undefined;
297
+ manifest?: TemplateParameterSchema | undefined;
298
298
  loading: boolean;
299
- error: Error | undefined;
299
+ error?: Error | undefined;
300
300
  };
301
301
 
302
302
  /**
@@ -374,4 +374,45 @@ declare const FormFieldBlueprint: _backstage_frontend_plugin_api.ExtensionBluepr
374
374
  */
375
375
  declare function createFormField<TReturnValue extends z.ZodType, TUiOptions extends z.ZodType>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField;
376
376
 
377
- export { type BackstageOverrides, type BackstageTemplateStepperClassKey, DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormFieldBlueprint, type FormFieldExtensionData, type FormValidation, type ParsedTemplateSchema, ReviewState, type ReviewStateProps, ScaffolderField, type ScaffolderFieldProps, 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, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
377
+ /** @alpha */
378
+ type ScaffolderFormDecoratorContext<TInput extends JsonObject = JsonObject> = {
379
+ input: TInput;
380
+ formState: Record<string, JsonValue>;
381
+ setFormState: (fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>) => void;
382
+ setSecrets: (fn: (currentState: Record<string, string>) => Record<string, string>) => void;
383
+ };
384
+ /** @alpha */
385
+ type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {
386
+ readonly $$type: '@backstage/scaffolder/FormDecorator';
387
+ readonly id: string;
388
+ readonly TInput: TInput;
389
+ };
390
+ /**
391
+ * Method for creating decorators which can be used to collect
392
+ * secrets from the user before submitting to the backend.
393
+ * @alpha
394
+ */
395
+ declare function createScaffolderFormDecorator<TInputSchema extends {
396
+ [key in string]: (zImpl: typeof z) => z.ZodType;
397
+ } = {
398
+ [key in string]: (zImpl: typeof z) => z.ZodType;
399
+ }, TDeps extends {
400
+ [key in string]: AnyApiRef;
401
+ } = {
402
+ [key in string]: AnyApiRef;
403
+ }, TInput extends JsonObject = {
404
+ [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;
405
+ }>(options: {
406
+ id: string;
407
+ schema?: {
408
+ input?: TInputSchema;
409
+ };
410
+ deps?: TDeps;
411
+ decorator: (ctx: ScaffolderFormDecoratorContext<TInput>, deps: TDeps extends {
412
+ [key in string]: AnyApiRef;
413
+ } ? {
414
+ [key in keyof TDeps]: TDeps[key]['T'];
415
+ } : never) => Promise<void>;
416
+ }): ScaffolderFormDecorator<TInput>;
417
+
418
+ 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, 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, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
package/dist/alpha.esm.js CHANGED
@@ -19,4 +19,5 @@ export { useTemplateSchema } from './next/hooks/useTemplateSchema.esm.js';
19
19
  export { useTemplateParameterSchema } from './next/hooks/useTemplateParameterSchema.esm.js';
20
20
  export { useFilteredSchemaProperties } from './next/hooks/useFilteredSchemaProperties.esm.js';
21
21
  export { FormFieldBlueprint, createFormField } from './next/blueprints/FormFieldBlueprint.esm.js';
22
+ export { createScaffolderFormDecorator } from './next/extensions/createScaffolderFormDecorator.esm.js';
22
23
  //# 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":";;;;;;;;;;;;;;;;;;;;;"}
@@ -22,4 +22,4 @@ attachComponentData(
22
22
  );
23
23
 
24
24
  export { ScaffolderFieldExtensions, createScaffolderFieldExtension };
25
- //# sourceMappingURL=index.esm.js.map
25
+ //# sourceMappingURL=createScaffolderFieldExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createScaffolderFieldExtension.esm.js","sources":["../../src/extensions/createScaffolderFieldExtension.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { UIOptionsType } from '@rjsf/utils';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps extends UIOptionsType = {},\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\nexport type {\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n};\n\nexport * from './rjsf';\n"],"names":[],"mappings":";;;AAgCO,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA;AAAA,OACF;AAEA,MAAO,OAAA,wBAAA;AAAA;AACT,GACF;AACF;AAOO,MAAM,4BAET,MAA0B;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA;AACF,CAAA;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ApiHolder, Extension } from '@backstage/core-plugin-api';
3
- import React__default, { HTMLAttributes, ReactNode, ComponentType, FormEvent, ElementType, Ref, PropsWithChildren } from 'react';
3
+ import React__default, { HTMLAttributes, ReactNode, FormEvent, ElementType, Ref, ComponentType, PropsWithChildren } from 'react';
4
4
  import { JsonObject, JsonValue, Observable } from '@backstage/types';
5
5
  import { JSONSchema7 } from 'json-schema';
6
- import { StrictRJSFSchema, RJSFSchema, FormContextType, GenericObjectType, UiSchema, IdSchema, ErrorSchema, Registry, ValidatorType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorTransformer, Experimental_DefaultFormStateBehavior, FieldValidation, UIOptionsType } from '@rjsf/utils';
6
+ import { StrictRJSFSchema, RJSFSchema, FormContextType, GenericObjectType, UiSchema, IdSchema, ErrorSchema, Registry, ValidatorType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorTransformer, Experimental_DefaultFormStateBehavior, UIOptionsType, FieldValidation } from '@rjsf/utils';
7
7
  import Form, { IChangeEvent, FormProps as FormProps$1 } from '@rjsf/core';
8
8
  import { TemplateEntityV1beta3, TemplatePresentationV1beta3, TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common';
9
9
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
@@ -348,6 +348,10 @@ type TemplateParameterSchema = {
348
348
  description?: string;
349
349
  schema: JsonObject;
350
350
  }>;
351
+ EXPERIMENTAL_formDecorators?: {
352
+ id: string;
353
+ input?: JsonObject;
354
+ }[];
351
355
  };
352
356
 
353
357
  /**
@@ -574,7 +578,8 @@ interface ScaffolderApi {
574
578
  context?: Record<string, string>;
575
579
  }): Promise<{
576
580
  results: {
577
- title: string;
581
+ title?: string;
582
+ id: string;
578
583
  }[];
579
584
  }>;
580
585
  }
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ScaffolderFieldExtensions, createScaffolderFieldExtension } from './extensions/index.esm.js';
1
+ export { ScaffolderFieldExtensions, createScaffolderFieldExtension } from './extensions/createScaffolderFieldExtension.esm.js';
2
2
  export { SecretsContextProvider, useTemplateSecrets } from './secrets/SecretsContext.esm.js';
3
3
  export { scaffolderApiRef } from './api/ref.esm.js';
4
4
  export { useCustomFieldExtensions } from './hooks/useCustomFieldExtensions.esm.js';
@@ -1,5 +1,6 @@
1
1
  import { createExtensionDataRef, createExtensionBlueprint } from '@backstage/frontend-plugin-api';
2
2
  import { OpaqueFormField } from '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
3
+ import '../../packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js';
3
4
 
4
5
  const formFieldExtensionDataRef = createExtensionDataRef().with({
5
6
  id: "scaffolder.form-field-loader"
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldBlueprint.esm.js","sources":["../../../src/next/blueprints/FormFieldBlueprint.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 { z } from 'zod';\n\nimport { OpaqueFormField, FormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\n\nconst formFieldExtensionDataRef = createExtensionDataRef<\n () => Promise<FormField>\n>().with({\n id: 'scaffolder.form-field-loader',\n});\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormFieldBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-field',\n attachTo: { id: 'api:scaffolder/form-fields', input: 'formFields' },\n dataRefs: {\n formFieldLoader: formFieldExtensionDataRef,\n },\n output: [formFieldExtensionDataRef],\n *factory(params: { field: () => Promise<FormField> }) {\n yield formFieldExtensionDataRef(params.field);\n },\n});\n\n/**\n * @alpha\n * Used to create a form field binding with typechecking for compliance\n */\nexport function createFormField<\n TReturnValue extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField {\n return OpaqueFormField.createInstance('v1', opts);\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,yBAAA,GAA4B,sBAEhC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,EACzD,IAAM,EAAA,uBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,4BAAA,EAA8B,OAAO,YAAa,EAAA;AAAA,EAClE,QAAU,EAAA;AAAA,IACR,eAAiB,EAAA;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAA6C,EAAA;AACpD,IAAM,MAAA,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA;AAEhD,CAAC;AAMM,SAAS,gBAGd,IAAmE,EAAA;AACnE,EAAO,OAAA,eAAA,CAAgB,cAAe,CAAA,IAAA,EAAM,IAAI,CAAA;AAClD;;;;"}
1
+ {"version":3,"file":"FormFieldBlueprint.esm.js","sources":["../../../src/next/blueprints/FormFieldBlueprint.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 { z } from 'zod';\n\nimport { OpaqueFormField, FormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\n\nconst formFieldExtensionDataRef = createExtensionDataRef<\n () => Promise<FormField>\n>().with({\n id: 'scaffolder.form-field-loader',\n});\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormFieldBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-field',\n attachTo: { id: 'api:scaffolder/form-fields', input: 'formFields' },\n dataRefs: {\n formFieldLoader: formFieldExtensionDataRef,\n },\n output: [formFieldExtensionDataRef],\n *factory(params: { field: () => Promise<FormField> }) {\n yield formFieldExtensionDataRef(params.field);\n },\n});\n\n/**\n * @alpha\n * Used to create a form field binding with typechecking for compliance\n */\nexport function createFormField<\n TReturnValue extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField {\n return OpaqueFormField.createInstance('v1', opts);\n}\n"],"names":[],"mappings":";;;;AAwBA,MAAM,yBAAA,GAA4B,sBAEhC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,EACzD,IAAM,EAAA,uBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,4BAAA,EAA8B,OAAO,YAAa,EAAA;AAAA,EAClE,QAAU,EAAA;AAAA,IACR,eAAiB,EAAA;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAA6C,EAAA;AACpD,IAAM,MAAA,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA;AAEhD,CAAC;AAMM,SAAS,gBAGd,IAAmE,EAAA;AACnE,EAAO,OAAA,eAAA,CAAgB,cAAe,CAAA,IAAA,EAAM,IAAI,CAAA;AAClD;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Content, ContentHeader, ItemCardGrid } from '@backstage/core-components';
2
+ import { Content, ItemCardGrid, ContentHeader } from '@backstage/core-components';
3
3
  import { stringifyEntityRef } from '@backstage/catalog-model';
4
4
  import { TemplateCard } from '../TemplateCard/TemplateCard.esm.js';
5
5
 
@@ -0,0 +1,12 @@
1
+ import { OpaqueFormDecorator } from '../../packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js';
2
+ import '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
3
+
4
+ function createScaffolderFormDecorator(options) {
5
+ return OpaqueFormDecorator.createInstance("v1", {
6
+ ...options,
7
+ TInput: null
8
+ });
9
+ }
10
+
11
+ export { createScaffolderFormDecorator };
12
+ //# sourceMappingURL=createScaffolderFormDecorator.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createScaffolderFormDecorator.esm.js","sources":["../../../src/next/extensions/createScaffolderFormDecorator.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 { AnyApiRef } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { z } from 'zod';\n\n/** @alpha */\nexport type ScaffolderFormDecoratorContext<\n TInput extends JsonObject = JsonObject,\n> = {\n input: TInput;\n formState: Record<string, JsonValue>;\n\n setFormState: (\n fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>,\n ) => void;\n setSecrets: (\n fn: (currentState: Record<string, string>) => Record<string, string>,\n ) => void;\n};\n\n/** @alpha */\nexport type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {\n readonly $$type: '@backstage/scaffolder/FormDecorator';\n readonly id: string;\n readonly TInput: TInput;\n};\n\n/**\n * Method for creating decorators which can be used to collect\n * secrets from the user before submitting to the backend.\n * @alpha\n */\nexport function createScaffolderFormDecorator<\n TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType } = {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n TDeps extends { [key in string]: AnyApiRef } = { [key in string]: AnyApiRef },\n TInput extends JsonObject = {\n [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;\n },\n>(options: {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext<TInput>,\n deps: TDeps extends { [key in string]: AnyApiRef }\n ? { [key in keyof TDeps]: TDeps[key]['T'] }\n : never,\n ) => Promise<void>;\n}): ScaffolderFormDecorator<TInput> {\n return OpaqueFormDecorator.createInstance('v1', {\n ...options,\n TInput: null as unknown as TInput,\n } as {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n TInput: TInput;\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [key in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n });\n}\n"],"names":[],"mappings":";;;AA+CO,SAAS,8BAQd,OAYkC,EAAA;AAClC,EAAO,OAAA,mBAAA,CAAoB,eAAe,IAAM,EAAA;AAAA,IAC9C,GAAG,OAAA;AAAA,IACH,MAAQ,EAAA;AAAA,GAYT,CAAA;AACH;;;;"}
@@ -4,12 +4,16 @@ import { useApi } from '@backstage/core-plugin-api';
4
4
 
5
5
  const useTemplateParameterSchema = (templateRef) => {
6
6
  const scaffolderApi = useApi(scaffolderApiRef);
7
- const { value, loading, error } = useAsync(
7
+ const {
8
+ value: manifest,
9
+ loading,
10
+ error
11
+ } = useAsync(
8
12
  () => scaffolderApi.getTemplateParameterSchema(templateRef),
9
13
  [scaffolderApi, templateRef]
10
14
  );
11
15
  return {
12
- manifest: value,
16
+ manifest,
13
17
  loading,
14
18
  error
15
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplateParameterSchema.esm.js","sources":["../../../src/next/hooks/useTemplateParameterSchema.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 */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (templateRef: string) => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const { value, loading, error } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return {\n manifest: value as TemplateParameterSchema | undefined,\n loading,\n error,\n };\n};\n"],"names":[],"mappings":";;;;AAwBa,MAAA,0BAAA,GAA6B,CAAC,WAAwB,KAAA;AACjE,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,MAAM,aAAc,CAAA,0BAAA,CAA2B,WAAW,CAAA;AAAA,IAC1D,CAAC,eAAe,WAAW;AAAA,GAC7B;AAEA,EAAO,OAAA;AAAA,IACL,QAAU,EAAA,KAAA;AAAA,IACV,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useTemplateParameterSchema.esm.js","sources":["../../../src/next/hooks/useTemplateParameterSchema.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 */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (\n templateRef: string,\n): { manifest?: TemplateParameterSchema; loading: boolean; error?: Error } => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const {\n value: manifest,\n loading,\n error,\n } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return {\n manifest,\n loading,\n error,\n };\n};\n"],"names":[],"mappings":";;;;AAwBa,MAAA,0BAAA,GAA6B,CACxC,WAC4E,KAAA;AAC5E,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACE,GAAA,QAAA;AAAA,IACF,MAAM,aAAc,CAAA,0BAAA,CAA2B,WAAW,CAAA;AAAA,IAC1D,CAAC,eAAe,WAAW;AAAA,GAC7B;AAEA,EAAO,OAAA;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,6 @@
1
+ import { OpaqueType } from '../../../opaque-internal/src/OpaqueType.esm.js';
2
+
3
+ const OpaqueFormDecorator = OpaqueType.create({ type: "@backstage/scaffolder/FormDecorator", versions: ["v1"] });
4
+
5
+ export { OpaqueFormDecorator };
6
+ //# sourceMappingURL=InternalFormDecorator.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalFormDecorator.esm.js","sources":["../../../../../../../packages/scaffolder-internal/src/wiring/InternalFormDecorator.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 { OpaqueType } from '@internal/opaque';\nimport { z } from 'zod';\n\nimport {\n ScaffolderFormDecorator,\n ScaffolderFormDecoratorContext,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { AnyApiRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport const OpaqueFormDecorator = OpaqueType.create<{\n public: ScaffolderFormDecorator;\n versions: {\n readonly version: 'v1';\n readonly id: string;\n readonly schema?: {\n input?: {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n };\n };\n readonly deps?: { [key in string]: AnyApiRef };\n readonly decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [depName in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n };\n}>({ type: '@backstage/scaffolder/FormDecorator', versions: ['v1'] });\n"],"names":[],"mappings":";;AAyBa,MAAA,mBAAA,GAAsB,UAAW,CAAA,MAAA,CAgB3C,EAAE,IAAA,EAAM,uCAAuC,QAAU,EAAA,CAAC,IAAI,CAAA,EAAG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { createVersionedContext, createVersionedValueMap } from '@backstage/version-bridge';
2
- import React, { useContext, useCallback, useState } from 'react';
2
+ import React, { useState, useContext, useCallback } from 'react';
3
3
 
4
4
  const SecretsContext = createVersionedContext("secrets-context");
5
5
  const SecretsContextProvider = (props) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.14.0",
3
+ "version": "1.14.2-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,25 +66,25 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/catalog-client": "^1.8.0",
70
- "@backstage/catalog-model": "^1.7.1",
71
- "@backstage/core-components": "^0.16.0",
72
- "@backstage/core-plugin-api": "^1.10.1",
73
- "@backstage/frontend-plugin-api": "^0.9.1",
74
- "@backstage/plugin-catalog-react": "^1.14.1",
75
- "@backstage/plugin-permission-react": "^0.4.28",
76
- "@backstage/plugin-scaffolder-common": "^1.5.7",
77
- "@backstage/theme": "^0.6.1",
78
- "@backstage/types": "^1.2.0",
79
- "@backstage/version-bridge": "^1.0.10",
69
+ "@backstage/catalog-client": "1.8.1-next.0",
70
+ "@backstage/catalog-model": "1.7.1",
71
+ "@backstage/core-components": "0.16.2-next.0",
72
+ "@backstage/core-plugin-api": "1.10.1",
73
+ "@backstage/frontend-plugin-api": "0.9.3-next.0",
74
+ "@backstage/plugin-catalog-react": "1.14.3-next.0",
75
+ "@backstage/plugin-permission-react": "0.4.28",
76
+ "@backstage/plugin-scaffolder-common": "1.5.8-next.0",
77
+ "@backstage/theme": "0.6.3-next.0",
78
+ "@backstage/types": "1.2.0",
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",
83
83
  "@react-hookz/web": "^24.0.0",
84
- "@rjsf/core": "5.21.2",
85
- "@rjsf/material-ui": "5.21.2",
86
- "@rjsf/utils": "5.21.2",
87
- "@rjsf/validator-ajv8": "5.21.2",
84
+ "@rjsf/core": "5.23.1",
85
+ "@rjsf/material-ui": "5.23.1",
86
+ "@rjsf/utils": "5.23.1",
87
+ "@rjsf/validator-ajv8": "5.23.1",
88
88
  "@types/json-schema": "^7.0.9",
89
89
  "ajv-errors": "^3.0.0",
90
90
  "classnames": "^2.2.6",
@@ -102,12 +102,12 @@
102
102
  "zod-to-json-schema": "^3.20.4"
103
103
  },
104
104
  "devDependencies": {
105
- "@backstage/cli": "^0.29.0",
106
- "@backstage/core-app-api": "^1.15.2",
107
- "@backstage/plugin-catalog": "^1.25.0",
108
- "@backstage/plugin-catalog-common": "^1.1.1",
109
- "@backstage/plugin-permission-common": "^0.8.2",
110
- "@backstage/test-utils": "^1.7.1",
105
+ "@backstage/cli": "0.29.3-next.0",
106
+ "@backstage/core-app-api": "1.15.3-next.0",
107
+ "@backstage/plugin-catalog": "1.25.2-next.0",
108
+ "@backstage/plugin-catalog-common": "1.1.1",
109
+ "@backstage/plugin-permission-common": "0.8.2",
110
+ "@backstage/test-utils": "1.7.3-next.0",
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",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/extensions/index.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { UIOptionsType } from '@rjsf/utils';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps extends UIOptionsType = {},\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\nexport type {\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n};\n\nexport * from './rjsf';\n"],"names":[],"mappings":";;;AAgCO,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA;AAAA,OACF;AAEA,MAAO,OAAA,wBAAA;AAAA;AACT,GACF;AACF;AAOO,MAAM,4BAET,MAA0B;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA;AACF,CAAA;;;;"}