@roadiehq/scaffolder-backend-module-utils 1.17.0 → 2.0.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 +2 -2
- package/dist/cjs/{yaml-CSkuC5qH.cjs.js → yaml-DR8FrHUV.cjs.js} +51 -27
- package/dist/cjs/yaml-DR8FrHUV.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/new-backend.cjs.js +1 -1
- package/new-backend/package.json +1 -1
- package/package.json +2 -2
- package/dist/cjs/yaml-CSkuC5qH.cjs.js.map +0 -1
package/README.md
CHANGED
|
@@ -199,7 +199,7 @@ spec:
|
|
|
199
199
|
name: sleep
|
|
200
200
|
action: roadiehq:utils:sleep
|
|
201
201
|
input:
|
|
202
|
-
|
|
202
|
+
amount: ${{ parameters.amount }}
|
|
203
203
|
```
|
|
204
204
|
|
|
205
205
|
### Deserialise
|
|
@@ -248,7 +248,7 @@ spec:
|
|
|
248
248
|
path: ${{ parameters.path }}
|
|
249
249
|
parser: ${{ parameters.parser }}
|
|
250
250
|
output:
|
|
251
|
-
content: ${{ steps.
|
|
251
|
+
content: ${{ steps.parsefile.output.content }}
|
|
252
252
|
```
|
|
253
253
|
|
|
254
254
|
### Serialise to JSON or YAML
|
|
@@ -311,49 +311,73 @@ const yamlOptionsSchema = {
|
|
|
311
311
|
description: "YAML stringify options",
|
|
312
312
|
type: "object",
|
|
313
313
|
properties: {
|
|
314
|
-
|
|
315
|
-
description: "(default:
|
|
316
|
-
type: "
|
|
314
|
+
blockQuote: {
|
|
315
|
+
description: "(default: true) - use block quote styles for scalar values where applicable",
|
|
316
|
+
type: "boolean | 'folded' | 'literal'"
|
|
317
|
+
},
|
|
318
|
+
collectionStyle: {
|
|
319
|
+
description: "(default: 'any') - enforce 'block' or 'flow' style on maps and sequences. By default, allows each collection to set its own flow: boolean property",
|
|
320
|
+
type: "'any' | 'block' | 'flow'"
|
|
321
|
+
},
|
|
322
|
+
defaultKeyType: {
|
|
323
|
+
description: "(default: null) - if not null, overrides defaultStringType for implicit key values",
|
|
324
|
+
type: "'BLOCK_FOLDED' \u23AE 'BLOCK_LITERAL' \u23AE 'QUOTE_DOUBLE' \u23AE 'QUOTE_SINGLE' \u23AE 'PLAIN' \u23AE null"
|
|
325
|
+
},
|
|
326
|
+
defaultStringType: {
|
|
327
|
+
description: "(default: 'PLAIN') - the default type of string literal used to stringify values",
|
|
328
|
+
type: "'BLOCK_FOLDED' \u23AE 'BLOCK_LITERAL' \u23AE 'QUOTE_DOUBLE' \u23AE 'QUOTE_SINGLE' \u23AE 'PLAIN'"
|
|
317
329
|
},
|
|
318
|
-
|
|
319
|
-
description: "(default:
|
|
330
|
+
directives: {
|
|
331
|
+
description: "(default: null) - include directives in the output. If true, at least the document-start marker --- is always included. If false, no directives or marker is ever included. If null, directives and marker may be included if required",
|
|
332
|
+
type: "boolean | null"
|
|
333
|
+
},
|
|
334
|
+
doubleQuotedAsJSON: {
|
|
335
|
+
description: "(default: false) - if true, restrict double-quoted strings to use JSON-compatible syntax",
|
|
320
336
|
type: "boolean"
|
|
321
337
|
},
|
|
322
|
-
|
|
323
|
-
description: "(default:
|
|
338
|
+
doubleQuotedMinMultiLineLength: {
|
|
339
|
+
description: "(default: 40) - minimum length for double-quoted strings to use multiple lines to represent the value instead of escaping newlines",
|
|
340
|
+
type: "number"
|
|
341
|
+
},
|
|
342
|
+
falseStr: {
|
|
343
|
+
description: "(default: 'false') - string representation for false boolean values",
|
|
344
|
+
type: "string"
|
|
345
|
+
},
|
|
346
|
+
flowCollectionPadding: {
|
|
347
|
+
description: "(default: true) - if true, a single space of padding will be added inside the delimiters of non-empty single-line flow collections",
|
|
324
348
|
type: "boolean"
|
|
325
349
|
},
|
|
326
|
-
|
|
327
|
-
description: "(default:
|
|
350
|
+
indent: {
|
|
351
|
+
description: "(default: 2) - the number of spaces to use when indenting code. Should be a strictly positive integer",
|
|
328
352
|
type: "number"
|
|
329
353
|
},
|
|
330
|
-
|
|
331
|
-
description: "(default:
|
|
354
|
+
indentSeq: {
|
|
355
|
+
description: "(default: true) - if true, block sequences should be indented",
|
|
332
356
|
type: "boolean"
|
|
333
357
|
},
|
|
334
358
|
lineWidth: {
|
|
335
|
-
description: "(default: 80) - set
|
|
359
|
+
description: "(default: 80) -maximum line width (set to 0 to disable folding). This is a soft limit, as only double-quoted semantics allow for inserting a line break in the middle of a word ",
|
|
336
360
|
type: "number"
|
|
337
361
|
},
|
|
338
|
-
|
|
339
|
-
description: "(default:
|
|
340
|
-
type: "
|
|
362
|
+
minContentWidth: {
|
|
363
|
+
description: "(default: 20) - minimum line width for highly-indented content (set to 0 to disable)",
|
|
364
|
+
type: "number"
|
|
341
365
|
},
|
|
342
|
-
|
|
343
|
-
description:
|
|
344
|
-
type: "
|
|
366
|
+
nullStr: {
|
|
367
|
+
description: "(default: 'null') - string representation for null values",
|
|
368
|
+
type: "number"
|
|
345
369
|
},
|
|
346
|
-
|
|
347
|
-
description:
|
|
370
|
+
simpleKeys: {
|
|
371
|
+
description: "(default: false) - if true, require keys to be scalars and always use implicit rather than explicit notation",
|
|
348
372
|
type: "boolean"
|
|
349
373
|
},
|
|
350
|
-
|
|
351
|
-
description:
|
|
352
|
-
type: "
|
|
374
|
+
singleQuote: {
|
|
375
|
+
description: "(default: null) - Use single quote rather than double quote where applicable. Set to false to disable single quotes completely",
|
|
376
|
+
type: "boolean | null"
|
|
353
377
|
},
|
|
354
|
-
|
|
355
|
-
description: "(default:
|
|
356
|
-
type: "
|
|
378
|
+
trueStr: {
|
|
379
|
+
description: "(default: 'true') - string representation for true boolean values",
|
|
380
|
+
type: "string"
|
|
357
381
|
}
|
|
358
382
|
}
|
|
359
383
|
};
|
|
@@ -901,4 +925,4 @@ exports.createSleepAction = createSleepAction;
|
|
|
901
925
|
exports.createWriteFileAction = createWriteFileAction;
|
|
902
926
|
exports.createYamlJSONataTransformAction = createYamlJSONataTransformAction;
|
|
903
927
|
exports.createZipAction = createZipAction;
|
|
904
|
-
//# sourceMappingURL=yaml-
|
|
928
|
+
//# sourceMappingURL=yaml-DR8FrHUV.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-DR8FrHUV.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 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 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 matchRegex: boolean;\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 matchRegex: {\n type: 'bool',\n title: 'Use regex to match the find string',\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 let find: string | RegExp = file.find;\n if (file.matchRegex) {\n find = new RegExp(file.find, 'g');\n }\n\n const replacedContent = content.replaceAll(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 blockQuote: {\n description:\n '(default: true) - use block quote styles for scalar values where applicable',\n type: \"boolean | 'folded' | 'literal'\",\n },\n collectionStyle: {\n description:\n \"(default: 'any') - enforce 'block' or 'flow' style on maps and sequences. By default, allows each collection to set its own flow: boolean property\",\n type: \"'any' | 'block' | 'flow'\",\n },\n defaultKeyType: {\n description:\n '(default: null) - if not null, overrides defaultStringType for implicit key values',\n type: \"'BLOCK_FOLDED' ⎮ 'BLOCK_LITERAL' ⎮ 'QUOTE_DOUBLE' ⎮ 'QUOTE_SINGLE' ⎮ 'PLAIN' ⎮ null\",\n },\n defaultStringType: {\n description:\n \"(default: 'PLAIN') - the default type of string literal used to stringify values\",\n type: \"'BLOCK_FOLDED' ⎮ 'BLOCK_LITERAL' ⎮ 'QUOTE_DOUBLE' ⎮ 'QUOTE_SINGLE' ⎮ 'PLAIN'\",\n },\n directives: {\n description:\n '(default: null) - include directives in the output. If true, at least the document-start marker --- is always included. If false, no directives or marker is ever included. If null, directives and marker may be included if required',\n type: 'boolean | null',\n },\n doubleQuotedAsJSON: {\n description:\n '(default: false) - if true, restrict double-quoted strings to use JSON-compatible syntax',\n type: 'boolean',\n },\n doubleQuotedMinMultiLineLength: {\n description:\n '(default: 40) - minimum length for double-quoted strings to use multiple lines to represent the value instead of escaping newlines',\n type: 'number',\n },\n falseStr: {\n description:\n \"(default: 'false') - string representation for false boolean values\",\n type: 'string',\n },\n flowCollectionPadding: {\n description:\n '(default: true) - if true, a single space of padding will be added inside the delimiters of non-empty single-line flow collections',\n type: 'boolean',\n },\n indent: {\n description:\n '(default: 2) - the number of spaces to use when indenting code. Should be a strictly positive integer',\n type: 'number',\n },\n indentSeq: {\n description:\n '(default: true) - if true, block sequences should be indented',\n type: 'boolean',\n },\n lineWidth: {\n description:\n '(default: 80) -maximum line width (set to 0 to disable folding). This is a soft limit, as only double-quoted semantics allow for inserting a line break in the middle of a word ',\n type: 'number',\n },\n minContentWidth: {\n description:\n '(default: 20) - minimum line width for highly-indented content (set to 0 to disable)',\n type: 'number',\n },\n nullStr: {\n description: \"(default: 'null') - string representation for null values\",\n type: 'number',\n },\n simpleKeys: {\n description:\n '(default: false) - if true, require keys to be scalars and always use implicit rather than explicit notation',\n type: 'boolean',\n },\n singleQuote: {\n description:\n '(default: null) - Use single quote rather than double quote where applicable. Set to false to disable single quotes completely',\n type: 'boolean | null',\n },\n trueStr: {\n description:\n \"(default: 'true') - string representation for true boolean values\",\n type: 'string',\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 YAWN from 'yawn-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 preserveYamlComments?: 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 preserveYamlComments: {\n type: 'boolean',\n default: false,\n title: 'Preserve Comments?',\n description:\n 'Will preserve standalone and inline comments in YAML files',\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 if (ctx.input.preserveYamlComments) {\n const yawn = new YAWN(originalContent);\n const parsedOriginal = yawn.json;\n const mergedJsonContent = mergeWith(\n parsedOriginal,\n newContent,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n );\n yawn.json = mergedJsonContent;\n mergedContent = YAML.stringify(\n YAML.parseDocument(yawn.yaml),\n ctx.input.options,\n );\n } else {\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 }\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 = await 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 = await 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 = await 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","YAWN","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,Y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/dist/new-backend.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
6
|
var alpha = require('@backstage/plugin-scaffolder-node/alpha');
|
|
7
|
-
var yaml = require('./cjs/yaml-
|
|
7
|
+
var yaml = require('./cjs/yaml-DR8FrHUV.cjs.js');
|
|
8
8
|
require('@backstage/backend-common');
|
|
9
9
|
require('@backstage/plugin-scaffolder-backend');
|
|
10
10
|
require('@backstage/errors');
|
package/new-backend/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roadiehq/scaffolder-backend-module-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"dist",
|
|
73
73
|
"new-backend"
|
|
74
74
|
],
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "a78f562f9e6af6b9e73a003e2b7a0376c8e6564a"
|
|
76
76
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-CSkuC5qH.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 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 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 matchRegex: boolean;\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 matchRegex: {\n type: 'bool',\n title: 'Use regex to match the find string',\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 let find: string | RegExp = file.find;\n if (file.matchRegex) {\n find = new RegExp(file.find, 'g');\n }\n\n const replacedContent = content.replaceAll(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 YAWN from 'yawn-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 preserveYamlComments?: 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 preserveYamlComments: {\n type: 'boolean',\n default: false,\n title: 'Preserve Comments?',\n description:\n 'Will preserve standalone and inline comments in YAML files',\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 if (ctx.input.preserveYamlComments) {\n const yawn = new YAWN(originalContent);\n const parsedOriginal = yawn.json;\n const mergedJsonContent = mergeWith(\n parsedOriginal,\n newContent,\n ctx.input.mergeArrays ? mergeArrayCustomiser : undefined,\n );\n yawn.json = mergedJsonContent;\n mergedContent = YAML.stringify(\n YAML.parseDocument(yawn.yaml),\n ctx.input.options,\n );\n } else {\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 }\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 = await 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 = await 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 = await 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","YAWN","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,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