@backstage/plugin-scaffolder-react 2.1.0-next.1 → 2.1.1-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.
Files changed (107) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/alpha.esm.js.map +1 -1
  3. package/dist/api/ref.esm.js.map +1 -1
  4. package/dist/extensions/createScaffolderFieldExtension.esm.js.map +1 -1
  5. package/dist/extensions/keys.esm.js.map +1 -1
  6. package/dist/hooks/useCustomFieldExtensions.esm.js.map +1 -1
  7. package/dist/hooks/useCustomLayouts.esm.js.map +1 -1
  8. package/dist/hooks/useEventStream.esm.js +132 -67
  9. package/dist/hooks/useEventStream.esm.js.map +1 -1
  10. package/dist/layouts/createScaffolderLayout.esm.js.map +1 -1
  11. package/dist/layouts/keys.esm.js.map +1 -1
  12. package/dist/next/api/index.esm.js.map +1 -1
  13. package/dist/next/blueprints/FormDecoratorBlueprint.esm.js.map +1 -1
  14. package/dist/next/blueprints/FormFieldBlueprint.esm.js.map +1 -1
  15. package/dist/next/blueprints/scaffolderTaskOutputsBlueprint.esm.js.map +1 -1
  16. package/dist/next/components/Form/BuiTheme/Form.module.css.esm.js.map +1 -1
  17. package/dist/next/components/Form/BuiTheme/index.esm.js.map +1 -1
  18. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.esm.js.map +1 -1
  19. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.esm.js.map +1 -1
  20. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.esm.js.map +1 -1
  21. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTitleTemplate.esm.js.map +1 -1
  22. package/dist/next/components/Form/BuiTheme/templates/ButtonTemplates.esm.js.map +1 -1
  23. package/dist/next/components/Form/BuiTheme/templates/DescriptionFieldTemplate.esm.js.map +1 -1
  24. package/dist/next/components/Form/BuiTheme/templates/ErrorListTemplate.esm.js.map +1 -1
  25. package/dist/next/components/Form/BuiTheme/templates/FieldErrorTemplate.esm.js.map +1 -1
  26. package/dist/next/components/Form/BuiTheme/templates/FieldHelpTemplate.esm.js.map +1 -1
  27. package/dist/next/components/Form/BuiTheme/templates/FieldTemplate.esm.js.map +1 -1
  28. package/dist/next/components/Form/BuiTheme/templates/ObjectFieldTemplate.esm.js.map +1 -1
  29. package/dist/next/components/Form/BuiTheme/templates/TitleFieldTemplate.esm.js.map +1 -1
  30. package/dist/next/components/Form/BuiTheme/templates/UnsupportedFieldTemplate.esm.js.map +1 -1
  31. package/dist/next/components/Form/BuiTheme/templates/WrapIfAdditionalTemplate.esm.js.map +1 -1
  32. package/dist/next/components/Form/BuiTheme/templates/index.esm.js.map +1 -1
  33. package/dist/next/components/Form/BuiTheme/widgets/BaseInputTemplate.esm.js.map +1 -1
  34. package/dist/next/components/Form/BuiTheme/widgets/CheckboxWidget.esm.js.map +1 -1
  35. package/dist/next/components/Form/BuiTheme/widgets/CheckboxesWidget.esm.js.map +1 -1
  36. package/dist/next/components/Form/BuiTheme/widgets/ColorWidget.esm.js.map +1 -1
  37. package/dist/next/components/Form/BuiTheme/widgets/DateInput.esm.js.map +1 -1
  38. package/dist/next/components/Form/BuiTheme/widgets/DateTimeWidget.esm.js.map +1 -1
  39. package/dist/next/components/Form/BuiTheme/widgets/DateWidget.esm.js.map +1 -1
  40. package/dist/next/components/Form/BuiTheme/widgets/EmailWidget.esm.js.map +1 -1
  41. package/dist/next/components/Form/BuiTheme/widgets/FileWidget.esm.js.map +1 -1
  42. package/dist/next/components/Form/BuiTheme/widgets/HiddenWidget.esm.js.map +1 -1
  43. package/dist/next/components/Form/BuiTheme/widgets/PasswordWidget.esm.js.map +1 -1
  44. package/dist/next/components/Form/BuiTheme/widgets/RadioWidget.esm.js.map +1 -1
  45. package/dist/next/components/Form/BuiTheme/widgets/RangeWidget.esm.js.map +1 -1
  46. package/dist/next/components/Form/BuiTheme/widgets/SelectWidget.esm.js.map +1 -1
  47. package/dist/next/components/Form/BuiTheme/widgets/TextWidget.esm.js.map +1 -1
  48. package/dist/next/components/Form/BuiTheme/widgets/TextareaWidget.esm.js.map +1 -1
  49. package/dist/next/components/Form/BuiTheme/widgets/TimeWidget.esm.js.map +1 -1
  50. package/dist/next/components/Form/BuiTheme/widgets/URLWidget.esm.js.map +1 -1
  51. package/dist/next/components/Form/BuiTheme/widgets/index.esm.js.map +1 -1
  52. package/dist/next/components/Form/BuiTheme/widgets/selectOverrides.module.css.esm.js.map +1 -1
  53. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
  54. package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
  55. package/dist/next/components/Form/Form.esm.js.map +1 -1
  56. package/dist/next/components/Form/ScaffolderThemeContext.esm.js.map +1 -1
  57. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
  58. package/dist/next/components/ReviewState/ReviewState.esm.js +1 -1
  59. package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
  60. package/dist/next/components/ReviewState/util.esm.js.map +1 -1
  61. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
  62. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
  63. package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
  64. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
  65. package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js.map +1 -1
  66. package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
  67. package/dist/next/components/Stepper/createAsyncValidators.esm.js.map +1 -1
  68. package/dist/next/components/Stepper/utils.esm.js.map +1 -1
  69. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
  70. package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
  71. package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
  72. package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
  73. package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
  74. package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
  75. package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
  76. package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
  77. package/dist/next/components/TemplateCard/TemplateCardActions.esm.js.map +1 -1
  78. package/dist/next/components/TemplateCard/TemplateCardContent.esm.js.map +1 -1
  79. package/dist/next/components/TemplateCard/TemplateCardImpl.esm.js.map +1 -1
  80. package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js.map +1 -1
  81. package/dist/next/components/TemplateCard/TemplateCardTags.esm.js.map +1 -1
  82. package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js.map +1 -1
  83. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
  84. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
  85. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
  86. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
  87. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
  88. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
  89. package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
  90. package/dist/next/extensions/createScaffolderFormDecorator.esm.js.map +1 -1
  91. package/dist/next/hooks/useDownloadLogs.esm.js.map +1 -1
  92. package/dist/next/hooks/useFilteredSchemaProperties.esm.js.map +1 -1
  93. package/dist/next/hooks/useFormDataFromQuery.esm.js.map +1 -1
  94. package/dist/next/hooks/useTemplateParameterSchema.esm.js.map +1 -1
  95. package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
  96. package/dist/next/hooks/useTemplateTimeSaved.esm.js.map +1 -1
  97. package/dist/next/hooks/useTransformSchemaToProps.esm.js.map +1 -1
  98. package/dist/next/lib/schema.esm.js.map +1 -1
  99. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
  100. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  101. package/dist/packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js.map +1 -1
  102. package/dist/packages/scaffolder-internal/src/wiring/InternalFormField.esm.js.map +1 -1
  103. package/dist/secrets/SecretsContext.esm.js.map +1 -1
  104. package/dist/testUtils/scaffolderApiMock.esm.js.map +1 -1
  105. package/dist/translation.esm.js.map +1 -1
  106. package/dist/utils.esm.js.map +1 -1
  107. package/package.json +18 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 2.1.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/plugin-scaffolder-common@2.3.1-next.0
9
+ - @backstage/core-components@0.18.15-next.0
10
+ - @backstage/core-plugin-api@1.12.11-next.0
11
+ - @backstage/frontend-plugin-api@0.18.2-next.0
12
+ - @backstage/frontend-test-utils@0.6.5-next.0
13
+ - @backstage/plugin-permission-react@0.5.6-next.0
14
+ - @backstage/catalog-client@1.16.3-next.0
15
+ - @backstage/catalog-model@1.10.2-next.0
16
+ - @backstage/plugin-catalog-react@3.2.4-next.0
17
+
18
+ ## 2.1.0
19
+
20
+ ### Minor Changes
21
+
22
+ - 5ff93bf: Added functionality to register a Template Outputs Component in the new frontend system.
23
+
24
+ ### Patch Changes
25
+
26
+ - 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
27
+ - ffaca06: Fixed several issues with scaffolder task event stream reconnection: retry timers are now properly cancelled on cleanup, concurrent reconnect attempts are guarded against, and tab visibility changes reconnect the stream using the last seen event cursor without re-fetching the task.
28
+ - 7c1019c: Fixed the scaffolder wizard not scrolling to the top on step change when the app uses the new frontend system (no `<main>` element).
29
+ - Updated dependencies
30
+ - @backstage/core-components@0.18.14
31
+ - @backstage/plugin-scaffolder-common@2.3.0
32
+ - @backstage/ui@0.18.0
33
+ - @backstage/catalog-client@1.16.2
34
+ - @backstage/catalog-model@1.10.1
35
+ - @backstage/plugin-catalog-react@3.2.3
36
+ - @backstage/frontend-plugin-api@0.18.1
37
+ - @backstage/core-plugin-api@1.12.10
38
+ - @backstage/plugin-permission-react@0.5.5
39
+
3
40
  ## 2.1.0-next.1
4
41
 
5
42
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './next';\n\nimport { scaffolderReactTranslationRef as _scaffolderReactTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-scaffolder-react` instead.\n */\nexport const scaffolderReactTranslationRef = _scaffolderReactTranslationRef;\n"],"names":["_scaffolderReactTranslationRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,6BAAA,GAAgCA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './next';\n\nimport { scaffolderReactTranslationRef as _scaffolderReactTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-scaffolder-react` instead.\n */\nexport const scaffolderReactTranslationRef = _scaffolderReactTranslationRef;\n"],"names":["_scaffolderReactTranslationRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,6BAAA,GAAgCA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ref.esm.js","sources":["../../src/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderApi } from './types';\n\n/** @public */\nexport const scaffolderApiRef = createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,YAAA,CAA4B;AAAA,EAC1D,EAAA,EAAI;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"ref.esm.js","sources":["../../src/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderApi } from './types';\n\n/** @public */\nexport const scaffolderApiRef = createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,YAAA,CAA4B;AAAA,EAC1D,EAAA,EAAI;AACN,CAAC;;"}
@@ -1 +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,OAAA,EAC+D;AAC/D,EAAA,OAAO;AAAA,IACL,MAAA,GAAS;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA;AAAA,OACF;AAEA,MAAA,OAAO,wBAAA;AAAA,IACT;AAAA,GACF;AACF;AAOO,MAAM,4BAET,MAA0B;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA;AACF,CAAA;;;;"}
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,OAAA,EAC+D;AAC/D,EAAA,OAAO;AAAA,IACL,MAAA,GAAS;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA;AAAA,OACF;AAEA,MAAA,OAAO,wBAAA;AAAA,IACT;AAAA,GACF;AACF;AAOO,MAAM,4BAET,MAA0B;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA;AACF,CAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.esm.js","sources":["../../src/extensions/keys.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\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n"],"names":[],"mappings":"AAgBO,MAAM,2BAAA,GAA8B;AAIpC,MAAM,mBAAA,GAAsB;;;;"}
1
+ {"version":3,"file":"keys.esm.js","sources":["../../src/extensions/keys.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\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n"],"names":[],"mappings":"AAgBO,MAAM,2BAAA,GAA8B;AAIpC,MAAM,mBAAA,GAAsB;;"}
@@ -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 // 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 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 return outletFields as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;AA0BO,MAAM,wBAAA,GAA2B,CAItC,MAAA,KACG;AAEH,EAAA,MAAM,YAAA,GAAe,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAA,CAAsB;AAAA,MACrB,GAAA,EAAK;AAAA,KACN,EACA,iBAAA,CAAsC;AAAA,MACrC,GAAA,EAAK;AAAA,KACN;AAAA,GACL;AAEA,EAAA,OAAO,YAAA;AACT;;;;"}
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 // 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 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 return outletFields as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;AA0BO,MAAM,wBAAA,GAA2B,CAItC,MAAA,KACG;AAEH,EAAA,MAAM,YAAA,GAAe,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAA,CAAsB;AAAA,MACrB,GAAA,EAAK;AAAA,KACN,EACA,iBAAA,CAAsC;AAAA,MACrC,GAAA,EAAK;AAAA,KACN;AAAA,GACL;AAEA,EAAA,OAAO,YAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomLayouts.esm.js","sources":["../../src/hooks/useCustomLayouts.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 { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n"],"names":[],"mappings":";;;AAuBO,MAAM,gBAAA,GAAmB,CAC9B,MAAA,KACG;AACH,EAAA,OAAO,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAA,CAAsB;AAAA,MACrB,GAAA,EAAK;AAAA,KACN,EACA,iBAAA,CAAsC;AAAA,MACrC,GAAA,EAAK;AAAA,KACN;AAAA,GACL;AACF;;;;"}
1
+ {"version":3,"file":"useCustomLayouts.esm.js","sources":["../../src/hooks/useCustomLayouts.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 { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n"],"names":[],"mappings":";;;AAuBO,MAAM,gBAAA,GAAmB,CAC9B,MAAA,KACG;AACH,EAAA,OAAO,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAA,CAAsB;AAAA,MACrB,GAAA,EAAK;AAAA,KACN,EACA,iBAAA,CAAsC;AAAA,MACrC,GAAA,EAAK;AAAA,KACN;AAAA,GACL;AACF;;"}
@@ -70,6 +70,11 @@ function reducer(draft, action) {
70
70
  }
71
71
  return;
72
72
  }
73
+ case "RECONNECTING": {
74
+ draft.error = void 0;
75
+ draft.completed = false;
76
+ return;
77
+ }
73
78
  case "ERROR": {
74
79
  draft.error = action.data;
75
80
  draft.loading = false;
@@ -93,84 +98,144 @@ const useTaskEventStream = (taskId) => {
93
98
  let didCancel = false;
94
99
  let subscription;
95
100
  let logPusher;
101
+ let retryTimer;
96
102
  let retryCount = 1;
97
103
  let isTaskRecoverable = false;
98
- const startStreamLogProcess = () => scaffolderApi.getTask(taskId).then(
99
- (task) => {
100
- if (didCancel) {
101
- return;
104
+ let lastSeenEventId;
105
+ let isStreamComplete = false;
106
+ let hasInitialized = false;
107
+ let startGeneration = 0;
108
+ let currentEmitLogs;
109
+ const cleanUpStream = () => {
110
+ currentEmitLogs?.();
111
+ currentEmitLogs = void 0;
112
+ if (subscription) {
113
+ subscription.unsubscribe();
114
+ subscription = void 0;
115
+ }
116
+ if (logPusher) {
117
+ clearInterval(logPusher);
118
+ logPusher = void 0;
119
+ }
120
+ if (retryTimer) {
121
+ clearTimeout(retryTimer);
122
+ retryTimer = void 0;
123
+ }
124
+ };
125
+ function reconnectStream() {
126
+ dispatch({ type: "RECONNECTING" });
127
+ const generation = ++startGeneration;
128
+ cleanUpStream();
129
+ subscribeToStream(generation);
130
+ }
131
+ function subscribeToStream(generation) {
132
+ const observable = scaffolderApi.streamLogs({
133
+ isTaskRecoverable,
134
+ taskId,
135
+ after: lastSeenEventId
136
+ });
137
+ const collectedLogEvents = new Array();
138
+ function emitLogs() {
139
+ if (collectedLogEvents.length) {
140
+ const logs = collectedLogEvents.splice(0, collectedLogEvents.length);
141
+ dispatch({ type: "LOGS", data: logs });
102
142
  }
103
- isTaskRecoverable = task.spec.EXPERIMENTAL_recovery?.EXPERIMENTAL_strategy === "startOver";
104
- dispatch({ type: "INIT", data: task });
105
- const observable = scaffolderApi.streamLogs({
106
- isTaskRecoverable,
107
- taskId
108
- });
109
- const collectedLogEvents = new Array();
110
- function emitLogs() {
111
- if (collectedLogEvents.length) {
112
- const logs = collectedLogEvents.splice(
113
- 0,
114
- collectedLogEvents.length
115
- );
116
- dispatch({ type: "LOGS", data: logs });
143
+ }
144
+ currentEmitLogs = emitLogs;
145
+ logPusher = setInterval(emitLogs, 500);
146
+ subscription = observable.subscribe({
147
+ next: (event) => {
148
+ retryCount = 1;
149
+ if (event.id !== void 0) {
150
+ lastSeenEventId = event.id;
151
+ }
152
+ switch (event.type) {
153
+ case "log":
154
+ return collectedLogEvents.push(event);
155
+ case "cancelled":
156
+ if (!isTaskRecoverable) {
157
+ isStreamComplete = true;
158
+ }
159
+ emitLogs();
160
+ dispatch({ type: "CANCELLED" });
161
+ if (isStreamComplete) {
162
+ cleanUpStream();
163
+ }
164
+ return void 0;
165
+ case "completion":
166
+ if (!isTaskRecoverable) {
167
+ isStreamComplete = true;
168
+ }
169
+ emitLogs();
170
+ dispatch({ type: "COMPLETED", data: event });
171
+ if (isStreamComplete) {
172
+ cleanUpStream();
173
+ }
174
+ return void 0;
175
+ case "recovered":
176
+ isStreamComplete = false;
177
+ dispatch({ type: "RECOVERED", data: event });
178
+ return void 0;
179
+ default:
180
+ throw new Error(`Unhandled event type ${event.type} in observer`);
181
+ }
182
+ },
183
+ error: (error) => {
184
+ cleanUpStream();
185
+ if (isStreamComplete || generation !== startGeneration || didCancel) {
186
+ return;
187
+ }
188
+ const maxRetries = 3;
189
+ if (!error.message) {
190
+ error.message = `We cannot connect at the moment, trying again in some seconds... Retrying (${retryCount > maxRetries ? maxRetries : retryCount}/${maxRetries} retries)`;
117
191
  }
192
+ retryTimer = setTimeout(() => {
193
+ retryTimer = void 0;
194
+ retryCount += 1;
195
+ reconnectStream();
196
+ }, 15e3);
197
+ dispatch({ type: "ERROR", data: error });
118
198
  }
119
- logPusher = setInterval(emitLogs, 500);
120
- subscription = observable.subscribe({
121
- next: (event) => {
122
- retryCount = 1;
123
- switch (event.type) {
124
- case "log":
125
- return collectedLogEvents.push(event);
126
- case "cancelled":
127
- dispatch({ type: "CANCELLED" });
128
- return void 0;
129
- case "completion":
130
- emitLogs();
131
- dispatch({ type: "COMPLETED", data: event });
132
- return void 0;
133
- case "recovered":
134
- dispatch({ type: "RECOVERED", data: event });
135
- return void 0;
136
- default:
137
- throw new Error(
138
- `Unhandled event type ${event.type} in observer`
139
- );
140
- }
141
- },
142
- error: (error) => {
143
- emitLogs();
144
- const maxRetries = 3;
145
- if (!error.message) {
146
- error.message = `We cannot connect at the moment, trying again in some seconds... Retrying (${retryCount > maxRetries ? maxRetries : retryCount}/${maxRetries} retries)`;
147
- }
148
- setTimeout(() => {
149
- retryCount += 1;
150
- void startStreamLogProcess();
151
- }, 15e3);
199
+ });
200
+ }
201
+ const startStreamLogProcess = () => {
202
+ const generation = ++startGeneration;
203
+ cleanUpStream();
204
+ return scaffolderApi.getTask(taskId).then(
205
+ (task) => {
206
+ if (didCancel || generation !== startGeneration) {
207
+ return;
208
+ }
209
+ isTaskRecoverable = task.spec.EXPERIMENTAL_recovery?.EXPERIMENTAL_strategy === "startOver";
210
+ hasInitialized = true;
211
+ dispatch({ type: "INIT", data: task });
212
+ subscribeToStream(generation);
213
+ },
214
+ (error) => {
215
+ if (!didCancel && generation === startGeneration) {
152
216
  dispatch({ type: "ERROR", data: error });
153
217
  }
154
- });
155
- },
156
- (error) => {
157
- if (!didCancel) {
158
- dispatch({ type: "ERROR", data: error });
159
218
  }
160
- }
161
- );
219
+ );
220
+ };
162
221
  void startStreamLogProcess();
163
- return () => {
164
- if (!isTaskRecoverable) {
165
- didCancel = true;
166
- if (subscription) {
167
- subscription.unsubscribe();
168
- }
169
- if (logPusher) {
170
- clearInterval(logPusher);
171
- }
222
+ const onVisibilityChange = () => {
223
+ if (didCancel || isStreamComplete) return;
224
+ if (document.hidden) {
225
+ startGeneration++;
226
+ cleanUpStream();
227
+ } else if (hasInitialized) {
228
+ reconnectStream();
229
+ } else {
230
+ void startStreamLogProcess();
172
231
  }
173
232
  };
233
+ document.addEventListener("visibilitychange", onVisibilityChange);
234
+ return () => {
235
+ didCancel = true;
236
+ cleanUpStream();
237
+ document.removeEventListener("visibilitychange", onVisibilityChange);
238
+ };
174
239
  }, [scaffolderApi, dispatch, taskId]);
175
240
  return state;
176
241
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useEventStream.esm.js","sources":["../../src/hooks/useEventStream.ts"],"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 */\nimport { useImmerReducer } from 'use-immer';\nimport { useEffect } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Subscription } from '@backstage/types';\nimport {\n ScaffolderTaskStatus,\n ScaffolderTaskOutput,\n ScaffolderTask,\n LogEvent,\n} from '@backstage/plugin-scaffolder-common';\nimport { scaffolderApiRef } from '../api';\n\n/**\n * The status of the step being processed\n *\n * @public\n */\nexport type ScaffolderStep = {\n id: string;\n status: ScaffolderTaskStatus;\n endedAt?: string;\n startedAt?: string;\n};\n\n/**\n * A task event from the event stream\n *\n * @public\n */\nexport type TaskStream = {\n cancelled: boolean;\n loading: boolean;\n error?: Error;\n stepLogs: { [stepId in string]: string[] };\n completed: boolean;\n task?: ScaffolderTask;\n steps: { [stepId in string]: ScaffolderStep };\n output?: ScaffolderTaskOutput;\n};\n\ntype ReducerLogEntry = {\n createdAt: string;\n body: {\n stepId?: string;\n status?: ScaffolderTaskStatus;\n message: string;\n output?: ScaffolderTaskOutput;\n error?: Error;\n recoverStrategy?: 'none' | 'startOver';\n };\n};\n\ntype ReducerAction =\n | { type: 'INIT'; data: ScaffolderTask }\n | { type: 'CANCELLED' }\n | { type: 'RECOVERED'; data: ReducerLogEntry }\n | { type: 'LOGS'; data: ReducerLogEntry[] }\n | { type: 'COMPLETED'; data: ReducerLogEntry }\n | { type: 'ERROR'; data: Error };\n\nfunction reducer(draft: TaskStream, action: ReducerAction) {\n switch (action.type) {\n case 'INIT': {\n draft.steps = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = { status: 'open', id: next.id };\n return current;\n }, {} as { [stepId in string]: ScaffolderStep });\n draft.stepLogs = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = [];\n return current;\n }, {} as { [stepId in string]: string[] });\n draft.error = undefined;\n draft.completed = false;\n draft.task = action.data;\n return;\n }\n\n case 'LOGS': {\n const entries = action.data;\n const logLines = [];\n\n // only set loading as false once we have logs,\n // otherwise things flicker from pending to loaded.\n if (draft.loading && entries.length > 0) {\n draft.loading = false;\n }\n\n for (const entry of entries) {\n const logLine = `${entry.createdAt} ${entry.body.message}`;\n logLines.push(logLine);\n\n if (!entry.body.stepId || !draft.steps?.[entry.body.stepId]) {\n continue;\n }\n\n const currentStepLog = draft.stepLogs?.[entry.body.stepId];\n const currentStep = draft.steps?.[entry.body.stepId];\n\n if (currentStep) {\n if (entry.body.status && entry.body.status !== currentStep.status) {\n currentStep.status = entry.body.status;\n\n if (currentStep.status === 'processing') {\n currentStep.startedAt = entry.createdAt;\n }\n\n if (\n ['cancelled', 'completed', 'failed'].includes(currentStep.status)\n ) {\n currentStep.endedAt = entry.createdAt;\n }\n }\n }\n\n currentStepLog?.push(logLine);\n }\n\n return;\n }\n\n case 'COMPLETED': {\n draft.completed = true;\n draft.output = action.data.body.output;\n draft.error = action.data.body.error;\n\n return;\n }\n\n case 'CANCELLED': {\n draft.cancelled = true;\n return;\n }\n\n case 'RECOVERED': {\n draft.cancelled = false;\n draft.completed = false;\n draft.output = undefined;\n draft.error = undefined;\n\n for (const stepId in draft.steps) {\n if (draft.steps.hasOwnProperty(stepId)) {\n draft.steps[stepId].startedAt = undefined;\n draft.steps[stepId].endedAt = undefined;\n draft.steps[stepId].status = 'open';\n }\n }\n return;\n }\n\n case 'ERROR': {\n draft.error = action.data;\n draft.loading = false;\n draft.completed = true;\n return;\n }\n\n default:\n return;\n }\n}\n\n/**\n * A hook to stream the logs of a task being processed\n *\n * @public\n */\nexport const useTaskEventStream = (taskId: string): TaskStream => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const [state, dispatch] = useImmerReducer(reducer, {\n cancelled: false,\n loading: true,\n completed: false,\n stepLogs: {} as { [stepId in string]: string[] },\n steps: {} as { [stepId in string]: ScaffolderStep },\n });\n\n useEffect(() => {\n let didCancel = false;\n let subscription: Subscription | undefined;\n let logPusher: NodeJS.Timeout | undefined;\n let retryCount = 1;\n let isTaskRecoverable = false;\n const startStreamLogProcess = () =>\n scaffolderApi.getTask(taskId).then(\n task => {\n if (didCancel) {\n return;\n }\n isTaskRecoverable =\n task.spec.EXPERIMENTAL_recovery?.EXPERIMENTAL_strategy ===\n 'startOver';\n dispatch({ type: 'INIT', data: task });\n\n // TODO(blam): Use a normal fetch to fetch the current log for the event stream\n // and use that for an INIT_EVENTs dispatch event, and then\n // use the last event ID to subscribe using after option to\n // stream logs. Without this, if you have a lot of logs, it can look like the\n // task is being rebuilt on load as it progresses through the steps at a slower\n // rate whilst it builds the status from the event logs\n const observable = scaffolderApi.streamLogs({\n isTaskRecoverable,\n taskId,\n });\n\n const collectedLogEvents = new Array<LogEvent>();\n\n function emitLogs() {\n if (collectedLogEvents.length) {\n const logs = collectedLogEvents.splice(\n 0,\n collectedLogEvents.length,\n );\n dispatch({ type: 'LOGS', data: logs });\n }\n }\n\n logPusher = setInterval(emitLogs, 500);\n\n subscription = observable.subscribe({\n next: event => {\n retryCount = 1;\n switch (event.type) {\n case 'log':\n return collectedLogEvents.push(event);\n case 'cancelled':\n dispatch({ type: 'CANCELLED' });\n return undefined;\n case 'completion':\n emitLogs();\n dispatch({ type: 'COMPLETED', data: event });\n return undefined;\n case 'recovered':\n dispatch({ type: 'RECOVERED', data: event });\n return undefined;\n default:\n throw new Error(\n `Unhandled event type ${event.type} in observer`,\n );\n }\n },\n error: error => {\n emitLogs();\n // in some cases the error is a refused connection from backend\n // this can happen from internet issues or proxy problems\n // so we try to reconnect again after some time\n // just to restart the fetch process\n // details here https://github.com/backstage/backstage/issues/15002\n\n const maxRetries = 3;\n\n if (!error.message) {\n error.message = `We cannot connect at the moment, trying again in some seconds... Retrying (${\n retryCount > maxRetries ? maxRetries : retryCount\n }/${maxRetries} retries)`;\n }\n\n setTimeout(() => {\n retryCount += 1;\n void startStreamLogProcess();\n }, 15000);\n\n dispatch({ type: 'ERROR', data: error });\n },\n });\n },\n error => {\n if (!didCancel) {\n dispatch({ type: 'ERROR', data: error });\n }\n },\n );\n void startStreamLogProcess();\n return () => {\n if (!isTaskRecoverable) {\n didCancel = true;\n if (subscription) {\n subscription.unsubscribe();\n }\n if (logPusher) {\n clearInterval(logPusher);\n }\n }\n };\n }, [scaffolderApi, dispatch, taskId]);\n\n return state;\n};\n"],"names":[],"mappings":";;;;;AA4EA,SAAS,OAAA,CAAQ,OAAmB,MAAA,EAAuB;AACzD,EAAA,QAAQ,OAAO,IAAA;AAAM,IACnB,KAAK,MAAA,EAAQ;AACX,MAAA,KAAA,CAAM,KAAA,GAAQ,OAAO,IAAA,CAAK,IAAA,CAAK,MAAM,MAAA,CAAO,CAAC,SAAS,IAAA,KAAS;AAC7D,QAAA,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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 */\nimport { useImmerReducer } from 'use-immer';\nimport { useEffect } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Subscription } from '@backstage/types';\nimport {\n ScaffolderTaskStatus,\n ScaffolderTaskOutput,\n ScaffolderTask,\n LogEvent,\n} from '@backstage/plugin-scaffolder-common';\nimport { scaffolderApiRef } from '../api';\n\n/**\n * The status of the step being processed\n *\n * @public\n */\nexport type ScaffolderStep = {\n id: string;\n status: ScaffolderTaskStatus;\n endedAt?: string;\n startedAt?: string;\n};\n\n/**\n * A task event from the event stream\n *\n * @public\n */\nexport type TaskStream = {\n cancelled: boolean;\n loading: boolean;\n error?: Error;\n stepLogs: { [stepId in string]: string[] };\n completed: boolean;\n task?: ScaffolderTask;\n steps: { [stepId in string]: ScaffolderStep };\n output?: ScaffolderTaskOutput;\n};\n\ntype ReducerLogEntry = {\n createdAt: string;\n body: {\n stepId?: string;\n status?: ScaffolderTaskStatus;\n message: string;\n output?: ScaffolderTaskOutput;\n error?: Error;\n recoverStrategy?: 'none' | 'startOver';\n };\n};\n\ntype ReducerAction =\n | { type: 'INIT'; data: ScaffolderTask }\n | { type: 'CANCELLED' }\n | { type: 'RECOVERED'; data: ReducerLogEntry }\n | { type: 'LOGS'; data: ReducerLogEntry[] }\n | { type: 'COMPLETED'; data: ReducerLogEntry }\n | { type: 'RECONNECTING' }\n | { type: 'ERROR'; data: Error };\n\nfunction reducer(draft: TaskStream, action: ReducerAction) {\n switch (action.type) {\n case 'INIT': {\n draft.steps = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = { status: 'open', id: next.id };\n return current;\n }, {} as { [stepId in string]: ScaffolderStep });\n draft.stepLogs = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = [];\n return current;\n }, {} as { [stepId in string]: string[] });\n draft.error = undefined;\n draft.completed = false;\n draft.task = action.data;\n return;\n }\n\n case 'LOGS': {\n const entries = action.data;\n const logLines = [];\n\n // only set loading as false once we have logs,\n // otherwise things flicker from pending to loaded.\n if (draft.loading && entries.length > 0) {\n draft.loading = false;\n }\n\n for (const entry of entries) {\n const logLine = `${entry.createdAt} ${entry.body.message}`;\n logLines.push(logLine);\n\n if (!entry.body.stepId || !draft.steps?.[entry.body.stepId]) {\n continue;\n }\n\n const currentStepLog = draft.stepLogs?.[entry.body.stepId];\n const currentStep = draft.steps?.[entry.body.stepId];\n\n if (currentStep) {\n if (entry.body.status && entry.body.status !== currentStep.status) {\n currentStep.status = entry.body.status;\n\n if (currentStep.status === 'processing') {\n currentStep.startedAt = entry.createdAt;\n }\n\n if (\n ['cancelled', 'completed', 'failed'].includes(currentStep.status)\n ) {\n currentStep.endedAt = entry.createdAt;\n }\n }\n }\n\n currentStepLog?.push(logLine);\n }\n\n return;\n }\n\n case 'COMPLETED': {\n draft.completed = true;\n draft.output = action.data.body.output;\n draft.error = action.data.body.error;\n\n return;\n }\n\n case 'CANCELLED': {\n draft.cancelled = true;\n return;\n }\n\n case 'RECOVERED': {\n draft.cancelled = false;\n draft.completed = false;\n draft.output = undefined;\n draft.error = undefined;\n\n for (const stepId in draft.steps) {\n if (draft.steps.hasOwnProperty(stepId)) {\n draft.steps[stepId].startedAt = undefined;\n draft.steps[stepId].endedAt = undefined;\n draft.steps[stepId].status = 'open';\n }\n }\n return;\n }\n\n case 'RECONNECTING': {\n draft.error = undefined;\n draft.completed = false;\n return;\n }\n\n case 'ERROR': {\n draft.error = action.data;\n draft.loading = false;\n draft.completed = true;\n return;\n }\n\n default:\n return;\n }\n}\n\n/**\n * A hook to stream the logs of a task being processed\n *\n * @public\n */\nexport const useTaskEventStream = (taskId: string): TaskStream => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const [state, dispatch] = useImmerReducer(reducer, {\n cancelled: false,\n loading: true,\n completed: false,\n stepLogs: {} as { [stepId in string]: string[] },\n steps: {} as { [stepId in string]: ScaffolderStep },\n });\n\n useEffect(() => {\n let didCancel = false;\n let subscription: Subscription | undefined;\n let logPusher: NodeJS.Timeout | undefined;\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n let retryCount = 1;\n let isTaskRecoverable = false;\n let lastSeenEventId: number | undefined;\n let isStreamComplete = false;\n let hasInitialized = false;\n let startGeneration = 0;\n let currentEmitLogs: (() => void) | undefined;\n\n const cleanUpStream = () => {\n currentEmitLogs?.();\n currentEmitLogs = undefined;\n if (subscription) {\n subscription.unsubscribe();\n subscription = undefined;\n }\n if (logPusher) {\n clearInterval(logPusher);\n logPusher = undefined;\n }\n if (retryTimer) {\n clearTimeout(retryTimer);\n retryTimer = undefined;\n }\n };\n\n function reconnectStream() {\n dispatch({ type: 'RECONNECTING' });\n const generation = ++startGeneration;\n cleanUpStream();\n subscribeToStream(generation);\n }\n\n function subscribeToStream(generation: number) {\n const observable = scaffolderApi.streamLogs({\n isTaskRecoverable,\n taskId,\n after: lastSeenEventId,\n });\n\n const collectedLogEvents = new Array<LogEvent>();\n\n function emitLogs() {\n if (collectedLogEvents.length) {\n const logs = collectedLogEvents.splice(0, collectedLogEvents.length);\n dispatch({ type: 'LOGS', data: logs });\n }\n }\n\n currentEmitLogs = emitLogs;\n logPusher = setInterval(emitLogs, 500);\n\n subscription = observable.subscribe({\n next: event => {\n retryCount = 1;\n if (event.id !== undefined) {\n lastSeenEventId = event.id;\n }\n switch (event.type) {\n case 'log':\n return collectedLogEvents.push(event);\n case 'cancelled':\n if (!isTaskRecoverable) {\n isStreamComplete = true;\n }\n emitLogs();\n dispatch({ type: 'CANCELLED' });\n if (isStreamComplete) {\n cleanUpStream();\n }\n return undefined;\n case 'completion':\n if (!isTaskRecoverable) {\n isStreamComplete = true;\n }\n emitLogs();\n dispatch({ type: 'COMPLETED', data: event });\n if (isStreamComplete) {\n cleanUpStream();\n }\n return undefined;\n case 'recovered':\n isStreamComplete = false;\n dispatch({ type: 'RECOVERED', data: event });\n return undefined;\n default:\n throw new Error(`Unhandled event type ${event.type} in observer`);\n }\n },\n error: error => {\n cleanUpStream();\n\n if (isStreamComplete || generation !== startGeneration || didCancel) {\n return;\n }\n\n const maxRetries = 3;\n\n if (!error.message) {\n error.message = `We cannot connect at the moment, trying again in some seconds... Retrying (${\n retryCount > maxRetries ? maxRetries : retryCount\n }/${maxRetries} retries)`;\n }\n\n retryTimer = setTimeout(() => {\n retryTimer = undefined;\n retryCount += 1;\n reconnectStream();\n }, 15000);\n\n dispatch({ type: 'ERROR', data: error });\n },\n });\n }\n\n const startStreamLogProcess = () => {\n const generation = ++startGeneration;\n cleanUpStream();\n\n return scaffolderApi.getTask(taskId).then(\n task => {\n if (didCancel || generation !== startGeneration) {\n return;\n }\n isTaskRecoverable =\n task.spec.EXPERIMENTAL_recovery?.EXPERIMENTAL_strategy ===\n 'startOver';\n\n hasInitialized = true;\n dispatch({ type: 'INIT', data: task });\n subscribeToStream(generation);\n },\n error => {\n if (!didCancel && generation === startGeneration) {\n dispatch({ type: 'ERROR', data: error });\n }\n },\n );\n };\n void startStreamLogProcess();\n\n const onVisibilityChange = () => {\n if (didCancel || isStreamComplete) return;\n if (document.hidden) {\n startGeneration++;\n cleanUpStream();\n } else if (hasInitialized) {\n reconnectStream();\n } else {\n void startStreamLogProcess();\n }\n };\n document.addEventListener('visibilitychange', onVisibilityChange);\n\n return () => {\n didCancel = true;\n cleanUpStream();\n document.removeEventListener('visibilitychange', onVisibilityChange);\n };\n }, [scaffolderApi, dispatch, taskId]);\n\n return state;\n};\n"],"names":[],"mappings":";;;;;AA6EA,SAAS,OAAA,CAAQ,OAAmB,MAAA,EAAuB;AACzD,EAAA,QAAQ,OAAO,IAAA;AAAM,IACnB,KAA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,UAAU,CAAA;AAAA,QAC9B,CAAA;AAAA,QACA,CAAA,KAAA,KAAS;AACP,UAAA,IAAI,CAAC,SAAA,IAAa,UAAA,KAAe,eAAA,EAAiB;AAChD,YAAA,QAAA,CAAS,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,OAAO,CAAA;AAAA,UACzC;AAAA,QACF;AAAA,OACF;AAAA,IACF,CAAA;AACA,IAAA,KAAK,qBAAA,EAAsB;AAE3B,IAAA,MAAM,qBAAqB,MAAM;AAC/B,MAAA,IAAI,aAAa,gBAAA,EAAkB;AACnC,MAAA,IAAI,SAAS,MAAA,EAAQ;AACnB,QAAA,eAAA,EAAA;AACA,QAAA,aAAA,EAAc;AAAA,MAChB,WAAW,cAAA,EAAgB;AACzB,QAAA,eAAA,EAAgB;AAAA,MAClB,CAAA,MAAO;AACL,QAAA,KAAK,qBAAA,EAAsB;AAAA,MAC7B;AAAA,IACF,CAAA;AACA,IAAA,QAAA,CAAS,gBAAA,CAAiB,oBAAoB,kBAAkB,CAAA;AAEhE,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,IAAA;AACZ,MAAA,aAAA,EAAc;AACd,MAAA,QAAA,CAAS,mBAAA,CAAoB,oBAAoB,kBAAkB,CAAA;AAAA,IACrE,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,aAAA,EAAe,QAAA,EAAU,MAAM,CAAC,CAAA;AAEpC,EAAA,OAAO,KAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createScaffolderLayout.esm.js","sources":["../../src/layouts/createScaffolderLayout.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 { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core';\nimport { PropsWithChildren, ComponentType } from 'react';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: ComponentType<\n PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;AAmDO,SAAS,uBACd,OAAA,EACyC;AACzC,EAAA,OAAO;AAAA,IACL,MAAA,GAAS;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA;AAEpC,MAAA,mBAAA,CAAoB,gBAAA,EAAkB,aAAa,OAAO,CAAA;AAE1D,MAAA,OAAO,gBAAA;AAAA,IACT;AAAA,GACF;AACF;AAOO,MAAM,oBAET,MAA0B;AAE9B,mBAAA,CAAoB,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
1
+ {"version":3,"file":"createScaffolderLayout.esm.js","sources":["../../src/layouts/createScaffolderLayout.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 { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core';\nimport { PropsWithChildren, ComponentType } from 'react';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: ComponentType<\n PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;AAmDO,SAAS,uBACd,OAAA,EACyC;AACzC,EAAA,OAAO;AAAA,IACL,MAAA,GAAS;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA;AAEpC,MAAA,mBAAA,CAAoB,gBAAA,EAAkB,aAAa,OAAO,CAAA;AAE1D,MAAA,OAAO,gBAAA;AAAA,IACT;AAAA,GACF;AACF;AAOO,MAAM,oBAET,MAA0B;AAE9B,mBAAA,CAAoB,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.esm.js","sources":["../../src/layouts/keys.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 */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n"],"names":[],"mappings":"AAeO,MAAM,WAAA,GAAc;AACpB,MAAM,mBAAA,GAAsB;;;;"}
1
+ {"version":3,"file":"keys.esm.js","sources":["../../src/layouts/keys.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 */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n"],"names":[],"mappings":"AAeO,MAAM,WAAA,GAAc;AACpB,MAAM,mBAAA,GAAsB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/next/api/index.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\nexport { type FormField, type ScaffolderFormFieldsApi } from './types';\n\n/** @alpha */\nexport const formFieldsApiRef = createApiRef<ScaffolderFormFieldsApi>({\n id: 'plugin.scaffolder.form-fields-loader',\n});\n"],"names":[],"mappings":";;AAsBO,MAAM,mBAAmB,YAAA,CAAsC;AAAA,EACpE,EAAA,EAAI;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/next/api/index.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\nexport { type FormField, type ScaffolderFormFieldsApi } from './types';\n\n/** @alpha */\nexport const formFieldsApiRef = createApiRef<ScaffolderFormFieldsApi>({\n id: 'plugin.scaffolder.form-fields-loader',\n});\n"],"names":[],"mappings":";;AAsBO,MAAM,mBAAmB,YAAA,CAAsC;AAAA,EACpE,EAAA,EAAI;AACN,CAAC;;"}
@@ -1 +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 * @public\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,sBAAA,EAAgD,CAAE,IAAA,CAAK;AAAA,EACrD,EAAA,EAAI;AACN,CAAC,CAAA;AAMI,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,2BAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gCAAA,EAAkC,OAAO,gBAAA,EAAiB;AAAA,EAC1E,QAAA,EAAU;AAAA,IACR,mBAAA,EAAqB;AAAA,GACvB;AAAA,EACA,MAAA,EAAQ,CAAC,6BAA6B,CAAA;AAAA,EACtC,CAAC,QAAQ,MAAA,EAAgD;AACvD,IAAA,MAAM,6BAAA,CAA8B,OAAO,SAAS,CAAA;AAAA,EACtD;AACF,CAAC;;;;"}
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 * @public\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,sBAAA,EAAgD,CAAE,IAAA,CAAK;AAAA,EACrD,EAAA,EAAI;AACN,CAAC,CAAA;AAMI,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,2BAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gCAAA,EAAkC,OAAO,gBAAA,EAAiB;AAAA,EAC1E,QAAA,EAAU;AAAA,IACR,mBAAA,EAAqB;AAAA,GACvB;AAAA,EACA,MAAA,EAAQ,CAAC,6BAA6B,CAAA;AAAA,EACtC,CAAC,QAAQ,MAAA,EAAgD;AACvD,IAAA,MAAM,6BAAA,CAA8B,OAAO,SAAS,CAAA;AAAA,EACtD;AACF,CAAC;;"}
@@ -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/v3';\n\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\nimport { FormField } from '../api';\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":";;;;AAyBA,MAAM,yBAAA,GAA4B,sBAAA,EAEhC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAA,CAAyB;AAAA,EACzD,IAAA,EAAM,uBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,4BAAA,EAA8B,OAAO,YAAA,EAAa;AAAA,EAClE,QAAA,EAAU;AAAA,IACR,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAAA,EAA6C;AACpD,IAAA,MAAM,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA,EAC9C;AACF,CAAC;AAMM,SAAS,gBAGd,IAAA,EAAmE;AACnE,EAAA,OAAO,eAAA,CAAgB,cAAA,CAAe,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/v3';\n\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\nimport { FormField } from '../api';\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":";;;;AAyBA,MAAM,yBAAA,GAA4B,sBAAA,EAEhC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAA,CAAyB;AAAA,EACzD,IAAA,EAAM,uBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,4BAAA,EAA8B,OAAO,YAAA,EAAa;AAAA,EAClE,QAAA,EAAU;AAAA,IACR,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAAA,EAA6C;AACpD,IAAA,MAAM,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA,EAC9C;AACF,CAAC;AAMM,SAAS,gBAGd,IAAA,EAAmE;AACnE,EAAA,OAAO,eAAA,CAAgB,cAAA,CAAe,IAAA,EAAM,IAAI,CAAA;AAClD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"scaffolderTaskOutputsBlueprint.esm.js","sources":["../../../src/next/blueprints/scaffolderTaskOutputsBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { ComponentType } from 'react';\nimport { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-common';\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\n\n/**\n * @alpha\n */\nexport type ScaffolderTemplateOutputsComponent = ComponentType<{\n output?: ScaffolderTaskOutput;\n}>;\n\n/**\n * @alpha\n */\nexport const scaffolderTemplateOutputsComponentRef =\n createExtensionDataRef<ScaffolderTemplateOutputsComponent>().with({\n id: 'scaffolder.template-outputs-component',\n });\n\n/**\n * @alpha\n */\nexport const scaffolderTemplateOutputTemplateRefsRef = createExtensionDataRef<\n string[]\n>().with({\n id: 'scaffolder.template-output-template-refs',\n});\n\n/**\n * @alpha\n */\nexport interface ScaffolderTemplateOutputsBlueprintParams {\n component: ScaffolderTemplateOutputsComponent;\n templateRefs: string[];\n}\n\n/**\n * @alpha\n */\nexport const scaffolderTemplateOutputsBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-template-outputs',\n attachTo: {\n id: 'sub-page:scaffolder/tasks',\n input: 'templateOutputsComponents',\n },\n output: [\n scaffolderTemplateOutputsComponentRef,\n scaffolderTemplateOutputTemplateRefsRef,\n ],\n dataRefs: {\n component: scaffolderTemplateOutputsComponentRef,\n templateRefs: scaffolderTemplateOutputTemplateRefsRef,\n },\n factory: (params: ScaffolderTemplateOutputsBlueprintParams) => {\n return [\n scaffolderTemplateOutputsComponentRef(params.component),\n scaffolderTemplateOutputTemplateRefsRef(params.templateRefs),\n ];\n },\n});\n"],"names":[],"mappings":";;AAgCO,MAAM,qCAAA,GACX,sBAAA,EAA2D,CAAE,IAAA,CAAK;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;AAKI,MAAM,uCAAA,GAA0C,sBAAA,EAErD,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI;AACN,CAAC;AAaM,MAAM,qCAAqC,wBAAA,CAAyB;AAAA,EACzE,IAAA,EAAM,6BAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,2BAAA;AAAA,IACJ,KAAA,EAAO;AAAA,GACT;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,qCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAA,EAAW,qCAAA;AAAA,IACX,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,OAAA,EAAS,CAAC,MAAA,KAAqD;AAC7D,IAAA,OAAO;AAAA,MACL,qCAAA,CAAsC,OAAO,SAAS,CAAA;AAAA,MACtD,uCAAA,CAAwC,OAAO,YAAY;AAAA,KAC7D;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"scaffolderTaskOutputsBlueprint.esm.js","sources":["../../../src/next/blueprints/scaffolderTaskOutputsBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { ComponentType } from 'react';\nimport { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-common';\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\n\n/**\n * @alpha\n */\nexport type ScaffolderTemplateOutputsComponent = ComponentType<{\n output?: ScaffolderTaskOutput;\n}>;\n\n/**\n * @alpha\n */\nexport const scaffolderTemplateOutputsComponentRef =\n createExtensionDataRef<ScaffolderTemplateOutputsComponent>().with({\n id: 'scaffolder.template-outputs-component',\n });\n\n/**\n * @alpha\n */\nexport const scaffolderTemplateOutputTemplateRefsRef = createExtensionDataRef<\n string[]\n>().with({\n id: 'scaffolder.template-output-template-refs',\n});\n\n/**\n * @alpha\n */\nexport interface ScaffolderTemplateOutputsBlueprintParams {\n component: ScaffolderTemplateOutputsComponent;\n templateRefs: string[];\n}\n\n/**\n * @alpha\n */\nexport const scaffolderTemplateOutputsBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-template-outputs',\n attachTo: {\n id: 'sub-page:scaffolder/tasks',\n input: 'templateOutputsComponents',\n },\n output: [\n scaffolderTemplateOutputsComponentRef,\n scaffolderTemplateOutputTemplateRefsRef,\n ],\n dataRefs: {\n component: scaffolderTemplateOutputsComponentRef,\n templateRefs: scaffolderTemplateOutputTemplateRefsRef,\n },\n factory: (params: ScaffolderTemplateOutputsBlueprintParams) => {\n return [\n scaffolderTemplateOutputsComponentRef(params.component),\n scaffolderTemplateOutputTemplateRefsRef(params.templateRefs),\n ];\n },\n});\n"],"names":[],"mappings":";;AAgCO,MAAM,qCAAA,GACX,sBAAA,EAA2D,CAAE,IAAA,CAAK;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;AAKI,MAAM,uCAAA,GAA0C,sBAAA,EAErD,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI;AACN,CAAC;AAaM,MAAM,qCAAqC,wBAAA,CAAyB;AAAA,EACzE,IAAA,EAAM,6BAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,2BAAA;AAAA,IACJ,KAAA,EAAO;AAAA,GACT;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,qCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAA,EAAW,qCAAA;AAAA,IACX,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,OAAA,EAAS,CAAC,MAAA,KAAqD;AAC7D,IAAA,OAAO;AAAA,MACL,qCAAA,CAAsC,OAAO,SAAS,CAAA;AAAA,MACtD,uCAAA,CAAwC,OAAO,YAAY;AAAA,KAC7D;AAAA,EACF;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Form.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"Form.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../../src/next/components/Form/BuiTheme/index.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\nimport { ThemeProps } from '@rjsf/core';\n\nimport { generateBuiTemplates } from './templates';\nimport { generateBuiWidgets } from './widgets';\n\nexport function generateBuiTheme<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(): ThemeProps<T, S, F> {\n return {\n templates: generateBuiTemplates<T, S, F>(),\n widgets: generateBuiWidgets<T, S, F>(),\n };\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,gBAAA,GAIS;AACvB,EAAA,OAAO;AAAA,IACL,WAAW,oBAAA,EAA8B;AAAA,IACzC,SAAS,kBAAA;AAA4B,GACvC;AACF;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../src/next/components/Form/BuiTheme/index.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\nimport { ThemeProps } from '@rjsf/core';\n\nimport { generateBuiTemplates } from './templates';\nimport { generateBuiWidgets } from './widgets';\n\nexport function generateBuiTheme<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(): ThemeProps<T, S, F> {\n return {\n templates: generateBuiTemplates<T, S, F>(),\n widgets: generateBuiWidgets<T, S, F>(),\n };\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,gBAAA,GAIS;AACvB,EAAA,OAAO;AAAA,IACL,WAAW,oBAAA,EAA8B;AAAA,IACzC,SAAS,kBAAA;AAA4B,GACvC;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldDescriptionTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { isValidElement } from 'react';\nimport {\n ArrayFieldDescriptionProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport default function ArrayFieldDescriptionTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: ArrayFieldDescriptionProps<T, S, F>) {\n const { description } = props;\n if (!description) {\n return null;\n }\n\n if (isValidElement(description)) {\n return <>{description}</>;\n }\n\n return <MarkdownContent content={description as string} linkTarget=\"_blank\" />;\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAwB,8BAItB,KAAA,EAA4C;AAC5C,EAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,cAAA,CAAe,WAAW,CAAA,EAAG;AAC/B,IAAA,uCAAU,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,EACxB;AAEA,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAuB,YAAW,QAAA,EAAS,CAAA;AAC9E;;;;"}
1
+ {"version":3,"file":"ArrayFieldDescriptionTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { isValidElement } from 'react';\nimport {\n ArrayFieldDescriptionProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport default function ArrayFieldDescriptionTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: ArrayFieldDescriptionProps<T, S, F>) {\n const { description } = props;\n if (!description) {\n return null;\n }\n\n if (isValidElement(description)) {\n return <>{description}</>;\n }\n\n return <MarkdownContent content={description as string} linkTarget=\"_blank\" />;\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAwB,8BAItB,KAAA,EAA4C;AAC5C,EAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,cAAA,CAAe,WAAW,CAAA,EAAG;AAC/B,IAAA,uCAAU,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,EACxB;AAEA,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAuB,YAAW,QAAA,EAAS,CAAA;AAC9E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldItemTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 ArrayFieldTemplateItemType,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { useState } from 'react';\nimport {\n Card,\n CardHeader,\n CardBody,\n Flex,\n Text,\n ButtonIcon,\n Box,\n Button,\n} from '@backstage/ui';\nimport { Disclosure, DisclosurePanel } from 'react-aria-components';\nimport {\n RiArrowDownSLine,\n RiArrowUpSLine,\n RiDeleteBinLine,\n RiAddLine,\n RiArrowRightSLine,\n} from '@remixicon/react';\n\nexport default function ArrayFieldItemTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n children,\n disabled,\n hasToolbar,\n hasCopy,\n hasMoveDown,\n hasMoveUp,\n hasRemove,\n index,\n onCopyIndexClick,\n onDropIndexClick,\n onReorderClick,\n readonly,\n schema,\n}: ArrayFieldTemplateItemType<T, S, F>) {\n const [isOpen, setIsOpen] = useState(true);\n\n const itemSchema = schema?.items as S | undefined;\n const itemTitle = itemSchema?.title\n ? `${itemSchema.title} ${index + 1}`\n : `Item ${index + 1}`;\n\n return (\n <Box mb=\"4\">\n <Card>\n <Disclosure isExpanded={isOpen} onExpandedChange={setIsOpen}>\n {({ isExpanded }) => (\n <>\n <CardHeader\n style={{ backgroundColor: 'var(--bui-bg-neutral-2)' }}\n >\n <Box py=\"3\" px=\"4\">\n <Flex align=\"center\" justify=\"between\">\n <Flex align=\"center\" gap=\"2\">\n <Button\n slot=\"trigger\"\n style={{\n padding: '2px',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n color: 'var(--bui-fg-secondary)',\n }}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n >\n {isExpanded ? (\n <RiArrowDownSLine size={18} />\n ) : (\n <RiArrowRightSLine size={18} />\n )}\n </Button>\n <Text variant=\"body-medium\" weight=\"bold\">\n {itemTitle}\n </Text>\n </Flex>\n {hasToolbar && (\n <Flex align=\"center\" gap=\"1\">\n {(hasMoveUp || hasMoveDown) && (\n <>\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly || !hasMoveUp}\n onClick={onReorderClick(index, index - 1)}\n aria-label=\"Move up\"\n icon={<RiArrowUpSLine size={18} />}\n />\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly || !hasMoveDown}\n onClick={onReorderClick(index, index + 1)}\n aria-label=\"Move down\"\n icon={<RiArrowDownSLine size={18} />}\n />\n </>\n )}\n {hasCopy && (\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly}\n onClick={onCopyIndexClick(index)}\n aria-label=\"Duplicate\"\n icon={<RiAddLine size={18} />}\n />\n )}\n {hasRemove && (\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly}\n onClick={onDropIndexClick(index)}\n aria-label=\"Remove\"\n icon={<RiDeleteBinLine size={18} />}\n />\n )}\n </Flex>\n )}\n </Flex>\n </Box>\n </CardHeader>\n <DisclosurePanel>\n <CardBody>\n <Box p=\"4\">{children}</Box>\n </CardBody>\n </DisclosurePanel>\n </>\n )}\n </Disclosure>\n </Card>\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;AAyCA,SAAwB,sBAAA,CAItB;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAwC;AACtC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,IAAI,CAAA;AAEzC,EAAA,MAAM,aAAa,MAAA,EAAQ,KAAA;AAC3B,EAAA,MAAM,SAAA,GAAY,UAAA,EAAY,KAAA,GAC1B,CAAA,EAAG,UAAA,CAAW,KAAK,CAAA,CAAA,EAAI,KAAA,GAAQ,CAAC,CAAA,CAAA,GAChC,CAAA,KAAA,EAAQ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,QAAA;AAAA,gBACxB,OAAA,EAAS,iBAAiB,KAAK,CAAA;AAAA,gBAC/B,YAAA,EAAW,WAAA;AAAA,gBACX,IAAA,kBAAM,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA,aAC7B;AAAA,YAED,SAAA,oBACC,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAQ,UAAA;AAAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,YAAY,QAAA,IAAY,QAAA;AAAA,gBACxB,OAAA,EAAS,iBAAiB,KAAK,CAAA;AAAA,gBAC/B,YAAA,EAAW,QAAA;AAAA,gBACX,IAAA,kBAAM,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA;AACnC,WAAA,EAEJ;AAAA,SAAA,EAEJ,CAAA,EACF;AAAA;AAAA,KACF;AAAA,oBACA,GAAA,CAAC,eAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,OAAI,CAAA,EAAE,GAAA,EAAK,QAAA,EAAS,CAAA,EACvB,CAAA,EACF;AAAA,GAAA,EACF,CAAA,EAEJ,GACF,CAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ArrayFieldItemTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 ArrayFieldTemplateItemType,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { useState } from 'react';\nimport {\n Card,\n CardHeader,\n CardBody,\n Flex,\n Text,\n ButtonIcon,\n Box,\n Button,\n} from '@backstage/ui';\nimport { Disclosure, DisclosurePanel } from 'react-aria-components';\nimport {\n RiArrowDownSLine,\n RiArrowUpSLine,\n RiDeleteBinLine,\n RiAddLine,\n RiArrowRightSLine,\n} from '@remixicon/react';\n\nexport default function ArrayFieldItemTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n children,\n disabled,\n hasToolbar,\n hasCopy,\n hasMoveDown,\n hasMoveUp,\n hasRemove,\n index,\n onCopyIndexClick,\n onDropIndexClick,\n onReorderClick,\n readonly,\n schema,\n}: ArrayFieldTemplateItemType<T, S, F>) {\n const [isOpen, setIsOpen] = useState(true);\n\n const itemSchema = schema?.items as S | undefined;\n const itemTitle = itemSchema?.title\n ? `${itemSchema.title} ${index + 1}`\n : `Item ${index + 1}`;\n\n return (\n <Box mb=\"4\">\n <Card>\n <Disclosure isExpanded={isOpen} onExpandedChange={setIsOpen}>\n {({ isExpanded }) => (\n <>\n <CardHeader\n style={{ backgroundColor: 'var(--bui-bg-neutral-2)' }}\n >\n <Box py=\"3\" px=\"4\">\n <Flex align=\"center\" justify=\"between\">\n <Flex align=\"center\" gap=\"2\">\n <Button\n slot=\"trigger\"\n style={{\n padding: '2px',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n color: 'var(--bui-fg-secondary)',\n }}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n >\n {isExpanded ? (\n <RiArrowDownSLine size={18} />\n ) : (\n <RiArrowRightSLine size={18} />\n )}\n </Button>\n <Text variant=\"body-medium\" weight=\"bold\">\n {itemTitle}\n </Text>\n </Flex>\n {hasToolbar && (\n <Flex align=\"center\" gap=\"1\">\n {(hasMoveUp || hasMoveDown) && (\n <>\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly || !hasMoveUp}\n onClick={onReorderClick(index, index - 1)}\n aria-label=\"Move up\"\n icon={<RiArrowUpSLine size={18} />}\n />\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly || !hasMoveDown}\n onClick={onReorderClick(index, index + 1)}\n aria-label=\"Move down\"\n icon={<RiArrowDownSLine size={18} />}\n />\n </>\n )}\n {hasCopy && (\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly}\n onClick={onCopyIndexClick(index)}\n aria-label=\"Duplicate\"\n icon={<RiAddLine size={18} />}\n />\n )}\n {hasRemove && (\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly}\n onClick={onDropIndexClick(index)}\n aria-label=\"Remove\"\n icon={<RiDeleteBinLine size={18} />}\n />\n )}\n </Flex>\n )}\n </Flex>\n </Box>\n </CardHeader>\n <DisclosurePanel>\n <CardBody>\n <Box p=\"4\">{children}</Box>\n </CardBody>\n </DisclosurePanel>\n </>\n )}\n </Disclosure>\n </Card>\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;AAyCA,SAAwB,sBAAA,CAItB;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAwC;AACtC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,IAAI,CAAA;AAEzC,EAAA,MAAM,aAAa,MAAA,EAAQ,KAAA;AAC3B,EAAA,MAAM,SAAA,GAAY,UAAA,EAAY,KAAA,GAC1B,CAAA,EAAG,UAAA,CAAW,KAAK,CAAA,CAAA,EAA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AAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,YAAY,QAAA,IAAY,QAAA;AAAA,gBACxB,OAAA,EAAS,iBAAiB,KAAK,CAAA;AAAA,gBAC/B,YAAA,EAAW,WAAA;AAAA,gBACX,IAAA,kBAAM,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA,aAC7B;AAAA,YAED,SAAA,oBACC,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAQ,UAAA;AAAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,YAAY,QAAA,IAAY,QAAA;AAAA,gBACxB,OAAA,EAAS,iBAAiB,KAAK,CAAA;AAAA,gBAC/B,YAAA,EAAW,QAAA;AAAA,gBACX,IAAA,kBAAM,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA;AACnC,WAAA,EAEJ;AAAA,SAAA,EAEJ,CAAA,EACF;AAAA;AAAA,KACF;AAAA,oBACA,GAAA,CAAC,eAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,OAAI,CAAA,EAAE,GAAA,EAAK,QAAA,EAAS,CAAA,EACvB,CAAA,EACF;AAAA,GAAA,EACF,CAAA,EAEJ,GACF,CAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 ArrayFieldTemplateProps,\n ArrayFieldTemplateItemType,\n FormContextType,\n getTemplate,\n getUiOptions,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { Box, Text } from '@backstage/ui';\n\nexport default function ArrayFieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n canAdd,\n disabled,\n idSchema,\n uiSchema,\n items,\n onAddClick,\n readonly,\n registry,\n required,\n schema,\n title,\n}: ArrayFieldTemplateProps<T, S, F>) {\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const ArrayFieldDescriptionTemplate = getTemplate<\n 'ArrayFieldDescriptionTemplate',\n T,\n S,\n F\n >('ArrayFieldDescriptionTemplate', registry, uiOptions);\n const ArrayFieldItemTemplate = getTemplate<\n 'ArrayFieldItemTemplate',\n T,\n S,\n F\n >('ArrayFieldItemTemplate', registry, uiOptions);\n const ArrayFieldTitleTemplate = getTemplate<\n 'ArrayFieldTitleTemplate',\n T,\n S,\n F\n >('ArrayFieldTitleTemplate', registry, uiOptions);\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n\n const hasTitle = uiOptions.title || title;\n const hasDescription = uiOptions.description || schema.description;\n\n return (\n <Box mb=\"4\">\n {hasTitle && (\n <Box mb=\"2\">\n <ArrayFieldTitleTemplate\n idSchema={idSchema}\n title={uiOptions.title || title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n {hasDescription && (\n <Box mb=\"2\">\n <ArrayFieldDescriptionTemplate\n idSchema={idSchema}\n description={uiOptions.description || schema.description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n {items && items.length > 0 ? (\n items.map(\n ({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (\n <ArrayFieldItemTemplate key={key} {...itemProps} />\n ),\n )\n ) : (\n <Box\n p=\"3\"\n mb=\"4\"\n style={{\n backgroundColor: 'var(--bui-bg-neutral-2)',\n borderRadius: 'var(--bui-radius-2)',\n }}\n >\n <Text\n variant=\"body-medium\"\n color=\"secondary\"\n style={{ textAlign: 'center' }}\n >\n No items added yet\n </Text>\n </Box>\n )}\n {canAdd && (\n <Box>\n <AddButton\n onClick={onAddClick}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAwB,kBAAA,CAItB;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAqC;AACnC,EAAA,MAAM,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,6BAAA,GAAgC,WAAA,CAKpC,+BAAA,EAAiC,QAAA,EAAU,SAAS,CAAA;AACtD,EAAA,MAAM,sBAAA,GAAyB,WAAA,CAK7B,wBAAA,EAA0B,QAAA,EAAU,SAAS,CAAA;AAC/C,EAAA,MAAM,uBAAA,GAA0B,WAAA,CAK9B,yBAAA,EAA2B,QAAA,EAAU,SAAS,CAAA;AAChD,EAAA,MAAM;AAAA,IACJ,eAAA,EAAiB,EAAE,SAAA;AAAU,MAC3B,QAAA,CAAS,SAAA;AAEb,EAAA,MAAM,QAAA,GAAW,UAAU,KAAA,IAAS,KAAA;AACpC,EAAA,MAAM,cAAA,GAAiB,SAAA,CAAU,WAAA,IAAe,MAAA,CAAO,WAAA;AAEvD,EAAA,uBACE,IAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,GAAA,EACL,QAAA,EAAA;AAAA,IAAA,QAAA,oBACC,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,GAAA,EACN,QAAA,kBAAA,GA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QAAA,IAAY,QAAA;AAAA,QACtB,QAAA;AAAA,QACA;AAAA;AAAA,KACF,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ArrayFieldTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 ArrayFieldTemplateProps,\n ArrayFieldTemplateItemType,\n FormContextType,\n getTemplate,\n getUiOptions,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { Box, Text } from '@backstage/ui';\n\nexport default function ArrayFieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n canAdd,\n disabled,\n idSchema,\n uiSchema,\n items,\n onAddClick,\n readonly,\n registry,\n required,\n schema,\n title,\n}: ArrayFieldTemplateProps<T, S, F>) {\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const ArrayFieldDescriptionTemplate = getTemplate<\n 'ArrayFieldDescriptionTemplate',\n T,\n S,\n F\n >('ArrayFieldDescriptionTemplate', registry, uiOptions);\n const ArrayFieldItemTemplate = getTemplate<\n 'ArrayFieldItemTemplate',\n T,\n S,\n F\n >('ArrayFieldItemTemplate', registry, uiOptions);\n const ArrayFieldTitleTemplate = getTemplate<\n 'ArrayFieldTitleTemplate',\n T,\n S,\n F\n >('ArrayFieldTitleTemplate', registry, uiOptions);\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n\n const hasTitle = uiOptions.title || title;\n const hasDescription = uiOptions.description || schema.description;\n\n return (\n <Box mb=\"4\">\n {hasTitle && (\n <Box mb=\"2\">\n <ArrayFieldTitleTemplate\n idSchema={idSchema}\n title={uiOptions.title || title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n {hasDescription && (\n <Box mb=\"2\">\n <ArrayFieldDescriptionTemplate\n idSchema={idSchema}\n description={uiOptions.description || schema.description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n {items && items.length > 0 ? (\n items.map(\n ({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (\n <ArrayFieldItemTemplate key={key} {...itemProps} />\n ),\n )\n ) : (\n <Box\n p=\"3\"\n mb=\"4\"\n style={{\n backgroundColor: 'var(--bui-bg-neutral-2)',\n borderRadius: 'var(--bui-radius-2)',\n }}\n >\n <Text\n variant=\"body-medium\"\n color=\"secondary\"\n style={{ textAlign: 'center' }}\n >\n No items added yet\n </Text>\n </Box>\n )}\n {canAdd && (\n <Box>\n <AddButton\n onClick={onAddClick}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAwB,kBAAA,CAItB;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAqC;AACnC,EAAA,MAAM,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,6BAAA,GAAgC,WAAA,CAKpC,+BAAA,EAAiC,QAAA,EAAU,SAAS,CAAA;AACtD,EAAA,MAAM,sBAAA,GAAyB,WAAA,CAK7B,wBAAA,EAA0B,QAAA,EAAU,SAAS,CAAA;AAC/C,EAAA,MAAM,uB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