@backstage/plugin-scaffolder-react 1.14.2-next.1 → 1.14.2-next.2

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,23 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.14.2-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 184161f: Scaffolder field extensions registered with `FormFieldBlueprint` are now collected in the `useCustomFieldExtensions` hook, enabling them for use in the scaffolder.
8
+ - Updated dependencies
9
+ - @backstage/plugin-catalog-react@1.14.3-next.2
10
+ - @backstage/catalog-client@1.9.0-next.2
11
+ - @backstage/catalog-model@1.7.2-next.0
12
+ - @backstage/core-components@0.16.2-next.2
13
+ - @backstage/core-plugin-api@1.10.2-next.0
14
+ - @backstage/frontend-plugin-api@0.9.3-next.2
15
+ - @backstage/theme@0.6.3-next.0
16
+ - @backstage/types@1.2.0
17
+ - @backstage/version-bridge@1.0.10
18
+ - @backstage/plugin-permission-react@0.4.29-next.0
19
+ - @backstage/plugin-scaffolder-common@1.5.8-next.1
20
+
3
21
  ## 1.14.2-next.1
4
22
 
5
23
  ### Patch Changes
package/dist/alpha.d.ts CHANGED
@@ -1,15 +1,96 @@
1
1
  /// <reference types="react" />
2
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
3
+ import { z } from 'zod';
4
+ import { FieldExtensionComponentProps, CustomFieldValidator, FieldSchema, TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep } from '@backstage/plugin-scaffolder-react';
2
5
  import { JsonObject, JsonValue } from '@backstage/types';
3
6
  import * as React from 'react';
4
7
  import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
5
8
  import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
6
9
  import { UiSchema, FieldValidation, WidgetProps } from '@rjsf/utils';
7
- import { TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, CustomFieldValidator, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep, FieldExtensionComponentProps, FieldSchema } from '@backstage/plugin-scaffolder-react';
8
10
  import { ApiHolder, IconComponent, AnyApiRef } from '@backstage/core-plugin-api';
9
11
  import { Overrides } from '@material-ui/core/styles/overrides';
10
12
  import { StyleRules } from '@material-ui/core/styles/withStyles';
11
- import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
12
- import { z } from 'zod';
13
+
14
+ /*
15
+ * Copyright 2024 The Backstage Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+
30
+
31
+
32
+ /** @alpha */
33
+ interface FormField {
34
+ readonly $$type: '@backstage/scaffolder/FormField';
35
+ }
36
+
37
+ /** @alpha */
38
+ declare const formFieldsApi: _backstage_frontend_plugin_api.ExtensionDefinition<{
39
+ config: {};
40
+ configInput: {};
41
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
42
+ inputs: {
43
+ formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>, {
44
+ singleton: false;
45
+ optional: false;
46
+ }>;
47
+ };
48
+ kind: "api";
49
+ name: "form-fields";
50
+ params: {
51
+ factory: _backstage_frontend_plugin_api.AnyApiFactory;
52
+ };
53
+ }>;
54
+
55
+ /** @alpha */
56
+ type FormFieldExtensionData<TReturnValue extends z.ZodType = z.ZodType, TUiOptions extends z.ZodType = z.ZodType> = {
57
+ name: string;
58
+ component: (props: FieldExtensionComponentProps<z.output<TReturnValue>, z.output<TUiOptions>>) => JSX.Element | null;
59
+ validation?: CustomFieldValidator<z.output<TReturnValue>, z.output<TUiOptions>>;
60
+ schema?: FieldSchema<z.output<TReturnValue>, z.output<TUiOptions>>;
61
+ };
62
+
63
+ /**
64
+ * @alpha
65
+ * Creates extensions that are Field Extensions for the Scaffolder
66
+ * */
67
+ declare const FormFieldBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
68
+ kind: "scaffolder-form-field";
69
+ name: undefined;
70
+ params: {
71
+ field: () => Promise<FormField>;
72
+ };
73
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
74
+ inputs: {};
75
+ config: {};
76
+ configInput: {};
77
+ dataRefs: {
78
+ formFieldLoader: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
79
+ };
80
+ }>;
81
+ /**
82
+ * @alpha
83
+ * Used to create a form field binding with typechecking for compliance
84
+ */
85
+ declare function createFormField<TReturnValue extends z.ZodType, TUiOptions extends z.ZodType>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField;
86
+
87
+ /** @alpha */
88
+ interface ScaffolderFormFieldsApi {
89
+ getFormFields(): Promise<FormFieldExtensionData[]>;
90
+ }
91
+
92
+ /** @alpha */
93
+ declare const formFieldsApiRef: _backstage_frontend_plugin_api.ApiRef<ScaffolderFormFieldsApi>;
13
94
 
14
95
  /**
15
96
  * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.
@@ -319,61 +400,6 @@ declare module '@backstage/theme' {
319
400
  }
320
401
  }
321
402
 
322
- /*
323
- * Copyright 2024 The Backstage Authors
324
- *
325
- * Licensed under the Apache License, Version 2.0 (the "License");
326
- * you may not use this file except in compliance with the License.
327
- * You may obtain a copy of the License at
328
- *
329
- * http://www.apache.org/licenses/LICENSE-2.0
330
- *
331
- * Unless required by applicable law or agreed to in writing, software
332
- * distributed under the License is distributed on an "AS IS" BASIS,
333
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334
- * See the License for the specific language governing permissions and
335
- * limitations under the License.
336
- */
337
-
338
-
339
-
340
- /** @alpha */
341
- interface FormField {
342
- readonly $$type: '@backstage/scaffolder/FormField';
343
- }
344
-
345
- /** @alpha */
346
- type FormFieldExtensionData<TReturnValue extends z.ZodType = z.ZodType, TUiOptions extends z.ZodType = z.ZodType> = {
347
- name: string;
348
- component: (props: FieldExtensionComponentProps<z.output<TReturnValue>, z.output<TUiOptions>>) => JSX.Element | null;
349
- validation?: CustomFieldValidator<z.output<TReturnValue>, z.output<TUiOptions>>;
350
- schema?: FieldSchema<z.output<TReturnValue>, z.output<TUiOptions>>;
351
- };
352
-
353
- /**
354
- * @alpha
355
- * Creates extensions that are Field Extensions for the Scaffolder
356
- * */
357
- declare const FormFieldBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
358
- kind: "scaffolder-form-field";
359
- name: undefined;
360
- params: {
361
- field: () => Promise<FormField>;
362
- };
363
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
364
- inputs: {};
365
- config: {};
366
- configInput: {};
367
- dataRefs: {
368
- formFieldLoader: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
369
- };
370
- }>;
371
- /**
372
- * @alpha
373
- * Used to create a form field binding with typechecking for compliance
374
- */
375
- declare function createFormField<TReturnValue extends z.ZodType, TUiOptions extends z.ZodType>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField;
376
-
377
403
  /** @alpha */
378
404
  type ScaffolderFormDecoratorContext<TInput extends JsonObject = JsonObject> = {
379
405
  input: TInput;
@@ -415,4 +441,4 @@ declare function createScaffolderFormDecorator<TInputSchema extends {
415
441
  } : never) => Promise<void>;
416
442
  }): ScaffolderFormDecorator<TInput>;
417
443
 
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 };
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 };
package/dist/alpha.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ export { formFieldsApi } from './next/api/FormFieldsApi.esm.js';
2
+ export { formFieldsApiRef } from './next/api/ref.esm.js';
1
3
  export { Stepper } from './next/components/Stepper/Stepper.esm.js';
2
4
  export { createAsyncValidators } from './next/components/Stepper/createAsyncValidators.esm.js';
3
5
  export { TemplateCard } from './next/components/TemplateCard/TemplateCard.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,56 @@
1
- import { useElementFilter } from '@backstage/core-plugin-api';
1
+ import { useAsync, useMountEffect } from '@react-hookz/web';
2
+ import { useApiHolder, useElementFilter } from '@backstage/core-plugin-api';
3
+ import '../next/api/FormFieldsApi.esm.js';
4
+ import { formFieldsApiRef } from '../next/api/ref.esm.js';
5
+ import '../next/components/Stepper/Stepper.esm.js';
6
+ import 'json-schema-library';
7
+ import 'flatted';
8
+ import '../next/components/TemplateCard/TemplateCard.esm.js';
9
+ import 'react';
10
+ import '@backstage/core-components';
11
+ import 'lodash';
12
+ import '@backstage/catalog-model';
13
+ import '@backstage/plugin-catalog-react';
14
+ import '@backstage/plugin-scaffolder-common';
15
+ import '@material-ui/core/Typography';
16
+ import '../next/components/Workflow/Workflow.esm.js';
17
+ import '@material-ui/core/Box';
18
+ import '@material-ui/core/Paper';
19
+ import '../next/components/TemplateOutputs/LinkOutputs.esm.js';
20
+ import '@material-ui/core/Button';
21
+ import '@material-ui/icons/Description';
22
+ import '../next/components/Form/Form.esm.js';
23
+ import '@material-ui/core/Stepper';
24
+ import '@material-ui/core/Step';
25
+ import '@material-ui/core/StepButton';
26
+ import '@material-ui/core/StepLabel';
27
+ import '../next/components/TaskSteps/StepIcon.esm.js';
28
+ import 'react-use/esm/useInterval';
29
+ import 'luxon';
30
+ import 'humanize-duration';
31
+ import '../next/components/TaskSteps/TaskBorder.esm.js';
32
+ import '../next/components/TaskLogStream/TaskLogStream.esm.js';
33
+ import '../next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js';
34
+ import '../next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js';
35
+ import '../next/components/ScaffolderField/ScaffolderField.esm.js';
36
+ import '@backstage/plugin-scaffolder-react';
37
+ import '@material-ui/core/TextField';
38
+ import 'qs';
39
+ import 'react-use/esm/useAsync';
40
+ import '../api/ref.esm.js';
41
+ import 'lodash/cloneDeep';
42
+ import '../next/blueprints/FormFieldBlueprint.esm.js';
2
43
  import { FIELD_EXTENSION_WRAPPER_KEY, FIELD_EXTENSION_KEY } from '../extensions/keys.esm.js';
3
44
 
4
45
  const useCustomFieldExtensions = (outlet) => {
5
- return useElementFilter(
46
+ const apiHolder = useApiHolder();
47
+ const formFieldsApi = apiHolder.get(formFieldsApiRef);
48
+ const [{ result: blueprintFields }, methods] = useAsync(
49
+ formFieldsApi?.getFormFields ?? (async () => []),
50
+ []
51
+ );
52
+ useMountEffect(methods.execute);
53
+ const outletFields = useElementFilter(
6
54
  outlet,
7
55
  (elements) => elements.selectByComponentData({
8
56
  key: FIELD_EXTENSION_WRAPPER_KEY
@@ -10,6 +58,15 @@ const useCustomFieldExtensions = (outlet) => {
10
58
  key: FIELD_EXTENSION_KEY
11
59
  })
12
60
  );
61
+ const blueprintsToLegacy = blueprintFields?.map(
62
+ (field) => ({
63
+ component: field.component,
64
+ name: field.name,
65
+ validation: field.validation,
66
+ schema: field.schema?.schema
67
+ })
68
+ );
69
+ return [...blueprintsToLegacy, ...outletFields];
13
70
  };
14
71
 
15
72
  export { useCustomFieldExtensions };
@@ -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 { useElementFilter } from '@backstage/core-plugin-api';\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 TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return 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"],"names":[],"mappings":";;;AA0Ba,MAAA,wBAAA,GAA2B,CAGtC,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AACF;;;;"}
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 { useApiHolder, 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 apiHolder = useApiHolder();\n const formFieldsApi = apiHolder.get(formFieldsApiRef);\n const [{ result: blueprintFields }, methods] = useAsync(\n formFieldsApi?.getFormFields ?? (async () => []),\n [],\n );\n useMountEffect(methods.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,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAM,MAAA,aAAA,GAAgB,SAAU,CAAA,GAAA,CAAI,gBAAgB,CAAA;AACpD,EAAA,MAAM,CAAC,EAAE,MAAA,EAAQ,eAAgB,EAAA,EAAG,OAAO,CAAI,GAAA,QAAA;AAAA,IAC7C,aAAA,EAAe,aAAkB,KAAA,YAAY,EAAC,CAAA;AAAA,IAC9C;AAAC,GACH;AACA,EAAA,cAAA,CAAe,QAAQ,OAAO,CAAA;AAG9B,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;;;;"}
@@ -0,0 +1,40 @@
1
+ import { ApiBlueprint, createExtensionInput, createApiFactory } from '@backstage/frontend-plugin-api';
2
+ import { formFieldsApiRef } from './ref.esm.js';
3
+ import { FormFieldBlueprint } from '../blueprints/FormFieldBlueprint.esm.js';
4
+ import { OpaqueFormField } from '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
5
+
6
+ class DefaultScaffolderFormFieldsApi {
7
+ constructor(formFieldLoaders = []) {
8
+ this.formFieldLoaders = formFieldLoaders;
9
+ }
10
+ async getFormFields() {
11
+ const formFields = await Promise.all(
12
+ this.formFieldLoaders.map((loader) => loader())
13
+ );
14
+ const internalFormFields = formFields.map(OpaqueFormField.toInternal);
15
+ return internalFormFields;
16
+ }
17
+ }
18
+ const formFieldsApi = ApiBlueprint.makeWithOverrides({
19
+ name: "form-fields",
20
+ inputs: {
21
+ formFields: createExtensionInput([
22
+ FormFieldBlueprint.dataRefs.formFieldLoader
23
+ ])
24
+ },
25
+ factory(originalFactory, { inputs }) {
26
+ const formFieldLoaders = inputs.formFields.map(
27
+ (e) => e.get(FormFieldBlueprint.dataRefs.formFieldLoader)
28
+ );
29
+ return originalFactory({
30
+ factory: createApiFactory({
31
+ api: formFieldsApiRef,
32
+ deps: {},
33
+ factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders)
34
+ })
35
+ });
36
+ }
37
+ });
38
+
39
+ export { formFieldsApi };
40
+ //# sourceMappingURL=FormFieldsApi.esm.js.map
@@ -0,0 +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;;;;"}
@@ -0,0 +1,8 @@
1
+ import { createApiRef } from '@backstage/frontend-plugin-api';
2
+
3
+ const formFieldsApiRef = createApiRef({
4
+ id: "plugin.scaffolder.form-fields"
5
+ });
6
+
7
+ export { formFieldsApiRef };
8
+ //# sourceMappingURL=ref.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref.esm.js","sources":["../../../src/next/api/ref.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 { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormFieldsApi } from './types';\n\n/** @alpha */\nexport const formFieldsApiRef = createApiRef<ScaffolderFormFieldsApi>({\n id: 'plugin.scaffolder.form-fields',\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,YAAsC,CAAA;AAAA,EACpE,EAAI,EAAA;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.14.2-next.1",
3
+ "version": "1.14.2-next.2",
4
4
  "description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -66,14 +66,14 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/catalog-client": "1.9.0-next.1",
70
- "@backstage/catalog-model": "1.7.1",
71
- "@backstage/core-components": "0.16.2-next.1",
72
- "@backstage/core-plugin-api": "1.10.1",
73
- "@backstage/frontend-plugin-api": "0.9.3-next.1",
74
- "@backstage/plugin-catalog-react": "1.14.3-next.1",
75
- "@backstage/plugin-permission-react": "0.4.28",
76
- "@backstage/plugin-scaffolder-common": "1.5.8-next.0",
69
+ "@backstage/catalog-client": "1.9.0-next.2",
70
+ "@backstage/catalog-model": "1.7.2-next.0",
71
+ "@backstage/core-components": "0.16.2-next.2",
72
+ "@backstage/core-plugin-api": "1.10.2-next.0",
73
+ "@backstage/frontend-plugin-api": "0.9.3-next.2",
74
+ "@backstage/plugin-catalog-react": "1.14.3-next.2",
75
+ "@backstage/plugin-permission-react": "0.4.29-next.0",
76
+ "@backstage/plugin-scaffolder-common": "1.5.8-next.1",
77
77
  "@backstage/theme": "0.6.3-next.0",
78
78
  "@backstage/types": "1.2.0",
79
79
  "@backstage/version-bridge": "1.0.10",
@@ -102,12 +102,12 @@
102
102
  "zod-to-json-schema": "^3.20.4"
103
103
  },
104
104
  "devDependencies": {
105
- "@backstage/cli": "0.29.3-next.1",
106
- "@backstage/core-app-api": "1.15.3-next.0",
107
- "@backstage/plugin-catalog": "1.25.2-next.1",
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",
105
+ "@backstage/cli": "0.29.3-next.2",
106
+ "@backstage/core-app-api": "1.15.3-next.1",
107
+ "@backstage/plugin-catalog": "1.26.0-next.2",
108
+ "@backstage/plugin-catalog-common": "1.1.2-next.0",
109
+ "@backstage/plugin-permission-common": "0.8.3-next.0",
110
+ "@backstage/test-utils": "1.7.3-next.1",
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",