@backstage/plugin-scaffolder 1.26.3-next.1 → 1.27.0-next.3

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 (100) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/alpha/api/FormFieldsApi.esm.js.map +1 -1
  3. package/dist/alpha/api/ref.esm.js.map +1 -1
  4. package/dist/alpha/api.esm.js.map +1 -1
  5. package/dist/alpha/components/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
  6. package/dist/alpha/components/TemplateEditorPage/CustomFieldPlaygroud.esm.js.map +1 -1
  7. package/dist/alpha/components/TemplateEditorPage/CustomFieldsPage.esm.js.map +1 -1
  8. package/dist/alpha/components/TemplateEditorPage/DirectoryEditorContext.esm.js.map +1 -1
  9. package/dist/alpha/components/TemplateEditorPage/DryRunContext.esm.js.map +1 -1
  10. package/dist/alpha/components/TemplateEditorPage/DryRunResults/DryRunResults.esm.js.map +1 -1
  11. package/dist/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js.map +1 -1
  12. package/dist/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsSplitView.esm.js.map +1 -1
  13. package/dist/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js.map +1 -1
  14. package/dist/alpha/components/TemplateEditorPage/DryRunResults/IconLink.esm.js.map +1 -1
  15. package/dist/alpha/components/TemplateEditorPage/DryRunResults/TaskPageLinks.esm.js.map +1 -1
  16. package/dist/alpha/components/TemplateEditorPage/DryRunResults/TaskStatusStepper.esm.js.map +1 -1
  17. package/dist/alpha/components/TemplateEditorPage/TemplateEditor.esm.js.map +1 -1
  18. package/dist/alpha/components/TemplateEditorPage/TemplateEditorBrowser.esm.js.map +1 -1
  19. package/dist/alpha/components/TemplateEditorPage/TemplateEditorForm.esm.js.map +1 -1
  20. package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
  21. package/dist/alpha/components/TemplateEditorPage/TemplateEditorLayout.esm.js.map +1 -1
  22. package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
  23. package/dist/alpha/components/TemplateEditorPage/TemplateEditorTextArea.esm.js.map +1 -1
  24. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbar.esm.js.map +1 -1
  25. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarFileMenu.esm.js.map +1 -1
  26. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarTemplatesMenu.esm.js.map +1 -1
  27. package/dist/alpha/components/TemplateEditorPage/TemplateFormPage.esm.js.map +1 -1
  28. package/dist/alpha/components/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
  29. package/dist/alpha/components/TemplateEditorPage/TemplateIntroPage.esm.js.map +1 -1
  30. package/dist/alpha/components/TemplateEditorPage/useTemplateDirectory.esm.js.map +1 -1
  31. package/dist/alpha/components/TemplateListPage/RegisterExistingButton.esm.js.map +1 -1
  32. package/dist/alpha/components/TemplateListPage/TemplateListPage.esm.js.map +1 -1
  33. package/dist/alpha/components/TemplateWizardPage/TemplateWizardPage.esm.js.map +1 -1
  34. package/dist/alpha/components/TemplateWizardPage/TemplateWizardPageContextMenu.esm.js.map +1 -1
  35. package/dist/alpha/extensions.esm.js.map +1 -1
  36. package/dist/alpha/fields/RepoUrlPicker.esm.js.map +1 -1
  37. package/dist/alpha/plugin.esm.js.map +1 -1
  38. package/dist/api.esm.js.map +1 -1
  39. package/dist/components/ActionsPage/ActionsPage.esm.js +4 -4
  40. package/dist/components/ActionsPage/ActionsPage.esm.js.map +1 -1
  41. package/dist/components/FileBrowser/FileBrowser.esm.js.map +1 -1
  42. package/dist/components/ListTasksPage/ListTasksPage.esm.js +3 -3
  43. package/dist/components/ListTasksPage/ListTasksPage.esm.js.map +1 -1
  44. package/dist/components/ListTasksPage/OwnerListPicker.esm.js.map +1 -1
  45. package/dist/components/ListTasksPage/columns/CreatedAtColumn.esm.js.map +1 -1
  46. package/dist/components/ListTasksPage/columns/OwnerEntityColumn.esm.js.map +1 -1
  47. package/dist/components/ListTasksPage/columns/TaskStatusColumn.esm.js.map +1 -1
  48. package/dist/components/ListTasksPage/columns/TemplateTitleColumn.esm.js.map +1 -1
  49. package/dist/components/OngoingTask/ContextMenu.esm.js.map +1 -1
  50. package/dist/components/OngoingTask/OngoingTask.esm.js.map +1 -1
  51. package/dist/components/Router/Router.esm.js +15 -9
  52. package/dist/components/Router/Router.esm.js.map +1 -1
  53. package/dist/components/TemplateTypePicker/TemplateTypePicker.esm.js.map +1 -1
  54. package/dist/components/fields/EntityNamePicker/EntityNamePicker.esm.js.map +1 -1
  55. package/dist/components/fields/EntityNamePicker/schema.esm.js.map +1 -1
  56. package/dist/components/fields/EntityNamePicker/validation.esm.js.map +1 -1
  57. package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
  58. package/dist/components/fields/EntityPicker/schema.esm.js.map +1 -1
  59. package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js.map +1 -1
  60. package/dist/components/fields/EntityTagsPicker/schema.esm.js.map +1 -1
  61. package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js.map +1 -1
  62. package/dist/components/fields/MultiEntityPicker/schema.esm.js.map +1 -1
  63. package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js.map +1 -1
  64. package/dist/components/fields/MyGroupsPicker/schema.esm.js.map +1 -1
  65. package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js.map +1 -1
  66. package/dist/components/fields/OwnedEntityPicker/schema.esm.js.map +1 -1
  67. package/dist/components/fields/OwnerPicker/OwnerPicker.esm.js.map +1 -1
  68. package/dist/components/fields/OwnerPicker/schema.esm.js.map +1 -1
  69. package/dist/components/fields/RepoBranchPicker/BitbucketRepoBranchPicker.esm.js.map +1 -1
  70. package/dist/components/fields/RepoBranchPicker/DefaultRepoBranchPicker.esm.js.map +1 -1
  71. package/dist/components/fields/RepoBranchPicker/RepoBranchPicker.esm.js.map +1 -1
  72. package/dist/components/fields/RepoBranchPicker/schema.esm.js.map +1 -1
  73. package/dist/components/fields/RepoUrlPicker/AzureRepoPicker.esm.js.map +1 -1
  74. package/dist/components/fields/RepoUrlPicker/BitbucketRepoPicker.esm.js.map +1 -1
  75. package/dist/components/fields/RepoUrlPicker/GerritRepoPicker.esm.js.map +1 -1
  76. package/dist/components/fields/RepoUrlPicker/GiteaRepoPicker.esm.js.map +1 -1
  77. package/dist/components/fields/RepoUrlPicker/GithubRepoPicker.esm.js.map +1 -1
  78. package/dist/components/fields/RepoUrlPicker/GitlabRepoPicker.esm.js.map +1 -1
  79. package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js.map +1 -1
  80. package/dist/components/fields/RepoUrlPicker/RepoUrlPickerHost.esm.js.map +1 -1
  81. package/dist/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.esm.js.map +1 -1
  82. package/dist/components/fields/RepoUrlPicker/schema.esm.js.map +1 -1
  83. package/dist/components/fields/RepoUrlPicker/utils.esm.js.map +1 -1
  84. package/dist/components/fields/RepoUrlPicker/validation.esm.js.map +1 -1
  85. package/dist/components/fields/SecretInput/SecretInput.esm.js.map +1 -1
  86. package/dist/components/fields/VirtualizedListbox.esm.js.map +1 -1
  87. package/dist/components/fields/utils.esm.js.map +1 -1
  88. package/dist/deprecated.esm.js.map +1 -1
  89. package/dist/extensions/default.esm.js.map +1 -1
  90. package/dist/index.d.ts +2 -0
  91. package/dist/lib/download/helpers.esm.js.map +1 -1
  92. package/dist/lib/filesystem/WebFileSystemAccess.esm.js.map +1 -1
  93. package/dist/lib/filesystem/WebFileSystemStore.esm.js.map +1 -1
  94. package/dist/lib/filesystem/createExampleTemplate.esm.js.map +1 -1
  95. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  96. package/dist/plugin.esm.js.map +1 -1
  97. package/dist/routes.esm.js.map +1 -1
  98. package/dist/translation.esm.js.map +1 -1
  99. package/package.json +23 -14
  100. package/alpha/package.json +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"RepoUrlPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPicker.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 */\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport React, { useEffect, useState, useMemo, useCallback } from 'react';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { RepoUrlPickerFieldSchema } from './schema';\nimport { RepoUrlPickerState } from './types';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\n\nexport { RepoUrlPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `RepoUrlPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoUrlPicker = (\n props: typeof RepoUrlPickerFieldSchema.TProps,\n) => {\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\n );\n const [credentialsHost, setCredentialsHost] = useState<string | undefined>(\n undefined,\n );\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n const { secrets, setSecrets } = useTemplateSecrets();\n const allowedHosts = useMemo(\n () => uiSchema?.['ui:options']?.allowedHosts ?? [],\n [uiSchema],\n );\n const allowedOrganizations = useMemo(\n () => uiSchema?.['ui:options']?.allowedOrganizations ?? [],\n [uiSchema],\n );\n const allowedOwners = useMemo(\n () => uiSchema?.['ui:options']?.allowedOwners ?? [],\n [uiSchema],\n );\n const allowedProjects = useMemo(\n () => uiSchema?.['ui:options']?.allowedProjects ?? [],\n [uiSchema],\n );\n const allowedRepos = useMemo(\n () => uiSchema?.['ui:options']?.allowedRepos ?? [],\n [uiSchema],\n );\n\n const { owner, organization, project, repoName } = state;\n\n useEffect(() => {\n onChange(serializeRepoPickerUrl(state));\n }, [state, onChange]);\n\n /* we deal with calling the repo setting here instead of in each components for ease */\n useEffect(() => {\n if (allowedOrganizations.length > 0 && !organization) {\n setState(prevState => ({\n ...prevState,\n organization: allowedOrganizations[0],\n }));\n }\n }, [setState, allowedOrganizations, organization]);\n\n useEffect(() => {\n if (allowedOwners.length > 0 && !owner) {\n setState(prevState => ({\n ...prevState,\n owner: allowedOwners[0],\n }));\n }\n }, [setState, allowedOwners, owner]);\n\n useEffect(() => {\n if (allowedProjects.length > 0 && !project) {\n setState(prevState => ({\n ...prevState,\n project: allowedProjects[0],\n }));\n }\n }, [setState, allowedProjects, project]);\n\n useEffect(() => {\n if (allowedRepos.length > 0 && !repoName) {\n setState(prevState => ({ ...prevState, repoName: allowedRepos[0] }));\n }\n }, [setState, allowedRepos, repoName]);\n\n const updateLocalState = useCallback(\n (newState: RepoUrlPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !state.host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state for selected host\n if (\n secrets[requestUserCredentials.secretsKey] &&\n credentialsHost === state.host\n ) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${state.host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n setCredentialsHost(state.host);\n },\n 500,\n [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {schema.description && (\n <Typography variant=\"body1\">{schema.description}</Typography>\n )}\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({ ...prevState, repoName: repo }))\n }\n rawErrors={rawErrors}\n availableRepos={state.availableRepos}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA8Ca,MAAA,aAAA,GAAgB,CAC3B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,QAAU,EAAA,QAAA,EAAU,SAAW,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA,CAAA;AAC5D,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA;AAAA,IACxB,mBAAmB,QAAQ,CAAA;AAAA,GAC7B,CAAA;AACA,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,KAAA,CAAA;AAAA,GACF,CAAA;AACA,EAAM,MAAA,cAAA,GAAiB,OAAO,qBAAqB,CAAA,CAAA;AACnD,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACnD,EAAA,MAAM,YAAe,GAAA,OAAA;AAAA,IACnB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,gBAAgB,EAAC;AAAA,IACjD,CAAC,QAAQ,CAAA;AAAA,GACX,CAAA;AACA,EAAA,MAAM,oBAAuB,GAAA,OAAA;AAAA,IAC3B,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,wBAAwB,EAAC;AA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,QAAU,EAAA,gBAAA;AAAA,KAAA;AAAA,GACZ,EAED,aAAa,QACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAU,EAAA,gBAAA;AAAA,KAAA;AAAA,GAGd,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,UAAU,KAAM,CAAA,QAAA;AAAA,MAChB,YAAA;AAAA,MACA,QAAA,EAAU,UACR,QAAS,CAAA,CAAA,SAAA,MAAc,EAAE,GAAG,SAAA,EAAW,QAAU,EAAA,IAAA,EAAO,CAAA,CAAA;AAAA,MAE1D,SAAA;AAAA,MACA,gBAAgB,KAAM,CAAA,cAAA;AAAA,KAAA;AAAA,GAE1B,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RepoUrlPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPicker.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 */\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport React, { useEffect, useState, useMemo, useCallback } from 'react';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { RepoUrlPickerFieldSchema } from './schema';\nimport { RepoUrlPickerState } from './types';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\n\nexport { RepoUrlPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `RepoUrlPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoUrlPicker = (\n props: typeof RepoUrlPickerFieldSchema.TProps,\n) => {\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\n );\n const [credentialsHost, setCredentialsHost] = useState<string | undefined>(\n undefined,\n );\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n const { secrets, setSecrets } = useTemplateSecrets();\n const allowedHosts = useMemo(\n () => uiSchema?.['ui:options']?.allowedHosts ?? [],\n [uiSchema],\n );\n const allowedOrganizations = useMemo(\n () => uiSchema?.['ui:options']?.allowedOrganizations ?? [],\n [uiSchema],\n );\n const allowedOwners = useMemo(\n () => uiSchema?.['ui:options']?.allowedOwners ?? [],\n [uiSchema],\n );\n const allowedProjects = useMemo(\n () => uiSchema?.['ui:options']?.allowedProjects ?? [],\n [uiSchema],\n );\n const allowedRepos = useMemo(\n () => uiSchema?.['ui:options']?.allowedRepos ?? [],\n [uiSchema],\n );\n\n const { owner, organization, project, repoName } = state;\n\n useEffect(() => {\n onChange(serializeRepoPickerUrl(state));\n }, [state, onChange]);\n\n /* we deal with calling the repo setting here instead of in each components for ease */\n useEffect(() => {\n if (allowedOrganizations.length > 0 && !organization) {\n setState(prevState => ({\n ...prevState,\n organization: allowedOrganizations[0],\n }));\n }\n }, [setState, allowedOrganizations, organization]);\n\n useEffect(() => {\n if (allowedOwners.length > 0 && !owner) {\n setState(prevState => ({\n ...prevState,\n owner: allowedOwners[0],\n }));\n }\n }, [setState, allowedOwners, owner]);\n\n useEffect(() => {\n if (allowedProjects.length > 0 && !project) {\n setState(prevState => ({\n ...prevState,\n project: allowedProjects[0],\n }));\n }\n }, [setState, allowedProjects, project]);\n\n useEffect(() => {\n if (allowedRepos.length > 0 && !repoName) {\n setState(prevState => ({ ...prevState, repoName: allowedRepos[0] }));\n }\n }, [setState, allowedRepos, repoName]);\n\n const updateLocalState = useCallback(\n (newState: RepoUrlPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !state.host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state for selected host\n if (\n secrets[requestUserCredentials.secretsKey] &&\n credentialsHost === state.host\n ) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${state.host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n setCredentialsHost(state.host);\n },\n 500,\n [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {schema.description && (\n <Typography variant=\"body1\">{schema.description}</Typography>\n )}\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({ ...prevState, repoName: repo }))\n }\n rawErrors={rawErrors}\n availableRepos={state.availableRepos}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA8Ca,MAAA,aAAA,GAAgB,CAC3B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,QAAU,EAAA,QAAA,EAAU,SAAW,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA;AAC5D,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA;AAAA,IACxB,mBAAmB,QAAQ;AAAA,GAC7B;AACA,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA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aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,oBAAA;AAAA,MACA,cAAgB,EAAA,eAAA;AAAA,MAChB,SAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAU,EAAA;AAAA;AAAA,GACZ,EAED,aAAa,QACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAU,EAAA;AAAA;AAAA,GAGd,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,UAAU,KAAM,CAAA,QAAA;AAAA,MAChB,YAAA;AAAA,MACA,QAAA,EAAU,UACR,QAAS,CAAA,CAAA,SAAA,MAAc,EAAE,GAAG,SAAA,EAAW,QAAU,EAAA,IAAA,EAAO,CAAA,CAAA;AAAA,MAE1D,SAAA;AAAA,MACA,gBAAgB,KAAM,CAAA;AAAA;AAAA,GAE1B,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RepoUrlPickerHost.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerHost.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 */\nimport React, { useEffect } from 'react';\nimport { Progress, Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const RepoUrlPickerHost = (props: {\n host?: string;\n hosts?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n}) => {\n const { host, hosts, onChange, rawErrors } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const scaffolderApi = useApi(scaffolderApiRef);\n\n const { value: { integrations } = { integrations: [] }, loading } = useAsync(\n async () => {\n return await scaffolderApi.getIntegrationsList({\n allowedHosts: hosts ?? [],\n });\n },\n );\n\n useEffect(() => {\n // If there is no host chosen currently\n if (!host) {\n // Set the first of the allowedHosts option if that available\n if (hosts?.length) {\n onChange(hosts[0]);\n // if there's no hosts provided, fallback to using the first integration\n } else if (integrations?.length) {\n onChange(integrations[0].host);\n }\n }\n }, [hosts, host, onChange, integrations]);\n\n // If there are no allowedHosts provided, then show all integrations. Otherwise, only show integrations\n // that are provided in the dropdown for the user to choose from.\n const hostsOptions: SelectItem[] = integrations\n ? integrations\n .filter(i => (hosts?.length ? hosts?.includes(i.host) : true))\n .map(i => ({ label: i.title, value: i.host }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !host}\n >\n <Select\n native\n disabled={hosts?.length === 1}\n label={t('fields.repoUrlPicker.host.title')}\n onChange={s => onChange(String(Array.isArray(s) ? s[0] : s))}\n selected={host}\n items={hostsOptions}\n data-testid=\"host-select\"\n />\n\n <FormHelperText>\n {t('fields.repoUrlPicker.host.description')}\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBa,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC7C,EAAA,MAAM,EAAE,CAAA,EAAM,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EI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,IAAA;AAAA,KAAA;AAAA,oBAEjC,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,QAAA,EAAU,OAAO,MAAW,KAAA,CAAA;AAAA,QAC5B,KAAA,EAAO,EAAE,iCAAiC,CAAA;AAAA,QAC1C,QAAU,EAAA,CAAA,CAAA,KAAK,QAAS,CAAA,MAAA,CAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA,GAAI,CAAE,CAAA,CAAC,CAAI,GAAA,CAAC,CAAC,CAAA;AAAA,QAC3D,QAAU,EAAA,IAAA;AAAA,QACV,KAAO,EAAA,YAAA;AAAA,QACP,aAAY,EAAA,aAAA;AAAA,OAAA;AAAA,KACd;AAAA,oBAEC,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EACE,CAAE,CAAA,uCAAuC,CAC5C,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RepoUrlPickerHost.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerHost.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 */\nimport React, { useEffect } from 'react';\nimport { Progress, Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const RepoUrlPickerHost = (props: {\n host?: string;\n hosts?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n}) => {\n const { host, hosts, onChange, rawErrors } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const scaffolderApi = useApi(scaffolderApiRef);\n\n const { value: { integrations } = { integrations: [] }, loading } = useAsync(\n async () => {\n return await scaffolderApi.getIntegrationsList({\n allowedHosts: hosts ?? [],\n });\n },\n );\n\n useEffect(() => {\n // If there is no host chosen currently\n if (!host) {\n // Set the first of the allowedHosts option if that available\n if (hosts?.length) {\n onChange(hosts[0]);\n // if there's no hosts provided, fallback to using the first integration\n } else if (integrations?.length) {\n onChange(integrations[0].host);\n }\n }\n }, [hosts, host, onChange, integrations]);\n\n // If there are no allowedHosts provided, then show all integrations. Otherwise, only show integrations\n // that are provided in the dropdown for the user to choose from.\n const hostsOptions: SelectItem[] = integrations\n ? integrations\n .filter(i => (hosts?.length ? hosts?.includes(i.host) : true))\n .map(i => ({ label: i.title, value: i.host }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !host}\n >\n <Select\n native\n disabled={hosts?.length === 1}\n label={t('fields.repoUrlPicker.host.title')}\n onChange={s => onChange(String(Array.isArray(s) ? s[0] : s))}\n selected={host}\n items={hostsOptions}\n data-testid=\"host-select\"\n />\n\n <FormHelperText>\n {t('fields.repoUrlPicker.host.description')}\n </FormHelperText>\n </FormControl>\n </>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EAAO,WAAW,CAAA;AAE9C,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA;AAGnB,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC;AAAA,KAAA;AAAA,oBAEjC,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,QAAA,EAAU,OAAO,MAAW,KAAA,CAAA;AAAA,QAC5B,KAAA,EAAO,EAAE,iCAAiC,CAAA;AAAA,QAC1C,QAAU,EAAA,CAAA,CAAA,KAAK,QAAS,CAAA,MAAA,CAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA,GAAI,CAAE,CAAA,CAAC,CAAI,GAAA,CAAC,CAAC,CAAA;AAAA,QAC3D,QAAU,EAAA,IAAA;AAAA,QACV,KAAO,EAAA,YAAA;AAAA,QACP,aAAY,EAAA;AAAA;AAAA,KACd;AAAA,oBAEC,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EACE,CAAE,CAAA,uCAAuC,CAC5C;AAAA,GAEJ,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RepoUrlPickerRepoName.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.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 */\nimport React, { useEffect } from 'react';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport TextField from '@material-ui/core/TextField';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const RepoUrlPickerRepoName = (props: {\n repoName?: string;\n allowedRepos?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n availableRepos?: string[];\n}) => {\n const { repoName, allowedRepos, onChange, rawErrors, availableRepos } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n useEffect(() => {\n // If there is no repoName chosen currently\n if (!repoName) {\n // Set the first of the allowedRepos option if that available\n if (allowedRepos?.length) {\n onChange(allowedRepos[0]);\n }\n }\n }, [allowedRepos, repoName, onChange]);\n\n const repoItems: SelectItem[] = allowedRepos\n ? allowedRepos.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !repoName}\n >\n {allowedRepos?.length ? (\n <Select\n native\n label={t('fields.repoUrlPicker.repository.title')}\n onChange={selected =>\n onChange(String(Array.isArray(selected) ? selected[0] : selected))\n }\n disabled={allowedRepos.length === 1}\n selected={repoName}\n items={repoItems}\n />\n ) : (\n <Autocomplete\n value={repoName}\n onInputChange={(_, newValue) => {\n onChange(newValue || '');\n }}\n options={availableRepos || []}\n renderInput={params => (\n <TextField\n {...params}\n label={t('fields.repoUrlPicker.repository.inputTitle')}\n required\n />\n )}\n freeSolo\n autoSelect\n />\n )}\n <FormHelperText>\n {t('fields.repoUrlPicker.repository.description')}\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"m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CAAA,CAAC,CAAI,GAAA,QAAQ,CAAC,CAAA;AAAA,QAEnE,QAAA,EAAU,aAAa,MAAW,KAAA,CAAA;AAAA,QAClC,QAAU,EAAA,QAAA;AAAA,QACV,KAAO,EAAA,SAAA;AAAA,OAAA;AAAA,KAGT,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,QAAA;AAAA,QACP,aAAA,EAAe,CAAC,CAAA,EAAG,QAAa,KAAA;AAC9B,UAAA,QAAA,CAAS,YAAY,EAAE,CAAA,CAAA;AAAA,SACzB;AAAA,QACA,OAAA,EAAS,kBAAkB,EAAC;AAAA,QAC5B,aAAa,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,SAAA;AAAA,UAAA;AAAA,YACE,GAAG,MAAA;AAAA,YACJ,KAAA,EAAO,EAAE,4CAA4C,CAAA;AAAA,YACrD,QAAQ,EAAA,IAAA;AAAA,WAAA;AAAA,SACV;AAAA,QAEF,QAAQ,EAAA,IAAA;AAAA,QACR,UAAU,EAAA,IAAA;AAAA,OAAA;AAAA,KACZ;AAAA,oBAED,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EACE,CAAE,CAAA,6CAA6C,CAClD,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RepoUrlPickerRepoName.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.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 */\nimport React, { useEffect } from 'react';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport TextField from '@material-ui/core/TextField';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const RepoUrlPickerRepoName = (props: {\n repoName?: string;\n allowedRepos?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n availableRepos?: string[];\n}) => {\n const { repoName, allowedRepos, onChange, rawErrors, availableRepos } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n useEffect(() => {\n // If there is no repoName chosen currently\n if (!repoName) {\n // Set the first of the allowedRepos option if that available\n if (allowedRepos?.length) {\n onChange(allowedRepos[0]);\n }\n }\n }, [allowedRepos, repoName, onChange]);\n\n const repoItems: SelectItem[] = allowedRepos\n ? allowedRepos.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !repoName}\n >\n {allowedRepos?.length ? (\n <Select\n native\n label={t('fields.repoUrlPicker.repository.title')}\n onChange={selected =>\n onChange(String(Array.isArray(selected) ? selected[0] : selected))\n }\n disabled={allowedRepos.length === 1}\n selected={repoName}\n items={repoItems}\n />\n ) : (\n <Autocomplete\n value={repoName}\n onInputChange={(_, newValue) => {\n onChange(newValue || '');\n }}\n options={availableRepos || []}\n renderInput={params => (\n <TextField\n {...params}\n label={t('fields.repoUrlPicker.repository.inputTitle')}\n required\n />\n )}\n freeSolo\n autoSelect\n />\n )}\n <FormHelperText>\n {t('fields.repoUrlPicker.repository.description')}\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBa,MAAA,qBAAA,GAAwB,CAAC,KAMhC,KAAA;AACJ,EAAA,MAAM,EAAE,QAAU,EAAA,YAAA,EAAc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,KAGT,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,QAAA;AAAA,QACP,aAAA,EAAe,CAAC,CAAA,EAAG,QAAa,KAAA;AAC9B,UAAA,QAAA,CAAS,YAAY,EAAE,CAAA;AAAA,SACzB;AAAA,QACA,OAAA,EAAS,kBAAkB,EAAC;AAAA,QAC5B,aAAa,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,SAAA;AAAA,UAAA;AAAA,YACE,GAAG,MAAA;AAAA,YACJ,KAAA,EAAO,EAAE,4CAA4C,CAAA;AAAA,YACrD,QAAQ,EAAA;AAAA;AAAA,SACV;AAAA,QAEF,QAAQ,EAAA,IAAA;AAAA,QACR,UAAU,EAAA;AAAA;AAAA,KACZ;AAAA,oBAED,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EACE,CAAE,CAAA,6CAA6C,CAClD;AAAA,GAEJ,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/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 */\n\nimport { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n */\nexport const RepoUrlPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n uiOptions: z =>\n z.object({\n allowedHosts: z\n .array(z.string())\n .optional()\n .describe('List of allowed SCM platform hosts'),\n allowedOrganizations: z\n .array(z.string())\n .optional()\n .describe('List of allowed organizations in the given SCM platform'),\n allowedOwners: z\n .array(z.string())\n .optional()\n .describe('List of allowed owners in the given SCM platform'),\n allowedProjects: z\n .array(z.string())\n .optional()\n .describe('List of allowed projects in the given SCM platform'),\n allowedRepos: z\n .array(z.string())\n .optional()\n .describe('List of allowed repos in the given SCM platform'),\n requestUserCredentials: z\n .object({\n secretsKey: z\n .string()\n .describe(\n 'Key used within the template secrets context to store the credential',\n ),\n additionalScopes: z\n .object({\n gitea: z\n .array(z.string())\n .optional()\n .describe('Additional Gitea scopes to request'),\n gerrit: z\n .array(z.string())\n .optional()\n .describe('Additional Gerrit scopes to request'),\n github: z\n .array(z.string())\n .optional()\n .describe('Additional GitHub scopes to request'),\n gitlab: z\n .array(z.string())\n .optional()\n .describe('Additional GitLab scopes to request'),\n bitbucket: z\n .array(z.string())\n .optional()\n .describe('Additional BitBucket scopes to request'),\n azure: z\n .array(z.string())\n .optional()\n .describe('Additional Azure scopes to request'),\n })\n .optional()\n .describe('Additional permission scopes to request'),\n })\n .optional()\n .describe(\n 'If defined will request user credentials to auth against the given SCM platform',\n ),\n }),\n});\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `RepoUrlPicker` field extension.\n *\n * @public\n * @deprecated this will be removed as it's no longer used\n */\nexport type RepoUrlPickerUiOptions =\n typeof RepoUrlPickerFieldSchema.uiOptionsType;\n\nexport type RepoUrlPickerProps = typeof RepoUrlPickerFieldSchema.type;\n\n// This has been duplicated to /plugins/scaffolder/src/components/fields/RepoBranchPicker/schema.ts\n// NOTE: There is a bug with this failing validation in the custom field explorer due\n// to https://github.com/rjsf-team/react-jsonschema-form/issues/675 even if\n// requestUserCredentials is not defined\nexport const RepoUrlPickerSchema = RepoUrlPickerFieldSchema.schema;\n"],"names":[],"mappings":";;AAqBO,MAAM,2BAA2B,eAAgB,CAAA;AAAA,EACtD,MAAA,EAAQ,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA;AAAA,EACtB,SAAA,EAAW,CACT,CAAA,KAAA,CAAA,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MAAA,EAAQ,CACL,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,SAAA,EAAW,CACR,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,wCAAwC,CAAA;AAAA,QACpD,KAAA,EAAO,CACJ,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,oCAAoC,CAAA;AAAA,OACjD,CAAA,CACA,QAAS,EAAA,CACT,SAAS,yCAAyC,CAAA;AAAA,KACtD,CACA,CAAA,QAAA,EACA,CAAA,QAAA;AAAA,MACC,iFAAA;AAAA,KACF;AAAA,GACH,CAAA;AACL,CAAC,EAAA;AAkBM,MAAM,sBAAsB,wBAAyB,CAAA;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/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 */\n\nimport { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n */\nexport const RepoUrlPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n uiOptions: z =>\n z.object({\n allowedHosts: z\n .array(z.string())\n .optional()\n .describe('List of allowed SCM platform hosts'),\n allowedOrganizations: z\n .array(z.string())\n .optional()\n .describe('List of allowed organizations in the given SCM platform'),\n allowedOwners: z\n .array(z.string())\n .optional()\n .describe('List of allowed owners in the given SCM platform'),\n allowedProjects: z\n .array(z.string())\n .optional()\n .describe('List of allowed projects in the given SCM platform'),\n allowedRepos: z\n .array(z.string())\n .optional()\n .describe('List of allowed repos in the given SCM platform'),\n requestUserCredentials: z\n .object({\n secretsKey: z\n .string()\n .describe(\n 'Key used within the template secrets context to store the credential',\n ),\n additionalScopes: z\n .object({\n gitea: z\n .array(z.string())\n .optional()\n .describe('Additional Gitea scopes to request'),\n gerrit: z\n .array(z.string())\n .optional()\n .describe('Additional Gerrit scopes to request'),\n github: z\n .array(z.string())\n .optional()\n .describe('Additional GitHub scopes to request'),\n gitlab: z\n .array(z.string())\n .optional()\n .describe('Additional GitLab scopes to request'),\n bitbucket: z\n .array(z.string())\n .optional()\n .describe('Additional BitBucket scopes to request'),\n azure: z\n .array(z.string())\n .optional()\n .describe('Additional Azure scopes to request'),\n })\n .optional()\n .describe('Additional permission scopes to request'),\n })\n .optional()\n .describe(\n 'If defined will request user credentials to auth against the given SCM platform',\n ),\n }),\n});\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `RepoUrlPicker` field extension.\n *\n * @public\n * @deprecated this will be removed as it's no longer used\n */\nexport type RepoUrlPickerUiOptions =\n typeof RepoUrlPickerFieldSchema.uiOptionsType;\n\nexport type RepoUrlPickerProps = typeof RepoUrlPickerFieldSchema.type;\n\n// This has been duplicated to /plugins/scaffolder/src/components/fields/RepoBranchPicker/schema.ts\n// NOTE: There is a bug with this failing validation in the custom field explorer due\n// to https://github.com/rjsf-team/react-jsonschema-form/issues/675 even if\n// requestUserCredentials is not defined\nexport const RepoUrlPickerSchema = RepoUrlPickerFieldSchema.schema;\n"],"names":[],"mappings":";;AAqBO,MAAM,2BAA2B,eAAgB,CAAA;AAAA,EACtD,MAAA,EAAQ,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA;AAAA,EACtB,SAAA,EAAW,CACT,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,IACP,YAAA,EAAc,CACX,CAAA,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,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,SAAA,EAAW,CACR,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,wCAAwC,CAAA;AAAA,QACpD,KAAA,EAAO,CACJ,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,oCAAoC;AAAA,OACjD,CAAA,CACA,QAAS,EAAA,CACT,SAAS,yCAAyC;AAAA,KACtD,CACA,CAAA,QAAA,EACA,CAAA,QAAA;AAAA,MACC;AAAA;AACF,GACH;AACL,CAAC;AAkBM,MAAM,sBAAsB,wBAAyB,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/utils.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RepoUrlPickerState } from './types';\n\nexport function serializeRepoPickerUrl(data: RepoUrlPickerState) {\n if (!data.host) {\n return undefined;\n }\n\n const params = new URLSearchParams();\n if (data.owner) {\n params.set('owner', data.owner);\n }\n if (data.repoName) {\n params.set('repo', data.repoName);\n }\n if (data.organization) {\n params.set('organization', data.organization);\n }\n if (data.workspace) {\n params.set('workspace', data.workspace);\n }\n if (data.project) {\n params.set('project', data.project);\n }\n\n return `${data.host}?${params.toString()}`;\n}\n\nexport function parseRepoPickerUrl(\n url: string | undefined,\n): RepoUrlPickerState {\n let host = '';\n let owner = '';\n let repoName = '';\n let organization = '';\n let workspace = '';\n let project = '';\n\n try {\n if (url) {\n const parsed = new URL(`https://${url}`);\n host = parsed.host;\n owner = parsed.searchParams.get('owner') || '';\n repoName = parsed.searchParams.get('repo') || '';\n organization = parsed.searchParams.get('organization') || '';\n workspace = parsed.searchParams.get('workspace') || '';\n project = parsed.searchParams.get('project') || '';\n }\n } catch {\n /* ok */\n }\n return { host, owner, repoName, organization, workspace, project };\n}\n"],"names":[],"mappings":"AAkBO,SAAS,uBAAuB,IAA0B,EAAA;AAC/D,EAAI,IAAA,CAAC,KAAK,IAAM,EAAA;AACd,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAM,MAAA,MAAA,GAAS,IAAI,eAAgB,EAAA,CAAA;AACnC,EAAA,IAAI,KAAK,KAAO,EAAA;AACd,IAAO,MAAA,CAAA,GAAA,CAAI,OAAS,EAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AAAA,GAChC;AACA,EAAA,IAAI,KAAK,QAAU,EAAA;AACjB,IAAO,MAAA,CAAA,GAAA,CAAI,MAAQ,EAAA,IAAA,CAAK,QAAQ,CAAA,CAAA;AAAA,GAClC;AACA,EAAA,IAAI,KAAK,YAAc,EAAA;AACrB,IAAO,MAAA,CAAA,GAAA,CAAI,cAAgB,EAAA,IAAA,CAAK,YAAY,CAAA,CAAA;AAAA,GAC9C;AACA,EAAA,IAAI,KAAK,SAAW,EAAA;AAClB,IAAO,MAAA,CAAA,GAAA,CAAI,WAAa,EAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAAA,GACxC;AACA,EAAA,IAAI,KAAK,OAAS,EAAA;AAChB,IAAO,MAAA,CAAA,GAAA,CAAI,SAAW,EAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAAA,GACpC;AAEA,EAAA,OAAO,GAAG,IAAK,CAAA,IAAI,CAAI,CAAA,EAAA,MAAA,CAAO,UAAU,CAAA,CAAA,CAAA;AAC1C,CAAA;AAEO,SAAS,mBACd,GACoB,EAAA;AACpB,EAAA,IAAI,IAAO,GAAA,EAAA,CAAA;AACX,EAAA,IAAI,KAAQ,GAAA,EAAA,CAAA;AACZ,EAAA,IAAI,QAAW,GAAA,EAAA,CAAA;AACf,EAAA,IAAI,YAAe,GAAA,EAAA,CAAA;AACnB,EAAA,IAAI,SAAY,GAAA,EAAA,CAAA;AAChB,EAAA,IAAI,OAAU,GAAA,EAAA,CAAA;AAEd,EAAI,IAAA;AACF,IAAA,IAAI,GAAK,EAAA;AACP,MAAA,MAAM,MAAS,GAAA,IAAI,GAAI,CAAA,CAAA,QAAA,EAAW,GAAG,CAAE,CAAA,CAAA,CAAA;AACvC,MAAA,IAAA,GAAO,MAAO,CAAA,IAAA,CAAA;AACd,MAAA,KAAA,GAAQ,MAAO,CAAA,YAAA,CAAa,GAAI,CAAA,OAAO,CAAK,IAAA,EAAA,CAAA;AAC5C,MAAA,QAAA,GAAW,MAAO,CAAA,YAAA,CAAa,GAAI,CAAA,MAAM,CAAK,IAAA,EAAA,CAAA;AAC9C,MAAA,YAAA,GAAe,MAAO,CAAA,YAAA,CAAa,GAAI,CAAA,cAAc,CAAK,IAAA,EAAA,CAAA;AAC1D,MAAA,SAAA,GAAY,MAAO,CAAA,YAAA,CAAa,GAAI,CAAA,WAAW,CAAK,IAAA,EAAA,CAAA;AACpD,MAAA,OAAA,GAAU,MAAO,CAAA,YAAA,CAAa,GAAI,CAAA,SAAS,CAAK,IAAA,EAAA,CAAA;AAAA,KAClD;AAAA,GACM,CAAA,MAAA;AAAA,GAER;AACA,EAAA,OAAO,EAAE,IAAM,EAAA,KAAA,EAAO,QAAU,EAAA,YAAA,EAAc,WAAW,OAAQ,EAAA,CAAA;AACnE;;;;"}
1
+ {"version":3,"file":"utils.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/utils.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RepoUrlPickerState } from './types';\n\nexport function serializeRepoPickerUrl(data: RepoUrlPickerState) {\n if (!data.host) {\n return undefined;\n }\n\n const params = new URLSearchParams();\n if (data.owner) {\n params.set('owner', data.owner);\n }\n if (data.repoName) {\n params.set('repo', data.repoName);\n }\n if (data.organization) {\n params.set('organization', data.organization);\n }\n if (data.workspace) {\n params.set('workspace', data.workspace);\n }\n if (data.project) {\n params.set('project', data.project);\n }\n\n return `${data.host}?${params.toString()}`;\n}\n\nexport function parseRepoPickerUrl(\n url: string | undefined,\n): RepoUrlPickerState {\n let host = '';\n let owner = '';\n let repoName = '';\n let organization = '';\n let workspace = '';\n let project = '';\n\n try {\n if (url) {\n const parsed = new URL(`https://${url}`);\n host = parsed.host;\n owner = parsed.searchParams.get('owner') || '';\n repoName = parsed.searchParams.get('repo') || '';\n organization = parsed.searchParams.get('organization') || '';\n workspace = parsed.searchParams.get('workspace') || '';\n project = parsed.searchParams.get('project') || '';\n }\n } catch {\n /* ok */\n }\n return { host, owner, repoName, organization, workspace, project };\n}\n"],"names":[],"mappings":"AAkBO,SAAS,uBAAuB,IAA0B,EAAA;AAC/D,EAAI,IAAA,CAAC,KAAK,IAAM,EAAA;AACd,IAAO,OAAA,KAAA,CAAA;AAAA;AAGT,EAAM,MAAA,MAAA,GAAS,IAAI,eAAgB,EAAA;AACnC,EAAA,IAAI,KAAK,KAAO,EAAA;AACd,IAAO,MAAA,CAAA,GAAA,CAAI,OAAS,EAAA,IAAA,CAAK,KAAK,CAAA;AAAA;AAEhC,EAAA,IAAI,KAAK,QAAU,EAAA;AACjB,IAAO,MAAA,CAAA,GAAA,CAAI,MAAQ,EAAA,IAAA,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;AACpD,MAAA,OAAA,GAAU,MAAO,CAAA,YAAA,CAAa,GAAI,CAAA,SAAS,CAAK,IAAA,EAAA;AAAA;AAClD,GACM,CAAA,MAAA;AAAA;AAGR,EAAA,OAAO,EAAE,IAAM,EAAA,KAAA,EAAO,QAAU,EAAA,YAAA,EAAc,WAAW,OAAQ,EAAA;AACnE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validation.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/validation.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\n\n/**\n * The validation function for the `repoUrl` that is returned from the\n * field extension. Ensures that you have all the required fields filled for\n * the different providers that exist.\n *\n * @public\n */\nexport const repoPickerValidation = (\n value: string,\n validation: FieldValidation,\n context: { apiHolder: ApiHolder },\n) => {\n try {\n const { host, searchParams } = new URL(`https://${value}`);\n\n const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);\n\n if (!host) {\n validation.addError(\n 'Incomplete repository location provided, host not provided',\n );\n } else {\n if (integrationApi?.byHost(host)?.type === 'bitbucket') {\n // workspace is only applicable for bitbucket cloud\n if (host === 'bitbucket.org' && !searchParams.get('workspace')) {\n validation.addError(\n 'Incomplete repository location provided, workspace not provided',\n );\n }\n\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n } else if (integrationApi?.byHost(host)?.type === 'azure') {\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n }\n // For anything other than bitbucket, azure, and gerrit\n else if (integrationApi?.byHost(host)?.type !== 'gerrit') {\n if (!searchParams.get('owner')) {\n validation.addError(\n 'Incomplete repository location provided, owner not provided',\n );\n }\n }\n\n // Do this for all hosts\n if (!searchParams.get('repo')) {\n validation.addError(\n 'Incomplete repository location provided, repo not provided',\n );\n }\n }\n } catch {\n validation.addError('Unable to parse the Repository URL');\n }\n};\n"],"names":[],"mappings":";;AA2BO,MAAM,oBAAuB,GAAA,CAClC,KACA,EAAA,UAAA,EACA,OACG,KAAA;AACH,EAAI,IAAA;AACF,IAAM,MAAA,EAAE,MAAM,YAAa,EAAA,GAAI,IAAI,GAAI,CAAA,CAAA,QAAA,EAAW,KAAK,CAAE,CAAA,CAAA,CAAA;AAEzD,IAAA,MAAM,cAAiB,GAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,qBAAqB,CAAA,CAAA;AAElE,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAW,UAAA,CAAA,QAAA;AAAA,QACT,4DAAA;AAAA,OACF,CAAA;AAAA,KACK,MAAA;AACL,MAAA,IAAI,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,WAAa,EAAA;AAEtD,QAAA,IAAI,SAAS,eAAmB,IAAA,CAAC,YAAa,CAAA,GAAA,CAAI,WAAW,CAAG,EAAA;AAC9D,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,iEAAA;AAAA,WACF,CAAA;AAAA,SACF;AAEA,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,SAAS,CAAG,EAAA;AAChC,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,+DAAA;AAAA,WACF,CAAA;AAAA,SACF;AAAA,iBACS,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,OAAS,EAAA;AACzD,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,SAAS,CAAG,EAAA;AAChC,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,+DAAA;AAAA,WACF,CAAA;AAAA,SACF;AAAA,iBAGO,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,QAAU,EAAA;AACxD,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,OAAO,CAAG,EAAA;AAC9B,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,6DAAA;AAAA,WACF,CAAA;AAAA,SACF;AAAA,OACF;AAGA,MAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,MAAM,CAAG,EAAA;AAC7B,QAAW,UAAA,CAAA,QAAA;AAAA,UACT,4DAAA;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACF;AAAA,GACM,CAAA,MAAA;AACN,IAAA,UAAA,CAAW,SAAS,oCAAoC,CAAA,CAAA;AAAA,GAC1D;AACF;;;;"}
1
+ {"version":3,"file":"validation.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/validation.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\n\n/**\n * The validation function for the `repoUrl` that is returned from the\n * field extension. Ensures that you have all the required fields filled for\n * the different providers that exist.\n *\n * @public\n */\nexport const repoPickerValidation = (\n value: string,\n validation: FieldValidation,\n context: { apiHolder: ApiHolder },\n) => {\n try {\n const { host, searchParams } = new URL(`https://${value}`);\n\n const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);\n\n if (!host) {\n validation.addError(\n 'Incomplete repository location provided, host not provided',\n );\n } else {\n if (integrationApi?.byHost(host)?.type === 'bitbucket') {\n // workspace is only applicable for bitbucket cloud\n if (host === 'bitbucket.org' && !searchParams.get('workspace')) {\n validation.addError(\n 'Incomplete repository location provided, workspace not provided',\n );\n }\n\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n } else if (integrationApi?.byHost(host)?.type === 'azure') {\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n }\n // For anything other than bitbucket, azure, and gerrit\n else if (integrationApi?.byHost(host)?.type !== 'gerrit') {\n if (!searchParams.get('owner')) {\n validation.addError(\n 'Incomplete repository location provided, owner not provided',\n );\n }\n }\n\n // Do this for all hosts\n if (!searchParams.get('repo')) {\n validation.addError(\n 'Incomplete repository location provided, repo not provided',\n );\n }\n }\n } catch {\n validation.addError('Unable to parse the Repository URL');\n }\n};\n"],"names":[],"mappings":";;AA2BO,MAAM,oBAAuB,GAAA,CAClC,KACA,EAAA,UAAA,EACA,OACG,KAAA;AACH,EAAI,IAAA;AACF,IAAM,MAAA,EAAE,MAAM,YAAa,EAAA,GAAI,IAAI,GAAI,CAAA,CAAA,QAAA,EAAW,KAAK,CAAE,CAAA,CAAA;AAEzD,IAAA,MAAM,cAAiB,GAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,qBAAqB,CAAA;AAElE,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAW,UAAA,CAAA,QAAA;AAAA,QACT;AAAA,OACF;AAAA,KACK,MAAA;AACL,MAAA,IAAI,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,WAAa,EAAA;AAEtD,QAAA,IAAI,SAAS,eAAmB,IAAA,CAAC,YAAa,CAAA,GAAA,CAAI,WAAW,CAAG,EAAA;AAC9D,UAAW,UAAA,CAAA,QAAA;AAAA,YACT;AAAA,WACF;AAAA;AAGF,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,SAAS,CAAG,EAAA;AAChC,UAAW,UAAA,CAAA,QAAA;AAAA,YACT;AAAA,WACF;AAAA;AACF,iBACS,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,OAAS,EAAA;AACzD,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,SAAS,CAAG,EAAA;AAChC,UAAW,UAAA,CAAA,QAAA;AAAA,YACT;AAAA,WACF;AAAA;AACF,iBAGO,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,QAAU,EAAA;AACxD,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,OAAO,CAAG,EAAA;AAC9B,UAAW,UAAA,CAAA,QAAA;AAAA,YACT;AAAA,WACF;AAAA;AACF;AAIF,MAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,MAAM,CAAG,EAAA;AAC7B,QAAW,UAAA,CAAA,QAAA;AAAA,UACT;AAAA,SACF;AAAA;AACF;AACF,GACM,CAAA,MAAA;AACN,IAAA,UAAA,CAAW,SAAS,oCAAoC,CAAA;AAAA;AAE5D;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecretInput.esm.js","sources":["../../../../src/components/fields/SecretInput/SecretInput.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 React from 'react';\nimport { ScaffolderRJSFFieldProps } from '@backstage/plugin-scaffolder-react';\nimport {\n ScaffolderField,\n SecretWidget,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nexport const SecretInput = (props: ScaffolderRJSFFieldProps) => {\n const {\n schema: { description },\n rawErrors,\n disabled,\n errors,\n required,\n } = props;\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={description}\n disabled={disabled}\n errors={errors}\n required={required}\n >\n <SecretWidget {...props} />\n </ScaffolderField>\n );\n};\n"],"names":[],"mappings":";;;AAsBa,MAAA,WAAA,GAAc,CAAC,KAAoC,KAAA;AAC9D,EAAM,MAAA;AAAA,IACJ,MAAA,EAAQ,EAAE,WAAY,EAAA;AAAA,IACtB,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,cAAgB,EAAA,WAAA;AAAA,MAChB,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA,CAAC,YAAc,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,GAC3B,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SecretInput.esm.js","sources":["../../../../src/components/fields/SecretInput/SecretInput.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 React from 'react';\nimport { ScaffolderRJSFFieldProps } from '@backstage/plugin-scaffolder-react';\nimport {\n ScaffolderField,\n SecretWidget,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nexport const SecretInput = (props: ScaffolderRJSFFieldProps) => {\n const {\n schema: { description },\n rawErrors,\n disabled,\n errors,\n required,\n } = props;\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={description}\n disabled={disabled}\n errors={errors}\n required={required}\n >\n <SecretWidget {...props} />\n </ScaffolderField>\n );\n};\n"],"names":[],"mappings":";;;AAsBa,MAAA,WAAA,GAAc,CAAC,KAAoC,KAAA;AAC9D,EAAM,MAAA;AAAA,IACJ,MAAA,EAAQ,EAAE,WAAY,EAAA;AAAA,IACtB,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,cAAgB,EAAA,WAAA;AAAA,MAChB,QAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA,CAAC,YAAc,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA,GAC3B;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedListbox.esm.js","sources":["../../../src/components/fields/VirtualizedListbox.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { FixedSizeList, ListChildComponentProps } from 'react-window';\n\ntype HTMLDivProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n return React.cloneElement(data[index], { style });\n};\n\n// Context needed to keep Autocomplete working correctly : https://v4.mui.com/components/autocomplete/#Virtualize.tsx\nconst OuterElementContext = React.createContext<HTMLDivProps>({});\n\nconst OuterElementType = React.forwardRef<HTMLDivElement, HTMLDivProps>(\n (props, ref) => {\n const outerProps = React.useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n },\n);\n\nexport const VirtualizedListbox = React.forwardRef<\n HTMLDivElement,\n HTMLDivProps\n>((props, ref) => {\n const { children, ...other } = props;\n const itemData = React.Children.toArray(children);\n const itemCount = itemData.length;\n\n const itemSize = 36;\n\n const itemsToShow = Math.min(10, itemCount) + 0.5;\n const height = itemsToShow * itemSize;\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <FixedSizeList\n height={height}\n itemData={itemData}\n itemCount={itemCount}\n itemSize={itemSize}\n outerElementType={OuterElementType}\n width=\"100%\"\n >\n {renderRow}\n </FixedSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n"],"names":[],"mappings":";;;AAqBA,MAAM,SAAA,GAAY,CAAC,KAAmC,KAAA;AACpD,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC/B,EAAA,OAAO,MAAM,YAAa,CAAA,IAAA,CAAK,KAAK,CAAG,EAAA,EAAE,OAAO,CAAA,CAAA;AAClD,CAAA,CAAA;AAGA,MAAM,mBAAsB,GAAA,KAAA,CAAM,aAA4B,CAAA,EAAE,CAAA,CAAA;AAEhE,MAAM,mBAAmB,KAAM,CAAA,UAAA;AAAA,EAC7B,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA,UAAA,GAAa,KAAM,CAAA,UAAA,CAAW,mBAAmB,CAAA,CAAA;AACvD,IAAA,2CAAQ,KAAI,EAAA,EAAA,GAAA,EAAW,GAAG,KAAA,EAAQ,GAAG,UAAY,EAAA,CAAA,CAAA;AAAA,GACnD;AACF,CAAA,CAAA;AAEO,MAAM,kBAAqB,GAAA,KAAA,CAAM,UAGtC,CAAA,CAAC,OAAO,GAAQ,KAAA;AAChB,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,KAAA,EAAU,GAAA,KAAA,CAAA;AAC/B,EAAA,MAAM,QAAW,GAAA,KAAA,CAAM,QAAS,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAChD,EAAA,MAAM,YAAY,QAAS,CAAA,MAAA,CAAA;AAE3B,EAAA,MAAM,QAAW,GAAA,EAAA,CAAA;AAEjB,EAAA,MAAM,WAAc,GAAA,IAAA,CAAK,GAAI,CAAA,EAAA,EAAI,SAAS,CAAI,GAAA,GAAA,CAAA;AAC9C,EAAA,MAAM,SAAS,WAAc,GAAA,QAAA,CAAA;AAE7B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,GACH,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAApB,EAAA,EAA6B,OAAO,KACnC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,gBAAkB,EAAA,gBAAA;AAAA,MAClB,KAAM,EAAA,MAAA;AAAA,KAAA;AAAA,IAEL,SAAA;AAAA,GAEL,CACF,CAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"VirtualizedListbox.esm.js","sources":["../../../src/components/fields/VirtualizedListbox.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { FixedSizeList, ListChildComponentProps } from 'react-window';\n\ntype HTMLDivProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n return React.cloneElement(data[index], { style });\n};\n\n// Context needed to keep Autocomplete working correctly : https://v4.mui.com/components/autocomplete/#Virtualize.tsx\nconst OuterElementContext = React.createContext<HTMLDivProps>({});\n\nconst OuterElementType = React.forwardRef<HTMLDivElement, HTMLDivProps>(\n (props, ref) => {\n const outerProps = React.useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n },\n);\n\nexport const VirtualizedListbox = React.forwardRef<\n HTMLDivElement,\n HTMLDivProps\n>((props, ref) => {\n const { children, ...other } = props;\n const itemData = React.Children.toArray(children);\n const itemCount = itemData.length;\n\n const itemSize = 36;\n\n const itemsToShow = Math.min(10, itemCount) + 0.5;\n const height = itemsToShow * itemSize;\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <FixedSizeList\n height={height}\n itemData={itemData}\n itemCount={itemCount}\n itemSize={itemSize}\n outerElementType={OuterElementType}\n width=\"100%\"\n >\n {renderRow}\n </FixedSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n"],"names":[],"mappings":";;;AAqBA,MAAM,SAAA,GAAY,CAAC,KAAmC,KAAA;AACpD,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA;AAC/B,EAAA,OAAO,MAAM,YAAa,CAAA,IAAA,CAAK,KAAK,CAAG,EAAA,EAAE,OAAO,CAAA;AAClD,CAAA;AAGA,MAAM,mBAAsB,GAAA,KAAA,CAAM,aAA4B,CAAA,EAAE,CAAA;AAEhE,MAAM,mBAAmB,KAAM,CAAA,UAAA;AAAA,EAC7B,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA,UAAA,GAAa,KAAM,CAAA,UAAA,CAAW,mBAAmB,CAAA;AACvD,IAAA,2CAAQ,KAAI,EAAA,EAAA,GAAA,EAAW,GAAG,KAAA,EAAQ,GAAG,UAAY,EAAA,CAAA;AAAA;AAErD,CAAA;AAEO,MAAM,kBAAqB,GAAA,KAAA,CAAM,UAGtC,CAAA,CAAC,OAAO,GAAQ,KAAA;AAChB,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,KAAA,EAAU,GAAA,KAAA;AAC/B,EAAA,MAAM,QAAW,GAAA,KAAA,CAAM,QAAS,CAAA,OAAA,CAAQ,QAAQ,CAAA;AAChD,EAAA,MAAM,YAAY,QAAS,CAAA,MAAA;AAE3B,EAAA,MAAM,QAAW,GAAA,EAAA;AAEjB,EAAA,MAAM,WAAc,GAAA,IAAA,CAAK,GAAI,CAAA,EAAA,EAAI,SAAS,CAAI,GAAA,GAAA;AAC9C,EAAA,MAAM,SAAS,WAAc,GAAA,QAAA;AAE7B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,GACH,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAApB,EAAA,EAA6B,OAAO,KACnC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,gBAAkB,EAAA,gBAAA;AAAA,MAClB,KAAM,EAAA;AAAA,KAAA;AAAA,IAEL;AAAA,GAEL,CACF,CAAA;AAEJ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.esm.js","sources":["../../../src/components/fields/utils.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 { JSONSchema7 } from 'json-schema';\nimport { z } from 'zod';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { FieldSchema as FieldSchemaType } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n * @deprecated - import from {@link @backstage/plugin-scaffolder-react#FieldSchema} instead\n */\nexport interface FieldSchema<T, P> extends FieldSchemaType<T, P> {}\n\n/**\n * @public\n * @deprecated use `makeFieldSchema` instead\n * Utility function to convert zod return and UI options schemas to a\n * CustomFieldExtensionSchema with FieldExtensionComponentProps type inference\n */\n\nexport function makeFieldSchemaFromZod<\n TReturnSchema extends z.ZodType,\n TUiOptionsSchema extends z.ZodType = z.ZodType<any, any, {}>,\n>(\n returnSchema: TReturnSchema,\n uiOptionsSchema?: TUiOptionsSchema,\n): FieldSchema<\n TReturnSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : never,\n TUiOptionsSchema extends z.ZodType<any, any, infer IUiOptions>\n ? IUiOptions\n : never\n> {\n return {\n schema: {\n returnValue: zodToJsonSchema(returnSchema) as JSONSchema7,\n uiOptions: uiOptionsSchema\n ? (zodToJsonSchema(uiOptionsSchema) as JSONSchema7)\n : undefined,\n },\n type: null as any,\n uiOptionsType: null as any,\n TProps: undefined as any,\n };\n}\n"],"names":[],"mappings":";;AAiCgB,SAAA,sBAAA,CAId,cACA,eAMA,EAAA;AACA,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA;AAAA,MACN,WAAA,EAAa,gBAAgB,YAAY,CAAA;AAAA,MACzC,SAAW,EAAA,eAAA,GACN,eAAgB,CAAA,eAAe,CAChC,GAAA,KAAA,CAAA;AAAA,KACN;AAAA,IACA,IAAM,EAAA,IAAA;AAAA,IACN,aAAe,EAAA,IAAA;AAAA,IACf,MAAQ,EAAA,KAAA,CAAA;AAAA,GACV,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"utils.esm.js","sources":["../../../src/components/fields/utils.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 { JSONSchema7 } from 'json-schema';\nimport { z } from 'zod';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { FieldSchema as FieldSchemaType } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n * @deprecated - import from {@link @backstage/plugin-scaffolder-react#FieldSchema} instead\n */\nexport interface FieldSchema<T, P> extends FieldSchemaType<T, P> {}\n\n/**\n * @public\n * @deprecated use `makeFieldSchema` instead\n * Utility function to convert zod return and UI options schemas to a\n * CustomFieldExtensionSchema with FieldExtensionComponentProps type inference\n */\n\nexport function makeFieldSchemaFromZod<\n TReturnSchema extends z.ZodType,\n TUiOptionsSchema extends z.ZodType = z.ZodType<any, any, {}>,\n>(\n returnSchema: TReturnSchema,\n uiOptionsSchema?: TUiOptionsSchema,\n): FieldSchema<\n TReturnSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : never,\n TUiOptionsSchema extends z.ZodType<any, any, infer IUiOptions>\n ? IUiOptions\n : never\n> {\n return {\n schema: {\n returnValue: zodToJsonSchema(returnSchema) as JSONSchema7,\n uiOptions: uiOptionsSchema\n ? (zodToJsonSchema(uiOptionsSchema) as JSONSchema7)\n : undefined,\n },\n type: null as any,\n uiOptionsType: null as any,\n TProps: undefined as any,\n };\n}\n"],"names":[],"mappings":";;AAiCgB,SAAA,sBAAA,CAId,cACA,eAMA,EAAA;AACA,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA;AAAA,MACN,WAAA,EAAa,gBAAgB,YAAY,CAAA;AAAA,MACzC,SAAW,EAAA,eAAA,GACN,eAAgB,CAAA,eAAe,CAChC,GAAA,KAAA;AAAA,KACN;AAAA,IACA,IAAM,EAAA,IAAA;AAAA,IACN,aAAe,EAAA,IAAA;AAAA,IACf,MAAQ,EAAA,KAAA;AAAA,GACV;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.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\n/*\n * This file is here to re-export exports from the `@backage/plugin-scaffolder-react` package to keep backwards compatibility.\n * But mark them as deprecated so that any import that is using these exports will be notified that they should use the `-react` package instead.\n * It's a little awkward to get the deprecated notice to show up in the API report, which is why it's all been extracted out to this file.\n */\n\nimport {\n createScaffolderFieldExtension as createScaffolderFieldExtensionTemp,\n ScaffolderFieldExtensions as ScaffolderFieldExtensionsTemp,\n useTemplateSecrets as useTemplateSecretsTemp,\n scaffolderApiRef as scaffolderApiRefTemp,\n createScaffolderLayout as createScaffolderLayoutTemp,\n ScaffolderLayouts as ScaffolderLayoutsTemp,\n type LayoutOptions as LayoutOptionsTemp,\n type LayoutTemplate as LayoutTemplateTemp,\n type ScaffolderApi as ScaffolderApiTemp,\n type ScaffolderUseTemplateSecrets as ScaffolderUseTemplateSecretsTemp,\n type TemplateParameterSchema as TemplateParameterSchemaTemp,\n type CustomFieldExtensionSchema as CustomFieldExtensionSchemaTemp,\n type CustomFieldValidator as CustomFieldValidatorTemp,\n type FieldExtensionOptions as FieldExtensionOptionsTemp,\n type FieldExtensionComponentProps as FieldExtensionComponentPropsTemp,\n type FieldExtensionComponent as FieldExtensionComponentTemp,\n type ListActionsResponse as ListActionsResponseTemp,\n type LogEvent as LogEventTemp,\n type ScaffolderDryRunOptions as ScaffolderDryRunOptionsTemp,\n type ScaffolderDryRunResponse as ScaffolderDryRunResponseTemp,\n type ScaffolderGetIntegrationsListOptions as ScaffolderGetIntegrationsListOptionsTemp,\n type ScaffolderGetIntegrationsListResponse as ScaffolderGetIntegrationsListResponseTemp,\n type ScaffolderOutputLink as ScaffolderOutputLinkTemp,\n type ScaffolderScaffoldOptions as ScaffolderScaffoldOptionsTemp,\n type ScaffolderScaffoldResponse as ScaffolderScaffoldResponseTemp,\n type ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptionsTemp,\n type ScaffolderTask as ScaffolderTaskTemp,\n type ScaffolderTaskOutput as ScaffolderTaskOutputTemp,\n type ScaffolderTaskStatus as ScaffolderTaskStatusTemp,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { rootRouteRef as rootRouteRefTemp } from './routes';\n\n/**\n * @public\n * @deprecated use import from `{@link @backstage/plugin-scaffolder#scaffolderPlugin}.routes.root` instead.\n */\nexport const rootRouteRef = rootRouteRefTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#createScaffolderFieldExtension} instead as this has now been moved.\n */\nexport const createScaffolderFieldExtension =\n createScaffolderFieldExtensionTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderFieldExtensions} instead as this has now been moved.\n */\nexport const ScaffolderFieldExtensions = ScaffolderFieldExtensionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#useTemplateSecrets} instead as this has now been moved.\n */\nexport const useTemplateSecrets = useTemplateSecretsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#scaffolderApiRef} instead as this has now been moved.\n */\nexport const scaffolderApiRef = scaffolderApiRefTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderApi} instead as this has now been moved.\n */\nexport type ScaffolderApi = ScaffolderApiTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderUseTemplateSecrets} instead as this has now been moved.\n */\nexport type ScaffolderUseTemplateSecrets = ScaffolderUseTemplateSecretsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#TemplateParameterSchema} instead as this has now been moved.\n */\nexport type TemplateParameterSchema = TemplateParameterSchemaTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#CustomFieldExtensionSchema} instead as this has now been moved.\n */\nexport type CustomFieldExtensionSchema = CustomFieldExtensionSchemaTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#CustomFieldValidator} instead as this has now been moved.\n */\nexport type CustomFieldValidator<TReturnFieldData> =\n CustomFieldValidatorTemp<TReturnFieldData>;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#FieldExtensionOptions} instead as this has now been moved.\n */\nexport type FieldExtensionOptions = FieldExtensionOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#FieldExtensionComponentProps} instead as this has now been moved.\n */\nexport type FieldExtensionComponentProps<\n TFieldReturnValue,\n TUiOptions extends {} = {},\n> = FieldExtensionComponentPropsTemp<TFieldReturnValue, TUiOptions>;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#FieldExtensionComponent} instead as this has now been moved.\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> =\n FieldExtensionComponentTemp<_TReturnValue, _TInputProps>;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ListActionsResponse} instead as this has now been moved.\n */\nexport type ListActionsResponse = ListActionsResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LogEvent} instead as this has now been moved.\n */\nexport type LogEvent = LogEventTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderDryRunOptions} instead as this has now been moved.\n */\nexport type ScaffolderDryRunOptions = ScaffolderDryRunOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderDryRunResponse} instead as this has now been moved.\n */\nexport type ScaffolderDryRunResponse = ScaffolderDryRunResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderGetIntegrationsListOptions} instead as this has now been moved.\n */\nexport type ScaffolderGetIntegrationsListOptions =\n ScaffolderGetIntegrationsListOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderGetIntegrationsListResponse} instead as this has now been moved.\n */\nexport type ScaffolderGetIntegrationsListResponse =\n ScaffolderGetIntegrationsListResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderOutputlink} instead as this has now been moved.\n */\nexport type ScaffolderOutputlink = ScaffolderOutputLinkTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderScaffoldOptions} instead as this has now been moved.\n */\nexport type ScaffolderScaffoldOptions = ScaffolderScaffoldOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderScaffoldResponse} instead as this has now been moved.\n */\nexport type ScaffolderScaffoldResponse = ScaffolderScaffoldResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderStreamLogsOptions} instead as this has now been moved.\n */\nexport type ScaffolderStreamLogsOptions = ScaffolderStreamLogsOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTask} instead as this has now been moved.\n */\nexport type ScaffolderTask = ScaffolderTaskTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTaskOutput} instead as this has now been moved.\n */\nexport type ScaffolderTaskOutput = ScaffolderTaskOutputTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTaskStatus} instead as this has now been moved.\n */\nexport type ScaffolderTaskStatus = ScaffolderTaskStatusTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#createScaffolderLayout} instead as this has now been moved.\n */\nexport const createScaffolderLayout = createScaffolderLayoutTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderLayouts} instead as this has now been moved.\n */\nexport const ScaffolderLayouts = ScaffolderLayoutsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LayoutTemplate} instead as this has now been moved.\n */\nexport type LayoutTemplate = LayoutTemplateTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LayoutOptions} instead as this has now been moved.\n */\nexport type LayoutOptions = LayoutOptionsTemp;\n\n/**\n * TaskPageProps for constructing a TaskPage\n * @public\n * @deprecated - this is a useless type that is no longer used.\n */\nexport type TaskPageProps = {\n // Optional loading text shown before a task begins executing.\n loadingText?: string;\n};\n"],"names":["rootRouteRefTemp","createScaffolderFieldExtensionTemp","ScaffolderFieldExtensionsTemp","useTemplateSecretsTemp","scaffolderApiRefTemp","createScaffolderLayoutTemp","ScaffolderLayoutsTemp"],"mappings":";;;AA4DO,MAAM,YAAe,GAAAA,eAAA;AAKrB,MAAM,8BACX,GAAAC,iCAAA;AAKK,MAAM,yBAA4B,GAAAC,4BAAA;AAKlC,MAAM,kBAAqB,GAAAC,qBAAA;AAK3B,MAAM,gBAAmB,GAAAC,mBAAA;AAqHzB,MAAM,sBAAyB,GAAAC,yBAAA;AAK/B,MAAM,iBAAoB,GAAAC;;;;"}
1
+ {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.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\n/*\n * This file is here to re-export exports from the `@backage/plugin-scaffolder-react` package to keep backwards compatibility.\n * But mark them as deprecated so that any import that is using these exports will be notified that they should use the `-react` package instead.\n * It's a little awkward to get the deprecated notice to show up in the API report, which is why it's all been extracted out to this file.\n */\n\nimport {\n createScaffolderFieldExtension as createScaffolderFieldExtensionTemp,\n ScaffolderFieldExtensions as ScaffolderFieldExtensionsTemp,\n useTemplateSecrets as useTemplateSecretsTemp,\n scaffolderApiRef as scaffolderApiRefTemp,\n createScaffolderLayout as createScaffolderLayoutTemp,\n ScaffolderLayouts as ScaffolderLayoutsTemp,\n type LayoutOptions as LayoutOptionsTemp,\n type LayoutTemplate as LayoutTemplateTemp,\n type ScaffolderApi as ScaffolderApiTemp,\n type ScaffolderUseTemplateSecrets as ScaffolderUseTemplateSecretsTemp,\n type TemplateParameterSchema as TemplateParameterSchemaTemp,\n type CustomFieldExtensionSchema as CustomFieldExtensionSchemaTemp,\n type CustomFieldValidator as CustomFieldValidatorTemp,\n type FieldExtensionOptions as FieldExtensionOptionsTemp,\n type FieldExtensionComponentProps as FieldExtensionComponentPropsTemp,\n type FieldExtensionComponent as FieldExtensionComponentTemp,\n type ListActionsResponse as ListActionsResponseTemp,\n type LogEvent as LogEventTemp,\n type ScaffolderDryRunOptions as ScaffolderDryRunOptionsTemp,\n type ScaffolderDryRunResponse as ScaffolderDryRunResponseTemp,\n type ScaffolderGetIntegrationsListOptions as ScaffolderGetIntegrationsListOptionsTemp,\n type ScaffolderGetIntegrationsListResponse as ScaffolderGetIntegrationsListResponseTemp,\n type ScaffolderOutputLink as ScaffolderOutputLinkTemp,\n type ScaffolderScaffoldOptions as ScaffolderScaffoldOptionsTemp,\n type ScaffolderScaffoldResponse as ScaffolderScaffoldResponseTemp,\n type ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptionsTemp,\n type ScaffolderTask as ScaffolderTaskTemp,\n type ScaffolderTaskOutput as ScaffolderTaskOutputTemp,\n type ScaffolderTaskStatus as ScaffolderTaskStatusTemp,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { rootRouteRef as rootRouteRefTemp } from './routes';\n\n/**\n * @public\n * @deprecated use import from `{@link @backstage/plugin-scaffolder#scaffolderPlugin}.routes.root` instead.\n */\nexport const rootRouteRef = rootRouteRefTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#createScaffolderFieldExtension} instead as this has now been moved.\n */\nexport const createScaffolderFieldExtension =\n createScaffolderFieldExtensionTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderFieldExtensions} instead as this has now been moved.\n */\nexport const ScaffolderFieldExtensions = ScaffolderFieldExtensionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#useTemplateSecrets} instead as this has now been moved.\n */\nexport const useTemplateSecrets = useTemplateSecretsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#scaffolderApiRef} instead as this has now been moved.\n */\nexport const scaffolderApiRef = scaffolderApiRefTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderApi} instead as this has now been moved.\n */\nexport type ScaffolderApi = ScaffolderApiTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderUseTemplateSecrets} instead as this has now been moved.\n */\nexport type ScaffolderUseTemplateSecrets = ScaffolderUseTemplateSecretsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#TemplateParameterSchema} instead as this has now been moved.\n */\nexport type TemplateParameterSchema = TemplateParameterSchemaTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#CustomFieldExtensionSchema} instead as this has now been moved.\n */\nexport type CustomFieldExtensionSchema = CustomFieldExtensionSchemaTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#CustomFieldValidator} instead as this has now been moved.\n */\nexport type CustomFieldValidator<TReturnFieldData> =\n CustomFieldValidatorTemp<TReturnFieldData>;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#FieldExtensionOptions} instead as this has now been moved.\n */\nexport type FieldExtensionOptions = FieldExtensionOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#FieldExtensionComponentProps} instead as this has now been moved.\n */\nexport type FieldExtensionComponentProps<\n TFieldReturnValue,\n TUiOptions extends {} = {},\n> = FieldExtensionComponentPropsTemp<TFieldReturnValue, TUiOptions>;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#FieldExtensionComponent} instead as this has now been moved.\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> =\n FieldExtensionComponentTemp<_TReturnValue, _TInputProps>;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ListActionsResponse} instead as this has now been moved.\n */\nexport type ListActionsResponse = ListActionsResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LogEvent} instead as this has now been moved.\n */\nexport type LogEvent = LogEventTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderDryRunOptions} instead as this has now been moved.\n */\nexport type ScaffolderDryRunOptions = ScaffolderDryRunOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderDryRunResponse} instead as this has now been moved.\n */\nexport type ScaffolderDryRunResponse = ScaffolderDryRunResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderGetIntegrationsListOptions} instead as this has now been moved.\n */\nexport type ScaffolderGetIntegrationsListOptions =\n ScaffolderGetIntegrationsListOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderGetIntegrationsListResponse} instead as this has now been moved.\n */\nexport type ScaffolderGetIntegrationsListResponse =\n ScaffolderGetIntegrationsListResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderOutputlink} instead as this has now been moved.\n */\nexport type ScaffolderOutputlink = ScaffolderOutputLinkTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderScaffoldOptions} instead as this has now been moved.\n */\nexport type ScaffolderScaffoldOptions = ScaffolderScaffoldOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderScaffoldResponse} instead as this has now been moved.\n */\nexport type ScaffolderScaffoldResponse = ScaffolderScaffoldResponseTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderStreamLogsOptions} instead as this has now been moved.\n */\nexport type ScaffolderStreamLogsOptions = ScaffolderStreamLogsOptionsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTask} instead as this has now been moved.\n */\nexport type ScaffolderTask = ScaffolderTaskTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTaskOutput} instead as this has now been moved.\n */\nexport type ScaffolderTaskOutput = ScaffolderTaskOutputTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTaskStatus} instead as this has now been moved.\n */\nexport type ScaffolderTaskStatus = ScaffolderTaskStatusTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#createScaffolderLayout} instead as this has now been moved.\n */\nexport const createScaffolderLayout = createScaffolderLayoutTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderLayouts} instead as this has now been moved.\n */\nexport const ScaffolderLayouts = ScaffolderLayoutsTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LayoutTemplate} instead as this has now been moved.\n */\nexport type LayoutTemplate = LayoutTemplateTemp;\n/**\n * @public\n * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LayoutOptions} instead as this has now been moved.\n */\nexport type LayoutOptions = LayoutOptionsTemp;\n\n/**\n * TaskPageProps for constructing a TaskPage\n * @public\n * @deprecated - this is a useless type that is no longer used.\n */\nexport type TaskPageProps = {\n // Optional loading text shown before a task begins executing.\n loadingText?: string;\n};\n"],"names":["rootRouteRefTemp","createScaffolderFieldExtensionTemp","ScaffolderFieldExtensionsTemp","useTemplateSecretsTemp","scaffolderApiRefTemp","createScaffolderLayoutTemp","ScaffolderLayoutsTemp"],"mappings":";;;AA4DO,MAAM,YAAe,GAAAA;AAKrB,MAAM,8BACX,GAAAC;AAKK,MAAM,yBAA4B,GAAAC;AAKlC,MAAM,kBAAqB,GAAAC;AAK3B,MAAM,gBAAmB,GAAAC;AAqHzB,MAAM,sBAAyB,GAAAC;AAK/B,MAAM,iBAAoB,GAAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"default.esm.js","sources":["../../src/extensions/default.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n EntityPicker,\n EntityPickerSchema,\n} from '../components/fields/EntityPicker/EntityPicker';\nimport {\n EntityNamePicker,\n EntityNamePickerSchema,\n} from '../components/fields/EntityNamePicker/EntityNamePicker';\nimport { entityNamePickerValidation } from '../components/fields/EntityNamePicker/validation';\nimport {\n EntityTagsPicker,\n EntityTagsPickerSchema,\n} from '../components/fields/EntityTagsPicker/EntityTagsPicker';\nimport {\n OwnerPicker,\n OwnerPickerSchema,\n} from '../components/fields/OwnerPicker/OwnerPicker';\nimport {\n RepoUrlPicker,\n RepoUrlPickerSchema,\n} from '../components/fields/RepoUrlPicker/RepoUrlPicker';\nimport { repoPickerValidation } from '../components/fields/RepoUrlPicker/validation';\nimport {\n OwnedEntityPicker,\n OwnedEntityPickerSchema,\n} from '../components/fields/OwnedEntityPicker/OwnedEntityPicker';\nimport {\n MyGroupsPicker,\n MyGroupsPickerSchema,\n} from '../components/fields/MyGroupsPicker/MyGroupsPicker';\n\nimport { SecretInput } from '../components/fields/SecretInput';\nimport {\n MultiEntityPicker,\n MultiEntityPickerSchema,\n validateMultiEntityPickerValidation,\n} from '../components/fields/MultiEntityPicker/MultiEntityPicker';\nimport { RepoBranchPicker } from '../components/fields/RepoBranchPicker/RepoBranchPicker';\nimport { RepoBranchPickerSchema } from '../components/fields/RepoBranchPicker/schema';\n\nexport const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [\n {\n component: EntityPicker,\n name: 'EntityPicker',\n schema: EntityPickerSchema,\n },\n {\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n schema: EntityNamePickerSchema,\n },\n {\n component: EntityTagsPicker,\n name: 'EntityTagsPicker',\n schema: EntityTagsPickerSchema,\n },\n {\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n schema: RepoUrlPickerSchema,\n },\n {\n component: OwnerPicker,\n name: 'OwnerPicker',\n schema: OwnerPickerSchema,\n },\n {\n component: OwnedEntityPicker,\n name: 'OwnedEntityPicker',\n schema: OwnedEntityPickerSchema,\n },\n {\n component: MyGroupsPicker,\n name: 'MyGroupsPicker',\n schema: MyGroupsPickerSchema,\n },\n {\n component: SecretInput,\n name: 'Secret',\n },\n {\n component: MultiEntityPicker,\n name: 'MultiEntityPicker',\n schema: MultiEntityPickerSchema,\n validation: validateMultiEntityPickerValidation,\n },\n {\n component: RepoBranchPicker,\n name: 'RepoBranchPicker',\n schema: RepoBranchPickerSchema,\n },\n];\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuDO,MAAM,mCAAsC,GAAA;AAAA,EACjD;AAAA,IACE,SAAW,EAAA,YAAA;AAAA,IACX,IAAM,EAAA,cAAA;AAAA,IACN,MAAQ,EAAA,kBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,UAAY,EAAA,0BAAA;AAAA,IACZ,MAAQ,EAAA,sBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA,sBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,aAAA;AAAA,IACX,IAAM,EAAA,eAAA;AAAA,IACN,UAAY,EAAA,oBAAA;AAAA,IACZ,MAAQ,EAAA,mBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,WAAA;AAAA,IACX,IAAM,EAAA,aAAA;AAAA,IACN,MAAQ,EAAA,iBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,iBAAA;AAAA,IACX,IAAM,EAAA,mBAAA;AAAA,IACN,MAAQ,EAAA,uBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,cAAA;AAAA,IACX,IAAM,EAAA,gBAAA;AAAA,IACN,MAAQ,EAAA,oBAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,WAAA;AAAA,IACX,IAAM,EAAA,QAAA;AAAA,GACR;AAAA,EACA;AAAA,IACE,SAAW,EAAA,iBAAA;AAAA,IACX,IAAM,EAAA,mBAAA;AAAA,IACN,MAAQ,EAAA,uBAAA;AAAA,IACR,UAAY,EAAA,mCAAA;AAAA,GACd;AAAA,EACA;AAAA,IACE,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA,sBAAA;AAAA,GACV;AACF;;;;"}
1
+ {"version":3,"file":"default.esm.js","sources":["../../src/extensions/default.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n EntityPicker,\n EntityPickerSchema,\n} from '../components/fields/EntityPicker/EntityPicker';\nimport {\n EntityNamePicker,\n EntityNamePickerSchema,\n} from '../components/fields/EntityNamePicker/EntityNamePicker';\nimport { entityNamePickerValidation } from '../components/fields/EntityNamePicker/validation';\nimport {\n EntityTagsPicker,\n EntityTagsPickerSchema,\n} from '../components/fields/EntityTagsPicker/EntityTagsPicker';\nimport {\n OwnerPicker,\n OwnerPickerSchema,\n} from '../components/fields/OwnerPicker/OwnerPicker';\nimport {\n RepoUrlPicker,\n RepoUrlPickerSchema,\n} from '../components/fields/RepoUrlPicker/RepoUrlPicker';\nimport { repoPickerValidation } from '../components/fields/RepoUrlPicker/validation';\nimport {\n OwnedEntityPicker,\n OwnedEntityPickerSchema,\n} from '../components/fields/OwnedEntityPicker/OwnedEntityPicker';\nimport {\n MyGroupsPicker,\n MyGroupsPickerSchema,\n} from '../components/fields/MyGroupsPicker/MyGroupsPicker';\n\nimport { SecretInput } from '../components/fields/SecretInput';\nimport {\n MultiEntityPicker,\n MultiEntityPickerSchema,\n validateMultiEntityPickerValidation,\n} from '../components/fields/MultiEntityPicker/MultiEntityPicker';\nimport { RepoBranchPicker } from '../components/fields/RepoBranchPicker/RepoBranchPicker';\nimport { RepoBranchPickerSchema } from '../components/fields/RepoBranchPicker/schema';\n\nexport const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [\n {\n component: EntityPicker,\n name: 'EntityPicker',\n schema: EntityPickerSchema,\n },\n {\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n schema: EntityNamePickerSchema,\n },\n {\n component: EntityTagsPicker,\n name: 'EntityTagsPicker',\n schema: EntityTagsPickerSchema,\n },\n {\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n schema: RepoUrlPickerSchema,\n },\n {\n component: OwnerPicker,\n name: 'OwnerPicker',\n schema: OwnerPickerSchema,\n },\n {\n component: OwnedEntityPicker,\n name: 'OwnedEntityPicker',\n schema: OwnedEntityPickerSchema,\n },\n {\n component: MyGroupsPicker,\n name: 'MyGroupsPicker',\n schema: MyGroupsPickerSchema,\n },\n {\n component: SecretInput,\n name: 'Secret',\n },\n {\n component: MultiEntityPicker,\n name: 'MultiEntityPicker',\n schema: MultiEntityPickerSchema,\n validation: validateMultiEntityPickerValidation,\n },\n {\n component: RepoBranchPicker,\n name: 'RepoBranchPicker',\n schema: RepoBranchPickerSchema,\n },\n];\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuDO,MAAM,mCAAsC,GAAA;AAAA,EACjD;AAAA,IACE,SAAW,EAAA,YAAA;AAAA,IACX,IAAM,EAAA,cAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,UAAY,EAAA,0BAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,aAAA;AAAA,IACX,IAAM,EAAA,eAAA;AAAA,IACN,UAAY,EAAA,oBAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,WAAA;AAAA,IACX,IAAM,EAAA,aAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,iBAAA;AAAA,IACX,IAAM,EAAA,mBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,cAAA;AAAA,IACX,IAAM,EAAA,gBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA;AAAA,IACE,SAAW,EAAA,WAAA;AAAA,IACX,IAAM,EAAA;AAAA,GACR;AAAA,EACA;AAAA,IACE,SAAW,EAAA,iBAAA;AAAA,IACX,IAAM,EAAA,mBAAA;AAAA,IACN,MAAQ,EAAA,uBAAA;AAAA,IACR,UAAY,EAAA;AAAA,GACd;AAAA,EACA;AAAA,IACE,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA;AAAA;AAEZ;;;;"}
package/dist/index.d.ts CHANGED
@@ -96,6 +96,8 @@ type RouterProps = {
96
96
  actions?: boolean;
97
97
  /** Whether to show a link to the tasks page */
98
98
  tasks?: boolean;
99
+ /** Whether to show a link to the create page (on /create subroutes) */
100
+ create?: boolean;
99
101
  };
100
102
  };
101
103
 
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.esm.js","sources":["../../../src/lib/download/helpers.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function downloadBlob(blob: Blob, name: string) {\n const a = document.createElement('a');\n a.href = URL.createObjectURL(blob);\n a.download = name;\n a.click();\n URL.revokeObjectURL(a.href);\n a.remove();\n}\n"],"names":[],"mappings":"AAgBgB,SAAA,YAAA,CAAa,MAAY,IAAc,EAAA;AACrD,EAAM,MAAA,CAAA,GAAI,QAAS,CAAA,aAAA,CAAc,GAAG,CAAA,CAAA;AACpC,EAAE,CAAA,CAAA,IAAA,GAAO,GAAI,CAAA,eAAA,CAAgB,IAAI,CAAA,CAAA;AACjC,EAAA,CAAA,CAAE,QAAW,GAAA,IAAA,CAAA;AACb,EAAA,CAAA,CAAE,KAAM,EAAA,CAAA;AACR,EAAI,GAAA,CAAA,eAAA,CAAgB,EAAE,IAAI,CAAA,CAAA;AAC1B,EAAA,CAAA,CAAE,MAAO,EAAA,CAAA;AACX;;;;"}
1
+ {"version":3,"file":"helpers.esm.js","sources":["../../../src/lib/download/helpers.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function downloadBlob(blob: Blob, name: string) {\n const a = document.createElement('a');\n a.href = URL.createObjectURL(blob);\n a.download = name;\n a.click();\n URL.revokeObjectURL(a.href);\n a.remove();\n}\n"],"names":[],"mappings":"AAgBgB,SAAA,YAAA,CAAa,MAAY,IAAc,EAAA;AACrD,EAAM,MAAA,CAAA,GAAI,QAAS,CAAA,aAAA,CAAc,GAAG,CAAA;AACpC,EAAE,CAAA,CAAA,IAAA,GAAO,GAAI,CAAA,eAAA,CAAgB,IAAI,CAAA;AACjC,EAAA,CAAA,CAAE,QAAW,GAAA,IAAA;AACb,EAAA,CAAA,CAAE,KAAM,EAAA;AACR,EAAI,GAAA,CAAA,eAAA,CAAgB,EAAE,IAAI,CAAA;AAC1B,EAAA,CAAA,CAAE,MAAO,EAAA;AACX;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WebFileSystemAccess.esm.js","sources":["../../../src/lib/filesystem/WebFileSystemAccess.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 { TemplateDirectoryAccess, TemplateFileAccess } from './types';\n\ntype WritableFileHandle = FileSystemFileHandle & {\n createWritable(): Promise<{\n write(data: string | Blob | BufferSource): Promise<void>;\n close(): Promise<void>;\n }>;\n};\n\n// A nicer type than the one from the TS lib\nexport interface IterableDirectoryHandle extends FileSystemDirectoryHandle {\n values(): AsyncIterable<\n | ({ kind: 'file' } & WritableFileHandle)\n | ({ kind: 'directory' } & IterableDirectoryHandle)\n >;\n}\n\nconst showDirectoryPicker = (window as any).showDirectoryPicker as\n | (() => Promise<IterableDirectoryHandle>)\n | undefined;\n\nclass WebFileAccess implements TemplateFileAccess {\n constructor(\n readonly path: string,\n private readonly handle: WritableFileHandle,\n ) {}\n\n file(): Promise<File> {\n return this.handle.getFile();\n }\n\n async save(data: string | Blob | BufferSource): Promise<void> {\n const writable = await this.handle.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebDirectoryAccess implements TemplateDirectoryAccess {\n constructor(private readonly handle: IterableDirectoryHandle) {}\n\n async listFiles(): Promise<TemplateFileAccess[]> {\n const content = [];\n for await (const entry of this.listDirectoryContents(this.handle)) {\n content.push(entry);\n }\n return content;\n }\n\n private async *listDirectoryContents(\n dirHandle: IterableDirectoryHandle,\n basePath: string[] = [],\n ): AsyncIterable<TemplateFileAccess> {\n for await (const handle of dirHandle.values()) {\n if (handle.kind === 'file') {\n yield new WebFileAccess([...basePath, handle.name].join('/'), handle);\n } else if (handle.kind === 'directory') {\n // Skip git storage directory\n if (handle.name === '.git') {\n continue;\n }\n yield* this.listDirectoryContents(handle, [...basePath, handle.name]);\n }\n }\n }\n\n async createFile(options: { name: string; data: string }): Promise<void> {\n const { name, data } = options;\n let file: FileSystemFileHandle;\n\n // Current create template does not require support for nested directories\n if (name.includes('/')) {\n const [dir, path] = name.split('/');\n const handle = await this.handle.getDirectoryHandle(dir, {\n create: true,\n });\n file = await handle.getFileHandle(path, { create: true });\n } else {\n file = await this.handle.getFileHandle(name, {\n create: true,\n });\n }\n const writable = await file.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebFileSystemAccess {\n static isSupported(): boolean {\n return Boolean(showDirectoryPicker);\n }\n\n static fromHandle(handle: IterableDirectoryHandle) {\n return new WebDirectoryAccess(handle);\n }\n\n static async requestDirectoryAccess(): Promise<TemplateDirectoryAccess> {\n if (!showDirectoryPicker) {\n throw new Error('File system access is not supported');\n }\n const handle = await showDirectoryPicker();\n return new WebDirectoryAccess(handle);\n }\n\n private constructor() {}\n}\n"],"names":[],"mappings":"AAiCA,MAAM,sBAAuB,MAAe,CAAA,mBAAA,CAAA;AAI5C,MAAM,aAA4C,CAAA;AAAA,EAChD,WAAA,CACW,MACQ,MACjB,EAAA;AAFS,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA,CAAA;AACQ,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AAAA,GAChB;AAAA,EAEH,IAAsB,GAAA;AACpB,IAAO,OAAA,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AAqC,CAAA,CAAA;AAAA,KACvD;AACA,IAAM,MAAA,MAAA,GAAS,MAAM,mBAAoB,EAAA,CAAA;AACzC,IAAO,OAAA,IAAI,mBAAmB,MAAM,CAAA,CAAA;AAAA,GACtC;AAAA,EAEQ,WAAc,GAAA;AAAA,GAAC;AACzB;;;;"}
1
+ {"version":3,"file":"WebFileSystemAccess.esm.js","sources":["../../../src/lib/filesystem/WebFileSystemAccess.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 { TemplateDirectoryAccess, TemplateFileAccess } from './types';\n\ntype WritableFileHandle = FileSystemFileHandle & {\n createWritable(): Promise<{\n write(data: string | Blob | BufferSource): Promise<void>;\n close(): Promise<void>;\n }>;\n};\n\n// A nicer type than the one from the TS lib\nexport interface IterableDirectoryHandle extends FileSystemDirectoryHandle {\n values(): AsyncIterable<\n | ({ kind: 'file' } & WritableFileHandle)\n | ({ kind: 'directory' } & IterableDirectoryHandle)\n >;\n}\n\nconst showDirectoryPicker = (window as any).showDirectoryPicker as\n | (() => Promise<IterableDirectoryHandle>)\n | undefined;\n\nclass WebFileAccess implements TemplateFileAccess {\n constructor(\n readonly path: string,\n private readonly handle: WritableFileHandle,\n ) {}\n\n file(): Promise<File> {\n return this.handle.getFile();\n }\n\n async save(data: string | Blob | BufferSource): Promise<void> {\n const writable = await this.handle.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebDirectoryAccess implements TemplateDirectoryAccess {\n constructor(private readonly handle: IterableDirectoryHandle) {}\n\n async listFiles(): Promise<TemplateFileAccess[]> {\n const content = [];\n for await (const entry of this.listDirectoryContents(this.handle)) {\n content.push(entry);\n }\n return content;\n }\n\n private async *listDirectoryContents(\n dirHandle: IterableDirectoryHandle,\n basePath: string[] = [],\n ): AsyncIterable<TemplateFileAccess> {\n for await (const handle of dirHandle.values()) {\n if (handle.kind === 'file') {\n yield new WebFileAccess([...basePath, handle.name].join('/'), handle);\n } else if (handle.kind === 'directory') {\n // Skip git storage directory\n if (handle.name === '.git') {\n continue;\n }\n yield* this.listDirectoryContents(handle, [...basePath, handle.name]);\n }\n }\n }\n\n async createFile(options: { name: string; data: string }): Promise<void> {\n const { name, data } = options;\n let file: FileSystemFileHandle;\n\n // Current create template does not require support for nested directories\n if (name.includes('/')) {\n const [dir, path] = name.split('/');\n const handle = await this.handle.getDirectoryHandle(dir, {\n create: true,\n });\n file = await handle.getFileHandle(path, { create: true });\n } else {\n file = await this.handle.getFileHandle(name, {\n create: true,\n });\n }\n const writable = await file.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebFileSystemAccess {\n static isSupported(): boolean {\n return Boolean(showDirectoryPicker);\n }\n\n static fromHandle(handle: IterableDirectoryHandle) {\n return new WebDirectoryAccess(handle);\n }\n\n static async requestDirectoryAccess(): Promise<TemplateDirectoryAccess> {\n if (!showDirectoryPicker) {\n throw new Error('File system access is not supported');\n }\n const handle = await showDirectoryPicker();\n return new WebDirectoryAccess(handle);\n }\n\n private constructor() {}\n}\n"],"names":[],"mappings":"AAiCA,MAAM,sBAAuB,MAAe,CAAA,mBAAA;AAI5C,MAAM,aAA4C,CAAA;AAAA,EAChD,WAAA,CACW,MACQ,MACjB,EAAA;AAFS,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACQ,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA;AAChB,EAEH,IAAsB,GAAA;AACpB,IAAO,OAAA,IAAA,CAAK,OAAO,OAAQ,EAAA;AAAA;AAC7B,EAEA,MAAM,KAAK,I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\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 { get, set } from 'idb-keyval';\nimport { TemplateDirectoryAccess } from './types';\nimport { IterableDirectoryHandle } from './WebFileSystemAccess';\n\nexport class WebFileSystemStore {\n private static readonly key = 'scalfolder-template-editor-directory';\n\n static async getDirectory(): Promise<IterableDirectoryHandle | undefined> {\n const directory = await get(WebFileSystemStore.key);\n return directory.handle;\n }\n\n static async setDirectory(directory: TemplateDirectoryAccess | undefined) {\n return set(WebFileSystemStore.key, directory);\n }\n}\n"],"names":[],"mappings":";;AAoBO,MAAM,kBAAmB,CAAA;AAAA,EAC9B,OAAwB,GAAM,GAAA,sCAAA,CAAA;AAAA,EAE9B,aAAa,YAA6D,GAAA;AACxE,IAAA,MAAM,SAAY,GAAA,MAAM,GAAI,CAAA,kBAAA,CAAmB,GAAG,CAAA,CAAA;AAClD,IAAA,OAAO,SAAU,CAAA,MAAA,CAAA;AAAA,GACnB;AAAA,EAEA,aAAa,aAAa,SAAgD,EAAA;AACxE,IAAO,OAAA,GAAA,CAAI,kBAAmB,CAAA,GAAA,EAAK,SAAS,CAAA,CAAA;AAAA,GAC9C;AACF;;;;"}
1
+ {"version":3,"file":"WebFileSystemStore.esm.js","sources":["../../../src/lib/filesystem/WebFileSystemStore.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 { get, set } from 'idb-keyval';\nimport { TemplateDirectoryAccess } from './types';\nimport { IterableDirectoryHandle } from './WebFileSystemAccess';\n\nexport class WebFileSystemStore {\n private static readonly key = 'scalfolder-template-editor-directory';\n\n static async getDirectory(): Promise<IterableDirectoryHandle | undefined> {\n const directory = await get(WebFileSystemStore.key);\n return directory.handle;\n }\n\n static async setDirectory(directory: TemplateDirectoryAccess | undefined) {\n return set(WebFileSystemStore.key, directory);\n }\n}\n"],"names":[],"mappings":";;AAoBO,MAAM,kBAAmB,CAAA;AAAA,EAC9B,OAAwB,GAAM,GAAA,sCAAA;AAAA,EAE9B,aAAa,YAA6D,GAAA;AACxE,IAAA,MAAM,SAAY,GAAA,MAAM,GAAI,CAAA,kBAAA,CAAmB,GAAG,CAAA;AAClD,IAAA,OAAO,SAAU,CAAA,MAAA;AAAA;AACnB,EAEA,aAAa,aAAa,SAAgD,EAAA;AACxE,IAAO,OAAA,GAAA,CAAI,kBAAmB,CAAA,GAAA,EAAK,SAAS,CAAA;AAAA;AAEhD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createExampleTemplate.esm.js","sources":["../../../src/lib/filesystem/createExampleTemplate.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 { TemplateDirectoryAccess } from './types';\n\nconst files = {\n 'template.yaml': `\napiVersion: scaffolder.backstage.io/v1beta3\n# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template\nkind: Template\nmetadata:\n name: generated-example-template\n title: Scaffolder Example Template\n description: An example template for the scaffolder\nspec:\n owner: user:guest\n type: service\n # These parameters are used to generate the input form in the frontend, and are\n # used to gather input data for the execution of the template.\n parameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\n steps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./skeleton\n values:\n name: \\${{parameters.name}}\n owner: \\${{parameters.owner}}\n destination: \\${{ parameters.repoUrl | parseRepoUrl }}`,\n 'skeleton/README.md': `# This service is named \\${{values.name}}!`,\n 'skeleton/catalog-info.yaml': `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: \\${{values.component_id | dump}}\n {%- if values.description %}\n description: \\${{values.description | dump}}\n {%- endif %}\n annotations:\n github.com/project-slug: \\${{values.destination.owner + \"/\" + values.destination.repo}}\n backstage.io/techdocs-ref: dir:.\nspec:\n type: service\n lifecycle: experimental\n owner: \\${{values.owner | dump}}`,\n};\n\nexport async function createExampleTemplate(\n directory: TemplateDirectoryAccess,\n) {\n for (const [name, data] of Object.entries(files)) {\n await directory.createFile({ name, data });\n }\n return directory;\n}\n"],"names":[],"mappings":"AAkBA,MAAM,KAAQ,GAAA;AAAA,EACZ,eAAiB,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gEAAA,CAAA;AAAA,EAmDjB,oBAAsB,EAAA,CAAA,0CAAA,CAAA;AAAA,EACtB,4BAA8B,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAA,CAAA;AAchC,CAAA,CAAA;AAEA,eAAsB,sBACpB,SACA,EAAA;AACA,EAAA,KAAA,MAAW,CAAC,IAAM,EAAA,IAAI,KAAK,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA;AAChD,IAAA,MAAM,SAAU,CAAA,UAAA,CAAW,EAAE,IAAA,EAAM,MAAM,CAAA,CAAA;AAAA,GAC3C;AACA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"createExampleTemplate.esm.js","sources":["../../../src/lib/filesystem/createExampleTemplate.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 { TemplateDirectoryAccess } from './types';\n\nconst files = {\n 'template.yaml': `\napiVersion: scaffolder.backstage.io/v1beta3\n# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template\nkind: Template\nmetadata:\n name: generated-example-template\n title: Scaffolder Example Template\n description: An example template for the scaffolder\nspec:\n owner: user:guest\n type: service\n # These parameters are used to generate the input form in the frontend, and are\n # used to gather input data for the execution of the template.\n parameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\n steps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./skeleton\n values:\n name: \\${{parameters.name}}\n owner: \\${{parameters.owner}}\n destination: \\${{ parameters.repoUrl | parseRepoUrl }}`,\n 'skeleton/README.md': `# This service is named \\${{values.name}}!`,\n 'skeleton/catalog-info.yaml': `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: \\${{values.component_id | dump}}\n {%- if values.description %}\n description: \\${{values.description | dump}}\n {%- endif %}\n annotations:\n github.com/project-slug: \\${{values.destination.owner + \"/\" + values.destination.repo}}\n backstage.io/techdocs-ref: dir:.\nspec:\n type: service\n lifecycle: experimental\n owner: \\${{values.owner | dump}}`,\n};\n\nexport async function createExampleTemplate(\n directory: TemplateDirectoryAccess,\n) {\n for (const [name, data] of Object.entries(files)) {\n await directory.createFile({ name, data });\n }\n return directory;\n}\n"],"names":[],"mappings":"AAkBA,MAAM,KAAQ,GAAA;AAAA,EACZ,eAAiB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gEAAA,CAAA;AAAA,EAmDjB,oBAAsB,EAAA,CAAA,0CAAA,CAAA;AAAA,EACtB,4BAA8B,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAA;AAchC,CAAA;AAEA,eAAsB,sBACpB,SACA,EAAA;AACA,EAAA,KAAA,MAAW,CAAC,IAAM,EAAA,IAAI,KAAK,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA;AAChD,IAAA,MAAM,SAAU,CAAA,UAAA,CAAW,EAAE,IAAA,EAAM,MAAM,CAAA;AAAA;AAE3C,EAAO,OAAA,SAAA;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,CAAA;AAAA,GAClE;AAAA,EAEA,KAAA,CAAA;AAAA,EACA,SAAA,CAAA;AAAA,EAEQ,WAAA,CAAY,MAAc,QAAmC,EAAA;AACnE,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAA,CAAA;AACb,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AAAA,GACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAuB,GAAA,KAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvB,SAAyC,GAAA,KAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzC,MAAA,GAAS,CAAC,KAAyC,KAAA;AACjD,IAAO,OAAA,IAAA,CAAK,oBAAoB,KAAK,CAAA,CAAA;AAAA,GACvC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAAA,GAAa,CAAC,KAAgD,KAAA;AAC5D,IAAA,IAAI,CAAC,IAAA,CAAK,mBAAoB,CAAA,KAAK,CAAG,EAAA;AACpC,MAAA,MAAM,IAAI,SAAA;AAAA,QACR,kCACE,I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O,OAAA,KAAA,CAAA;AAAA,KACT;AACA,IAAQ,OAAA,KAAA,CAAsB,WAAW,IAAK,CAAA,KAAA,CAAA;AAAA,GAChD;AAAA,EAEA,kBAAkB,KAAgB,EAAA;AAChC,IAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,MAAO,OAAA,CAAA,CAAA,EAAI,OAAO,KAAK,CAAA,CAAA,CAAA,CAAA;AAAA,KACzB;AACA,IAAA,IAAI,UAAU,IAAM,EAAA;AAClB,MAAO,OAAA,QAAA,CAAA;AAAA,KACT;AACA,IAAA,IAAI,YAAY,KAAO,EAAA;AACrB,MAAO,OAAA,MAAA,CAAO,MAAM,MAAM,CAAA,CAAA;AAAA,KAC5B;AACA,IAAA,OAAO,OAAO,KAAK,CAAA,CAAA;AAAA,GACrB;AAAA,EAEA,iBAAA,GAAoB,CAAC,OAAgC,KAAA;AACnD,IAAO,OAAA,OAAA,GAAU,CAAI,CAAA,EAAA,OAAO,CAAM,CAAA,CAAA,GAAA,WAAA,CAAA;AAAA,GACpC,CAAA;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,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;AAAA,EAEQ,WAAA,CAAY,MAAc,QAAmC,EAAA;AACnE,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAA;AACb,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA;AAAA;AACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAuB,GAAA,KAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvB,SAAyC,GAAA,KAAA,CAAA;AAAA;AAAA;AAAA;A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,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 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport {\n createScaffolderFieldExtension,\n scaffolderApiRef,\n} from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from './api';\nimport {\n EntityPicker,\n EntityPickerSchema,\n} from './components/fields/EntityPicker/EntityPicker';\nimport { entityNamePickerValidation } from './components/fields/EntityNamePicker';\nimport {\n EntityNamePicker,\n EntityNamePickerSchema,\n} from './components/fields/EntityNamePicker/EntityNamePicker';\nimport {\n OwnerPicker,\n OwnerPickerSchema,\n} from './components/fields/OwnerPicker/OwnerPicker';\nimport {\n MultiEntityPicker,\n MultiEntityPickerSchema,\n validateMultiEntityPickerValidation,\n} from './components/fields/MultiEntityPicker/MultiEntityPicker';\nimport { repoPickerValidation } from './components/fields/RepoUrlPicker';\nimport {\n RepoUrlPicker,\n RepoUrlPickerSchema,\n} from './components/fields/RepoUrlPicker/RepoUrlPicker';\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n OwnedEntityPicker,\n OwnedEntityPickerSchema,\n} from './components/fields/OwnedEntityPicker/OwnedEntityPicker';\nimport {\n EntityTagsPicker,\n EntityTagsPickerSchema,\n} from './components/fields/EntityTagsPicker/EntityTagsPicker';\nimport {\n registerComponentRouteRef,\n rootRouteRef,\n viewTechDocRouteRef,\n selectedTemplateRouteRef,\n scaffolderTaskRouteRef,\n scaffolderListTaskRouteRef,\n actionsRouteRef,\n editRouteRef,\n editorRouteRef,\n customFieldsRouteRef,\n templateFormRouteRef,\n} from './routes';\nimport {\n MyGroupsPicker,\n MyGroupsPickerSchema,\n} from './components/fields/MyGroupsPicker/MyGroupsPicker';\nimport { RepoBranchPicker } from './components/fields/RepoBranchPicker/RepoBranchPicker';\nimport { RepoBranchPickerSchema } from './components/fields/RepoBranchPicker/schema';\n\n/**\n * The main plugin export for the scaffolder.\n * @public\n */\nexport const scaffolderPlugin = createPlugin({\n id: 'scaffolder',\n apis: [\n 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 routes: {\n root: rootRouteRef,\n selectedTemplate: selectedTemplateRouteRef,\n ongoingTask: scaffolderTaskRouteRef,\n actions: actionsRouteRef,\n listTasks: scaffolderListTaskRouteRef,\n edit: editRouteRef,\n editor: editorRouteRef,\n customFields: customFieldsRouteRef,\n templateForm: templateFormRouteRef,\n },\n externalRoutes: {\n registerComponent: registerComponentRouteRef,\n viewTechDoc: viewTechDocRouteRef,\n },\n});\n\n/**\n * A field extension for selecting an Entity that exists in the Catalog.\n *\n * @public\n */\nexport const EntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityPicker,\n name: 'EntityPicker',\n schema: EntityPickerSchema,\n }),\n);\n\n/**\n * The field extension for selecting a name for a new Entity in the Catalog.\n *\n * @public\n */\nexport const EntityNamePickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n schema: EntityNamePickerSchema,\n }),\n);\n\n/**\n * A field extension for selecting multiple entities that exists in the Catalog.\n *\n * @public\n */\nexport const MultiEntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: MultiEntityPicker,\n name: 'MultiEntityPicker',\n schema: MultiEntityPickerSchema,\n validation: validateMultiEntityPickerValidation,\n }),\n);\n\n/**\n * The field extension which provides the ability to select a RepositoryUrl.\n * Currently, this is an encoded URL that looks something like the following `github.com?repo=myRepoName&owner=backstage`.\n *\n * @public\n */\nexport const RepoUrlPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n schema: RepoUrlPickerSchema,\n }),\n);\n\n/**\n * A field extension for picking users and groups out of the Catalog.\n *\n * @public\n */\nexport const OwnerPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: OwnerPicker,\n name: 'OwnerPicker',\n schema: OwnerPickerSchema,\n }),\n);\n\n/**\n * A field extension for picking groups a user belongs to out of the catalog.\n *\n * @public\n */\nexport const MyGroupsPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: MyGroupsPicker,\n name: 'MyGroupsPicker',\n schema: MyGroupsPickerSchema,\n }),\n);\n\n/**\n * The Router and main entrypoint to the Scaffolder plugin.\n *\n * @public\n */\nexport const ScaffolderPage = scaffolderPlugin.provide(\n createRoutableExtension({\n name: 'ScaffolderPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * A field extension to show all the Entities that are owned by the current logged-in User for use in templates.\n *\n * @public\n */\nexport const OwnedEntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: OwnedEntityPicker,\n name: 'OwnedEntityPicker',\n schema: OwnedEntityPickerSchema,\n }),\n);\n\n/**\n * EntityTagsPickerFieldExtension\n * @public\n */\nexport const EntityTagsPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityTagsPicker,\n name: 'EntityTagsPicker',\n schema: EntityTagsPickerSchema,\n }),\n);\n\n/**\n * A field extension to select a branch from a repository.\n *\n * @public\n */\nexport const RepoBranchPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: RepoBranchPicker,\n name: 'RepoBranchPicker',\n schema: RepoBranchPickerSchema,\n }),\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAA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;AACH,EAAA;AAMO,MAAM,iCAAiC,gBAAiB,CAAA,OAAA;AAAA,EAC7D,8BAA+B,CAAA;AAAA,IAC7B,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA,sBAAA;AAAA,GACT,CAAA;AACH,EAAA;AAOO,MAAM,iCAAiC,gBAAiB,CAAA,OAAA;AAAA,EAC7D,8BAA+B,CAAA;AAAA,IAC7B,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA,sBAAA;AAAA,GACT,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport {\n createScaffolderFieldExtension,\n scaffolderApiRef,\n} from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from './api';\nimport {\n EntityPicker,\n EntityPickerSchema,\n} from './components/fields/EntityPicker/EntityPicker';\nimport { entityNamePickerValidation } from './components/fields/EntityNamePicker';\nimport {\n EntityNamePicker,\n EntityNamePickerSchema,\n} from './components/fields/EntityNamePicker/EntityNamePicker';\nimport {\n OwnerPicker,\n OwnerPickerSchema,\n} from './components/fields/OwnerPicker/OwnerPicker';\nimport {\n MultiEntityPicker,\n MultiEntityPickerSchema,\n validateMultiEntityPickerValidation,\n} from './components/fields/MultiEntityPicker/MultiEntityPicker';\nimport { repoPickerValidation } from './components/fields/RepoUrlPicker';\nimport {\n RepoUrlPicker,\n RepoUrlPickerSchema,\n} from './components/fields/RepoUrlPicker/RepoUrlPicker';\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n OwnedEntityPicker,\n OwnedEntityPickerSchema,\n} from './components/fields/OwnedEntityPicker/OwnedEntityPicker';\nimport {\n EntityTagsPicker,\n EntityTagsPickerSchema,\n} from './components/fields/EntityTagsPicker/EntityTagsPicker';\nimport {\n registerComponentRouteRef,\n rootRouteRef,\n viewTechDocRouteRef,\n selectedTemplateRouteRef,\n scaffolderTaskRouteRef,\n scaffolderListTaskRouteRef,\n actionsRouteRef,\n editRouteRef,\n editorRouteRef,\n customFieldsRouteRef,\n templateFormRouteRef,\n} from './routes';\nimport {\n MyGroupsPicker,\n MyGroupsPickerSchema,\n} from './components/fields/MyGroupsPicker/MyGroupsPicker';\nimport { RepoBranchPicker } from './components/fields/RepoBranchPicker/RepoBranchPicker';\nimport { RepoBranchPickerSchema } from './components/fields/RepoBranchPicker/schema';\n\n/**\n * The main plugin export for the scaffolder.\n * @public\n */\nexport const scaffolderPlugin = createPlugin({\n id: 'scaffolder',\n apis: [\n 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 routes: {\n root: rootRouteRef,\n selectedTemplate: selectedTemplateRouteRef,\n ongoingTask: scaffolderTaskRouteRef,\n actions: actionsRouteRef,\n listTasks: scaffolderListTaskRouteRef,\n edit: editRouteRef,\n editor: editorRouteRef,\n customFields: customFieldsRouteRef,\n templateForm: templateFormRouteRef,\n },\n externalRoutes: {\n registerComponent: registerComponentRouteRef,\n viewTechDoc: viewTechDocRouteRef,\n },\n});\n\n/**\n * A field extension for selecting an Entity that exists in the Catalog.\n *\n * @public\n */\nexport const EntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityPicker,\n name: 'EntityPicker',\n schema: EntityPickerSchema,\n }),\n);\n\n/**\n * The field extension for selecting a name for a new Entity in the Catalog.\n *\n * @public\n */\nexport const EntityNamePickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n schema: EntityNamePickerSchema,\n }),\n);\n\n/**\n * A field extension for selecting multiple entities that exists in the Catalog.\n *\n * @public\n */\nexport const MultiEntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: MultiEntityPicker,\n name: 'MultiEntityPicker',\n schema: MultiEntityPickerSchema,\n validation: validateMultiEntityPickerValidation,\n }),\n);\n\n/**\n * The field extension which provides the ability to select a RepositoryUrl.\n * Currently, this is an encoded URL that looks something like the following `github.com?repo=myRepoName&owner=backstage`.\n *\n * @public\n */\nexport const RepoUrlPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n schema: RepoUrlPickerSchema,\n }),\n);\n\n/**\n * A field extension for picking users and groups out of the Catalog.\n *\n * @public\n */\nexport const OwnerPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: OwnerPicker,\n name: 'OwnerPicker',\n schema: OwnerPickerSchema,\n }),\n);\n\n/**\n * A field extension for picking groups a user belongs to out of the catalog.\n *\n * @public\n */\nexport const MyGroupsPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: MyGroupsPicker,\n name: 'MyGroupsPicker',\n schema: MyGroupsPickerSchema,\n }),\n);\n\n/**\n * The Router and main entrypoint to the Scaffolder plugin.\n *\n * @public\n */\nexport const ScaffolderPage = scaffolderPlugin.provide(\n createRoutableExtension({\n name: 'ScaffolderPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * A field extension to show all the Entities that are owned by the current logged-in User for use in templates.\n *\n * @public\n */\nexport const OwnedEntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: OwnedEntityPicker,\n name: 'OwnedEntityPicker',\n schema: OwnedEntityPickerSchema,\n }),\n);\n\n/**\n * EntityTagsPickerFieldExtension\n * @public\n */\nexport const EntityTagsPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityTagsPicker,\n name: 'EntityTagsPicker',\n schema: EntityTagsPickerSchema,\n }),\n);\n\n/**\n * A field extension to select a branch from a repository.\n *\n * @public\n */\nexport const RepoBranchPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: RepoBranchPicker,\n name: 'RepoBranchPicker',\n schema: RepoBranchPickerSchema,\n }),\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,kBAAoB,EAAA,qBAAA;AAAA,QACpB,QAAU,EAAA,WAAA;AAAA,QACV,WAAa,EAAA;AAAA,OACf;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,oBAAoB,QAAU,EAAA,WAAA,EACtD,KAAA,IAAI,gBAAiB,CAAA;AAAA,QACnB,YAAA;AAAA,QACA,kBAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA,OACD;AAAA,KACJ;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;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EAAA,aAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACT;AACH;AAOO,MAAM,+BAA+B,gBAAiB,CAAA,OAAA;AAAA,EAC3D,8BAA+B,CAAA;AAAA,IAC7B,SAAW,EAAA,cAAA;AAAA,IACX,IAAM,EAAA,gBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACT;AACH;AAOO,MAAM,iBAAiB,gBAAiB,CAAA,OAAA;AAAA,EAC7C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,kCAAqB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACjE,UAAY,EAAA;AAAA,GACb;AACH;AAOO,MAAM,kCAAkC,gBAAiB,CAAA,OAAA;AAAA,EAC9D,8BAA+B,CAAA;AAAA,IAC7B,SAAW,EAAA,iBAAA;AAAA,IACX,IAAM,EAAA,mBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACT;AACH;AAMO,MAAM,iCAAiC,gBAAiB,CAAA,OAAA;AAAA,EAC7D,8BAA+B,CAAA;AAAA,IAC7B,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACT;AACH;AAOO,MAAM,iCAAiC,gBAAiB,CAAA,OAAA;AAAA,EAC7D,8BAA+B,CAAA;AAAA,IAC7B,SAAW,EAAA,gBAAA;AAAA,IACX,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACT;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExternalRouteRef,\n createRouteRef,\n createSubRouteRef,\n} from '@backstage/core-plugin-api';\n\nexport const registerComponentRouteRef = createExternalRouteRef({\n id: 'register-component',\n optional: true,\n defaultTarget: 'catalog-import.importPage',\n});\n\nexport const viewTechDocRouteRef = createExternalRouteRef({\n id: 'view-techdoc',\n optional: true,\n params: ['namespace', 'kind', 'name'],\n defaultTarget: 'techdocs.docRoot',\n});\n\n/**\n * @public\n */\nexport const rootRouteRef = createRouteRef({\n id: 'scaffolder',\n});\n\n/**\n * @deprecated This is the old template route, can be deleted before next major release\n * @public\n */\nexport const legacySelectedTemplateRouteRef = createSubRouteRef({\n id: 'scaffolder/legacy/selected-template',\n parent: rootRouteRef,\n path: '/templates/:templateName',\n});\n\nexport const selectedTemplateRouteRef = createSubRouteRef({\n id: 'scaffolder/selected-template',\n parent: rootRouteRef,\n path: '/templates/:namespace/:templateName',\n});\n\nexport const scaffolderTaskRouteRef = createSubRouteRef({\n id: 'scaffolder/task',\n parent: rootRouteRef,\n path: '/tasks/:taskId',\n});\n\nexport const scaffolderListTaskRouteRef = createSubRouteRef({\n id: 'scaffolder/list-tasks',\n parent: rootRouteRef,\n path: '/tasks',\n});\n\nexport const actionsRouteRef = createSubRouteRef({\n id: 'scaffolder/actions',\n parent: rootRouteRef,\n path: '/actions',\n});\n\nexport const editRouteRef = createSubRouteRef({\n id: 'scaffolder/edit',\n parent: rootRouteRef,\n path: '/edit',\n});\n\nexport const editorRouteRef = createSubRouteRef({\n id: 'scaffolder/editor',\n parent: rootRouteRef,\n path: '/template',\n});\n\nexport const customFieldsRouteRef = createSubRouteRef({\n id: 'scaffolder/customFields',\n parent: rootRouteRef,\n path: '/custom-fields',\n});\n\nexport const templateFormRouteRef = createSubRouteRef({\n id: 'scaffolder/editorForm',\n parent: rootRouteRef,\n path: '/template-form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A;AAAA,EACJ,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA,OAAA;AACR,CAAC,EAAA;AAEM,MAAM,iBAAiB,iBAAkB,CAAA;AAAA,EAC9C,EAAI,EAAA,mBAAA;AAAA,EACJ,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA,WAAA;AACR,CAAC,EAAA;AAEM,MAAM,uBAAuB,iBAAkB,CAAA;AAAA,EACpD,EAAI,EAAA,yBAAA;AAAA,EACJ,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA,gBAAA;AACR,CAAC,EAAA;AAEM,MAAM,uBAAuB,iBAAkB,CAAA;AAAA,EACpD,EAAI,EAAA,uBAAA;AAAA,EACJ,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA,gBAAA;AACR,CAAC;;;;"}
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExternalRouteRef,\n createRouteRef,\n createSubRouteRef,\n} from '@backstage/core-plugin-api';\n\nexport const registerComponentRouteRef = createExternalRouteRef({\n id: 'register-component',\n optional: true,\n defaultTarget: 'catalog-import.importPage',\n});\n\nexport const viewTechDocRouteRef = createExternalRouteRef({\n id: 'view-techdoc',\n optional: true,\n params: ['namespace', 'kind', 'name'],\n defaultTarget: 'techdocs.docRoot',\n});\n\n/**\n * @public\n */\nexport const rootRouteRef = createRouteRef({\n id: 'scaffolder',\n});\n\n/**\n * @deprecated This is the old template route, can be deleted before next major release\n * @public\n */\nexport const legacySelectedTemplateRouteRef = createSubRouteRef({\n id: 'scaffolder/legacy/selected-template',\n parent: rootRouteRef,\n path: '/templates/:templateName',\n});\n\nexport const selectedTemplateRouteRef = createSubRouteRef({\n id: 'scaffolder/selected-template',\n parent: rootRouteRef,\n path: '/templates/:namespace/:templateName',\n});\n\nexport const scaffolderTaskRouteRef = createSubRouteRef({\n id: 'scaffolder/task',\n parent: rootRouteRef,\n path: '/tasks/:taskId',\n});\n\nexport const scaffolderListTaskRouteRef = createSubRouteRef({\n id: 'scaffolder/list-tasks',\n parent: rootRouteRef,\n path: '/tasks',\n});\n\nexport const actionsRouteRef = createSubRouteRef({\n id: 'scaffolder/actions',\n parent: rootRouteRef,\n path: '/actions',\n});\n\nexport const editRouteRef = createSubRouteRef({\n id: 'scaffolder/edit',\n parent: rootRouteRef,\n path: '/edit',\n});\n\nexport const editorRouteRef = createSubRouteRef({\n id: 'scaffolder/editor',\n parent: rootRouteRef,\n path: '/template',\n});\n\nexport const customFieldsRouteRef = createSubRouteRef({\n id: 'scaffolder/customFields',\n parent: rootRouteRef,\n path: '/custom-fields',\n});\n\nexport const templateFormRouteRef = createSubRouteRef({\n id: 'scaffolder/editorForm',\n parent: rootRouteRef,\n path: '/template-form',\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,4BAA4B,sBAAuB,CAAA;AAAA,EAC9D,EAAI,EAAA,oBAAA;AAAA,EACJ,QAAU,EAAA,IAAA;AAAA,EACV,aAAe,EAAA;AACjB,CAAC;AAEM,MAAM,sBAAsB,sBAAuB,CAAA;AAAA,EACxD,EAAI,EAAA,cAAA;AAAA,EACJ,QAAU,EAAA,IAAA;AAAA,EACV,MAAQ,EAAA,CAAC,WAAa,EAAA,MAAA,EAAQ,MAAM,CAAA;AAAA,EACpC,aAAe,EAAA;AACjB,CAAC;AAKM,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;AAM6C,iBAAkB,CAAA;AAAA,EAC9D,EAAI,EAAA,qCAAA;AA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