@roadiehq/scaffolder-backend-module-utils 1.15.2 → 1.15.4
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/dist/cjs/{yaml-CAPzYRTX.cjs.js → yaml-BZ_-NBwH.cjs.js} +2 -1
- package/dist/cjs/yaml-BZ_-NBwH.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 +8 -8
- package/dist/cjs/yaml-CAPzYRTX.cjs.js.map +0 -1
|
@@ -139,6 +139,7 @@ function createAppendFileAction() {
|
|
|
139
139
|
return pluginScaffolderBackend.createTemplateAction({
|
|
140
140
|
id: "roadiehq:utils:fs:append",
|
|
141
141
|
description: "Append content to the end of the given file, it will create the file if it does not exist.",
|
|
142
|
+
supportsDryRun: true,
|
|
142
143
|
schema: {
|
|
143
144
|
input: {
|
|
144
145
|
type: "object",
|
|
@@ -869,4 +870,4 @@ exports.createSleepAction = createSleepAction;
|
|
|
869
870
|
exports.createWriteFileAction = createWriteFileAction;
|
|
870
871
|
exports.createYamlJSONataTransformAction = createYamlJSONataTransformAction;
|
|
871
872
|
exports.createZipAction = createZipAction;
|
|
872
|
-
//# sourceMappingURL=yaml-
|
|
873
|
+
//# sourceMappingURL=yaml-BZ_-NBwH.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-BZ_-NBwH.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 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 = 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","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,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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/dist/index.cjs.js
CHANGED
package/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-BZ_-NBwH.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": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"clean": "backstage-cli clean"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@backstage/backend-common": "^0.21.
|
|
46
|
-
"@backstage/backend-plugin-api": "^0.6.
|
|
45
|
+
"@backstage/backend-common": "^0.21.7",
|
|
46
|
+
"@backstage/backend-plugin-api": "^0.6.17",
|
|
47
47
|
"@backstage/config": "^1.2.0",
|
|
48
48
|
"@backstage/errors": "^1.2.4",
|
|
49
|
-
"@backstage/plugin-scaffolder-backend": "^1.22.
|
|
50
|
-
"@backstage/plugin-scaffolder-node": "^0.4.
|
|
49
|
+
"@backstage/plugin-scaffolder-backend": "^1.22.5",
|
|
50
|
+
"@backstage/plugin-scaffolder-node": "^0.4.3",
|
|
51
51
|
"adm-zip": "^0.5.9",
|
|
52
52
|
"cross-fetch": "^3.1.4",
|
|
53
53
|
"detect-indent": "^6.1.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"yaml": "^2.3.4"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@backstage/backend-test-utils": "^0.3.
|
|
62
|
-
"@backstage/cli": "^0.26.
|
|
61
|
+
"@backstage/backend-test-utils": "^0.3.7",
|
|
62
|
+
"@backstage/cli": "^0.26.4",
|
|
63
63
|
"@testing-library/jest-dom": "^6.4.2",
|
|
64
64
|
"@types/adm-zip": "^0.4.34",
|
|
65
65
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"dist",
|
|
72
72
|
"new-backend"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "9e3d96583f7422cc060a2781f9ad0cc89c8850de"
|
|
75
75
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-CAPzYRTX.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 = 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","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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