@roadiehq/scaffolder-backend-module-utils 1.14.0 → 1.15.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.
package/README.md CHANGED
@@ -93,6 +93,27 @@ return await createRouter({
93
93
  });
94
94
  ```
95
95
 
96
+ ### New backend system
97
+
98
+ ## From your Backstage root directory
99
+
100
+ ```
101
+ cd packages/backend
102
+ yarn add @roadiehq/scaffolder-backend-module-utils/new-backend
103
+ ```
104
+
105
+ ```typescript
106
+ // packages/backend/src/index.ts
107
+ import { createBackend } from '@backstage/backend-defaults';
108
+ import { createBackendModule } from '@backstage/backend-plugin-api';
109
+
110
+ const backend = createBackend();
111
+ backend.add(import('@backstage/plugin-proxy-backend/alpha'));
112
+ backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
113
+ backend.add(import('@roadiehq/scaffolder-backend-module-utils/new-backend'));
114
+ backend.start();
115
+ ```
116
+
96
117
  ## Actions:
97
118
 
98
119
  ### Zip
package/dist/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var backendCommon = require('@backstage/backend-common');
6
4
  var pluginScaffolderBackend = require('@backstage/plugin-scaffolder-backend');
7
5
  var errors = require('@backstage/errors');
@@ -14,13 +12,13 @@ var lodash = require('lodash');
14
12
  var detectIndent = require('detect-indent');
15
13
  var jsonata = require('jsonata');
16
14
 
17
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
18
16
 
19
- var AdmZip__default = /*#__PURE__*/_interopDefaultLegacy(AdmZip);
20
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
21
- var YAML__default = /*#__PURE__*/_interopDefaultLegacy(YAML);
22
- var detectIndent__default = /*#__PURE__*/_interopDefaultLegacy(detectIndent);
23
- var jsonata__default = /*#__PURE__*/_interopDefaultLegacy(jsonata);
17
+ var AdmZip__default = /*#__PURE__*/_interopDefaultCompat(AdmZip);
18
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
19
+ var YAML__default = /*#__PURE__*/_interopDefaultCompat(YAML);
20
+ var detectIndent__default = /*#__PURE__*/_interopDefaultCompat(detectIndent);
21
+ var jsonata__default = /*#__PURE__*/_interopDefaultCompat(jsonata);
24
22
 
25
23
  function createZipAction() {
26
24
  return pluginScaffolderBackend.createTemplateAction({
@@ -55,7 +53,7 @@ function createZipAction() {
55
53
  }
56
54
  },
57
55
  async handler(ctx) {
58
- const zip = new AdmZip__default["default"]();
56
+ const zip = new AdmZip__default.default();
59
57
  const sourceFilepath = backendCommon.resolveSafeChildPath(
60
58
  ctx.workspacePath,
61
59
  ctx.input.path
@@ -64,14 +62,14 @@ function createZipAction() {
64
62
  ctx.workspacePath,
65
63
  ctx.input.outputPath
66
64
  );
67
- if (!fs__default["default"].existsSync(sourceFilepath)) {
65
+ if (!fs__default.default.existsSync(sourceFilepath)) {
68
66
  throw new errors.InputError(
69
67
  `File ${ctx.input.path} does not exist. Can't zip it.`
70
68
  );
71
69
  }
72
- if (fs__default["default"].lstatSync(sourceFilepath).isDirectory()) {
70
+ if (fs__default.default.lstatSync(sourceFilepath).isDirectory()) {
73
71
  zip.addLocalFolder(sourceFilepath);
74
- } else if (fs__default["default"].lstatSync(sourceFilepath).isFile()) {
72
+ } else if (fs__default.default.lstatSync(sourceFilepath).isFile()) {
75
73
  zip.addLocalFile(sourceFilepath);
76
74
  }
77
75
  zip.writeZip(destFilepath);
@@ -131,7 +129,7 @@ function createWriteFileAction() {
131
129
  } catch (error) {
132
130
  }
133
131
  }
134
- fs__default["default"].outputFileSync(destFilepath, formattedContent);
132
+ fs__default.default.outputFileSync(destFilepath, formattedContent);
135
133
  ctx.output("path", destFilepath);
136
134
  }
137
135
  });
@@ -173,16 +171,16 @@ function createAppendFileAction() {
173
171
  ctx.workspacePath,
174
172
  ctx.input.path
175
173
  );
176
- fs__default["default"].appendFileSync(sourceFilepath, ctx.input.content);
174
+ fs__default.default.appendFileSync(sourceFilepath, ctx.input.content);
177
175
  ctx.output("path", sourceFilepath);
178
176
  }
179
177
  });
180
178
  }
181
179
 
182
180
  const parsers = {
183
- yaml: (cnt) => YAML__default["default"].parse(cnt),
181
+ yaml: (cnt) => YAML__default.default.parse(cnt),
184
182
  json: (cnt) => JSON.parse(cnt),
185
- multiyaml: (cnt) => YAML__default["default"].parseAllDocuments(cnt).map((doc) => doc.toJSON())
183
+ multiyaml: (cnt) => YAML__default.default.parseAllDocuments(cnt).map((doc) => doc.toJSON())
186
184
  };
187
185
  function createParseFileAction() {
188
186
  return pluginScaffolderBackend.createTemplateAction({
@@ -228,7 +226,7 @@ function createParseFileAction() {
228
226
  parser = parsers[parserName];
229
227
  }
230
228
  const content = parser(
231
- fs__default["default"].readFileSync(sourceFilepath).toString()
229
+ fs__default.default.readFileSync(sourceFilepath).toString()
232
230
  );
233
231
  ctx.output("content", content);
234
232
  }
@@ -289,9 +287,9 @@ function createReplaceInFileAction() {
289
287
  ctx.workspacePath,
290
288
  file.file
291
289
  );
292
- const content = fs__default["default"].readFileSync(sourceFilepath).toString();
290
+ const content = fs__default.default.readFileSync(sourceFilepath).toString();
293
291
  const replacedContent = content.replaceAll(file.find, file.replaceWith);
294
- fs__default["default"].writeFileSync(sourceFilepath, replacedContent);
292
+ fs__default.default.writeFileSync(sourceFilepath, replacedContent);
295
293
  }
296
294
  }
297
295
  });
@@ -405,9 +403,9 @@ function createMergeJSONAction({ actionId }) {
405
403
  ctx.input.path
406
404
  );
407
405
  let existingContent;
408
- if (fs__default["default"].existsSync(sourceFilepath)) {
406
+ if (fs__default.default.existsSync(sourceFilepath)) {
409
407
  existingContent = JSON.parse(
410
- fs__default["default"].readFileSync(sourceFilepath).toString()
408
+ fs__default.default.readFileSync(sourceFilepath).toString()
411
409
  );
412
410
  } else {
413
411
  ctx.logger.info(
@@ -418,8 +416,8 @@ function createMergeJSONAction({ actionId }) {
418
416
  const content = typeof ctx.input.content === "string" ? JSON.parse(ctx.input.content) : ctx.input.content;
419
417
  let fileIndent = 2;
420
418
  if (ctx.input.matchFileIndent) {
421
- fileIndent = detectIndent__default["default"](
422
- fs__default["default"].readFileSync(sourceFilepath, "utf8")
419
+ fileIndent = detectIndent__default.default(
420
+ fs__default.default.readFileSync(sourceFilepath, "utf8")
423
421
  ).amount;
424
422
  if (!fileIndent) {
425
423
  fileIndent = 2;
@@ -428,7 +426,7 @@ function createMergeJSONAction({ actionId }) {
428
426
  );
429
427
  }
430
428
  }
431
- fs__default["default"].writeFileSync(
429
+ fs__default.default.writeFileSync(
432
430
  sourceFilepath,
433
431
  JSON.stringify(
434
432
  lodash.mergeWith(
@@ -491,18 +489,18 @@ function createMergeAction() {
491
489
  ctx.workspacePath,
492
490
  ctx.input.path
493
491
  );
494
- if (!fs__default["default"].existsSync(sourceFilepath)) {
492
+ if (!fs__default.default.existsSync(sourceFilepath)) {
495
493
  ctx.logger.error(`The file ${sourceFilepath} does not exist.`);
496
494
  throw new Error(`The file ${sourceFilepath} does not exist.`);
497
495
  }
498
- const originalContent = fs__default["default"].readFileSync(sourceFilepath).toString();
496
+ const originalContent = fs__default.default.readFileSync(sourceFilepath).toString();
499
497
  let mergedContent;
500
498
  switch (path.extname(sourceFilepath)) {
501
499
  case ".json": {
502
500
  const newContent = typeof ctx.input.content === "string" ? JSON.parse(ctx.input.content) : ctx.input.content;
503
501
  mergedContent = JSON.stringify(
504
502
  lodash.mergeWith(
505
- YAML__default["default"].parse(originalContent),
503
+ YAML__default.default.parse(originalContent),
506
504
  newContent,
507
505
  ctx.input.mergeArrays ? mergeArrayCustomiser : void 0
508
506
  ),
@@ -513,10 +511,10 @@ function createMergeAction() {
513
511
  }
514
512
  case ".yml":
515
513
  case ".yaml": {
516
- const newContent = typeof ctx.input.content === "string" ? YAML__default["default"].parse(ctx.input.content) : ctx.input.content;
517
- mergedContent = YAML__default["default"].stringify(
514
+ const newContent = typeof ctx.input.content === "string" ? YAML__default.default.parse(ctx.input.content) : ctx.input.content;
515
+ mergedContent = YAML__default.default.stringify(
518
516
  lodash.mergeWith(
519
- YAML__default["default"].parse(originalContent),
517
+ YAML__default.default.parse(originalContent),
520
518
  newContent,
521
519
  ctx.input.mergeArrays ? mergeArrayCustomiser : void 0
522
520
  ),
@@ -528,7 +526,7 @@ function createMergeAction() {
528
526
  if (!mergedContent) {
529
527
  return;
530
528
  }
531
- fs__default["default"].writeFileSync(sourceFilepath, mergedContent);
529
+ fs__default.default.writeFileSync(sourceFilepath, mergedContent);
532
530
  ctx.output("path", sourceFilepath);
533
531
  }
534
532
  });
@@ -611,7 +609,7 @@ function createJSONataAction() {
611
609
  },
612
610
  async handler(ctx) {
613
611
  try {
614
- const expression = jsonata__default["default"](ctx.input.expression);
612
+ const expression = jsonata__default.default(ctx.input.expression);
615
613
  const result = expression.evaluate(ctx.input.data);
616
614
  ctx.output("result", result);
617
615
  } catch (e) {
@@ -673,7 +671,7 @@ function createYamlJSONataTransformAction() {
673
671
  if (ctx.input.as === "object") {
674
672
  resultHandler = (rz) => rz;
675
673
  } else {
676
- resultHandler = (rz) => YAML__default["default"].stringify(rz, ctx.input.options);
674
+ resultHandler = (rz) => YAML__default.default.stringify(rz, ctx.input.options);
677
675
  }
678
676
  const sourceFilepath = backendCommon.resolveSafeChildPath(
679
677
  ctx.workspacePath,
@@ -681,13 +679,13 @@ function createYamlJSONataTransformAction() {
681
679
  );
682
680
  let data;
683
681
  if (ctx.input.loadAll) {
684
- data = YAML__default["default"].parseAllDocuments(
685
- fs__default["default"].readFileSync(sourceFilepath).toString()
682
+ data = YAML__default.default.parseAllDocuments(
683
+ fs__default.default.readFileSync(sourceFilepath).toString()
686
684
  ).map((doc) => doc.toJSON());
687
685
  } else {
688
- data = YAML__default["default"].parse(fs__default["default"].readFileSync(sourceFilepath).toString());
686
+ data = YAML__default.default.parse(fs__default.default.readFileSync(sourceFilepath).toString());
689
687
  }
690
- const expression = jsonata__default["default"](ctx.input.expression);
688
+ const expression = jsonata__default.default(ctx.input.expression);
691
689
  const result = expression.evaluate(data);
692
690
  ctx.output("result", resultHandler(result));
693
691
  }
@@ -756,8 +754,8 @@ function createJsonJSONataTransformAction() {
756
754
  ctx.workspacePath,
757
755
  ctx.input.path
758
756
  );
759
- const data = JSON.parse(fs__default["default"].readFileSync(sourceFilepath).toString());
760
- const expression = jsonata__default["default"](ctx.input.expression);
757
+ const data = JSON.parse(fs__default.default.readFileSync(sourceFilepath).toString());
758
+ const expression = jsonata__default.default(ctx.input.expression);
761
759
  const result = expression.evaluate(data);
762
760
  ctx.output("result", resultHandler(result));
763
761
  }
@@ -852,7 +850,7 @@ function createSerializeYamlAction() {
852
850
  async handler(ctx) {
853
851
  ctx.output(
854
852
  "serialized",
855
- YAML__default["default"].stringify(ctx.input.data, ctx.input.options)
853
+ YAML__default.default.stringify(ctx.input.data, ctx.input.options)
856
854
  );
857
855
  }
858
856
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/actions/zip.ts","../src/actions/fs/writeFile.ts","../src/actions/fs/appendFile.ts","../src/actions/fs/parseFile.ts","../src/actions/fs/replaceInFile.ts","../src/types.ts","../src/actions/merge/merge.ts","../src/actions/sleep.ts","../src/actions/jsonata/jsonata.ts","../src/actions/jsonata/yaml.ts","../src/actions/jsonata/json.ts","../src/actions/serialize/json.ts","../src/actions/serialize/yaml.ts"],"sourcesContent":["/*\n * Copyright 2021 Larder Software Limited\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 { resolveSafeChildPath } from '@backstage/backend-common';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport { InputError } from '@backstage/errors';\nimport AdmZip from 'adm-zip';\nimport fs from 'fs-extra';\n\nexport function createZipAction() {\n return createTemplateAction<{ path: string; outputPath: string }>({\n id: 'roadiehq:utils:zip',\n description: 'Zips the content of the path',\n supportsDryRun: true,\n schema: {\n input: {\n required: ['path'],\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n description: 'Relative path you would like to zip',\n type: 'string',\n },\n\n outputPath: {\n title: 'Output Path',\n description: 'The name of the result of the zip command',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n outputPath: {\n title: 'Zip Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const zip = new AdmZip();\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n const destFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.outputPath,\n );\n\n if (!fs.existsSync(sourceFilepath)) {\n throw new InputError(\n `File ${ctx.input.path} does not exist. Can't zip it.`,\n );\n }\n if (fs.lstatSync(sourceFilepath).isDirectory()) {\n zip.addLocalFolder(sourceFilepath);\n } else if (fs.lstatSync(sourceFilepath).isFile()) {\n zip.addLocalFile(sourceFilepath);\n }\n zip.writeZip(destFilepath);\n ctx.output('outputPath', ctx.input.outputPath);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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-backend';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\n\nexport function createWriteFileAction() {\n return createTemplateAction<{\n path: string;\n content: string;\n preserveFormatting?: boolean;\n }>({\n id: 'roadiehq:utils:fs:write',\n description: 'Creates a file with the content on the given path',\n supportsDryRun: true,\n schema: {\n input: {\n required: ['path', 'content'],\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n description: 'Relative path',\n type: 'string',\n },\n content: {\n title: 'Content',\n description: 'This will be the content of the file',\n type: 'string',\n },\n preserveFormatting: {\n title: 'Preserve Formatting',\n description:\n 'Specify whether to preserve formatting for JSON content',\n type: 'boolean',\n default: false,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const destFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n let formattedContent = ctx.input.content;\n if (ctx.input.preserveFormatting) {\n try {\n const parsedContent = JSON.parse(ctx.input.content);\n formattedContent = JSON.stringify(parsedContent, null, 2);\n } catch (error) {\n // Content is not JSON, no need to format\n }\n }\n\n fs.outputFileSync(destFilepath, formattedContent);\n\n ctx.output('path', destFilepath);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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-backend';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\n\nexport function createAppendFileAction() {\n return createTemplateAction<{ path: string; content: string }>({\n id: 'roadiehq:utils:fs:append',\n description:\n 'Append content to the end of the given file, it will create the file if it does not exist.',\n schema: {\n input: {\n type: 'object',\n required: ['content', 'path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to existing file to append.',\n type: 'string',\n },\n content: {\n title: 'Content',\n description: 'This will be appended to the file',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n fs.appendFileSync(sourceFilepath, ctx.input.content);\n ctx.output('path', sourceFilepath);\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\nimport YAML from 'yaml';\n\nconst parsers: Record<'yaml' | 'json' | 'multiyaml', (cnt: string) => any> = {\n yaml: (cnt: string) => YAML.parse(cnt),\n json: (cnt: string) => JSON.parse(cnt),\n multiyaml: (cnt: string) =>\n YAML.parseAllDocuments(cnt).map(doc => doc.toJSON()),\n};\n\nexport function createParseFileAction() {\n return createTemplateAction<{\n path: string;\n parser?: 'yaml' | 'json' | 'multiyaml';\n }>({\n id: 'roadiehq:utils:fs:parse',\n description: 'Reads a file from the workspace and optionally parses it',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to the file to read.',\n type: 'string',\n },\n parser: {\n title: 'Parse',\n description: 'Optionally parse the content to an object.',\n type: 'string',\n enum: ['yaml', 'json', 'multiyaml'],\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n content: {\n title: 'Content of the file',\n type: ['string', 'object'],\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n const parserName = ctx.input.parser;\n let parser = (content: string) => content;\n\n if (parserName) {\n parser = parsers[parserName];\n }\n\n const content: string | object = parser(\n fs.readFileSync(sourceFilepath).toString(),\n );\n\n ctx.output('content', content);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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 fs from 'fs-extra';\nimport { InputError } from '@backstage/errors';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\n\nexport function createReplaceInFileAction() {\n return createTemplateAction<{\n files: Array<{\n file: string;\n find: string;\n replaceWith: string;\n }>;\n }>({\n id: 'roadiehq:utils:fs:replace',\n description: 'Replaces content of a file with given values.',\n supportsDryRun: true,\n schema: {\n input: {\n required: ['files'],\n type: 'object',\n properties: {\n files: {\n title: 'Files',\n description: 'A list of files and replacements to be done',\n type: 'array',\n items: {\n type: 'object',\n required: [],\n properties: {\n file: {\n type: 'string',\n title:\n 'The source location of the file to be used to run replace against',\n },\n find: {\n type: 'string',\n title: 'A string to be replaced',\n },\n replaceWith: {\n type: 'string',\n title: 'Text to be used to replace the found lines with',\n },\n },\n },\n },\n },\n },\n },\n async handler(ctx) {\n if (!Array.isArray(ctx.input?.files)) {\n throw new InputError('files must be an Array');\n }\n\n for (const file of ctx.input.files) {\n if (!file.file) {\n throw new InputError('Path to file needs to be defined');\n }\n if (!file.find || !file.replaceWith) {\n throw new InputError(\n 'each file must have a find and replaceWith property',\n );\n }\n\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n file.file,\n );\n const content: string = fs.readFileSync(sourceFilepath).toString();\n\n // Not regex\n const replacedContent = content.replaceAll(file.find, file.replaceWith);\n\n fs.writeFileSync(sourceFilepath, replacedContent);\n }\n },\n });\n}\n","/*\n * Copyright 2023 Larder Software Limited\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 { ToStringOptions } from 'yaml';\n\nexport type stringifyOptions = Omit<ToStringOptions, 'commentString'>;\n\nexport const yamlOptionsSchema = {\n title: 'Options',\n description: 'YAML stringify options',\n type: 'object',\n properties: {\n indent: {\n description: '(default: 2) - indentation width to use (in spaces)',\n type: 'number',\n },\n noArrayIndent: {\n description:\n '(default: false) - when true, will not add an indentation level to array elements',\n type: 'boolean',\n },\n skipInvalid: {\n description:\n '(default: false) - do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types',\n type: 'boolean',\n },\n flowLevel: {\n description:\n '(default: -1) - specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere',\n type: 'number',\n },\n sortKeys: {\n description:\n '(default: false) - if true, sort keys when dumping YAML. If a function, use the function to sort the keys',\n type: 'boolean',\n },\n lineWidth: {\n description:\n '(default: 80) - set max line width. Set -1 for unlimited width',\n type: 'number',\n },\n noRefs: {\n description:\n \"(default: false) - if true, don't convert duplicate objects into references\",\n type: 'boolean',\n },\n noCompatMode: {\n description:\n '(default: false) - if true don\\'t try to be compatible with older yaml versions. Currently: don\\'t quote \"yes\", \"no\" and so on, as required for YAML 1.1',\n type: 'boolean',\n },\n condenseFlow: {\n description:\n \"(default: false) - if true flow sequences will be condensed, omitting the space between a, b. Eg. '[a,b]', and omitting the space between key: value and quoting the key. Eg. '{\\\"a\\\":b}' Can be useful when using yaml for pretty URL query params as spaces are %-encoded.\",\n type: 'boolean',\n },\n quotingType: {\n description:\n \"(' or \\\", default: ') - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.\",\n type: 'string',\n },\n forceQuotes: {\n description:\n \"(default: false) - if true, all non-key strings will be quoted even if they normally don't need to.\",\n type: 'boolean',\n },\n },\n};\n","/*\n * Copyright 2021 Larder Software Limited\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 { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\nimport { extname } from 'path';\nimport { isArray, isNull, mergeWith } from 'lodash';\nimport YAML from 'yaml';\nimport { stringifyOptions, yamlOptionsSchema } from '../../types';\nimport detectIndent from 'detect-indent';\n\nfunction mergeArrayCustomiser(objValue: string | any[], srcValue: any) {\n if (isArray(objValue) && !isNull(objValue)) {\n return Array.from(new Set(objValue.concat(srcValue)));\n }\n return undefined;\n}\n\nexport function createMergeJSONAction({ actionId }: { actionId?: string }) {\n return createTemplateAction<{\n path: string;\n content: any;\n mergeArrays?: boolean;\n matchFileIndent?: boolean;\n }>({\n id: actionId || 'roadiehq:utils:json:merge',\n description: 'Merge new data into an existing JSON file.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['content', 'path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to existing file to append.',\n type: 'string',\n },\n content: {\n description:\n 'This will be merged into to the file. Can be either an object or a string.',\n title: 'Content',\n type: ['string', 'object'],\n },\n mergeArrays: {\n type: 'boolean',\n default: false,\n title: 'Merge Arrays?',\n description:\n 'Where a value is an array the merge function should concatenate the provided array value with the target array',\n },\n matchFileIndent: {\n type: 'boolean',\n default: false,\n title: 'Match file indent?',\n description:\n 'Make the output file indentation match that of the specified input file.',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n let existingContent;\n\n if (fs.existsSync(sourceFilepath)) {\n existingContent = JSON.parse(\n fs.readFileSync(sourceFilepath).toString(),\n );\n } else {\n ctx.logger.info(\n `The file ${sourceFilepath} does not exist, creating it.`,\n );\n existingContent = {};\n }\n const content =\n typeof ctx.input.content === 'string'\n ? JSON.parse(ctx.input.content)\n : ctx.input.content;\n\n let fileIndent = 2;\n if (ctx.input.matchFileIndent) {\n fileIndent = detectIndent(\n fs.readFileSync(sourceFilepath, 'utf8'),\n ).amount;\n if (!fileIndent) {\n fileIndent = 2;\n ctx.logger.info(\n `Failed to detect source file indentation, using default value of 2.`,\n );\n }\n }\n fs.writeFileSync(\n sourceFilepath,\n JSON.stringify(\n mergeWith(\n existingContent,\n content,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n ),\n null,\n fileIndent,\n ),\n );\n ctx.output('path', sourceFilepath);\n },\n });\n}\n\nexport function createMergeAction() {\n return createTemplateAction<{\n path: string;\n content: any;\n mergeArrays?: boolean;\n options?: stringifyOptions;\n }>({\n id: 'roadiehq:utils:merge',\n description: 'Merges data into an existing structured file.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['content', 'path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to existing file to append.',\n type: 'string',\n },\n content: {\n description:\n 'This will be merged into to the file. Can be either an object or a string.',\n title: 'Content',\n type: ['string', 'object'],\n },\n mergeArrays: {\n type: 'boolean',\n default: false,\n title: 'Merge Arrays?',\n description:\n 'Where a value is an array the merge function should concatenate the provided array value with the target array',\n },\n options: {\n ...yamlOptionsSchema,\n description: `${yamlOptionsSchema.description} (for YAML output only)`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n if (!fs.existsSync(sourceFilepath)) {\n ctx.logger.error(`The file ${sourceFilepath} does not exist.`);\n throw new Error(`The file ${sourceFilepath} does not exist.`);\n }\n const originalContent = fs.readFileSync(sourceFilepath).toString();\n let mergedContent;\n\n switch (extname(sourceFilepath)) {\n case '.json': {\n const newContent =\n typeof ctx.input.content === 'string'\n ? JSON.parse(ctx.input.content)\n : ctx.input.content; // This supports the case where dynamic keys are required\n mergedContent = JSON.stringify(\n mergeWith(\n YAML.parse(originalContent),\n newContent,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n ),\n null,\n 2,\n );\n break;\n }\n case '.yml':\n case '.yaml': {\n const newContent =\n typeof ctx.input.content === 'string'\n ? YAML.parse(ctx.input.content)\n : ctx.input.content; // This supports the case where dynamic keys are required\n mergedContent = YAML.stringify(\n mergeWith(\n YAML.parse(originalContent),\n newContent,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n ),\n ctx.input.options,\n );\n break;\n }\n default:\n break;\n }\n if (!mergedContent) {\n return;\n }\n fs.writeFileSync(sourceFilepath, mergedContent);\n ctx.output('path', sourceFilepath);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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-backend';\nimport { InputError } from '@backstage/errors';\n\nexport function createSleepAction(options?: { maxSleep?: number }) {\n return createTemplateAction<{ amount: number }>({\n id: 'roadiehq:utils:sleep',\n description: 'Halts the scaffolding for the given amount of seconds',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['amount'],\n properties: {\n amount: {\n title: 'Sleep Amount',\n description: 'How much seconds should this step take.',\n type: 'number',\n },\n },\n },\n },\n async handler(ctx) {\n if (isNaN(ctx.input?.amount)) {\n throw new InputError('amount must be a number');\n } else if (options?.maxSleep && ctx.input.amount > options.maxSleep) {\n throw new InputError(\n `sleep amount can not be greater than maxSleep. amount: ${ctx.input.amount}, maxSleep: ${options.maxSleep}`,\n );\n }\n ctx.logger.info(`Waiting ${ctx.input.amount} seconds`);\n\n await new Promise(resolve => {\n setTimeout(resolve, ctx.input.amount * 1000);\n });\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport jsonata from 'jsonata';\n\nexport function createJSONataAction() {\n return createTemplateAction<{\n data: any;\n expression: string;\n }>({\n id: 'roadiehq:utils:jsonata',\n description:\n 'Allows performing JSONata operations and transformations on input objects and produces the output result as a step output.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['data', 'expression'],\n properties: {\n data: {\n title: 'Data',\n description: 'Input data to be transformed',\n type: [\n 'object',\n 'array',\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'null',\n ],\n },\n expression: {\n title: 'Expression',\n description: 'JSONata expression to perform on the input',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n result: {\n title: 'Output result from JSONata',\n type: 'object',\n },\n },\n },\n },\n async handler(ctx) {\n try {\n const expression = jsonata(ctx.input.expression);\n const result = expression.evaluate(ctx.input.data);\n\n ctx.output('result', result);\n } catch (e: any) {\n const message = e.hasOwnProperty('message')\n ? e.message\n : 'unknown JSONata evaluation error';\n throw new Error(\n `JSONata failed to evaluate the expression: ${message}`,\n );\n }\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport jsonata from 'jsonata';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\nimport YAML from 'yaml';\nimport { stringifyOptions, yamlOptionsSchema } from '../../types';\n\nexport function createYamlJSONataTransformAction() {\n return createTemplateAction<{\n path: string;\n expression: string;\n options?: stringifyOptions;\n loadAll?: boolean;\n as?: 'string' | 'object';\n }>({\n id: 'roadiehq:utils:jsonata:yaml:transform',\n description:\n 'Allows performing JSONata operations and transformations on a YAML file in the workspace. The result can be read from the `result` step output.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['path', 'expression'],\n properties: {\n path: {\n title: 'Path',\n description: 'Input path to read yaml file',\n type: 'string',\n },\n expression: {\n title: 'Expression',\n description: 'JSONata expression to perform on the input',\n type: 'string',\n },\n loadAll: {\n title: 'Load All',\n description:\n 'Use this if the yaml source file contains multiple yaml objects',\n type: 'boolean',\n },\n as: {\n title: 'Desired Result Type',\n description:\n 'Permitted values are: \"string\" (default) and \"object\"',\n type: 'string',\n enum: ['string', 'object'],\n },\n options: yamlOptionsSchema,\n },\n },\n output: {\n type: 'object',\n properties: {\n result: {\n title: 'Output result from JSONata',\n type: 'object | string',\n },\n },\n },\n },\n async handler(ctx) {\n let resultHandler: (rz: any) => any;\n\n if (ctx.input.as === 'object') {\n resultHandler = rz => rz;\n } else {\n resultHandler = rz => YAML.stringify(rz, ctx.input.options);\n }\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n let data;\n if (ctx.input.loadAll) {\n data = YAML.parseAllDocuments(\n fs.readFileSync(sourceFilepath).toString(),\n ).map(doc => doc.toJSON());\n } else {\n data = YAML.parse(fs.readFileSync(sourceFilepath).toString());\n }\n const expression = jsonata(ctx.input.expression);\n const result = expression.evaluate(data);\n\n ctx.output('result', resultHandler(result));\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport jsonata from 'jsonata';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\n\nexport function createJsonJSONataTransformAction() {\n return createTemplateAction<{\n path: string;\n expression: string;\n replacer?: string[];\n space?: string;\n as?: 'string' | 'object';\n }>({\n id: 'roadiehq:utils:jsonata:json:transform',\n description:\n 'Allows performing JSONata operations and transformations on a JSON file in the workspace. The result can be read from the `result` step output.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['path', 'expression'],\n properties: {\n path: {\n title: 'Path',\n description: 'Input path to read json file',\n type: 'string',\n },\n expression: {\n title: 'Expression',\n description: 'JSONata expression to perform on the input',\n type: 'string',\n },\n as: {\n title: 'Desired Result Type',\n description:\n 'Permitted values are: \"string\" (default) and \"object\"',\n type: 'string',\n enum: ['string', 'object'],\n },\n replacer: {\n title: 'Replacer',\n description: 'Replacer array',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n space: {\n title: 'Space',\n description: 'Space character',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n result: {\n title: 'Output result from JSONata',\n type: 'object | string',\n },\n },\n },\n },\n async handler(ctx) {\n let resultHandler: (rz: any) => any;\n\n if (ctx.input.as === 'object') {\n resultHandler = rz => rz;\n } else {\n resultHandler = rz =>\n JSON.stringify(rz, ctx.input.replacer, ctx.input.space);\n }\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n const data = JSON.parse(fs.readFileSync(sourceFilepath).toString());\n const expression = jsonata(ctx.input.expression);\n const result = expression.evaluate(data);\n\n ctx.output('result', resultHandler(result));\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\n\nexport function createSerializeJsonAction() {\n return createTemplateAction<{\n data: any;\n replacer?: string[];\n space?: string;\n }>({\n id: 'roadiehq:utils:serialize:json',\n description: 'Allows performing serialization on an object',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['data'],\n properties: {\n data: {\n title: 'Data',\n description: 'Input data to perform seriazation on.',\n type: 'object',\n },\n replacer: {\n title: 'Replacer',\n description: 'Replacer array',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n space: {\n title: 'Space',\n description: 'Space character',\n type: 'string',\n },\n },\n },\n output: {\n type: 'string',\n properties: {\n serialized: {\n title: 'Output result from serialization',\n type: 'string',\n },\n },\n },\n },\n\n async handler(ctx) {\n ctx.output(\n 'serialized',\n JSON.stringify(ctx.input.data, ctx.input.replacer, ctx.input.space),\n );\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport YAML from 'yaml';\nimport { stringifyOptions, yamlOptionsSchema } from '../../types';\n\nexport function createSerializeYamlAction() {\n return createTemplateAction<{\n data: any;\n options?: stringifyOptions;\n }>({\n id: 'roadiehq:utils:serialize:yaml',\n description: 'Allows performing serialization on an object',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['data'],\n properties: {\n data: {\n title: 'Data',\n description: 'Input data to perform seriazation on.',\n type: 'object',\n },\n replacer: {\n title: 'Replacer',\n description: 'Replacer array',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n options: yamlOptionsSchema,\n },\n },\n output: {\n type: 'string',\n properties: {\n serialized: {\n title: 'Output result from serialization',\n type: 'string',\n },\n },\n },\n },\n\n async handler(ctx) {\n ctx.output(\n 'serialized',\n YAML.stringify(ctx.input.data, ctx.input.options),\n );\n },\n });\n}\n"],"names":["createTemplateAction","AdmZip","resolveSafeChildPath","fs","InputError","YAML","content","isArray","isNull","detectIndent","mergeWith","extname","jsonata"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,eAAkB,GAAA;AAChC,EAAA,OAAOA,4CAA2D,CAAA;AAAA,IAChE,EAAI,EAAA,oBAAA;AAAA,IACJ,WAAa,EAAA,8BAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,QAAA,EAAU,CAAC,MAAM,CAAA;AAAA,QACjB,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,IAAM,EAAA;AAAA,YACJ,KAAO,EAAA,MAAA;AAAA,YACP,WAAa,EAAA,qCAAA;AAAA,YACb,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UAEA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,YACP,WAAa,EAAA,2CAAA;AAAA,YACb,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,SACF;AAAA,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,UAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAM,MAAA,GAAA,GAAM,IAAIC,0BAAO,EAAA,CAAA;AACvB,MAAA,MAAM,cAAiB,GAAAC,kCAAA;AAAA,QACrB,GAAI,CAAA,aAAA;AAAA,QACJ,IAAI,KAAM,CAAA,IAAA;AAAA,OACZ,CAAA;AACA,MAAA,MAAM,YAAe,GAAAA,kCAAA;AAAA,QACnB,GAAI,CAAA,aAAA;AAAA,QACJ,IAAI,KAAM,CAAA,UAAA;AAAA,OACZ,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,OACF;AAAA,KACF;AAAA,IAEA,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAI,GAAA,CAAA,MAAA;AAAA,QACF,YAAA;AAAA,QACAK,yBAAK,SAAU,CAAA,GAAA,CAAI,MAAM,IAAM,EAAA,GAAA,CAAI,MAAM,OAAO,CAAA;AAAA,OAClD,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/actions/zip.ts","../src/actions/fs/writeFile.ts","../src/actions/fs/appendFile.ts","../src/actions/fs/parseFile.ts","../src/actions/fs/replaceInFile.ts","../src/types.ts","../src/actions/merge/merge.ts","../src/actions/sleep.ts","../src/actions/jsonata/jsonata.ts","../src/actions/jsonata/yaml.ts","../src/actions/jsonata/json.ts","../src/actions/serialize/json.ts","../src/actions/serialize/yaml.ts"],"sourcesContent":["/*\n * Copyright 2021 Larder Software Limited\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 { resolveSafeChildPath } from '@backstage/backend-common';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport { InputError } from '@backstage/errors';\nimport AdmZip from 'adm-zip';\nimport fs from 'fs-extra';\n\nexport function createZipAction() {\n return createTemplateAction<{ path: string; outputPath: string }>({\n id: 'roadiehq:utils:zip',\n description: 'Zips the content of the path',\n supportsDryRun: true,\n schema: {\n input: {\n required: ['path'],\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n description: 'Relative path you would like to zip',\n type: 'string',\n },\n\n outputPath: {\n title: 'Output Path',\n description: 'The name of the result of the zip command',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n outputPath: {\n title: 'Zip Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const zip = new AdmZip();\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n const destFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.outputPath,\n );\n\n if (!fs.existsSync(sourceFilepath)) {\n throw new InputError(\n `File ${ctx.input.path} does not exist. Can't zip it.`,\n );\n }\n if (fs.lstatSync(sourceFilepath).isDirectory()) {\n zip.addLocalFolder(sourceFilepath);\n } else if (fs.lstatSync(sourceFilepath).isFile()) {\n zip.addLocalFile(sourceFilepath);\n }\n zip.writeZip(destFilepath);\n ctx.output('outputPath', ctx.input.outputPath);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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-backend';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\n\nexport function createWriteFileAction() {\n return createTemplateAction<{\n path: string;\n content: string;\n preserveFormatting?: boolean;\n }>({\n id: 'roadiehq:utils:fs:write',\n description: 'Creates a file with the content on the given path',\n supportsDryRun: true,\n schema: {\n input: {\n required: ['path', 'content'],\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n description: 'Relative path',\n type: 'string',\n },\n content: {\n title: 'Content',\n description: 'This will be the content of the file',\n type: 'string',\n },\n preserveFormatting: {\n title: 'Preserve Formatting',\n description:\n 'Specify whether to preserve formatting for JSON content',\n type: 'boolean',\n default: false,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const destFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n let formattedContent = ctx.input.content;\n if (ctx.input.preserveFormatting) {\n try {\n const parsedContent = JSON.parse(ctx.input.content);\n formattedContent = JSON.stringify(parsedContent, null, 2);\n } catch (error) {\n // Content is not JSON, no need to format\n }\n }\n\n fs.outputFileSync(destFilepath, formattedContent);\n\n ctx.output('path', destFilepath);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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-backend';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\n\nexport function createAppendFileAction() {\n return createTemplateAction<{ path: string; content: string }>({\n id: 'roadiehq:utils:fs:append',\n description:\n 'Append content to the end of the given file, it will create the file if it does not exist.',\n schema: {\n input: {\n type: 'object',\n required: ['content', 'path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to existing file to append.',\n type: 'string',\n },\n content: {\n title: 'Content',\n description: 'This will be appended to the file',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n fs.appendFileSync(sourceFilepath, ctx.input.content);\n ctx.output('path', sourceFilepath);\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\nimport YAML from 'yaml';\n\nconst parsers: Record<'yaml' | 'json' | 'multiyaml', (cnt: string) => any> = {\n yaml: (cnt: string) => YAML.parse(cnt),\n json: (cnt: string) => JSON.parse(cnt),\n multiyaml: (cnt: string) =>\n YAML.parseAllDocuments(cnt).map(doc => doc.toJSON()),\n};\n\nexport function createParseFileAction() {\n return createTemplateAction<{\n path: string;\n parser?: 'yaml' | 'json' | 'multiyaml';\n }>({\n id: 'roadiehq:utils:fs:parse',\n description: 'Reads a file from the workspace and optionally parses it',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to the file to read.',\n type: 'string',\n },\n parser: {\n title: 'Parse',\n description: 'Optionally parse the content to an object.',\n type: 'string',\n enum: ['yaml', 'json', 'multiyaml'],\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n content: {\n title: 'Content of the file',\n type: ['string', 'object'],\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n const parserName = ctx.input.parser;\n let parser = (content: string) => content;\n\n if (parserName) {\n parser = parsers[parserName];\n }\n\n const content: string | object = parser(\n fs.readFileSync(sourceFilepath).toString(),\n );\n\n ctx.output('content', content);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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 fs from 'fs-extra';\nimport { InputError } from '@backstage/errors';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\n\nexport function createReplaceInFileAction() {\n return createTemplateAction<{\n files: Array<{\n file: string;\n find: string;\n replaceWith: string;\n }>;\n }>({\n id: 'roadiehq:utils:fs:replace',\n description: 'Replaces content of a file with given values.',\n supportsDryRun: true,\n schema: {\n input: {\n required: ['files'],\n type: 'object',\n properties: {\n files: {\n title: 'Files',\n description: 'A list of files and replacements to be done',\n type: 'array',\n items: {\n type: 'object',\n required: [],\n properties: {\n file: {\n type: 'string',\n title:\n 'The source location of the file to be used to run replace against',\n },\n find: {\n type: 'string',\n title: 'A string to be replaced',\n },\n replaceWith: {\n type: 'string',\n title: 'Text to be used to replace the found lines with',\n },\n },\n },\n },\n },\n },\n },\n async handler(ctx) {\n if (!Array.isArray(ctx.input?.files)) {\n throw new InputError('files must be an Array');\n }\n\n for (const file of ctx.input.files) {\n if (!file.file) {\n throw new InputError('Path to file needs to be defined');\n }\n if (!file.find || !file.replaceWith) {\n throw new InputError(\n 'each file must have a find and replaceWith property',\n );\n }\n\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n file.file,\n );\n const content: string = fs.readFileSync(sourceFilepath).toString();\n\n // Not regex\n const replacedContent = content.replaceAll(file.find, file.replaceWith);\n\n fs.writeFileSync(sourceFilepath, replacedContent);\n }\n },\n });\n}\n","/*\n * Copyright 2023 Larder Software Limited\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 { ToStringOptions } from 'yaml';\n\nexport type stringifyOptions = Omit<ToStringOptions, 'commentString'>;\n\nexport const yamlOptionsSchema = {\n title: 'Options',\n description: 'YAML stringify options',\n type: 'object',\n properties: {\n indent: {\n description: '(default: 2) - indentation width to use (in spaces)',\n type: 'number',\n },\n noArrayIndent: {\n description:\n '(default: false) - when true, will not add an indentation level to array elements',\n type: 'boolean',\n },\n skipInvalid: {\n description:\n '(default: false) - do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types',\n type: 'boolean',\n },\n flowLevel: {\n description:\n '(default: -1) - specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere',\n type: 'number',\n },\n sortKeys: {\n description:\n '(default: false) - if true, sort keys when dumping YAML. If a function, use the function to sort the keys',\n type: 'boolean',\n },\n lineWidth: {\n description:\n '(default: 80) - set max line width. Set -1 for unlimited width',\n type: 'number',\n },\n noRefs: {\n description:\n \"(default: false) - if true, don't convert duplicate objects into references\",\n type: 'boolean',\n },\n noCompatMode: {\n description:\n '(default: false) - if true don\\'t try to be compatible with older yaml versions. Currently: don\\'t quote \"yes\", \"no\" and so on, as required for YAML 1.1',\n type: 'boolean',\n },\n condenseFlow: {\n description:\n \"(default: false) - if true flow sequences will be condensed, omitting the space between a, b. Eg. '[a,b]', and omitting the space between key: value and quoting the key. Eg. '{\\\"a\\\":b}' Can be useful when using yaml for pretty URL query params as spaces are %-encoded.\",\n type: 'boolean',\n },\n quotingType: {\n description:\n \"(' or \\\", default: ') - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.\",\n type: 'string',\n },\n forceQuotes: {\n description:\n \"(default: false) - if true, all non-key strings will be quoted even if they normally don't need to.\",\n type: 'boolean',\n },\n },\n};\n","/*\n * Copyright 2021 Larder Software Limited\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 { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\nimport { extname } from 'path';\nimport { isArray, isNull, mergeWith } from 'lodash';\nimport YAML from 'yaml';\nimport { stringifyOptions, yamlOptionsSchema } from '../../types';\nimport detectIndent from 'detect-indent';\n\nfunction mergeArrayCustomiser(objValue: string | any[], srcValue: any) {\n if (isArray(objValue) && !isNull(objValue)) {\n return Array.from(new Set(objValue.concat(srcValue)));\n }\n return undefined;\n}\n\nexport function createMergeJSONAction({ actionId }: { actionId?: string }) {\n return createTemplateAction<{\n path: string;\n content: any;\n mergeArrays?: boolean;\n matchFileIndent?: boolean;\n }>({\n id: actionId || 'roadiehq:utils:json:merge',\n description: 'Merge new data into an existing JSON file.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['content', 'path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to existing file to append.',\n type: 'string',\n },\n content: {\n description:\n 'This will be merged into to the file. Can be either an object or a string.',\n title: 'Content',\n type: ['string', 'object'],\n },\n mergeArrays: {\n type: 'boolean',\n default: false,\n title: 'Merge Arrays?',\n description:\n 'Where a value is an array the merge function should concatenate the provided array value with the target array',\n },\n matchFileIndent: {\n type: 'boolean',\n default: false,\n title: 'Match file indent?',\n description:\n 'Make the output file indentation match that of the specified input file.',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n let existingContent;\n\n if (fs.existsSync(sourceFilepath)) {\n existingContent = JSON.parse(\n fs.readFileSync(sourceFilepath).toString(),\n );\n } else {\n ctx.logger.info(\n `The file ${sourceFilepath} does not exist, creating it.`,\n );\n existingContent = {};\n }\n const content =\n typeof ctx.input.content === 'string'\n ? JSON.parse(ctx.input.content)\n : ctx.input.content;\n\n let fileIndent = 2;\n if (ctx.input.matchFileIndent) {\n fileIndent = detectIndent(\n fs.readFileSync(sourceFilepath, 'utf8'),\n ).amount;\n if (!fileIndent) {\n fileIndent = 2;\n ctx.logger.info(\n `Failed to detect source file indentation, using default value of 2.`,\n );\n }\n }\n fs.writeFileSync(\n sourceFilepath,\n JSON.stringify(\n mergeWith(\n existingContent,\n content,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n ),\n null,\n fileIndent,\n ),\n );\n ctx.output('path', sourceFilepath);\n },\n });\n}\n\nexport function createMergeAction() {\n return createTemplateAction<{\n path: string;\n content: any;\n mergeArrays?: boolean;\n options?: stringifyOptions;\n }>({\n id: 'roadiehq:utils:merge',\n description: 'Merges data into an existing structured file.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['content', 'path'],\n properties: {\n path: {\n title: 'Path',\n description: 'Path to existing file to append.',\n type: 'string',\n },\n content: {\n description:\n 'This will be merged into to the file. Can be either an object or a string.',\n title: 'Content',\n type: ['string', 'object'],\n },\n mergeArrays: {\n type: 'boolean',\n default: false,\n title: 'Merge Arrays?',\n description:\n 'Where a value is an array the merge function should concatenate the provided array value with the target array',\n },\n options: {\n ...yamlOptionsSchema,\n description: `${yamlOptionsSchema.description} (for YAML output only)`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n path: {\n title: 'Path',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n if (!fs.existsSync(sourceFilepath)) {\n ctx.logger.error(`The file ${sourceFilepath} does not exist.`);\n throw new Error(`The file ${sourceFilepath} does not exist.`);\n }\n const originalContent = fs.readFileSync(sourceFilepath).toString();\n let mergedContent;\n\n switch (extname(sourceFilepath)) {\n case '.json': {\n const newContent =\n typeof ctx.input.content === 'string'\n ? JSON.parse(ctx.input.content)\n : ctx.input.content; // This supports the case where dynamic keys are required\n mergedContent = JSON.stringify(\n mergeWith(\n YAML.parse(originalContent),\n newContent,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n ),\n null,\n 2,\n );\n break;\n }\n case '.yml':\n case '.yaml': {\n const newContent =\n typeof ctx.input.content === 'string'\n ? YAML.parse(ctx.input.content)\n : ctx.input.content; // This supports the case where dynamic keys are required\n mergedContent = YAML.stringify(\n mergeWith(\n YAML.parse(originalContent),\n newContent,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n ),\n ctx.input.options,\n );\n break;\n }\n default:\n break;\n }\n if (!mergedContent) {\n return;\n }\n fs.writeFileSync(sourceFilepath, mergedContent);\n ctx.output('path', sourceFilepath);\n },\n });\n}\n","/*\n * Copyright 2021 Larder Software Limited\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-backend';\nimport { InputError } from '@backstage/errors';\n\nexport function createSleepAction(options?: { maxSleep?: number }) {\n return createTemplateAction<{ amount: number }>({\n id: 'roadiehq:utils:sleep',\n description: 'Halts the scaffolding for the given amount of seconds',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['amount'],\n properties: {\n amount: {\n title: 'Sleep Amount',\n description: 'How much seconds should this step take.',\n type: 'number',\n },\n },\n },\n },\n async handler(ctx) {\n if (isNaN(ctx.input?.amount)) {\n throw new InputError('amount must be a number');\n } else if (options?.maxSleep && ctx.input.amount > options.maxSleep) {\n throw new InputError(\n `sleep amount can not be greater than maxSleep. amount: ${ctx.input.amount}, maxSleep: ${options.maxSleep}`,\n );\n }\n ctx.logger.info(`Waiting ${ctx.input.amount} seconds`);\n\n await new Promise(resolve => {\n setTimeout(resolve, ctx.input.amount * 1000);\n });\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport jsonata from 'jsonata';\n\nexport function createJSONataAction() {\n return createTemplateAction<{\n data: any;\n expression: string;\n }>({\n id: 'roadiehq:utils:jsonata',\n description:\n 'Allows performing JSONata operations and transformations on input objects and produces the output result as a step output.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['data', 'expression'],\n properties: {\n data: {\n title: 'Data',\n description: 'Input data to be transformed',\n type: [\n 'object',\n 'array',\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'null',\n ],\n },\n expression: {\n title: 'Expression',\n description: 'JSONata expression to perform on the input',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n result: {\n title: 'Output result from JSONata',\n type: 'object',\n },\n },\n },\n },\n async handler(ctx) {\n try {\n const expression = jsonata(ctx.input.expression);\n const result = expression.evaluate(ctx.input.data);\n\n ctx.output('result', result);\n } catch (e: any) {\n const message = e.hasOwnProperty('message')\n ? e.message\n : 'unknown JSONata evaluation error';\n throw new Error(\n `JSONata failed to evaluate the expression: ${message}`,\n );\n }\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport jsonata from 'jsonata';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\nimport YAML from 'yaml';\nimport { stringifyOptions, yamlOptionsSchema } from '../../types';\n\nexport function createYamlJSONataTransformAction() {\n return createTemplateAction<{\n path: string;\n expression: string;\n options?: stringifyOptions;\n loadAll?: boolean;\n as?: 'string' | 'object';\n }>({\n id: 'roadiehq:utils:jsonata:yaml:transform',\n description:\n 'Allows performing JSONata operations and transformations on a YAML file in the workspace. The result can be read from the `result` step output.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['path', 'expression'],\n properties: {\n path: {\n title: 'Path',\n description: 'Input path to read yaml file',\n type: 'string',\n },\n expression: {\n title: 'Expression',\n description: 'JSONata expression to perform on the input',\n type: 'string',\n },\n loadAll: {\n title: 'Load All',\n description:\n 'Use this if the yaml source file contains multiple yaml objects',\n type: 'boolean',\n },\n as: {\n title: 'Desired Result Type',\n description:\n 'Permitted values are: \"string\" (default) and \"object\"',\n type: 'string',\n enum: ['string', 'object'],\n },\n options: yamlOptionsSchema,\n },\n },\n output: {\n type: 'object',\n properties: {\n result: {\n title: 'Output result from JSONata',\n type: 'object | string',\n },\n },\n },\n },\n async handler(ctx) {\n let resultHandler: (rz: any) => any;\n\n if (ctx.input.as === 'object') {\n resultHandler = rz => rz;\n } else {\n resultHandler = rz => YAML.stringify(rz, ctx.input.options);\n }\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n let data;\n if (ctx.input.loadAll) {\n data = YAML.parseAllDocuments(\n fs.readFileSync(sourceFilepath).toString(),\n ).map(doc => doc.toJSON());\n } else {\n data = YAML.parse(fs.readFileSync(sourceFilepath).toString());\n }\n const expression = jsonata(ctx.input.expression);\n const result = expression.evaluate(data);\n\n ctx.output('result', resultHandler(result));\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\nimport jsonata from 'jsonata';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport fs from 'fs-extra';\n\nexport function createJsonJSONataTransformAction() {\n return createTemplateAction<{\n path: string;\n expression: string;\n replacer?: string[];\n space?: string;\n as?: 'string' | 'object';\n }>({\n id: 'roadiehq:utils:jsonata:json:transform',\n description:\n 'Allows performing JSONata operations and transformations on a JSON file in the workspace. The result can be read from the `result` step output.',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['path', 'expression'],\n properties: {\n path: {\n title: 'Path',\n description: 'Input path to read json file',\n type: 'string',\n },\n expression: {\n title: 'Expression',\n description: 'JSONata expression to perform on the input',\n type: 'string',\n },\n as: {\n title: 'Desired Result Type',\n description:\n 'Permitted values are: \"string\" (default) and \"object\"',\n type: 'string',\n enum: ['string', 'object'],\n },\n replacer: {\n title: 'Replacer',\n description: 'Replacer array',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n space: {\n title: 'Space',\n description: 'Space character',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n result: {\n title: 'Output result from JSONata',\n type: 'object | string',\n },\n },\n },\n },\n async handler(ctx) {\n let resultHandler: (rz: any) => any;\n\n if (ctx.input.as === 'object') {\n resultHandler = rz => rz;\n } else {\n resultHandler = rz =>\n JSON.stringify(rz, ctx.input.replacer, ctx.input.space);\n }\n const sourceFilepath = resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input.path,\n );\n\n const data = JSON.parse(fs.readFileSync(sourceFilepath).toString());\n const expression = jsonata(ctx.input.expression);\n const result = expression.evaluate(data);\n\n ctx.output('result', resultHandler(result));\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-backend';\n\nexport function createSerializeJsonAction() {\n return createTemplateAction<{\n data: any;\n replacer?: string[];\n space?: string;\n }>({\n id: 'roadiehq:utils:serialize:json',\n description: 'Allows performing serialization on an object',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['data'],\n properties: {\n data: {\n title: 'Data',\n description: 'Input data to perform seriazation on.',\n type: 'object',\n },\n replacer: {\n title: 'Replacer',\n description: 'Replacer array',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n space: {\n title: 'Space',\n description: 'Space character',\n type: 'string',\n },\n },\n },\n output: {\n type: 'string',\n properties: {\n serialized: {\n title: 'Output result from serialization',\n type: 'string',\n },\n },\n },\n },\n\n async handler(ctx) {\n ctx.output(\n 'serialized',\n JSON.stringify(ctx.input.data, ctx.input.replacer, ctx.input.space),\n );\n },\n });\n}\n","/*\n * Copyright 2022 Larder Software Limited\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport YAML from 'yaml';\nimport { stringifyOptions, yamlOptionsSchema } from '../../types';\n\nexport function createSerializeYamlAction() {\n return createTemplateAction<{\n data: any;\n options?: stringifyOptions;\n }>({\n id: 'roadiehq:utils:serialize:yaml',\n description: 'Allows performing serialization on an object',\n supportsDryRun: true,\n schema: {\n input: {\n type: 'object',\n required: ['data'],\n properties: {\n data: {\n title: 'Data',\n description: 'Input data to perform seriazation on.',\n type: 'object',\n },\n replacer: {\n title: 'Replacer',\n description: 'Replacer array',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n options: yamlOptionsSchema,\n },\n },\n output: {\n type: 'string',\n properties: {\n serialized: {\n title: 'Output result from serialization',\n type: 'string',\n },\n },\n },\n },\n\n async handler(ctx) {\n ctx.output(\n 'serialized',\n YAML.stringify(ctx.input.data, ctx.input.options),\n );\n },\n });\n}\n"],"names":["createTemplateAction","AdmZip","resolveSafeChildPath","fs","InputError","YAML","content","isArray","isNull","detectIndent","mergeWith","extname","jsonata"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,eAAkB,GAAA;AAChC,EAAA,OAAOA,4CAA2D,CAAA;AAAA,IAChE,EAAI,EAAA,oBAAA;AAAA,IACJ,WAAa,EAAA,8BAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,QAAA,EAAU,CAAC,MAAM,CA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CAAA,CAAA;AACH;;AClDO,SAAS,yBAA4B,GAAA;AAC1C,EAAA,OAAOA,yCAGJ,CAAA;AAAA,IACD,EAAI,EAAA,+BAAA;AAAA,IACJ,WAAa,EAAA,8CAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,MAAM,CAAA;AAAA,QACjB,UAAY,EAAA;AAAA,UACV,IAAM,EAAA;AAAA,YACJ,KAAO,EAAA,MAAA;AAAA,YACP,WAAa,EAAA,uCAAA;AAAA,YACb,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,QAAU,EAAA;AAAA,YACR,KAAO,EAAA,UAAA;AAAA,YACP,WAAa,EAAA,gBAAA;AAAA,YACb,IAAM,EAAA,OAAA;AAAA,YACN,KAAO,EAAA;AAAA,cACL,IAAM,EAAA,QAAA;AAAA,aACR;AAAA,WACF;AAAA,UACA,OAAS,EAAA,iBAAA;AAAA,SACX;AAAA,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,kCAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IAEA,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAI,GAAA,CAAA,MAAA;AAAA,QACF,YAAA;AAAA,QACAK,sBAAK,SAAU,CAAA,GAAA,CAAI,MAAM,IAAM,EAAA,GAAA,CAAI,MAAM,OAAO,CAAA;AAAA,OAClD,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@roadiehq/scaffolder-backend-module-utils",
3
- "version": "1.14.0",
4
- "main": "dist/index.cjs.js",
5
- "types": "dist/index.d.ts",
3
+ "version": "1.15.0",
4
+ "main": "./dist/index.cjs.js",
5
+ "types": "./dist/index.d.ts",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
8
- "access": "public",
9
- "main": "dist/index.cjs.js",
10
- "types": "dist/index.d.ts"
8
+ "access": "public"
11
9
  },
12
10
  "backstage": {
13
- "role": "backend-plugin"
11
+ "role": "backend-plugin-module"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "require": "./dist/index.cjs.js",
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.cjs.js"
18
+ },
19
+ "./package.json": "./package.json"
14
20
  },
15
21
  "repository": {
16
22
  "type": "git",
@@ -31,11 +37,12 @@
31
37
  "clean": "backstage-cli clean"
32
38
  },
33
39
  "dependencies": {
34
- "@backstage/backend-common": "^0.21.3",
35
- "@backstage/config": "^1.1.1",
36
- "@backstage/errors": "^1.2.3",
37
- "@backstage/plugin-scaffolder-backend": "^1.21.3",
38
- "@backstage/plugin-scaffolder-node": "^0.3.3",
40
+ "@backstage/backend-common": "^0.21.6",
41
+ "@backstage/backend-plugin-api": "^0.6.16",
42
+ "@backstage/config": "^1.2.0",
43
+ "@backstage/errors": "^1.2.4",
44
+ "@backstage/plugin-scaffolder-backend": "^1.22.3",
45
+ "@backstage/plugin-scaffolder-node": "^0.4.2",
39
46
  "adm-zip": "^0.5.9",
40
47
  "cross-fetch": "^3.1.4",
41
48
  "detect-indent": "^6.1.0",
@@ -46,7 +53,8 @@
46
53
  "yaml": "^2.3.4"
47
54
  },
48
55
  "devDependencies": {
49
- "@backstage/cli": "^0.25.2",
56
+ "@backstage/backend-test-utils": "^0.3.6",
57
+ "@backstage/cli": "^0.26.2",
50
58
  "@testing-library/jest-dom": "^6.4.2",
51
59
  "@types/adm-zip": "^0.4.34",
52
60
  "@types/fs-extra": "^9.0.13",
@@ -57,5 +65,5 @@
57
65
  "files": [
58
66
  "dist"
59
67
  ],
60
- "gitHead": "e2ec28fd71cfc60e801bb38a0a3ca1e67f245046"
68
+ "gitHead": "fb8ce775546faa2fb68fe922d946e1ab5909aeb2"
61
69
  }