@backstage/plugin-scaffolder-backend 1.26.3-next.0 → 1.27.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/alpha/package.json +1 -1
- package/dist/ScaffolderPlugin.cjs.js.map +1 -1
- package/dist/deprecated.cjs.js.map +1 -1
- package/dist/lib/templating/SecureTemplater.cjs.js.map +1 -1
- package/dist/lib/templating/filters.cjs.js.map +1 -1
- package/dist/lib/templating/helpers.cjs.js.map +1 -1
- package/dist/scaffolder/actions/TemplateActionRegistry.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/catalog/fetch.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/catalog/fetch.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/catalog/register.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/catalog/register.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/catalog/write.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/catalog/write.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/debug/log.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/debug/log.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/debug/wait.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/debug/wait.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/plain.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/plain.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/plainFile.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/plainFile.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/template.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/template.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/templateFile.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/fetch/templateFile.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/filesystem/delete.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/filesystem/delete.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/filesystem/rename.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/filesystem/rename.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/deprecated.cjs.js.map +1 -1
- package/dist/scaffolder/dryrun/DecoratedActionsRegistry.cjs.js.map +1 -1
- package/dist/scaffolder/dryrun/createDryRunner.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/DatabaseTaskStore.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/DatabaseWorkspaceProvider.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/NunjucksWorkflowRunner.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/StorageTaskBroker.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/TaskWorker.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/WorkspaceService.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/dbUtil.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/helper.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/logger.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/taskRecoveryHelper.cjs.js.map +1 -1
- package/dist/service/conditionExports.cjs.js.map +1 -1
- package/dist/service/helpers.cjs.js.map +1 -1
- package/dist/service/router.cjs.js.map +1 -1
- package/dist/service/rules.cjs.js.map +1 -1
- package/dist/util/checkPermissions.cjs.js.map +1 -1
- package/dist/util/metrics.cjs.js.map +1 -1
- package/package.json +23 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.27.0-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/catalog-client@1.8.0-next.1
|
|
9
|
+
- @backstage/backend-defaults@0.5.3-next.2
|
|
10
|
+
- @backstage/plugin-auth-node@0.5.4-next.2
|
|
11
|
+
- @backstage/plugin-catalog-node@1.14.0-next.2
|
|
12
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.5.2-next.2
|
|
13
|
+
- @backstage/backend-plugin-api@1.0.2-next.2
|
|
14
|
+
- @backstage/catalog-model@1.7.0
|
|
15
|
+
- @backstage/config@1.2.0
|
|
16
|
+
- @backstage/errors@1.2.4
|
|
17
|
+
- @backstage/integration@1.15.1
|
|
18
|
+
- @backstage/types@1.1.1
|
|
19
|
+
- @backstage/plugin-bitbucket-cloud-common@0.2.24
|
|
20
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.2.2-next.2
|
|
21
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
22
|
+
- @backstage/plugin-permission-node@0.8.5-next.2
|
|
23
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.2.2-next.2
|
|
24
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.3.2-next.2
|
|
25
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.2.2-next.2
|
|
26
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.2.2-next.2
|
|
27
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.2.2-next.2
|
|
28
|
+
- @backstage/plugin-scaffolder-backend-module-gitea@0.2.2-next.2
|
|
29
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.6.1-next.2
|
|
30
|
+
- @backstage/plugin-scaffolder-common@1.5.6
|
|
31
|
+
- @backstage/plugin-scaffolder-node@0.5.1-next.2
|
|
32
|
+
|
|
33
|
+
## 1.27.0-next.1
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- 0587633: Bumped the `isolated-vm` dependency from v4 to v5, which drops support for Node.js v16.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.2.2-next.1
|
|
43
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.2.2-next.1
|
|
44
|
+
- @backstage/backend-defaults@0.5.3-next.1
|
|
45
|
+
- @backstage/backend-plugin-api@1.0.2-next.1
|
|
46
|
+
- @backstage/catalog-client@1.8.0-next.0
|
|
47
|
+
- @backstage/catalog-model@1.7.0
|
|
48
|
+
- @backstage/config@1.2.0
|
|
49
|
+
- @backstage/errors@1.2.4
|
|
50
|
+
- @backstage/integration@1.15.1
|
|
51
|
+
- @backstage/types@1.1.1
|
|
52
|
+
- @backstage/plugin-auth-node@0.5.4-next.1
|
|
53
|
+
- @backstage/plugin-bitbucket-cloud-common@0.2.24
|
|
54
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.2.2-next.1
|
|
55
|
+
- @backstage/plugin-catalog-node@1.14.0-next.1
|
|
56
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
57
|
+
- @backstage/plugin-permission-node@0.8.5-next.1
|
|
58
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.2.2-next.1
|
|
59
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.3.2-next.1
|
|
60
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.2.2-next.1
|
|
61
|
+
- @backstage/plugin-scaffolder-backend-module-gitea@0.2.2-next.1
|
|
62
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.5.2-next.1
|
|
63
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.6.1-next.1
|
|
64
|
+
- @backstage/plugin-scaffolder-common@1.5.6
|
|
65
|
+
- @backstage/plugin-scaffolder-node@0.5.1-next.1
|
|
66
|
+
|
|
3
67
|
## 1.26.3-next.0
|
|
4
68
|
|
|
5
69
|
### Patch Changes
|
package/alpha/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaffolderPlugin.cjs.js","sources":["../src/ScaffolderPlugin.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 {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n AutocompleteHandler,\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n scaffolderWorkspaceProviderExtensionPoint,\n WorkspaceProvider,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createDebugLogAction,\n createFetchCatalogEntityAction,\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n createWaitAction,\n} from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @public\n */\nexport const scaffolderPlugin = createBackendPlugin({\n pluginId: 'scaffolder',\n register(env) {\n const addedActions = new Array<TemplateAction<any, any>>();\n env.registerExtensionPoint(scaffolderActionsExtensionPoint, {\n addActions(...newActions: TemplateAction<any>[]) {\n addedActions.push(...newActions);\n },\n });\n\n let taskBroker: TaskBroker | undefined;\n env.registerExtensionPoint(scaffolderTaskBrokerExtensionPoint, {\n setTaskBroker(newTaskBroker) {\n if (taskBroker) {\n throw new Error('Task broker may only be set once');\n }\n taskBroker = newTaskBroker;\n },\n });\n\n const additionalTemplateFilters: Record<string, TemplateFilter> = {};\n const additionalTemplateGlobals: Record<string, TemplateGlobal> = {};\n env.registerExtensionPoint(scaffolderTemplatingExtensionPoint, {\n addTemplateFilters(newFilters) {\n Object.assign(additionalTemplateFilters, newFilters);\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(additionalTemplateGlobals, newGlobals);\n },\n });\n\n const autocompleteHandlers: Record<string, AutocompleteHandler> = {};\n env.registerExtensionPoint(scaffolderAutocompleteExtensionPoint, {\n addAutocompleteProvider(provider) {\n autocompleteHandlers[provider.id] = provider.handler;\n },\n });\n\n const additionalWorkspaceProviders: Record<string, WorkspaceProvider> = {};\n env.registerExtensionPoint(scaffolderWorkspaceProviderExtensionPoint, {\n addProviders(provider) {\n Object.assign(additionalWorkspaceProviders, provider);\n },\n });\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n lifecycle: coreServices.rootLifecycle,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n auth: coreServices.auth,\n discovery: coreServices.discovery,\n httpRouter: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n catalogClient: catalogServiceRef,\n },\n async init({\n logger,\n config,\n lifecycle,\n reader,\n database,\n auth,\n discovery,\n httpRouter,\n httpAuth,\n catalogClient,\n permissions,\n }) {\n const log = loggerToWinstonLogger(logger);\n const integrations = ScmIntegrations.fromConfig(config);\n\n const actions = [\n // actions provided from other modules\n ...addedActions,\n\n // built-in actions for the scaffolder\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createDebugLogAction(),\n createWaitAction(),\n // todo(blam): maybe these should be a -catalog module?\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n ];\n\n const actionIds = actions.map(action => action.id).join(', ');\n\n log.info(\n `Starting scaffolder with the following actions enabled ${actionIds}`,\n );\n\n const router = await createRouter({\n logger: log,\n config,\n database,\n catalogClient,\n reader,\n lifecycle,\n actions,\n taskBroker,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n auth,\n httpAuth,\n discovery,\n permissions,\n autocompleteHandlers,\n additionalWorkspaceProviders,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","scaffolderAutocompleteExtensionPoint","scaffolderWorkspaceProviderExtensionPoint","coreServices","catalogServiceRef","log","loggerToWinstonLogger","ScmIntegrations","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DO,MAAM,mBAAmBA,oCAAoB,CAAA;AAAA,EAClD,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAM,MAAA,YAAA,GAAe,IAAI,KAAgC,EAAA,CAAA;AACzD,IAAA,GAAA,CAAI,uBAAuBC,qCAAiC,EAAA;AAAA,MAC1D,cAAc,UAAmC,EAAA;AAC/C,QAAa,YAAA,CAAA,IAAA,CAAK,GAAG,UAAU,CAAA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,UACrBC,qBAAiB,EAAA;AAAA;AAAA,UAEjBC,oCAA4B,CAAA,EAAE,aAAe,EAAA,YAAA,EAAc,MAAM,CAAA;AAAA,UACjEC,oCAA+B,CAAA,EAAE,aAAe,EAAA,IAAA,EAAM,CAAA;AAAA,UACtDC,8BAAyB,EAAA;AAAA,UACzBC,oCAA6B,EAAA;AAAA,UAC7BC,mCAA6B,EAAA;AAAA,SAC/B,CAAA;AAEA,QAAM,MAAA,SAAA,GAAY,QAAQ,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,EAAE,CAAA,CAAE,KAAK,IAAI,CAAA,CAAA;AAE5D,QAAIb,KAAA,CAAA,IAAA;AAAA,UACF,0DAA0D,SAAS,CAAA,CAAA;AAAA,SACrE,CAAA;AAEA,QAAM,MAAAc,QAAA,GAAS,MAAMC,mBAAa,CAAA;AAAA,UAChC,MAAQ,EAAAf,KAAA;AAAA,UACR,MAAA;AAAA,UACA,QAAA;AAAA,UACA,aAAA;AAAA,UACA,MAAA;AAAA,UACA,SAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,yBAAA;AAAA,UACA,yBAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,SAAA;AAAA,UACA,WAAA;AAAA,UACA,oBAAA;AAAA,UACA,4BAAA;AAAA,SACD,CAAA,CAAA;AACD,QAAA,UAAA,CAAW,IAAIc,QAAM,CAAA,CAAA;AAAA,OACvB;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ScaffolderPlugin.cjs.js","sources":["../src/ScaffolderPlugin.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 {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n AutocompleteHandler,\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n scaffolderWorkspaceProviderExtensionPoint,\n WorkspaceProvider,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createDebugLogAction,\n createFetchCatalogEntityAction,\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n createWaitAction,\n} from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @public\n */\nexport const scaffolderPlugin = createBackendPlugin({\n pluginId: 'scaffolder',\n register(env) {\n const addedActions = new Array<TemplateAction<any, any>>();\n env.registerExtensionPoint(scaffolderActionsExtensionPoint, {\n addActions(...newActions: TemplateAction<any>[]) {\n addedActions.push(...newActions);\n },\n });\n\n let taskBroker: TaskBroker | undefined;\n env.registerExtensionPoint(scaffolderTaskBrokerExtensionPoint, {\n setTaskBroker(newTaskBroker) {\n if (taskBroker) {\n throw new Error('Task broker may only be set once');\n }\n taskBroker = newTaskBroker;\n },\n });\n\n const additionalTemplateFilters: Record<string, TemplateFilter> = {};\n const additionalTemplateGlobals: Record<string, TemplateGlobal> = {};\n env.registerExtensionPoint(scaffolderTemplatingExtensionPoint, {\n addTemplateFilters(newFilters) {\n Object.assign(additionalTemplateFilters, newFilters);\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(additionalTemplateGlobals, newGlobals);\n },\n });\n\n const autocompleteHandlers: Record<string, AutocompleteHandler> = {};\n env.registerExtensionPoint(scaffolderAutocompleteExtensionPoint, {\n addAutocompleteProvider(provider) {\n autocompleteHandlers[provider.id] = provider.handler;\n },\n });\n\n const additionalWorkspaceProviders: Record<string, WorkspaceProvider> = {};\n env.registerExtensionPoint(scaffolderWorkspaceProviderExtensionPoint, {\n addProviders(provider) {\n Object.assign(additionalWorkspaceProviders, provider);\n },\n });\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n lifecycle: coreServices.rootLifecycle,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n auth: coreServices.auth,\n discovery: coreServices.discovery,\n httpRouter: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n catalogClient: catalogServiceRef,\n },\n async init({\n logger,\n config,\n lifecycle,\n reader,\n database,\n auth,\n discovery,\n httpRouter,\n httpAuth,\n catalogClient,\n permissions,\n }) {\n const log = loggerToWinstonLogger(logger);\n const integrations = ScmIntegrations.fromConfig(config);\n\n const actions = [\n // actions provided from other modules\n ...addedActions,\n\n // built-in actions for the scaffolder\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createDebugLogAction(),\n createWaitAction(),\n // todo(blam): maybe these should be a -catalog module?\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n ];\n\n const actionIds = actions.map(action => action.id).join(', ');\n\n log.info(\n `Starting scaffolder with the following actions enabled ${actionIds}`,\n );\n\n const router = await createRouter({\n logger: log,\n config,\n database,\n catalogClient,\n reader,\n lifecycle,\n actions,\n taskBroker,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n auth,\n httpAuth,\n discovery,\n permissions,\n autocompleteHandlers,\n additionalWorkspaceProviders,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","scaffolderAutocompleteExtensionPoint","scaffolderWorkspaceProviderExtensionPoint","coreServices","catalogServiceRef","log","loggerToWinstonLogger","ScmIntegrations","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DO,MAAM,mBAAmBA,oCAAoB,CAAA;AAAA,EAClD,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAM,MAAA,YAAA,GAAe,IAAI,KAAgC,EAAA;AACzD,IAAA,GAAA,CAAI,uBAAuBC,qCAAiC,EAAA;AAAA,MAC1D,cAAc,UAAmC,EAAA;AAC/C,QAAa,YAAA,CAAA,IAAA,CAAK,GAAG,UAAU,CAAA;AAAA;AACjC,KACD,CAAA;AAED,IAAI,IAAA,UAAA;AACJ,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,cAAc,aAAe,EAAA;AAC3B,QAAA,IAAI,UAAY,EAAA;AACd,UAAM,MAAA,IAAI,MAAM,kCAAkC,CAAA;AAAA;AAEpD,QAAa,UAAA,GAAA,aAAA;AAAA;AACf,KACD,CAAA;AAED,IAAA,MAAM,4BAA4D,EAAC;AACnE,IAAA,MAAM,4BAA4D,EAAC;AACnE,IAAA,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;AAAA,UACR,MAAA;AAAA,UACA,QAAA;AAAA,UACA,aAAA;AAAA,UACA,MAAA;AAAA,UACA,SAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,yBAAA;AAAA,UACA,yBAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,SAAA;AAAA,UACA,WAAA;AAAA,UACA,oBAAA;AAAA,UACA;AAAA,SACD,CAAA;AACD,QAAA,UAAA,CAAW,IAAIc,QAAM,CAAA;AAAA;AACvB,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.cjs.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ActionContext as ActionContextNode,\n createTemplateAction as createTemplateActionNode,\n TaskSecrets as TaskSecretsNode,\n TemplateAction as TemplateActionNode,\n executeShellCommand as executeShellCommandNode,\n ExecuteShellCommandOptions as ExecuteShellCommandOptionsNode,\n fetchContents as fetchContentsNode,\n} from '@backstage/plugin-scaffolder-node';\nimport { JsonObject } from '@backstage/types';\nimport { ScaffolderEntitiesProcessor as ScaffolderEntitiesProcessorModule } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';\n\n/**\n * @public\n * @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead\n */\nexport type ActionContext<TInput extends JsonObject> =\n ActionContextNode<TInput>;\n\n/**\n * @public\n * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead\n */\nexport const createTemplateAction = createTemplateActionNode;\n\n/**\n * @public\n * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead\n */\nexport type TaskSecrets = TaskSecretsNode;\n\n/**\n * @public\n * @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead\n */\nexport type TemplateAction<TInput extends JsonObject> =\n TemplateActionNode<TInput>;\n\n/**\n * Options for {@link executeShellCommand}.\n *\n * @public\n * @deprecated Use `ExecuteShellCommandOptions` from `@backstage/plugin-scaffolder-node` instead\n */\nexport type RunCommandOptions = ExecuteShellCommandOptionsNode;\n\n/**\n * Run a command in a sub-process, normally a shell command.\n *\n * @public\n * @deprecated Use `executeShellCommand` from `@backstage/plugin-scaffolder-node` instead\n */\nexport const executeShellCommand = executeShellCommandNode;\n\n/**\n * A helper function that reads the contents of a directory from the given URL.\n * Can be used in your own actions, and also used behind fetch:template and fetch:plain\n *\n * @public\n * @deprecated Use `fetchContents` from `@backstage/plugin-scaffolder-node` instead\n */\nexport const fetchContents = fetchContentsNode;\n\n/**\n * Adds support for scaffolder specific entity kinds to the catalog.\n *\n * @public\n * @deprecated Import from `@backstage/plugin-catalog-backend-module-scaffolder-entity-model` instead\n */\nexport const ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessorModule;\n"],"names":["createTemplateActionNode","executeShellCommandNode","fetchContentsNode","ScaffolderEntitiesProcessorModule"],"mappings":";;;;;AAuCO,MAAM,oBAAuB,GAAAA
|
|
1
|
+
{"version":3,"file":"deprecated.cjs.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ActionContext as ActionContextNode,\n createTemplateAction as createTemplateActionNode,\n TaskSecrets as TaskSecretsNode,\n TemplateAction as TemplateActionNode,\n executeShellCommand as executeShellCommandNode,\n ExecuteShellCommandOptions as ExecuteShellCommandOptionsNode,\n fetchContents as fetchContentsNode,\n} from '@backstage/plugin-scaffolder-node';\nimport { JsonObject } from '@backstage/types';\nimport { ScaffolderEntitiesProcessor as ScaffolderEntitiesProcessorModule } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';\n\n/**\n * @public\n * @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead\n */\nexport type ActionContext<TInput extends JsonObject> =\n ActionContextNode<TInput>;\n\n/**\n * @public\n * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead\n */\nexport const createTemplateAction = createTemplateActionNode;\n\n/**\n * @public\n * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead\n */\nexport type TaskSecrets = TaskSecretsNode;\n\n/**\n * @public\n * @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead\n */\nexport type TemplateAction<TInput extends JsonObject> =\n TemplateActionNode<TInput>;\n\n/**\n * Options for {@link executeShellCommand}.\n *\n * @public\n * @deprecated Use `ExecuteShellCommandOptions` from `@backstage/plugin-scaffolder-node` instead\n */\nexport type RunCommandOptions = ExecuteShellCommandOptionsNode;\n\n/**\n * Run a command in a sub-process, normally a shell command.\n *\n * @public\n * @deprecated Use `executeShellCommand` from `@backstage/plugin-scaffolder-node` instead\n */\nexport const executeShellCommand = executeShellCommandNode;\n\n/**\n * A helper function that reads the contents of a directory from the given URL.\n * Can be used in your own actions, and also used behind fetch:template and fetch:plain\n *\n * @public\n * @deprecated Use `fetchContents` from `@backstage/plugin-scaffolder-node` instead\n */\nexport const fetchContents = fetchContentsNode;\n\n/**\n * Adds support for scaffolder specific entity kinds to the catalog.\n *\n * @public\n * @deprecated Import from `@backstage/plugin-catalog-backend-module-scaffolder-entity-model` instead\n */\nexport const ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessorModule;\n"],"names":["createTemplateActionNode","executeShellCommandNode","fetchContentsNode","ScaffolderEntitiesProcessorModule"],"mappings":";;;;;AAuCO,MAAM,oBAAuB,GAAAA;AA6B7B,MAAM,mBAAsB,GAAAC;AAS5B,MAAM,aAAgB,GAAAC;AAQtB,MAAM,2BAA8B,GAAAC;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecureTemplater.cjs.js","sources":["../../../src/lib/templating/SecureTemplater.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 { Isolate } from 'isolated-vm';\nimport { resolvePackagePath } from '@backstage/backend-plugin-api';\nimport {\n TemplateFilter as _TemplateFilter,\n TemplateGlobal as _TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport fs from 'fs-extra';\nimport { JsonValue } from '@backstage/types';\nimport { getMajorNodeVersion, isNoNodeSnapshotOptionProvided } from './helpers';\n\n// language=JavaScript\nconst mkScript = (nunjucksSource: string) => `\nconst { render, renderCompat } = (() => {\n const module = {};\n const process = { env: {} };\n const require = (pkg) => { if (pkg === 'events') { return function (){}; }};\n\n ${nunjucksSource}\n\n const env = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '\\${{',\n variableEnd: '}}',\n },\n });\n\n const compatEnv = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '{{',\n variableEnd: '}}',\n },\n });\n compatEnv.addFilter('jsonify', compatEnv.getFilter('dump'));\n\n const handleFunctionResult = (value) => {\n return value === '' ? undefined : JSON.parse(value);\n };\n for (const name of JSON.parse(availableTemplateFilters)) {\n env.addFilter(name, (...args) => handleFunctionResult(callFilter(name, args)));\n }\n for (const [name, value] of Object.entries(JSON.parse(availableTemplateGlobals))) {\n env.addGlobal(name, value);\n }\n for (const name of JSON.parse(availableTemplateCallbacks)) {\n env.addGlobal(name, (...args) => handleFunctionResult(callGlobal(name, args)));\n }\n\n let uninstallCompat = undefined;\n\n function render(str, values) {\n try {\n if (uninstallCompat) {\n uninstallCompat();\n uninstallCompat = undefined;\n }\n return env.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n function renderCompat(str, values) {\n try {\n if (!uninstallCompat) {\n uninstallCompat = module.exports.installJinjaCompat();\n }\n return compatEnv.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n return { render, renderCompat };\n})();\n`;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateFilter = _TemplateFilter;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateGlobal = _TemplateGlobal;\n\ninterface SecureTemplaterOptions {\n /* Enables jinja compatibility and the \"jsonify\" filter */\n cookiecutterCompat?: boolean;\n /* Extra user-provided nunjucks filters */\n templateFilters?: Record<string, TemplateFilter>;\n /* Extra user-provided nunjucks globals */\n templateGlobals?: Record<string, TemplateGlobal>;\n nunjucksConfigs?: { trimBlocks?: boolean; lstripBlocks?: boolean };\n}\n\nexport type SecureTemplateRenderer = (\n template: string,\n values: unknown,\n) => string;\n\nexport class SecureTemplater {\n static async loadRenderer(options: SecureTemplaterOptions = {}) {\n const {\n cookiecutterCompat,\n templateFilters = {},\n templateGlobals = {},\n nunjucksConfigs = {},\n } = options;\n\n const nodeVersion = getMajorNodeVersion();\n if (nodeVersion >= 20 && !isNoNodeSnapshotOptionProvided()) {\n throw new Error(\n `When using Node.js version 20 or newer, the scaffolder backend plugin requires that it be started with the --no-node-snapshot option. \n Please make sure that you have NODE_OPTIONS=--no-node-snapshot in your environment.`,\n );\n }\n\n const isolate = new Isolate({ memoryLimit: 128 });\n const context = await isolate.createContext();\n const contextGlobal = context.global;\n\n const nunjucksSource = await fs.readFile(\n resolvePackagePath(\n '@backstage/plugin-scaffolder-backend',\n 'assets/nunjucks.js.txt',\n ),\n 'utf-8',\n );\n\n const nunjucksScript = await isolate.compileScript(\n mkScript(nunjucksSource),\n );\n\n await contextGlobal.set('nunjucksConfigs', JSON.stringify(nunjucksConfigs));\n\n const availableFilters = Object.keys(templateFilters);\n\n await contextGlobal.set(\n 'availableTemplateFilters',\n JSON.stringify(availableFilters),\n );\n\n const globalCallbacks = [];\n const globalValues: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(templateGlobals)) {\n if (typeof value === 'function') {\n globalCallbacks.push(name);\n } else {\n globalValues[name] = value;\n }\n }\n\n await contextGlobal.set(\n 'availableTemplateGlobals',\n JSON.stringify(globalValues),\n );\n await contextGlobal.set(\n 'availableTemplateCallbacks',\n JSON.stringify(globalCallbacks),\n );\n\n await contextGlobal.set(\n 'callFilter',\n (filterName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateFilters, filterName)) {\n return '';\n }\n const rz = templateFilters[filterName](...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await contextGlobal.set(\n 'callGlobal',\n (globalName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateGlobals, globalName)) {\n return '';\n }\n const global = templateGlobals[globalName];\n if (typeof global !== 'function') {\n return '';\n }\n const rz = global(...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await nunjucksScript.run(context);\n\n const render: SecureTemplateRenderer = (template, values) => {\n if (!context) {\n throw new Error('SecureTemplater has not been initialized');\n }\n\n contextGlobal.setSync('templateStr', String(template));\n contextGlobal.setSync('templateValues', JSON.stringify(values));\n\n if (cookiecutterCompat) {\n return context.evalSync(`renderCompat(templateStr, templateValues)`);\n }\n\n return context.evalSync(`render(templateStr, templateValues)`);\n };\n return render;\n }\n}\n"],"names":["getMajorNodeVersion","isNoNodeSnapshotOptionProvided","Isolate","fs","resolvePackagePath"],"mappings":";;;;;;;;;;;AA2BA,MAAM,QAAA,GAAW,CAAC,cAA2B,KAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA,EAMzC,cAAc,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA;AA4FX,MAAM,eAAgB,CAAA;AAAA,EAC3B,aAAa,YAAA,CAAa,OAAkC,GAAA,EAAI,EAAA;AAC9D,IAAM,MAAA;AAAA,MACJ,kBAAA;AAAA,MACA,kBAAkB,EAAC;AAAA,MACnB,kBAAkB,EAAC;AAAA,MACnB,kBAAkB,EAAC;AAAA,KACjB,GAAA,OAAA,CAAA;AAEJ,IAAA,MAAM,cAAcA,2BAAoB,EAAA,CAAA;AACxC,IAAA,IAAI,WAAe,IAAA,EAAA,IAAM,CAACC,sCAAA,EAAkC,EAAA;AAC1D,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA;AAAA,2FAAA,CAAA;AAAA,OAEF,CAAA;AAAA,KACF;AAEA,IAAA,MAAM,UAAU,IAAIC,kBA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,0CAA0C,CAAA,CAAA;AAAA,OAC5D;AAEA,MAAA,aAAA,CAAc,OAAQ,CAAA,aAAA,EAAe,MAAO,CAAA,QAAQ,CAAC,CAAA,CAAA;AACrD,MAAA,aAAA,CAAc,OAAQ,CAAA,gBAAA,EAAkB,IAAK,CAAA,SAAA,CAAU,MAAM,CAAC,CAAA,CAAA;AAE9D,MAAA,IAAI,kBAAoB,EAAA;AACtB,QAAO,OAAA,OAAA,CAAQ,SAAS,CAA2C,yCAAA,CAAA,CAAA,CAAA;AAAA,OACrE;AAEA,MAAO,OAAA,OAAA,CAAQ,SAAS,CAAqC,mCAAA,CAAA,CAAA,CAAA;AAAA,KAC/D,CAAA;AACA,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"SecureTemplater.cjs.js","sources":["../../../src/lib/templating/SecureTemplater.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 { Isolate } from 'isolated-vm';\nimport { resolvePackagePath } from '@backstage/backend-plugin-api';\nimport {\n TemplateFilter as _TemplateFilter,\n TemplateGlobal as _TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport fs from 'fs-extra';\nimport { JsonValue } from '@backstage/types';\nimport { getMajorNodeVersion, isNoNodeSnapshotOptionProvided } from './helpers';\n\n// language=JavaScript\nconst mkScript = (nunjucksSource: string) => `\nconst { render, renderCompat } = (() => {\n const module = {};\n const process = { env: {} };\n const require = (pkg) => { if (pkg === 'events') { return function (){}; }};\n\n ${nunjucksSource}\n\n const env = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '\\${{',\n variableEnd: '}}',\n },\n });\n\n const compatEnv = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '{{',\n variableEnd: '}}',\n },\n });\n compatEnv.addFilter('jsonify', compatEnv.getFilter('dump'));\n\n const handleFunctionResult = (value) => {\n return value === '' ? undefined : JSON.parse(value);\n };\n for (const name of JSON.parse(availableTemplateFilters)) {\n env.addFilter(name, (...args) => handleFunctionResult(callFilter(name, args)));\n }\n for (const [name, value] of Object.entries(JSON.parse(availableTemplateGlobals))) {\n env.addGlobal(name, value);\n }\n for (const name of JSON.parse(availableTemplateCallbacks)) {\n env.addGlobal(name, (...args) => handleFunctionResult(callGlobal(name, args)));\n }\n\n let uninstallCompat = undefined;\n\n function render(str, values) {\n try {\n if (uninstallCompat) {\n uninstallCompat();\n uninstallCompat = undefined;\n }\n return env.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n function renderCompat(str, values) {\n try {\n if (!uninstallCompat) {\n uninstallCompat = module.exports.installJinjaCompat();\n }\n return compatEnv.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n return { render, renderCompat };\n})();\n`;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateFilter = _TemplateFilter;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateGlobal = _TemplateGlobal;\n\ninterface SecureTemplaterOptions {\n /* Enables jinja compatibility and the \"jsonify\" filter */\n cookiecutterCompat?: boolean;\n /* Extra user-provided nunjucks filters */\n templateFilters?: Record<string, TemplateFilter>;\n /* Extra user-provided nunjucks globals */\n templateGlobals?: Record<string, TemplateGlobal>;\n nunjucksConfigs?: { trimBlocks?: boolean; lstripBlocks?: boolean };\n}\n\nexport type SecureTemplateRenderer = (\n template: string,\n values: unknown,\n) => string;\n\nexport class SecureTemplater {\n static async loadRenderer(options: SecureTemplaterOptions = {}) {\n const {\n cookiecutterCompat,\n templateFilters = {},\n templateGlobals = {},\n nunjucksConfigs = {},\n } = options;\n\n const nodeVersion = getMajorNodeVersion();\n if (nodeVersion >= 20 && !isNoNodeSnapshotOptionProvided()) {\n throw new Error(\n `When using Node.js version 20 or newer, the scaffolder backend plugin requires that it be started with the --no-node-snapshot option. \n Please make sure that you have NODE_OPTIONS=--no-node-snapshot in your environment.`,\n );\n }\n\n const isolate = new Isolate({ memoryLimit: 128 });\n const context = await isolate.createContext();\n const contextGlobal = context.global;\n\n const nunjucksSource = await fs.readFile(\n resolvePackagePath(\n '@backstage/plugin-scaffolder-backend',\n 'assets/nunjucks.js.txt',\n ),\n 'utf-8',\n );\n\n const nunjucksScript = await isolate.compileScript(\n mkScript(nunjucksSource),\n );\n\n await contextGlobal.set('nunjucksConfigs', JSON.stringify(nunjucksConfigs));\n\n const availableFilters = Object.keys(templateFilters);\n\n await contextGlobal.set(\n 'availableTemplateFilters',\n JSON.stringify(availableFilters),\n );\n\n const globalCallbacks = [];\n const globalValues: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(templateGlobals)) {\n if (typeof value === 'function') {\n globalCallbacks.push(name);\n } else {\n globalValues[name] = value;\n }\n }\n\n await contextGlobal.set(\n 'availableTemplateGlobals',\n JSON.stringify(globalValues),\n );\n await contextGlobal.set(\n 'availableTemplateCallbacks',\n JSON.stringify(globalCallbacks),\n );\n\n await contextGlobal.set(\n 'callFilter',\n (filterName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateFilters, filterName)) {\n return '';\n }\n const rz = templateFilters[filterName](...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await contextGlobal.set(\n 'callGlobal',\n (globalName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateGlobals, globalName)) {\n return '';\n }\n const global = templateGlobals[globalName];\n if (typeof global !== 'function') {\n return '';\n }\n const rz = global(...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await nunjucksScript.run(context);\n\n const render: SecureTemplateRenderer = (template, values) => {\n if (!context) {\n throw new Error('SecureTemplater has not been initialized');\n }\n\n contextGlobal.setSync('templateStr', String(template));\n contextGlobal.setSync('templateValues', JSON.stringify(values));\n\n if (cookiecutterCompat) {\n return context.evalSync(`renderCompat(templateStr, templateValues)`);\n }\n\n return context.evalSync(`render(templateStr, templateValues)`);\n };\n return render;\n }\n}\n"],"names":["getMajorNodeVersion","isNoNodeSnapshotOptionProvided","Isolate","fs","resolvePackagePath"],"mappings":";;;;;;;;;;;AA2BA,MAAM,QAAA,GAAW,CAAC,cAA2B,KAAA;AAAA;AAAA;AAAA;AAAA;;AAAA,EAAA,EAMzC,cAAc;;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;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,CAAA;AA4FX,MAAM,eAAgB,CAAA;AAAA,EAC3B,aAAa,YAAA,CAAa,OAAkC,GAAA,EAAI,EAAA;AAC9D,IAAM,MAAA;AAAA,MACJ,kBAAA;AAAA,MACA,kBAAkB,EAAC;AAAA,MACnB,kBAAkB,EAAC;AAAA,MACnB,kBAAkB;AAAC,KACjB,GAAA,OAAA;AAEJ,IAAA,MAAM,cAAcA,2BAAoB,EAAA;AACxC,IAAA,IAAI,WAAe,IAAA,EAAA,IAAM,CAACC,sCAAA,EAAkC,EAAA;AAC1D,MAAA,MAAM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AAQ,CAAA,gBAAA,EAAkB,IAAK,CAAA,SAAA,CAAU,MAAM,CAAC,CAAA;AAE9D,MAAA,IAAI,kBAAoB,EAAA;AACtB,QAAO,OAAA,OAAA,CAAQ,SAAS,CAA2C,yCAAA,CAAA,CAAA;AAAA;AAGrE,MAAO,OAAA,OAAA,CAAQ,SAAS,CAAqC,mCAAA,CAAA,CAAA;AAAA,KAC/D;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.cjs.js","sources":["../../../src/lib/templating/filters.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { ScmIntegrations } from '@backstage/integration';\nimport type { JsonObject, JsonValue } from '@backstage/types';\nimport {\n parseRepoUrl,\n TemplateFilter,\n} from '@backstage/plugin-scaffolder-node';\nimport get from 'lodash/get';\n\nexport const createDefaultFilters = ({\n integrations,\n}: {\n integrations: ScmIntegrations;\n}): Record<string, TemplateFilter> => {\n return {\n parseRepoUrl: url => parseRepoUrl(url as string, integrations),\n parseEntityRef: (ref: JsonValue, context?: JsonValue) =>\n parseEntityRef(ref as string, context as JsonObject),\n pick: (obj: JsonValue, key: JsonValue) => get(obj, key as string),\n projectSlug: repoUrl => {\n const { owner, repo } = parseRepoUrl(repoUrl as string, integrations);\n return `${owner}/${repo}`;\n },\n };\n};\n"],"names":["parseRepoUrl","parseEntityRef","get"],"mappings":";;;;;;;;;;AAwBO,MAAM,uBAAuB,CAAC;AAAA,EACnC
|
|
1
|
+
{"version":3,"file":"filters.cjs.js","sources":["../../../src/lib/templating/filters.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { ScmIntegrations } from '@backstage/integration';\nimport type { JsonObject, JsonValue } from '@backstage/types';\nimport {\n parseRepoUrl,\n TemplateFilter,\n} from '@backstage/plugin-scaffolder-node';\nimport get from 'lodash/get';\n\nexport const createDefaultFilters = ({\n integrations,\n}: {\n integrations: ScmIntegrations;\n}): Record<string, TemplateFilter> => {\n return {\n parseRepoUrl: url => parseRepoUrl(url as string, integrations),\n parseEntityRef: (ref: JsonValue, context?: JsonValue) =>\n parseEntityRef(ref as string, context as JsonObject),\n pick: (obj: JsonValue, key: JsonValue) => get(obj, key as string),\n projectSlug: repoUrl => {\n const { owner, repo } = parseRepoUrl(repoUrl as string, integrations);\n return `${owner}/${repo}`;\n },\n };\n};\n"],"names":["parseRepoUrl","parseEntityRef","get"],"mappings":";;;;;;;;;;AAwBO,MAAM,uBAAuB,CAAC;AAAA,EACnC;AACF,CAEsC,KAAA;AACpC,EAAO,OAAA;AAAA,IACL,YAAc,EAAA,CAAA,GAAA,KAAOA,iCAAa,CAAA,GAAA,EAAe,YAAY,CAAA;AAAA,IAC7D,gBAAgB,CAAC,GAAA,EAAgB,OAC/B,KAAAC,2BAAA,CAAe,KAAe,OAAqB,CAAA;AAAA,IACrD,MAAM,CAAC,GAAA,EAAgB,GAAmB,KAAAC,oBAAA,CAAI,KAAK,GAAa,CAAA;AAAA,IAChE,aAAa,CAAW,OAAA,KAAA;AACtB,MAAA,MAAM,EAAE,KAAO,EAAA,IAAA,EAAS,GAAAF,iCAAA,CAAa,SAAmB,YAAY,CAAA;AACpE,MAAO,OAAA,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA;AACzB,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs.js","sources":["../../../src/lib/templating/helpers.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\nexport function isNoNodeSnapshotOptionProvided(): boolean {\n return (\n process.env.NODE_OPTIONS?.includes('--no-node-snapshot') ||\n process.argv.includes('--no-node-snapshot')\n );\n}\n\n/**\n * Gets the major version of the currently running Node.js process.\n *\n * @remarks\n * This function extracts the major version from `process.versions.node` (a string representing the Node.js version),\n * which includes the major, minor, and patch versions. It splits this string by the `.` character to get an array\n * of these versions, and then parses the first element of this array (the major version) to a number.\n *\n * @returns {number} The major version of the currently running Node.js process.\n */\nexport function getMajorNodeVersion(): number {\n const version = process.versions.node;\n return parseInt(version.split('.')[0], 10);\n}\n"],"names":[],"mappings":";;AAgBO,SAAS,8BAA0C,GAAA;AACxD,EACE,OAAA,OAAA,CAAQ,IAAI,YAAc,EAAA,QAAA,CAAS,oBAAoB,CACvD,IAAA,OAAA,CAAQ,IAAK,CAAA,QAAA,CAAS,oBAAoB,CAAA
|
|
1
|
+
{"version":3,"file":"helpers.cjs.js","sources":["../../../src/lib/templating/helpers.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\nexport function isNoNodeSnapshotOptionProvided(): boolean {\n return (\n process.env.NODE_OPTIONS?.includes('--no-node-snapshot') ||\n process.argv.includes('--no-node-snapshot')\n );\n}\n\n/**\n * Gets the major version of the currently running Node.js process.\n *\n * @remarks\n * This function extracts the major version from `process.versions.node` (a string representing the Node.js version),\n * which includes the major, minor, and patch versions. It splits this string by the `.` character to get an array\n * of these versions, and then parses the first element of this array (the major version) to a number.\n *\n * @returns {number} The major version of the currently running Node.js process.\n */\nexport function getMajorNodeVersion(): number {\n const version = process.versions.node;\n return parseInt(version.split('.')[0], 10);\n}\n"],"names":[],"mappings":";;AAgBO,SAAS,8BAA0C,GAAA;AACxD,EACE,OAAA,OAAA,CAAQ,IAAI,YAAc,EAAA,QAAA,CAAS,oBAAoB,CACvD,IAAA,OAAA,CAAQ,IAAK,CAAA,QAAA,CAAS,oBAAoB,CAAA;AAE9C;AAYO,SAAS,mBAA8B,GAAA;AAC5C,EAAM,MAAA,OAAA,GAAU,QAAQ,QAAS,CAAA,IAAA;AACjC,EAAA,OAAO,SAAS,OAAQ,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,GAAG,EAAE,CAAA;AAC3C;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateActionRegistry.cjs.js","sources":["../../../src/scaffolder/actions/TemplateActionRegistry.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 { ConflictError, NotFoundError } from '@backstage/errors';\nimport { TemplateAction } from '@backstage/plugin-scaffolder-node';\n/**\n * Registry of all registered template actions.\n * @public\n */\nexport class TemplateActionRegistry {\n private readonly actions = new Map<string, TemplateAction>();\n\n register(action: TemplateAction) {\n if (this.actions.has(action.id)) {\n throw new ConflictError(\n `Template action with ID '${action.id}' has already been registered`,\n );\n }\n\n this.actions.set(action.id, action);\n }\n\n get(actionId: string): TemplateAction {\n const action = this.actions.get(actionId);\n if (!action) {\n throw new NotFoundError(\n `Template action with ID '${actionId}' is not registered.`,\n );\n }\n return action;\n }\n\n list(): TemplateAction[] {\n return [...this.actions.values()];\n }\n}\n"],"names":["ConflictError","NotFoundError"],"mappings":";;;;AAsBO,MAAM,sBAAuB,CAAA;AAAA,EACjB,OAAA,uBAAc,GAA4B,EAAA
|
|
1
|
+
{"version":3,"file":"TemplateActionRegistry.cjs.js","sources":["../../../src/scaffolder/actions/TemplateActionRegistry.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 { ConflictError, NotFoundError } from '@backstage/errors';\nimport { TemplateAction } from '@backstage/plugin-scaffolder-node';\n/**\n * Registry of all registered template actions.\n * @public\n */\nexport class TemplateActionRegistry {\n private readonly actions = new Map<string, TemplateAction>();\n\n register(action: TemplateAction) {\n if (this.actions.has(action.id)) {\n throw new ConflictError(\n `Template action with ID '${action.id}' has already been registered`,\n );\n }\n\n this.actions.set(action.id, action);\n }\n\n get(actionId: string): TemplateAction {\n const action = this.actions.get(actionId);\n if (!action) {\n throw new NotFoundError(\n `Template action with ID '${actionId}' is not registered.`,\n );\n }\n return action;\n }\n\n list(): TemplateAction[] {\n return [...this.actions.values()];\n }\n}\n"],"names":["ConflictError","NotFoundError"],"mappings":";;;;AAsBO,MAAM,sBAAuB,CAAA;AAAA,EACjB,OAAA,uBAAc,GAA4B,EAAA;AAAA,EAE3D,SAAS,MAAwB,EAAA;AAC/B,IAAA,IAAI,IAAK,CAAA,OAAA,CAAQ,GAAI,CAAA,MAAA,CAAO,EAAE,CAAG,EAAA;AAC/B,MAAA,MAAM,IAAIA,oBAAA;AAAA,QACR,CAAA,yBAAA,EAA4B,OAAO,EAAE,CAAA,6BAAA;AAAA,OACvC;AAAA;AAGF,IAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,CAAI,MAAO,CAAA,EAAA,EAAI,MAAM,CAAA;AAAA;AACpC,EAEA,IAAI,QAAkC,EAAA;AACpC,IAAA,MAAM,MAAS,GAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,CAAI,QAAQ,CAAA;AACxC,IAAA,IAAI,CAAC,MAAQ,EAAA;AACX,MAAA,MAAM,IAAIC,oBAAA;AAAA,QACR,4BAA4B,QAAQ,CAAA,oBAAA;AAAA,OACtC;AAAA;AAEF,IAAO,OAAA,MAAA;AAAA;AACT,EAEA,IAAyB,GAAA;AACvB,IAAA,OAAO,CAAC,GAAG,IAAK,CAAA,OAAA,CAAQ,QAAQ,CAAA;AAAA;AAEpC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/fetch.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 { CatalogApi } from '@backstage/catalog-client';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { z } from 'zod';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\nimport { examples } from './fetch.examples';\nimport { AuthService } from '@backstage/backend-plugin-api';\n\nconst id = 'catalog:fetch';\n\n/**\n * Returns entity or entities from the catalog by entity reference(s).\n *\n * @public\n */\nexport function createFetchCatalogEntityAction(options: {\n catalogClient: CatalogApi;\n auth?: AuthService;\n}) {\n const { catalogClient, auth } = options;\n\n return createTemplateAction({\n id,\n description:\n 'Returns entity or entities from the catalog by entity reference(s)',\n examples,\n supportsDryRun: true,\n schema: {\n input: z.object({\n entityRef: z\n .string({\n description: 'Entity reference of the entity to get',\n })\n .optional(),\n entityRefs: z\n .array(z.string(), {\n description: 'Entity references of the entities to get',\n })\n .optional(),\n optional: z\n .boolean({\n description:\n 'Allow the entity or entities to optionally exist. Default: false',\n })\n .optional(),\n defaultKind: z.string({ description: 'The default kind' }).optional(),\n defaultNamespace: z\n .string({ description: 'The default namespace' })\n .optional(),\n }),\n output: z.object({\n entity: z\n .any({\n description:\n 'Object containing same values used in the Entity schema. Only when used with `entityRef` parameter.',\n })\n .optional(),\n entities: z\n .array(\n z.any({\n description:\n 'Array containing objects with same values used in the Entity schema. Only when used with `entityRefs` parameter.',\n }),\n )\n .optional(),\n }),\n },\n async handler(ctx) {\n const { entityRef, entityRefs, optional, defaultKind, defaultNamespace } =\n ctx.input;\n if (!entityRef && !entityRefs) {\n if (optional) {\n return;\n }\n throw new Error('Missing entity reference or references');\n }\n\n const { token } = (await auth?.getPluginRequestToken({\n onBehalfOf: await ctx.getInitiatorCredentials(),\n targetPluginId: 'catalog',\n })) ?? { token: ctx.secrets?.backstageToken };\n\n if (entityRef) {\n const entity = await catalogClient.getEntityByRef(\n stringifyEntityRef(\n parseEntityRef(entityRef, { defaultKind, defaultNamespace }),\n ),\n {\n token,\n },\n );\n\n if (!entity && !optional) {\n throw new Error(`Entity ${entityRef} not found`);\n }\n ctx.output('entity', entity ?? null);\n }\n\n if (entityRefs) {\n const entities = await catalogClient.getEntitiesByRefs(\n {\n entityRefs: entityRefs.map(ref =>\n stringifyEntityRef(\n parseEntityRef(ref, { defaultKind, defaultNamespace }),\n ),\n ),\n },\n {\n token,\n },\n );\n\n const finalEntities = entities.items.map((e, i) => {\n if (!e && !optional) {\n throw new Error(`Entity ${entityRefs[i]} not found`);\n }\n return e ?? null;\n });\n\n ctx.output('entities', finalEntities);\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","z","stringifyEntityRef","parseEntityRef"],"mappings":";;;;;;;AAuBA,MAAM,EAAK,GAAA,eAAA
|
|
1
|
+
{"version":3,"file":"fetch.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/fetch.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 { CatalogApi } from '@backstage/catalog-client';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { z } from 'zod';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\nimport { examples } from './fetch.examples';\nimport { AuthService } from '@backstage/backend-plugin-api';\n\nconst id = 'catalog:fetch';\n\n/**\n * Returns entity or entities from the catalog by entity reference(s).\n *\n * @public\n */\nexport function createFetchCatalogEntityAction(options: {\n catalogClient: CatalogApi;\n auth?: AuthService;\n}) {\n const { catalogClient, auth } = options;\n\n return createTemplateAction({\n id,\n description:\n 'Returns entity or entities from the catalog by entity reference(s)',\n examples,\n supportsDryRun: true,\n schema: {\n input: z.object({\n entityRef: z\n .string({\n description: 'Entity reference of the entity to get',\n })\n .optional(),\n entityRefs: z\n .array(z.string(), {\n description: 'Entity references of the entities to get',\n })\n .optional(),\n optional: z\n .boolean({\n description:\n 'Allow the entity or entities to optionally exist. Default: false',\n })\n .optional(),\n defaultKind: z.string({ description: 'The default kind' }).optional(),\n defaultNamespace: z\n .string({ description: 'The default namespace' })\n .optional(),\n }),\n output: z.object({\n entity: z\n .any({\n description:\n 'Object containing same values used in the Entity schema. Only when used with `entityRef` parameter.',\n })\n .optional(),\n entities: z\n .array(\n z.any({\n description:\n 'Array containing objects with same values used in the Entity schema. Only when used with `entityRefs` parameter.',\n }),\n )\n .optional(),\n }),\n },\n async handler(ctx) {\n const { entityRef, entityRefs, optional, defaultKind, defaultNamespace } =\n ctx.input;\n if (!entityRef && !entityRefs) {\n if (optional) {\n return;\n }\n throw new Error('Missing entity reference or references');\n }\n\n const { token } = (await auth?.getPluginRequestToken({\n onBehalfOf: await ctx.getInitiatorCredentials(),\n targetPluginId: 'catalog',\n })) ?? { token: ctx.secrets?.backstageToken };\n\n if (entityRef) {\n const entity = await catalogClient.getEntityByRef(\n stringifyEntityRef(\n parseEntityRef(entityRef, { defaultKind, defaultNamespace }),\n ),\n {\n token,\n },\n );\n\n if (!entity && !optional) {\n throw new Error(`Entity ${entityRef} not found`);\n }\n ctx.output('entity', entity ?? null);\n }\n\n if (entityRefs) {\n const entities = await catalogClient.getEntitiesByRefs(\n {\n entityRefs: entityRefs.map(ref =>\n stringifyEntityRef(\n parseEntityRef(ref, { defaultKind, defaultNamespace }),\n ),\n ),\n },\n {\n token,\n },\n );\n\n const finalEntities = entities.items.map((e, i) => {\n if (!e && !optional) {\n throw new Error(`Entity ${entityRefs[i]} not found`);\n }\n return e ?? null;\n });\n\n ctx.output('entities', finalEntities);\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","z","stringifyEntityRef","parseEntityRef"],"mappings":";;;;;;;AAuBA,MAAM,EAAK,GAAA,eAAA;AAOJ,SAAS,+BAA+B,OAG5C,EAAA;AACD,EAAM,MAAA,EAAE,aAAe,EAAA,IAAA,EAAS,GAAA,OAAA;AAEhC,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAA;AAAA,IACA,WACE,EAAA,oEAAA;AAAA,cACFC,uBAAA;AAAA,IACA,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,KAAA,EAAOC,MAAE,MAAO,CAAA;AAAA,QACd,SAAA,EAAWA,MACR,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACZ,UAAY,EAAAA,KAAA,CACT,KAAM,CAAAA,KAAA,CAAE,QAAU,EAAA;AAAA,UACjB,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACZ,QAAA,EAAUA,MACP,OAAQ,CAAA;AAAA,UACP,WACE,EAAA;AAAA,SACH,EACA,QAAS,EAAA;AAAA,QACZ,WAAA,EAAaA,MAAE,MAAO,CAAA,EAAE,aAAa,kBAAmB,EAAC,EAAE,QAAS,EAAA;AAAA,QACpE,gBAAA,EAAkBA,MACf,MAAO,CAAA,EAAE,aAAa,uBAAwB,EAAC,EAC/C,QAAS;AAAA,OACb,CAAA;AAAA,MACD,MAAA,EAAQA,MAAE,MAAO,CAAA;AAAA,QACf,MAAA,EAAQA,MACL,GAAI,CAAA;AAAA,UACH,WACE,EAAA;AAAA,SACH,EACA,QAAS,EAAA;AAAA,QACZ,UAAUA,KACP,CAAA,KAAA;AAAA,UACCA,MAAE,GAAI,CAAA;AAAA,YACJ,WACE,EAAA;AAAA,W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;AAAA;AACvD;AACF,WACF;AAAA,UACA;AAAA,YACE;AAAA;AACF,SACF;AAEA,QAAA,MAAM,gBAAgB,QAAS,CAAA,KAAA,CAAM,GAAI,CAAA,CAAC,GAAG,CAAM,KAAA;AACjD,UAAI,IAAA,CAAC,CAAK,IAAA,CAAC,QAAU,EAAA;AACnB,YAAA,MAAM,IAAI,KAAM,CAAA,CAAA,OAAA,EAAU,UAAW,CAAA,CAAC,CAAC,CAAY,UAAA,CAAA,CAAA;AAAA;AAErD,UAAA,OAAO,CAAK,IAAA,IAAA;AAAA,SACb,CAAA;AAED,QAAI,GAAA,CAAA,MAAA,CAAO,YAAY,aAAa,CAAA;AAAA;AACtC;AACF,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/fetch.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Fetch entity by reference',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:fetch',\n id: 'fetch',\n name: 'Fetch catalog entity',\n input: {\n entityRef: 'component:default/name',\n },\n },\n ],\n }),\n },\n {\n description: 'Fetch multiple entities by reference',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:fetch',\n id: 'fetchMultiple',\n name: 'Fetch catalog entities',\n input: {\n entityRefs: ['component:default/name'],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,2BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,eAAA;AAAA,UACR,EAAI,EAAA,OAAA;AAAA,UACJ,IAAM,EAAA,sBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,SAAW,EAAA
|
|
1
|
+
{"version":3,"file":"fetch.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/fetch.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Fetch entity by reference',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:fetch',\n id: 'fetch',\n name: 'Fetch catalog entity',\n input: {\n entityRef: 'component:default/name',\n },\n },\n ],\n }),\n },\n {\n description: 'Fetch multiple entities by reference',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:fetch',\n id: 'fetchMultiple',\n name: 'Fetch catalog entities',\n input: {\n entityRefs: ['component:default/name'],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,2BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,eAAA;AAAA,UACR,EAAI,EAAA,OAAA;AAAA,UACJ,IAAM,EAAA,sBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,SAAW,EAAA;AAAA;AACb;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,sCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,eAAA;AAAA,UACR,EAAI,EAAA,eAAA;AAAA,UACJ,IAAM,EAAA,wBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,UAAA,EAAY,CAAC,wBAAwB;AAAA;AACvC;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/register.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 { InputError } from '@backstage/errors';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { CatalogApi } from '@backstage/catalog-client';\nimport { stringifyEntityRef, Entity } from '@backstage/catalog-model';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { examples } from './register.examples';\nimport { AuthService } from '@backstage/backend-plugin-api';\n\nconst id = 'catalog:register';\n\n/**\n * Registers entities from a catalog descriptor file in the workspace into the software catalog.\n * @public\n */\nexport function createCatalogRegisterAction(options: {\n catalogClient: CatalogApi;\n integrations: ScmIntegrations;\n auth?: AuthService;\n}) {\n const { catalogClient, integrations, auth } = options;\n\n return createTemplateAction<\n | { catalogInfoUrl: string; optional?: boolean }\n | { repoContentsUrl: string; catalogInfoPath?: string; optional?: boolean }\n >({\n id,\n description:\n 'Registers entities from a catalog descriptor file in the workspace into the software catalog.',\n examples,\n schema: {\n input: {\n oneOf: [\n {\n type: 'object',\n required: ['catalogInfoUrl'],\n properties: {\n catalogInfoUrl: {\n title: 'Catalog Info URL',\n description:\n 'An absolute URL pointing to the catalog info file location',\n type: 'string',\n },\n optional: {\n title: 'Optional',\n description:\n 'Permit the registered location to optionally exist. Default: false',\n type: 'boolean',\n },\n },\n },\n {\n type: 'object',\n required: ['repoContentsUrl'],\n properties: {\n repoContentsUrl: {\n title: 'Repository Contents URL',\n description:\n 'An absolute URL pointing to the root of a repository directory tree',\n type: 'string',\n },\n catalogInfoPath: {\n title: 'Fetch URL',\n description:\n 'A relative path from the repo root pointing to the catalog info file, defaults to /catalog-info.yaml',\n type: 'string',\n },\n optional: {\n title: 'Optional',\n description:\n 'Permit the registered location to optionally exist. Default: false',\n type: 'boolean',\n },\n },\n },\n ],\n },\n output: {\n type: 'object',\n required: ['catalogInfoUrl'],\n properties: {\n entityRef: {\n type: 'string',\n },\n catalogInfoUrl: {\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const { input } = ctx;\n\n let catalogInfoUrl;\n if ('catalogInfoUrl' in input) {\n catalogInfoUrl = input.catalogInfoUrl;\n } else {\n const { repoContentsUrl, catalogInfoPath = '/catalog-info.yaml' } =\n input;\n const integration = integrations.byUrl(repoContentsUrl);\n if (!integration) {\n throw new InputError(\n `No integration found for host ${repoContentsUrl}`,\n );\n }\n\n catalogInfoUrl = integration.resolveUrl({\n base: repoContentsUrl,\n url: catalogInfoPath,\n });\n }\n\n ctx.logger.info(`Registering ${catalogInfoUrl} in the catalog`);\n\n const { token } = (await auth?.getPluginRequestToken({\n onBehalfOf: await ctx.getInitiatorCredentials(),\n targetPluginId: 'catalog',\n })) ?? { token: ctx.secrets?.backstageToken };\n\n try {\n // 1st try to register the location, this will throw an error if the location already exists (see catch)\n await catalogClient.addLocation(\n {\n type: 'url',\n target: catalogInfoUrl,\n },\n token ? { token } : {},\n );\n } catch (e) {\n if (!input.optional) {\n // if optional is false or unset, it is not allowed to register the same location twice, we rethrow the error\n throw e;\n }\n }\n\n try {\n // 2nd retry the registration as a dry run, this will not throw an error if the location already exists\n const result = await catalogClient.addLocation(\n {\n dryRun: true,\n type: 'url',\n target: catalogInfoUrl,\n },\n token ? { token } : {},\n );\n\n if (result.entities.length) {\n const { entities } = result;\n let entity: Entity | undefined;\n // prioritise 'Component' type as it is the most central kind of entity\n entity = entities.find(\n e =>\n !e.metadata.name.startsWith('generated-') &&\n e.kind === 'Component',\n );\n if (!entity) {\n entity = entities.find(\n e => !e.metadata.name.startsWith('generated-'),\n );\n }\n if (!entity) {\n entity = entities[0];\n }\n\n ctx.output('entityRef', stringifyEntityRef(entity));\n }\n } catch (e) {\n if (!input.optional) {\n throw e;\n }\n }\n\n ctx.output('catalogInfoUrl', catalogInfoUrl);\n },\n });\n}\n"],"names":["createTemplateAction","examples","InputError","stringifyEntityRef"],"mappings":";;;;;;;AAwBA,MAAM,EAAK,GAAA,kBAAA
|
|
1
|
+
{"version":3,"file":"register.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/register.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 { InputError } from '@backstage/errors';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { CatalogApi } from '@backstage/catalog-client';\nimport { stringifyEntityRef, Entity } from '@backstage/catalog-model';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { examples } from './register.examples';\nimport { AuthService } from '@backstage/backend-plugin-api';\n\nconst id = 'catalog:register';\n\n/**\n * Registers entities from a catalog descriptor file in the workspace into the software catalog.\n * @public\n */\nexport function createCatalogRegisterAction(options: {\n catalogClient: CatalogApi;\n integrations: ScmIntegrations;\n auth?: AuthService;\n}) {\n const { catalogClient, integrations, auth } = options;\n\n return createTemplateAction<\n | { catalogInfoUrl: string; optional?: boolean }\n | { repoContentsUrl: string; catalogInfoPath?: string; optional?: boolean }\n >({\n id,\n description:\n 'Registers entities from a catalog descriptor file in the workspace into the software catalog.',\n examples,\n schema: {\n input: {\n oneOf: [\n {\n type: 'object',\n required: ['catalogInfoUrl'],\n properties: {\n catalogInfoUrl: {\n title: 'Catalog Info URL',\n description:\n 'An absolute URL pointing to the catalog info file location',\n type: 'string',\n },\n optional: {\n title: 'Optional',\n description:\n 'Permit the registered location to optionally exist. Default: false',\n type: 'boolean',\n },\n },\n },\n {\n type: 'object',\n required: ['repoContentsUrl'],\n properties: {\n repoContentsUrl: {\n title: 'Repository Contents URL',\n description:\n 'An absolute URL pointing to the root of a repository directory tree',\n type: 'string',\n },\n catalogInfoPath: {\n title: 'Fetch URL',\n description:\n 'A relative path from the repo root pointing to the catalog info file, defaults to /catalog-info.yaml',\n type: 'string',\n },\n optional: {\n title: 'Optional',\n description:\n 'Permit the registered location to optionally exist. Default: false',\n type: 'boolean',\n },\n },\n },\n ],\n },\n output: {\n type: 'object',\n required: ['catalogInfoUrl'],\n properties: {\n entityRef: {\n type: 'string',\n },\n catalogInfoUrl: {\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const { input } = ctx;\n\n let catalogInfoUrl;\n if ('catalogInfoUrl' in input) {\n catalogInfoUrl = input.catalogInfoUrl;\n } else {\n const { repoContentsUrl, catalogInfoPath = '/catalog-info.yaml' } =\n input;\n const integration = integrations.byUrl(repoContentsUrl);\n if (!integration) {\n throw new InputError(\n `No integration found for host ${repoContentsUrl}`,\n );\n }\n\n catalogInfoUrl = integration.resolveUrl({\n base: repoContentsUrl,\n url: catalogInfoPath,\n });\n }\n\n ctx.logger.info(`Registering ${catalogInfoUrl} in the catalog`);\n\n const { token } = (await auth?.getPluginRequestToken({\n onBehalfOf: await ctx.getInitiatorCredentials(),\n targetPluginId: 'catalog',\n })) ?? { token: ctx.secrets?.backstageToken };\n\n try {\n // 1st try to register the location, this will throw an error if the location already exists (see catch)\n await catalogClient.addLocation(\n {\n type: 'url',\n target: catalogInfoUrl,\n },\n token ? { token } : {},\n );\n } catch (e) {\n if (!input.optional) {\n // if optional is false or unset, it is not allowed to register the same location twice, we rethrow the error\n throw e;\n }\n }\n\n try {\n // 2nd retry the registration as a dry run, this will not throw an error if the location already exists\n const result = await catalogClient.addLocation(\n {\n dryRun: true,\n type: 'url',\n target: catalogInfoUrl,\n },\n token ? { token } : {},\n );\n\n if (result.entities.length) {\n const { entities } = result;\n let entity: Entity | undefined;\n // prioritise 'Component' type as it is the most central kind of entity\n entity = entities.find(\n e =>\n !e.metadata.name.startsWith('generated-') &&\n e.kind === 'Component',\n );\n if (!entity) {\n entity = entities.find(\n e => !e.metadata.name.startsWith('generated-'),\n );\n }\n if (!entity) {\n entity = entities[0];\n }\n\n ctx.output('entityRef', stringifyEntityRef(entity));\n }\n } catch (e) {\n if (!input.optional) {\n throw e;\n }\n }\n\n ctx.output('catalogInfoUrl', catalogInfoUrl);\n },\n });\n}\n"],"names":["createTemplateAction","examples","InputError","stringifyEntityRef"],"mappings":";;;;;;;AAwBA,MAAM,EAAK,GAAA,kBAAA;AAMJ,SAAS,4BAA4B,OAIzC,EAAA;AACD,EAAA,MAAM,EAAE,aAAA,EAAe,YAAc,EAAA,IAAA,EAAS,GAAA,OAAA;AAE9C,EAAA,OAAOA,yCAGL,CAAA;AAAA,IACA,EAAA;AAAA,IACA,WACE,EAAA,+FAAA;A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ACE,MAAQ,EAAA,IAAA;AAAA,YACR,IAAM,EAAA,KAAA;AAAA,YACN,MAAQ,EAAA;AAAA,WACV;AAAA,UACA,KAAQ,GAAA,EAAE,KAAM,EAAA,GAAI;AAAC,SACvB;AAEA,QAAI,IAAA,MAAA,CAAO,SAAS,MAAQ,EAAA;AAC1B,UAAM,MAAA,EAAE,UAAa,GAAA,MAAA;AACrB,UAAI,IAAA,MAAA;AAEJ,UAAA,MAAA,GAAS,QAAS,CAAA,IAAA;AAAA,YAChB,CAAA,CAAA,KACE,CAAC,CAAE,CAAA,QAAA,CAAS,KAAK,UAAW,CAAA,YAAY,CACxC,IAAA,CAAA,CAAE,IAAS,KAAA;AAAA,WACf;AACA,UAAA,IAAI,CAAC,MAAQ,EAAA;AACX,YAAA,MAAA,GAAS,QAAS,CAAA,IAAA;AAAA,cAChB,OAAK,CAAC,CAAA,CAAE,QAAS,CAAA,IAAA,CAAK,WAAW,YAAY;AAAA,aAC/C;AAAA;AAEF,UAAA,IAAI,CAAC,MAAQ,EAAA;AACX,YAAA,MAAA,GAAS,SAAS,CAAC,CAAA;AAAA;AAGrB,UAAA,GAAA,CAAI,MAAO,CAAA,WAAA,EAAaC,+BAAmB,CAAA,MAAM,CAAC,CAAA;AAAA;AACpD,eACO,CAAG,EAAA;AACV,QAAI,IAAA,CAAC,MAAM,QAAU,EAAA;AACnB,UAAM,MAAA,CAAA;AAAA;AACR;AAGF,MAAI,GAAA,CAAA,MAAA,CAAO,kBAAkB,cAAc,CAAA;AAAA;AAC7C,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/register.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Register with the catalog',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:register',\n id: 'register-with-catalog',\n name: 'Register with the catalog',\n input: {\n catalogInfoUrl:\n 'http://github.com/backstage/backstage/blob/master/catalog-info.yaml',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,2BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,kBAAA;AAAA,UACR,EAAI,EAAA,uBAAA;AAAA,UACJ,IAAM,EAAA,2BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,cACE,EAAA
|
|
1
|
+
{"version":3,"file":"register.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/register.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Register with the catalog',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:register',\n id: 'register-with-catalog',\n name: 'Register with the catalog',\n input: {\n catalogInfoUrl:\n 'http://github.com/backstage/backstage/blob/master/catalog-info.yaml',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,2BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,kBAAA;AAAA,UACR,EAAI,EAAA,uBAAA;AAAA,UACJ,IAAM,EAAA,2BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,cACE,EAAA;AAAA;AACJ;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/write.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 fs from 'fs-extra';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\nimport { resolveSafeChildPath } from '@backstage/backend-plugin-api';\nimport { z } from 'zod';\nimport { examples } from './write.examples';\n\nconst id = 'catalog:write';\n\n/**\n * Writes a catalog descriptor file containing the provided entity to a path in the workspace.\n * @public\n */\n\nexport function createCatalogWriteAction() {\n return createTemplateAction({\n id,\n description: 'Writes the catalog-info.yaml for your template',\n schema: {\n input: z.object({\n filePath: z\n .string()\n .optional()\n .describe('Defaults to catalog-info.yaml'),\n // TODO: this should reference an zod entity validator if it existed.\n entity: z\n .record(z.any())\n .describe(\n 'You can provide the same values used in the Entity schema.',\n ),\n }),\n },\n examples,\n supportsDryRun: true,\n async handler(ctx) {\n const { filePath, entity } = ctx.input;\n const entityRef = ctx.templateInfo?.entityRef;\n const path = filePath ?? 'catalog-info.yaml';\n ctx.logger.info(`Writing ${path}`);\n\n await fs.outputFile(\n resolveSafeChildPath(ctx.workspacePath, path),\n yaml.stringify({\n ...entity,\n metadata: {\n ...entity.metadata,\n ...(entityRef\n ? {\n annotations: {\n ...entity.metadata.annotations,\n 'backstage.io/source-template': entityRef,\n },\n }\n : undefined),\n },\n }),\n );\n },\n });\n}\n"],"names":["createTemplateAction","z","examples","fs","resolveSafeChildPath","yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,eAAA
|
|
1
|
+
{"version":3,"file":"write.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/write.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 fs from 'fs-extra';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\nimport { resolveSafeChildPath } from '@backstage/backend-plugin-api';\nimport { z } from 'zod';\nimport { examples } from './write.examples';\n\nconst id = 'catalog:write';\n\n/**\n * Writes a catalog descriptor file containing the provided entity to a path in the workspace.\n * @public\n */\n\nexport function createCatalogWriteAction() {\n return createTemplateAction({\n id,\n description: 'Writes the catalog-info.yaml for your template',\n schema: {\n input: z.object({\n filePath: z\n .string()\n .optional()\n .describe('Defaults to catalog-info.yaml'),\n // TODO: this should reference an zod entity validator if it existed.\n entity: z\n .record(z.any())\n .describe(\n 'You can provide the same values used in the Entity schema.',\n ),\n }),\n },\n examples,\n supportsDryRun: true,\n async handler(ctx) {\n const { filePath, entity } = ctx.input;\n const entityRef = ctx.templateInfo?.entityRef;\n const path = filePath ?? 'catalog-info.yaml';\n ctx.logger.info(`Writing ${path}`);\n\n await fs.outputFile(\n resolveSafeChildPath(ctx.workspacePath, path),\n yaml.stringify({\n ...entity,\n metadata: {\n ...entity.metadata,\n ...(entityRef\n ? {\n annotations: {\n ...entity.metadata.annotations,\n 'backstage.io/source-template': entityRef,\n },\n }\n : undefined),\n },\n }),\n );\n },\n });\n}\n"],"names":["createTemplateAction","z","examples","fs","resolveSafeChildPath","yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,eAAA;AAOJ,SAAS,wBAA2B,GAAA;AACzC,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAA;AAAA,IACA,WAAa,EAAA,gDAAA;AAAA,IACb,MAAQ,EAAA;AAAA,MACN,KAAA,EAAOC,MAAE,MAAO,CAAA;AAAA,QACd,UAAUA,KACP,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,+BAA+B,CAAA;AAAA;AAAA,QAE3C,QAAQA,KACL,CAAA,MAAA,CAAOA,KAAE,CAAA,GAAA,EAAK,CACd,CAAA,QAAA;AAAA,UACC;AAAA;AACF,OACH;AAAA,KACH;AAAA,cACAC,uBAAA;AAAA,IACA,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAA,MAAM,EAAE,QAAA,EAAU,MAAO,EAAA,GAAI,GAAI,CAAA,KAAA;AACjC,MAAM,MAAA,SAAA,GAAY,IAAI,YAAc,EAAA,SAAA;AACpC,MAAA,MAAM,OAAO,QAAY,IAAA,mBAAA;AACzB,MAAA,GAAA,CAAI,MAAO,CAAA,IAAA,CAAK,CAAW,QAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAEjC,MAAA,MAAMC,mBAAG,CAAA,UAAA;AAAA,QACPC,qCAAA,CAAqB,GAAI,CAAA,aAAA,EAAe,IAAI,CAAA;AAAA,QAC5CC,gBAAK,SAAU,CAAA;AAAA,UACb,GAAG,MAAA;AAAA,UACH,QAAU,EAAA;AAAA,YACR,GAAG,MAAO,CAAA,QAAA;AAAA,YACV,GAAI,SACA,GAAA;AAAA,cACE,WAAa,EAAA;AAAA,gBACX,GAAG,OAAO,QAAS,CAAA,WAAA;AAAA,gBACnB,8BAAgC,EAAA;AAAA;AAClC,aAEF,GAAA,KAAA;AAAA;AACN,SACD;AAAA,OACH;AAAA;AACF,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/write.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Write a catalog yaml file',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:write',\n id: 'create-catalog-info-file',\n name: 'Create catalog file',\n input: {\n entity: {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Component',\n metadata: {\n name: 'test',\n annotations: {},\n },\n spec: {\n type: 'service',\n lifecycle: 'production',\n owner: 'default/owner',\n },\n },\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,2BAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,eAAA;AAAA,UACR,EAAI,EAAA,0BAAA;AAAA,UACJ,IAAM,EAAA,qBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,MAAQ,EAAA;AAAA,cACN,UAAY,EAAA,uBAAA;AAAA,cACZ,IAAM,EAAA,WAAA;AAAA,cACN,QAAU,EAAA;AAAA,gBACR,IAAM,EAAA,MAAA;AAAA,gBACN,aAAa
|
|
1
|
+
{"version":3,"file":"write.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/catalog/write.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Write a catalog yaml file',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:write',\n id: 'create-catalog-info-file',\n name: 'Create catalog file',\n input: {\n entity: {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Component',\n metadata: {\n name: 'test',\n annotations: {},\n },\n spec: {\n type: 'service',\n lifecycle: 'production',\n owner: 'default/owner',\n },\n },\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,2BAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,eAAA;AAAA,UACR,EAAI,EAAA,0BAAA;AAAA,UACJ,IAAM,EAAA,qBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,MAAQ,EAAA;AAAA,cACN,UAAY,EAAA,uBAAA;AAAA,cACZ,IAAM,EAAA,WAAA;AAAA,cACN,QAAU,EAAA;AAAA,gBACR,IAAM,EAAA,MAAA;AAAA,gBACN,aAAa;AAAC,eAChB;AAAA,cACA,IAAM,EAAA;AAAA,gBACJ,IAAM,EAAA,SAAA;AAAA,gBACN,SAAW,EAAA,YAAA;AAAA,gBACX,KAAO,EAAA;AAAA;AACT;AACF;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBuiltinActions.cjs.js","sources":["../../../../src/scaffolder/actions/builtin/createBuiltinActions.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 { CatalogApi } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createFetchCatalogEntityAction,\n} from './catalog';\n\nimport { createDebugLogAction, createWaitAction } from './debug';\nimport {\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n} from './fetch';\nimport {\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n} from './filesystem';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-github';\n\nimport { createPublishAzureAction } from '@backstage/plugin-scaffolder-backend-module-azure';\n\nimport { createPublishBitbucketAction } from '@backstage/plugin-scaffolder-backend-module-bitbucket';\n\nimport {\n createPublishBitbucketCloudAction,\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';\n\nimport {\n createPublishBitbucketServerAction,\n createPublishBitbucketServerPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';\n\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from '@backstage/plugin-scaffolder-backend-module-gerrit';\n\nimport {\n createPublishGitlabAction,\n createGitlabRepoPushAction,\n createPublishGitlabMergeRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-gitlab';\n\nimport { createPublishGiteaAction } from '@backstage/plugin-scaffolder-backend-module-gitea';\nimport { AuthService, UrlReaderService } from '@backstage/backend-plugin-api';\n\n/**\n * The options passed to {@link createBuiltinActions}\n * @public\n */\nexport interface CreateBuiltInActionsOptions {\n /**\n * The {@link @backstage/backend-plugin-api#UrlReaderService} interface that will be used in the default actions.\n */\n reader: UrlReaderService;\n /**\n * The {@link @backstage/integrations#ScmIntegrations} that will be used in the default actions.\n */\n integrations: ScmIntegrations;\n /**\n * The {@link @backstage/catalog-client#CatalogApi} that will be used in the default actions.\n */\n catalogClient: CatalogApi;\n /**\n * The {@link @backstage/backend-plugin-api#AuthService} that will be used in the default actions.\n */\n auth?: AuthService;\n /**\n * The {@link @backstage/config#Config} that will be used in the default actions.\n */\n config: Config;\n /**\n * Additional custom filters that will be passed to the nunjucks template engine for use in\n * Template Manifests and also template skeleton files when using `fetch:template`.\n */\n additionalTemplateFilters?: Record<string, TemplateFilter>;\n additionalTemplateGlobals?: Record<string, TemplateGlobal>;\n}\n\n/**\n * A function to generate create a list of default actions that the scaffolder provides.\n * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones\n *\n * TODO(blam): version 2 of the scaffolder shouldn't ship with the additional modules. We should ship the basics, and let people install\n * modules for the providers they want to use.\n * @public\n * @returns A list of actions that can be used in the scaffolder\n *\n */\nexport const createBuiltinActions = (\n options: CreateBuiltInActionsOptions,\n): TemplateAction[] => {\n const {\n reader,\n integrations,\n catalogClient,\n auth,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n } = options;\n\n const githubCredentialsProvider: GithubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const actions = [\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createPublishGerritAction({\n integrations,\n config,\n }),\n createPublishGerritReviewAction({\n integrations,\n config,\n }),\n createPublishGiteaAction({\n integrations,\n config,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n }),\n createPublishGitlabAction({\n integrations,\n config,\n }),\n createPublishGitlabMergeRequestAction({\n integrations,\n }),\n createGitlabRepoPushAction({\n integrations,\n }),\n createPublishBitbucketAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudPullRequestAction({ integrations, config }),\n createPublishBitbucketServerAction({\n integrations,\n config,\n }),\n createPublishBitbucketServerPullRequestAction({\n integrations,\n config,\n }),\n createPublishAzureAction({\n integrations,\n config,\n }),\n createDebugLogAction(),\n createWaitAction(),\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalogClient,\n }),\n createGithubDeployKeyAction({\n integrations,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n }),\n createBitbucketPipelinesRunAction({\n integrations,\n }),\n ];\n\n return actions as TemplateAction[];\n};\n"],"names":["DefaultGithubCredentialsProvider","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createPublishGerritAction","createPublishGerritReviewAction","createPublishGiteaAction","createPublishGithubAction","createPublishGithubPullRequestAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createGitlabRepoPushAction","createPublishBitbucketAction","createPublishBitbucketCloudAction","createPublishBitbucketCloudPullRequestAction","createPublishBitbucketServerAction","createPublishBitbucketServerPullRequestAction","createPublishAzureAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","createGithubActionsDispatchAction","createGithubWebhookAction","createGithubIssuesLabelAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubEnvironmentAction","createGithubDeployKeyAction","createGithubAutolinksAction","createBitbucketPipelinesRunAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkIa,MAAA,oBAAA,GAAuB,CAClC,OACqB,KAAA;AACrB,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,yBAAA;AAAA,IACA,yBAAA;AAAA,GACE,GAAA,OAAA,CAAA;AAEJ,EAAM,MAAA,yBAAA,GACJA,4CAAiC,CAAA,gBAAA,CAAiB,YAAY,CAAA,CAAA;AAEhE,EAAA,MAAM,OAAU,GAAA;AAAA,IACdC,4BAAuB,CAAA;AAAA,MACrB,MAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA;AAAA,IACDC,oCAA2B,CAAA;AAAA,MACzB,MAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA;AAAA,IACDC,kCAA0B,CAAA;AAAA,MACxB,YAAA;AAAA,MACA,MAAA;AAAA,MACA,yBAAA;AAAA,MACA,yBAAA;AAAA,KACD,CAAA;AAAA,IACDC,0CAA8B,CAAA;AAAA,MAC5B,YAAA;AAAA,MACA,MAAA;AAAA,MACA,yBAAA;AAAA,MACA,yBAAA;AAAA,KACD,CAAA;AAAA,IACDC,gCAA0B,CAAA;AAAA,MACxB,YAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA;AAAA,IACDC,sCAAgC,CAAA;AAAA,MAC9B,YAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA;AAAA,IACDC,2DAAyB,CAAA;AAAA,MACvB,YAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA;AAAA,IACDC,gCAA0B,CAAA;AAAA,MACxB,YAAA;AAAA,MACA,MAAA;AAAA,MACA,yBAAA;AAAA,KACD,CAAA;AAAA,IACDC,2CAAqC,CAAA;AAAA,MACnC,YAAA;AAAA,MACA,yBAAA;AAAA,MACA,MA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,YAAA;AAAA,MACA,yBAAA;AAAA,KACD,CAAA;AAAA,IACDC,iCAA2B,CAAA;AAAA,MACzB,YAAA;AAAA,MACA,MAAA;AAAA,MACA,yBAAA;AAAA,KACD,CAAA;AAAA,IACDC,oCAA8B,CAAA;AAAA,MAC5B,YAAA;AAAA,MACA,aAAA;AAAA,KACD,CAAA;AAAA,IACDC,kCAA4B,CAAA;AAAA,MAC1B,YAAA;AAAA,KACD,CAAA;AAAA,IACDC,kCAA4B,CAAA;AAAA,MAC1B,YAAA;AAAA,MACA,yBAAA;AAAA,KACD,CAAA;AAAA,IACDC,gDAAkC,CAAA;AAAA,MAChC,YAAA;AAAA,KACD,CAAA;AAAA,GACH,CAAA;AAEA,EAAO,OAAA,OAAA,CAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"createBuiltinActions.cjs.js","sources":["../../../../src/scaffolder/actions/builtin/createBuiltinActions.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 { CatalogApi } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createFetchCatalogEntityAction,\n} from './catalog';\n\nimport { createDebugLogAction, createWaitAction } from './debug';\nimport {\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n} from './fetch';\nimport {\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n} from './filesystem';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-github';\n\nimport { createPublishAzureAction } from '@backstage/plugin-scaffolder-backend-module-azure';\n\nimport { createPublishBitbucketAction } from '@backstage/plugin-scaffolder-backend-module-bitbucket';\n\nimport {\n createPublishBitbucketCloudAction,\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';\n\nimport {\n createPublishBitbucketServerAction,\n createPublishBitbucketServerPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';\n\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from '@backstage/plugin-scaffolder-backend-module-gerrit';\n\nimport {\n createPublishGitlabAction,\n createGitlabRepoPushAction,\n createPublishGitlabMergeRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-gitlab';\n\nimport { createPublishGiteaAction } from '@backstage/plugin-scaffolder-backend-module-gitea';\nimport { AuthService, UrlReaderService } from '@backstage/backend-plugin-api';\n\n/**\n * The options passed to {@link createBuiltinActions}\n * @public\n */\nexport interface CreateBuiltInActionsOptions {\n /**\n * The {@link @backstage/backend-plugin-api#UrlReaderService} interface that will be used in the default actions.\n */\n reader: UrlReaderService;\n /**\n * The {@link @backstage/integrations#ScmIntegrations} that will be used in the default actions.\n */\n integrations: ScmIntegrations;\n /**\n * The {@link @backstage/catalog-client#CatalogApi} that will be used in the default actions.\n */\n catalogClient: CatalogApi;\n /**\n * The {@link @backstage/backend-plugin-api#AuthService} that will be used in the default actions.\n */\n auth?: AuthService;\n /**\n * The {@link @backstage/config#Config} that will be used in the default actions.\n */\n config: Config;\n /**\n * Additional custom filters that will be passed to the nunjucks template engine for use in\n * Template Manifests and also template skeleton files when using `fetch:template`.\n */\n additionalTemplateFilters?: Record<string, TemplateFilter>;\n additionalTemplateGlobals?: Record<string, TemplateGlobal>;\n}\n\n/**\n * A function to generate create a list of default actions that the scaffolder provides.\n * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones\n *\n * TODO(blam): version 2 of the scaffolder shouldn't ship with the additional modules. We should ship the basics, and let people install\n * modules for the providers they want to use.\n * @public\n * @returns A list of actions that can be used in the scaffolder\n *\n */\nexport const createBuiltinActions = (\n options: CreateBuiltInActionsOptions,\n): TemplateAction[] => {\n const {\n reader,\n integrations,\n catalogClient,\n auth,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n } = options;\n\n const githubCredentialsProvider: GithubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const actions = [\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createPublishGerritAction({\n integrations,\n config,\n }),\n createPublishGerritReviewAction({\n integrations,\n config,\n }),\n createPublishGiteaAction({\n integrations,\n config,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n }),\n createPublishGitlabAction({\n integrations,\n config,\n }),\n createPublishGitlabMergeRequestAction({\n integrations,\n }),\n createGitlabRepoPushAction({\n integrations,\n }),\n createPublishBitbucketAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudPullRequestAction({ integrations, config }),\n createPublishBitbucketServerAction({\n integrations,\n config,\n }),\n createPublishBitbucketServerPullRequestAction({\n integrations,\n config,\n }),\n createPublishAzureAction({\n integrations,\n config,\n }),\n createDebugLogAction(),\n createWaitAction(),\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalogClient,\n }),\n createGithubDeployKeyAction({\n integrations,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n }),\n createBitbucketPipelinesRunAction({\n integrations,\n }),\n ];\n\n return actions as TemplateAction[];\n};\n"],"names":["DefaultGithubCredentialsProvider","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createPublishGerritAction","createPublishGerritReviewAction","createPublishGiteaAction","createPublishGithubAction","createPublishGithubPullRequestAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createGitlabRepoPushAction","createPublishBitbucketAction","createPublishBitbucketCloudAction","createPublishBitbucketCloudPullRequestAction","createPublishBitbucketServerAction","createPublishBitbucketServerPullRequestAction","createPublishAzureAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","createGithubActionsDispatchAction","createGithubWebhookAction","createGithubIssuesLabelAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubEnvironmentAction","createGithubDeployKeyAction","createGithubAutolinksAction","createBitbucketPipelinesRunAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkIa,MAAA,oBAAA,GAAuB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MAC1B,YAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACDC,gDAAkC,CAAA;AAAA,MAChC;AAAA,KACD;AAAA,GACH;AAEA,EAAO,OAAA,OAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/log.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 { readdir, stat } from 'fs-extra';\nimport { join, relative } from 'path';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { examples } from './log.examples';\nimport fs from 'fs';\nimport { z } from 'zod';\n\nconst id = 'debug:log';\n\n/**\n * Writes a message into the log or lists all files in the workspace\n *\n * @remarks\n *\n * This task is useful for local development and testing of both the scaffolder\n * and scaffolder templates.\n *\n * @public\n */\nexport function createDebugLogAction() {\n return createTemplateAction<{\n message?: string;\n listWorkspace?: boolean | 'with-filenames' | 'with-contents';\n }>({\n id,\n description:\n 'Writes a message into the log and/or lists all files in the workspace.',\n examples,\n schema: {\n input: z.object({\n message: z.string({ description: 'Message to output.' }).optional(),\n listWorkspace: z\n .union([z.boolean(), z.enum(['with-filenames', 'with-contents'])], {\n description:\n 'List all files in the workspace. If used with \"with-contents\", also the file contents are listed.',\n })\n .optional(),\n }),\n },\n supportsDryRun: true,\n async handler(ctx) {\n ctx.logger.info(JSON.stringify(ctx.input, null, 2));\n\n if (ctx.input?.message) {\n ctx.logger.info(ctx.input.message);\n }\n\n if (ctx.input?.listWorkspace) {\n const files = await recursiveReadDir(ctx.workspacePath);\n ctx.logger.info(\n `Workspace:\\n${files\n .map(f => {\n const relativePath = relative(ctx.workspacePath, f);\n if (ctx.input?.listWorkspace === 'with-contents') {\n const content = fs.readFileSync(f, 'utf-8');\n return ` - ${relativePath}:\\n\\n ${content}`;\n }\n return ` - ${relativePath}`;\n })\n .join('\\n')}`,\n );\n }\n },\n });\n}\n\nexport async function recursiveReadDir(dir: string): Promise<string[]> {\n const subdirs = await readdir(dir);\n const files = await Promise.all(\n subdirs.map(async subdir => {\n const res = join(dir, subdir);\n return (await stat(res)).isDirectory() ? recursiveReadDir(res) : [res];\n }),\n );\n return files.reduce((a, f) => a.concat(f), []);\n}\n"],"names":["createTemplateAction","examples","z","relative","fs","readdir","join","stat"],"mappings":";;;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,WAAA
|
|
1
|
+
{"version":3,"file":"log.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/log.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 { readdir, stat } from 'fs-extra';\nimport { join, relative } from 'path';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { examples } from './log.examples';\nimport fs from 'fs';\nimport { z } from 'zod';\n\nconst id = 'debug:log';\n\n/**\n * Writes a message into the log or lists all files in the workspace\n *\n * @remarks\n *\n * This task is useful for local development and testing of both the scaffolder\n * and scaffolder templates.\n *\n * @public\n */\nexport function createDebugLogAction() {\n return createTemplateAction<{\n message?: string;\n listWorkspace?: boolean | 'with-filenames' | 'with-contents';\n }>({\n id,\n description:\n 'Writes a message into the log and/or lists all files in the workspace.',\n examples,\n schema: {\n input: z.object({\n message: z.string({ description: 'Message to output.' }).optional(),\n listWorkspace: z\n .union([z.boolean(), z.enum(['with-filenames', 'with-contents'])], {\n description:\n 'List all files in the workspace. If used with \"with-contents\", also the file contents are listed.',\n })\n .optional(),\n }),\n },\n supportsDryRun: true,\n async handler(ctx) {\n ctx.logger.info(JSON.stringify(ctx.input, null, 2));\n\n if (ctx.input?.message) {\n ctx.logger.info(ctx.input.message);\n }\n\n if (ctx.input?.listWorkspace) {\n const files = await recursiveReadDir(ctx.workspacePath);\n ctx.logger.info(\n `Workspace:\\n${files\n .map(f => {\n const relativePath = relative(ctx.workspacePath, f);\n if (ctx.input?.listWorkspace === 'with-contents') {\n const content = fs.readFileSync(f, 'utf-8');\n return ` - ${relativePath}:\\n\\n ${content}`;\n }\n return ` - ${relativePath}`;\n })\n .join('\\n')}`,\n );\n }\n },\n });\n}\n\nexport async function recursiveReadDir(dir: string): Promise<string[]> {\n const subdirs = await readdir(dir);\n const files = await Promise.all(\n subdirs.map(async subdir => {\n const res = join(dir, subdir);\n return (await stat(res)).isDirectory() ? recursiveReadDir(res) : [res];\n }),\n );\n return files.reduce((a, f) => a.concat(f), []);\n}\n"],"names":["createTemplateAction","examples","z","relative","fs","readdir","join","stat"],"mappings":";;;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,WAAA;AAYJ,SAAS,oBAAuB,GAAA;AACrC,EAAA,OAAOA,yCAGJ,CAAA;AAAA,IACD,EAAA;AAAA,IACA,WACE,EAAA,wEAAA;AAAA,cACFC,qBAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAA,EAAOC,MAAE,MAAO,CAAA;AAAA,QACd,OAAA,EAASA,MAAE,MAAO,CAAA,EAAE,aAAa,oBAAqB,EAAC,EAAE,QAAS,EAAA;AAAA,QAClE,aAAe,EAAAA,KAAA,CACZ,KAAM,CAAA,CAACA,MAAE,OAAQ,EAAA,EAAGA,KAAE,CAAA,IAAA,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,MAAA,KAAA,GAAQ,MAAM,OAAQ,CAAA,GAAA;AAAA,IAC1B,OAAA,CAAQ,GAAI,CAAA,OAAM,MAAU,KAAA;AAC1B,MAAM,MAAA,GAAA,GAAMC,SAAK,CAAA,GAAA,EAAK,MAAM,CAAA;AAC5B,MAAQ,OAAA,CAAA,MAAMC,SAAK,CAAA,GAAG,CAAG,EAAA,WAAA,KAAgB,gBAAiB,CAAA,GAAG,CAAI,GAAA,CAAC,GAAG,CAAA;AAAA,KACtE;AAAA,GACH;AACA,EAAO,OAAA,KAAA,CAAM,MAAO,CAAA,CAAC,CAAG,EAAA,CAAA,KAAM,EAAE,MAAO,CAAA,CAAC,CAAG,EAAA,EAAE,CAAA;AAC/C;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/log.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Write a debug message',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-debug-line',\n name: 'Write \"Hello Backstage!\" log line',\n input: {\n message: 'Hello Backstage!',\n },\n },\n ],\n }),\n },\n {\n description: 'List the workspace directory',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-workspace-directory',\n name: 'List the workspace directory',\n input: {\n listWorkspace: true,\n },\n },\n ],\n }),\n },\n {\n description: 'List the workspace directory with file contents',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-workspace-directory',\n name: 'List the workspace directory with file contents',\n input: {\n listWorkspace: 'with-contents',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,kBAAA;AAAA,UACJ,IAAM,EAAA,mCAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA
|
|
1
|
+
{"version":3,"file":"log.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/log.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Write a debug message',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-debug-line',\n name: 'Write \"Hello Backstage!\" log line',\n input: {\n message: 'Hello Backstage!',\n },\n },\n ],\n }),\n },\n {\n description: 'List the workspace directory',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-workspace-directory',\n name: 'List the workspace directory',\n input: {\n listWorkspace: true,\n },\n },\n ],\n }),\n },\n {\n description: 'List the workspace directory with file contents',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-workspace-directory',\n name: 'List the workspace directory with file contents',\n input: {\n listWorkspace: 'with-contents',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,kBAAA;AAAA,UACJ,IAAM,EAAA,mCAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA;AAAA;AACX;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,8BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,2BAAA;AAAA,UACJ,IAAM,EAAA,8BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,aAAe,EAAA;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,iDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,2BAAA;AAAA,UACJ,IAAM,EAAA,iDAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,aAAe,EAAA;AAAA;AACjB;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/wait.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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { HumanDuration } from '@backstage/types';\nimport { Duration } from 'luxon';\nimport { examples } from './wait.examples';\n\nconst id = 'debug:wait';\n\nconst MAX_WAIT_TIME_IN_ISO = 'T00:10:00';\n\n/**\n * Waits for a certain period of time.\n *\n * @remarks\n *\n * This task is useful to give some waiting time for manual intervention.\n * Has to be used in a combination with other actions.\n *\n * @public\n */\nexport function createWaitAction(options?: {\n maxWaitTime?: Duration | HumanDuration;\n}) {\n const toDuration = (\n maxWaitTime: Duration | HumanDuration | undefined,\n ): Duration => {\n if (maxWaitTime) {\n if (maxWaitTime instanceof Duration) {\n return maxWaitTime;\n }\n return Duration.fromObject(maxWaitTime);\n }\n return Duration.fromISOTime(MAX_WAIT_TIME_IN_ISO);\n };\n\n return createTemplateAction<HumanDuration>({\n id,\n description: 'Waits for a certain period of time.',\n examples,\n schema: {\n input: {\n type: 'object',\n properties: {\n minutes: {\n title: 'Waiting period in minutes.',\n type: 'number',\n },\n seconds: {\n title: 'Waiting period in seconds.',\n type: 'number',\n },\n milliseconds: {\n title: 'Waiting period in milliseconds.',\n type: 'number',\n },\n },\n },\n },\n async handler(ctx) {\n const delayTime = Duration.fromObject(ctx.input);\n const maxWait = toDuration(options?.maxWaitTime);\n\n if (delayTime.minus(maxWait).toMillis() > 0) {\n throw new Error(\n `Waiting duration is longer than the maximum threshold of ${maxWait.toHuman()}`,\n );\n }\n\n await new Promise(resolve => {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(abort, delayTime.toMillis());\n ctx.signal?.addEventListener('abort', abort);\n\n function abort() {\n ctx.signal?.removeEventListener('abort', abort);\n clearTimeout(timeoutHandle!);\n controller.abort();\n resolve('finished');\n }\n });\n },\n });\n}\n"],"names":["Duration","createTemplateAction","examples"],"mappings":";;;;;;AAqBA,MAAM,EAAK,GAAA,YAAA
|
|
1
|
+
{"version":3,"file":"wait.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/wait.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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { HumanDuration } from '@backstage/types';\nimport { Duration } from 'luxon';\nimport { examples } from './wait.examples';\n\nconst id = 'debug:wait';\n\nconst MAX_WAIT_TIME_IN_ISO = 'T00:10:00';\n\n/**\n * Waits for a certain period of time.\n *\n * @remarks\n *\n * This task is useful to give some waiting time for manual intervention.\n * Has to be used in a combination with other actions.\n *\n * @public\n */\nexport function createWaitAction(options?: {\n maxWaitTime?: Duration | HumanDuration;\n}) {\n const toDuration = (\n maxWaitTime: Duration | HumanDuration | undefined,\n ): Duration => {\n if (maxWaitTime) {\n if (maxWaitTime instanceof Duration) {\n return maxWaitTime;\n }\n return Duration.fromObject(maxWaitTime);\n }\n return Duration.fromISOTime(MAX_WAIT_TIME_IN_ISO);\n };\n\n return createTemplateAction<HumanDuration>({\n id,\n description: 'Waits for a certain period of time.',\n examples,\n schema: {\n input: {\n type: 'object',\n properties: {\n minutes: {\n title: 'Waiting period in minutes.',\n type: 'number',\n },\n seconds: {\n title: 'Waiting period in seconds.',\n type: 'number',\n },\n milliseconds: {\n title: 'Waiting period in milliseconds.',\n type: 'number',\n },\n },\n },\n },\n async handler(ctx) {\n const delayTime = Duration.fromObject(ctx.input);\n const maxWait = toDuration(options?.maxWaitTime);\n\n if (delayTime.minus(maxWait).toMillis() > 0) {\n throw new Error(\n `Waiting duration is longer than the maximum threshold of ${maxWait.toHuman()}`,\n );\n }\n\n await new Promise(resolve => {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(abort, delayTime.toMillis());\n ctx.signal?.addEventListener('abort', abort);\n\n function abort() {\n ctx.signal?.removeEventListener('abort', abort);\n clearTimeout(timeoutHandle!);\n controller.abort();\n resolve('finished');\n }\n });\n },\n });\n}\n"],"names":["Duration","createTemplateAction","examples"],"mappings":";;;;;;AAqBA,MAAM,EAAK,GAAA,YAAA;AAEX,MAAM,oBAAuB,GAAA,WAAA;AAYtB,SAAS,iBAAiB,OAE9B,EAAA;AACD,EAAM,MAAA,UAAA,GAAa,CACjB,WACa,KAAA;AACb,IAAA,IAAI,WAAa,EAAA;AACf,MAAA,IAAI,uBAAuBA,cAAU,EAAA;AACnC,QAAO,OAAA,WAAA;AAAA;AAET,MAAO,OAAAA,cAAA,CAAS,WAAW,WAAW,CAAA;AAAA;AAExC,IAAO,OAAAA,cAAA,CAAS,YAAY,oBAAoB,CAAA;AAAA,GAClD;AAEA,EAAA,OAAOC,yCAAoC,CAAA;AAAA,IACzC,EAAA;AAAA,IACA,WAAa,EAAA,qCAAA;AAAA,cACbC,sBAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,4BAAA;AAAA,YACP,IAAM,EAAA;AAAA,WACR;AAAA,UACA,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,4BAAA;AAAA,YACP,IAAM,EAAA;AAAA,WACR;AAAA,UACA,YAAc,EAAA;AAAA,YACZ,KAAO,EAAA,iCAAA;AAAA,YACP,IAAM,EAAA;AAAA;AACR;AACF;AACF,KACF;AAAA,IACA,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAA,MAAM,SAAY,GAAAF,cAAA,CAAS,UAAW,CAAA,GAAA,CAAI,KAAK,CAAA;AAC/C,MAAM,MAAA,OAAA,GAAU,UAAW,CAAA,OAAA,EAAS,WAAW,CAAA;AAE/C,MAAA,IAAI,UAAU,KAAM,CAAA,OAAO,CAAE,CAAA,QAAA,KAAa,CAAG,EAAA;AAC3C,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,CAAA,yDAAA,EAA4D,OAAQ,CAAA,OAAA,EAAS,CAAA;AAAA,SAC/E;AAAA;AAGF,MAAM,MAAA,IAAI,QAAQ,CAAW,OAAA,KAAA;AAC3B,QAAM,MAAA,UAAA,GAAa,IAAI,eAAgB,EAAA;AACvC,QAAA,MAAM,aAAgB,GAAA,UAAA,CAAW,KAAO,EAAA,SAAA,CAAU,UAAU,CAAA;AAC5D,QAAI,GAAA,CAAA,MAAA,EAAQ,gBAAiB,CAAA,OAAA,EAAS,KAAK,CAAA;AAE3C,QAAA,SAAS,KAAQ,GAAA;AACf,UAAI,GAAA,CAAA,MAAA,EAAQ,mBAAoB,CAAA,OAAA,EAAS,KAAK,CAAA;AAC9C,UAAA,YAAA,CAAa,aAAc,CAAA;AAC3B,UAAA,UAAA,CAAW,KAAM,EAAA;AACjB,UAAA,OAAA,CAAQ,UAAU,CAAA;AAAA;AACpB,OACD,CAAA;AAAA;AACH,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/wait.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Waiting for 50 milliseconds',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-milliseconds',\n name: 'Waiting for 50 milliseconds',\n input: {\n milliseconds: 50,\n },\n },\n ],\n }),\n },\n {\n description: 'Waiting for 5 seconds',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-5sec',\n name: 'Waiting for 5 seconds',\n input: {\n seconds: 5,\n },\n },\n ],\n }),\n },\n {\n description: 'Waiting for 1 minutes',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-1min',\n name: 'Waiting for 1 minutes',\n input: {\n minutes: 1,\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,6BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,mBAAA;AAAA,UACJ,IAAM,EAAA,6BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,YAAc,EAAA
|
|
1
|
+
{"version":3,"file":"wait.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/wait.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Waiting for 50 milliseconds',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-milliseconds',\n name: 'Waiting for 50 milliseconds',\n input: {\n milliseconds: 50,\n },\n },\n ],\n }),\n },\n {\n description: 'Waiting for 5 seconds',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-5sec',\n name: 'Waiting for 5 seconds',\n input: {\n seconds: 5,\n },\n },\n ],\n }),\n },\n {\n description: 'Waiting for 1 minutes',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-1min',\n name: 'Waiting for 1 minutes',\n input: {\n minutes: 1,\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,6BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,mBAAA;AAAA,UACJ,IAAM,EAAA,6BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,YAAc,EAAA;AAAA;AAChB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,WAAA;AAAA,UACJ,IAAM,EAAA,uBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA;AAAA;AACX;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,WAAA;AAAA,UACJ,IAAM,EAAA,uBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA;AAAA;AACX;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|