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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/ScaffolderPlugin.cjs.js +1 -0
  3. package/dist/ScaffolderPlugin.cjs.js.map +1 -1
  4. package/dist/deprecated.cjs.js.map +1 -1
  5. package/dist/index.cjs.js +2 -0
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.d.ts +21 -1
  8. package/dist/lib/templating/SecureTemplater.cjs.js.map +1 -1
  9. package/dist/lib/templating/filters.cjs.js.map +1 -1
  10. package/dist/lib/templating/helpers.cjs.js.map +1 -1
  11. package/dist/scaffolder/actions/TemplateActionRegistry.cjs.js.map +1 -1
  12. package/dist/scaffolder/actions/builtin/catalog/fetch.cjs.js +11 -11
  13. package/dist/scaffolder/actions/builtin/catalog/fetch.cjs.js.map +1 -1
  14. package/dist/scaffolder/actions/builtin/catalog/fetch.examples.cjs.js.map +1 -1
  15. package/dist/scaffolder/actions/builtin/catalog/register.cjs.js.map +1 -1
  16. package/dist/scaffolder/actions/builtin/catalog/register.examples.cjs.js.map +1 -1
  17. package/dist/scaffolder/actions/builtin/catalog/write.cjs.js +4 -4
  18. package/dist/scaffolder/actions/builtin/catalog/write.cjs.js.map +1 -1
  19. package/dist/scaffolder/actions/builtin/catalog/write.examples.cjs.js.map +1 -1
  20. package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js +2 -0
  21. package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js.map +1 -1
  22. package/dist/scaffolder/actions/builtin/debug/log.cjs.js +4 -4
  23. package/dist/scaffolder/actions/builtin/debug/log.cjs.js.map +1 -1
  24. package/dist/scaffolder/actions/builtin/debug/log.examples.cjs.js.map +1 -1
  25. package/dist/scaffolder/actions/builtin/debug/wait.cjs.js.map +1 -1
  26. package/dist/scaffolder/actions/builtin/debug/wait.examples.cjs.js.map +1 -1
  27. package/dist/scaffolder/actions/builtin/fetch/plain.cjs.js.map +1 -1
  28. package/dist/scaffolder/actions/builtin/fetch/plain.examples.cjs.js.map +1 -1
  29. package/dist/scaffolder/actions/builtin/fetch/plainFile.cjs.js.map +1 -1
  30. package/dist/scaffolder/actions/builtin/fetch/plainFile.examples.cjs.js.map +1 -1
  31. package/dist/scaffolder/actions/builtin/fetch/template.cjs.js.map +1 -1
  32. package/dist/scaffolder/actions/builtin/fetch/template.examples.cjs.js.map +1 -1
  33. package/dist/scaffolder/actions/builtin/fetch/templateFile.cjs.js.map +1 -1
  34. package/dist/scaffolder/actions/builtin/fetch/templateFile.examples.cjs.js.map +1 -1
  35. package/dist/scaffolder/actions/builtin/filesystem/delete.cjs.js.map +1 -1
  36. package/dist/scaffolder/actions/builtin/filesystem/delete.examples.cjs.js.map +1 -1
  37. package/dist/scaffolder/actions/builtin/filesystem/read.cjs.js +68 -0
  38. package/dist/scaffolder/actions/builtin/filesystem/read.cjs.js.map +1 -0
  39. package/dist/scaffolder/actions/builtin/filesystem/rename.cjs.js.map +1 -1
  40. package/dist/scaffolder/actions/builtin/filesystem/rename.examples.cjs.js.map +1 -1
  41. package/dist/scaffolder/actions/deprecated.cjs.js.map +1 -1
  42. package/dist/scaffolder/dryrun/DecoratedActionsRegistry.cjs.js +1 -0
  43. package/dist/scaffolder/dryrun/DecoratedActionsRegistry.cjs.js.map +1 -1
  44. package/dist/scaffolder/dryrun/createDryRunner.cjs.js +10 -12
  45. package/dist/scaffolder/dryrun/createDryRunner.cjs.js.map +1 -1
  46. package/dist/scaffolder/tasks/DatabaseTaskStore.cjs.js.map +1 -1
  47. package/dist/scaffolder/tasks/DatabaseWorkspaceProvider.cjs.js.map +1 -1
  48. package/dist/scaffolder/tasks/NunjucksWorkflowRunner.cjs.js.map +1 -1
  49. package/dist/scaffolder/tasks/StorageTaskBroker.cjs.js.map +1 -1
  50. package/dist/scaffolder/tasks/TaskWorker.cjs.js.map +1 -1
  51. package/dist/scaffolder/tasks/WorkspaceService.cjs.js.map +1 -1
  52. package/dist/scaffolder/tasks/dbUtil.cjs.js.map +1 -1
  53. package/dist/scaffolder/tasks/helper.cjs.js.map +1 -1
  54. package/dist/scaffolder/tasks/logger.cjs.js.map +1 -1
  55. package/dist/scaffolder/tasks/taskRecoveryHelper.cjs.js.map +1 -1
  56. package/dist/service/conditionExports.cjs.js.map +1 -1
  57. package/dist/service/helpers.cjs.js.map +1 -1
  58. package/dist/service/router.cjs.js +26 -8
  59. package/dist/service/router.cjs.js.map +1 -1
  60. package/dist/service/rules.cjs.js +11 -11
  61. package/dist/service/rules.cjs.js.map +1 -1
  62. package/dist/util/checkPermissions.cjs.js.map +1 -1
  63. package/dist/util/metrics.cjs.js.map +1 -1
  64. package/package.json +35 -26
  65. package/alpha/package.json +0 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.27.0-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 7ab3371: Modified `createDryRunner` and corresponding route to include `templateMetaData` inside the `templateInfo`. This allows custom action writers to access things like `templateInfo.entity.metadata.name` via the action context while executing templates using the dry run framework.
8
+ - 2dae341: Add new `fs:readdir` action to list current content of the workspace
9
+ - Updated dependencies
10
+ - @backstage/plugin-scaffolder-common@1.5.7-next.0
11
+ - @backstage/plugin-bitbucket-cloud-common@0.2.25-next.0
12
+ - @backstage/backend-defaults@0.5.3-next.3
13
+ - @backstage/backend-plugin-api@1.0.2-next.2
14
+ - @backstage/catalog-client@1.8.0-next.1
15
+ - @backstage/catalog-model@1.7.0
16
+ - @backstage/config@1.2.0
17
+ - @backstage/errors@1.2.4
18
+ - @backstage/integration@1.15.1
19
+ - @backstage/types@1.1.1
20
+ - @backstage/plugin-auth-node@0.5.4-next.2
21
+ - @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.2.2-next.3
22
+ - @backstage/plugin-catalog-node@1.14.0-next.2
23
+ - @backstage/plugin-permission-common@0.8.1
24
+ - @backstage/plugin-permission-node@0.8.5-next.2
25
+ - @backstage/plugin-scaffolder-backend-module-azure@0.2.2-next.3
26
+ - @backstage/plugin-scaffolder-backend-module-bitbucket@0.3.2-next.3
27
+ - @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.2.2-next.3
28
+ - @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.2.2-next.3
29
+ - @backstage/plugin-scaffolder-backend-module-gerrit@0.2.2-next.3
30
+ - @backstage/plugin-scaffolder-backend-module-gitea@0.2.2-next.3
31
+ - @backstage/plugin-scaffolder-backend-module-github@0.5.2-next.3
32
+ - @backstage/plugin-scaffolder-backend-module-gitlab@0.6.1-next.3
33
+ - @backstage/plugin-scaffolder-node@0.5.1-next.3
34
+
35
+ ## 1.27.0-next.2
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies
40
+ - @backstage/catalog-client@1.8.0-next.1
41
+ - @backstage/backend-defaults@0.5.3-next.2
42
+ - @backstage/plugin-auth-node@0.5.4-next.2
43
+ - @backstage/plugin-catalog-node@1.14.0-next.2
44
+ - @backstage/plugin-scaffolder-backend-module-github@0.5.2-next.2
45
+ - @backstage/backend-plugin-api@1.0.2-next.2
46
+ - @backstage/catalog-model@1.7.0
47
+ - @backstage/config@1.2.0
48
+ - @backstage/errors@1.2.4
49
+ - @backstage/integration@1.15.1
50
+ - @backstage/types@1.1.1
51
+ - @backstage/plugin-bitbucket-cloud-common@0.2.24
52
+ - @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.2.2-next.2
53
+ - @backstage/plugin-permission-common@0.8.1
54
+ - @backstage/plugin-permission-node@0.8.5-next.2
55
+ - @backstage/plugin-scaffolder-backend-module-azure@0.2.2-next.2
56
+ - @backstage/plugin-scaffolder-backend-module-bitbucket@0.3.2-next.2
57
+ - @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.2.2-next.2
58
+ - @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.2.2-next.2
59
+ - @backstage/plugin-scaffolder-backend-module-gerrit@0.2.2-next.2
60
+ - @backstage/plugin-scaffolder-backend-module-gitea@0.2.2-next.2
61
+ - @backstage/plugin-scaffolder-backend-module-gitlab@0.6.1-next.2
62
+ - @backstage/plugin-scaffolder-common@1.5.6
63
+ - @backstage/plugin-scaffolder-node@0.5.1-next.2
64
+
3
65
  ## 1.27.0-next.1
4
66
 
5
67
  ### Minor Changes
@@ -16,6 +16,7 @@ var template = require('./scaffolder/actions/builtin/fetch/template.cjs.js');
16
16
  var templateFile = require('./scaffolder/actions/builtin/fetch/templateFile.cjs.js');
17
17
  var _delete = require('./scaffolder/actions/builtin/filesystem/delete.cjs.js');
18
18
  var rename = require('./scaffolder/actions/builtin/filesystem/rename.cjs.js');
19
+ require('./scaffolder/actions/builtin/filesystem/read.cjs.js');
19
20
  require('@backstage/plugin-scaffolder-backend-module-github');
20
21
  require('@backstage/plugin-scaffolder-backend-module-azure');
21
22
  require('@backstage/plugin-scaffolder-backend-module-bitbucket');
@@ -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,CAAA;AAAA,OACjC;AAAA,KACD,CAAA,CAAA;AAED,IAAI,IAAA,UAAA,CAAA;AACJ,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,cAAc,aAAe,EAAA;AAC3B,QAAA,IAAI,UAAY,EAAA;AACd,UAAM,MAAA,IAAI,MAAM,kCAAkC,CAAA,CAAA;AAAA,SACpD;AACA,QAAa,UAAA,GAAA,aAAA,CAAA;AAAA,OACf;AAAA,KACD,CAAA,CAAA;AAED,IAAA,MAAM,4BAA4D,EAAC,CAAA;AACnE,IAAA,MAAM,4BAA4D,EAAC,CAAA;AACnE,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,mBAAmB,UAAY,EAAA;AAC7B,QAAO,MAAA,CAAA,MAAA,CAAO,2BAA2B,UAAU,CAAA,CAAA;AAAA,OACrD;AAAA,MACA,mBAAmB,UAAY,EAAA;AAC7B,QAAO,MAAA,CAAA,MAAA,CAAO,2BAA2B,U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AAA,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,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A;AAAA,YACA,yBAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,wBAAqB,EAAA;AAAA,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;AAAA,SAC/B;AAEA,QAAM,MAAA,SAAA,GAAY,QAAQ,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,EAAE,CAAA,CAAE,KAAK,IAAI,CAAA;AAE5D,QAAIb,KAAA,CAAA,IAAA;AAAA,UACF,0DAA0D,SAAS,CAAA;AAAA,SACrE;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;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,0CAAA;AA6B7B,MAAM,mBAAsB,GAAAC,yCAAA;AAS5B,MAAM,aAAgB,GAAAC,mCAAA;AAQtB,MAAM,2BAA8B,GAAAC;;;;;;;"}
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;;;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -15,6 +15,7 @@ var template = require('./scaffolder/actions/builtin/fetch/template.cjs.js');
15
15
  var templateFile = require('./scaffolder/actions/builtin/fetch/templateFile.cjs.js');
16
16
  var _delete = require('./scaffolder/actions/builtin/filesystem/delete.cjs.js');
17
17
  var rename = require('./scaffolder/actions/builtin/filesystem/rename.cjs.js');
18
+ var read = require('./scaffolder/actions/builtin/filesystem/read.cjs.js');
18
19
  var deprecated = require('./scaffolder/actions/deprecated.cjs.js');
19
20
  var TemplateActionRegistry = require('./scaffolder/actions/TemplateActionRegistry.cjs.js');
20
21
  var DatabaseTaskStore = require('./scaffolder/tasks/DatabaseTaskStore.cjs.js');
@@ -38,6 +39,7 @@ exports.createFetchTemplateAction = template.createFetchTemplateAction;
38
39
  exports.createFetchTemplateFileAction = templateFile.createFetchTemplateFileAction;
39
40
  exports.createFilesystemDeleteAction = _delete.createFilesystemDeleteAction;
40
41
  exports.createFilesystemRenameAction = rename.createFilesystemRenameAction;
42
+ exports.createFilesystemReadDirAction = read.createFilesystemReadDirAction;
41
43
  exports.createGithubActionsDispatchAction = deprecated.createGithubActionsDispatchAction;
42
44
  exports.createGithubDeployKeyAction = deprecated.createGithubDeployKeyAction;
43
45
  exports.createGithubEnvironmentAction = deprecated.createGithubEnvironmentAction;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -256,6 +256,26 @@ declare const createFilesystemRenameAction: () => _backstage_plugin_scaffolder_n
256
256
  }>;
257
257
  }, _backstage_types.JsonObject>;
258
258
 
259
+ /**
260
+ * Creates new action that enables reading directories in the workspace.
261
+ * @public
262
+ */
263
+ declare const createFilesystemReadDirAction: () => _backstage_plugin_scaffolder_node.TemplateAction<{
264
+ paths: string[];
265
+ recursive?: boolean | undefined;
266
+ }, {
267
+ files: {
268
+ name: string;
269
+ path: string;
270
+ fullPath: string;
271
+ }[];
272
+ folders: {
273
+ name: string;
274
+ path: string;
275
+ fullPath: string;
276
+ }[];
277
+ }>;
278
+
259
279
  /**
260
280
  * @public
261
281
  * @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
@@ -941,4 +961,4 @@ declare const fetchContents: typeof fetchContents$1;
941
961
  */
942
962
  declare const ScaffolderEntitiesProcessor: typeof ScaffolderEntitiesProcessor$1;
943
963
 
944
- export { type ActionContext, type ActionPermissionRuleInput, type CreateBuiltInActionsOptions, type CreateGithubPullRequestActionOptions, type CreateWorkerOptions, type CurrentClaimedTask, DatabaseTaskStore, type DatabaseTaskStoreOptions, type RouterOptions, type RunCommandOptions, ScaffolderEntitiesProcessor, type SerializedTask, type SerializedTaskEvent, type TaskBroker, type TaskBrokerDispatchOptions, type TaskBrokerDispatchResult, type TaskCompletionState, type TaskContext, type TaskEventType, TaskManager, type TaskSecrets, type TaskStatus, type TaskStore, type TaskStoreCreateTaskOptions, type TaskStoreCreateTaskResult, type TaskStoreEmitOptions, type TaskStoreListEventsOptions, type TaskStoreRecoverTaskOptions, type TaskStoreShutDownTaskOptions, TaskWorker, type TemplateAction, TemplateActionRegistry, type TemplateFilter, type TemplateGlobal, type TemplatePermissionRuleInput, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchPlainFileAction, createFetchTemplateAction, createFetchTemplateFileAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishBitbucketServerPullRequestAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, createWaitAction, scaffolderPlugin as default, executeShellCommand, fetchContents };
964
+ export { type ActionContext, type ActionPermissionRuleInput, type CreateBuiltInActionsOptions, type CreateGithubPullRequestActionOptions, type CreateWorkerOptions, type CurrentClaimedTask, DatabaseTaskStore, type DatabaseTaskStoreOptions, type RouterOptions, type RunCommandOptions, ScaffolderEntitiesProcessor, type SerializedTask, type SerializedTaskEvent, type TaskBroker, type TaskBrokerDispatchOptions, type TaskBrokerDispatchResult, type TaskCompletionState, type TaskContext, type TaskEventType, TaskManager, type TaskSecrets, type TaskStatus, type TaskStore, type TaskStoreCreateTaskOptions, type TaskStoreCreateTaskResult, type TaskStoreEmitOptions, type TaskStoreListEventsOptions, type TaskStoreRecoverTaskOptions, type TaskStoreShutDownTaskOptions, TaskWorker, type TemplateAction, TemplateActionRegistry, type TemplateFilter, type TemplateGlobal, type TemplatePermissionRuleInput, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchPlainFileAction, createFetchTemplateAction, createFetchTemplateFileAction, createFilesystemDeleteAction, createFilesystemReadDirAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishBitbucketServerPullRequestAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, createWaitAction, scaffolderPlugin as default, executeShellCommand, fetchContents };
@@ -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;AAA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],"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;A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C,MAAA,CAAO,MAAO,CAAA,eAAA,EAAiB,UAAU,CAAG,EAAA;AAC/C,UAAO,OAAA,EAAA;AAAA;AAET,QAAM,MAAA,MAAA,GAAS,gBAAgB,UAAU,CAAA;AACzC,QAAI,IAAA,OAAO,WAAW,UAAY,EAAA;AAChC,UAAO,OAAA,EAAA;AAAA;AAET,QAAM,MAAA,EAAA,GAAK,MAAO,CAAA,GAAG,IAAI,CAAA;AACzB,QAAA,OAAO,EAAO,KAAA,KAAA,CAAA,GAAY,EAAK,GAAA,IAAA,CAAK,UAAU,EAAE,CAAA;AAAA;AAClD,KACF;AAEA,IAAM,MAAA,cAAA,CAAe,IAAI,OAAO,CAAA;AAEhC,IAAM,MAAA,MAAA,GAAiC,CAAC,QAAA,EAAU,MAAW,KAAA;AAC3D,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAM,MAAA,IAAI,MAAM,0CAA0C,CAAA;AAAA;AAG5D,MAAA,aAAA,CAAc,OAAQ,CAAA,aAAA,EAAe,MAAO,CAAA,QAAQ,CAAC,CAAA;AACrD,MAAA,aAAA,CAAc,OAAQ,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,YAAA;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,CAAA;AACpE,MAAO,OAAA,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAA;AAAA,KACzB;AAAA,GACF,CAAA;AACF;;;;"}
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,CAAA;AAE9C,CAAA;AAYO,SAAS,mBAA8B,GAAA;AAC5C,EAAM,MAAA,OAAA,GAAU,QAAQ,QAAS,CAAA,IAAA,CAAA;AACjC,EAAA,OAAO,SAAS,OAAQ,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,GAAG,EAAE,CAAA,CAAA;AAC3C;;;;;"}
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,CAAA;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,CAAA;AAAA,OACvC,CAAA;AAAA,KACF;AAEA,IAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,CAAI,MAAO,CAAA,EAAA,EAAI,MAAM,CAAA,CAAA;AAAA,GACpC;AAAA,EAEA,IAAI,QAAkC,EAAA;AACpC,IAAA,MAAM,MAAS,GAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,CAAI,QAAQ,CAAA,CAAA;AACxC,IAAA,IAAI,CAAC,MAAQ,EAAA;AACX,MAAA,MAAM,IAAIC,oBAAA;AAAA,QACR,4BAA4B,QAAQ,CAAA,oBAAA,CAAA;AAAA,OACtC,CAAA;AAAA,KACF;AACA,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAyB,GAAA;AACvB,IAAA,OAAO,CAAC,GAAG,IAAK,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAAA,GAClC;AACF;;;;"}
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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
4
- var zod = require('zod');
4
+ var z = require('zod');
5
5
  var catalogModel = require('@backstage/catalog-model');
6
6
  var fetch_examples = require('./fetch.examples.cjs.js');
7
7
 
@@ -14,25 +14,25 @@ function createFetchCatalogEntityAction(options) {
14
14
  examples: fetch_examples.examples,
15
15
  supportsDryRun: true,
16
16
  schema: {
17
- input: zod.z.object({
18
- entityRef: zod.z.string({
17
+ input: z.z.object({
18
+ entityRef: z.z.string({
19
19
  description: "Entity reference of the entity to get"
20
20
  }).optional(),
21
- entityRefs: zod.z.array(zod.z.string(), {
21
+ entityRefs: z.z.array(z.z.string(), {
22
22
  description: "Entity references of the entities to get"
23
23
  }).optional(),
24
- optional: zod.z.boolean({
24
+ optional: z.z.boolean({
25
25
  description: "Allow the entity or entities to optionally exist. Default: false"
26
26
  }).optional(),
27
- defaultKind: zod.z.string({ description: "The default kind" }).optional(),
28
- defaultNamespace: zod.z.string({ description: "The default namespace" }).optional()
27
+ defaultKind: z.z.string({ description: "The default kind" }).optional(),
28
+ defaultNamespace: z.z.string({ description: "The default namespace" }).optional()
29
29
  }),
30
- output: zod.z.object({
31
- entity: zod.z.any({
30
+ output: z.z.object({
31
+ entity: z.z.any({
32
32
  description: "Object containing same values used in the Entity schema. Only when used with `entityRef` parameter."
33
33
  }).optional(),
34
- entities: zod.z.array(
35
- zod.z.any({
34
+ entities: z.z.array(
35
+ z.z.any({
36
36
  description: "Array containing objects with same values used in the Entity schema. Only when used with `entityRefs` parameter."
37
37
  })
38
38
  ).optional()
@@ -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 },\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,CAAA,GAAA,EAAK,EAAE,WAAA,EAAa,kBAAkB,CAAA;AAAA,eACvD;AAAA,aACF;AAAA,WACF;AAAA,UACA;AAAA,YACE,KAAA;AAAA,WACF;AAAA,SACF,CAAA;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,CAAA;AAAA,WACrD;AACA,UAAA,OAAO,CAAK,IAAA,IAAA,CAAA;AAAA,SACb,CAAA,CAAA;AAED,QAAI,GAAA,CAAA,MAAA,CAAO,YAAY,aAAa,CAAA,CAAA;AAAA,OACtC;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
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,IAAE,MAAO,CAAA;AAAA,QACd,SAAA,EAAWA,IACR,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACZ,UAAY,EAAAA,GAAA,CACT,KAAM,CAAAA,GAAA,CAAE,QAAU,EAAA;AAAA,UACjB,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACZ,QAAA,EAAUA,IACP,OAAQ,CAAA;AAAA,UACP,WACE,EAAA;AAAA,SACH,EACA,QAAS,EAAA;AAAA,QACZ,WAAA,EAAaA,IAAE,MAAO,CAAA,EAAE,aAAa,kBAAmB,EAAC,EAAE,QAAS,EAAA;AAAA,QACpE,gBAAA,EAAkBA,IACf,MAAO,CAAA,EAAE,aAAa,uBAAwB,EAAC,EAC/C,QAAS;AAAA,OACb,CAAA;AAAA,MACD,MAAA,EAAQA,IAAE,MAAO,CAAA;AAAA,QACf,MAAA,EAAQA,IACL,GAAI,CAAA;AAAA,UACH,WACE,EAAA;AAAA,SACH,EACA,QAAS,EAAA;AAAA,QACZ,UAAUA,GACP,CAAA,KAAA;AAAA,UACCA,IAAE,GAAI,CAAA;AAAA,YACJ,WACE,EAAA;AAAA,WACH;AAAA,UAEF,QAAS;AAAA,OACb;AAAA,KACH;AAAA,IACA,MAAM,QAAQ,G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AA,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,wBAAA;AAAA,WACb;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;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,CAAA;AAAA,WACvC;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
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,CAAA;AAMJ,SAAS,4BAA4B,OAIzC,EAAA;AACD,EAAA,MAAM,EAAE,aAAA,EAAe,YAAc,EAAA,IAAA,EAAS,GAAA,OAAA,CAAA;AAE9C,EAAA,OAAOA,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SACR;AAAA,OACF;AAEA,MAAI,GAAA,CAAA,MAAA,CAAO,kBAAkB,cAAc,CAAA,CAAA;AAAA,KAC7C;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
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;AAAA,cACFC,0BAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,KAAO,EAAA;AAAA,UACL;AAAA,YACE,IAAM,EAAA,QAAA;AAAA,YACN,QAAA,EAAU,CAAC,gBAAgB,CAAA;AAAA,YAC3B,UAAY,EAAA;AAAA,cACV,cAAgB,EAAA;AAAA,gBACd,KAAO,EAAA,kBAAA;AAAA,gBACP,WACE,EAAA,4DAAA;AAAA,gBACF,IAAM,EAAA;AAAA,eACR;AAAA,cACA,QAAU,EAAA;AAAA,gBACR,KAAO,EAAA,UAAA;AAAA,gBACP,WACE,EAAA,oEAAA;AAAA,gBACF,IAAM,EAAA;AAAA;AACR;AACF,WACF;AAAA,UACA;AAAA,YACE,IAAM,EAAA,QAAA;AAAA,YACN,QAAA,EAAU,CAAC,iBAAiB,CAAA;AAAA,YAC5B,UAAY,EAAA;AAAA,cACV,eAAiB,EAAA;AAAA,gBACf,KAAO,EAAA,yBAAA;AAAA,gBACP,WACE,EAAA,qEAAA;AAAA,gBACF,IAAM,EAAA;AAAA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AAS,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,qEAAA;AAAA,WACJ;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
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;;;;"}
@@ -4,7 +4,7 @@ var fs = require('fs-extra');
4
4
  var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
5
5
  var yaml = require('yaml');
6
6
  var backendPluginApi = require('@backstage/backend-plugin-api');
7
- var zod = require('zod');
7
+ var z = require('zod');
8
8
  var write_examples = require('./write.examples.cjs.js');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -36,10 +36,10 @@ function createCatalogWriteAction() {
36
36
  id,
37
37
  description: "Writes the catalog-info.yaml for your template",
38
38
  schema: {
39
- input: zod.z.object({
40
- filePath: zod.z.string().optional().describe("Defaults to catalog-info.yaml"),
39
+ input: z.z.object({
40
+ filePath: z.z.string().optional().describe("Defaults to catalog-info.yaml"),
41
41
  // TODO: this should reference an zod entity validator if it existed.
42
- entity: zod.z.record(zod.z.any()).describe(
42
+ entity: z.z.record(z.z.any()).describe(
43
43
  "You can provide the same values used in the Entity schema."
44
44
  )
45
45
  })
@@ -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,CAAA;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,4DAAA;AAAA,SACF;AAAA,OACH,CAAA;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,CAAA;AACjC,MAAM,MAAA,SAAA,GAAY,IAAI,YAAc,EAAA,SAAA,CAAA;AACpC,MAAA,MAAM,OAAO,QAAY,IAAA,mBAAA,CAAA;AACzB,MAAA,GAAA,CAAI,MAAO,CAAA,IAAA,CAAK,CAAW,QAAA,EAAA,IAAI,CAAE,CAAA,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,SAAA;AAAA,eAClC;AAAA,aAEF,GAAA,KAAA,CAAA;AAAA,WACN;AAAA,SACD,CAAA;AAAA,OACH,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
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,IAAE,MAAO,CAAA;AAAA,QACd,UAAUA,GACP,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,+BAA+B,CAAA;AAAA;AAAA,QAE3C,QAAQA,GACL,CAAA,MAAA,CAAOA,GAAE,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,EAAC;AAAA,eAChB;AAAA,cACA,IAAM,EAAA;AAAA,gBACJ,IAAM,EAAA,SAAA;AAAA,gBACN,SAAW,EAAA,YAAA;AAAA,gBACX,KAAO,EAAA,eAAA;AAAA,eACT;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
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;;;;"}
@@ -12,6 +12,7 @@ var template = require('./fetch/template.cjs.js');
12
12
  var templateFile = require('./fetch/templateFile.cjs.js');
13
13
  var _delete = require('./filesystem/delete.cjs.js');
14
14
  var rename = require('./filesystem/rename.cjs.js');
15
+ var read = require('./filesystem/read.cjs.js');
15
16
  var github = require('@backstage/plugin-scaffolder-backend-module-github');
16
17
  var azure = require('@backstage/plugin-scaffolder-backend-module-azure');
17
18
  var bitbucket = require('@backstage/plugin-scaffolder-backend-module-bitbucket');
@@ -112,6 +113,7 @@ const createBuiltinActions = (options) => {
112
113
  fetch.createFetchCatalogEntityAction({ catalogClient, auth }),
113
114
  write.createCatalogWriteAction(),
114
115
  _delete.createFilesystemDeleteAction(),
116
+ read.createFilesystemReadDirAction(),
115
117
  rename.createFilesystemRenameAction(),
116
118
  github.createGithubActionsDispatchAction({
117
119
  integrations,