@rockcarver/frodo-cli 2.0.0-55 → 2.0.0-57
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/CHANGELOG.md +9 -1
- package/esm/cli/script/script-export.js +2 -2
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/service/service-import.js +2 -2
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/ops/AdminOps.js +17 -19
- package/esm/ops/AdminOps.js.map +1 -1
- package/esm/ops/ConfigOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +2 -1
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/ScriptOps.js +5 -2
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/templates/{cloud/GenericExtensionAttributesTemplate.json → GenericExtensionAttributesTemplate.json} +20 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JourneyOps.js","names":["frodo","FrodoError","state","fs","createProgressIndicator","createTable","debugMessage","printError","printMessage","stopProgressIndicator","updateProgressIndicator","CirclesOfTrust","EmailTemplate","Idp","Node","Saml2","Script","Theme","cloneDeep","wordwrap","getTypedFilename","saveJsonToFile","getRealmString","getFilePath","getWorkingDirectory","utils","readJourneys","exportJourney","exportJourneys","resolveDependencies","importJourneys","importJourney","getTreeDescendents","getNodeRef","onlineTreeExportResolver","getJourneyClassification","_getJourneyClassification","disableJourney","_disableJourney","enableJourney","_enableJourney","deleteJourney","_deleteJourney","deleteJourneys","_deleteJourneys","authn","journey","listJourneys","long","analyze","journeys","journeyStub","table","_journeyStub$uiConfig","push","_id","enabled","uiConfig","categories","JSON","parse","join","toString","spinnerId","exportPromises","useStringArrays","deps","coords","journeyExports","Promise","all","journeyExport","_journeyExport$tree$u","tree","error","exportJourneyToFile","journeyId","file","includeMeta","options","verbose","getVerbose","filePath","fileData","exportJourneysToFile","exportJourneysToFiles","journeysExport","trees","Object","entries","treeId","treeValue","indicatorId","meta","importJourneyFromFile","data","readFileSync","journeyData","installedJourneys","map","x","unresolvedJourneys","resolvedJourneys","indicatorId1","keys","length","indicatorId2","importError","indicatorId3","importFirstJourneyFromFile","hasOwnProperty","call","depSpinnerId","importSpinnerId","importJourneysFromFile","importJourneysFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","allJourneysData","it","getJourneyClassificationMd","getOneLineDescription","treeObj","description","getOneLineDescriptionMd","describeTreeDescendents","descendents","depth","values","indent","Array","fill","descendent","describeTreeDescendentsMd","markdown","describeJourney","resolveTreeExport","errors","_journeyData$meta","_journeyData$tree$uiC","_journeyData$themes","allNodes","nodes","innerNodes","nodeTypeMap","nodeData","_type","getAmVersion","originAmVersion","setAmVersion","nodeType","count","String","getNodeClassification","nodeObj","themes","themeData","scripts","scriptData","emailTemplates","templateData","socialIdentityProviders","socialIdpData","saml2Entities","entityProviderData","circlesOfTrust","cotData","describeJourneyMd","_journeyData$meta2","_journeyData$tree$uiC2","_journeyData$themes2","getNodeClassificationMd","getTableHeaderMd","getTableRowMd","deep","progress","status"],"sources":["../../src/ops/JourneyOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport { type NodeSkeleton } from '@rockcarver/frodo-lib/types/api/NodeApi';\nimport { type TreeSkeleton } from '@rockcarver/frodo-lib/types/api/TreeApi';\nimport {\n DeleteJourneysStatus,\n type JourneyClassificationType,\n type MultiTreeExportInterface,\n type SingleTreeExportInterface,\n type TreeDependencyMapInterface,\n type TreeExportOptions,\n type TreeExportResolverInterface,\n type TreeImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/JourneyOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n printError,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport * as CirclesOfTrust from './CirclesOfTrustOps';\nimport * as EmailTemplate from './EmailTemplateOps';\nimport * as Idp from './IdpOps';\nimport * as Node from './NodeOps';\nimport * as Saml2 from './Saml2Ops';\nimport * as Script from './ScriptOps';\nimport * as Theme from './ThemeOps';\nimport { cloneDeep } from './utils/OpsUtils';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n saveJsonToFile,\n getRealmString,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readJourneys,\n exportJourney,\n exportJourneys,\n resolveDependencies,\n importJourneys,\n importJourney,\n getTreeDescendents,\n getNodeRef,\n onlineTreeExportResolver,\n getJourneyClassification: _getJourneyClassification,\n disableJourney: _disableJourney,\n enableJourney: _enableJourney,\n deleteJourney: _deleteJourney,\n deleteJourneys: _deleteJourneys,\n} = frodo.authn.journey;\n\n/**\n * List all the journeys/trees\n * @param {boolean} long Long version, all the fields\n * @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function listJourneys(\n long: boolean = false,\n analyze: boolean = false\n): Promise<boolean> {\n let journeys = [];\n try {\n journeys = await readJourneys();\n if (!long && !analyze) {\n for (const journeyStub of journeys) {\n printMessage(`${journeyStub['_id']}`, 'data');\n }\n return true;\n } else {\n if (!analyze) {\n const table = createTable(['Name', 'Status', 'Tags']);\n for (const journeyStub of journeys) {\n table.push([\n `${journeyStub._id}`,\n journeyStub.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n journeyStub.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyStub.uiConfig.categories).join(', '),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n return true;\n } else {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Retrieving details of all journeys...`\n );\n const exportPromises = [];\n try {\n for (const journeyStub of journeys) {\n exportPromises.push(\n exportJourney(journeyStub['_id'], {\n useStringArrays: false,\n deps: false,\n coords: true,\n })\n );\n }\n const journeyExports = await Promise.all(exportPromises);\n stopProgressIndicator(\n spinnerId,\n 'Retrieved details of all journeys.',\n 'success'\n );\n const table = createTable([\n 'Name',\n 'Status',\n 'Classification',\n 'Tags',\n ]);\n for (const journeyExport of journeyExports) {\n table.push([\n `${journeyExport.tree._id}`,\n journeyExport.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n getJourneyClassification(journeyExport).join(', '),\n journeyExport.tree.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyExport.tree.uiConfig.categories).join(\n ', '\n ),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n 'Error retrieving details of all journeys.',\n 'fail'\n );\n printError(error);\n }\n }\n }\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Export journey by id/name to file\n * @param {string} journeyId journey id/name\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {TreeExportOptions} options export options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportJourneyToFile(\n journeyId: string,\n file: string,\n includeMeta: boolean = true,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n coords: true,\n }\n): Promise<boolean> {\n debugMessage(`exportJourneyToFile: start`);\n const verbose = state.getVerbose();\n if (!file) {\n file = getTypedFilename(journeyId, 'journey');\n }\n const filePath = getFilePath(file, true);\n let spinnerId: string;\n if (!verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n try {\n const fileData: SingleTreeExportInterface = await exportJourney(\n journeyId,\n options\n );\n if (verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n saveJsonToFile(fileData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported ${journeyId['brightCyan']} to ${filePath['brightCyan']}.`,\n 'success'\n );\n return true;\n } catch (error) {\n if (verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n stopProgressIndicator(\n spinnerId,\n `Error exporting journey ${journeyId}: ${error}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all journeys to file\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {TreeExportOptions} options export options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportJourneysToFile(\n file: string,\n includeMeta: boolean = true,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n coords: true,\n }\n): Promise<boolean> {\n try {\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Journeys`, 'journey');\n }\n const filePath = getFilePath(file, true);\n const fileData: MultiTreeExportInterface = await exportJourneys(options);\n saveJsonToFile(fileData, filePath, includeMeta);\n return true;\n } catch (error) {\n printError(error);\n }\n}\n\n/**\n * Export all journeys to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {TreeExportOptions} options export options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportJourneysToFiles(\n includeMeta: boolean = true,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n coords: true,\n }\n): Promise<boolean> {\n try {\n const journeysExport = await exportJourneys(options);\n const trees = Object.entries(journeysExport.trees);\n for (const [treeId, treeValue] of trees) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Saving ${treeId}...`\n );\n const file = getFilePath(getTypedFilename(`${treeId}`, 'journey'), true);\n treeValue['meta'] = journeysExport.meta;\n try {\n updateProgressIndicator(indicatorId, `Saving ${treeId} to ${file}`);\n saveJsonToFile(treeValue, file, includeMeta);\n stopProgressIndicator(indicatorId, `${treeId} saved to ${file}`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error saving ${treeId} to ${file}`);\n }\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import a journey from file\n * @param {string} journeyId journey id/name\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importJourneyFromFile(\n journeyId: string,\n file: string,\n options: TreeImportOptions\n): Promise<boolean> {\n const verbose = state.getVerbose();\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n let journeyData = JSON.parse(data);\n // check if this is a file with multiple trees and get journey by id\n if (journeyData.trees && journeyData.trees[journeyId]) {\n journeyData = journeyData.trees[journeyId];\n } else if (journeyData.trees) {\n journeyData = null;\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId === journeyData.tree._id) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n const indicatorId1 = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Resolving dependencies'\n );\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n stopProgressIndicator(\n indicatorId1,\n `Resolved all dependencies.`,\n 'success'\n );\n\n let indicatorId2: string;\n if (!verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n try {\n await importJourney(journeyData, options);\n if (verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n indicatorId2,\n `Imported ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (importError) {\n if (verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(indicatorId2, `${importError}`, 'fail');\n }\n } else {\n stopProgressIndicator(indicatorId1, `Unresolved dependencies:`, 'fail');\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n // end dependency resolution for single tree import\n } else {\n const indicatorId3 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(indicatorId3, `${journeyId} not found!`, 'fail');\n }\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import first journey from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importFirstJourneyFromFile(\n file: string,\n options: TreeImportOptions\n): Promise<boolean> {\n const verbose = state.getVerbose();\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n let journeyData = cloneDeep(JSON.parse(data));\n let journeyId = null;\n // single tree\n if (journeyData.tree) {\n journeyId = cloneDeep(journeyData.tree._id);\n }\n // multiple trees, so get the first tree\n else if (journeyData.trees) {\n for (const treeId in journeyData.trees) {\n if (Object.hasOwnProperty.call(journeyData.trees, treeId)) {\n journeyId = treeId;\n journeyData = journeyData.trees[treeId];\n break;\n }\n }\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n const depSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Resolving dependencies'\n );\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n stopProgressIndicator(\n depSpinnerId,\n `Resolved all dependencies.`,\n 'success'\n );\n\n let importSpinnerId: string;\n if (!verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n try {\n await importJourney(journeyData, options);\n if (verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n importSpinnerId,\n `Imported ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (importError) {\n if (verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(importSpinnerId, `${importError}`, 'fail');\n }\n } else {\n stopProgressIndicator(depSpinnerId, `Unresolved dependencies:`, 'fail');\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n } else {\n const importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing...`\n );\n stopProgressIndicator(importSpinnerId, `No journeys found!`, 'fail');\n }\n // end dependency resolution for single tree import\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import all journeys from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importJourneysFromFile(\n file: string,\n options: TreeImportOptions\n): Promise<boolean> {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importJourneys(fileData, options);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import all journeys from separate files\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importJourneysFromFiles(\n options: TreeImportOptions\n): Promise<boolean> {\n try {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.journey.json'))\n .map((name) => getFilePath(name));\n const allJourneysData = { trees: {} };\n for (const file of jsonFiles) {\n const journeyData = JSON.parse(fs.readFileSync(file, 'utf8'));\n allJourneysData.trees[journeyData.tree._id] = journeyData;\n }\n await importJourneys(allJourneysData as MultiTreeExportInterface, options);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Get journey classification\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassification(\n journey: SingleTreeExportInterface\n): JourneyClassificationType[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return it['brightGreen'];\n\n case 'cloud':\n return it['brightMagenta'];\n\n case 'custom':\n return it['brightRed'];\n\n case 'premium':\n return it['brightYellow'];\n }\n });\n}\n\n/**\n * Get journey classification in markdown\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassificationMd(\n journey: SingleTreeExportInterface\n): string[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return `:green_circle: \\`${it}\\``;\n\n case 'cloud':\n return `:purple_circle: \\`${it}\\``;\n\n case 'custom':\n return `:red_circle: \\`${it}\\``;\n\n case 'premium':\n return `:yellow_circle: \\`${it}\\``;\n }\n });\n}\n\n/**\n * Get a one-line description of the tree object\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(treeObj: TreeSkeleton): string {\n const description = `[${treeObj._id['brightCyan']}]`;\n return description;\n}\n\n/**\n * Get a one-line description of the tree object in markdown\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescriptionMd(treeObj: TreeSkeleton): string {\n const description = `${treeObj._id}`;\n return description;\n}\n\n/**\n * Helper function to render a nested list of dependent trees\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendents(\n descendents: TreeDependencyMapInterface,\n depth = 0\n) {\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n printMessage(\n `\\nInner Tree Dependencies (${Object.values(descendents)[0].length}):`,\n 'data'\n );\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n printMessage(`${indent}- ${tree['brightCyan']}`, 'data');\n for (const descendent of descendents[tree]) {\n describeTreeDescendents(descendent, depth + 1);\n }\n }\n}\n\n/**\n * Helper function to render a nested list of dependent trees in markdown\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendentsMd(\n descendents: TreeDependencyMapInterface,\n depth = 0\n): string {\n let markdown = '';\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n markdown += `## Inner Tree Dependencies (${\n Object.values(descendents)[0].length\n })\\n`;\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n markdown += `${indent}- ${tree}\\n`;\n for (const descendent of descendents[tree]) {\n markdown += describeTreeDescendentsMd(descendent, depth + 1);\n }\n return markdown;\n }\n return markdown;\n}\n\n/**\n * Describe a journey:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function describeJourney(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n): Promise<boolean> {\n const errors: Error[] = [];\n try {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(`${getOneLineDescription(journeyData.tree)}`, 'data');\n printMessage(\n Array(`[${journeyData.tree._id}]`['length']).fill('=').join('')\n );\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Status\n printMessage(\n `\\nStatus\\n${\n journeyData.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen']\n }`\n );\n\n // Classification\n if (state.getAmVersion()) {\n printMessage(\n `\\nClassification\\n${getJourneyClassification(journeyData).join(', ')}`,\n 'data'\n );\n }\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage('\\nCategories/Tags', 'data');\n printMessage(\n `${JSON.parse(journeyData.tree.uiConfig.categories).join(', ')}`,\n 'data'\n );\n }\n\n // Dependency Tree\n try {\n const descendents = await getTreeDescendents(\n journeyData,\n resolveTreeExport\n );\n describeTreeDescendents(descendents);\n } catch (error) {\n errors.push(error);\n }\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `\\nNode Types (${Object.entries(nodeTypeMap).length}):`,\n 'data'\n );\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `- ${String(count)} [${\n nodeType['brightCyan']\n }] (${Node.getNodeClassification(nodeType).join(', ')})`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`\\nNodes (${Object.entries(allNodes).length}):`, 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `- ${Node.getOneLineDescription(\n nodeObj,\n getNodeRef(nodeObj, journeyData)\n )}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`\\nThemes (${journeyData.themes.length}):`, 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`- ${Theme.getOneLineDescription(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `\\nScripts (${Object.entries(journeyData.scripts).length}):`,\n 'data'\n );\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`- ${Script.getOneLineDescription(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `\\nEmail Templates (${\n Object.entries(journeyData.emailTemplates).length\n }):`,\n 'data'\n );\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(\n `- ${EmailTemplate.getOneLineDescription(templateData)}`,\n 'data'\n );\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `\\nSocial Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n }):`,\n 'data'\n );\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`- ${Idp.getOneLineDescription(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `\\nSAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n }):`,\n 'data'\n );\n for (const entityProviderData of Object.values(\n journeyData.saml2Entities\n )) {\n printMessage(\n `- ${Saml2.getOneLineDescription(entityProviderData)}`,\n 'data'\n );\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `\\nSAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n }):`,\n 'data'\n );\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(\n `- ${CirclesOfTrust.getOneLineDescription(cotData)}`,\n 'data'\n );\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error describing journey`, errors);\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Describe a journey in markdown:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function describeJourneyMd(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n) {\n const errors: Error[] = [];\n try {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(\n `# ${getOneLineDescriptionMd(journeyData.tree)} - ${\n journeyData.tree.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n }, ${getJourneyClassificationMd(journeyData).join(', ')}`,\n 'data'\n );\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage(\n `\\`${JSON.parse(journeyData.tree.uiConfig.categories).join('`, `')}\\``,\n 'data'\n );\n }\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Journey image\n printMessage(`\\n[]()\\n`, 'data');\n\n // Dependency Tree\n const descendents = await getTreeDescendents(\n journeyData,\n resolveTreeExport\n );\n printMessage(describeTreeDescendentsMd(descendents), 'data');\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `## Node Types (${Object.entries(nodeTypeMap).length})`,\n 'data'\n );\n printMessage('| Count | Type | Classification |', 'data');\n printMessage('| -----:| ---- | -------------- |', 'data');\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `| ${String(count)} | ${nodeType} | ${Node.getNodeClassificationMd(\n nodeType\n ).join('<br>')} |`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`## Nodes (${Object.entries(allNodes).length})`, 'data');\n printMessage(Node.getTableHeaderMd(), 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `${Node.getTableRowMd(nodeObj, getNodeRef(nodeObj, journeyData))}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`## Themes (${journeyData.themes.length})`, 'data');\n printMessage(Theme.getTableHeaderMd(), 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`${Theme.getTableRowMd(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `## Scripts (${Object.entries(journeyData.scripts).length})`,\n 'data'\n );\n printMessage(Script.getTableHeaderMd(), 'data');\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`${Script.getTableRowMd(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `## Email Templates (${\n Object.entries(journeyData.emailTemplates).length\n })`,\n 'data'\n );\n printMessage(EmailTemplate.getTableHeaderMd(), 'data');\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(`${EmailTemplate.getTableRowMd(templateData)}`, 'data');\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `## Social Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n })`,\n 'data'\n );\n printMessage(Idp.getTableHeaderMd(), 'data');\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`${Idp.getTableRowMd(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `## SAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n })`,\n 'data'\n );\n printMessage(Saml2.getTableHeaderMd(), 'data');\n for (const entityProviderData of Object.values(\n journeyData.saml2Entities\n )) {\n printMessage(`${Saml2.getTableRowMd(entityProviderData)}`, 'data');\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `## SAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n })`,\n 'data'\n );\n printMessage(CirclesOfTrust.getTableHeaderMd(), 'data');\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(`${CirclesOfTrust.getTableRowMd(cotData)}`, 'data');\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error describing journey`, errors);\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Enable a journey\n * @param {string} journeyId id/name of journey\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function enableJourney(journeyId: string): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Enabling journey ${journeyId}...`\n );\n try {\n await _enableJourney(journeyId);\n stopProgressIndicator(\n indicatorId,\n `Enabled journey ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error enabling journey ${journeyId}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Disable a journey\n * @param {string} journeyId id/name of journey\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function disableJourney(journeyId: string): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Disabling journey ${journeyId}...`\n );\n try {\n await _disableJourney(journeyId);\n stopProgressIndicator(\n indicatorId,\n `Disabled journey ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error disabling journey ${journeyId}`,\n 'fail'\n );\n }\n return false;\n}\n\n/**\n * Delete a journey\n * @param {string} journeyId id/name of journey\n * @param {{ deep: boolean; verbose: boolean }} [options] delete journey options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function deleteJourney(\n journeyId: string,\n options: { deep: boolean; verbose: boolean; progress?: boolean } = {\n deep: true,\n verbose: false,\n progress: true,\n }\n): Promise<boolean> {\n try {\n await _deleteJourney(journeyId, options);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete all journeys\n * @param {{ deep: boolean; verbose: boolean }} [options] delete journey options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function deleteJourneys(\n options: { deep: boolean; verbose: boolean } = {\n deep: true,\n verbose: false,\n }\n): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n null,\n `Deleting journeys...`\n );\n try {\n const status: DeleteJourneysStatus = await _deleteJourneys(options);\n stopProgressIndicator(\n indicatorId,\n `Deleted ${Object.keys(status).length} journeys`\n );\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error deleting journeys`);\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAahE,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AACrD,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,GAAG,MAAM,UAAU;AAC/B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGxB,KAAK,CAACyB,KAAK;AACf,MAAM;EACJC,YAAY;EACZC,aAAa;EACbC,cAAc;EACdC,mBAAmB;EACnBC,cAAc;EACdC,aAAa;EACbC,kBAAkB;EAClBC,UAAU;EACVC,wBA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BmF,WAAW,EACV,WAAUJ,MAAM,CAACgB,IAAI,CAAC6E,MAAM,CAAC,CAAC5E,MAAO,WACxC,CAAC;IACD,OAAO,IAAI;EACb,CAAC,CAAC,OAAO/B,KAAK,EAAE;IACdjE,qBAAqB,CAACmF,WAAW,EAAG,yBAAwB,CAAC;IAC7DrF,UAAU,CAACmE,KAAK,CAAC;EACnB;EACA,OAAO,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"JourneyOps.js","names":["frodo","FrodoError","state","fs","createProgressIndicator","createTable","debugMessage","printError","printMessage","stopProgressIndicator","updateProgressIndicator","CirclesOfTrust","EmailTemplate","Idp","Node","Saml2","Script","Theme","cloneDeep","wordwrap","getTypedFilename","saveJsonToFile","getRealmString","getFilePath","getWorkingDirectory","utils","readJourneys","exportJourney","exportJourneys","resolveDependencies","importJourneys","importJourney","getTreeDescendents","getNodeRef","onlineTreeExportResolver","getJourneyClassification","_getJourneyClassification","disableJourney","_disableJourney","enableJourney","_enableJourney","deleteJourney","_deleteJourney","deleteJourneys","_deleteJourneys","authn","journey","listJourneys","long","analyze","journeys","journeyStub","table","_journeyStub$uiConfig","push","_id","enabled","uiConfig","categories","JSON","parse","join","toString","spinnerId","exportPromises","useStringArrays","deps","coords","journeyExports","Promise","all","journeyExport","_journeyExport$tree$u","tree","error","exportJourneyToFile","journeyId","file","includeMeta","options","verbose","getVerbose","filePath","fileData","exportJourneysToFile","exportJourneysToFiles","journeysExport","trees","Object","entries","treeId","treeValue","indicatorId","meta","importJourneyFromFile","data","readFileSync","journeyData","installedJourneys","map","x","unresolvedJourneys","resolvedJourneys","indicatorId1","keys","length","indicatorId2","importError","indicatorId3","importFirstJourneyFromFile","hasOwnProperty","call","depSpinnerId","importSpinnerId","importJourneysFromFile","importJourneysFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","allJourneysData","it","getJourneyClassificationMd","getOneLineDescription","treeObj","description","getOneLineDescriptionMd","describeTreeDescendents","descendents","depth","values","indent","Array","fill","descendent","describeTreeDescendentsMd","markdown","describeJourney","resolveTreeExport","errors","_journeyData$meta","_journeyData$tree$uiC","_journeyData$themes","allNodes","nodes","innerNodes","nodeTypeMap","nodeData","_type","getAmVersion","originAmVersion","setAmVersion","nodeType","count","String","getNodeClassification","nodeObj","themes","themeData","scripts","scriptData","emailTemplates","templateData","socialIdentityProviders","socialIdpData","saml2Entities","entityProviderData","circlesOfTrust","cotData","describeJourneyMd","_journeyData$meta2","_journeyData$tree$uiC2","_journeyData$themes2","getNodeClassificationMd","getTableHeaderMd","getTableRowMd","deep","progress","status"],"sources":["../../src/ops/JourneyOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport { type NodeSkeleton } from '@rockcarver/frodo-lib/types/api/NodeApi';\nimport { type TreeSkeleton } from '@rockcarver/frodo-lib/types/api/TreeApi';\nimport {\n DeleteJourneysStatus,\n type JourneyClassificationType,\n type MultiTreeExportInterface,\n type SingleTreeExportInterface,\n type TreeDependencyMapInterface,\n type TreeExportOptions,\n type TreeExportResolverInterface,\n type TreeImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/JourneyOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n printError,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport * as CirclesOfTrust from './CirclesOfTrustOps';\nimport * as EmailTemplate from './EmailTemplateOps';\nimport * as Idp from './IdpOps';\nimport * as Node from './NodeOps';\nimport * as Saml2 from './Saml2Ops';\nimport * as Script from './ScriptOps';\nimport * as Theme from './ThemeOps';\nimport { cloneDeep } from './utils/OpsUtils';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n saveJsonToFile,\n getRealmString,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readJourneys,\n exportJourney,\n exportJourneys,\n resolveDependencies,\n importJourneys,\n importJourney,\n getTreeDescendents,\n getNodeRef,\n onlineTreeExportResolver,\n getJourneyClassification: _getJourneyClassification,\n disableJourney: _disableJourney,\n enableJourney: _enableJourney,\n deleteJourney: _deleteJourney,\n deleteJourneys: _deleteJourneys,\n} = frodo.authn.journey;\n\n/**\n * List all the journeys/trees\n * @param {boolean} long Long version, all the fields\n * @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function listJourneys(\n long: boolean = false,\n analyze: boolean = false\n): Promise<boolean> {\n let journeys = [];\n try {\n journeys = await readJourneys();\n if (!long && !analyze) {\n for (const journeyStub of journeys) {\n printMessage(`${journeyStub['_id']}`, 'data');\n }\n return true;\n } else {\n if (!analyze) {\n const table = createTable(['Name', 'Status', 'Tags']);\n for (const journeyStub of journeys) {\n table.push([\n `${journeyStub._id}`,\n journeyStub.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n journeyStub.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyStub.uiConfig.categories).join(', '),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n return true;\n } else {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Retrieving details of all journeys...`\n );\n const exportPromises = [];\n try {\n for (const journeyStub of journeys) {\n exportPromises.push(\n exportJourney(journeyStub['_id'], {\n useStringArrays: false,\n deps: false,\n coords: true,\n })\n );\n }\n const journeyExports = await Promise.all(exportPromises);\n stopProgressIndicator(\n spinnerId,\n 'Retrieved details of all journeys.',\n 'success'\n );\n const table = createTable([\n 'Name',\n 'Status',\n 'Classification',\n 'Tags',\n ]);\n for (const journeyExport of journeyExports) {\n table.push([\n `${journeyExport.tree._id}`,\n journeyExport.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n getJourneyClassification(journeyExport).join(', '),\n journeyExport.tree.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyExport.tree.uiConfig.categories).join(\n ', '\n ),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n 'Error retrieving details of all journeys.',\n 'fail'\n );\n printError(error);\n }\n }\n }\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Export journey by id/name to file\n * @param {string} journeyId journey id/name\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {TreeExportOptions} options export options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportJourneyToFile(\n journeyId: string,\n file: string,\n includeMeta: boolean = true,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n coords: true,\n }\n): Promise<boolean> {\n debugMessage(`exportJourneyToFile: start`);\n const verbose = state.getVerbose();\n if (!file) {\n file = getTypedFilename(journeyId, 'journey');\n }\n const filePath = getFilePath(file, true);\n let spinnerId: string;\n if (!verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n try {\n const fileData: SingleTreeExportInterface = await exportJourney(\n journeyId,\n options\n );\n if (verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n saveJsonToFile(fileData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported ${journeyId['brightCyan']} to ${filePath['brightCyan']}.`,\n 'success'\n );\n return true;\n } catch (error) {\n if (verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n stopProgressIndicator(\n spinnerId,\n `Error exporting journey ${journeyId}: ${error}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all journeys to file\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {TreeExportOptions} options export options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportJourneysToFile(\n file: string,\n includeMeta: boolean = true,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n coords: true,\n }\n): Promise<boolean> {\n try {\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Journeys`, 'journey');\n }\n const filePath = getFilePath(file, true);\n const fileData: MultiTreeExportInterface = await exportJourneys(options);\n saveJsonToFile(fileData, filePath, includeMeta);\n return true;\n } catch (error) {\n printError(error);\n }\n}\n\n/**\n * Export all journeys to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {TreeExportOptions} options export options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportJourneysToFiles(\n includeMeta: boolean = true,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n coords: true,\n }\n): Promise<boolean> {\n try {\n const journeysExport = await exportJourneys(options);\n const trees = Object.entries(journeysExport.trees);\n for (const [treeId, treeValue] of trees) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Saving ${treeId}...`\n );\n const file = getFilePath(getTypedFilename(`${treeId}`, 'journey'), true);\n treeValue['meta'] = journeysExport.meta;\n try {\n updateProgressIndicator(indicatorId, `Saving ${treeId} to ${file}`);\n saveJsonToFile(treeValue, file, includeMeta);\n stopProgressIndicator(indicatorId, `${treeId} saved to ${file}`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error saving ${treeId} to ${file}`);\n }\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import a journey from file\n * @param {string} journeyId journey id/name\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importJourneyFromFile(\n journeyId: string,\n file: string,\n options: TreeImportOptions\n): Promise<boolean> {\n const verbose = state.getVerbose();\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n let journeyData = JSON.parse(data);\n // check if this is a file with multiple trees and get journey by id\n if (journeyData.trees && journeyData.trees[journeyId]) {\n journeyData = journeyData.trees[journeyId];\n } else if (journeyData.trees) {\n journeyData = null;\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId === journeyData.tree._id) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n const indicatorId1 = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Resolving dependencies'\n );\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n stopProgressIndicator(\n indicatorId1,\n `Resolved all dependencies.`,\n 'success'\n );\n\n let indicatorId2: string;\n if (!verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n try {\n await importJourney(journeyData, options);\n if (verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n indicatorId2,\n `Imported ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (importError) {\n if (verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(indicatorId2, `${importError}`, 'fail');\n }\n } else {\n stopProgressIndicator(indicatorId1, `Unresolved dependencies:`, 'fail');\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n // end dependency resolution for single tree import\n } else {\n const indicatorId3 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(indicatorId3, `${journeyId} not found!`, 'fail');\n }\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import first journey from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importFirstJourneyFromFile(\n file: string,\n options: TreeImportOptions\n): Promise<boolean> {\n const verbose = state.getVerbose();\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n let journeyData = cloneDeep(JSON.parse(data));\n let journeyId = null;\n // single tree\n if (journeyData.tree) {\n journeyId = cloneDeep(journeyData.tree._id);\n }\n // multiple trees, so get the first tree\n else if (journeyData.trees) {\n for (const treeId in journeyData.trees) {\n if (Object.hasOwnProperty.call(journeyData.trees, treeId)) {\n journeyId = treeId;\n journeyData = journeyData.trees[treeId];\n break;\n }\n }\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n const depSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Resolving dependencies'\n );\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n stopProgressIndicator(\n depSpinnerId,\n `Resolved all dependencies.`,\n 'success'\n );\n\n let importSpinnerId: string;\n if (!verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n try {\n await importJourney(journeyData, options);\n if (verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n importSpinnerId,\n `Imported ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (importError) {\n if (verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n importSpinnerId,\n `Error importing ${journeyId}`,\n 'fail'\n );\n printError(importError);\n }\n } else {\n stopProgressIndicator(depSpinnerId, `Unresolved dependencies:`, 'fail');\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n } else {\n const importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing...`\n );\n stopProgressIndicator(importSpinnerId, `No journeys found!`, 'fail');\n }\n // end dependency resolution for single tree import\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import all journeys from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importJourneysFromFile(\n file: string,\n options: TreeImportOptions\n): Promise<boolean> {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importJourneys(fileData, options);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import all journeys from separate files\n * @param {TreeImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importJourneysFromFiles(\n options: TreeImportOptions\n): Promise<boolean> {\n try {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.journey.json'))\n .map((name) => getFilePath(name));\n const allJourneysData = { trees: {} };\n for (const file of jsonFiles) {\n const journeyData = JSON.parse(fs.readFileSync(file, 'utf8'));\n allJourneysData.trees[journeyData.tree._id] = journeyData;\n }\n await importJourneys(allJourneysData as MultiTreeExportInterface, options);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Get journey classification\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassification(\n journey: SingleTreeExportInterface\n): JourneyClassificationType[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return it['brightGreen'];\n\n case 'cloud':\n return it['brightMagenta'];\n\n case 'custom':\n return it['brightRed'];\n\n case 'premium':\n return it['brightYellow'];\n }\n });\n}\n\n/**\n * Get journey classification in markdown\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassificationMd(\n journey: SingleTreeExportInterface\n): string[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return `:green_circle: \\`${it}\\``;\n\n case 'cloud':\n return `:purple_circle: \\`${it}\\``;\n\n case 'custom':\n return `:red_circle: \\`${it}\\``;\n\n case 'premium':\n return `:yellow_circle: \\`${it}\\``;\n }\n });\n}\n\n/**\n * Get a one-line description of the tree object\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(treeObj: TreeSkeleton): string {\n const description = `[${treeObj._id['brightCyan']}]`;\n return description;\n}\n\n/**\n * Get a one-line description of the tree object in markdown\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescriptionMd(treeObj: TreeSkeleton): string {\n const description = `${treeObj._id}`;\n return description;\n}\n\n/**\n * Helper function to render a nested list of dependent trees\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendents(\n descendents: TreeDependencyMapInterface,\n depth = 0\n) {\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n printMessage(\n `\\nInner Tree Dependencies (${Object.values(descendents)[0].length}):`,\n 'data'\n );\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n printMessage(`${indent}- ${tree['brightCyan']}`, 'data');\n for (const descendent of descendents[tree]) {\n describeTreeDescendents(descendent, depth + 1);\n }\n }\n}\n\n/**\n * Helper function to render a nested list of dependent trees in markdown\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendentsMd(\n descendents: TreeDependencyMapInterface,\n depth = 0\n): string {\n let markdown = '';\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n markdown += `## Inner Tree Dependencies (${\n Object.values(descendents)[0].length\n })\\n`;\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n markdown += `${indent}- ${tree}\\n`;\n for (const descendent of descendents[tree]) {\n markdown += describeTreeDescendentsMd(descendent, depth + 1);\n }\n return markdown;\n }\n return markdown;\n}\n\n/**\n * Describe a journey:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function describeJourney(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n): Promise<boolean> {\n const errors: Error[] = [];\n try {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(`${getOneLineDescription(journeyData.tree)}`, 'data');\n printMessage(\n Array(`[${journeyData.tree._id}]`['length']).fill('=').join('')\n );\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Status\n printMessage(\n `\\nStatus\\n${\n journeyData.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen']\n }`\n );\n\n // Classification\n if (state.getAmVersion()) {\n printMessage(\n `\\nClassification\\n${getJourneyClassification(journeyData).join(', ')}`,\n 'data'\n );\n }\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage('\\nCategories/Tags', 'data');\n printMessage(\n `${JSON.parse(journeyData.tree.uiConfig.categories).join(', ')}`,\n 'data'\n );\n }\n\n // Dependency Tree\n try {\n const descendents = await getTreeDescendents(\n journeyData,\n resolveTreeExport\n );\n describeTreeDescendents(descendents);\n } catch (error) {\n errors.push(error);\n }\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `\\nNode Types (${Object.entries(nodeTypeMap).length}):`,\n 'data'\n );\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `- ${String(count)} [${\n nodeType['brightCyan']\n }] (${Node.getNodeClassification(nodeType).join(', ')})`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`\\nNodes (${Object.entries(allNodes).length}):`, 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `- ${Node.getOneLineDescription(\n nodeObj,\n getNodeRef(nodeObj, journeyData)\n )}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`\\nThemes (${journeyData.themes.length}):`, 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`- ${Theme.getOneLineDescription(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `\\nScripts (${Object.entries(journeyData.scripts).length}):`,\n 'data'\n );\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`- ${Script.getOneLineDescription(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `\\nEmail Templates (${\n Object.entries(journeyData.emailTemplates).length\n }):`,\n 'data'\n );\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(\n `- ${EmailTemplate.getOneLineDescription(templateData)}`,\n 'data'\n );\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `\\nSocial Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n }):`,\n 'data'\n );\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`- ${Idp.getOneLineDescription(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `\\nSAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n }):`,\n 'data'\n );\n for (const entityProviderData of Object.values(\n journeyData.saml2Entities\n )) {\n printMessage(\n `- ${Saml2.getOneLineDescription(entityProviderData)}`,\n 'data'\n );\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `\\nSAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n }):`,\n 'data'\n );\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(\n `- ${CirclesOfTrust.getOneLineDescription(cotData)}`,\n 'data'\n );\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error describing journey`, errors);\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Describe a journey in markdown:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function describeJourneyMd(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n) {\n const errors: Error[] = [];\n try {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(\n `# ${getOneLineDescriptionMd(journeyData.tree)} - ${\n journeyData.tree.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n }, ${getJourneyClassificationMd(journeyData).join(', ')}`,\n 'data'\n );\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage(\n `\\`${JSON.parse(journeyData.tree.uiConfig.categories).join('`, `')}\\``,\n 'data'\n );\n }\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Journey image\n printMessage(`\\n[]()\\n`, 'data');\n\n // Dependency Tree\n const descendents = await getTreeDescendents(\n journeyData,\n resolveTreeExport\n );\n printMessage(describeTreeDescendentsMd(descendents), 'data');\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `## Node Types (${Object.entries(nodeTypeMap).length})`,\n 'data'\n );\n printMessage('| Count | Type | Classification |', 'data');\n printMessage('| -----:| ---- | -------------- |', 'data');\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `| ${String(count)} | ${nodeType} | ${Node.getNodeClassificationMd(\n nodeType\n ).join('<br>')} |`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`## Nodes (${Object.entries(allNodes).length})`, 'data');\n printMessage(Node.getTableHeaderMd(), 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `${Node.getTableRowMd(nodeObj, getNodeRef(nodeObj, journeyData))}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`## Themes (${journeyData.themes.length})`, 'data');\n printMessage(Theme.getTableHeaderMd(), 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`${Theme.getTableRowMd(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `## Scripts (${Object.entries(journeyData.scripts).length})`,\n 'data'\n );\n printMessage(Script.getTableHeaderMd(), 'data');\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`${Script.getTableRowMd(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `## Email Templates (${\n Object.entries(journeyData.emailTemplates).length\n })`,\n 'data'\n );\n printMessage(EmailTemplate.getTableHeaderMd(), 'data');\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(`${EmailTemplate.getTableRowMd(templateData)}`, 'data');\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `## Social Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n })`,\n 'data'\n );\n printMessage(Idp.getTableHeaderMd(), 'data');\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`${Idp.getTableRowMd(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `## SAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n })`,\n 'data'\n );\n printMessage(Saml2.getTableHeaderMd(), 'data');\n for (const entityProviderData of Object.values(\n journeyData.saml2Entities\n )) {\n printMessage(`${Saml2.getTableRowMd(entityProviderData)}`, 'data');\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `## SAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n })`,\n 'data'\n );\n printMessage(CirclesOfTrust.getTableHeaderMd(), 'data');\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(`${CirclesOfTrust.getTableRowMd(cotData)}`, 'data');\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error describing journey`, errors);\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Enable a journey\n * @param {string} journeyId id/name of journey\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function enableJourney(journeyId: string): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Enabling journey ${journeyId}...`\n );\n try {\n await _enableJourney(journeyId);\n stopProgressIndicator(\n indicatorId,\n `Enabled journey ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error enabling journey ${journeyId}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Disable a journey\n * @param {string} journeyId id/name of journey\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function disableJourney(journeyId: string): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Disabling journey ${journeyId}...`\n );\n try {\n await _disableJourney(journeyId);\n stopProgressIndicator(\n indicatorId,\n `Disabled journey ${journeyId}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error disabling journey ${journeyId}`,\n 'fail'\n );\n }\n return false;\n}\n\n/**\n * Delete a journey\n * @param {string} journeyId id/name of journey\n * @param {{ deep: boolean; verbose: boolean }} [options] delete journey options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function deleteJourney(\n journeyId: string,\n options: { deep: boolean; verbose: boolean; progress?: boolean } = {\n deep: true,\n verbose: false,\n progress: true,\n }\n): Promise<boolean> {\n try {\n await _deleteJourney(journeyId, options);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete all journeys\n * @param {{ deep: boolean; verbose: boolean }} [options] delete journey options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function deleteJourneys(\n options: { deep: boolean; verbose: boolean } = {\n deep: true,\n verbose: false,\n }\n): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n null,\n `Deleting journeys...`\n );\n try {\n const status: DeleteJourneysStatus = await _deleteJourneys(options);\n stopProgressIndicator(\n indicatorId,\n `Deleted ${Object.keys(status).length} journeys`\n );\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error deleting journeys`);\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAahE,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AACrD,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,GAAG,MAAM,UAAU;AAC/B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGxB,KAAK,CAACyB,KAAK;AACf,MAAM;EACJC,YAAY;EACZC,aAAa;EACbC,cAAc;EACdC,mBAAmB;EACnBC,cAAc;EACdC,aAAa;EACbC,kBAAkB;EAClBC,UAAU;EACVC,wBAAwB;EACxBC,wBAAwB,EAAEC,yBAAyB;EACnDC,cAAc,EAAEC,eAAe;EAC/BC,aAAa,EAAEC,cAAc;EAC7BC,aAAa,EAAEC,cAAc;EAC7BC,cAAc,EAAEC;AAClB,CAAC,GAAG5C,KAAK,CAAC6C,KAAK,CAACC,OAAO;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,YAAYA,CAChCC,IAAa,GAAG,KA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ACA,OAAO,KAAK;AACd"}
|
package/esm/ops/ScriptOps.js
CHANGED
|
@@ -153,9 +153,10 @@ export async function exportScriptToFile(scriptId, file, includeMeta = true) {
|
|
|
153
153
|
* @param {string} name script name
|
|
154
154
|
* @param {string} file file name
|
|
155
155
|
* @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
|
|
156
|
+
* @param {boolean} extract Extracts the scripts from the exports into separate files if true
|
|
156
157
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
157
158
|
*/
|
|
158
|
-
export async function exportScriptByNameToFile(name, file, includeMeta = true) {
|
|
159
|
+
export async function exportScriptByNameToFile(name, file, includeMeta = true, extract = false) {
|
|
159
160
|
debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: start`);
|
|
160
161
|
try {
|
|
161
162
|
showSpinner(`Exporting script '${name}'...`);
|
|
@@ -166,6 +167,7 @@ export async function exportScriptByNameToFile(name, file, includeMeta = true) {
|
|
|
166
167
|
const filePath = getFilePath(fileName, true);
|
|
167
168
|
spinSpinner(`Exporting script '${name}' to '${filePath}'...`);
|
|
168
169
|
const scriptExport = await exportScriptByName(name);
|
|
170
|
+
if (extract) extractScriptToFile(scriptExport);
|
|
169
171
|
saveJsonToFile(scriptExport, filePath, includeMeta);
|
|
170
172
|
succeedSpinner(`Exported script '${name}' to '${filePath}'.`);
|
|
171
173
|
debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end`);
|
|
@@ -345,7 +347,8 @@ export async function importScriptsFromFiles(watch, options, validateScripts) {
|
|
|
345
347
|
|
|
346
348
|
// We watch json files and script files.
|
|
347
349
|
const watcher = chokidar.watch([`${getWorkingDirectory()}/**/*.script.json`, `${getWorkingDirectory()}/**/*.script.js`, `${getWorkingDirectory()}/**/*.script.groovy`], {
|
|
348
|
-
persistent: watch
|
|
350
|
+
persistent: watch,
|
|
351
|
+
ignoreInitial: watch
|
|
349
352
|
});
|
|
350
353
|
watcher.on('add', onChange).on('change', onChange).on('error', error => {
|
|
351
354
|
printError(error, `Watcher error`);
|
package/esm/ops/ScriptOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptOps.js","names":["frodo","FrodoError","state","chokidar","fs","getFullExportConfig","isIdUsed","createProgressIndicator","createTable","debugMessage","failSpinner","printError","printMessage","showSpinner","spinSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","wordwrap","getTypedFilename","isValidUrl","saveJsonToFile","saveTextToFile","titleCase","isBase64Encoded","getFilePath","getWorkingDirectory","utils","readScripts","exportScript","exportScriptByName","exportScripts","importScripts","deleteScript","deleteScriptByName","deleteScripts","script","getOneLineDescription","scriptObj","description","_id","context","name","getTableHeaderMd","markdown","getTableRowMd","langMap","JAVASCRIPT","GROOVY","language","split","join","listScripts","long","usage","file","spinnerId","scripts","sort","a","b","localeCompare","length","error","forEach","fullExport","headers","push","table","values","isScriptUsed","used","location","toString","exportScriptToFile","scriptId","includeMeta","fileName","filePath","scriptExport","exportScriptByNameToFile","message","exportScriptsToFile","includeDefault","getRealm","exportScriptsToFiles","extract","errors","barId","scriptList","filter","default","fileBarId","extractScriptToFile","directory","scriptSkeleton","getScriptSkeleton","fileExtension","scriptFileName","scriptFilePath","scriptText","Array","isArray","isScriptExtracted","importData","extracted","Object","keys","importScriptsFromFile","options","reUuid","data","readFileSync","JSON","parse","handleScriptFileImport","importScriptsFromFiles","watch","validateScripts","onChange","path","_stats","watcher","persistent","on","close","scriptFile","getScriptFile","getScriptExportByScriptFile","imported","endsWith","replace","getScriptExport","extractFile","getExtractFile","scriptRaw","startsWith","scriptExportRaw","getScriptId","scriptIds","Error","deleteScriptId","id","undefined","deleteScriptName","deleteAllScripts"],"sources":["../../src/ops/ScriptOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport { type ScriptSkeleton } from '@rockcarver/frodo-lib/types/api/ScriptApi';\nimport {\n type ScriptExportInterface,\n type ScriptImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ScriptOps';\nimport chokidar from 'chokidar';\nimport fs from 'fs';\n\nimport { getFullExportConfig, isIdUsed } from '../utils/Config';\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printError,\n printMessage,\n showSpinner,\n spinSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n isValidUrl,\n saveJsonToFile,\n saveTextToFile,\n titleCase,\n isBase64Encoded,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readScripts,\n exportScript,\n exportScriptByName,\n exportScripts,\n importScripts,\n deleteScript,\n deleteScriptByName,\n deleteScripts,\n} = frodo.script;\n\n/**\n * Get a one-line description of the script object\n * @param {ScriptSkeleton} scriptObj script object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(scriptObj: ScriptSkeleton): string {\n const description = `[${scriptObj._id['brightCyan']}] ${scriptObj.context} - ${scriptObj.name}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Language | Type | Id |\\n';\n markdown += '| ---- | -------- | ---- | ---|';\n return markdown;\n}\n\n/**\n * Get a one-line description of the script object in markdown\n * @param {TypesRaw.ScriptSkeleton} scriptObj script object to describe\n * @returns {string} markdown table row\n */\nexport function getTableRowMd(scriptObj: ScriptSkeleton): string {\n const langMap = { JAVASCRIPT: 'JavaSscript', GROOVY: 'Groovy' };\n const description = `| ${scriptObj.name} | ${\n langMap[scriptObj.language]\n } | ${titleCase(scriptObj.context.split('_').join(' '))} | \\`${\n scriptObj._id\n }\\` |`;\n return description;\n}\n\n/**\n * List scripts\n * @param {boolean} long detail list\n * @param {boolean} usage display usage field\n * @param {String | null} file Optional filename to determine usage\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listScripts(\n long: boolean = false,\n usage: boolean = false,\n file: string | null = null\n): Promise<boolean> {\n let spinnerId: string;\n let scripts: ScriptSkeleton[] = [];\n debugMessage(`Cli.ScriptOps.listScripts: start`);\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading scripts...`\n );\n scripts = await readScripts();\n scripts.sort((a, b) => a.name.localeCompare(b.name));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${scripts.length} scripts.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error reading scripts`, 'fail');\n printError(error);\n return false;\n }\n if (!long && !usage) {\n scripts.forEach((script) => {\n printMessage(`${script.name}`, 'data');\n });\n debugMessage(`Cli.ScriptOps.listScripts: end`);\n return true;\n }\n let fullExport = null;\n const headers = long\n ? ['Name', 'UUID', 'Language', 'Context', 'Description']\n : ['Name'];\n if (usage) {\n try {\n fullExport = await getFullExportConfig(file);\n } catch (error) {\n printError(error);\n return false;\n }\n //Delete scripts from full export so they aren't mistakenly used for determining usage\n delete fullExport.script;\n headers.push('Used');\n }\n const table = createTable(headers);\n const langMap = { JAVASCRIPT: 'JS', GROOVY: 'Groovy' };\n scripts.forEach((script) => {\n const values = long\n ? [\n wordwrap(script.name, 25, ' '),\n script._id,\n langMap[script.language],\n wordwrap(titleCase(script.context.split('_').join(' ')), 25),\n wordwrap(script.description, 30),\n ]\n : [wordwrap(script.name, 25, ' ')];\n if (usage) {\n const isScriptUsed = isIdUsed(fullExport, script._id, false);\n values.push(\n isScriptUsed.used\n ? `${'yes'['brightGreen']} (at ${isScriptUsed.location})`\n : 'no'['brightRed']\n );\n }\n table.push(values);\n });\n printMessage(table.toString(), 'data');\n debugMessage(`Cli.ScriptOps.listScripts: end`);\n return true;\n}\n\n/**\n * Export script by id to file\n * @param {string} scriptId script uuid\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptToFile(\n scriptId: string,\n file: string,\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptToFile: start`);\n try {\n showSpinner(`Exporting script '${scriptId}'...`);\n let fileName = getTypedFilename(scriptId, 'script');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n spinSpinner(`Exporting script '${scriptId}' to '${filePath}'...`);\n const scriptExport = await exportScript(scriptId);\n saveJsonToFile(scriptExport, filePath, includeMeta);\n succeedSpinner(`Exported script '${scriptId}' to '${filePath}'.`);\n debugMessage(`Cli.ScriptOps.exportScriptToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting script '${scriptId}'`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export script by name to file\n * @param {string} name script name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptByNameToFile(\n name: string,\n file: string,\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: start`);\n try {\n showSpinner(`Exporting script '${name}'...`);\n let fileName = getTypedFilename(name, 'script');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n spinSpinner(`Exporting script '${name}' to '${filePath}'...`);\n const scriptExport = await exportScriptByName(name);\n saveJsonToFile(scriptExport, filePath, includeMeta);\n succeedSpinner(`Exported script '${name}' to '${filePath}'.`);\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting script '${name}': ${error.message}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all scripts to single file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {boolean} includeDefault true to include default scripts in export, false otherwise. Default: false\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptsToFile(\n file: string,\n includeMeta: boolean = true,\n includeDefault: boolean = false\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: start`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(state.getRealm())}Scripts`,\n 'script'\n );\n if (file) {\n fileName = file;\n }\n const scriptExport = await exportScripts(includeDefault);\n saveJsonToFile(scriptExport, getFilePath(fileName, true), includeMeta);\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: end`);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all scripts to individual files\n * @param {boolean} extract Extracts the scripts from the exports into separate files if true\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {boolean} includeDefault true to include default scripts in export, false otherwise. Default: false\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptsToFiles(\n extract: boolean = false,\n includeMeta: boolean = true,\n includeDefault: boolean = false\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptsToFiles: start`);\n const errors: Error[] = [];\n let barId: string;\n try {\n let scriptList = await readScripts();\n if (!includeDefault)\n scriptList = scriptList.filter((script) => !script.default);\n barId = createProgressIndicator(\n 'determinate',\n scriptList.length,\n 'Exporting scripts to individual files...'\n );\n for (const script of scriptList) {\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting script ${script.name}...`\n );\n const file = getFilePath(getTypedFilename(script.name, 'script'), true);\n try {\n const scriptExport = await exportScriptByName(script.name);\n if (extract) extractScriptToFile(scriptExport);\n saveJsonToFile(scriptExport, file, includeMeta);\n updateProgressIndicator(fileBarId, `Saving ${script.name} to ${file}.`);\n stopProgressIndicator(fileBarId, `${script.name} saved to ${file}.`);\n } catch (error) {\n stopProgressIndicator(\n fileBarId,\n `Error exporting ${script.name}`,\n 'fail'\n );\n errors.push(error);\n }\n updateProgressIndicator(barId, `Exported script ${script.name}`);\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error exporting scripts`, errors);\n }\n stopProgressIndicator(\n barId,\n `Exported ${scriptList.length} scripts to individual files.`\n );\n debugMessage(`Cli.ScriptOps.exportScriptsToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(barId, `Error exporting scripts`);\n printError(error);\n }\n}\n\n/**\n * Extracts a script from a script export into a separate file.\n * @param {ScriptExportInterface} scriptExport The script export\n * @param {string} scriptId The script id (optional if there is only one script in the export)\n * @param {string} directory The directory within the base directory to save the script file\n * @returns {boolean} true if successful, false otherwise\n */\nexport function extractScriptToFile(\n scriptExport: ScriptExportInterface,\n scriptId?: string,\n directory?: string\n): boolean {\n try {\n const scriptSkeleton = scriptId\n ? scriptExport.script[scriptId]\n : getScriptSkeleton(scriptExport);\n const fileExtension =\n scriptSkeleton.language === 'JAVASCRIPT' ? 'js' : 'groovy';\n const scriptFileName = getTypedFilename(\n scriptSkeleton.name,\n 'script',\n fileExtension\n );\n const scriptFilePath = getFilePath(\n (directory ? `${directory}/` : '') + scriptFileName,\n true\n );\n const scriptText = Array.isArray(scriptSkeleton.script)\n ? scriptSkeleton.script.join('\\n')\n : scriptSkeleton.script;\n scriptSkeleton.script = `file://${scriptFilePath}`;\n saveTextToFile(scriptText, scriptFilePath);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\nfunction isScriptExtracted(importData: ScriptExportInterface): boolean {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: start`);\n let extracted = true;\n for (const scriptId of Object.keys(importData.script)) {\n const script = importData.script[scriptId].script;\n if (Array.isArray(script)) {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: script is string array`);\n extracted = false;\n break;\n }\n if (isValidUrl(script as string)) {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: script is extracted`);\n extracted = true;\n break;\n }\n if (isBase64Encoded) {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: script is base64-encoded`);\n extracted = false;\n break;\n }\n break;\n }\n debugMessage(`Cli.ScriptOps.isScriptExtracted: end [extracted=${extracted}]`);\n return extracted;\n}\n\n/**\n * Import script(s) from file\n * @param {string} name Optional name of script. If supplied, only the script of that name is imported\n * @param {string} file file name\n * @param {ScriptImportOptions} options Script import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importScriptsFromFile(\n name: string,\n file: string,\n options: ScriptImportOptions = {\n reUuid: false,\n includeDefault: false,\n }\n): Promise<boolean> {\n const filePath = getFilePath(file);\n debugMessage(`Cli.ScriptOps.importScriptsFromFile: start`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const importData: ScriptExportInterface = JSON.parse(data);\n if (isScriptExtracted(importData)) {\n await handleScriptFileImport(filePath, options, false);\n } else {\n await importScripts(name, importData, options);\n }\n debugMessage(`Cli.ScriptOps.importScriptsFromFile: end`);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import extracted scripts.\n *\n * @param {boolean} watch whether or not to watch for file changes\n * @param {ScriptImportOptions} options Script import options\n * @param {boolean} validateScripts If true, validates Javascript scripts to ensure no errors exist in them. Default: false\n */\nexport async function importScriptsFromFiles(\n watch: boolean,\n options: ScriptImportOptions,\n validateScripts: boolean\n): Promise<void> {\n // If watch is true, it doesn't make sense to reUuid.\n options.reUuid = watch ? false : options.reUuid;\n\n /**\n * Run on file change detection, as well as on initial run.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async function onChange(path: string, _stats?: fs.Stats): Promise<void> {\n try {\n await handleScriptFileImport(path, options, validateScripts);\n } catch (error) {\n printError(error, `${path}`);\n }\n }\n\n // We watch json files and script files.\n const watcher = chokidar.watch(\n [\n `${getWorkingDirectory()}/**/*.script.json`,\n `${getWorkingDirectory()}/**/*.script.js`,\n `${getWorkingDirectory()}/**/*.script.groovy`,\n ],\n {\n persistent: watch,\n }\n );\n\n watcher\n .on('add', onChange)\n .on('change', onChange)\n .on('error', (error) => {\n printError(error, `Watcher error`);\n watcher.close();\n })\n .on('ready', () => {\n if (watch) {\n printMessage('Watching for changes...');\n } else {\n watcher.close();\n printMessage('Done.');\n }\n });\n}\n\n/**\n * Handle a script file import.\n *\n * @param {string} file Either a script file or an extract file\n * @param {ScriptImportOptions} options Script import options\n * @param {boolean} validateScripts If true, validates Javascript scripts to ensure no errors exist in them. Default: false\n */\nasync function handleScriptFileImport(\n file: string,\n options: ScriptImportOptions,\n validateScripts: boolean\n) {\n debugMessage(`Cli.ScriptOps.handleScriptFileImport: start`);\n const scriptFile = getScriptFile(file);\n const script = getScriptExportByScriptFile(scriptFile);\n\n const imported = await importScripts('', script, options, validateScripts);\n if (imported) {\n printMessage(`Imported '${scriptFile}'`);\n }\n debugMessage(`Cli.ScriptOps.handleScriptFileImport: end`);\n}\n\n/**\n * Get a script file from a file.\n *\n * @param file Either a script file or an extract file\n * @returns The script file\n */\nfunction getScriptFile(file: string): string {\n if (file.endsWith('.script.json')) {\n return file;\n }\n return file.replace(/\\.script\\.(js|groovy)/, '.script.json');\n}\n\n/**\n * Get a script export from a script file.\n *\n * @param scriptFile The path to the script file\n * @returns The script export\n */\nfunction getScriptExportByScriptFile(\n scriptFile: string\n): ScriptExportInterface {\n const scriptExport = getScriptExport(scriptFile);\n const scriptSkeleton = getScriptSkeleton(scriptExport);\n\n const extractFile = getExtractFile(scriptSkeleton);\n if (!extractFile) {\n return scriptExport;\n }\n\n const scriptRaw = fs.readFileSync(extractFile, 'utf8');\n scriptSkeleton.script = scriptRaw.split('\\n');\n\n return scriptExport;\n}\n\n/**\n * Get an extract file from a script skeleton.\n *\n * @param scriptSkeleton The script skeleton\n * @returns The extract file or null if there is no extract file\n */\nfunction getExtractFile(scriptSkeleton: ScriptSkeleton): string | null {\n const extractFile = scriptSkeleton.script;\n if (Array.isArray(extractFile)) {\n return null;\n }\n if (\n extractFile.startsWith('file://') &&\n (extractFile.endsWith('.js') || extractFile.endsWith('.groovy'))\n ) {\n return extractFile.replace('file://', '');\n }\n return null;\n}\n\n/**\n * Get a script export from a file.\n *\n * @param file The path to a script export file\n * @returns The script export\n */\nfunction getScriptExport(file: string): ScriptExportInterface {\n const scriptExportRaw = fs.readFileSync(file, 'utf8');\n const scriptExport = JSON.parse(scriptExportRaw) as ScriptExportInterface;\n\n return scriptExport;\n}\n\n/**\n * Get the main script skeleton from a script export. If there is more than one\n * script, an error is thrown.\n *\n * @param script Get the main script skeleton from a script export\n * @returns The main script skeleton\n */\nfunction getScriptSkeleton(script: ScriptExportInterface): ScriptSkeleton {\n const scriptId = getScriptId(script);\n return script.script[scriptId];\n}\n\n/**\n * Get the main script ID from a script export. If there is more than one\n * script, an error is thrown.\n *\n * @param script The script export\n * @returns The main script ID\n */\nfunction getScriptId(script: ScriptExportInterface): string {\n const scriptIds = Object.keys(script.script);\n if (scriptIds.length !== 1) {\n throw new Error(`Expected 1 script, found ${scriptIds.length}`);\n }\n return scriptIds[0];\n}\n\n/**\n * Delete script by id\n * @param {String} id script id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteScriptId(id: string): Promise<boolean> {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${id}...`\n );\n try {\n await deleteScript(id);\n stopProgressIndicator(spinnerId, `Deleted ${id}.`, 'success');\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error: ${error.message}`, 'fail');\n }\n return false;\n}\n\n/**\n * Delete script by name\n * @param {String} name script name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteScriptName(name: string): Promise<boolean> {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${name}...`\n );\n try {\n await deleteScriptByName(name);\n stopProgressIndicator(spinnerId, `Deleted ${name}.`, 'success');\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error: ${error.message}`, 'fail');\n }\n return false;\n}\n\n/**\n * Delete all non-default scripts\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteAllScripts(): Promise<boolean> {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all non-default scripts...`\n );\n try {\n await deleteScripts();\n stopProgressIndicator(\n spinnerId,\n `Deleted all non-default scripts.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId,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AS,GAAGjD,uBAAuB,CACvC,eAAe,EACfwI,SAAS,EACR,YAAWrG,IAAK,KACnB,CAAC;EACD,IAAI;IACF,MAAMR,kBAAkB,CAACQ,IAAI,CAAC;IAC9B3B,qBAAqB,CAACyC,SAAS,EAAG,WAAUd,IAAK,GAAE,EAAE,SAAS,CAAC;IAC/D,OAAO,IAAI;EACb,CAAC,CAAC,OAAOqB,KAAK,EAAE;IACdhD,qBAAqB,CAACyC,SAAS,EAAG,UAASO,KAAK,CAACkB,OAAQ,EAAC,EAAE,MAAM,CAAC;EACrE;EACA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAegE,gBAAgBA,CAAA,EAAqB;EACzD,MAAMzF,SAAS,GAAGjD,uBAAuB,CACvC,eAAe,EACfwI,SAAS,EACR,qCACH,CAAC;EACD,IAAI;IACF,MAAM5G,aAAa,CAAC,CAAC;IACrBpB,qBAAqB,CACnByC,SAAS,EACR,kCAAiC,EAClC,SACF,CAAC;IACD,OAAO,IAAI;EACb,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdhD,qBAAqB,CAACyC,SAAS,EAAG,UAASO,KAAK,CAACkB,OAAQ,EAAC,EAAE,MAAM,CAAC;EACrE;EACA,OAAO,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"ScriptOps.js","names":["frodo","FrodoError","state","chokidar","fs","getFullExportConfig","isIdUsed","createProgressIndicator","createTable","debugMessage","failSpinner","printError","printMessage","showSpinner","spinSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","wordwrap","getTypedFilename","isValidUrl","saveJsonToFile","saveTextToFile","titleCase","isBase64Encoded","getFilePath","getWorkingDirectory","utils","readScripts","exportScript","exportScriptByName","exportScripts","importScripts","deleteScript","deleteScriptByName","deleteScripts","script","getOneLineDescription","scriptObj","description","_id","context","name","getTableHeaderMd","markdown","getTableRowMd","langMap","JAVASCRIPT","GROOVY","language","split","join","listScripts","long","usage","file","spinnerId","scripts","sort","a","b","localeCompare","length","error","forEach","fullExport","headers","push","table","values","isScriptUsed","used","location","toString","exportScriptToFile","scriptId","includeMeta","fileName","filePath","scriptExport","exportScriptByNameToFile","extract","extractScriptToFile","message","exportScriptsToFile","includeDefault","getRealm","exportScriptsToFiles","errors","barId","scriptList","filter","default","fileBarId","directory","scriptSkeleton","getScriptSkeleton","fileExtension","scriptFileName","scriptFilePath","scriptText","Array","isArray","isScriptExtracted","importData","extracted","Object","keys","importScriptsFromFile","options","reUuid","data","readFileSync","JSON","parse","handleScriptFileImport","importScriptsFromFiles","watch","validateScripts","onChange","path","_stats","watcher","persistent","ignoreInitial","on","close","scriptFile","getScriptFile","getScriptExportByScriptFile","imported","endsWith","replace","getScriptExport","extractFile","getExtractFile","scriptRaw","startsWith","scriptExportRaw","getScriptId","scriptIds","Error","deleteScriptId","id","undefined","deleteScriptName","deleteAllScripts"],"sources":["../../src/ops/ScriptOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport { type ScriptSkeleton } from '@rockcarver/frodo-lib/types/api/ScriptApi';\nimport {\n type ScriptExportInterface,\n type ScriptImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ScriptOps';\nimport chokidar from 'chokidar';\nimport fs from 'fs';\n\nimport { getFullExportConfig, isIdUsed } from '../utils/Config';\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printError,\n printMessage,\n showSpinner,\n spinSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n isValidUrl,\n saveJsonToFile,\n saveTextToFile,\n titleCase,\n isBase64Encoded,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readScripts,\n exportScript,\n exportScriptByName,\n exportScripts,\n importScripts,\n deleteScript,\n deleteScriptByName,\n deleteScripts,\n} = frodo.script;\n\n/**\n * Get a one-line description of the script object\n * @param {ScriptSkeleton} scriptObj script object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(scriptObj: ScriptSkeleton): string {\n const description = `[${scriptObj._id['brightCyan']}] ${scriptObj.context} - ${scriptObj.name}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Language | Type | Id |\\n';\n markdown += '| ---- | -------- | ---- | ---|';\n return markdown;\n}\n\n/**\n * Get a one-line description of the script object in markdown\n * @param {TypesRaw.ScriptSkeleton} scriptObj script object to describe\n * @returns {string} markdown table row\n */\nexport function getTableRowMd(scriptObj: ScriptSkeleton): string {\n const langMap = { JAVASCRIPT: 'JavaSscript', GROOVY: 'Groovy' };\n const description = `| ${scriptObj.name} | ${\n langMap[scriptObj.language]\n } | ${titleCase(scriptObj.context.split('_').join(' '))} | \\`${\n scriptObj._id\n }\\` |`;\n return description;\n}\n\n/**\n * List scripts\n * @param {boolean} long detail list\n * @param {boolean} usage display usage field\n * @param {String | null} file Optional filename to determine usage\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listScripts(\n long: boolean = false,\n usage: boolean = false,\n file: string | null = null\n): Promise<boolean> {\n let spinnerId: string;\n let scripts: ScriptSkeleton[] = [];\n debugMessage(`Cli.ScriptOps.listScripts: start`);\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading scripts...`\n );\n scripts = await readScripts();\n scripts.sort((a, b) => a.name.localeCompare(b.name));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${scripts.length} scripts.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error reading scripts`, 'fail');\n printError(error);\n return false;\n }\n if (!long && !usage) {\n scripts.forEach((script) => {\n printMessage(`${script.name}`, 'data');\n });\n debugMessage(`Cli.ScriptOps.listScripts: end`);\n return true;\n }\n let fullExport = null;\n const headers = long\n ? ['Name', 'UUID', 'Language', 'Context', 'Description']\n : ['Name'];\n if (usage) {\n try {\n fullExport = await getFullExportConfig(file);\n } catch (error) {\n printError(error);\n return false;\n }\n //Delete scripts from full export so they aren't mistakenly used for determining usage\n delete fullExport.script;\n headers.push('Used');\n }\n const table = createTable(headers);\n const langMap = { JAVASCRIPT: 'JS', GROOVY: 'Groovy' };\n scripts.forEach((script) => {\n const values = long\n ? [\n wordwrap(script.name, 25, ' '),\n script._id,\n langMap[script.language],\n wordwrap(titleCase(script.context.split('_').join(' ')), 25),\n wordwrap(script.description, 30),\n ]\n : [wordwrap(script.name, 25, ' ')];\n if (usage) {\n const isScriptUsed = isIdUsed(fullExport, script._id, false);\n values.push(\n isScriptUsed.used\n ? `${'yes'['brightGreen']} (at ${isScriptUsed.location})`\n : 'no'['brightRed']\n );\n }\n table.push(values);\n });\n printMessage(table.toString(), 'data');\n debugMessage(`Cli.ScriptOps.listScripts: end`);\n return true;\n}\n\n/**\n * Export script by id to file\n * @param {string} scriptId script uuid\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptToFile(\n scriptId: string,\n file: string,\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptToFile: start`);\n try {\n showSpinner(`Exporting script '${scriptId}'...`);\n let fileName = getTypedFilename(scriptId, 'script');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n spinSpinner(`Exporting script '${scriptId}' to '${filePath}'...`);\n const scriptExport = await exportScript(scriptId);\n saveJsonToFile(scriptExport, filePath, includeMeta);\n succeedSpinner(`Exported script '${scriptId}' to '${filePath}'.`);\n debugMessage(`Cli.ScriptOps.exportScriptToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting script '${scriptId}'`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export script by name to file\n * @param {string} name script name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {boolean} extract Extracts the scripts from the exports into separate files if true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptByNameToFile(\n name: string,\n file: string,\n includeMeta: boolean = true,\n extract: boolean = false\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: start`);\n try {\n showSpinner(`Exporting script '${name}'...`);\n let fileName = getTypedFilename(name, 'script');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n spinSpinner(`Exporting script '${name}' to '${filePath}'...`);\n const scriptExport = await exportScriptByName(name);\n if (extract) extractScriptToFile(scriptExport);\n saveJsonToFile(scriptExport, filePath, includeMeta);\n succeedSpinner(`Exported script '${name}' to '${filePath}'.`);\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting script '${name}': ${error.message}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all scripts to single file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {boolean} includeDefault true to include default scripts in export, false otherwise. Default: false\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptsToFile(\n file: string,\n includeMeta: boolean = true,\n includeDefault: boolean = false\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: start`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(state.getRealm())}Scripts`,\n 'script'\n );\n if (file) {\n fileName = file;\n }\n const scriptExport = await exportScripts(includeDefault);\n saveJsonToFile(scriptExport, getFilePath(fileName, true), includeMeta);\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: end`);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all scripts to individual files\n * @param {boolean} extract Extracts the scripts from the exports into separate files if true\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {boolean} includeDefault true to include default scripts in export, false otherwise. Default: false\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportScriptsToFiles(\n extract: boolean = false,\n includeMeta: boolean = true,\n includeDefault: boolean = false\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptsToFiles: start`);\n const errors: Error[] = [];\n let barId: string;\n try {\n let scriptList = await readScripts();\n if (!includeDefault)\n scriptList = scriptList.filter((script) => !script.default);\n barId = createProgressIndicator(\n 'determinate',\n scriptList.length,\n 'Exporting scripts to individual files...'\n );\n for (const script of scriptList) {\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting script ${script.name}...`\n );\n const file = getFilePath(getTypedFilename(script.name, 'script'), true);\n try {\n const scriptExport = await exportScriptByName(script.name);\n if (extract) extractScriptToFile(scriptExport);\n saveJsonToFile(scriptExport, file, includeMeta);\n updateProgressIndicator(fileBarId, `Saving ${script.name} to ${file}.`);\n stopProgressIndicator(fileBarId, `${script.name} saved to ${file}.`);\n } catch (error) {\n stopProgressIndicator(\n fileBarId,\n `Error exporting ${script.name}`,\n 'fail'\n );\n errors.push(error);\n }\n updateProgressIndicator(barId, `Exported script ${script.name}`);\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error exporting scripts`, errors);\n }\n stopProgressIndicator(\n barId,\n `Exported ${scriptList.length} scripts to individual files.`\n );\n debugMessage(`Cli.ScriptOps.exportScriptsToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(barId, `Error exporting scripts`);\n printError(error);\n }\n}\n\n/**\n * Extracts a script from a script export into a separate file.\n * @param {ScriptExportInterface} scriptExport The script export\n * @param {string} scriptId The script id (optional if there is only one script in the export)\n * @param {string} directory The directory within the base directory to save the script file\n * @returns {boolean} true if successful, false otherwise\n */\nexport function extractScriptToFile(\n scriptExport: ScriptExportInterface,\n scriptId?: string,\n directory?: string\n): boolean {\n try {\n const scriptSkeleton = scriptId\n ? scriptExport.script[scriptId]\n : getScriptSkeleton(scriptExport);\n const fileExtension =\n scriptSkeleton.language === 'JAVASCRIPT' ? 'js' : 'groovy';\n const scriptFileName = getTypedFilename(\n scriptSkeleton.name,\n 'script',\n fileExtension\n );\n const scriptFilePath = getFilePath(\n (directory ? `${directory}/` : '') + scriptFileName,\n true\n );\n const scriptText = Array.isArray(scriptSkeleton.script)\n ? scriptSkeleton.script.join('\\n')\n : scriptSkeleton.script;\n scriptSkeleton.script = `file://${scriptFilePath}`;\n saveTextToFile(scriptText, scriptFilePath);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\nfunction isScriptExtracted(importData: ScriptExportInterface): boolean {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: start`);\n let extracted = true;\n for (const scriptId of Object.keys(importData.script)) {\n const script = importData.script[scriptId].script;\n if (Array.isArray(script)) {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: script is string array`);\n extracted = false;\n break;\n }\n if (isValidUrl(script as string)) {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: script is extracted`);\n extracted = true;\n break;\n }\n if (isBase64Encoded) {\n debugMessage(`Cli.ScriptOps.isScriptExtracted: script is base64-encoded`);\n extracted = false;\n break;\n }\n break;\n }\n debugMessage(`Cli.ScriptOps.isScriptExtracted: end [extracted=${extracted}]`);\n return extracted;\n}\n\n/**\n * Import script(s) from file\n * @param {string} name Optional name of script. If supplied, only the script of that name is imported\n * @param {string} file file name\n * @param {ScriptImportOptions} options Script import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importScriptsFromFile(\n name: string,\n file: string,\n options: ScriptImportOptions = {\n reUuid: false,\n includeDefault: false,\n }\n): Promise<boolean> {\n const filePath = getFilePath(file);\n debugMessage(`Cli.ScriptOps.importScriptsFromFile: start`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const importData: ScriptExportInterface = JSON.parse(data);\n if (isScriptExtracted(importData)) {\n await handleScriptFileImport(filePath, options, false);\n } else {\n await importScripts(name, importData, options);\n }\n debugMessage(`Cli.ScriptOps.importScriptsFromFile: end`);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Import extracted scripts.\n *\n * @param {boolean} watch whether or not to watch for file changes\n * @param {ScriptImportOptions} options Script import options\n * @param {boolean} validateScripts If true, validates Javascript scripts to ensure no errors exist in them. Default: false\n */\nexport async function importScriptsFromFiles(\n watch: boolean,\n options: ScriptImportOptions,\n validateScripts: boolean\n): Promise<void> {\n // If watch is true, it doesn't make sense to reUuid.\n options.reUuid = watch ? false : options.reUuid;\n\n /**\n * Run on file change detection, as well as on initial run.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async function onChange(path: string, _stats?: fs.Stats): Promise<void> {\n try {\n await handleScriptFileImport(path, options, validateScripts);\n } catch (error) {\n printError(error, `${path}`);\n }\n }\n\n // We watch json files and script files.\n const watcher = chokidar.watch(\n [\n `${getWorkingDirectory()}/**/*.script.json`,\n `${getWorkingDirectory()}/**/*.script.js`,\n `${getWorkingDirectory()}/**/*.script.groovy`,\n ],\n {\n persistent: watch,\n ignoreInitial: watch,\n }\n );\n\n watcher\n .on('add', onChange)\n .on('change', onChange)\n .on('error', (error) => {\n printError(error, `Watcher error`);\n watcher.close();\n })\n .on('ready', () => {\n if (watch) {\n printMessage('Watching for changes...');\n } else {\n watcher.close();\n printMessage('Done.');\n }\n });\n}\n\n/**\n * Handle a script file import.\n *\n * @param {string} file Either a script file or an extract file\n * @param {ScriptImportOptions} options Script import options\n * @param {boolean} validateScripts If true, validates Javascript scripts to ensure no errors exist in them. Default: false\n */\nasync function handleScriptFileImport(\n file: string,\n options: ScriptImportOptions,\n validateScripts: boolean\n) {\n debugMessage(`Cli.ScriptOps.handleScriptFileImport: start`);\n const scriptFile = getScriptFile(file);\n const script = getScriptExportByScriptFile(scriptFile);\n\n const imported = await importScripts('', script, options, validateScripts);\n if (imported) {\n printMessage(`Imported '${scriptFile}'`);\n }\n debugMessage(`Cli.ScriptOps.handleScriptFileImport: end`);\n}\n\n/**\n * Get a script file from a file.\n *\n * @param file Either a script file or an extract file\n * @returns The script file\n */\nfunction getScriptFile(file: string): string {\n if (file.endsWith('.script.json')) {\n return file;\n }\n return file.replace(/\\.script\\.(js|groovy)/, '.script.json');\n}\n\n/**\n * Get a script export from a script file.\n *\n * @param scriptFile The path to the script file\n * @returns The script export\n */\nfunction getScriptExportByScriptFile(\n scriptFile: string\n): ScriptExportInterface {\n const scriptExport = getScriptExport(scriptFile);\n const scriptSkeleton = getScriptSkeleton(scriptExport);\n\n const extractFile = getExtractFile(scriptSkeleton);\n if (!extractFile) {\n return scriptExport;\n }\n\n const scriptRaw = fs.readFileSync(extractFile, 'utf8');\n scriptSkeleton.script = scriptRaw.split('\\n');\n\n return scriptExport;\n}\n\n/**\n * Get an extract file from a script skeleton.\n *\n * @param scriptSkeleton The script skeleton\n * @returns The extract file or null if there is no extract file\n */\nfunction getExtractFile(scriptSkeleton: ScriptSkeleton): string | null {\n const extractFile = scriptSkeleton.script;\n if (Array.isArray(extractFile)) {\n return null;\n }\n if (\n extractFile.startsWith('file://') &&\n (extractFile.endsWith('.js') || extractFile.endsWith('.groovy'))\n ) {\n return extractFile.replace('file://', '');\n }\n return null;\n}\n\n/**\n * Get a script export from a file.\n *\n * @param file The path to a script export file\n * @returns The script export\n */\nfunction getScriptExport(file: string): ScriptExportInterface {\n const scriptExportRaw = fs.readFileSync(file, 'utf8');\n const scriptExport = JSON.parse(scriptExportRaw) as ScriptExportInterface;\n\n return scriptExport;\n}\n\n/**\n * Get the main script skeleton from a script export. If there is more than one\n * script, an error is thrown.\n *\n * @param script Get the main script skeleton from a script export\n * @returns The main script skeleton\n */\nfunction getScriptSkeleton(script: ScriptExportInterface): ScriptSkeleton {\n const scriptId = getScriptId(script);\n return script.script[scriptId];\n}\n\n/**\n * Get the main script ID from a script export. If there is more than one\n * script, an error is thrown.\n *\n * @param script The script export\n * @returns The main script ID\n */\nfunction getScriptId(script: ScriptExportInterface): string {\n const scriptIds = Object.keys(script.script);\n if (scriptIds.length !== 1) {\n throw new Error(`Expected 1 script, found ${scriptIds.length}`);\n }\n return scriptIds[0];\n}\n\n/**\n * Delete script by id\n * @param {String} id script id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteScriptId(id: string): Promise<boolean> {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${id}...`\n );\n try {\n await deleteScript(id);\n stopProgressIndicator(spinnerId, `Deleted ${id}.`, 'success');\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error: ${error.message}`, 'fail');\n }\n return false;\n}\n\n/**\n * Delete script by name\n * @param {String} name script name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteScriptName(name: string): Promise<boolean> {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${name}...`\n );\n try {\n await deleteScriptByName(name);\n stopProgressIndicator(spinnerId, `Deleted ${name}.`, 'success');\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error: ${error.message}`, 'fail');\n }\n return false;\n}\n\n/**\n * Delete all non-default scripts\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteAllScripts(): Promise<boolean> {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all non-default scripts...`\n );\n try {\n await deleteScripts();\n stopProgressIndicator(\n spinnerId,\n `Deleted all non-default scripts.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error: ${error.message}`, 'fail');\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAMhE,OAAOC,QAAQ,MAAM,UAAU;AAC/B,OAAOC,EAAE,MAAM,IAAI;AAEnB,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ,iBAAiB;AAC/D,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,qBAAqB,EACrBC,cAAc,EACdC,uBAAuB,QAClB,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,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