@backstage/plugin-scaffolder 1.33.1-next.0 → 1.34.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @backstage/plugin-scaffolder
2
2
 
3
+ ## 1.34.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e4ddf22: Internal update to align with new blueprint parameter naming in the new frontend system.
8
+ - Updated dependencies
9
+ - @backstage/frontend-plugin-api@0.11.0-next.1
10
+ - @backstage/core-compat-api@0.5.0-next.2
11
+ - @backstage/plugin-catalog-react@1.20.0-next.2
12
+ - @backstage/core-components@0.17.5-next.1
13
+ - @backstage/catalog-client@1.11.0-next.0
14
+ - @backstage/catalog-model@1.7.5
15
+ - @backstage/core-plugin-api@1.10.9
16
+ - @backstage/errors@1.2.7
17
+ - @backstage/integration@1.17.1
18
+ - @backstage/integration-react@1.2.9
19
+ - @backstage/types@1.2.1
20
+ - @backstage/plugin-catalog-common@1.1.5
21
+ - @backstage/plugin-permission-react@0.4.36
22
+ - @backstage/plugin-scaffolder-common@1.7.0-next.0
23
+ - @backstage/plugin-scaffolder-react@1.19.0-next.1
24
+
25
+ ## 1.34.0-next.1
26
+
27
+ ### Minor Changes
28
+
29
+ - c08cbc4: Move Scaffolder API to OpenAPI
30
+
31
+ ### Patch Changes
32
+
33
+ - f2f133c: Internal update to use the new variant of `ApiBlueprint`.
34
+ - b0dc9b8: differentiate between entirely and partially composite schemas in schema rendering
35
+ - c4b7c50: Export `FormField` type from `/alpha` in `-react` package, and internal refactor.
36
+ - Updated dependencies
37
+ - @backstage/plugin-scaffolder-react@1.19.0-next.1
38
+ - @backstage/plugin-scaffolder-common@1.7.0-next.0
39
+ - @backstage/core-compat-api@0.4.5-next.1
40
+ - @backstage/plugin-catalog-react@1.20.0-next.1
41
+ - @backstage/frontend-plugin-api@0.11.0-next.0
42
+ - @backstage/catalog-client@1.11.0-next.0
43
+ - @backstage/core-components@0.17.5-next.0
44
+ - @backstage/catalog-model@1.7.5
45
+ - @backstage/core-plugin-api@1.10.9
46
+ - @backstage/errors@1.2.7
47
+ - @backstage/integration@1.17.1
48
+ - @backstage/integration-react@1.2.9
49
+ - @backstage/types@1.2.1
50
+ - @backstage/plugin-catalog-common@1.1.5
51
+ - @backstage/plugin-permission-react@0.4.36
52
+
3
53
  ## 1.33.1-next.0
4
54
 
5
55
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { ApiBlueprint, createExtensionInput, createApiFactory } from '@backstage/frontend-plugin-api';
1
+ import { ApiBlueprint, createExtensionInput } from '@backstage/frontend-plugin-api';
2
2
  import { formDecoratorsApiRef } from './ref.esm.js';
3
3
  import { FormDecoratorBlueprint } from '@backstage/plugin-scaffolder-react/alpha';
4
4
 
@@ -26,15 +26,15 @@ const formDecoratorsApi = ApiBlueprint.makeWithOverrides({
26
26
  const formDecorators = inputs.formDecorators.map(
27
27
  (e) => e.get(FormDecoratorBlueprint.dataRefs.formDecoratorLoader)
28
28
  );
29
- return originalFactory({
30
- factory: createApiFactory({
29
+ return originalFactory(
30
+ (defineParams) => defineParams({
31
31
  api: formDecoratorsApiRef,
32
32
  deps: {},
33
33
  factory: () => DefaultScaffolderFormDecoratorsApi.create({
34
34
  decorators: formDecorators
35
35
  })
36
36
  })
37
- });
37
+ );
38
38
  }
39
39
  });
40
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"FormDecoratorsApi.esm.js","sources":["../../../src/alpha/api/FormDecoratorsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createApiFactory,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecoratorsApi } from './types';\nimport { ScaffolderFormDecorator } from '@backstage/plugin-scaffolder-react/alpha';\nimport { formDecoratorsApiRef } from './ref';\nimport { FormDecoratorBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\n\n/** @alpha */\nexport class DefaultScaffolderFormDecoratorsApi\n implements ScaffolderFormDecoratorsApi\n{\n private constructor(\n private readonly options: {\n decorators: Array<ScaffolderFormDecorator>;\n },\n ) {}\n\n static create(options?: { decorators: ScaffolderFormDecorator[] }) {\n return new DefaultScaffolderFormDecoratorsApi(\n options ?? { decorators: [] },\n );\n }\n\n async getFormDecorators(): Promise<ScaffolderFormDecorator[]> {\n return this.options.decorators;\n }\n}\n\n/** @alpha */\nexport const formDecoratorsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-decorators',\n inputs: {\n formDecorators: createExtensionInput([\n FormDecoratorBlueprint.dataRefs.formDecoratorLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formDecorators = inputs.formDecorators.map(e =>\n e.get(FormDecoratorBlueprint.dataRefs.formDecoratorLoader),\n );\n\n return originalFactory({\n factory: createApiFactory({\n api: formDecoratorsApiRef,\n deps: {},\n factory: () =>\n DefaultScaffolderFormDecoratorsApi.create({\n decorators: formDecorators,\n }),\n }),\n });\n },\n});\n"],"names":[],"mappings":";;;;AA2BO,MAAM,kCAEb,CAAA;AAAA,EACU,YACW,OAGjB,EAAA;AAHiB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA;AAGhB,EAEH,OAAO,OAAO,OAAqD,EAAA;AACjE,IAAA,OAAO,IAAI,kCAAA;AAAA,MACT,OAAW,IAAA,EAAE,UAAY,EAAA,EAAG;AAAA,KAC9B;AAAA;AACF,EAEA,MAAM,iBAAwD,GAAA;AAC5D,IAAA,OAAO,KAAK,OAAQ,CAAA,UAAA;AAAA;AAExB;AAGa,MAAA,iBAAA,GAAoB,aAAa,iBAAkB,CAAA;AAAA,EAC9D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,gBAAgB,oBAAqB,CAAA;AAAA,MACnC,uBAAuB,QAAS,CAAA;AAAA,KACjC;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,cAAA,GAAiB,OAAO,cAAe,CAAA,GAAA;AAAA,MAAI,CAC/C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,sBAAA,CAAuB,SAAS,mBAAmB;AAAA,KAC3D;AAEA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,oBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,kCAAA,CAAmC,MAAO,CAAA;AAAA,UACxC,UAAY,EAAA;AAAA,SACb;AAAA,OACJ;AAAA,KACF,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"FormDecoratorsApi.esm.js","sources":["../../../src/alpha/api/FormDecoratorsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecoratorsApi } from './types';\nimport { ScaffolderFormDecorator } from '@backstage/plugin-scaffolder-react/alpha';\nimport { formDecoratorsApiRef } from './ref';\nimport { FormDecoratorBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\n\n/** @alpha */\nexport class DefaultScaffolderFormDecoratorsApi\n implements ScaffolderFormDecoratorsApi\n{\n private constructor(\n private readonly options: {\n decorators: Array<ScaffolderFormDecorator>;\n },\n ) {}\n\n static create(options?: { decorators: ScaffolderFormDecorator[] }) {\n return new DefaultScaffolderFormDecoratorsApi(\n options ?? { decorators: [] },\n );\n }\n\n async getFormDecorators(): Promise<ScaffolderFormDecorator[]> {\n return this.options.decorators;\n }\n}\n\n/** @alpha */\nexport const formDecoratorsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-decorators',\n inputs: {\n formDecorators: createExtensionInput([\n FormDecoratorBlueprint.dataRefs.formDecoratorLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formDecorators = inputs.formDecorators.map(e =>\n e.get(FormDecoratorBlueprint.dataRefs.formDecoratorLoader),\n );\n\n return originalFactory(defineParams =>\n defineParams({\n api: formDecoratorsApiRef,\n deps: {},\n factory: () =>\n DefaultScaffolderFormDecoratorsApi.create({\n decorators: formDecorators,\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA0BO,MAAM,kCAEb,CAAA;AAAA,EACU,YACW,OAGjB,EAAA;AAHiB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA;AAGhB,EAEH,OAAO,OAAO,OAAqD,EAAA;AACjE,IAAA,OAAO,IAAI,kCAAA;AAAA,MACT,OAAW,IAAA,EAAE,UAAY,EAAA,EAAG;AAAA,KAC9B;AAAA;AACF,EAEA,MAAM,iBAAwD,GAAA;AAC5D,IAAA,OAAO,KAAK,OAAQ,CAAA,UAAA;AAAA;AAExB;AAGa,MAAA,iBAAA,GAAoB,aAAa,iBAAkB,CAAA;AAAA,EAC9D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,gBAAgB,oBAAqB,CAAA;AAAA,MACnC,uBAAuB,QAAS,CAAA;AAAA,KACjC;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,cAAA,GAAiB,OAAO,cAAe,CAAA,GAAA;AAAA,MAAI,CAC/C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,sBAAA,CAAuB,SAAS,mBAAmB;AAAA,KAC3D;AAEA,IAAO,OAAA,eAAA;AAAA,MAAgB,kBACrB,YAAa,CAAA;AAAA,QACX,GAAK,EAAA,oBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,kCAAA,CAAmC,MAAO,CAAA;AAAA,UACxC,UAAY,EAAA;AAAA,SACb;AAAA,OACJ;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DryRunResultsList.esm.js","sources":["../../../../../src/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.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 IconButton from '@material-ui/core/IconButton';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CancelIcon from '@material-ui/icons/Cancel';\nimport CheckIcon from '@material-ui/icons/Check';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport DownloadIcon from '@material-ui/icons/GetApp';\nimport { useDryRun } from '../DryRunContext';\nimport { downloadBlob } from '../../../../lib/download';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../../translation';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n overflowY: 'auto',\n background: theme.palette.background.default,\n },\n iconSuccess: {\n minWidth: 0,\n marginRight: theme.spacing(1),\n color: theme.palette.status.ok,\n },\n iconFailure: {\n minWidth: 0,\n marginRight: theme.spacing(1),\n color: theme.palette.status.error,\n },\n}));\n\nexport function DryRunResultsList() {\n const classes = useStyles();\n const dryRun = useDryRun();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n return (\n <List className={classes.root} dense>\n {dryRun.results.map(result => {\n const failed = result.log.some(l => l.body.status === 'failed');\n let isLoading = false;\n\n async function downloadResult() {\n isLoading = true;\n await downloadDirectoryContents(\n result.directoryContents,\n `dry-run-result-${result.id}.zip`,\n );\n isLoading = false;\n }\n\n return (\n <ListItem\n button\n key={result.id}\n selected={dryRun.selectedResult?.id === result.id}\n onClick={() => dryRun.selectResult(result.id)}\n >\n <ListItemIcon\n className={failed ? classes.iconFailure : classes.iconSuccess}\n >\n {failed ? <CancelIcon /> : <CheckIcon />}\n </ListItemIcon>\n <ListItemText\n primary={t('templateEditorPage.dryRunResultsList.title', {\n resultId: `${result.id}`,\n })}\n />\n <ListItemSecondaryAction>\n <IconButton\n edge=\"end\"\n aria-label=\"download\"\n title={t(\n 'templateEditorPage.dryRunResultsList.downloadButtonTitle',\n )}\n disabled={isLoading}\n onClick={() => downloadResult()}\n >\n <DownloadIcon />\n </IconButton>\n <IconButton\n edge=\"end\"\n aria-label=\"delete\"\n title={t(\n 'templateEditorPage.dryRunResultsList.deleteButtonTitle',\n )}\n onClick={() => dryRun.deleteResult(result.id)}\n >\n <DeleteIcon />\n </IconButton>\n </ListItemSecondaryAction>\n </ListItem>\n );\n })}\n </List>\n );\n}\n\nasync function downloadDirectoryContents(\n directoryContents: {\n path: string;\n base64Content: string;\n executable: boolean;\n }[],\n name: string,\n) {\n const { default: JSZip } = await import('jszip');\n const zip = new JSZip();\n\n for (const d of directoryContents) {\n // Decode text content from base64 to ascii\n const converted = atob(d.base64Content);\n\n // add folder/file to zip\n await zip.file(d.path, converted);\n }\n\n const blob = await zip.generateAsync({ type: 'blob' });\n downloadBlob(blob, name);\n}\n"],"names":["CancelIcon"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA,MAAA;AAAA,IACX,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA;AAAA,GACvC;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,CAAA;AAAA,IACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,CAAA;AAAA,IACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA;AAEhC,CAAE,CAAA,CAAA;AAEK,SAAS,iBAAoB,GAAA;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,SAAS,SAAU,EAAA;AACzB,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EACE,uBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAM,OAAK,IACjC,EAAA,QAAA,EAAA,MAAA,CAAO,OAAQ,CAAA,GAAA,CAAI,CAAU,MAAA,KAAA;AAC5B,IAAM,MAAA,MAAA,GAAS,OAAO,GAAI,CAAA,IAAA,CAAK,OAAK,CAAE,CAAA,IAAA,CAAK,WAAW,QAAQ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A;AAAA,gBAE9B,8BAAC,YAAa,EAAA,EAAA;AAAA;AAAA,aAChB;AAAA,4BACA,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,IAAK,EAAA,KAAA;AAAA,gBACL,YAAW,EAAA,QAAA;AAAA,gBACX,KAAO,EAAA,CAAA;AAAA,kBACL;AAAA,iBACF;AAAA,gBACA,OAAS,EAAA,MAAM,MAAO,CAAA,YAAA,CAAa,OAAO,EAAE,CAAA;AAAA,gBAE5C,8BAAC,UAAW,EAAA,EAAA;AAAA;AAAA;AACd,WACF,EAAA;AAAA;AAAA,OAAA;AAAA,MApCK,MAAO,CAAA;AAAA,KAqCd;AAAA,GAEH,CACH,EAAA,CAAA;AAEJ;AAEA,eAAe,yBAAA,CACb,mBAKA,IACA,EAAA;AACA,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAU,GAAA,MAAM,OAAO,OAAO,CAAA;AAC/C,EAAM,MAAA,GAAA,GAAM,IAAI,KAAM,EAAA;AAEtB,EAAA,KAAA,MAAW,KAAK,iBAAmB,EAAA;AAEjC,IAAM,MAAA,SAAA,GAAY,IAAK,CAAA,CAAA,CAAE,aAAa,CAAA;AAGtC,IAAA,MAAM,GAAI,CAAA,IAAA,CAAK,CAAE,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA;AAGlC,EAAA,MAAM,OAAO,MAAM,GAAA,CAAI,cAAc,EAAE,IAAA,EAAM,QAAQ,CAAA;AACrD,EAAA,YAAA,CAAa,MAAM,IAAI,CAAA;AACzB;;;;"}
1
+ {"version":3,"file":"DryRunResultsList.esm.js","sources":["../../../../../src/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.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 IconButton from '@material-ui/core/IconButton';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CancelIcon from '@material-ui/icons/Cancel';\nimport CheckIcon from '@material-ui/icons/Check';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport DownloadIcon from '@material-ui/icons/GetApp';\nimport { useDryRun } from '../DryRunContext';\nimport { downloadBlob } from '../../../../lib/download';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../../translation';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n overflowY: 'auto',\n background: theme.palette.background.default,\n },\n iconSuccess: {\n minWidth: 0,\n marginRight: theme.spacing(1),\n color: theme.palette.status.ok,\n },\n iconFailure: {\n minWidth: 0,\n marginRight: theme.spacing(1),\n color: theme.palette.status.error,\n },\n}));\n\nexport function DryRunResultsList() {\n const classes = useStyles();\n const dryRun = useDryRun();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n return (\n <List className={classes.root} dense>\n {dryRun.results.map(result => {\n const failed = result.log.some(l => l.body.status === 'failed');\n let isLoading = false;\n\n async function downloadResult() {\n isLoading = true;\n await downloadDirectoryContents(\n result.directoryContents,\n `dry-run-result-${result.id}.zip`,\n );\n isLoading = false;\n }\n\n return (\n <ListItem\n button\n key={result.id}\n selected={dryRun.selectedResult?.id === result.id}\n onClick={() => dryRun.selectResult(result.id)}\n >\n <ListItemIcon\n className={failed ? classes.iconFailure : classes.iconSuccess}\n >\n {failed ? <CancelIcon /> : <CheckIcon />}\n </ListItemIcon>\n <ListItemText\n primary={t('templateEditorPage.dryRunResultsList.title', {\n resultId: `${result.id}`,\n })}\n />\n <ListItemSecondaryAction>\n <IconButton\n edge=\"end\"\n aria-label=\"download\"\n title={t(\n 'templateEditorPage.dryRunResultsList.downloadButtonTitle',\n )}\n disabled={isLoading}\n onClick={() => downloadResult()}\n >\n <DownloadIcon />\n </IconButton>\n <IconButton\n edge=\"end\"\n aria-label=\"delete\"\n title={t(\n 'templateEditorPage.dryRunResultsList.deleteButtonTitle',\n )}\n onClick={() => dryRun.deleteResult(result.id)}\n >\n <DeleteIcon />\n </IconButton>\n </ListItemSecondaryAction>\n </ListItem>\n );\n })}\n </List>\n );\n}\n\nasync function downloadDirectoryContents(\n directoryContents: {\n path: string;\n base64Content: string;\n executable?: boolean;\n }[],\n name: string,\n) {\n const { default: JSZip } = await import('jszip');\n const zip = new JSZip();\n\n for (const d of directoryContents) {\n // Decode text content from base64 to ascii\n const converted = atob(d.base64Content);\n\n // add folder/file to zip\n await zip.file(d.path, converted);\n }\n\n const blob = await zip.generateAsync({ type: 'blob' });\n downloadBlob(blob, name);\n}\n"],"names":["CancelIcon"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA,MAAA;AAAA,IACX,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA;AAAA,GACvC;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,CAAA;AAAA,IACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,CAAA;AAAA,IACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,KAAA,EAAO,KAAM,CAAA,OAA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;AAGtC,IAAA,MAAM,GAAI,CAAA,IAAA,CAAK,CAAE,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA;AAGlC,EAAA,MAAM,OAAO,MAAM,GAAA,CAAI,cAAc,EAAE,IAAA,EAAM,QAAQ,CAAA;AACrD,EAAA,YAAA,CAAa,MAAM,IAAI,CAAA;AACzB;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
3
- import { PageBlueprint, createExtensionInput, NavItemBlueprint, ApiBlueprint, createApiFactory, discoveryApiRef, fetchApiRef, identityApiRef } from '@backstage/frontend-plugin-api';
3
+ import { PageBlueprint, createExtensionInput, NavItemBlueprint, ApiBlueprint, discoveryApiRef, fetchApiRef, identityApiRef } from '@backstage/frontend-plugin-api';
4
4
  import { rootRouteRef } from '../routes.esm.js';
5
5
  import CreateComponentIcon from '@material-ui/icons/AddCircleOutline';
6
6
  import { FormFieldBlueprint } from '@backstage/plugin-scaffolder-react/alpha';
@@ -20,7 +20,7 @@ const scaffolderPage = PageBlueprint.makeWithOverrides({
20
20
  );
21
21
  return originalFactory({
22
22
  routeRef: convertLegacyRouteRef(rootRouteRef),
23
- defaultPath: "/create",
23
+ path: "/create",
24
24
  loader: () => import('../components/Router/Router.esm.js').then(
25
25
  (m) => compatWrapper(
26
26
  /* @__PURE__ */ jsx(m.InternalRouter, { formFieldLoaders })
@@ -43,23 +43,21 @@ const repoUrlPickerFormField = FormFieldBlueprint.make({
43
43
  }
44
44
  });
45
45
  const scaffolderApi = ApiBlueprint.make({
46
- params: {
47
- factory: createApiFactory({
48
- api: scaffolderApiRef,
49
- deps: {
50
- discoveryApi: discoveryApiRef,
51
- scmIntegrationsApi: scmIntegrationsApiRef,
52
- fetchApi: fetchApiRef,
53
- identityApi: identityApiRef
54
- },
55
- factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) => new ScaffolderClient({
56
- discoveryApi,
57
- scmIntegrationsApi,
58
- fetchApi,
59
- identityApi
60
- })
46
+ params: (defineParams) => defineParams({
47
+ api: scaffolderApiRef,
48
+ deps: {
49
+ discoveryApi: discoveryApiRef,
50
+ scmIntegrationsApi: scmIntegrationsApiRef,
51
+ fetchApi: fetchApiRef,
52
+ identityApi: identityApiRef
53
+ },
54
+ factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) => new ScaffolderClient({
55
+ discoveryApi,
56
+ scmIntegrationsApi,
57
+ fetchApi,
58
+ identityApi
61
59
  })
62
- }
60
+ })
63
61
  });
64
62
 
65
63
  export { repoUrlPickerFormField, scaffolderApi, scaffolderNavItem, scaffolderPage };
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.esm.js","sources":["../../src/alpha/extensions.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 */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n NavItemBlueprint,\n PageBlueprint,\n ApiBlueprint,\n createApiFactory,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../routes';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport { FormFieldBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from '../api';\n\nexport const scaffolderPage = PageBlueprint.makeWithOverrides({\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(i =>\n i.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n return originalFactory({\n routeRef: convertLegacyRouteRef(rootRouteRef),\n defaultPath: '/create',\n loader: () =>\n import('../components/Router/Router').then(m =>\n compatWrapper(\n <m.InternalRouter formFieldLoaders={formFieldLoaders} />,\n ),\n ),\n });\n },\n});\n\nexport const scaffolderNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Create...',\n icon: CreateComponentIcon,\n },\n});\n\nexport const repoUrlPickerFormField = FormFieldBlueprint.make({\n name: 'repo-url-picker',\n params: {\n field: () => import('./fields/RepoUrlPicker').then(m => m.RepoUrlPicker),\n },\n});\n\nexport const scaffolderApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>\n new ScaffolderClient({\n discoveryApi,\n scmIntegrationsApi,\n fetchApi,\n identityApi,\n }),\n }),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAqCa,MAAA,cAAA,GAAiB,cAAc,iBAAkB,CAAA;AAAA,EAC5D,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AACA,IAA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.esm.js","sources":["../../src/alpha/extensions.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 */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n NavItemBlueprint,\n PageBlueprint,\n ApiBlueprint,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../routes';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport { FormFieldBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from '../api';\n\nexport const scaffolderPage = PageBlueprint.makeWithOverrides({\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(i =>\n i.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n return originalFactory({\n routeRef: convertLegacyRouteRef(rootRouteRef),\n path: '/create',\n loader: () =>\n import('../components/Router/Router').then(m =>\n compatWrapper(\n <m.InternalRouter formFieldLoaders={formFieldLoaders} />,\n ),\n ),\n });\n },\n});\n\nexport const scaffolderNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Create...',\n icon: CreateComponentIcon,\n },\n});\n\nexport const repoUrlPickerFormField = FormFieldBlueprint.make({\n name: 'repo-url-picker',\n params: {\n field: () => import('./fields/RepoUrlPicker').then(m => m.RepoUrlPicker),\n },\n});\n\nexport const scaffolderApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>\n new ScaffolderClient({\n discoveryApi,\n scmIntegrationsApi,\n fetchApi,\n identityApi,\n }),\n }),\n});\n"],"names":[],"mappings":";;;;;;;;;;AAoCa,MAAA,cAAA,GAAiB,cAAc,iBAAkB,CAAA;AAAA,EAC5D,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AACA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,MAC5C,IAAM,EAAA,SAAA;AAAA,MACN,MAAQ,EAAA,MACN,OAAO,oCAA6B,CAAE,CAAA,IAAA;AAAA,QAAK,CACzC,CAAA,KAAA,aAAA;AAAA,0BACG,GAAA,CAAA,CAAA,CAAE,cAAF,EAAA,EAAiB,gBAAoC,EAAA;AAAA;AACxD;AACF,KACH,CAAA;AAAA;AAEL,CAAC;AAEY,MAAA,iBAAA,GAAoB,iBAAiB,IAAK,CAAA;AAAA,EACrD,MAAQ,EAAA;AAAA,IACN,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,KAAO,EAAA,WAAA;AAAA,IACP,IAAM,EAAA;AAAA;AAEV,CAAC;AAEY,MAAA,sBAAA,GAAyB,mBAAmB,IAAK,CAAA;AAAA,EAC5D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAA,EAAO,MAAM,OAAO,+BAAwB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAE3E,CAAC;AAEY,MAAA,aAAA,GAAgB,aAAa,IAAK,CAAA;AAAA,EAC7C,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA,IACX,GAAK,EAAA,gBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,kBAAoB,EAAA,qBAAA;AAAA,MACpB,QAAU,EAAA,WAAA;AAAA,MACV,WAAa,EAAA;AAAA,KACf;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,oBAAoB,QAAU,EAAA,WAAA,EACtD,KAAA,IAAI,gBAAiB,CAAA;AAAA,MACnB,YAAA;AAAA,MACA,kBAAA;AAAA,MACA,QAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -276,7 +276,7 @@ declare class DefaultScaffolderFormDecoratorsApi implements ScaffolderFormDecora
276
276
  declare const formDecoratorsApi: _backstage_frontend_plugin_api.ExtensionDefinition<{
277
277
  config: {};
278
278
  configInput: {};
279
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
279
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
280
280
  inputs: {
281
281
  formDecorators: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<ScaffolderFormDecorator, "scaffolder.form-decorator-loader", {}>, {
282
282
  singleton: false;
@@ -285,34 +285,9 @@ declare const formDecoratorsApi: _backstage_frontend_plugin_api.ExtensionDefinit
285
285
  };
286
286
  kind: "api";
287
287
  name: "form-decorators";
288
- params: {
289
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
290
- };
288
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
291
289
  }>;
292
290
 
293
- /*
294
- * Copyright 2024 The Backstage Authors
295
- *
296
- * Licensed under the Apache License, Version 2.0 (the "License");
297
- * you may not use this file except in compliance with the License.
298
- * You may obtain a copy of the License at
299
- *
300
- * http://www.apache.org/licenses/LICENSE-2.0
301
- *
302
- * Unless required by applicable law or agreed to in writing, software
303
- * distributed under the License is distributed on an "AS IS" BASIS,
304
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
305
- * See the License for the specific language governing permissions and
306
- * limitations under the License.
307
- */
308
-
309
-
310
-
311
- /** @alpha */
312
- interface FormField {
313
- readonly $$type: '@backstage/scaffolder/FormField';
314
- }
315
-
316
291
  /** @alpha */
317
292
  declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
318
293
  root: _backstage_frontend_plugin_api.RouteRef<undefined>;
@@ -335,16 +310,14 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
335
310
  name: undefined;
336
311
  config: {};
337
312
  configInput: {};
338
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
313
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
339
314
  inputs: {};
340
- params: {
341
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
342
- };
315
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
343
316
  }>;
344
317
  "api:scaffolder/form-decorators": _backstage_frontend_plugin_api.ExtensionDefinition<{
345
318
  config: {};
346
319
  configInput: {};
347
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
320
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
348
321
  inputs: {
349
322
  formDecorators: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_plugin_scaffolder_react_alpha.ScaffolderFormDecorator, "scaffolder.form-decorator-loader", {}>, {
350
323
  singleton: false;
@@ -353,25 +326,21 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
353
326
  };
354
327
  kind: "api";
355
328
  name: "form-decorators";
356
- params: {
357
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
358
- };
329
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
359
330
  }>;
360
331
  "api:scaffolder/form-fields": _backstage_frontend_plugin_api.ExtensionDefinition<{
361
332
  config: {};
362
333
  configInput: {};
363
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
334
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
364
335
  inputs: {
365
- formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>, {
336
+ formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>, "scaffolder.form-field-loader", {}>, {
366
337
  singleton: false;
367
338
  optional: false;
368
339
  }>;
369
340
  };
370
341
  kind: "api";
371
342
  name: "form-fields";
372
- params: {
373
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
374
- };
343
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
375
344
  }>;
376
345
  "entity-icon-link:scaffolder/launch-template": _backstage_frontend_plugin_api.ExtensionDefinition<{
377
346
  kind: "entity-icon-link";
@@ -386,11 +355,11 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
386
355
  label?: string | undefined;
387
356
  title?: string | undefined;
388
357
  };
389
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
358
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
390
359
  optional: true;
391
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
360
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
392
361
  optional: true;
393
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => _backstage_core_components.IconLinkVerticalProps, "entity-icon-link-props", {}>;
362
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<() => _backstage_core_components.IconLinkVerticalProps, "entity-icon-link-props", {}>;
394
363
  inputs: {};
395
364
  params: {
396
365
  useProps: () => Omit<_backstage_core_components.IconLinkVerticalProps, "color">;
@@ -402,7 +371,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
402
371
  name: undefined;
403
372
  config: {};
404
373
  configInput: {};
405
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
374
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<{
406
375
  title: string;
407
376
  icon: _backstage_core_plugin_api.IconComponent;
408
377
  routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
@@ -421,11 +390,11 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
421
390
  configInput: {
422
391
  path?: string | undefined;
423
392
  };
424
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
393
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
425
394
  optional: true;
426
395
  }>;
427
396
  inputs: {
428
- formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>, {
397
+ formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>, "scaffolder.form-field-loader", {}>, {
429
398
  singleton: false;
430
399
  optional: false;
431
400
  }>;
@@ -433,7 +402,8 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
433
402
  kind: "page";
434
403
  name: undefined;
435
404
  params: {
436
- defaultPath: string;
405
+ defaultPath?: [Error: `Use the 'path' param instead`];
406
+ path: string;
437
407
  loader: () => Promise<JSX.Element>;
438
408
  routeRef?: _backstage_frontend_plugin_api.RouteRef;
439
409
  };
@@ -443,10 +413,10 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
443
413
  name: "repo-url-picker";
444
414
  config: {};
445
415
  configInput: {};
446
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
416
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<() => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>, "scaffolder.form-field-loader", {}>;
447
417
  inputs: {};
448
418
  params: {
449
- field: () => Promise<FormField>;
419
+ field: () => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>;
450
420
  };
451
421
  }>;
452
422
  }>;
package/dist/api.esm.js CHANGED
@@ -1,272 +1,6 @@
1
- import { parseEntityRef } from '@backstage/catalog-model';
2
- import { ResponseError } from '@backstage/errors';
3
- import { fetchEventSource } from '@microsoft/fetch-event-source';
4
- import qs from 'qs';
5
- import ObservableImpl from 'zen-observable';
1
+ import { ScaffolderClient as ScaffolderClient$1 } from '@backstage/plugin-scaffolder-common';
6
2
 
7
- class ScaffolderClient {
8
- discoveryApi;
9
- scmIntegrationsApi;
10
- fetchApi;
11
- identityApi;
12
- useLongPollingLogs;
13
- constructor(options) {
14
- this.discoveryApi = options.discoveryApi;
15
- this.fetchApi = options.fetchApi ?? { fetch };
16
- this.scmIntegrationsApi = options.scmIntegrationsApi;
17
- this.useLongPollingLogs = options.useLongPollingLogs ?? false;
18
- this.identityApi = options.identityApi;
19
- }
20
- async listTasks(options) {
21
- if (!this.identityApi) {
22
- throw new Error(
23
- "IdentityApi is not available in the ScaffolderClient, please pass through the IdentityApi to the ScaffolderClient constructor in order to use the listTasks method"
24
- );
25
- }
26
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
27
- const { userEntityRef } = await this.identityApi.getBackstageIdentity();
28
- const query = qs.stringify({
29
- createdBy: options.filterByOwnership === "owned" ? userEntityRef : void 0,
30
- limit: options.limit,
31
- offset: options.offset
32
- });
33
- const response = await this.fetchApi.fetch(`${baseUrl}/v2/tasks?${query}`);
34
- if (!response.ok) {
35
- throw await ResponseError.fromResponse(response);
36
- }
37
- return await response.json();
38
- }
39
- async getIntegrationsList(options) {
40
- const integrations = [
41
- ...this.scmIntegrationsApi.azure.list(),
42
- ...this.scmIntegrationsApi.bitbucket.list().filter(
43
- (item) => !this.scmIntegrationsApi.bitbucketCloud.byHost(item.config.host) && !this.scmIntegrationsApi.bitbucketServer.byHost(item.config.host)
44
- ),
45
- ...this.scmIntegrationsApi.bitbucketCloud.list(),
46
- ...this.scmIntegrationsApi.bitbucketServer.list(),
47
- ...this.scmIntegrationsApi.gerrit.list(),
48
- ...this.scmIntegrationsApi.gitea.list(),
49
- ...this.scmIntegrationsApi.github.list(),
50
- ...this.scmIntegrationsApi.gitlab.list()
51
- ].map((c) => ({ type: c.type, title: c.title, host: c.config.host })).filter((c) => options.allowedHosts.includes(c.host));
52
- return {
53
- integrations
54
- };
55
- }
56
- async getTemplateParameterSchema(templateRef) {
57
- const { namespace, kind, name } = parseEntityRef(templateRef, {
58
- defaultKind: "template"
59
- });
60
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
61
- const templatePath = [namespace, kind, name].map((s) => encodeURIComponent(s)).join("/");
62
- const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`;
63
- const response = await this.fetchApi.fetch(url);
64
- if (!response.ok) {
65
- throw await ResponseError.fromResponse(response);
66
- }
67
- const schema = await response.json();
68
- return schema;
69
- }
70
- async scaffold(options) {
71
- const { templateRef, values, secrets = {} } = options;
72
- const url = `${await this.discoveryApi.getBaseUrl("scaffolder")}/v2/tasks`;
73
- const response = await this.fetchApi.fetch(url, {
74
- method: "POST",
75
- headers: {
76
- "Content-Type": "application/json"
77
- },
78
- body: JSON.stringify({
79
- templateRef,
80
- values: { ...values },
81
- secrets
82
- })
83
- });
84
- if (response.status !== 201) {
85
- const status = `${response.status} ${response.statusText}`;
86
- const body = await response.text();
87
- throw new Error(`Backend request failed, ${status} ${body.trim()}`);
88
- }
89
- const { id } = await response.json();
90
- return { taskId: id };
91
- }
92
- async getTask(taskId) {
93
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
94
- const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`;
95
- const response = await this.fetchApi.fetch(url);
96
- if (!response.ok) {
97
- throw await ResponseError.fromResponse(response);
98
- }
99
- return await response.json();
100
- }
101
- streamLogs(options) {
102
- if (this.useLongPollingLogs) {
103
- return this.streamLogsPolling(options);
104
- }
105
- return this.streamLogsEventStream(options);
106
- }
107
- async dryRun(options) {
108
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
109
- const response = await this.fetchApi.fetch(`${baseUrl}/v2/dry-run`, {
110
- method: "POST",
111
- headers: {
112
- "Content-Type": "application/json"
113
- },
114
- body: JSON.stringify({
115
- template: options.template,
116
- values: options.values,
117
- secrets: options.secrets,
118
- directoryContents: options.directoryContents
119
- })
120
- });
121
- if (!response.ok) {
122
- throw await ResponseError.fromResponse(response);
123
- }
124
- return response.json();
125
- }
126
- streamLogsEventStream({
127
- isTaskRecoverable,
128
- taskId,
129
- after
130
- }) {
131
- return new ObservableImpl((subscriber) => {
132
- const params = new URLSearchParams();
133
- if (after !== void 0) {
134
- params.set("after", String(Number(after)));
135
- }
136
- this.discoveryApi.getBaseUrl("scaffolder").then(
137
- (baseUrl) => {
138
- const url = `${baseUrl}/v2/tasks/${encodeURIComponent(
139
- taskId
140
- )}/eventstream`;
141
- const processEvent = (event) => {
142
- if (event.data) {
143
- try {
144
- subscriber.next(JSON.parse(event.data));
145
- } catch (ex) {
146
- subscriber.error(ex);
147
- }
148
- }
149
- };
150
- const ctrl = new AbortController();
151
- void fetchEventSource(url, {
152
- fetch: this.fetchApi.fetch,
153
- signal: ctrl.signal,
154
- onmessage(e) {
155
- if (e.event === "log") {
156
- processEvent(e);
157
- return;
158
- } else if (e.event === "completion" && !isTaskRecoverable) {
159
- processEvent(e);
160
- subscriber.complete();
161
- ctrl.abort();
162
- return;
163
- }
164
- processEvent(e);
165
- },
166
- onerror(err) {
167
- subscriber.error(err);
168
- }
169
- });
170
- },
171
- (error) => {
172
- subscriber.error(error);
173
- }
174
- );
175
- });
176
- }
177
- streamLogsPolling({
178
- taskId,
179
- after: inputAfter
180
- }) {
181
- let after = inputAfter;
182
- return new ObservableImpl((subscriber) => {
183
- this.discoveryApi.getBaseUrl("scaffolder").then(async (baseUrl) => {
184
- while (!subscriber.closed) {
185
- const url = `${baseUrl}/v2/tasks/${encodeURIComponent(
186
- taskId
187
- )}/events?${qs.stringify({ after })}`;
188
- const response = await this.fetchApi.fetch(url);
189
- if (!response.ok) {
190
- await new Promise((resolve) => setTimeout(resolve, 1e3));
191
- continue;
192
- }
193
- const logs = await response.json();
194
- for (const event of logs) {
195
- after = Number(event.id);
196
- subscriber.next(event);
197
- if (event.type === "completion") {
198
- subscriber.complete();
199
- return;
200
- }
201
- }
202
- }
203
- });
204
- });
205
- }
206
- async listActions() {
207
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
208
- const response = await this.fetchApi.fetch(`${baseUrl}/v2/actions`);
209
- if (!response.ok) {
210
- throw await ResponseError.fromResponse(response);
211
- }
212
- return await response.json();
213
- }
214
- async listTemplatingExtensions() {
215
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
216
- const response = await this.fetchApi.fetch(
217
- `${baseUrl}/v2/templating-extensions`
218
- );
219
- if (!response.ok) {
220
- throw ResponseError.fromResponse(response);
221
- }
222
- return response.json();
223
- }
224
- async cancelTask(taskId) {
225
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
226
- const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/cancel`;
227
- const response = await this.fetchApi.fetch(url, {
228
- method: "POST"
229
- });
230
- if (!response.ok) {
231
- throw await ResponseError.fromResponse(response);
232
- }
233
- return await response.json();
234
- }
235
- async retry(taskId) {
236
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
237
- const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/retry`;
238
- const response = await this.fetchApi.fetch(url, {
239
- method: "POST"
240
- });
241
- if (!response.ok) {
242
- throw await ResponseError.fromResponse(response);
243
- }
244
- return await response.json();
245
- }
246
- async autocomplete({
247
- token,
248
- resource,
249
- provider,
250
- context
251
- }) {
252
- const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
253
- const url = `${baseUrl}/v2/autocomplete/${provider}/${resource}`;
254
- const response = await this.fetchApi.fetch(url, {
255
- method: "POST",
256
- headers: {
257
- "Content-Type": "application/json"
258
- },
259
- body: JSON.stringify({
260
- token,
261
- context: context ?? {}
262
- })
263
- });
264
- if (!response.ok) {
265
- throw await ResponseError.fromResponse(response);
266
- }
267
- const { results } = await response.json();
268
- return { results };
269
- }
3
+ class ScaffolderClient extends ScaffolderClient$1 {
270
4
  }
271
5
 
272
6
  export { ScaffolderClient };