@backstage/plugin-scaffolder-react 1.18.1-next.0 → 1.19.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 (68) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/alpha.d.ts +23 -46
  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.map +1 -1
  9. package/dist/index.d.ts +67 -201
  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/FormFieldsApi.esm.js +4 -4
  13. package/dist/next/api/FormFieldsApi.esm.js.map +1 -1
  14. package/dist/next/api/ref.esm.js.map +1 -1
  15. package/dist/next/blueprints/FormDecoratorBlueprint.esm.js.map +1 -1
  16. package/dist/next/blueprints/FormFieldBlueprint.esm.js.map +1 -1
  17. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
  18. package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
  19. package/dist/next/components/Form/Form.esm.js.map +1 -1
  20. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
  21. package/dist/next/components/ReviewState/ReviewState.esm.js +1 -1
  22. package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
  23. package/dist/next/components/ReviewState/util.esm.js.map +1 -1
  24. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
  25. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
  26. package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
  27. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
  28. package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js.map +1 -1
  29. package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
  30. package/dist/next/components/Stepper/createAsyncValidators.esm.js.map +1 -1
  31. package/dist/next/components/Stepper/utils.esm.js.map +1 -1
  32. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
  33. package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
  34. package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
  35. package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
  36. package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
  37. package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
  38. package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
  39. package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
  40. package/dist/next/components/TemplateCard/TemplateCardActions.esm.js.map +1 -1
  41. package/dist/next/components/TemplateCard/TemplateCardContent.esm.js.map +1 -1
  42. package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js.map +1 -1
  43. package/dist/next/components/TemplateCard/TemplateCardTags.esm.js.map +1 -1
  44. package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js.map +1 -1
  45. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
  46. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
  47. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
  48. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
  49. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
  50. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
  51. package/dist/next/components/Workflow/Workflow.esm.js +1 -1
  52. package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
  53. package/dist/next/extensions/createScaffolderFormDecorator.esm.js.map +1 -1
  54. package/dist/next/hooks/useFilteredSchemaProperties.esm.js.map +1 -1
  55. package/dist/next/hooks/useFormDataFromQuery.esm.js.map +1 -1
  56. package/dist/next/hooks/useTemplateParameterSchema.esm.js.map +1 -1
  57. package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
  58. package/dist/next/hooks/useTemplateTimeSaved.esm.js.map +1 -1
  59. package/dist/next/hooks/useTransformSchemaToProps.esm.js.map +1 -1
  60. package/dist/next/lib/schema.esm.js.map +1 -1
  61. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  62. package/dist/packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js.map +1 -1
  63. package/dist/packages/scaffolder-internal/src/wiring/InternalFormField.esm.js.map +1 -1
  64. package/dist/secrets/SecretsContext.esm.js +1 -1
  65. package/dist/secrets/SecretsContext.esm.js.map +1 -1
  66. package/dist/translation.esm.js.map +1 -1
  67. package/dist/utils.esm.js.map +1 -1
  68. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardContent.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardContent.tsx"],"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 { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(() => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n },\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n margin: 0,\n },\n },\n}));\n\n/**\n * The Props for the {@link TemplateCardContent} component\n * @alpha\n */\nexport interface TemplateCardContentProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardContent = ({ template }: TemplateCardContentProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const styles = useStyles();\n return (\n <Grid item xs={12} data-testid=\"template-card-content-grid\">\n <Box className={styles.box} data-testid=\"template-card-content-container\">\n <MarkdownContent\n className={styles.markdown}\n content={\n template.metadata.description ?? t('templateCard.noDescription')\n }\n />\n </Box>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,GAAK,EAAA;AAAA,IACH,QAAU,EAAA,QAAA;AAAA,IACV,YAAc,EAAA,UAAA;AAAA,IACd,OAAS,EAAA,aAAA;AAAA,IACT,oBAAsB,EAAA,EAAA;AAAA,IACtB,oBAAsB,EAAA;AAAA,GACxB;AAAA,EACA,QAAU,EAAA;AAAA;AAAA,IAER,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA;AAAA;AACV;AAEJ,CAAE,CAAA,CAAA;AASK,MAAM,mBAAsB,GAAA,CAAC,EAAE,QAAA,EAAyC,KAAA;AAC7E,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAS,SAAU,EAAA;AACzB,EAAA,uBACG,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EAAI,EAAA,aAAA,EAAY,4BAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,GAAA,EAAK,eAAY,iCACtC,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,MAAO,CAAA,QAAA;AAAA,MAClB,OACE,EAAA,QAAA,CAAS,QAAS,CAAA,WAAA,IAAe,EAAE,4BAA4B;AAAA;AAAA,KAGrE,CACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCardContent.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardContent.tsx"],"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 { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(() => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n },\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n margin: 0,\n },\n },\n}));\n\n/**\n * The Props for the {@link TemplateCardContent} component\n * @alpha\n */\nexport interface TemplateCardContentProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardContent = ({ template }: TemplateCardContentProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const styles = useStyles();\n return (\n <Grid item xs={12} data-testid=\"template-card-content-grid\">\n <Box className={styles.box} data-testid=\"template-card-content-container\">\n <MarkdownContent\n className={styles.markdown}\n content={\n template.metadata.description ?? t('templateCard.noDescription')\n }\n />\n </Box>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,GAAA,EAAK;AAAA,IACH,QAAA,EAAU,QAAA;AAAA,IACV,YAAA,EAAc,UAAA;AAAA,IACd,OAAA,EAAS,aAAA;AAAA,IACT,oBAAA,EAAsB,EAAA;AAAA,IACtB,oBAAA,EAAsB;AAAA,GACxB;AAAA,EACA,QAAA,EAAU;AAAA;AAAA,IAER,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ;AAAA;AACV;AAEJ,CAAA,CAAE,CAAA;AASK,MAAM,mBAAA,GAAsB,CAAC,EAAE,QAAA,EAAS,KAAgC;AAC7E,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EAAI,aAAA,EAAY,4BAAA,EAC7B,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,GAAA,EAAK,eAAY,iCAAA,EACtC,QAAA,kBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,MAAA,CAAO,QAAA;AAAA,MAClB,OAAA,EACE,QAAA,CAAS,QAAA,CAAS,WAAA,IAAe,EAAE,4BAA4B;AAAA;AAAA,KAGrE,CAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardLinks.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardLinks.tsx"],"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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport { CardLink } from './CardLink';\n\nconst useStyles = makeStyles<Theme>({});\n\n/**\n * The Props for the {@link TemplateCardLinks} component\n * @alpha\n */\nexport interface TemplateCardLinksProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\nexport const TemplateCardLinks = ({\n template,\n additionalLinks,\n}: TemplateCardLinksProps) => {\n const styles = useStyles();\n const app = useApp();\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n return (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--links\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-links\">\n {additionalLinks?.map(({ icon, text, url }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--item\"\n >\n <CardLink icon={icon} text={text} url={url} />\n </Grid>\n ))}\n {template.metadata.links?.map(({ url, icon, title }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--metalink\"\n >\n <CardLink\n icon={iconResolver(icon)}\n text={title || url}\n url={url}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM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AG,KACnD,qBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAO,CAAA,QAAA;AAAA,UAClB,IAAI,EAAA,IAAA;AAAA,UACJ,EAAI,EAAA,CAAA;AAAA,UAEJ,aAAY,EAAA,+BAAA;AAAA,UAEZ,QAAA,kBAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAM,aAAa,IAAI,CAAA;AAAA,cACvB,MAAM,KAAS,IAAA,GAAA;AAAA,cACf;AAAA;AAAA;AACF,SAAA;AAAA,QAPK;AAAA,OASR;AAAA,KAAA,EACH,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCardLinks.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardLinks.tsx"],"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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport { CardLink } from './CardLink';\n\nconst useStyles = makeStyles<Theme>({});\n\n/**\n * The Props for the {@link TemplateCardLinks} component\n * @alpha\n */\nexport interface TemplateCardLinksProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\nexport const TemplateCardLinks = ({\n template,\n additionalLinks,\n}: TemplateCardLinksProps) => {\n const styles = useStyles();\n const app = useApp();\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n return (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--links\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-links\">\n {additionalLinks?.map(({ icon, text, url }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--item\"\n >\n <CardLink icon={icon} text={text} url={url} />\n </Grid>\n ))}\n {template.metadata.links?.map(({ url, icon, title }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--metalink\"\n >\n <CardLink\n icon={iconResolver(icon)}\n text={title || url}\n url={url}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,UAAA,CAAkB,EAAE,CAAA;AAc/B,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAAA,KAA8B;AAC5B,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,YAAA,GAAe,CAAC,GAAA,KACpB,GAAA,GAAM,IAAI,aAAA,CAAc,GAAG,KAAK,YAAA,GAAe,YAAA;AACjD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,aAAA,EAAY,gCAAA,EAAiC,CAAA,EACxD,CAAA;AAAA,oBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,CAAA,EAAG,eAAY,qBAAA,EACrC,QAAA,EAAA;AAAA,MAAA,eAAA,EAAiB,IAAI,CAAC,EAAE,MAAM,IAAA,EAAM,GAAA,IAAO,KAAA,qBAC1C,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAA,CAAO,QAAA;AAAA,UAClB,IAAA,EAAI,IAAA;AAAA,UACJ,EAAA,EAAI,CAAA;AAAA,UAEJ,aAAA,EAAY,2BAAA;AAAA,UAEZ,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAY,IAAA,EAAY,GAAA,EAAU;AAAA,SAAA;AAAA,QAHvC;AAAA,OAKR,CAAA;AAAA,MACA,QAAA,CAAS,QAAA,CAAS,KAAA,EAAO,GAAA,CAAI,CAAC,EAAE,GAAA,EAAK,IAAA,EAAM,KAAA,EAAM,EAAG,KAAA,qBACnD,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAA,CAAO,QAAA;AAAA,UAClB,IAAA,EAAI,IAAA;AAAA,UACJ,EAAA,EAAI,CAAA;AAAA,UAEJ,aAAA,EAAY,+BAAA;AAAA,UAEZ,QAAA,kBAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAM,aAAa,IAAI,CAAA;AAAA,cACvB,MAAM,KAAA,IAAS,GAAA;AAAA,cACf;AAAA;AAAA;AACF,SAAA;AAAA,QAPK;AAAA,OASR;AAAA,KAAA,EACH,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardTags.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardTags.tsx"],"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 type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\n\n/**\n * The Props for the {@link TemplateCardTags} component\n * @alpha\n */\nexport interface TemplateCardTagsProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardTags = ({ template }: TemplateCardTagsProps) => (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--tags\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-tags\">\n {template.metadata.tags?.map(tag => (\n <Grid\n key={`grid-${tag}`}\n item\n data-testid={`template-card-tag-item-${tag}`}\n >\n <Chip\n style={{ margin: 0 }}\n size=\"small\"\n data-testid={`template-card-tag-chip-${tag}`}\n label={tag}\n key={tag}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,gBAAmB,GAAA,CAAC,EAAE,QAAA,uBAE/B,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,kBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,OAAA,EAAA,EAAQ,aAAY,EAAA,+BAAA,EAAgC,CACvD,EAAA,CAAA;AAAA,sBACC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,EAAA,EACb,8BAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,OAAA,EAAS,GAAG,aAAY,EAAA,oBAAA,EACrC,mBAAS,QAAS,CAAA,IAAA,EAAM,IAAI,CAC3B,GAAA,qBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MAEC,IAAI,EAAA,IAAA;AAAA,MACJ,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,MAE1C,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAE,EAAA;AAAA,UACnB,IAAK,EAAA,OAAA;AAAA,UACL,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,UAC1C,KAAO,EAAA;AAAA,SAAA;AAAA,QACF;AAAA;AACP,KAAA;AAAA,IAVK,QAAQ,GAAG,CAAA;AAAA,GAYnB,GACH,CACF,EAAA;AAAA,CACF,EAAA;;;;"}
1
+ {"version":3,"file":"TemplateCardTags.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardTags.tsx"],"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 type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\n\n/**\n * The Props for the {@link TemplateCardTags} component\n * @alpha\n */\nexport interface TemplateCardTagsProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardTags = ({ template }: TemplateCardTagsProps) => (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--tags\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-tags\">\n {template.metadata.tags?.map(tag => (\n <Grid\n key={`grid-${tag}`}\n item\n data-testid={`template-card-tag-item-${tag}`}\n >\n <Chip\n style={{ margin: 0 }}\n size=\"small\"\n data-testid={`template-card-tag-chip-${tag}`}\n label={tag}\n key={tag}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,gBAAA,GAAmB,CAAC,EAAE,QAAA,uBACjC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,aAAA,EAAY,+BAAA,EAAgC,CAAA,EACvD,CAAA;AAAA,sBACC,IAAA,EAAA,EAAK,IAAA,EAAI,MAAC,EAAA,EAAI,EAAA,EACb,8BAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,GAAG,aAAA,EAAY,oBAAA,EACrC,mBAAS,QAAA,CAAS,IAAA,EAAM,IAAI,CAAA,GAAA,qBAC3B,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MAEC,IAAA,EAAI,IAAA;AAAA,MACJ,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,MAE1C,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAE;AAAA,UACnB,IAAA,EAAK,OAAA;AAAA,UACL,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,UAC1C,KAAA,EAAO;AAAA,SAAA;AAAA,QACF;AAAA;AACP,KAAA;AAAA,IAVK,QAAQ,GAAG,CAAA;AAAA,GAYnB,GACH,CAAA,EACF;AAAA,CAAA,EACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateDetailButton.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateDetailButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { Link } from '@backstage/core-components';\nimport {\n entityRouteParams,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\nexport interface TemplateDetailButtonProps {\n template: Entity;\n className?: string;\n}\n\nexport const TemplateDetailButton = ({\n template,\n className,\n}: TemplateDetailButtonProps) => {\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const entityRef = stringifyEntityRef(template);\n\n const app = useApp();\n const TemplateIcon = app.getSystemIcon('kind:template') || DescriptionIcon;\n\n return (\n <Tooltip id={`tooltip-${entityRef}`} title={t('cardHeader.detailBtnTitle')}>\n <IconButton\n aria-label={t('cardHeader.detailBtnTitle')}\n id={`viewDetail-${entityRef}`}\n style={{ padding: 0 }}\n >\n <Typography component=\"span\">\n <Link\n to={catalogEntityRoute(entityRouteParams(template))}\n style={{ display: 'flex', alignItems: 'center' }}\n >\n <TemplateIcon className={className} />\n </Link>\n </Typography>\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,uBAAuB,CAAC;AAAA,EACnC,QAAA;AAAA,EACA;AACF,CAAiC,KAAA;AAC/B,EAAM,MAAA,kBAAA,GAAqB,YAAY,cAAc,CAAA;AACrD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAM,MAAA,SAAA,GAAY,mBAAmB,QAAQ,CAAA;AAE7C,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAA,MAAM,YAAe,GAAA,GAAA,CAAI,aAAc,CAAA,eAAe,CAAK,IAAA,eAAA;AAE3D,EACE,uBAAA,GAAA,CAAC,WAAQ,EAAI,EAAA,CAAA,QAAA,EAAW,SAAS,CAAI,CAAA,EAAA,KAAA,EAAO,CAAE,CAAA,2BAA2B,CACvE,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,EAAE,2BAA2B,CAAA;AAAA,MACzC,EAAA,EAAI,cAAc,SAAS,CAAA,CAAA;AAAA,MAC3B,KAAA,EAAO,EAAE,OAAA,EAAS,CAAE,EAAA;AAAA,MAEpB,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAU,MACpB,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA,kBAAA,CAAmB,iBAAkB,CAAA,QAAQ,CAAC,CAAA;AAAA,UAClD,KAAO,EAAA,EAAE,OAAS,EAAA,MAAA,EAAQ,YAAY,QAAS,EAAA;AAAA,UAE/C,QAAA,kBAAA,GAAA,CAAC,gBAAa,SAAsB,EAAA;AAAA;AAAA,OAExC,EAAA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateDetailButton.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateDetailButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { Link } from '@backstage/core-components';\nimport {\n entityRouteParams,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\nexport interface TemplateDetailButtonProps {\n template: Entity;\n className?: string;\n}\n\nexport const TemplateDetailButton = ({\n template,\n className,\n}: TemplateDetailButtonProps) => {\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const entityRef = stringifyEntityRef(template);\n\n const app = useApp();\n const TemplateIcon = app.getSystemIcon('kind:template') || DescriptionIcon;\n\n return (\n <Tooltip id={`tooltip-${entityRef}`} title={t('cardHeader.detailBtnTitle')}>\n <IconButton\n aria-label={t('cardHeader.detailBtnTitle')}\n id={`viewDetail-${entityRef}`}\n style={{ padding: 0 }}\n >\n <Typography component=\"span\">\n <Link\n to={catalogEntityRoute(entityRouteParams(template))}\n style={{ display: 'flex', alignItems: 'center' }}\n >\n <TemplateIcon className={className} />\n </Link>\n </Typography>\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,uBAAuB,CAAC;AAAA,EACnC,QAAA;AAAA,EACA;AACF,CAAA,KAAiC;AAC/B,EAAA,MAAM,kBAAA,GAAqB,YAAY,cAAc,CAAA;AACrD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAA,GAAY,mBAAmB,QAAQ,CAAA;AAE7C,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,YAAA,GAAe,GAAA,CAAI,aAAA,CAAc,eAAe,CAAA,IAAK,eAAA;AAE3D,EAAA,uBACE,GAAA,CAAC,WAAQ,EAAA,EAAI,CAAA,QAAA,EAAW,SAAS,CAAA,CAAA,EAAI,KAAA,EAAO,CAAA,CAAE,2BAA2B,CAAA,EACvE,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,EAAE,2BAA2B,CAAA;AAAA,MACzC,EAAA,EAAI,cAAc,SAAS,CAAA,CAAA;AAAA,MAC3B,KAAA,EAAO,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,MAEpB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAU,MAAA,EACpB,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,EAAA,EAAI,kBAAA,CAAmB,iBAAA,CAAkB,QAAQ,CAAC,CAAA;AAAA,UAClD,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAQ,YAAY,QAAA,EAAS;AAAA,UAE/C,QAAA,kBAAA,GAAA,CAAC,gBAAa,SAAA,EAAsB;AAAA;AAAA,OACtC,EACF;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCategoryPicker.esm.js","sources":["../../../../src/next/components/TemplateCategoryPicker/TemplateCategoryPicker.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 { Progress } from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport capitalize from 'lodash/capitalize';\nimport { ReactNode } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/** @alpha */\nexport type ScaffolderReactTemplateCategoryPickerClassKey = 'root' | 'label';\n\nconst useStyles = makeStyles(\n {\n root: {},\n label: {},\n },\n { name: 'ScaffolderReactTemplateCategoryPicker' },\n);\n\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n * @alpha\n */\nexport const TemplateCategoryPicker = () => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography\n className={classes.label}\n variant=\"button\"\n component=\"label\"\n htmlFor=\"categories-picker\"\n >\n {t('templateCategoryPicker.title')}\n </Typography>\n <Autocomplete<string, true>\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n id=\"categories-picker\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAM,IAAO,mBAAA,GAAA,CAAC,wBAAyB,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AACxD,MAAM,WAAc,mBAAA,GAAA,CAAC,YAAa,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAKnD,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,MAAM,EAAC;AAAA,IACP,OAAO;AAAC,GACV;AAAA,EACA,EAAE,MAAM,uCAAwC;AAClD,CAAA;AAOO,MAAM,yBAAyB,MAAM;AAC1C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,gBAAgB,aAAe,EAAA,gBAAA,KACrD,mBAAoB,EAAA;AAEtB,EAAI,IAAA,OAAA,EAAgB,uBAAA,GAAA,CAAC,QAAS,EAAA,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,IAAK,EAAA,OAAA;AAAA,QACL,SAAA,sBAAY,cAAe,EAAA,EAAA,CAAA;AAAA,QAC3B,aAAa,CAAU,MAAA,qBAAA,GAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAW,EAAA;AAAA;AAAA;AACnE,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCategoryPicker.esm.js","sources":["../../../../src/next/components/TemplateCategoryPicker/TemplateCategoryPicker.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 { Progress } from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport capitalize from 'lodash/capitalize';\nimport { ReactNode } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/** @alpha */\nexport type ScaffolderReactTemplateCategoryPickerClassKey = 'root' | 'label';\n\nconst useStyles = makeStyles(\n {\n root: {},\n label: {},\n },\n { name: 'ScaffolderReactTemplateCategoryPicker' },\n);\n\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n * @alpha\n */\nexport const TemplateCategoryPicker = () => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography\n className={classes.label}\n variant=\"button\"\n component=\"label\"\n htmlFor=\"categories-picker\"\n >\n {t('templateCategoryPicker.title')}\n </Typography>\n <Autocomplete<string, true>\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n id=\"categories-picker\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAM,IAAA,mBAAO,GAAA,CAAC,wBAAA,EAAA,EAAyB,QAAA,EAAS,OAAA,EAAQ,CAAA;AACxD,MAAM,WAAA,mBAAc,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAS,OAAA,EAAQ,CAAA;AAKnD,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,MAAM,EAAC;AAA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S,cAAA;AAAA,QACT,KAAA,EAAO,aAAA;AAAA,QACP,QAAA,EAAU,CAAC,CAAA,EAAW,KAAA,KAAoB,iBAAiB,KAAK,CAAA;AAAA,QAChE,YAAA,EAAc,CAAC,MAAA,EAAQ,EAAE,UAAS,qBAChC,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,OAAA,kBACE,GAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA;AAAA,gBACA,WAAA;AAAA,gBACA,OAAA,EAAS;AAAA;AAAA,aACX;AAAA,YAEF,KAAA,EAAO,WAAW,MAAM;AAAA;AAAA,SAC1B;AAAA,QAEF,IAAA,EAAK,OAAA;AAAA,QACL,SAAA,sBAAY,cAAA,EAAA,EAAe,CAAA;AAAA,QAC3B,aAAa,CAAA,MAAA,qBAAU,GAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAA,EAAW;AAAA;AAAA;AACnE,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateGroup.esm.js","sources":["../../../../src/next/components/TemplateGroup/TemplateGroup.tsx"],"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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { ReactNode, ComponentType } from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n} from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateCardProps, TemplateCard } from '../TemplateCard';\nimport { AnalyticsContext, IconComponent } from '@backstage/core-plugin-api';\n\n/**\n * The props for the {@link TemplateGroup} component.\n * @alpha\n */\nexport interface TemplateGroupProps {\n templates: {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n }[];\n onSelected: (template: TemplateEntityV1beta3) => void;\n title: ReactNode;\n components?: {\n CardComponent?: ComponentType<TemplateCardProps>;\n };\n}\n\n/**\n * The `TemplateGroup` component is used to display a group of templates with a title.\n * @alpha\n */\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const {\n templates,\n title,\n components: { CardComponent } = {},\n onSelected,\n } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return null;\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(({ template, additionalLinks }) => (\n <AnalyticsContext\n attributes={{\n entityRef: stringifyEntityRef(template),\n }}\n key={stringifyEntityRef(template)}\n >\n <Card\n additionalLinks={additionalLinks}\n template={template}\n onSelected={onSelected}\n />\n </AnalyticsContext>\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkDa,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAY,EAAA,EAAE,aAAc,EAAA,GAAI,EAAC;AAAA,IACjC;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,iBACJ,OAAO,KAAA,KAAU,2BAAY,GAAA,CAAA,aAAA,EAAA,EAAc,OAAc,CAAK,GAAA,KAAA;AAEhE,EAAI,IAAA,SAAA,CAAU,WAAW,CAAG,EAAA;AAC1B,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,MAAM,OAAO,aAAiB,IAAA,YAAA;AAE9B,EAAA,4BACG,OACE,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,cAAA;AAAA,oBACD,GAAA,CAAC,gBACE,QAAU,EAAA,SAAA,CAAA,GAAA,CAAI,CAAC,EAAE,QAAA,EAAU,iBAC1B,qBAAA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,UAAY,EAAA;AAAA,UACV,SAAA,EAAW,mBAAmB,QAAQ;AAAA,SACxC;AAAA,QAGA,QAAA,kBAAA,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,eAAA;AAAA,YACA,QAAA;AAAA,YACA;AAAA;AAAA;AACF,OAAA;AAAA,MANK,mBAAmB,QAAQ;AAAA,KAQnC,CACH,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateGroup.esm.js","sources":["../../../../src/next/components/TemplateGroup/TemplateGroup.tsx"],"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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { ReactNode, ComponentType } from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n} from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateCardProps, TemplateCard } from '../TemplateCard';\nimport { AnalyticsContext, IconComponent } from '@backstage/core-plugin-api';\n\n/**\n * The props for the {@link TemplateGroup} component.\n * @alpha\n */\nexport interface TemplateGroupProps {\n templates: {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n }[];\n onSelected: (template: TemplateEntityV1beta3) => void;\n title: ReactNode;\n components?: {\n CardComponent?: ComponentType<TemplateCardProps>;\n };\n}\n\n/**\n * The `TemplateGroup` component is used to display a group of templates with a title.\n * @alpha\n */\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const {\n templates,\n title,\n components: { CardComponent } = {},\n onSelected,\n } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return null;\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(({ template, additionalLinks }) => (\n <AnalyticsContext\n attributes={{\n entityRef: stringifyEntityRef(template),\n }}\n key={stringifyEntityRef(template)}\n >\n <Card\n additionalLinks={additionalLinks}\n template={template}\n onSelected={onSelected}\n />\n </AnalyticsContext>\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkDO,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA8B;AAC1D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA,EAAY,EAAE,aAAA,EAAc,GAAI,EAAC;AAAA,IACjC;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,iBACJ,OAAO,KAAA,KAAU,2BAAW,GAAA,CAAC,aAAA,EAAA,EAAc,OAAc,CAAA,GAAK,KAAA;AAEhE,EAAA,IAAI,SAAA,CAAU,WAAW,CAAA,EAAG;AAC1B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAO,aAAA,IAAiB,YAAA;AAE9B,EAAA,4BACG,OAAA,EAAA,EACE,QAAA,EAAA;AAAA,IAAA,cAAA;AAAA,oBACD,GAAA,CAAC,gBACE,QAAA,EAAA,SAAA,CAAU,GAAA,CAAI,CAAC,EAAE,QAAA,EAAU,iBAAgB,qBAC1C,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY;AAAA,UACV,SAAA,EAAW,mBAAmB,QAAQ;AAAA,SACxC;AAAA,QAGA,QAAA,kBAAA,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,eAAA;AAAA,YACA,QAAA;AAAA,YACA;AAAA;AAAA;AACF,OAAA;AAAA,MANK,mBAAmB,QAAQ;AAAA,KAQnC,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateGroups.esm.js","sources":["../../../../src/next/components/TemplateGroups/TemplateGroups.tsx"],"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 { Link, Progress } from '@backstage/core-components';\nimport { errorApiRef, IconComponent, useApi } from '@backstage/core-plugin-api';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport {\n isTemplateEntityV1beta3,\n TemplateEntityV1beta3,\n} from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react';\nimport Typography from '@material-ui/core/Typography';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { TemplateGroup } from '../TemplateGroup/TemplateGroup';\n\n/**\n * @alpha\n */\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n TemplateCardComponent?: ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n onTemplateSelected?: (template: TemplateEntityV1beta3) => void;\n additionalLinksForEntity?: (template: TemplateEntityV1beta3) => {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\n\n/**\n * @alpha\n */\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, templateFilter, TemplateCardComponent, onTemplateSelected } =\n props;\n const errorApi = useApi(errorApiRef);\n const onSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n onTemplateSelected?.(template);\n },\n [onTemplateSelected],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => {\n const templates = entities\n .filter(isTemplateEntityV1beta3)\n .filter(e => (templateFilter ? templateFilter(e) : true))\n .filter(filter)\n .map(template => {\n const additionalLinks =\n props.additionalLinksForEntity?.(template) ?? [];\n\n return {\n template,\n additionalLinks,\n };\n });\n\n return (\n <TemplateGroup\n key={index}\n templates={templates}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n onSelected={onSelected}\n />\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgDa,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAA,MAAM,EAAE,OAAA,EAAS,KAAO,EAAA,QAAA,KAAa,aAAc,EAAA;AACnD,EAAA,MAAM,EAAE,MAAA,EAAQ,cAAgB,EAAA,qBAAA,EAAuB,oBACrD,GAAA,KAAA;AACF,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,UAAa,GAAA,WAAA;AAAA,IACjB,CAAC,QAAoC,KAAA;AACnC,MAAA,kBAAA,GAAqB,QAAQ,CAAA;AAAA,KAC/B;AAAA,IACA,CAAC,kBAAkB;AAAA,GACrB;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS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AA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateGroups.esm.js","sources":["../../../../src/next/components/TemplateGroups/TemplateGroups.tsx"],"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 { Link, Progress } from '@backstage/core-components';\nimport { errorApiRef, IconComponent, useApi } from '@backstage/core-plugin-api';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport {\n isTemplateEntityV1beta3,\n TemplateEntityV1beta3,\n} from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react';\nimport Typography from '@material-ui/core/Typography';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { TemplateGroup } from '../TemplateGroup/TemplateGroup';\n\n/**\n * @alpha\n */\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n TemplateCardComponent?: ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n onTemplateSelected?: (template: TemplateEntityV1beta3) => void;\n additionalLinksForEntity?: (template: TemplateEntityV1beta3) => {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\n\n/**\n * @alpha\n */\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, templateFilter, TemplateCardComponent, onTemplateSelected } =\n props;\n const errorApi = useApi(errorApiRef);\n const onSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n onTemplateSelected?.(template);\n },\n [onTemplateSelected],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => {\n const templates = entities\n .filter(isTemplateEntityV1beta3)\n .filter(e => (templateFilter ? templateFilter(e) : true))\n .filter(filter)\n .map(template => {\n const additionalLinks =\n props.additionalLinksForEntity?.(template) ?? [];\n\n return {\n template,\n additionalLinks,\n };\n });\n\n return (\n <TemplateGroup\n key={index}\n templates={templates}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n onSelected={onSelected}\n />\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgDO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,QAAA,KAAa,aAAA,EAAc;AACnD,EAAA,MAAM,EAAE,MAAA,EAAQ,cAAA,EAAgB,qBAAA,EAAuB,oBAAmB,GACxE,KAAA;AACF,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,UAAA,GAAa,WAAA;AAAA,IACjB,CAAC,QAAA,KAAoC;AACnC,MAAA,kBAAA,GAAqB,QAAQ,CAAA;AAAA,IAC/B,CAAA;AAAA,IACA,CAAC,kBAAkB;AAAA,GACrB;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,QAAA,CAAS,KAAK,KAAK,CAAA;AAAA,IACrB;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,QAAQ,CAAC,CAAA;AAEpB,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,CAAC,QAAA,IAAY,CAAC,QAAA,CAAS,MAAA,EAAQ;AACjC,IAAA,uBACE,IAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,6DAAA;AAAA,MACkC,GAAA;AAAA,sBAC5D,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,wEAAA,EAAyE,QAAA,EAAA,kBAAA,EAElF,CAAA;AAAA,MAAO;AAAA,KAAA,EAET,CAAA;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA,CAAA,QAAA,EAAA,EACG,iBAAO,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,MAAA,IAAU,KAAA,KAAU;AACxC,IAAA,MAAM,YAAY,QAAA,CACf,MAAA,CAAO,uBAAuB,CAAA,CAC9B,OAAO,CAAA,CAAA,KAAM,cAAA,GAAiB,cAAA,CAAe,CAAC,IAAI,IAAK,CAAA,CACvD,OAAO,MAAM,CAAA,CACb,IAAI,CAAA,QAAA,KAAY;AACf,MAAA,MAAM,eAAA,GACJ,KAAA,CAAM,wBAAA,GAA2B,QAAQ,KAAK,EAAC;AAEjD,MAAA,OAAO;AAAA,QACL,QAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAEH,IAAA,uBACE,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA,EAAY,EAAE,aAAA,EAAe,qBAAA,EAAsB;AAAA,QACnD;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ,CAAC,CAAA,EACH,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultTemplateOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/DefaultTemplateOutputs.tsx"],"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 { InfoCard, MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n ScaffolderOutputText,\n ScaffolderTaskOutput,\n} from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { LinkOutputs } from './LinkOutputs';\nimport { TextOutputs } from './TextOutputs';\n\n/**\n * The DefaultOutputs renderer for the scaffolder task output\n *\n * @alpha\n */\nexport const DefaultTemplateOutputs = (props: {\n output?: ScaffolderTaskOutput;\n}) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { output } = props;\n const [textOutputIndex, setTextOutputIndex] = useState<number | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (textOutputIndex === undefined && output?.text) {\n const defaultIndex = output.text.findIndex(\n (text: ScaffolderOutputText) => text.default,\n );\n setTextOutputIndex(defaultIndex >= 0 ? defaultIndex : 0);\n }\n }, [textOutputIndex, output]);\n\n const textOutput = useMemo(\n () =>\n textOutputIndex !== undefined ? output?.text?.[textOutputIndex] : null,\n [output, textOutputIndex],\n );\n\n if (!output) {\n return null;\n }\n\n const displayTextButtons = (output.text || []).length > 1;\n const emptyOutput = (output.links || []).length === 0 && !displayTextButtons;\n\n return (\n <>\n {!emptyOutput ? (\n <Box paddingBottom={2} data-testid=\"output-box\">\n <Paper>\n <Box\n padding={2}\n justifyContent=\"center\"\n display=\"flex\"\n gridGap={16}\n flexWrap=\"wrap\"\n >\n {displayTextButtons && (\n <TextOutputs\n data-testid=\"text-outputs\"\n output={output}\n index={textOutputIndex}\n setIndex={setTextOutputIndex}\n />\n )}\n <LinkOutputs output={output} />\n </Box>\n </Paper>\n </Box>\n ) : null}\n {textOutput ? (\n <Box paddingBottom={2} data-testid=\"text-output-box\">\n <InfoCard\n title={textOutput.title ?? t('templateOutputs.title')}\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Box padding={2} height=\"100%\">\n <MarkdownContent content={textOutput.content ?? ''} />\n </Box>\n </InfoCard>\n </Box>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAkCa,MAAA,sBAAA,GAAyB,CAAC,KAEjC,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,KAAA;AAAA,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,eAAA,KAAoB,KAAa,CAAA,IAAA,MAAA,EAAQ,IAAM,EAAA;AACjD,MAAM,MAAA,YAAA,GAAe,OAAO,IAAK,CAAA,SAAA;AAAA,QAC/B,CAAC,SAA+B,IAAK,CAAA;AAAA,OACvC;AACA,MAAmB,kBAAA,CAAA,YAAA,IAAgB,CAAI,GAAA,YAAA,GAAe,CAAC,CAAA;AAAA;AACzD,GACC,EAAA,CAAC,eAAiB,EAAA,MAAM,CAAC,CAAA;AAE5B,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IACjB,MACE,eAAoB,KAAA,KAAA,CAAA,GAAY,MAAQ,EAAA,IAAA,GAAO,eAAe,CAAI,GAAA,IAAA;AAAA,IACpE,CAAC,QAAQ,eAAe;AAAA,GAC1B;AAEA,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAO,OAAA,IAAA;AAA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O,EAAA,MAAA,EACtB,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,OAAS,EAAA,UAAA,CAAW,OAAW,IAAA,EAAA,EAAI,CACtD,EAAA;AAAA;AAAA,OAEJ,CACE,GAAA;AAAA,GACN,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultTemplateOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/DefaultTemplateOutputs.tsx"],"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 { InfoCard, MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n ScaffolderOutputText,\n ScaffolderTaskOutput,\n} from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { LinkOutputs } from './LinkOutputs';\nimport { TextOutputs } from './TextOutputs';\n\n/**\n * The DefaultOutputs renderer for the scaffolder task output\n *\n * @alpha\n */\nexport const DefaultTemplateOutputs = (props: {\n output?: ScaffolderTaskOutput;\n}) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { output } = props;\n const [textOutputIndex, setTextOutputIndex] = useState<number | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (textOutputIndex === undefined && output?.text) {\n const defaultIndex = output.text.findIndex(\n (text: ScaffolderOutputText) => text.default,\n );\n setTextOutputIndex(defaultIndex >= 0 ? defaultIndex : 0);\n }\n }, [textOutputIndex, output]);\n\n const textOutput = useMemo(\n () =>\n textOutputIndex !== undefined ? output?.text?.[textOutputIndex] : null,\n [output, textOutputIndex],\n );\n\n if (!output) {\n return null;\n }\n\n const displayTextButtons = (output.text || []).length > 1;\n const emptyOutput = (output.links || []).length === 0 && !displayTextButtons;\n\n return (\n <>\n {!emptyOutput ? (\n <Box paddingBottom={2} data-testid=\"output-box\">\n <Paper>\n <Box\n padding={2}\n justifyContent=\"center\"\n display=\"flex\"\n gridGap={16}\n flexWrap=\"wrap\"\n >\n {displayTextButtons && (\n <TextOutputs\n data-testid=\"text-outputs\"\n output={output}\n index={textOutputIndex}\n setIndex={setTextOutputIndex}\n />\n )}\n <LinkOutputs output={output} />\n </Box>\n </Paper>\n </Box>\n ) : null}\n {textOutput ? (\n <Box paddingBottom={2} data-testid=\"text-output-box\">\n <InfoCard\n title={textOutput.title ?? t('templateOutputs.title')}\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Box padding={2} height=\"100%\">\n <MarkdownContent content={textOutput.content ?? ''} />\n </Box>\n </InfoCard>\n </Box>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAkCO,MAAM,sBAAA,GAAyB,CAAC,KAAA,KAEjC;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,QAAO,GAAI,KAAA;AACnB,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA;AAAA,IAC5C;AAAA,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,eAAA,KAAoB,MAAA,IAAa,MAAA,EAAQ,IAAA,EAAM;AACjD,MAAA,MAAM,YAAA,GAAe,OAAO,IAAA,CAAK,SAAA;AAAA,QAC/B,CAAC,SAA+B,IAAA,CAAK;AAAA,OACvC;AACA,MAAA,kBAAA,CAAmB,YAAA,IAAgB,CAAA,GAAI,YAAA,GAAe,CA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AAA,EAAG,eAAY,iBAAA,EACjC,QAAA,kBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,UAAA,CAAW,KAAA,IAAS,CAAA,CAAE,uBAAuB,CAAA;AAAA,QACpD,SAAA,EAAS,IAAA;AAAA,QACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAA,EAAK;AAAA,QAExC,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,OAAA,EAAS,CAAA,EAAG,MAAA,EAAO,MAAA,EACtB,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,UAAA,CAAW,OAAA,IAAW,EAAA,EAAI,CAAA,EACtD;AAAA;AAAA,OAEJ,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LinkOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/LinkOutputs.tsx"],"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 { IconComponent, useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { Link } from '@backstage/core-components';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nconst useStyles = makeStyles({\n root: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n});\n\nexport const LinkOutputs = (props: { output: ScaffolderTaskOutput }) => {\n const { links = [] } = props.output;\n const classes = useStyles();\n const app = useApp();\n const entityRoute = useRouteRef(entityRouteRef);\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? LinkIcon;\n\n return (\n <>\n {links\n .filter(({ url, entityRef }) => url || entityRef)\n .map(({ url, entityRef, title, icon }) => {\n if (entityRef) {\n const entityName = parseEntityRef(entityRef);\n const target = entityRoute(entityName);\n return { title, icon, url: target };\n }\n return { title, icon, url: url! };\n })\n .map(({ url, title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Link to={url} key={i} classes={{ root: classes.root }}>\n <Button startIcon={<Icon />} component=\"div\" color=\"primary\">\n {title}\n </Button>\n </Link>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA;AAAA,MACT,cAAgB,EAAA;AAAA;AAClB;AAEJ,CAAC,CAAA;AAEY,MAAA,WAAA,GAAc,CAAC,KAA4C,KAAA;AACtE,EAAA,MAAM,EAAE,KAAA,GAAQ,EAAC,KAAM,KAAM,CAAA,MAAA;AAC7B,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAM,MAAA,WAAA,GAAc,YAAY,cAAc,CAAA;AAE9C,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAI,CAAA,aAAA,CAAc,GAAI,CAAK,IAAA,QAAA;AAE7B,EAAA,uCAEK,QACE,EAAA,KAAA,CAAA,MAAA,CAAO,CAAC,EAAE,GAAA,EAAK,WAAgB,KAAA,GAAA,IAAO,SAAS,CAAA,CAC/C,IAAI,CAAC,EAAE,KAAK,SAAW,EAAA,KAAA,EAAO,MAAW,KAAA;AACxC,IAAA,IAAI,SAAW,EAAA;AACb,MAAM,MAAA,UAAA,GAAa,eAAe,SAAS,CAAA;AAC3C,MAAM,MAAA,MAAA,GAAS,YAAY,UAAU,CAAA;AACrC,MAAA,OAAO,EAAE,KAAA,EAAO,IAAM,EAAA,GAAA,EAAK,MAAO,EAAA;AAAA;AAEpC,IAAO,OAAA,EAAE,KAAO,EAAA,IAAA,EAAM,GAAU,EAAA;AAAA,GACjC,EACA,GAAI,CAAA,CAAC,EAAE,GAAK,EAAA,KAAA,EAAO,IAAK,EAAA,EAAG,CAAM,KAAA;AAChC,IAAM,MAAA,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IACE,uBAAA,GAAA,CAAC,QAAK,EAAI,EAAA,GAAA,EAAa,SAAS,EAAE,IAAA,EAAM,OAAQ,CAAA,IAAA,EAC9C,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAO,SAAW,kBAAA,GAAA,CAAC,QAAK,CAAI,EAAA,SAAA,EAAU,OAAM,KAAM,EAAA,SAAA,EAChD,QACH,EAAA,KAAA,EAAA,CAAA,EAAA,EAHkB,CAIpB,CAAA;AAAA,GAEH,CACL,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LinkOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/LinkOutputs.tsx"],"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 { IconComponent, useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { Link } from '@backstage/core-components';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nconst useStyles = makeStyles({\n root: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n});\n\nexport const LinkOutputs = (props: { output: ScaffolderTaskOutput }) => {\n const { links = [] } = props.output;\n const classes = useStyles();\n const app = useApp();\n const entityRoute = useRouteRef(entityRouteRef);\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? LinkIcon;\n\n return (\n <>\n {links\n .filter(({ url, entityRef }) => url || entityRef)\n .map(({ url, entityRef, title, icon }) => {\n if (entityRef) {\n const entityName = parseEntityRef(entityRef);\n const target = entityRoute(entityName);\n return { title, icon, url: target };\n }\n return { title, icon, url: url! };\n })\n .map(({ url, title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Link to={url} key={i} classes={{ root: classes.root }}>\n <Button startIcon={<Icon />} component=\"div\" color=\"primary\">\n {title}\n </Button>\n </Link>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,IAAA,EAAM;AAAA,IACJ,SAAA,EAAW;AAAA,MACT,cAAA,EAAgB;AAAA;AAClB;AAEJ,CAAC,CAAA;AAEM,MAAM,WAAA,GAAc,CAAC,KAAA,KAA4C;AACtE,EAAA,MAAM,EAAE,KAAA,GAAQ,EAAC,KAAM,KAAA,CAAM,MAAA;AAC7B,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,WAAA,GAAc,YAAY,cAAc,CAAA;AAE9C,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAA,CAAI,aAAA,CAAc,GAAI,CAAA,IAAK,QAAA;AAE7B,EAAA,uCAEK,QAAA,EAAA,KAAA,CACE,MAAA,CAAO,CAAC,EAAE,GAAA,EAAK,WAAU,KAAM,GAAA,IAAO,SAAS,CAAA,CAC/C,IAAI,CAAC,EAAE,KAAK,SAAA,EAAW,KAAA,EAAO,MAAK,KAAM;AACxC,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAM,UAAA,GAAa,eAAe,SAAS,CAAA;AAC3C,MAAA,MAAM,MAAA,GAAS,YAAY,UAAU,CAAA;AACrC,MAAA,OAAO,EAAE,KAAA,EAAO,IAAA,EAAM,GAAA,EAAK,MAAA,EAAO;AAAA,IACpC;AACA,IAAA,OAAO,EAAE,KAAA,EAAO,IAAA,EAAM,GAAA,EAAU;AAAA,EAClC,CAAC,EACA,GAAA,CAAI,CAAC,EAAE,GAAA,EAAK,KAAA,EAAO,IAAA,EAAK,EAAG,CAAA,KAAM;AAChC,IAAA,MAAM,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IAAA,uBACE,GAAA,CAAC,QAAK,EAAA,EAAI,GAAA,EAAa,SAAS,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK,EACnD,QAAA,kBAAA,GAAA,CAAC,UAAO,SAAA,kBAAW,GAAA,CAAC,QAAK,CAAA,EAAI,SAAA,EAAU,OAAM,KAAA,EAAM,SAAA,EAChD,QAAA,EAAA,KAAA,EACH,CAAA,EAAA,EAHkB,CAIpB,CAAA;AAAA,EAEJ,CAAC,CAAA,EACL,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/TextOutputs.tsx"],"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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nexport const TextOutputs = (props: {\n output: ScaffolderTaskOutput;\n index?: number;\n setIndex?: (index: number | undefined) => void;\n}) => {\n const {\n output: { text = [] },\n index,\n setIndex,\n } = props;\n\n const app = useApp();\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? DescriptionIcon;\n\n return (\n <>\n {text\n .filter(({ content }) => content !== undefined)\n .map(({ title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Button\n key={i}\n startIcon={<Icon />}\n component=\"div\"\n color=\"primary\"\n onClick={() => {\n if (index !== i) {\n setIndex?.(i);\n }\n }}\n variant={index === i ? 'outlined' : undefined}\n >\n {title}\n </Button>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAoBa,MAAA,WAAA,GAAc,CAAC,KAItB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA,EAAE,IAAO,GAAA,EAAG,EAAA;AAAA,IACpB,KAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAA,MAAM,MAAM,MAAO,EAAA;AAEnB,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAI,CAAA,aAAA,CAAc,GAAI,CAAK,IAAA,eAAA;AAE7B,EAAA,uCAEK,QACE,EAAA,IAAA,CAAA,MAAA,CAAO,CAAC,EAAE,SAAc,KAAA,OAAA,KAAY,KAAS,CAAA,CAAA,CAC7C,IAAI,CAAC,EAAE,KAAO,EAAA,IAAA,IAAQ,CAAM,KAAA;AAC3B,IAAM,MAAA,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IACE,uBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QAEC,SAAA,sBAAY,IAAK,EAAA,EAAA,CAAA;AAAA,QACjB,SAAU,EAAA,KAAA;AAAA,QACV,KAAM,EAAA,SAAA;AAAA,QACN,SAAS,MAAM;AACb,UAAA,IAAI,UAAU,CAAG,EAAA;AACf,YAAA,QAAA,GAAW,CAAC,CAAA;AAAA;AACd,SACF;AAAA,QACA,OAAA,EAAS,KAAU,KAAA,CAAA,GAAI,UAAa,GAAA,KAAA,CAAA;AAAA,QAEnC,QAAA,EAAA;AAAA,OAAA;AAAA,MAXI;AAAA,KAYP;AAAA,GAEH,CACL,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TextOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/TextOutputs.tsx"],"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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nexport const TextOutputs = (props: {\n output: ScaffolderTaskOutput;\n index?: number;\n setIndex?: (index: number | undefined) => void;\n}) => {\n const {\n output: { text = [] },\n index,\n setIndex,\n } = props;\n\n const app = useApp();\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? DescriptionIcon;\n\n return (\n <>\n {text\n .filter(({ content }) => content !== undefined)\n .map(({ title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Button\n key={i}\n startIcon={<Icon />}\n component=\"div\"\n color=\"primary\"\n onClick={() => {\n if (index !== i) {\n setIndex?.(i);\n }\n }}\n variant={index === i ? 'outlined' : undefined}\n >\n {title}\n </Button>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAoBO,MAAM,WAAA,GAAc,CAAC,KAAA,KAItB;AACJ,EAAA,MAAM;AAAA,IACJ,MAAA,EAAQ,EAAE,IAAA,GAAO,EAAC,EAAE;AAAA,IACpB,KAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,MAAM,MAAA,EAAO;AAEnB,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAA,CAAI,aAAA,CAAc,GAAI,CAAA,IAAK,eAAA;AAE7B,EAAA,uCAEK,QAAA,EAAA,IAAA,CACE,MAAA,CAAO,CAAC,EAAE,SAAQ,KAAM,OAAA,KAAY,MAAS,CAAA,CAC7C,IAAI,CAAC,EAAE,KAAA,EAAO,IAAA,IAAQ,CAAA,KAAM;AAC3B,IAAA,MAAM,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IAAA,uBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QAEC,SAAA,sBAAY,IAAA,EAAA,EAAK,CAAA;AAAA,QACjB,SAAA,EAAU,KAAA;AAAA,QACV,KAAA,EAAM,SAAA;AAAA,QACN,SAAS,MAAM;AACb,UAAA,IAAI,UAAU,CAAA,EAAG;AACf,YAAA,QAAA,GAAW,CAAC,CAAA;AAAA,UACd;AAAA,QACF,CAAA;AAAA,QACA,OAAA,EAAS,KAAA,KAAU,CAAA,GAAI,UAAA,GAAa,MAAA;AAAA,QAEnC,QAAA,EAAA;AAAA,OAAA;AAAA,MAXI;AAAA,KAYP;AAAA,EAEJ,CAAC,CAAA,EACL,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { stringifyEntityRef } from '@backstage/catalog-model';
3
3
  import { Content, Progress, InfoCard, MarkdownContent } from '@backstage/core-components';
4
4
  import { useAnalytics, useApi, errorApiRef } from '@backstage/core-plugin-api';
@@ -1 +1 @@
1
- {"version":3,"file":"Workflow.esm.js","sources":["../../../../src/next/components/Workflow/Workflow.tsx"],"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 { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n Content,\n InfoCard,\n MarkdownContent,\n Progress,\n} from '@backstage/core-components';\nimport { errorApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useFilteredSchemaProperties } from '../../hooks/useFilteredSchemaProperties';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { useTemplateTimeSavedMinutes } from '../../hooks/useTemplateTimeSaved';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\n\nconst useStyles = makeStyles({\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n marginTop: 0,\n },\n '& :last-child': {\n marginBottom: 0,\n },\n },\n});\n\n/**\n * @alpha\n */\nexport type WorkflowProps = {\n title?: string;\n description?: string;\n namespace: string;\n templateName: string;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n };\n onError(error: Error | undefined): JSX.Element | null;\n} & Pick<\n StepperProps,\n | 'extensions'\n | 'formProps'\n | 'components'\n | 'onCreate'\n | 'initialState'\n | 'layouts'\n>;\n\n/**\n * @alpha\n */\nexport const Workflow = (workflowProps: WorkflowProps): JSX.Element | null => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { title, description, namespace, templateName, onCreate, ...props } =\n workflowProps;\n\n const analytics = useAnalytics();\n const styles = useStyles();\n const templateRef = stringifyEntityRef({\n kind: 'Template',\n namespace: namespace,\n name: templateName,\n });\n\n const errorApi = useApi(errorApiRef);\n\n const { loading, manifest, error } = useTemplateParameterSchema(templateRef);\n\n const sortedManifest = useFilteredSchemaProperties(manifest);\n\n const minutesSaved = useTemplateTimeSavedMinutes(templateRef);\n\n const workflowOnCreate = useCallback(\n async (formState: Record<string, JsonValue>) => {\n await onCreate(formState);\n\n analytics.captureEvent('create', 'Task has been created', {\n value: minutesSaved,\n attributes: {\n templateSteps: sortedManifest?.steps?.length ?? 0,\n },\n });\n },\n [onCreate, analytics, minutesSaved, sortedManifest],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(new Error(`Failed to load template, ${error}`));\n }\n }, [error, errorApi]);\n\n if (error) {\n return props.onError(error);\n }\n\n return (\n <Content>\n {loading && <Progress />}\n {sortedManifest && (\n <InfoCard\n title={title ?? sortedManifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n linkTarget=\"_blank\"\n content={\n description ??\n sortedManifest.description ??\n t('workflow.noDescription')\n }\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper\n manifest={sortedManifest}\n onCreate={workflowOnCreate}\n {...props}\n />\n </InfoCard>\n )}\n </Content>\n );\n};\n\n/**\n * @alpha\n */\nexport const EmbeddableWorkflow = (props: WorkflowProps) => (\n <SecretsContextProvider>\n <Workflow {...props} />\n </SecretsContextProvider>\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,QAAU,EAAA;AAAA;AAAA,IAER,gBAAkB,EAAA;AAAA,MAChB,SAAW,EAAA;AAAA,KACb;AAAA,IACA,eAAiB,EAAA;AAAA,MACf,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AA;AAC9D,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA;AAEpB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,OAAA,KAAA,CAAM,QAAQ,KAAK,CAAA;AAAA;AAG5B,EAAA,4BACG,OACE,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,OAAA,wBAAY,QAAS,EAAA,EAAA,CAAA;AAAA,IACrB,cACC,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,SAAS,cAAe,CAAA,KAAA;AAAA,QAC/B,SACE,kBAAA,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,WAAW,MAAO,CAAA,QAAA;AAAA,YAClB,UAAW,EAAA,QAAA;AAAA,YACX,OACE,EAAA,WAAA,IACA,cAAe,CAAA,WAAA,IACf,EAAE,wBAAwB;AAAA;AAAA,SAE9B;AAAA,QAEF,SAAS,EAAA,IAAA;AAAA,QACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAK,EAAA;AAAA,QAExC,QAAA,kBAAA,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,QAAU,EAAA,cAAA;AAAA,YACV,QAAU,EAAA,gBAAA;AAAA,YACT,GAAG;AAAA;AAAA;AACN;AAAA;AACF,GAEJ,EAAA,CAAA;AAEJ;AAKa,MAAA,kBAAA,GAAqB,CAAC,KACjC,qBAAA,GAAA,CAAC,0BACC,QAAC,kBAAA,GAAA,CAAA,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CACvB,EAAA;;;;"}
1
+ {"version":3,"file":"Workflow.esm.js","sources":["../../../../src/next/components/Workflow/Workflow.tsx"],"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 { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n Content,\n InfoCard,\n MarkdownContent,\n Progress,\n} from '@backstage/core-components';\nimport { errorApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useFilteredSchemaProperties } from '../../hooks/useFilteredSchemaProperties';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { useTemplateTimeSavedMinutes } from '../../hooks/useTemplateTimeSaved';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\n\nconst useStyles = makeStyles({\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n marginTop: 0,\n },\n '& :last-child': {\n marginBottom: 0,\n },\n },\n});\n\n/**\n * @alpha\n */\nexport type WorkflowProps = {\n title?: string;\n description?: string;\n namespace: string;\n templateName: string;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n };\n onError(error: Error | undefined): JSX.Element | null;\n} & Pick<\n StepperProps,\n | 'extensions'\n | 'formProps'\n | 'components'\n | 'onCreate'\n | 'initialState'\n | 'layouts'\n>;\n\n/**\n * @alpha\n */\nexport const Workflow = (workflowProps: WorkflowProps): JSX.Element | null => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { title, description, namespace, templateName, onCreate, ...props } =\n workflowProps;\n\n const analytics = useAnalytics();\n const styles = useStyles();\n const templateRef = stringifyEntityRef({\n kind: 'Template',\n namespace: namespace,\n name: templateName,\n });\n\n const errorApi = useApi(errorApiRef);\n\n const { loading, manifest, error } = useTemplateParameterSchema(templateRef);\n\n const sortedManifest = useFilteredSchemaProperties(manifest);\n\n const minutesSaved = useTemplateTimeSavedMinutes(templateRef);\n\n const workflowOnCreate = useCallback(\n async (formState: Record<string, JsonValue>) => {\n await onCreate(formState);\n\n analytics.captureEvent('create', 'Task has been created', {\n value: minutesSaved,\n attributes: {\n templateSteps: sortedManifest?.steps?.length ?? 0,\n },\n });\n },\n [onCreate, analytics, minutesSaved, sortedManifest],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(new Error(`Failed to load template, ${error}`));\n }\n }, [error, errorApi]);\n\n if (error) {\n return props.onError(error);\n }\n\n return (\n <Content>\n {loading && <Progress />}\n {sortedManifest && (\n <InfoCard\n title={title ?? sortedManifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n linkTarget=\"_blank\"\n content={\n description ??\n sortedManifest.description ??\n t('workflow.noDescription')\n }\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper\n manifest={sortedManifest}\n onCreate={workflowOnCreate}\n {...props}\n />\n </InfoCard>\n )}\n </Content>\n );\n};\n\n/**\n * @alpha\n */\nexport const EmbeddableWorkflow = (props: WorkflowProps) => (\n <SecretsContextProvider>\n <Workflow {...props} />\n </SecretsContextProvider>\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,QAAA,EAAU;AAAA;AAAA,IAER,gBAAA,EAAkB;AAAA,MAChB,SAAA,EAAW;AAAA,KACb;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,YAAA,EAAc;AAAA;AAChB;AAEJ,CAAC,CAAA;AA2BM,MAAM,QAAA,GAAW,CAAC,aAAA,KAAqD;AAC5E,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,OAAO,WAAA,E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,EACE,QAAA,EAAA;AAAA,IAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,CAAA;AAAA,IACrB,cAAA,oBACC,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,SAAS,cAAA,CAAe,KAAA;AAAA,QAC/B,SAAA,kBACE,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,WAAW,MAAA,CAAO,QAAA;AAAA,YAClB,UAAA,EAAW,QAAA;AAAA,YACX,OAAA,EACE,WAAA,IACA,cAAA,CAAe,WAAA,IACf,EAAE,wBAAwB;AAAA;AAAA,SAE9B;AAAA,QAEF,SAAA,EAAS,IAAA;AAAA,QACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAA,EAAK;AAAA,QAExC,QAAA,kBAAA,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,QAAA,EAAU,cAAA;AAAA,YACV,QAAA,EAAU,gBAAA;AAAA,YACT,GAAG;AAAA;AAAA;AACN;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;AAKO,MAAM,kBAAA,GAAqB,CAAC,KAAA,qBACjC,GAAA,CAAC,0BACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CAAA,EACvB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createScaffolderFormDecorator.esm.js","sources":["../../../src/next/extensions/createScaffolderFormDecorator.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AnyApiRef } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { z } from 'zod';\n\n/** @alpha */\nexport type ScaffolderFormDecoratorContext<\n TInput extends JsonObject = JsonObject,\n> = {\n input: TInput;\n formState: Record<string, JsonValue>;\n\n setFormState: (\n fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>,\n ) => void;\n setSecrets: (\n fn: (currentState: Record<string, string>) => Record<string, string>,\n ) => void;\n};\n\n/** @alpha */\nexport type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {\n readonly $$type: '@backstage/scaffolder/FormDecorator';\n readonly id: string;\n readonly TInput: TInput;\n};\n\n/**\n * Method for creating decorators which can be used to collect\n * secrets from the user before submitting to the backend.\n * @alpha\n */\nexport function createScaffolderFormDecorator<\n TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType } = {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n TDeps extends { [key in string]: AnyApiRef } = { [key in string]: AnyApiRef },\n TInput extends JsonObject = {\n [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;\n },\n>(options: {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext<TInput>,\n deps: TDeps extends { [key in string]: AnyApiRef }\n ? { [key in keyof TDeps]: TDeps[key]['T'] }\n : never,\n ) => Promise<void>;\n}): ScaffolderFormDecorator<TInput> {\n return OpaqueFormDecorator.createInstance('v1', {\n ...options,\n TInput: null as unknown as TInput,\n } as {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n TInput: TInput;\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [key in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n });\n}\n"],"names":[],"mappings":";;;AA+CO,SAAS,8BAQd,OAYkC,EAAA;AAClC,EAAO,OAAA,mBAAA,CAAoB,eAAe,IAAM,EAAA;AAAA,IAC9C,GAAG,OAAA;AAAA,IACH,MAAQ,EAAA;AAAA,GAYT,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"createScaffolderFormDecorator.esm.js","sources":["../../../src/next/extensions/createScaffolderFormDecorator.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AnyApiRef } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { z } from 'zod';\n\n/** @alpha */\nexport type ScaffolderFormDecoratorContext<\n TInput extends JsonObject = JsonObject,\n> = {\n input: TInput;\n formState: Record<string, JsonValue>;\n\n setFormState: (\n fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>,\n ) => void;\n setSecrets: (\n fn: (currentState: Record<string, string>) => Record<string, string>,\n ) => void;\n};\n\n/** @alpha */\nexport type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {\n readonly $$type: '@backstage/scaffolder/FormDecorator';\n readonly id: string;\n readonly TInput: TInput;\n};\n\n/**\n * Method for creating decorators which can be used to collect\n * secrets from the user before submitting to the backend.\n * @alpha\n */\nexport function createScaffolderFormDecorator<\n TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType } = {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n TDeps extends { [key in string]: AnyApiRef } = { [key in string]: AnyApiRef },\n TInput extends JsonObject = {\n [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;\n },\n>(options: {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext<TInput>,\n deps: TDeps extends { [key in string]: AnyApiRef }\n ? { [key in keyof TDeps]: TDeps[key]['T'] }\n : never,\n ) => Promise<void>;\n}): ScaffolderFormDecorator<TInput> {\n return OpaqueFormDecorator.createInstance('v1', {\n ...options,\n TInput: null as unknown as TInput,\n } as {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n TInput: TInput;\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [key in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n });\n}\n"],"names":[],"mappings":";;;AA+CO,SAAS,8BAQd,OAAA,EAYkC;AAClC,EAAA,OAAO,mBAAA,CAAoB,eAAe,IAAA,EAAM;AAAA,IAC9C,GAAG,OAAA;AAAA,IACH,MAAA,EAAQ;AAAA,GAYT,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFilteredSchemaProperties.esm.js","sources":["../../../src/next/hooks/useFilteredSchemaProperties.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 cloneDeep from 'lodash/cloneDeep';\nimport { useApi, featureFlagsApiRef } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { useMemo } from 'react';\n\n/**\n * Returns manifest of software templates with steps without a featureFlag tag.\n * @alpha\n */\n\nexport const useFilteredSchemaProperties = (\n manifest: TemplateParameterSchema | undefined,\n): TemplateParameterSchema | undefined => {\n const featureFlagKey = 'backstage:featureFlag';\n const featureFlagApi = useApi(featureFlagsApiRef);\n\n return useMemo(() => {\n if (!manifest) {\n return undefined;\n }\n const filteredSteps = manifest?.steps\n .filter(step => {\n const featureFlag = step.schema[featureFlagKey];\n return (\n typeof featureFlag !== 'string' ||\n featureFlagApi.isActive(featureFlag)\n );\n })\n .map(step => {\n const filteredStep = cloneDeep(step);\n const removedPropertyKeys: Array<string> = [];\n if (filteredStep.schema.properties) {\n filteredStep.schema.properties = Object.fromEntries(\n Object.entries(filteredStep.schema.properties).filter(\n ([key, value]) => {\n if (value[featureFlagKey]) {\n if (featureFlagApi.isActive(value[featureFlagKey])) {\n return true;\n }\n\n removedPropertyKeys.push(key);\n return false;\n }\n return true;\n },\n ),\n );\n\n // remove the feature flag property key from required if they are not active\n filteredStep.schema.required = Array.isArray(\n filteredStep.schema.required,\n )\n ? filteredStep.schema.required?.filter(\n r => !removedPropertyKeys.includes(r as string),\n )\n : filteredStep.schema.required;\n }\n\n return filteredStep;\n });\n\n return { ...manifest, steps: filteredSteps };\n }, [manifest, featureFlagApi]);\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,2BAAA,GAA8B,CACzC,QACwC,KAAA;AACxC,EAAA,MAAM,cAAiB,GAAA,uBAAA;AACvB,EAAM,MAAA,cAAA,GAAiB,OAAO,kBAAkB,CAAA;AAEhD,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAA,IAAI,CAAC,QAAU,EAAA;AACb,MAAO,OAAA,KAAA,CAAA;AAAA;AAET,IAAA,MAAM,aAAgB,GAAA,QAAA,EAAU,KAC7B,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA;AACd,MAAM,MAAA,WAAA,GAAc,IAAK,CAAA,MAAA,CAAO,cAAc,CAAA;AAC9C,MAAA,OACE,OAAO,WAAA,KAAgB,QACvB,IAAA,cAAA,CAAe,SAAS,WAAW,CAAA;AAAA,KAEtC,CACA,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA;AACX,MAAM,MAAA,YAAA,GAAe,UAAU,IAAI,CAAA;AACnC,MAAA,MAAM,sBAAqC,EAAC;AAC5C,MAAI,IAAA,YAAA,CAAa,OAAO,UAAY,EAAA;AAClC,QAAa,YAAA,CAAA,MAAA,CAAO,aAAa,MAAO,CAAA,WAAA;AAAA,UACtC,MAAO,CAAA,OAAA,CAAQ,YAAa,CAAA,MAAA,CAAO,UAAU,CAAE,CAAA,MAAA;AAAA,YAC7C,CAAC,CAAC,GAAK,EAAA,KAAK,CAAM,KAAA;AAChB,cAAI,IAAA,KAAA,CAAM,cAAc,CAAG,EAAA;AACzB,gBAAA,IAAI,cAAe,CAAA,QAAA,CAAS,KAAM,CAAA,cAAc,CAAC,CAAG,EAAA;AAClD,kBAAO,OAAA,IAAA;AAAA;AAGT,gBAAA,mBAAA,CAAoB,KAAK,GAAG,CAAA;AAC5B,gBAAO,OAAA,KAAA;AAAA;AAET,cAAO,OAAA,IAAA;AAAA;AACT;AACF,SACF;AAGA,QAAa,YAAA,CAAA,MAAA,CAAO,WAAW,KAAM,CAAA,OAAA;AAAA,UACnC,aAAa,MAAO,CAAA;AAAA,SACtB,GACI,YAAa,CAAA,MAAA,CAAO,QAAU,EAAA,MAAA;AAAA,UAC5B,CAAK,CAAA,KAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,CAAW;AAAA,SAChD,GACA,aAAa,MAAO,CAAA,QAAA;AAAA;AAG1B,MAAO,OAAA,YAAA;AAAA,KACR,CAAA;AAEH,IAAA,OAAO,EAAE,GAAG,QAAU,EAAA,KAAA,EAAO,aAAc,EAAA;AAAA,GAC1C,EAAA,CAAC,QAAU,EAAA,cAAc,CAAC,CAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"useFilteredSchemaProperties.esm.js","sources":["../../../src/next/hooks/useFilteredSchemaProperties.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 cloneDeep from 'lodash/cloneDeep';\nimport { useApi, featureFlagsApiRef } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { useMemo } from 'react';\n\n/**\n * Returns manifest of software templates with steps without a featureFlag tag.\n * @alpha\n */\n\nexport const useFilteredSchemaProperties = (\n manifest: TemplateParameterSchema | undefined,\n): TemplateParameterSchema | undefined => {\n const featureFlagKey = 'backstage:featureFlag';\n const featureFlagApi = useApi(featureFlagsApiRef);\n\n return useMemo(() => {\n if (!manifest) {\n return undefined;\n }\n const filteredSteps = manifest?.steps\n .filter(step => {\n const featureFlag = step.schema[featureFlagKey];\n return (\n typeof featureFlag !== 'string' ||\n featureFlagApi.isActive(featureFlag)\n );\n })\n .map(step => {\n const filteredStep = cloneDeep(step);\n const removedPropertyKeys: Array<string> = [];\n if (filteredStep.schema.properties) {\n filteredStep.schema.properties = Object.fromEntries(\n Object.entries(filteredStep.schema.properties).filter(\n ([key, value]) => {\n if (value[featureFlagKey]) {\n if (featureFlagApi.isActive(value[featureFlagKey])) {\n return true;\n }\n\n removedPropertyKeys.push(key);\n return false;\n }\n return true;\n },\n ),\n );\n\n // remove the feature flag property key from required if they are not active\n filteredStep.schema.required = Array.isArray(\n filteredStep.schema.required,\n )\n ? filteredStep.schema.required?.filter(\n r => !removedPropertyKeys.includes(r as string),\n )\n : filteredStep.schema.required;\n }\n\n return filteredStep;\n });\n\n return { ...manifest, steps: filteredSteps };\n }, [manifest, featureFlagApi]);\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,2BAAA,GAA8B,CACzC,QAAA,KACwC;AACxC,EAAA,MAAM,cAAA,GAAiB,uBAAA;AACvB,EAAA,MAAM,cAAA,GAAiB,OAAO,kBAAkB,CAAA;AA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CAAW;AAAA,SAChD,GACA,aAAa,MAAA,CAAO,QAAA;AAAA,MAC1B;AAEA,MAAA,OAAO,YAAA;AAAA,IACT,CAAC,CAAA;AAEH,IAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAO,aAAA,EAAc;AAAA,EAC7C,CAAA,EAAG,CAAC,QAAA,EAAU,cAAc,CAAC,CAAA;AAC/B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFormDataFromQuery.esm.js","sources":["../../../src/next/hooks/useFormDataFromQuery.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 { JsonValue } from '@backstage/types';\nimport qs from 'qs';\nimport { useState } from 'react';\n\n/**\n * This hook is used to get the formData from the query string.\n * @alpha\n */\nexport const useFormDataFromQuery = (\n initialState?: Record<string, JsonValue>,\n) => {\n return useState<Record<string, any>>(() => {\n if (initialState) {\n return initialState;\n }\n\n const query = qs.parse(window.location.search, {\n ignoreQueryPrefix: true,\n });\n\n try {\n return JSON.parse(query.formData as string);\n } catch (e) {\n return {};\n }\n });\n};\n"],"names":[],"mappings":";;;AAwBa,MAAA,oBAAA,GAAuB,CAClC,YACG,KAAA;AACH,EAAA,OAAO,SAA8B,MAAM;AACzC,IAAA,IAAI,YAAc,EAAA;AAChB,MAAO,OAAA,YAAA;AAAA;AAGT,IAAA,MAAM,KAAQ,GAAA,EAAA,CAAG,KAAM,CAAA,MAAA,CAAO,SAAS,MAAQ,EAAA;AAAA,MAC7C,iBAAmB,EAAA;AAAA,KACpB,CAAA;AAED,IAAI,IAAA;AACF,MAAO,OAAA,IAAA,CAAK,KAAM,CAAA,KAAA,CAAM,QAAkB,CAAA;AAAA,aACnC,CAAG,EAAA;AACV,MAAA,OAAO,EAAC;AAAA;AACV,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useFormDataFromQuery.esm.js","sources":["../../../src/next/hooks/useFormDataFromQuery.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 { JsonValue } from '@backstage/types';\nimport qs from 'qs';\nimport { useState } from 'react';\n\n/**\n * This hook is used to get the formData from the query string.\n * @alpha\n */\nexport const useFormDataFromQuery = (\n initialState?: Record<string, JsonValue>,\n) => {\n return useState<Record<string, any>>(() => {\n if (initialState) {\n return initialState;\n }\n\n const query = qs.parse(window.location.search, {\n ignoreQueryPrefix: true,\n });\n\n try {\n return JSON.parse(query.formData as string);\n } catch (e) {\n return {};\n }\n });\n};\n"],"names":[],"mappings":";;;AAwBO,MAAM,oBAAA,GAAuB,CAClC,YAAA,KACG;AACH,EAAA,OAAO,SAA8B,MAAM;AACzC,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,OAAO,YAAA;AAAA,IACT;AAEA,IAAA,MAAM,KAAA,GAAQ,EAAA,CAAG,KAAA,CAAM,MAAA,CAAO,SAAS,MAAA,EAAQ;AAAA,MAC7C,iBAAA,EAAmB;AAAA,KACpB,CAAA;AAED,IAAA,IAAI;AACF,MAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,QAAkB,CAAA;AAAA,IAC5C,SAAS,CAAA,EAAG;AACV,MAAA,OAAO,EAAC;AAAA,IACV;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplateParameterSchema.esm.js","sources":["../../../src/next/hooks/useTemplateParameterSchema.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (\n templateRef: string,\n): { manifest?: TemplateParameterSchema; loading: boolean; error?: Error } => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const {\n value: manifest,\n loading,\n error,\n } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return {\n manifest,\n loading,\n error,\n };\n};\n"],"names":[],"mappings":";;;;AAwBa,MAAA,0BAAA,GAA6B,CACxC,WAC4E,KAAA;AAC5E,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACE,GAAA,QAAA;AAAA,IACF,MAAM,aAAc,CAAA,0BAAA,CAA2B,WAAW,CAAA;AAAA,IAC1D,CAAC,eAAe,WAAW;AAAA,GAC7B;AAEA,EAAO,OAAA;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useTemplateParameterSchema.esm.js","sources":["../../../src/next/hooks/useTemplateParameterSchema.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (\n templateRef: string,\n): { manifest?: TemplateParameterSchema; loading: boolean; error?: Error } => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const {\n value: manifest,\n loading,\n error,\n } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return {\n manifest,\n loading,\n error,\n };\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,0BAAA,GAA6B,CACxC,WAAA,KAC4E;AAC5E,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,QAAA;AAAA,IACF,MAAM,aAAA,CAAc,0BAAA,CAA2B,WAAW,CAAA;AAAA,IAC1D,CAAC,eAAe,WAAW;AAAA,GAC7B;AAEA,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplateSchema.esm.js","sources":["../../../src/next/hooks/useTemplateSchema.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 { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): {\n steps: ParsedTemplateSchema[];\n presentation?: TemplatePresentationV1beta3;\n} => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => {\n const strippedSchema = {\n ...step,\n schema: {\n ...step.schema,\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n title: undefined,\n },\n } as ParsedTemplateSchema;\n\n if (step.schema?.properties || !step.schema?.dependencies) {\n strippedSchema.schema.properties = Object.fromEntries(\n Object.entries((step.schema?.properties ?? {}) as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n );\n }\n\n return strippedSchema;\n });\n\n return {\n presentation: manifest.presentation,\n steps: returningSteps,\n };\n};\n"],"names":[],"mappings":";;;AAwCa,MAAA,iBAAA,GAAoB,CAC/B,QAIG,KAAA;AACH,EAAM,MAAA,YAAA,GAAe,OAAO,kBAAkB,CAAA;AAC9C,EAAM,MAAA,KAAA,GAAQ,SAAS,KAAM,CAAA,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,WAAa,EAAA,MAAA,EAAc,MAAA;AAAA,IACpE,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAc,EAAA,MAAA;AAAA,IACd,GAAG,sBAAsB,MAAM;AAAA,GAC/B,CAAA,CAAA;AAEF,EAAM,MAAA,cAAA,GAAiB,KAEpB,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA;AACd,IAAA,MAAM,eAAkB,GAAA,IAAA,CAAK,QAAS,CAAA,cAAc,CAAG,EAAA,WAAA;AACvD,IAAA,OAAO,eAAkB,GAAA,YAAA,CAAa,QAAS,CAAA,eAAe,CAAI,GAAA,IAAA;AAAA,GACnE,CAEA,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA;AACX,IAAA,MAAM,cAAiB,GAAA;AAAA,MACrB,GAAG,IAAA;AAAA,MACH,MAAQ,EAAA;AAAA,QACN,GAAG,IAAK,CAAA,MAAA;AAAA;AAAA,QAER,KAAO,EAAA,KAAA;AAAA;AACT,KACF;AAEA,IAAA,IAAI,KAAK,MAAQ,EAAA,UAAA,IAAc,CAAC,IAAA,CAAK,QAAQ,YAAc,EAAA;AACzD,MAAe,cAAA,CAAA,MAAA,CAAO,aAAa,MAAO,CAAA,WAAA;AAAA,QACxC,OAAO,OAAS,CAAA,IAAA,CAAK,QAAQ,UAAc,IAAA,EAAiB,CAAE,CAAA,MAAA;AAAA,UAC5D,CAAC,CAAC,GAAG,CAAM,KAAA;AACT,YAAA,MAAM,kBACJ,IAAK,CAAA,QAAA,CAAS,GAAG,CAAA,GAAI,cAAc,CAAG,EAAA,WAAA;AACxC,YAAA,OAAO,eACH,GAAA,YAAA,CAAa,QAAS,CAAA,eAAe,CACrC,GAAA,IAAA;AAAA;AACN;AACF,OACF;AAAA;AAGF,IAAO,OAAA,cAAA;AAAA,GACR,CAAA;AAEH,EAAO,OAAA;AAAA,IACL,cAAc,QAAS,CAAA,YAAA;AAAA,IACvB,KAAO,EAAA;AAAA,GACT;AACF;;;;"}
1
+ {"version":3,"file":"useTemplateSchema.esm.js","sources":["../../../src/next/hooks/useTemplateSchema.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 { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): {\n steps: ParsedTemplateSchema[];\n presentation?: TemplatePresentationV1beta3;\n} => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => {\n const strippedSchema = {\n ...step,\n schema: {\n ...step.schema,\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n title: undefined,\n },\n } as ParsedTemplateSchema;\n\n if (step.schema?.properties || !step.schema?.dependencies) {\n strippedSchema.schema.properties = Object.fromEntries(\n Object.entries((step.schema?.properties ?? {}) as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n );\n }\n\n return strippedSchema;\n });\n\n return {\n presentation: manifest.presentation,\n steps: returningSteps,\n };\n};\n"],"names":[],"mappings":";;;AAwCO,MAAM,iBAAA,GAAoB,CAC/B,QAAA,KAIG;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,kBAAkB,CAAA;AAC9C,EAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,MAAA,EAAO,MAAO;AAAA,IACpE,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA,EAAc,MAAA;AAAA,IACd,GAAG,sBAAsB,MAAM;AAAA,GACjC,CAAE,CAAA;AAEF,EAAA,MAAM,cAAA,GAAiB,KAAA,CAEpB,MAAA,CAAO,CAAA,IAAA,KAAQ;AACd,IAAA,MAAM,eAAA,GAAkB,IAAA,CAAK,QAAA,CAAS,cAAc,CAAA,EAAG,WAAA;AACvD,IAAA,OAAO,eAAA,GAAkB,YAAA,CAAa,QAAA,CAAS,eAAe,CAAA,GAAI,IAAA;AAAA,EACpE,CAAC,CAAA,CAEA,GAAA,CAAI,CAAA,IAAA,KAAQ;AACX,IAAA,MAAM,cAAA,GAAiB;AAAA,MACrB,GAAG,IAAA;AAAA,MACH,MAAA,EAAQ;AAAA,QACN,GAAG,IAAA,CAAK,MAAA;AAAA;AAAA,QAER,KAAA,EAAO;AAAA;AACT,KACF;AAEA,IAAA,IAAI,KAAK,MAAA,EAAQ,UAAA,IAAc,CAAC,IAAA,CAAK,QAAQ,YAAA,EAAc;AACzD,MAAA,cAAA,CAAe,MAAA,CAAO,aAAa,MAAA,CAAO,WAAA;AAAA,QACxC,OAAO,OAAA,CAAS,IAAA,CAAK,QAAQ,UAAA,IAAc,EAAiB,CAAA,CAAE,MAAA;AAAA,UAC5D,CAAC,CAAC,GAAG,CAAA,KAAM;AACT,YAAA,MAAM,kBACJ,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GAAI,cAAc,CAAA,EAAG,WAAA;AACxC,YAAA,OAAO,eAAA,GACH,YAAA,CAAa,QAAA,CAAS,eAAe,CAAA,GACrC,IAAA;AAAA,UACN;AAAA;AACF,OACF;AAAA,IACF;AAEA,IAAA,OAAO,cAAA;AAAA,EACT,CAAC,CAAA;AAEH,EAAA,OAAO;AAAA,IACL,cAAc,QAAA,CAAS,YAAA;AAAA,IACvB,KAAA,EAAO;AAAA,GACT;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplateTimeSaved.esm.js","sources":["../../../src/next/hooks/useTemplateTimeSaved.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 { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Duration } from 'luxon';\nimport useAsync from 'react-use/lib/useAsync';\n\n/**\n * Returns the backstage.io/time-saved annotation (as a number of minutes) for\n * a given template entity ref.\n */\nexport const useTemplateTimeSavedMinutes = (templateRef: string) => {\n const catalogApi = useApi(catalogApiRef);\n\n const { value: timeSavedMinutes } = useAsync(async () => {\n const entity = await catalogApi.getEntityByRef(templateRef);\n const timeSaved = entity?.metadata.annotations?.['backstage.io/time-saved'];\n\n // This is not a valid template or the template has no time-saved value.\n if (!entity || !timeSaved) {\n return undefined;\n }\n\n const durationMs = Duration.fromISO(timeSaved).as('minutes');\n\n // The time-saved annotation has an invalid value. Ignore.\n if (Number.isNaN(durationMs)) {\n return undefined;\n }\n\n return durationMs;\n }, [catalogApi, templateRef]);\n\n return timeSavedMinutes;\n};\n"],"names":[],"mappings":";;;;;AAyBa,MAAA,2BAAA,GAA8B,CAAC,WAAwB,KAAA;AAClE,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,KAAA,EAAO,gBAAiB,EAAA,GAAI,SAAS,YAAY;AACvD,IAAA,MAAM,MAAS,GAAA,MAAM,UAAW,CAAA,cAAA,CAAe,WAAW,CAAA;AAC1D,IAAA,MAAM,SAAY,GAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,yBAAyB,CAAA;AAG1E,IAAI,IAAA,CAAC,MAAU,IAAA,CAAC,SAAW,EAAA;AACzB,MAAO,OAAA,KAAA,CAAA;AAAA;AAGT,IAAA,MAAM,aAAa,QAAS,CAAA,OAAA,CAAQ,SAAS,CAAA,CAAE,GAAG,SAAS,CAAA;AAG3D,IAAI,IAAA,MAAA,CAAO,KAAM,CAAA,UAAU,CAAG,EAAA;AAC5B,MAAO,OAAA,KAAA,CAAA;AAAA;AAGT,IAAO,OAAA,UAAA;AAAA,GACN,EAAA,CAAC,UAAY,EAAA,WAAW,CAAC,CAAA;AAE5B,EAAO,OAAA,gBAAA;AACT;;;;"}
1
+ {"version":3,"file":"useTemplateTimeSaved.esm.js","sources":["../../../src/next/hooks/useTemplateTimeSaved.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 { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Duration } from 'luxon';\nimport useAsync from 'react-use/lib/useAsync';\n\n/**\n * Returns the backstage.io/time-saved annotation (as a number of minutes) for\n * a given template entity ref.\n */\nexport const useTemplateTimeSavedMinutes = (templateRef: string) => {\n const catalogApi = useApi(catalogApiRef);\n\n const { value: timeSavedMinutes } = useAsync(async () => {\n const entity = await catalogApi.getEntityByRef(templateRef);\n const timeSaved = entity?.metadata.annotations?.['backstage.io/time-saved'];\n\n // This is not a valid template or the template has no time-saved value.\n if (!entity || !timeSaved) {\n return undefined;\n }\n\n const durationMs = Duration.fromISO(timeSaved).as('minutes');\n\n // The time-saved annotation has an invalid value. Ignore.\n if (Number.isNaN(durationMs)) {\n return undefined;\n }\n\n return durationMs;\n }, [catalogApi, templateRef]);\n\n return timeSavedMinutes;\n};\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,2BAAA,GAA8B,CAAC,WAAA,KAAwB;AAClE,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,KAAA,EAAO,gBAAA,EAAiB,GAAI,SAAS,YAAY;AACvD,IAAA,MAAM,MAAA,GAAS,MAAM,UAAA,CAAW,cAAA,CAAe,WAAW,CAAA;AAC1D,IAAA,MAAM,SAAA,GAAY,MAAA,EAAQ,QAAA,CAAS,WAAA,GAAc,yBAAyB,CAAA;AAG1E,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,SAAA,EAAW;AACzB,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,aAAa,QAAA,CAAS,OAAA,CAAQ,SAAS,CAAA,CAAE,GAAG,SAAS,CAAA;AAG3D,IAAA,IAAI,MAAA,CAAO,KAAA,CAAM,UAAU,CAAA,EAAG;AAC5B,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,OAAO,UAAA;AAAA,EACT,CAAA,EAAG,CAAC,UAAA,EAAY,WAAW,CAAC,CAAA;AAE5B,EAAA,OAAO,gBAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTransformSchemaToProps.esm.js","sources":["../../../src/next/hooks/useTransformSchemaToProps.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 { useMemo } from 'react';\nimport { LayoutOptions } from '../../layouts';\nimport { type ParsedTemplateSchema } from './useTemplateSchema';\n\ninterface Options {\n layouts?: LayoutOptions[];\n}\n\nexport const useTransformSchemaToProps = (\n step: ParsedTemplateSchema,\n options: Options = {},\n): ParsedTemplateSchema => {\n const { layouts = [] } = options;\n const objectFieldTemplate = step?.uiSchema['ui:ObjectFieldTemplate'] as\n | string\n | undefined;\n return useMemo(() => {\n if (typeof objectFieldTemplate !== 'string') {\n return step;\n }\n\n const Layout = layouts.find(\n layout => layout.name === objectFieldTemplate,\n )?.component;\n\n if (!Layout) {\n return step;\n }\n return {\n ...step,\n uiSchema: {\n ...step.uiSchema,\n ['ui:ObjectFieldTemplate']: Layout,\n },\n };\n }, [layouts, objectFieldTemplate, step]);\n};\n"],"names":[],"mappings":";;AAuBO,MAAM,yBAA4B,GAAA,CACvC,IACA,EAAA,OAAA,GAAmB,EACM,KAAA;AACzB,EAAA,MAAM,EAAE,OAAA,GAAU,EAAC,EAAM,GAAA,OAAA;AACzB,EAAM,MAAA,mBAAA,GAAsB,IAAM,EAAA,QAAA,CAAS,wBAAwB,CAAA;AAGnE,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAI,IAAA,OAAO,wBAAwB,QAAU,EAAA;AAC3C,MAAO,OAAA,IAAA;AAAA;AAGT,IAAA,MAAM,SAAS,OAAQ,CAAA,IAAA;AAAA,MACrB,CAAA,MAAA,KAAU,OAAO,IAAS,KAAA;AAAA,KACzB,EAAA,SAAA;AAEH,IAAA,IAAI,CAAC,MAAQ,EAAA;AACX,MAAO,OAAA,IAAA;AAAA;AAET,IAAO,OAAA;AAAA,MACL,GAAG,IAAA;AAAA,MACH,QAAU,EAAA;AAAA,QACR,GAAG,IAAK,CAAA,QAAA;AAAA,QACR,CAAC,wBAAwB,GAAG;AAAA;AAC9B,KACF;AAAA,GACC,EAAA,CAAC,OAAS,EAAA,mBAAA,EAAqB,IAAI,CAAC,CAAA;AACzC;;;;"}
1
+ {"version":3,"file":"useTransformSchemaToProps.esm.js","sources":["../../../src/next/hooks/useTransformSchemaToProps.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 { useMemo } from 'react';\nimport { LayoutOptions } from '../../layouts';\nimport { type ParsedTemplateSchema } from './useTemplateSchema';\n\ninterface Options {\n layouts?: LayoutOptions[];\n}\n\nexport const useTransformSchemaToProps = (\n step: ParsedTemplateSchema,\n options: Options = {},\n): ParsedTemplateSchema => {\n const { layouts = [] } = options;\n const objectFieldTemplate = step?.uiSchema['ui:ObjectFieldTemplate'] as\n | string\n | undefined;\n return useMemo(() => {\n if (typeof objectFieldTemplate !== 'string') {\n return step;\n }\n\n const Layout = layouts.find(\n layout => layout.name === objectFieldTemplate,\n )?.component;\n\n if (!Layout) {\n return step;\n }\n return {\n ...step,\n uiSchema: {\n ...step.uiSchema,\n ['ui:ObjectFieldTemplate']: Layout,\n },\n };\n }, [layouts, objectFieldTemplate, step]);\n};\n"],"names":[],"mappings":";;AAuBO,MAAM,yBAAA,GAA4B,CACvC,IAAA,EACA,OAAA,GAAmB,EAAC,KACK;AACzB,EAAA,MAAM,EAAE,OAAA,GAAU,EAAC,EAAE,GAAI,OAAA;AACzB,EAAA,MAAM,mBAAA,GAAsB,IAAA,EAAM,QAAA,CAAS,wBAAwB,CAAA;AAGnE,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAA,IAAI,OAAO,wBAAwB,QAAA,EAAU;AAC3C,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,SAAS,OAAA,CAAQ,IAAA;AAAA,MACrB,CAAA,MAAA,KAAU,OAAO,IAAA,KAAS;AAAA,KAC5B,EAAG,SAAA;AAEH,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,OAAO;AAAA,MACL,GAAG,IAAA;AAAA,MACH,QAAA,EAAU;AAAA,QACR,GAAG,IAAA,CAAK,QAAA;AAAA,QACR,CAAC,wBAAwB,GAAG;AAAA;AAC9B,KACF;AAAA,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,mBAAA,EAAqB,IAAI,CAAC,CAAA;AACzC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../src/next/lib/schema.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 { JsonObject } from '@backstage/types';\nimport { stringify, parse } from 'flatted';\nimport { FieldValidation, UiSchema } from '@rjsf/utils';\n\nfunction isObject(value: unknown): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction extractUiSchema(schema: JsonObject, uiSchema: JsonObject) {\n if (!isObject(schema)) {\n return;\n }\n\n const {\n properties,\n items,\n anyOf,\n oneOf,\n allOf,\n dependencies,\n then,\n else: _else,\n } = schema;\n\n for (const propName in schema) {\n if (!schema.hasOwnProperty(propName)) {\n continue;\n }\n\n if (propName.startsWith('ui:')) {\n uiSchema[propName] = schema[propName];\n delete schema[propName];\n }\n }\n\n if (isObject(properties)) {\n for (const propName in properties) {\n if (!properties.hasOwnProperty(propName)) {\n continue;\n }\n\n const schemaNode = properties[propName];\n if (!isObject(schemaNode)) {\n continue;\n }\n\n if (!isObject(uiSchema[propName])) {\n const innerUiSchema = {};\n uiSchema[propName] = innerUiSchema;\n }\n\n extractUiSchema(schemaNode, uiSchema[propName] as JsonObject);\n }\n }\n\n if (isObject(items)) {\n const innerUiSchema = {};\n uiSchema.items = innerUiSchema;\n extractUiSchema(items, innerUiSchema);\n }\n\n if (Array.isArray(anyOf)) {\n for (const schemaNode of anyOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(oneOf)) {\n for (const schemaNode of oneOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(allOf)) {\n for (const schemaNode of allOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (isObject(dependencies)) {\n for (const depName of Object.keys(dependencies)) {\n const schemaNode = dependencies[depName];\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (isObject(then)) {\n extractUiSchema(then, uiSchema);\n }\n\n if (isObject(_else)) {\n extractUiSchema(_else, uiSchema);\n }\n}\n\n/**\n * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf\n * @alpha\n */\nexport const extractSchemaFromStep = (\n inputStep: JsonObject,\n): { uiSchema: UiSchema; schema: JsonObject } => {\n const uiSchema: UiSchema = {};\n const returnSchema: JsonObject = parse(stringify(inputStep));\n extractUiSchema(returnSchema, uiSchema);\n return { uiSchema, schema: returnSchema };\n};\n\n/**\n * Creates a field validation object for use in react jsonschema form\n * @alpha\n */\nexport const createFieldValidation = (): FieldValidation => {\n const fieldValidation: FieldValidation = {\n __errors: [] as string[],\n addError: (message: string) => {\n fieldValidation.__errors?.push(message);\n },\n };\n\n return fieldValidation;\n};\n"],"names":[],"mappings":";;AAmBA,SAAS,SAAS,KAAqC,EAAA;AACrD,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAEA,SAAS,eAAA,CAAgB,QAAoB,QAAsB,EAAA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AAO,QAAQ,CAAA;AAAA;AAEnC;AAMa,MAAA,qBAAA,GAAwB,CACnC,SAC+C,KAAA;AAC/C,EAAA,MAAM,WAAqB,EAAC;AAC5B,EAAA,MAAM,YAA2B,GAAA,KAAA,CAAM,SAAU,CAAA,SAAS,CAAC,CAAA;AAC3D,EAAA,eAAA,CAAgB,cAAc,QAAQ,CAAA;AACtC,EAAO,OAAA,EAAE,QAAU,EAAA,MAAA,EAAQ,YAAa,EAAA;AAC1C;AAMO,MAAM,wBAAwB,MAAuB;AAC1D,EAAA,MAAM,eAAmC,GAAA;AAAA,IACvC,UAAU,EAAC;AAAA,IACX,QAAA,EAAU,CAAC,OAAoB,KAAA;AAC7B,MAAgB,eAAA,CAAA,QAAA,EAAU,KAAK,OAAO,CAAA;AAAA;AACxC,GACF;AAEA,EAAO,OAAA,eAAA;AACT;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../src/next/lib/schema.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 { JsonObject } from '@backstage/types';\nimport { stringify, parse } from 'flatted';\nimport { FieldValidation, UiSchema } from '@rjsf/utils';\n\nfunction isObject(value: unknown): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction extractUiSchema(schema: JsonObject, uiSchema: JsonObject) {\n if (!isObject(schema)) {\n return;\n }\n\n const {\n properties,\n items,\n anyOf,\n oneOf,\n allOf,\n dependencies,\n then,\n else: _else,\n } = schema;\n\n for (const propName in schema) {\n if (!schema.hasOwnProperty(propName)) {\n continue;\n }\n\n if (propName.startsWith('ui:')) {\n uiSchema[propName] = schema[propName];\n delete schema[propName];\n }\n }\n\n if (isObject(properties)) {\n for (const propName in properties) {\n if (!properties.hasOwnProperty(propName)) {\n continue;\n }\n\n const schemaNode = properties[propName];\n if (!isObject(schemaNode)) {\n continue;\n }\n\n if (!isObject(uiSchema[propName])) {\n const innerUiSchema = {};\n uiSchema[propName] = innerUiSchema;\n }\n\n extractUiSchema(schemaNode, uiSchema[propName] as JsonObject);\n }\n }\n\n if (isObject(items)) {\n const innerUiSchema = {};\n uiSchema.items = innerUiSchema;\n extractUiSchema(items, innerUiSchema);\n }\n\n if (Array.isArray(anyOf)) {\n for (const schemaNode of anyOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(oneOf)) {\n for (const schemaNode of oneOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(allOf)) {\n for (const schemaNode of allOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (isObject(dependencies)) {\n for (const depName of Object.keys(dependencies)) {\n const schemaNode = dependencies[depName];\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (isObject(then)) {\n extractUiSchema(then, uiSchema);\n }\n\n if (isObject(_else)) {\n extractUiSchema(_else, uiSchema);\n }\n}\n\n/**\n * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf\n * @alpha\n */\nexport const extractSchemaFromStep = (\n inputStep: JsonObject,\n): { uiSchema: UiSchema; schema: JsonObject } => {\n const uiSchema: UiSchema = {};\n const returnSchema: JsonObject = parse(stringify(inputStep));\n extractUiSchema(returnSchema, uiSchema);\n return { uiSchema, schema: returnSchema };\n};\n\n/**\n * Creates a field validation object for use in react jsonschema form\n * @alpha\n */\nexport const createFieldValidation = (): FieldValidation => {\n const fieldValidation: FieldValidation = {\n __errors: [] as string[],\n addError: (message: string) => {\n fieldValidation.__errors?.push(message);\n },\n };\n\n return fieldValidation;\n};\n"],"names":[],"mappings":";;AAmBA,SAAS,SAAS,KAAA,EAAqC;AACrD,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAEA,SAAS,eAAA,CAAgB,QAAoB,QAAA,EAAsB;AACjE,EAAA,IAAI,CAAC,QAAA,CAAS,MAAM,CAAA,EAAG;AACrB,IAAA;AAAA,EACF;AAEA,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA,EAAM;AAAA,GACR,GAAI,MAAA;AAEJ,EAAA,KAAA,MAAW,YAAY,MAAA,EAAQ;AAC7B,IAAA,IAAI,CAAC,MAAA,CAAO,cAAA,CAAe,QAAQ,CAAA,EAAG;AACpC,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,QAAA,CAAS,UAAA,CAAW,KAAK,CAAA,EAAG;AAC9B,MAAA,QAAA,CAAS,QAAQ,CAAA,GAAI,MAAA,CAAO,QAAQ,CAAA;AACpC,MAAA,OAAO,OAAO,QAAQ,CAAA;AAAA,IACxB;AAAA,EACF;AAEA,EAAA,IAAI,QAAA,CAAS,UAAU,CAAA,EAAG;AACxB,IAAA,KAAA,MAAW,YAAY,UAAA,EAAY;AACjC,MAAA,IAAI,CAAC,UAAA,CAAW,cAAA,CAAe,QAAQ,CAAA,EAAG;AACxC,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAA,GAAa,WAAW,QAAQ,CAAA;AACtC,MAAA,IAAI,CAAC,QAAA,CAAS,UAAU,CAAA,EAAG;AACzB,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,CAAC,QAAA,CAA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W,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA,EAAG;AAC/C,MAAA,MAAM,UAAA,GAAa,aAAa,OAAO,CAAA;AACvC,MAAA,IAAI,CAAC,QAAA,CAAS,UAAU,CAAA,EAAG;AACzB,QAAA;AAAA,MACF;AACA,MAAA,eAAA,CAAgB,YAAY,QAAQ,CAAA;AAAA,IACtC;AAAA,EACF;AAEA,EAAA,IAAI,QAAA,CAAS,IAAI,CAAA,EAAG;AAClB,IAAA,eAAA,CAAgB,MAAM,QAAQ,CAAA;AAAA,EAChC;AAEA,EAAA,IAAI,QAAA,CAAS,KAAK,CAAA,EAAG;AACnB,IAAA,eAAA,CAAgB,OAAO,QAAQ,CAAA;AAAA,EACjC;AACF;AAMO,MAAM,qBAAA,GAAwB,CACnC,SAAA,KAC+C;AAC/C,EAAA,MAAM,WAAqB,EAAC;AAC5B,EAAA,MAAM,YAAA,GAA2B,KAAA,CAAM,SAAA,CAAU,SAAS,CAAC,CAAA;AAC3D,EAAA,eAAA,CAAgB,cAAc,QAAQ,CAAA;AACtC,EAAA,OAAO,EAAE,QAAA,EAAU,MAAA,EAAQ,YAAA,EAAa;AAC1C;AAMO,MAAM,wBAAwB,MAAuB;AAC1D,EAAA,MAAM,eAAA,GAAmC;AAAA,IACvC,UAAU,EAAC;AAAA,IACX,QAAA,EAAU,CAAC,OAAA,KAAoB;AAC7B,MAAA,eAAA,CAAgB,QAAA,EAAU,KAAK,OAAO,CAAA;AAAA,IACxC;AAAA,GACF;AAEA,EAAA,OAAO,eAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OpaqueType.esm.js","sources":["../../../../../../packages/opaque-internal/src/OpaqueType.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\n// TODO(Rugvip): This lives here temporarily, but should be moved to a more\n// central location. It's useful for backend packages too so we'll need to have\n// it in a common package, but it might also be that we want to make it\n// available publicly too in which case it would make sense to have this be part\n// of @backstage/version-bridge. The problem with exporting it from there is\n// that it would need to be very stable at that point, so it might be a bit\n// early to put it there already.\n\n/**\n * A helper for working with opaque types.\n */\nexport class OpaqueType<\n T extends {\n public: { $$type: string };\n versions: { version: string | undefined };\n },\n> {\n /**\n * Creates a new opaque type.\n *\n * @param options.type The type identifier of the opaque type\n * @param options.versions The available versions of the opaque type\n * @returns A new opaque type helper\n */\n static create<\n T extends {\n public: { $$type: string };\n versions: { version: string | undefined };\n },\n >(options: {\n type: T['public']['$$type'];\n versions: Array<T['versions']['version']>;\n }) {\n return new OpaqueType<T>(options.type, new Set(options.versions));\n }\n\n #type: string;\n #versions: Set<string | undefined>;\n\n private constructor(type: string, versions: Set<string | undefined>) {\n this.#type = type;\n this.#versions = versions;\n }\n\n /**\n * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TPublic`\n *\n * @remarks\n *\n * This property is only useful for type checking, its runtime value is `undefined`.\n */\n TPublic: T['public'] = undefined as any;\n\n /**\n * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TInternal`\n *\n * @remarks\n *\n * This property is only useful for type checking, its runtime value is `undefined`.\n */\n TInternal: T['public'] & T['versions'] = undefined as any;\n\n /**\n * @param value Input value expected to be an instance of this opaque type\n * @returns True if the value matches this opaque type\n */\n isType = (value: unknown): value is T['public'] => {\n return this.#isThisInternalType(value);\n };\n\n /**\n * @param value Input value expected to be an instance of this opaque type\n * @throws If the value is not an instance of this opaque type or is of an unsupported version\n * @returns The internal version of the opaque type\n */\n toInternal = (value: unknown): T['public'] & T['versions'] => {\n if (!this.#isThisInternalType(value)) {\n throw new TypeError(\n `Invalid opaque type, expected '${\n this.#type\n }', but got '${this.#stringifyUnknown(value)}'`,\n );\n }\n\n if (!this.#versions.has(value.version)) {\n const versions = Array.from(this.#versions).map(this.#stringifyVersion);\n if (versions.length > 1) {\n versions[versions.length - 1] = `or ${versions[versions.length - 1]}`;\n }\n const expected =\n versions.length > 2 ? versions.join(', ') : versions.join(' ');\n throw new TypeError(\n `Invalid opaque type instance, got version ${this.#stringifyVersion(\n value.version,\n )}, expected ${expected}`,\n );\n }\n\n return value;\n };\n\n /**\n * Creates an instance of the opaque type, returning the public type.\n *\n * @param version The version of the instance to create\n * @param value The remaining public and internal properties of the instance\n * @returns An instance of the opaque type\n */\n createInstance<\n TVersion extends T['versions']['version'],\n TPublic extends T['public'],\n >(\n version: TVersion,\n props: Omit<T['public'], '$$type'> &\n (T['versions'] extends infer UVersion\n ? UVersion extends { version: TVersion }\n ? Omit<UVersion, 'version'>\n : never\n : never) &\n Object, // & Object to allow for object properties too, e.g. toString()\n ): TPublic {\n return Object.assign(props as object, {\n $$type: this.#type,\n ...(version && { version }),\n }) as unknown as TPublic;\n }\n\n #isThisInternalType(value: unknown): value is T['public'] & T['versions'] {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n return (value as T['public']).$$type === this.#type;\n }\n\n #stringifyUnknown(value: unknown) {\n if (typeof value !== 'object') {\n return `<${typeof value}>`;\n }\n if (value === null) {\n return '<null>';\n }\n if ('$$type' in value) {\n return String(value.$$type);\n }\n return String(value);\n }\n\n #stringifyVersion = (version: string | undefined) => {\n return version ? `'${version}'` : 'undefined';\n };\n}\n"],"names":[],"mappings":"AA2BO,MAAM,UAKX,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,OAKL,OAGC,EAAA;AACD,IAAO,OAAA,IAAI,WAAc,OAAQ,CAAA,IAAA,EAAM,IAAI,GAAI,CAAA,OAAA,CAAQ,QAAQ,CAAC,CAAA;AAAA;AAClE,EAEA,KAAA;AAAA,EACA,SAAA;A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MAAA,MAAM,IAAI,SAAA;AAAA,QACR,6CAA6C,IAAK,CAAA,iBAAA;AAAA,UAChD,KAAM,CAAA;AAAA,SACP,cAAc,QAAQ,CAAA;AAAA,OACzB;AAAA;AAGF,IAAO,OAAA,KAAA;AAAA,GACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAA,CAIE,SACA,KAOS,EAAA;AACT,IAAO,OAAA,MAAA,CAAO,OAAO,KAAiB,EAAA;AAAA,MACpC,QAAQ,IAAK,CAAA,KAAA;AAAA,MACb,GAAI,OAAW,IAAA,EAAE,OAAQ;AAAA,KAC1B,CAAA;AAAA;AACH,EAEA,oBAAoB,KAAsD,EAAA;AACxE,IAAA,IAAI,KAAU,KAAA,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAU,EAAA;AAC/C,MAAO,OAAA,KAAA;AAAA;AAET,IAAQ,OAAA,KAAA,CAAsB,WAAW,IAAK,CAAA,KAAA;AAAA;AAChD,EAEA,kBAAkB,KAAgB,EAAA;AAChC,IAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,MAAO,OAAA,CAAA,CAAA,EAAI,OAAO,KAAK,CAAA,CAAA,CAAA;AAAA;AAEzB,IAAA,IAAI,UAAU,IAAM,EAAA;AAClB,MAAO,OAAA,QAAA;AAAA;AAET,IAAA,IAAI,YAAY,KAAO,EAAA;AACrB,MAAO,OAAA,MAAA,CAAO,MAAM,MAAM,CAAA;AAAA;AAE5B,IAAA,OAAO,OAAO,KAAK,CAAA;AAAA;AACrB,EAEA,iBAAA,GAAoB,CAAC,OAAgC,KAAA;AACnD,IAAO,OAAA,OAAA,GAAU,CAAI,CAAA,EAAA,OAAO,CAAM,CAAA,CAAA,GAAA,WAAA;AAAA,GACpC;AACF;;;;"}
1
+ {"version":3,"file":"OpaqueType.esm.js","sources":["../../../../../../packages/opaque-internal/src/OpaqueType.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\n// TODO(Rugvip): This lives here temporarily, but should be moved to a more\n// central location. It's useful for backend packages too so we'll need to have\n// it in a common package, but it might also be that we want to make it\n// available publicly too in which case it would make sense to have this be part\n// of @backstage/version-bridge. The problem with exporting it from there is\n// that it would need to be very stable at that point, so it might be a bit\n// early to put it there already.\n\n/**\n * A helper for working with opaque types.\n */\nexport class OpaqueType<\n T extends {\n public: { $$type: string };\n versions: { version: string | undefined };\n },\n> {\n /**\n * Creates a new opaque type.\n *\n * @param options.type The type identifier of the opaque type\n * @param options.versions The available versions of the opaque type\n * @returns A new opaque type helper\n */\n static create<\n T extends {\n public: { $$type: string };\n versions: { version: string | undefined };\n },\n >(options: {\n type: T['public']['$$type'];\n versions: Array<T['versions']['version']>;\n }) {\n return new OpaqueType<T>(options.type, new Set(options.versions));\n }\n\n #type: string;\n #versions: Set<string | undefined>;\n\n private constructor(type: string, versions: Set<string | undefined>) {\n this.#type = type;\n this.#versions = versions;\n }\n\n /**\n * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TPublic`\n *\n * @remarks\n *\n * This property is only useful for type checking, its runtime value is `undefined`.\n */\n TPublic: T['public'] = undefined as any;\n\n /**\n * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TInternal`\n *\n * @remarks\n *\n * This property is only useful for type checking, its runtime value is `undefined`.\n */\n TInternal: T['public'] & T['versions'] = undefined as any;\n\n /**\n * @param value Input value expected to be an instance of this opaque type\n * @returns True if the value matches this opaque type\n */\n isType = (value: unknown): value is T['public'] => {\n return this.#isThisInternalType(value);\n };\n\n /**\n * @param value Input value expected to be an instance of this opaque type\n * @throws If the value is not an instance of this opaque type or is of an unsupported version\n * @returns The internal version of the opaque type\n */\n toInternal = (value: unknown): T['public'] & T['versions'] => {\n if (!this.#isThisInternalType(value)) {\n throw new TypeError(\n `Invalid opaque type, expected '${\n this.#type\n }', but got '${this.#stringifyUnknown(value)}'`,\n );\n }\n\n if (!this.#versions.has(value.version)) {\n const versions = Array.from(this.#versions).map(this.#stringifyVersion);\n if (versions.length > 1) {\n versions[versions.length - 1] = `or ${versions[versions.length - 1]}`;\n }\n const expected =\n versions.length > 2 ? versions.join(', ') : versions.join(' ');\n throw new TypeError(\n `Invalid opaque type instance, got version ${this.#stringifyVersion(\n value.version,\n )}, expected ${expected}`,\n );\n }\n\n return value;\n };\n\n /**\n * Creates an instance of the opaque type, returning the public type.\n *\n * @param version The version of the instance to create\n * @param value The remaining public and internal properties of the instance\n * @returns An instance of the opaque type\n */\n createInstance<\n TVersion extends T['versions']['version'],\n TPublic extends T['public'],\n >(\n version: TVersion,\n props: Omit<T['public'], '$$type'> &\n (T['versions'] extends infer UVersion\n ? UVersion extends { version: TVersion }\n ? Omit<UVersion, 'version'>\n : never\n : never) &\n Object, // & Object to allow for object properties too, e.g. toString()\n ): TPublic {\n return Object.assign(props as object, {\n $$type: this.#type,\n ...(version && { version }),\n }) as unknown as TPublic;\n }\n\n #isThisInternalType(value: unknown): value is T['public'] & T['versions'] {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n return (value as T['public']).$$type === this.#type;\n }\n\n #stringifyUnknown(value: unknown) {\n if (typeof value !== 'object') {\n return `<${typeof value}>`;\n }\n if (value === null) {\n return '<null>';\n }\n if ('$$type' in value) {\n return String(value.$$type);\n }\n return String(value);\n }\n\n #stringifyVersion = (version: string | undefined) => {\n return version ? `'${version}'` : 'undefined';\n };\n}\n"],"names":[],"mappings":"AA2BO,MAAM,UAAA,CAKX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,OAKL,OAAA,EAGC;AACD,IAAA,OAA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A,EAAI,OAAO,CAAA,CAAA,CAAA,GAAM,WAAA;AAAA,EACpC,CAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalFormDecorator.esm.js","sources":["../../../../../../../packages/scaffolder-internal/src/wiring/InternalFormDecorator.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OpaqueType } from '@internal/opaque';\nimport { z } from 'zod';\n\nimport {\n ScaffolderFormDecorator,\n ScaffolderFormDecoratorContext,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { AnyApiRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport const OpaqueFormDecorator = OpaqueType.create<{\n public: ScaffolderFormDecorator;\n versions: {\n readonly version: 'v1';\n readonly id: string;\n readonly schema?: {\n input?: {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n };\n };\n readonly deps?: { [key in string]: AnyApiRef };\n readonly decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [depName in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n };\n}>({ type: '@backstage/scaffolder/FormDecorator', versions: ['v1'] });\n"],"names":[],"mappings":";;AAyBa,MAAA,mBAAA,GAAsB,UAAW,CAAA,MAAA,CAgB3C,EAAE,IAAA,EAAM,uCAAuC,QAAU,EAAA,CAAC,IAAI,CAAA,EAAG;;;;"}
1
+ {"version":3,"file":"InternalFormDecorator.esm.js","sources":["../../../../../../../packages/scaffolder-internal/src/wiring/InternalFormDecorator.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OpaqueType } from '@internal/opaque';\nimport { z } from 'zod';\n\nimport {\n ScaffolderFormDecorator,\n ScaffolderFormDecoratorContext,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { AnyApiRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport const OpaqueFormDecorator = OpaqueType.create<{\n public: ScaffolderFormDecorator;\n versions: {\n readonly version: 'v1';\n readonly id: string;\n readonly schema?: {\n input?: {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n };\n };\n readonly deps?: { [key in string]: AnyApiRef };\n readonly decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [depName in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n };\n}>({ type: '@backstage/scaffolder/FormDecorator', versions: ['v1'] });\n"],"names":[],"mappings":";;AAyBO,MAAM,mBAAA,GAAsB,UAAA,CAAW,MAAA,CAgB3C,EAAE,IAAA,EAAM,uCAAuC,QAAA,EAAU,CAAC,IAAI,CAAA,EAAG;;;;"}