@backstage/plugin-scaffolder-backend 1.26.0-next.1 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +1 -1
  3. package/alpha/package.json +1 -1
  4. package/dist/ScaffolderPlugin.cjs.js +168 -0
  5. package/dist/ScaffolderPlugin.cjs.js.map +1 -0
  6. package/dist/alpha.cjs.js +8 -197
  7. package/dist/alpha.cjs.js.map +1 -1
  8. package/dist/alpha.d.ts +4 -8
  9. package/dist/deprecated.cjs.js +15 -0
  10. package/dist/deprecated.cjs.js.map +1 -0
  11. package/dist/index.cjs.js +60 -133
  12. package/dist/index.cjs.js.map +1 -1
  13. package/dist/index.d.ts +11 -3
  14. package/dist/lib/templating/SecureTemplater.cjs.js +169 -0
  15. package/dist/lib/templating/SecureTemplater.cjs.js.map +1 -0
  16. package/dist/lib/templating/filters.cjs.js +26 -0
  17. package/dist/lib/templating/filters.cjs.js.map +1 -0
  18. package/dist/lib/templating/helpers.cjs.js +13 -0
  19. package/dist/lib/templating/helpers.cjs.js.map +1 -0
  20. package/dist/scaffolder/actions/TemplateActionRegistry.cjs.js +30 -0
  21. package/dist/scaffolder/actions/TemplateActionRegistry.cjs.js.map +1 -0
  22. package/dist/scaffolder/actions/builtin/catalog/fetch.cjs.js +93 -0
  23. package/dist/scaffolder/actions/builtin/catalog/fetch.cjs.js.map +1 -0
  24. package/dist/scaffolder/actions/builtin/catalog/fetch.examples.cjs.js +43 -0
  25. package/dist/scaffolder/actions/builtin/catalog/fetch.examples.cjs.js.map +1 -0
  26. package/dist/scaffolder/actions/builtin/catalog/register.cjs.js +142 -0
  27. package/dist/scaffolder/actions/builtin/catalog/register.cjs.js.map +1 -0
  28. package/dist/scaffolder/actions/builtin/catalog/register.examples.cjs.js +28 -0
  29. package/dist/scaffolder/actions/builtin/catalog/register.examples.cjs.js.map +1 -0
  30. package/dist/scaffolder/actions/builtin/catalog/write.cjs.js +74 -0
  31. package/dist/scaffolder/actions/builtin/catalog/write.cjs.js.map +1 -0
  32. package/dist/scaffolder/actions/builtin/catalog/write.examples.cjs.js +56 -0
  33. package/dist/scaffolder/actions/builtin/catalog/write.examples.cjs.js.map +1 -0
  34. package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js +156 -0
  35. package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js.map +1 -0
  36. package/dist/scaffolder/actions/builtin/debug/log.cjs.js +66 -0
  37. package/dist/scaffolder/actions/builtin/debug/log.cjs.js.map +1 -0
  38. package/dist/scaffolder/actions/builtin/debug/log.examples.cjs.js +58 -0
  39. package/dist/scaffolder/actions/builtin/debug/log.examples.cjs.js.map +1 -0
  40. package/dist/scaffolder/actions/builtin/debug/wait.cjs.js +66 -0
  41. package/dist/scaffolder/actions/builtin/debug/wait.cjs.js.map +1 -0
  42. package/dist/scaffolder/actions/builtin/debug/wait.examples.cjs.js +58 -0
  43. package/dist/scaffolder/actions/builtin/debug/wait.examples.cjs.js.map +1 -0
  44. package/dist/scaffolder/actions/builtin/fetch/plain.cjs.js +56 -0
  45. package/dist/scaffolder/actions/builtin/fetch/plain.cjs.js.map +1 -0
  46. package/dist/scaffolder/actions/builtin/fetch/plain.examples.cjs.js +44 -0
  47. package/dist/scaffolder/actions/builtin/fetch/plain.examples.cjs.js.map +1 -0
  48. package/dist/scaffolder/actions/builtin/fetch/plainFile.cjs.js +56 -0
  49. package/dist/scaffolder/actions/builtin/fetch/plainFile.cjs.js.map +1 -0
  50. package/dist/scaffolder/actions/builtin/fetch/plainFile.examples.cjs.js +29 -0
  51. package/dist/scaffolder/actions/builtin/fetch/plainFile.examples.cjs.js.map +1 -0
  52. package/dist/scaffolder/actions/builtin/fetch/template.cjs.js +241 -0
  53. package/dist/scaffolder/actions/builtin/fetch/template.cjs.js.map +1 -0
  54. package/dist/scaffolder/actions/builtin/fetch/template.examples.cjs.js +35 -0
  55. package/dist/scaffolder/actions/builtin/fetch/template.examples.cjs.js.map +1 -0
  56. package/dist/scaffolder/actions/builtin/fetch/templateFile.cjs.js +119 -0
  57. package/dist/scaffolder/actions/builtin/fetch/templateFile.cjs.js.map +1 -0
  58. package/dist/scaffolder/actions/builtin/fetch/templateFile.examples.cjs.js +34 -0
  59. package/dist/scaffolder/actions/builtin/fetch/templateFile.examples.cjs.js.map +1 -0
  60. package/dist/scaffolder/actions/builtin/filesystem/delete.cjs.js +54 -0
  61. package/dist/scaffolder/actions/builtin/filesystem/delete.cjs.js.map +1 -0
  62. package/dist/scaffolder/actions/builtin/filesystem/delete.examples.cjs.js +44 -0
  63. package/dist/scaffolder/actions/builtin/filesystem/delete.examples.cjs.js.map +1 -0
  64. package/dist/scaffolder/actions/builtin/filesystem/rename.cjs.js +83 -0
  65. package/dist/scaffolder/actions/builtin/filesystem/rename.cjs.js.map +1 -0
  66. package/dist/scaffolder/actions/builtin/filesystem/rename.examples.cjs.js +48 -0
  67. package/dist/scaffolder/actions/builtin/filesystem/rename.examples.cjs.js.map +1 -0
  68. package/dist/scaffolder/actions/deprecated.cjs.js +74 -0
  69. package/dist/scaffolder/actions/deprecated.cjs.js.map +1 -0
  70. package/dist/scaffolder/dryrun/DecoratedActionsRegistry.cjs.js +57 -0
  71. package/dist/scaffolder/dryrun/DecoratedActionsRegistry.cjs.js.map +1 -0
  72. package/dist/scaffolder/dryrun/createDryRunner.cjs.js +97 -0
  73. package/dist/scaffolder/dryrun/createDryRunner.cjs.js.map +1 -0
  74. package/dist/scaffolder/tasks/DatabaseTaskStore.cjs.js +430 -0
  75. package/dist/scaffolder/tasks/DatabaseTaskStore.cjs.js.map +1 -0
  76. package/dist/scaffolder/tasks/DatabaseWorkspaceProvider.cjs.js +22 -0
  77. package/dist/scaffolder/tasks/DatabaseWorkspaceProvider.cjs.js.map +1 -0
  78. package/dist/scaffolder/tasks/NunjucksWorkflowRunner.cjs.js +545 -0
  79. package/dist/scaffolder/tasks/NunjucksWorkflowRunner.cjs.js.map +1 -0
  80. package/dist/scaffolder/tasks/StorageTaskBroker.cjs.js +318 -0
  81. package/dist/scaffolder/tasks/StorageTaskBroker.cjs.js.map +1 -0
  82. package/dist/scaffolder/tasks/TaskWorker.cjs.js +110 -0
  83. package/dist/scaffolder/tasks/TaskWorker.cjs.js.map +1 -0
  84. package/dist/scaffolder/tasks/WorkspaceService.cjs.js +50 -0
  85. package/dist/scaffolder/tasks/WorkspaceService.cjs.js.map +1 -0
  86. package/dist/scaffolder/tasks/dbUtil.cjs.js +20 -0
  87. package/dist/scaffolder/tasks/dbUtil.cjs.js.map +1 -0
  88. package/dist/scaffolder/tasks/helper.cjs.js +46 -0
  89. package/dist/scaffolder/tasks/helper.cjs.js.map +1 -0
  90. package/dist/scaffolder/tasks/logger.cjs.js +156 -0
  91. package/dist/scaffolder/tasks/logger.cjs.js.map +1 -0
  92. package/dist/scaffolder/tasks/taskRecoveryHelper.cjs.js +18 -0
  93. package/dist/scaffolder/tasks/taskRecoveryHelper.cjs.js.map +1 -0
  94. package/dist/service/conditionExports.cjs.js +26 -0
  95. package/dist/service/conditionExports.cjs.js.map +1 -0
  96. package/dist/service/helpers.cjs.js +92 -0
  97. package/dist/service/helpers.cjs.js.map +1 -0
  98. package/dist/service/router.cjs.js +640 -0
  99. package/dist/service/router.cjs.js.map +1 -0
  100. package/dist/service/rules.cjs.js +97 -0
  101. package/dist/service/rules.cjs.js.map +1 -0
  102. package/dist/util/checkPermissions.cjs.js +25 -0
  103. package/dist/util/checkPermissions.cjs.js.map +1 -0
  104. package/dist/util/metrics.cjs.js +24 -0
  105. package/dist/util/metrics.cjs.js.map +1 -0
  106. package/package.json +32 -31
  107. package/dist/cjs/router-BqZK9yax.cjs.js +0 -4101
  108. package/dist/cjs/router-BqZK9yax.cjs.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createBuiltinActions.cjs.js","sources":["../../../../src/scaffolder/actions/builtin/createBuiltinActions.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CatalogApi } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createFetchCatalogEntityAction,\n} from './catalog';\n\nimport { createDebugLogAction, createWaitAction } from './debug';\nimport {\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n} from './fetch';\nimport {\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n} from './filesystem';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-github';\n\nimport { createPublishAzureAction } from '@backstage/plugin-scaffolder-backend-module-azure';\n\nimport { createPublishBitbucketAction } from '@backstage/plugin-scaffolder-backend-module-bitbucket';\n\nimport {\n createPublishBitbucketCloudAction,\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';\n\nimport {\n createPublishBitbucketServerAction,\n createPublishBitbucketServerPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';\n\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from '@backstage/plugin-scaffolder-backend-module-gerrit';\n\nimport {\n createPublishGitlabAction,\n createGitlabRepoPushAction,\n createPublishGitlabMergeRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-gitlab';\n\nimport { createPublishGiteaAction } from '@backstage/plugin-scaffolder-backend-module-gitea';\nimport { AuthService, UrlReaderService } from '@backstage/backend-plugin-api';\n\n/**\n * The options passed to {@link createBuiltinActions}\n * @public\n */\nexport interface CreateBuiltInActionsOptions {\n /**\n * The {@link @backstage/backend-plugin-api#UrlReaderService} interface that will be used in the default actions.\n */\n reader: UrlReaderService;\n /**\n * The {@link @backstage/integrations#ScmIntegrations} that will be used in the default actions.\n */\n integrations: ScmIntegrations;\n /**\n * The {@link @backstage/catalog-client#CatalogApi} that will be used in the default actions.\n */\n catalogClient: CatalogApi;\n /**\n * The {@link @backstage/backend-plugin-api#AuthService} that will be used in the default actions.\n */\n auth?: AuthService;\n /**\n * The {@link @backstage/config#Config} that will be used in the default actions.\n */\n config: Config;\n /**\n * Additional custom filters that will be passed to the nunjucks template engine for use in\n * Template Manifests and also template skeleton files when using `fetch:template`.\n */\n additionalTemplateFilters?: Record<string, TemplateFilter>;\n additionalTemplateGlobals?: Record<string, TemplateGlobal>;\n}\n\n/**\n * A function to generate create a list of default actions that the scaffolder provides.\n * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones\n *\n * TODO(blam): version 2 of the scaffolder shouldn't ship with the additional modules. We should ship the basics, and let people install\n * modules for the providers they want to use.\n * @public\n * @returns A list of actions that can be used in the scaffolder\n *\n */\nexport const createBuiltinActions = (\n options: CreateBuiltInActionsOptions,\n): TemplateAction[] => {\n const {\n reader,\n integrations,\n catalogClient,\n auth,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n } = options;\n\n const githubCredentialsProvider: GithubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const actions = [\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createPublishGerritAction({\n integrations,\n config,\n }),\n createPublishGerritReviewAction({\n integrations,\n config,\n }),\n createPublishGiteaAction({\n integrations,\n config,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n }),\n createPublishGitlabAction({\n integrations,\n config,\n }),\n createPublishGitlabMergeRequestAction({\n integrations,\n }),\n createGitlabRepoPushAction({\n integrations,\n }),\n createPublishBitbucketAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudPullRequestAction({ integrations, config }),\n createPublishBitbucketServerAction({\n integrations,\n config,\n }),\n createPublishBitbucketServerPullRequestAction({\n integrations,\n config,\n }),\n createPublishAzureAction({\n integrations,\n config,\n }),\n createDebugLogAction(),\n createWaitAction(),\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalogClient,\n }),\n createGithubDeployKeyAction({\n integrations,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n }),\n createBitbucketPipelinesRunAction({\n integrations,\n }),\n ];\n\n return actions as TemplateAction[];\n};\n"],"names":["DefaultGithubCredentialsProvider","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createPublishGerritAction","createPublishGerritReviewAction","createPublishGiteaAction","createPublishGithubAction","createPublishGithubPullRequestAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createGitlabRepoPushAction","createPublishBitbucketAction","createPublishBitbucketCloudAction","createPublishBitbucketCloudPullRequestAction","createPublishBitbucketServerAction","createPublishBitbucketServerPullRequestAction","createPublishAzureAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","createGithubActionsDispatchAction","createGithubWebhookAction","createGithubIssuesLabelAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubEnvironmentAction","createGithubDeployKeyAction","createGithubAutolinksAction","createBitbucketPipelinesRunAction"],"mappings":"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"}
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ var fs$1 = require('fs-extra');
4
+ var path = require('path');
5
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
6
+ var log_examples = require('./log.examples.cjs.js');
7
+ var fs = require('fs');
8
+ var zod = require('zod');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
+
12
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
13
+
14
+ const id = "debug:log";
15
+ function createDebugLogAction() {
16
+ return pluginScaffolderNode.createTemplateAction({
17
+ id,
18
+ description: "Writes a message into the log and/or lists all files in the workspace.",
19
+ examples: log_examples.examples,
20
+ schema: {
21
+ input: zod.z.object({
22
+ message: zod.z.string({ description: "Message to output." }).optional(),
23
+ listWorkspace: zod.z.union([zod.z.boolean(), zod.z.enum(["with-filenames", "with-contents"])], {
24
+ description: 'List all files in the workspace. If used with "with-contents", also the file contents are listed.'
25
+ }).optional()
26
+ })
27
+ },
28
+ supportsDryRun: true,
29
+ async handler(ctx) {
30
+ ctx.logger.info(JSON.stringify(ctx.input, null, 2));
31
+ if (ctx.input?.message) {
32
+ ctx.logger.info(ctx.input.message);
33
+ }
34
+ if (ctx.input?.listWorkspace) {
35
+ const files = await recursiveReadDir(ctx.workspacePath);
36
+ ctx.logger.info(
37
+ `Workspace:
38
+ ${files.map((f) => {
39
+ const relativePath = path.relative(ctx.workspacePath, f);
40
+ if (ctx.input?.listWorkspace === "with-contents") {
41
+ const content = fs__default.default.readFileSync(f, "utf-8");
42
+ return ` - ${relativePath}:
43
+
44
+ ${content}`;
45
+ }
46
+ return ` - ${relativePath}`;
47
+ }).join("\n")}`
48
+ );
49
+ }
50
+ }
51
+ });
52
+ }
53
+ async function recursiveReadDir(dir) {
54
+ const subdirs = await fs$1.readdir(dir);
55
+ const files = await Promise.all(
56
+ subdirs.map(async (subdir) => {
57
+ const res = path.join(dir, subdir);
58
+ return (await fs$1.stat(res)).isDirectory() ? recursiveReadDir(res) : [res];
59
+ })
60
+ );
61
+ return files.reduce((a, f) => a.concat(f), []);
62
+ }
63
+
64
+ exports.createDebugLogAction = createDebugLogAction;
65
+ exports.recursiveReadDir = recursiveReadDir;
66
+ //# sourceMappingURL=log.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/log.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readdir, stat } from 'fs-extra';\nimport { join, relative } from 'path';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { examples } from './log.examples';\nimport fs from 'fs';\nimport { z } from 'zod';\n\nconst id = 'debug:log';\n\n/**\n * Writes a message into the log or lists all files in the workspace\n *\n * @remarks\n *\n * This task is useful for local development and testing of both the scaffolder\n * and scaffolder templates.\n *\n * @public\n */\nexport function createDebugLogAction() {\n return createTemplateAction<{\n message?: string;\n listWorkspace?: boolean | 'with-filenames' | 'with-contents';\n }>({\n id,\n description:\n 'Writes a message into the log and/or lists all files in the workspace.',\n examples,\n schema: {\n input: z.object({\n message: z.string({ description: 'Message to output.' }).optional(),\n listWorkspace: z\n .union([z.boolean(), z.enum(['with-filenames', 'with-contents'])], {\n description:\n 'List all files in the workspace. If used with \"with-contents\", also the file contents are listed.',\n })\n .optional(),\n }),\n },\n supportsDryRun: true,\n async handler(ctx) {\n ctx.logger.info(JSON.stringify(ctx.input, null, 2));\n\n if (ctx.input?.message) {\n ctx.logger.info(ctx.input.message);\n }\n\n if (ctx.input?.listWorkspace) {\n const files = await recursiveReadDir(ctx.workspacePath);\n ctx.logger.info(\n `Workspace:\\n${files\n .map(f => {\n const relativePath = relative(ctx.workspacePath, f);\n if (ctx.input?.listWorkspace === 'with-contents') {\n const content = fs.readFileSync(f, 'utf-8');\n return ` - ${relativePath}:\\n\\n ${content}`;\n }\n return ` - ${relativePath}`;\n })\n .join('\\n')}`,\n );\n }\n },\n });\n}\n\nexport async function recursiveReadDir(dir: string): Promise<string[]> {\n const subdirs = await readdir(dir);\n const files = await Promise.all(\n subdirs.map(async subdir => {\n const res = join(dir, subdir);\n return (await stat(res)).isDirectory() ? recursiveReadDir(res) : [res];\n }),\n );\n return files.reduce((a, f) => a.concat(f), []);\n}\n"],"names":["createTemplateAction","examples","z","relative","fs","readdir","join","stat"],"mappings":";;;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,WAAA,CAAA;AAYJ,SAAS,oBAAuB,GAAA;AACrC,EAAA,OAAOA,yCAGJ,CAAA;AAAA,IACD,EAAA;AAAA,IACA,WACE,EAAA,wEAAA;AAAA,cACFC,qBAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAA,EAAOC,MAAE,MAAO,CAAA;AAAA,QACd,OAAA,EAASA,MAAE,MAAO,CAAA,EAAE,aAAa,oBAAqB,EAAC,EAAE,QAAS,EAAA;AAAA,QAClE,aAAe,EAAAA,KAAA,CACZ,KAAM,CAAA,CAACA,MAAE,OAAQ,EAAA,EAAGA,KAAE,CAAA,IAAA,CAAK,CAAC,gBAAA,EAAkB,eAAe,CAAC,CAAC,CAAG,EAAA;AAAA,UACjE,WACE,EAAA,mGAAA;AAAA,SACH,EACA,QAAS,EAAA;AAAA,OACb,CAAA;AAAA,KACH;AAAA,IACA,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAI,GAAA,CAAA,MAAA,CAAO,KAAK,IAAK,CAAA,SAAA,CAAU,IAAI,KAAO,EAAA,IAAA,EAAM,CAAC,CAAC,CAAA,CAAA;AAElD,MAAI,IAAA,GAAA,CAAI,OAAO,OAAS,EAAA;AACtB,QAAA,GAAA,CAAI,MAAO,CAAA,IAAA,CAAK,GAAI,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,OACnC;AAEA,MAAI,IAAA,GAAA,CAAI,OAAO,aAAe,EAAA;AAC5B,QAAA,MAAM,KAAQ,GAAA,MAAM,gBAAiB,CAAA,GAAA,CAAI,aAAa,CAAA,CAAA;AACtD,QAAA,GAAA,CAAI,MAAO,CAAA,IAAA;AAAA,UACT,CAAA;AAAA,EAAe,KAAA,CACZ,IAAI,CAAK,CAAA,KAAA;AACR,YAAA,MAAM,YAAe,GAAAC,aAAA,CAAS,GAAI,CAAA,aAAA,EAAe,CAAC,CAAA,CAAA;AAClD,YAAI,IAAA,GAAA,CAAI,KAAO,EAAA,aAAA,KAAkB,eAAiB,EAAA;AAChD,cAAA,MAAM,OAAU,GAAAC,mBAAA,CAAG,YAAa,CAAA,CAAA,EAAG,OAAO,CAAA,CAAA;AAC1C,cAAA,OAAO,MAAM,YAAY,CAAA;AAAA;AAAA,EAAA,EAAU,OAAO,CAAA,CAAA,CAAA;AAAA,aAC5C;AACA,YAAA,OAAO,OAAO,YAAY,CAAA,CAAA,CAAA;AAAA,WAC3B,CAAA,CACA,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAAA,SACf,CAAA;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAEA,eAAsB,iBAAiB,GAAgC,EAAA;AACrE,EAAM,MAAA,OAAA,GAAU,MAAMC,YAAA,CAAQ,GAAG,CAAA,CAAA;AACjC,EAAM,MAAA,KAAA,GAAQ,MAAM,OAAQ,CAAA,GAAA;AAAA,IAC1B,OAAA,CAAQ,GAAI,CAAA,OAAM,MAAU,KAAA;AAC1B,MAAM,MAAA,GAAA,GAAMC,SAAK,CAAA,GAAA,EAAK,MAAM,CAAA,CAAA;AAC5B,MAAQ,OAAA,CAAA,MAAMC,SAAK,CAAA,GAAG,CAAG,EAAA,WAAA,KAAgB,gBAAiB,CAAA,GAAG,CAAI,GAAA,CAAC,GAAG,CAAA,CAAA;AAAA,KACtE,CAAA;AAAA,GACH,CAAA;AACA,EAAO,OAAA,KAAA,CAAM,MAAO,CAAA,CAAC,CAAG,EAAA,CAAA,KAAM,EAAE,MAAO,CAAA,CAAC,CAAG,EAAA,EAAE,CAAA,CAAA;AAC/C;;;;;"}
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Write a debug message",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "debug:log",
16
+ id: "write-debug-line",
17
+ name: 'Write "Hello Backstage!" log line',
18
+ input: {
19
+ message: "Hello Backstage!"
20
+ }
21
+ }
22
+ ]
23
+ })
24
+ },
25
+ {
26
+ description: "List the workspace directory",
27
+ example: yaml__default.default.stringify({
28
+ steps: [
29
+ {
30
+ action: "debug:log",
31
+ id: "write-workspace-directory",
32
+ name: "List the workspace directory",
33
+ input: {
34
+ listWorkspace: true
35
+ }
36
+ }
37
+ ]
38
+ })
39
+ },
40
+ {
41
+ description: "List the workspace directory with file contents",
42
+ example: yaml__default.default.stringify({
43
+ steps: [
44
+ {
45
+ action: "debug:log",
46
+ id: "write-workspace-directory",
47
+ name: "List the workspace directory with file contents",
48
+ input: {
49
+ listWorkspace: "with-contents"
50
+ }
51
+ }
52
+ ]
53
+ })
54
+ }
55
+ ];
56
+
57
+ exports.examples = examples;
58
+ //# sourceMappingURL=log.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/log.examples.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Write a debug message',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-debug-line',\n name: 'Write \"Hello Backstage!\" log line',\n input: {\n message: 'Hello Backstage!',\n },\n },\n ],\n }),\n },\n {\n description: 'List the workspace directory',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-workspace-directory',\n name: 'List the workspace directory',\n input: {\n listWorkspace: true,\n },\n },\n ],\n }),\n },\n {\n description: 'List the workspace directory with file contents',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:log',\n id: 'write-workspace-directory',\n name: 'List the workspace directory with file contents',\n input: {\n listWorkspace: 'with-contents',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,kBAAA;AAAA,UACJ,IAAM,EAAA,mCAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kBAAA;AAAA,WACX;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,8BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,2BAAA;AAAA,UACJ,IAAM,EAAA,8BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,aAAe,EAAA,IAAA;AAAA,WACjB;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,iDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,WAAA;AAAA,UACR,EAAI,EAAA,2BAAA;AAAA,UACJ,IAAM,EAAA,iDAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,aAAe,EAAA,eAAA;AAAA,WACjB;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
4
+ var luxon = require('luxon');
5
+ var wait_examples = require('./wait.examples.cjs.js');
6
+
7
+ const id = "debug:wait";
8
+ const MAX_WAIT_TIME_IN_ISO = "T00:10:00";
9
+ function createWaitAction(options) {
10
+ const toDuration = (maxWaitTime) => {
11
+ if (maxWaitTime) {
12
+ if (maxWaitTime instanceof luxon.Duration) {
13
+ return maxWaitTime;
14
+ }
15
+ return luxon.Duration.fromObject(maxWaitTime);
16
+ }
17
+ return luxon.Duration.fromISOTime(MAX_WAIT_TIME_IN_ISO);
18
+ };
19
+ return pluginScaffolderNode.createTemplateAction({
20
+ id,
21
+ description: "Waits for a certain period of time.",
22
+ examples: wait_examples.examples,
23
+ schema: {
24
+ input: {
25
+ type: "object",
26
+ properties: {
27
+ minutes: {
28
+ title: "Waiting period in minutes.",
29
+ type: "number"
30
+ },
31
+ seconds: {
32
+ title: "Waiting period in seconds.",
33
+ type: "number"
34
+ },
35
+ milliseconds: {
36
+ title: "Waiting period in milliseconds.",
37
+ type: "number"
38
+ }
39
+ }
40
+ }
41
+ },
42
+ async handler(ctx) {
43
+ const delayTime = luxon.Duration.fromObject(ctx.input);
44
+ const maxWait = toDuration(options?.maxWaitTime);
45
+ if (delayTime.minus(maxWait).toMillis() > 0) {
46
+ throw new Error(
47
+ `Waiting duration is longer than the maximum threshold of ${maxWait.toHuman()}`
48
+ );
49
+ }
50
+ await new Promise((resolve) => {
51
+ const controller = new AbortController();
52
+ const timeoutHandle = setTimeout(abort, delayTime.toMillis());
53
+ ctx.signal?.addEventListener("abort", abort);
54
+ function abort() {
55
+ ctx.signal?.removeEventListener("abort", abort);
56
+ clearTimeout(timeoutHandle);
57
+ controller.abort();
58
+ resolve("finished");
59
+ }
60
+ });
61
+ }
62
+ });
63
+ }
64
+
65
+ exports.createWaitAction = createWaitAction;
66
+ //# sourceMappingURL=wait.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/wait.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { HumanDuration } from '@backstage/types';\nimport { Duration } from 'luxon';\nimport { examples } from './wait.examples';\n\nconst id = 'debug:wait';\n\nconst MAX_WAIT_TIME_IN_ISO = 'T00:10:00';\n\n/**\n * Waits for a certain period of time.\n *\n * @remarks\n *\n * This task is useful to give some waiting time for manual intervention.\n * Has to be used in a combination with other actions.\n *\n * @public\n */\nexport function createWaitAction(options?: {\n maxWaitTime?: Duration | HumanDuration;\n}) {\n const toDuration = (\n maxWaitTime: Duration | HumanDuration | undefined,\n ): Duration => {\n if (maxWaitTime) {\n if (maxWaitTime instanceof Duration) {\n return maxWaitTime;\n }\n return Duration.fromObject(maxWaitTime);\n }\n return Duration.fromISOTime(MAX_WAIT_TIME_IN_ISO);\n };\n\n return createTemplateAction<HumanDuration>({\n id,\n description: 'Waits for a certain period of time.',\n examples,\n schema: {\n input: {\n type: 'object',\n properties: {\n minutes: {\n title: 'Waiting period in minutes.',\n type: 'number',\n },\n seconds: {\n title: 'Waiting period in seconds.',\n type: 'number',\n },\n milliseconds: {\n title: 'Waiting period in milliseconds.',\n type: 'number',\n },\n },\n },\n },\n async handler(ctx) {\n const delayTime = Duration.fromObject(ctx.input);\n const maxWait = toDuration(options?.maxWaitTime);\n\n if (delayTime.minus(maxWait).toMillis() > 0) {\n throw new Error(\n `Waiting duration is longer than the maximum threshold of ${maxWait.toHuman()}`,\n );\n }\n\n await new Promise(resolve => {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(abort, delayTime.toMillis());\n ctx.signal?.addEventListener('abort', abort);\n\n function abort() {\n ctx.signal?.removeEventListener('abort', abort);\n clearTimeout(timeoutHandle!);\n controller.abort();\n resolve('finished');\n }\n });\n },\n });\n}\n"],"names":["Duration","createTemplateAction","examples"],"mappings":";;;;;;AAqBA,MAAM,EAAK,GAAA,YAAA,CAAA;AAEX,MAAM,oBAAuB,GAAA,WAAA,CAAA;AAYtB,SAAS,iBAAiB,OAE9B,EAAA;AACD,EAAM,MAAA,UAAA,GAAa,CACjB,WACa,KAAA;AACb,IAAA,IAAI,WAAa,EAAA;AACf,MAAA,IAAI,uBAAuBA,cAAU,EAAA;AACnC,QAAO,OAAA,WAAA,CAAA;AAAA,OACT;AACA,MAAO,OAAAA,cAAA,CAAS,WAAW,WAAW,CAAA,CAAA;AAAA,KACxC;AACA,IAAO,OAAAA,cAAA,CAAS,YAAY,oBAAoB,CAAA,CAAA;AAAA,GAClD,CAAA;AAEA,EAAA,OAAOC,yCAAoC,CAAA;AAAA,IACzC,EAAA;AAAA,IACA,WAAa,EAAA,qCAAA;AAAA,cACbC,sBAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,4BAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,4BAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,YAAc,EAAA;AAAA,YACZ,KAAO,EAAA,iCAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAA,MAAM,SAAY,GAAAF,cAAA,CAAS,UAAW,CAAA,GAAA,CAAI,KAAK,CAAA,CAAA;AAC/C,MAAM,MAAA,OAAA,GAAU,UAAW,CAAA,OAAA,EAAS,WAAW,CAAA,CAAA;AAE/C,MAAA,IAAI,UAAU,KAAM,CAAA,OAAO,CAAE,CAAA,QAAA,KAAa,CAAG,EAAA;AAC3C,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,CAAA,yDAAA,EAA4D,OAAQ,CAAA,OAAA,EAAS,CAAA,CAAA;AAAA,SAC/E,CAAA;AAAA,OACF;AAEA,MAAM,MAAA,IAAI,QAAQ,CAAW,OAAA,KAAA;AAC3B,QAAM,MAAA,UAAA,GAAa,IAAI,eAAgB,EAAA,CAAA;AACvC,QAAA,MAAM,aAAgB,GAAA,UAAA,CAAW,KAAO,EAAA,SAAA,CAAU,UAAU,CAAA,CAAA;AAC5D,QAAI,GAAA,CAAA,MAAA,EAAQ,gBAAiB,CAAA,OAAA,EAAS,KAAK,CAAA,CAAA;AAE3C,QAAA,SAAS,KAAQ,GAAA;AACf,UAAI,GAAA,CAAA,MAAA,EAAQ,mBAAoB,CAAA,OAAA,EAAS,KAAK,CAAA,CAAA;AAC9C,UAAA,YAAA,CAAa,aAAc,CAAA,CAAA;AAC3B,UAAA,UAAA,CAAW,KAAM,EAAA,CAAA;AACjB,UAAA,OAAA,CAAQ,UAAU,CAAA,CAAA;AAAA,SACpB;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Waiting for 50 milliseconds",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "debug:wait",
16
+ id: "wait-milliseconds",
17
+ name: "Waiting for 50 milliseconds",
18
+ input: {
19
+ milliseconds: 50
20
+ }
21
+ }
22
+ ]
23
+ })
24
+ },
25
+ {
26
+ description: "Waiting for 5 seconds",
27
+ example: yaml__default.default.stringify({
28
+ steps: [
29
+ {
30
+ action: "debug:wait",
31
+ id: "wait-5sec",
32
+ name: "Waiting for 5 seconds",
33
+ input: {
34
+ seconds: 5
35
+ }
36
+ }
37
+ ]
38
+ })
39
+ },
40
+ {
41
+ description: "Waiting for 1 minutes",
42
+ example: yaml__default.default.stringify({
43
+ steps: [
44
+ {
45
+ action: "debug:wait",
46
+ id: "wait-1min",
47
+ name: "Waiting for 1 minutes",
48
+ input: {
49
+ minutes: 1
50
+ }
51
+ }
52
+ ]
53
+ })
54
+ }
55
+ ];
56
+
57
+ exports.examples = examples;
58
+ //# sourceMappingURL=wait.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/debug/wait.examples.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Waiting for 50 milliseconds',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-milliseconds',\n name: 'Waiting for 50 milliseconds',\n input: {\n milliseconds: 50,\n },\n },\n ],\n }),\n },\n {\n description: 'Waiting for 5 seconds',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-5sec',\n name: 'Waiting for 5 seconds',\n input: {\n seconds: 5,\n },\n },\n ],\n }),\n },\n {\n description: 'Waiting for 1 minutes',\n example: yaml.stringify({\n steps: [\n {\n action: 'debug:wait',\n id: 'wait-1min',\n name: 'Waiting for 1 minutes',\n input: {\n minutes: 1,\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,6BAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,mBAAA;AAAA,UACJ,IAAM,EAAA,6BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,YAAc,EAAA,EAAA;AAAA,WAChB;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,WAAA;AAAA,UACJ,IAAM,EAAA,uBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,CAAA;AAAA,WACX;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,YAAA;AAAA,UACR,EAAI,EAAA,WAAA;AAAA,UACJ,IAAM,EAAA,uBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,CAAA;AAAA,WACX;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var backendPluginApi = require('@backstage/backend-plugin-api');
4
+ var plain_examples = require('./plain.examples.cjs.js');
5
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
6
+
7
+ const ACTION_ID = "fetch:plain";
8
+ function createFetchPlainAction(options) {
9
+ const { reader, integrations } = options;
10
+ return pluginScaffolderNode.createTemplateAction({
11
+ id: ACTION_ID,
12
+ examples: plain_examples.examples,
13
+ description: "Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
14
+ schema: {
15
+ input: {
16
+ type: "object",
17
+ required: ["url"],
18
+ properties: {
19
+ url: {
20
+ title: "Fetch URL",
21
+ description: "Relative path or absolute URL pointing to the directory tree to fetch",
22
+ type: "string"
23
+ },
24
+ targetPath: {
25
+ title: "Target Path",
26
+ description: "Target path within the working directory to download the contents to.",
27
+ type: "string"
28
+ },
29
+ token: {
30
+ title: "Token",
31
+ description: "An optional token to use for authentication when reading the resources.",
32
+ type: "string"
33
+ }
34
+ }
35
+ }
36
+ },
37
+ supportsDryRun: true,
38
+ async handler(ctx) {
39
+ ctx.logger.info("Fetching plain content from remote URL");
40
+ const targetPath = ctx.input.targetPath ?? "./";
41
+ const outputPath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, targetPath);
42
+ await pluginScaffolderNode.fetchContents({
43
+ reader,
44
+ integrations,
45
+ baseUrl: ctx.templateInfo?.baseUrl,
46
+ fetchUrl: ctx.input.url,
47
+ outputPath,
48
+ token: ctx.input.token
49
+ });
50
+ }
51
+ });
52
+ }
53
+
54
+ exports.ACTION_ID = ACTION_ID;
55
+ exports.createFetchPlainAction = createFetchPlainAction;
56
+ //# sourceMappingURL=plain.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/fetch/plain.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 {\n resolveSafeChildPath,\n UrlReaderService,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { examples } from './plain.examples';\n\nimport {\n createTemplateAction,\n fetchContents,\n} from '@backstage/plugin-scaffolder-node';\n\nexport const ACTION_ID = 'fetch:plain';\n\n/**\n * Downloads content and places it in the workspace, or optionally\n * in a subdirectory specified by the 'targetPath' input option.\n * @public\n */\nexport function createFetchPlainAction(options: {\n reader: UrlReaderService;\n integrations: ScmIntegrations;\n}) {\n const { reader, integrations } = options;\n\n return createTemplateAction<{\n url: string;\n targetPath?: string;\n token?: string;\n }>({\n id: ACTION_ID,\n examples,\n description:\n 'Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.',\n schema: {\n input: {\n type: 'object',\n required: ['url'],\n properties: {\n url: {\n title: 'Fetch URL',\n description:\n 'Relative path or absolute URL pointing to the directory tree to fetch',\n type: 'string',\n },\n targetPath: {\n title: 'Target Path',\n description:\n 'Target path within the working directory to download the contents to.',\n type: 'string',\n },\n token: {\n title: 'Token',\n description:\n 'An optional token to use for authentication when reading the resources.',\n type: 'string',\n },\n },\n },\n },\n supportsDryRun: true,\n async handler(ctx) {\n ctx.logger.info('Fetching plain content from remote URL');\n\n // Finally move the template result into the task workspace\n const targetPath = ctx.input.targetPath ?? './';\n const outputPath = resolveSafeChildPath(ctx.workspacePath, targetPath);\n\n await fetchContents({\n reader,\n integrations,\n baseUrl: ctx.templateInfo?.baseUrl,\n fetchUrl: ctx.input.url,\n outputPath,\n token: ctx.input.token,\n });\n },\n });\n}\n"],"names":["createTemplateAction","examples","resolveSafeChildPath","fetchContents"],"mappings":";;;;;;AA4BO,MAAM,SAAY,GAAA,cAAA;AAOlB,SAAS,uBAAuB,OAGpC,EAAA;AACD,EAAM,MAAA,EAAE,MAAQ,EAAA,YAAA,EAAiB,GAAA,OAAA,CAAA;AAEjC,EAAA,OAAOA,yCAIJ,CAAA;AAAA,IACD,EAAI,EAAA,SAAA;AAAA,cACJC,uBAAA;AAAA,IACA,WACE,EAAA,+HAAA;AAAA,IACF,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,KAAK,CAAA;AAAA,QAChB,UAAY,EAAA;AAAA,UACV,GAAK,EAAA;AAAA,YACH,KAAO,EAAA,WAAA;AAAA,YACP,WACE,EAAA,uEAAA;AAAA,YACF,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,YACP,WACE,EAAA,uEAAA;AAAA,YACF,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,KAAO,EAAA;AAAA,YACL,KAAO,EAAA,OAAA;AAAA,YACP,WACE,EAAA,yEAAA;AAAA,YACF,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAI,GAAA,CAAA,MAAA,CAAO,KAAK,wCAAwC,CAAA,CAAA;AAGxD,MAAM,MAAA,UAAA,GAAa,GAAI,CAAA,KAAA,CAAM,UAAc,IAAA,IAAA,CAAA;AAC3C,MAAA,MAAM,UAAa,GAAAC,qCAAA,CAAqB,GAAI,CAAA,aAAA,EAAe,UAAU,CAAA,CAAA;AAErE,MAAA,MAAMC,kCAAc,CAAA;AAAA,QAClB,MAAA;AAAA,QACA,YAAA;AAAA,QACA,OAAA,EAAS,IAAI,YAAc,EAAA,OAAA;AAAA,QAC3B,QAAA,EAAU,IAAI,KAAM,CAAA,GAAA;AAAA,QACpB,UAAA;AAAA,QACA,KAAA,EAAO,IAAI,KAAM,CAAA,KAAA;AAAA,OAClB,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;;;;"}
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Downloads content and places it in the workspace.",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "fetch:plain",
16
+ id: "fetch-plain",
17
+ name: "Fetch plain",
18
+ input: {
19
+ url: "https://github.com/backstage/community/tree/main/backstage-community-sessions/assets"
20
+ }
21
+ }
22
+ ]
23
+ })
24
+ },
25
+ {
26
+ description: "Optionally, if you would prefer the data to be downloaded to a subdirectory in the workspace you may specify the \u2018targetPath\u2019 input option.",
27
+ example: yaml__default.default.stringify({
28
+ steps: [
29
+ {
30
+ action: "fetch:plain",
31
+ id: "fetch-plain",
32
+ name: "Fetch plain",
33
+ input: {
34
+ url: "https://github.com/backstage/community/tree/main/backstage-community-sessions/assets",
35
+ targetPath: "fetched-data"
36
+ }
37
+ }
38
+ ]
39
+ })
40
+ }
41
+ ];
42
+
43
+ exports.examples = examples;
44
+ //# sourceMappingURL=plain.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/fetch/plain.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: 'Downloads content and places it in the workspace.',\n example: yaml.stringify({\n steps: [\n {\n action: 'fetch:plain',\n id: 'fetch-plain',\n name: 'Fetch plain',\n input: {\n url: 'https://github.com/backstage/community/tree/main/backstage-community-sessions/assets',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Optionally, if you would prefer the data to be downloaded to a subdirectory in the workspace you may specify the ‘targetPath’ input option.',\n example: yaml.stringify({\n steps: [\n {\n action: 'fetch:plain',\n id: 'fetch-plain',\n name: 'Fetch plain',\n input: {\n url: 'https://github.com/backstage/community/tree/main/backstage-community-sessions/assets',\n targetPath: 'fetched-data',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,mDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,aAAA;AAAA,UACR,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,aAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,GAAK,EAAA,sFAAA;AAAA,WACP;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,uJAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,aAAA;AAAA,UACR,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,aAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,GAAK,EAAA,sFAAA;AAAA,YACL,UAAY,EAAA,cAAA;AAAA,WACd;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var backendPluginApi = require('@backstage/backend-plugin-api');
4
+ var plainFile_examples = require('./plainFile.examples.cjs.js');
5
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
6
+
7
+ function createFetchPlainFileAction(options) {
8
+ const { reader, integrations } = options;
9
+ return pluginScaffolderNode.createTemplateAction({
10
+ id: "fetch:plain:file",
11
+ description: "Downloads single file and places it in the workspace.",
12
+ examples: plainFile_examples.examples,
13
+ schema: {
14
+ input: {
15
+ type: "object",
16
+ required: ["url", "targetPath"],
17
+ properties: {
18
+ url: {
19
+ title: "Fetch URL",
20
+ description: "Relative path or absolute URL pointing to the single file to fetch.",
21
+ type: "string"
22
+ },
23
+ targetPath: {
24
+ title: "Target Path",
25
+ description: "Target path within the working directory to download the file as.",
26
+ type: "string"
27
+ },
28
+ token: {
29
+ title: "Token",
30
+ description: "An optional token to use for authentication when reading the resources.",
31
+ type: "string"
32
+ }
33
+ }
34
+ }
35
+ },
36
+ supportsDryRun: true,
37
+ async handler(ctx) {
38
+ ctx.logger.info("Fetching plain content from remote URL");
39
+ const outputPath = backendPluginApi.resolveSafeChildPath(
40
+ ctx.workspacePath,
41
+ ctx.input.targetPath
42
+ );
43
+ await pluginScaffolderNode.fetchFile({
44
+ reader,
45
+ integrations,
46
+ baseUrl: ctx.templateInfo?.baseUrl,
47
+ fetchUrl: ctx.input.url,
48
+ outputPath,
49
+ token: ctx.input.token
50
+ });
51
+ }
52
+ });
53
+ }
54
+
55
+ exports.createFetchPlainFileAction = createFetchPlainFileAction;
56
+ //# sourceMappingURL=plainFile.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plainFile.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/fetch/plainFile.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 { UrlReaderService } from '@backstage/backend-plugin-api';\nimport { resolveSafeChildPath } from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { examples } from './plainFile.examples';\nimport {\n createTemplateAction,\n fetchFile,\n} from '@backstage/plugin-scaffolder-node';\n\n/**\n * Downloads content and places it in the workspace, or optionally\n * in a subdirectory specified by the 'targetPath' input option.\n * @public\n */\nexport function createFetchPlainFileAction(options: {\n reader: UrlReaderService;\n integrations: ScmIntegrations;\n}) {\n const { reader, integrations } = options;\n\n return createTemplateAction<{\n url: string;\n targetPath: string;\n token?: string;\n }>({\n id: 'fetch:plain:file',\n description: 'Downloads single file and places it in the workspace.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['url', 'targetPath'],\n properties: {\n url: {\n title: 'Fetch URL',\n description:\n 'Relative path or absolute URL pointing to the single file to fetch.',\n type: 'string',\n },\n targetPath: {\n title: 'Target Path',\n description:\n 'Target path within the working directory to download the file as.',\n type: 'string',\n },\n token: {\n title: 'Token',\n description:\n 'An optional token to use for authentication when reading the resources.',\n type: 'string',\n },\n },\n },\n },\n supportsDryRun: true,\n async handler(ctx) {\n ctx.logger.info('Fetching plain content from remote URL');\n\n // Finally move the template result into the task workspace\n const outputPath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.targetPath,\n );\n\n await fetchFile({\n reader,\n integrations,\n baseUrl: ctx.templateInfo?.baseUrl,\n fetchUrl: ctx.input.url,\n outputPath,\n token: ctx.input.token,\n });\n },\n });\n}\n"],"names":["createTemplateAction","examples","resolveSafeChildPath","fetchFile"],"mappings":";;;;;;AA8BO,SAAS,2BAA2B,OAGxC,EAAA;AACD,EAAM,MAAA,EAAE,MAAQ,EAAA,YAAA,EAAiB,GAAA,OAAA,CAAA;AAEjC,EAAA,OAAOA,yCAIJ,CAAA;AAAA,IACD,EAAI,EAAA,kBAAA;AAAA,IACJ,WAAa,EAAA,uDAAA;AAAA,cACbC,2BAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,KAAA,EAAO,YAAY,CAAA;AAAA,QAC9B,UAAY,EAAA;AAAA,UACV,GAAK,EAAA;AAAA,YACH,KAAO,EAAA,WAAA;AAAA,YACP,WACE,EAAA,qEAAA;AAAA,YACF,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,YACP,WACE,EAAA,mEAAA;AAAA,YACF,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,KAAO,EAAA;AAAA,YACL,KAAO,EAAA,OAAA;AAAA,YACP,WACE,EAAA,yEAAA;AAAA,YACF,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAI,GAAA,CAAA,MAAA,CAAO,KAAK,wCAAwC,CAAA,CAAA;AAGxD,MAAA,MAAM,UAAa,GAAAC,qCAAA;AAAA,QACjB,GAAI,CAAA,aAAA;AAAA,QACJ,IAAI,KAAM,CAAA,UAAA;AAAA,OACZ,CAAA;AAEA,MAAA,MAAMC,8BAAU,CAAA;AAAA,QACd,MAAA;AAAA,QACA,YAAA;AAAA,QACA,OAAA,EAAS,IAAI,YAAc,EAAA,OAAA;AAAA,QAC3B,QAAA,EAAU,IAAI,KAAM,CAAA,GAAA;AAAA,QACpB,UAAA;AAAA,QACA,KAAA,EAAO,IAAI,KAAM,CAAA,KAAA;AAAA,OAClB,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Downloads a file and places it in the workspace.",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "fetch:plain:file",
16
+ id: "fetch-plain-file",
17
+ name: "Fetch plain file",
18
+ input: {
19
+ url: "https://github.com/backstage/community/tree/main/backstage-community-sessions/assets/Backstage%20Community%20Sessions.png",
20
+ targetPath: "target-path"
21
+ }
22
+ }
23
+ ]
24
+ })
25
+ }
26
+ ];
27
+
28
+ exports.examples = examples;
29
+ //# sourceMappingURL=plainFile.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plainFile.examples.cjs.js","sources":["../../../../../src/scaffolder/actions/builtin/fetch/plainFile.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: 'Downloads a file and places it in the workspace.',\n example: yaml.stringify({\n steps: [\n {\n action: 'fetch:plain:file',\n id: 'fetch-plain-file',\n name: 'Fetch plain file',\n input: {\n url: 'https://github.com/backstage/community/tree/main/backstage-community-sessions/assets/Backstage%20Community%20Sessions.png',\n targetPath: 'target-path',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,kDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,kBAAA;AAAA,UACR,EAAI,EAAA,kBAAA;AAAA,UACJ,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,GAAK,EAAA,2HAAA;AAAA,YACL,UAAY,EAAA,aAAA;AAAA,WACd;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}