@rockcarver/frodo-cli 0.23.1-8 → 0.24.2
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 +73 -1
- package/esm/app.js.map +1 -1
- package/esm/cli/FrodoCommand.js.map +1 -1
- package/esm/cli/_template/something-delete.js.map +1 -1
- package/esm/cli/_template/something-describe.js.map +1 -1
- package/esm/cli/_template/something-else-delete.js.map +1 -1
- package/esm/cli/_template/something-else-describe.js.map +1 -1
- package/esm/cli/_template/something-else-export.js.map +1 -1
- package/esm/cli/_template/something-else-import.js.map +1 -1
- package/esm/cli/_template/something-else-list.js.map +1 -1
- package/esm/cli/_template/something-else.js.map +1 -1
- package/esm/cli/_template/something-export.js.map +1 -1
- package/esm/cli/_template/something-import.js.map +1 -1
- package/esm/cli/_template/something-list.js.map +1 -1
- package/esm/cli/_template/something-other-delete.js.map +1 -1
- package/esm/cli/_template/something-other-describe.js.map +1 -1
- package/esm/cli/_template/something-other-export.js.map +1 -1
- package/esm/cli/_template/something-other-import.js.map +1 -1
- package/esm/cli/_template/something-other-list.js.map +1 -1
- package/esm/cli/_template/something-other.js.map +1 -1
- package/esm/cli/_template/something.js.map +1 -1
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-get-access-token.js.map +1 -1
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js.map +1 -1
- package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
- package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin.js.map +1 -1
- package/esm/cli/agent/agent-delete.js.map +1 -1
- package/esm/cli/agent/agent-describe.js.map +1 -1
- package/esm/cli/agent/agent-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
- package/esm/cli/agent/agent-gateway-describe.js.map +1 -1
- package/esm/cli/agent/agent-gateway-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-import.js.map +1 -1
- package/esm/cli/agent/agent-gateway-list.js.map +1 -1
- package/esm/cli/agent/agent-gateway.js.map +1 -1
- package/esm/cli/agent/agent-import.js.map +1 -1
- package/esm/cli/agent/agent-java-delete.js.map +1 -1
- package/esm/cli/agent/agent-java-describe.js.map +1 -1
- package/esm/cli/agent/agent-java-export.js.map +1 -1
- package/esm/cli/agent/agent-java-import.js.map +1 -1
- package/esm/cli/agent/agent-java-list.js.map +1 -1
- package/esm/cli/agent/agent-java.js.map +1 -1
- package/esm/cli/agent/agent-list.js.map +1 -1
- package/esm/cli/agent/agent-web-delete.js.map +1 -1
- package/esm/cli/agent/agent-web-describe.js.map +1 -1
- package/esm/cli/agent/agent-web-export.js.map +1 -1
- package/esm/cli/agent/agent-web-import.js.map +1 -1
- package/esm/cli/agent/agent-web-list.js.map +1 -1
- package/esm/cli/agent/agent-web.js.map +1 -1
- package/esm/cli/agent/agent.js.map +1 -1
- package/esm/cli/app/app-delete.js.map +1 -1
- package/esm/cli/app/app-describe.js.map +1 -1
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/app/app-list.js.map +1 -1
- package/esm/cli/app/app.js.map +1 -1
- package/esm/cli/authz/authz-policy-delete.js.map +1 -1
- package/esm/cli/authz/authz-policy-describe.js.map +1 -1
- package/esm/cli/authz/authz-policy-export.js +16 -11
- package/esm/cli/authz/authz-policy-export.js.map +1 -1
- package/esm/cli/authz/authz-policy-import.js +13 -13
- package/esm/cli/authz/authz-policy-import.js.map +1 -1
- package/esm/cli/authz/authz-policy-list.js.map +1 -1
- package/esm/cli/authz/authz-policy.js.map +1 -1
- package/esm/cli/authz/authz-set-delete.js.map +1 -1
- package/esm/cli/authz/authz-set-describe.js.map +1 -1
- package/esm/cli/authz/authz-set-export.js +7 -4
- package/esm/cli/authz/authz-set-export.js.map +1 -1
- package/esm/cli/authz/authz-set-import.js +9 -5
- package/esm/cli/authz/authz-set-import.js.map +1 -1
- package/esm/cli/authz/authz-set-list.js.map +1 -1
- package/esm/cli/authz/authz-set.js.map +1 -1
- package/esm/cli/authz/authz-type-delete.js.map +1 -1
- package/esm/cli/authz/authz-type-describe.js.map +1 -1
- package/esm/cli/authz/authz-type-export.js.map +1 -1
- package/esm/cli/authz/authz-type-import.js.map +1 -1
- package/esm/cli/authz/authz-type-list.js.map +1 -1
- package/esm/cli/authz/authz-type.js.map +1 -1
- package/esm/cli/authz/authz.js.map +1 -1
- package/esm/cli/conn/conn-delete.js.map +1 -1
- package/esm/cli/conn/conn-describe.js.map +1 -1
- package/esm/cli/conn/conn-list.js.map +1 -1
- package/esm/cli/conn/conn-save.js.map +1 -1
- package/esm/cli/conn/conn.js.map +1 -1
- package/esm/cli/email/email-template-export.js.map +1 -1
- package/esm/cli/email/email-template-import.js.map +1 -1
- package/esm/cli/email/email-template-list.js.map +1 -1
- package/esm/cli/email/email-template.js.map +1 -1
- package/esm/cli/email/email.js.map +1 -1
- package/esm/cli/esv/esv-apply.js.map +1 -1
- package/esm/cli/esv/esv-secret-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-describe.js.map +1 -1
- package/esm/cli/esv/esv-secret-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-import.js.map +1 -1
- package/esm/cli/esv/esv-secret-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-set.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-version.js.map +1 -1
- package/esm/cli/esv/esv-secret.js.map +1 -1
- package/esm/cli/esv/esv-variable-create.js.map +1 -1
- package/esm/cli/esv/esv-variable-delete.js.map +1 -1
- package/esm/cli/esv/esv-variable-describe.js.map +1 -1
- package/esm/cli/esv/esv-variable-export.js.map +1 -1
- package/esm/cli/esv/esv-variable-import.js.map +1 -1
- package/esm/cli/esv/esv-variable-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-set.js.map +1 -1
- package/esm/cli/esv/esv-variable.js.map +1 -1
- package/esm/cli/esv/esv.js.map +1 -1
- package/esm/cli/idm/idm-count.js.map +1 -1
- package/esm/cli/idm/idm-export.js.map +1 -1
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/cli/idm/idm-list.js.map +1 -1
- package/esm/cli/idm/idm.js.map +1 -1
- package/esm/cli/idp/idp-export.js.map +1 -1
- package/esm/cli/idp/idp-import.js.map +1 -1
- package/esm/cli/idp/idp-list.js.map +1 -1
- package/esm/cli/idp/idp.js.map +1 -1
- package/esm/cli/info/info.js.map +1 -1
- package/esm/cli/journey/journey-delete.js.map +1 -1
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/journey/journey-disable.js.map +1 -1
- package/esm/cli/journey/journey-enable.js.map +1 -1
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/journey/journey-import.js.map +1 -1
- package/esm/cli/journey/journey-list.js.map +1 -1
- package/esm/cli/journey/journey-prune.js.map +1 -1
- package/esm/cli/journey/journey.js.map +1 -1
- package/esm/cli/logging/logs-fetch.js.map +1 -1
- package/esm/cli/logging/logs-list.js.map +1 -1
- package/esm/cli/logging/logs-tail.js.map +1 -1
- package/esm/cli/logging/logs.js.map +1 -1
- package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm-describe.js.map +1 -1
- package/esm/cli/realm/realm-list.js.map +1 -1
- package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm.js.map +1 -1
- package/esm/cli/saml/saml-cot-export.js.map +1 -1
- package/esm/cli/saml/saml-cot-import.js.map +1 -1
- package/esm/cli/saml/saml-cot-list.js.map +1 -1
- package/esm/cli/saml/saml-cot.js.map +1 -1
- package/esm/cli/saml/saml-delete.js.map +1 -1
- package/esm/cli/saml/saml-describe.js.map +1 -1
- package/esm/cli/saml/saml-export.js.map +1 -1
- package/esm/cli/saml/saml-import.js.map +1 -1
- package/esm/cli/saml/saml-list.js.map +1 -1
- package/esm/cli/saml/saml-metadata-export.js.map +1 -1
- package/esm/cli/saml/saml-metadata.js.map +1 -1
- package/esm/cli/saml/saml.js.map +1 -1
- package/esm/cli/script/script-delete.js.map +1 -1
- package/esm/cli/script/script-describe.js.map +1 -1
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/script/script-import.js.map +1 -1
- package/esm/cli/script/script-list.js.map +1 -1
- package/esm/cli/script/script.js.map +1 -1
- package/esm/cli/service/service-delete.js.map +1 -1
- package/esm/cli/service/service-export.js.map +1 -1
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/cli/service/service-list.js.map +1 -1
- package/esm/cli/service/service.js.map +1 -1
- package/esm/cli/theme/theme-delete.e2e.test_.js.map +1 -1
- package/esm/cli/theme/theme-delete.js.map +1 -1
- package/esm/cli/theme/theme-export.js.map +1 -1
- package/esm/cli/theme/theme-import.js.map +1 -1
- package/esm/cli/theme/theme-list.e2e.test_.js.map +1 -1
- package/esm/cli/theme/theme-list.js.map +1 -1
- package/esm/cli/theme/theme.js.map +1 -1
- package/esm/loader.js.map +1 -1
- package/esm/ops/AgentOps.js.map +1 -1
- package/esm/ops/CirclesOfTrustOps.js.map +1 -1
- package/esm/ops/ConnectionProfileOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/IdpOps.js.map +1 -1
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/NodeOps.js.map +1 -1
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +26 -17
- package/esm/ops/PolicyOps.js.map +1 -1
- package/esm/ops/PolicySetOps.js +17 -10
- package/esm/ops/PolicySetOps.js.map +1 -1
- package/esm/ops/ResourceTypeOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/Saml2Ops.test_.js.map +1 -1
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js.map +1 -1
- package/esm/ops/utils/OpsUtils.js.map +1 -1
- package/esm/ops/utils/Wordwrap.js.map +1 -1
- package/esm/utils/Config.js.map +1 -1
- package/esm/utils/Console.js.map +1 -1
- package/esm/utils/ExportImportUtils.js.map +1 -1
- package/esm/utils/Version.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JourneyOps.js","names":["fs","printMessage","createProgressBar","updateProgressBar","stopProgressBar","showSpinner","succeedSpinner","failSpinner","createTable","debugMessage","ExportImportUtils","Journey","Types","state","CirclesOfTrust","EmailTemplate","Idp","Node","Saml2","Script","Theme","wordwrap","cloneDeep","getJourneys","importAllJourneys","importJourney","resolveDependencies","createMultiTreeExportTemplate","exportJourney","onlineTreeExportResolver","getTreeDescendents","getNodeRef","getTypedFilename","saveJsonToFile","getRealmString","listJourneys","long","analyze","journeys","journeyStub","table","push","_id","enabled","uiConfig","categories","JSON","parse","join","toString","exportPromises","useStringArrays","deps","journeyExports","Promise","all","journeyExport","tree","getJourneyClassification","error","response","data","exportJourneyToFile","journeyId","file","options","verbose","default","session","getDebug","getDirectory","dir","replace","existsSync","mkdirSync","recursive","fileData","exportJourneysToFile","fileName","trees","length","exportData","meta","exportJourneysToFiles","importJourneyFromFile","readFile","err","journeyData","installedJourneys","map","x","unresolvedJourneys","resolvedJourneys","Object","keys","then","catch","importError","journey","importFirstJourneyFromFile","treeId","hasOwnProperty","call","importJourneysFromFile","importJourneysFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","allJourneysData","readFileSync","it","JourneyClassification","STANDARD","CLOUD","CUSTOM","PREMIUM","getJourneyClassificationMd","getOneLineDescription","treeObj","description","getOneLineDescriptionMd","describeTreeDescendents","descendents","depth","values","indent","Array","fill","descendent","describeTreeDescendentsMd","markdown","describeJourney","resolveTreeExport","allNodes","nodes","innerNodes","nodeTypeMap","nodeData","_type","getAmVersion","originAmVersion","setAmVersion","entries","nodeType","count","String","getNodeClassification","nodeObj","themes","themeData","scripts","scriptData","emailTemplates","templateData","socialIdentityProviders","socialIdpData","saml2Entities","entityProviderData","circlesOfTrust","cotData","describeJourneyMd","getNodeClassificationMd","getTableHeaderMd","getTableRowMd"],"sources":["ops/JourneyOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n NodeSkeleton,\n TreeSkeleton,\n} from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n MultiTreeExportInterface,\n SingleTreeExportInterface,\n TreeDependencyMapInterface,\n TreeExportOptions,\n TreeExportResolverInterface,\n TreeImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport {\n printMessage,\n createProgressBar,\n updateProgressBar,\n stopProgressBar,\n showSpinner,\n succeedSpinner,\n failSpinner,\n createTable,\n debugMessage,\n} from '../utils/Console';\nimport {\n ExportImportUtils,\n Journey,\n Types,\n state,\n} from '@rockcarver/frodo-lib';\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 wordwrap from './utils/Wordwrap';\nimport { cloneDeep } from './utils/OpsUtils';\n\nconst {\n getJourneys,\n importAllJourneys,\n importJourney,\n resolveDependencies,\n createMultiTreeExportTemplate,\n exportJourney,\n onlineTreeExportResolver,\n getTreeDescendents,\n getNodeRef,\n} = Journey;\nconst { getTypedFilename, saveJsonToFile, getRealmString } = ExportImportUtils;\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<TreeSkeleton[]>} a promise that resolves to an array journey objects\n */\nexport async function listJourneys(\n long = false,\n analyze = false\n): Promise<TreeSkeleton[]> {\n let journeys = [];\n try {\n journeys = await getJourneys();\n if (!long && !analyze) {\n for (const journeyStub of journeys) {\n printMessage(`${journeyStub['_id']}`, 'data');\n }\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 } else {\n showSpinner('Retrieving details of all journeys...');\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 })\n );\n }\n const journeyExports = await Promise.all(exportPromises);\n succeedSpinner('Retrieved details of all journeys.');\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 } catch (error) {\n failSpinner('Error retrieving details of all journeys.');\n printMessage(error.response.data, 'error');\n }\n }\n }\n } catch (error) {\n printMessage(error.response?.data, 'error');\n }\n return journeys;\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 {TreeExportOptions} options export options\n */\nexport async function exportJourneyToFile(\n journeyId: string,\n file: string,\n options: TreeExportOptions\n): Promise<void> {\n debugMessage(`exportJourneyToFile: start`);\n const verbose = state.default.session.getDebug();\n if (!file) {\n file = getTypedFilename(journeyId, 'journey');\n }\n if (state.default.session.getDirectory()) {\n const dir = state.default.session.getDirectory().replace(/\\/$/, '');\n debugMessage(`exportJourneyToFile: directory='${dir}'`);\n file = `${dir}/${file}`;\n // create directory if it doesn't exist\n if (!fs.existsSync(dir)) {\n debugMessage(`exportJourneyToFile: creating directory '${dir}'`);\n fs.mkdirSync(dir, { recursive: true });\n }\n }\n if (!verbose) showSpinner(`${journeyId}`);\n try {\n const fileData: SingleTreeExportInterface = await exportJourney(\n journeyId,\n options\n );\n if (verbose) showSpinner(`${journeyId}`);\n saveJsonToFile(fileData, file);\n succeedSpinner(\n `Exported ${journeyId['brightCyan']} to ${file['brightCyan']}.`\n );\n } catch (error) {\n if (verbose) showSpinner(`${journeyId}`);\n failSpinner(`Error exporting journey ${journeyId}: ${error}`);\n }\n}\n\n/**\n * Export all journeys to file\n * @param {string} file optional export file name\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFile(\n file: string,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n }\n): Promise<void> {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Journeys`, 'journeys');\n }\n const trees = await getJourneys();\n const fileData: MultiTreeExportInterface = createMultiTreeExportTemplate();\n createProgressBar(trees.length, 'Exporting journeys...');\n for (const tree of trees) {\n updateProgressBar(`${tree._id}`);\n try {\n const exportData = await exportJourney(tree._id, options);\n delete exportData.meta;\n fileData.trees[tree._id] = exportData;\n } catch (error) {\n printMessage(`Error exporting journey ${tree._id}: ${error}`, 'error');\n }\n }\n saveJsonToFile(fileData, fileName);\n stopProgressBar(`Exported to ${fileName}`);\n}\n\n/**\n * Export all journeys to separate files\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFiles(\n options: TreeExportOptions\n): Promise<void> {\n const trees = await getJourneys();\n createProgressBar(trees.length, 'Exporting journeys...');\n for (const tree of trees) {\n updateProgressBar(`${tree._id}`);\n const fileName = getTypedFilename(`${tree._id}`, 'journey');\n try {\n const exportData: SingleTreeExportInterface = await exportJourney(\n tree._id,\n options\n );\n saveJsonToFile(exportData, fileName);\n } catch (error) {\n // do we need to report status here?\n }\n }\n stopProgressBar('Done');\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 */\nexport async function importJourneyFromFile(\n journeyId: string,\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.default.session.getDebug();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\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 getJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n showSpinner('Resolving dependencies');\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n succeedSpinner(`Resolved all dependencies.`);\n\n if (!verbose) showSpinner(`Importing ${journeyId}...`);\n importJourney(journeyData, options)\n .then(() => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n succeedSpinner(`Imported ${journeyId}.`);\n })\n .catch((importError) => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${importError}`);\n });\n } else {\n failSpinner(`Unresolved dependencies:`);\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 showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${journeyId} not found!`);\n }\n });\n}\n\n/**\n * Import first journey from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importFirstJourneyFromFile(\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.default.session.getDebug();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\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 getJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n showSpinner('Resolving dependencies');\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n succeedSpinner(`Resolved all dependencies.`);\n\n if (!verbose) showSpinner(`Importing ${journeyId}...`);\n importJourney(journeyData, options)\n .then(() => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n succeedSpinner(`Imported ${journeyId}.`);\n })\n .catch((importError) => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${importError}`);\n });\n } else {\n failSpinner(`Unresolved dependencies:`);\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No journeys found!`);\n }\n // end dependency resolution for single tree import\n });\n}\n\n/**\n * Import all journeys from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFile(\n file: string,\n options: TreeImportOptions\n) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n importAllJourneys(fileData.trees, options);\n });\n}\n\n/**\n * Import all journeys from separate files\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFiles(options: TreeImportOptions) {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.journey.json')\n );\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 importAllJourneys(allJourneysData.trees as MultiTreeExportInterface, options);\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): string[] {\n return Journey.getJourneyClassification(journey).map((it) => {\n switch (it) {\n case Types.JourneyClassification.STANDARD:\n return it.toString()['brightGreen'];\n\n case Types.JourneyClassification.CLOUD:\n return it.toString()['brightMagenta'];\n\n case Types.JourneyClassification.CUSTOM:\n return it.toString()['brightRed'];\n\n case Types.JourneyClassification.PREMIUM:\n return it.toString()['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 Journey.getJourneyClassification(journey).map((it) => {\n switch (it) {\n case Types.JourneyClassification.STANDARD:\n return `:green_circle: \\`${it.toString()}\\``;\n\n case Types.JourneyClassification.CLOUD:\n return `:purple_circle: \\`${it.toString()}\\``;\n\n case Types.JourneyClassification.CUSTOM:\n return `:red_circle: \\`${it.toString()}\\``;\n\n case Types.JourneyClassification.PREMIUM:\n return `:yellow_circle: \\`${it.toString()}\\``;\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 */\nexport async function describeJourney(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n): Promise<void> {\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 (\n !state.default.session.getAmVersion() &&\n journeyData.meta?.originAmVersion\n ) {\n state.default.session.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(`${getOneLineDescription(journeyData.tree)}`, 'data');\n printMessage(Array(`[${journeyData.tree._id}]`['length']).fill('=').join(''));\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.default.session.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 const descendents = await getTreeDescendents(journeyData, resolveTreeExport);\n describeTreeDescendents(descendents);\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(journeyData.saml2Entities)) {\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}\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 */\nexport async function describeJourneyMd(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n) {\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 (\n !state.default.session.getAmVersion() &&\n journeyData.meta?.originAmVersion\n ) {\n state.default.session.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(journeyData, resolveTreeExport);\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(journeyData.saml2Entities)) {\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}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AAanB,SACEC,YAAY,EACZC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,WAAW,EACXC,cAAc,EACdC,WAAW,EACXC,WAAW,EACXC,YAAY,QACP,kBAAkB;AACzB,SACEC,iBAAiB,E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AAY,CACT,8BACC4F,MAAM,CAACqD,OAAO,CAAC3D,WAAW,CAACyE,aAAa,CAAC,CAAChF,MAC3C,GAAE,EACH,MAAM,CACP;IACD/E,YAAY,CAACiB,KAAK,CAACoJ,gBAAgB,EAAE,EAAE,MAAM,CAAC;IAC9C,KAAK,MAAML,kBAAkB,IAAIpE,MAAM,CAACmC,MAAM,CAACzC,WAAW,CAACyE,aAAa,CAAC,EAAE;MACzE/J,YAAY,CAAE,GAAEiB,KAAK,CAACqJ,aAAa,CAACN,kBAAkB,CAAE,EAAC,EAAE,MAAM,CAAC;IACpE;EACF;;EAEA;EACA,IAAIpE,MAAM,CAACqD,OAAO,CAAC3D,WAAW,CAAC2E,cAAc,CAAC,CAAClF,MAAM,EAAE;IACrD/E,YAAY,CACT,8BACC4F,MAAM,CAACqD,OAAO,CAAC3D,WAAW,CAAC2E,cAAc,CAAC,CAAClF,MAC5C,GAAE,EACH,MAAM,CACP;IACD/E,YAAY,CAACa,cAAc,CAACwJ,gBAAgB,EAAE,EAAE,MAAM,CAAC;IACvD,KAAK,MAAMH,OAAO,IAAItE,MAAM,CAACmC,MAAM,CAACzC,WAAW,CAAC2E,cAAc,CAAC,EAAE;MAC/DjK,YAAY,CAAE,GAAEa,cAAc,CAACyJ,aAAa,CAACJ,OAAO,CAAE,EAAC,EAAE,MAAM,CAAC;IAClE;EACF;AACF"}
|
|
1
|
+
{"version":3,"file":"JourneyOps.js","names":["fs","printMessage","createProgressBar","updateProgressBar","stopProgressBar","showSpinner","succeedSpinner","failSpinner","createTable","debugMessage","ExportImportUtils","Journey","Types","state","CirclesOfTrust","EmailTemplate","Idp","Node","Saml2","Script","Theme","wordwrap","cloneDeep","getJourneys","importAllJourneys","importJourney","resolveDependencies","createMultiTreeExportTemplate","exportJourney","onlineTreeExportResolver","getTreeDescendents","getNodeRef","getTypedFilename","saveJsonToFile","getRealmString","listJourneys","long","analyze","journeys","journeyStub","table","_journeyStub$uiConfig","push","_id","enabled","uiConfig","categories","JSON","parse","join","toString","exportPromises","useStringArrays","deps","journeyExports","Promise","all","journeyExport","_journeyExport$tree$u","tree","getJourneyClassification","error","response","data","_error$response","exportJourneyToFile","journeyId","file","options","verbose","default","session","getDebug","getDirectory","dir","replace","existsSync","mkdirSync","recursive","fileData","exportJourneysToFile","fileName","trees","length","exportData","meta","exportJourneysToFiles","importJourneyFromFile","readFile","err","journeyData","installedJourneys","map","x","unresolvedJourneys","resolvedJourneys","Object","keys","then","catch","importError","journey","importFirstJourneyFromFile","treeId","hasOwnProperty","call","importJourneysFromFile","importJourneysFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","allJourneysData","readFileSync","it","JourneyClassification","STANDARD","CLOUD","CUSTOM","PREMIUM","getJourneyClassificationMd","getOneLineDescription","treeObj","description","getOneLineDescriptionMd","describeTreeDescendents","descendents","depth","values","indent","Array","fill","descendent","describeTreeDescendentsMd","markdown","describeJourney","resolveTreeExport","_journeyData$meta","_journeyData$tree$uiC","_journeyData$themes","allNodes","nodes","innerNodes","nodeTypeMap","nodeData","_type","getAmVersion","originAmVersion","setAmVersion","entries","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"],"sources":["ops/JourneyOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n NodeSkeleton,\n TreeSkeleton,\n} from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n MultiTreeExportInterface,\n SingleTreeExportInterface,\n TreeDependencyMapInterface,\n TreeExportOptions,\n TreeExportResolverInterface,\n TreeImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport {\n printMessage,\n createProgressBar,\n updateProgressBar,\n stopProgressBar,\n showSpinner,\n succeedSpinner,\n failSpinner,\n createTable,\n debugMessage,\n} from '../utils/Console';\nimport {\n ExportImportUtils,\n Journey,\n Types,\n state,\n} from '@rockcarver/frodo-lib';\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 wordwrap from './utils/Wordwrap';\nimport { cloneDeep } from './utils/OpsUtils';\n\nconst {\n getJourneys,\n importAllJourneys,\n importJourney,\n resolveDependencies,\n createMultiTreeExportTemplate,\n exportJourney,\n onlineTreeExportResolver,\n getTreeDescendents,\n getNodeRef,\n} = Journey;\nconst { getTypedFilename, saveJsonToFile, getRealmString } = ExportImportUtils;\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<TreeSkeleton[]>} a promise that resolves to an array journey objects\n */\nexport async function listJourneys(\n long = false,\n analyze = false\n): Promise<TreeSkeleton[]> {\n let journeys = [];\n try {\n journeys = await getJourneys();\n if (!long && !analyze) {\n for (const journeyStub of journeys) {\n printMessage(`${journeyStub['_id']}`, 'data');\n }\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 } else {\n showSpinner('Retrieving details of all journeys...');\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 })\n );\n }\n const journeyExports = await Promise.all(exportPromises);\n succeedSpinner('Retrieved details of all journeys.');\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 } catch (error) {\n failSpinner('Error retrieving details of all journeys.');\n printMessage(error.response.data, 'error');\n }\n }\n }\n } catch (error) {\n printMessage(error.response?.data, 'error');\n }\n return journeys;\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 {TreeExportOptions} options export options\n */\nexport async function exportJourneyToFile(\n journeyId: string,\n file: string,\n options: TreeExportOptions\n): Promise<void> {\n debugMessage(`exportJourneyToFile: start`);\n const verbose = state.default.session.getDebug();\n if (!file) {\n file = getTypedFilename(journeyId, 'journey');\n }\n if (state.default.session.getDirectory()) {\n const dir = state.default.session.getDirectory().replace(/\\/$/, '');\n debugMessage(`exportJourneyToFile: directory='${dir}'`);\n file = `${dir}/${file}`;\n // create directory if it doesn't exist\n if (!fs.existsSync(dir)) {\n debugMessage(`exportJourneyToFile: creating directory '${dir}'`);\n fs.mkdirSync(dir, { recursive: true });\n }\n }\n if (!verbose) showSpinner(`${journeyId}`);\n try {\n const fileData: SingleTreeExportInterface = await exportJourney(\n journeyId,\n options\n );\n if (verbose) showSpinner(`${journeyId}`);\n saveJsonToFile(fileData, file);\n succeedSpinner(\n `Exported ${journeyId['brightCyan']} to ${file['brightCyan']}.`\n );\n } catch (error) {\n if (verbose) showSpinner(`${journeyId}`);\n failSpinner(`Error exporting journey ${journeyId}: ${error}`);\n }\n}\n\n/**\n * Export all journeys to file\n * @param {string} file optional export file name\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFile(\n file: string,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n }\n): Promise<void> {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Journeys`, 'journeys');\n }\n const trees = await getJourneys();\n const fileData: MultiTreeExportInterface = createMultiTreeExportTemplate();\n createProgressBar(trees.length, 'Exporting journeys...');\n for (const tree of trees) {\n updateProgressBar(`${tree._id}`);\n try {\n const exportData = await exportJourney(tree._id, options);\n delete exportData.meta;\n fileData.trees[tree._id] = exportData;\n } catch (error) {\n printMessage(`Error exporting journey ${tree._id}: ${error}`, 'error');\n }\n }\n saveJsonToFile(fileData, fileName);\n stopProgressBar(`Exported to ${fileName}`);\n}\n\n/**\n * Export all journeys to separate files\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFiles(\n options: TreeExportOptions\n): Promise<void> {\n const trees = await getJourneys();\n createProgressBar(trees.length, 'Exporting journeys...');\n for (const tree of trees) {\n updateProgressBar(`${tree._id}`);\n const fileName = getTypedFilename(`${tree._id}`, 'journey');\n try {\n const exportData: SingleTreeExportInterface = await exportJourney(\n tree._id,\n options\n );\n saveJsonToFile(exportData, fileName);\n } catch (error) {\n // do we need to report status here?\n }\n }\n stopProgressBar('Done');\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 */\nexport async function importJourneyFromFile(\n journeyId: string,\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.default.session.getDebug();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\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 getJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n showSpinner('Resolving dependencies');\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n succeedSpinner(`Resolved all dependencies.`);\n\n if (!verbose) showSpinner(`Importing ${journeyId}...`);\n importJourney(journeyData, options)\n .then(() => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n succeedSpinner(`Imported ${journeyId}.`);\n })\n .catch((importError) => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${importError}`);\n });\n } else {\n failSpinner(`Unresolved dependencies:`);\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 showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${journeyId} not found!`);\n }\n });\n}\n\n/**\n * Import first journey from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importFirstJourneyFromFile(\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.default.session.getDebug();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\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 getJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n showSpinner('Resolving dependencies');\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n succeedSpinner(`Resolved all dependencies.`);\n\n if (!verbose) showSpinner(`Importing ${journeyId}...`);\n importJourney(journeyData, options)\n .then(() => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n succeedSpinner(`Imported ${journeyId}.`);\n })\n .catch((importError) => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${importError}`);\n });\n } else {\n failSpinner(`Unresolved dependencies:`);\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No journeys found!`);\n }\n // end dependency resolution for single tree import\n });\n}\n\n/**\n * Import all journeys from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFile(\n file: string,\n options: TreeImportOptions\n) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n importAllJourneys(fileData.trees, options);\n });\n}\n\n/**\n * Import all journeys from separate files\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFiles(options: TreeImportOptions) {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.journey.json')\n );\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 importAllJourneys(allJourneysData.trees as MultiTreeExportInterface, options);\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): string[] {\n return Journey.getJourneyClassification(journey).map((it) => {\n switch (it) {\n case Types.JourneyClassification.STANDARD:\n return it.toString()['brightGreen'];\n\n case Types.JourneyClassification.CLOUD:\n return it.toString()['brightMagenta'];\n\n case Types.JourneyClassification.CUSTOM:\n return it.toString()['brightRed'];\n\n case Types.JourneyClassification.PREMIUM:\n return it.toString()['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 Journey.getJourneyClassification(journey).map((it) => {\n switch (it) {\n case Types.JourneyClassification.STANDARD:\n return `:green_circle: \\`${it.toString()}\\``;\n\n case Types.JourneyClassification.CLOUD:\n return `:purple_circle: \\`${it.toString()}\\``;\n\n case Types.JourneyClassification.CUSTOM:\n return `:red_circle: \\`${it.toString()}\\``;\n\n case Types.JourneyClassification.PREMIUM:\n return `:yellow_circle: \\`${it.toString()}\\``;\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 */\nexport async function describeJourney(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n): Promise<void> {\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 (\n !state.default.session.getAmVersion() &&\n journeyData.meta?.originAmVersion\n ) {\n state.default.session.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(`${getOneLineDescription(journeyData.tree)}`, 'data');\n printMessage(Array(`[${journeyData.tree._id}]`['length']).fill('=').join(''));\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.default.session.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 const descendents = await getTreeDescendents(journeyData, resolveTreeExport);\n describeTreeDescendents(descendents);\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(journeyData.saml2Entities)) {\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}\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 */\nexport async function describeJourneyMd(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n) {\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 (\n !state.default.session.getAmVersion() &&\n journeyData.meta?.originAmVersion\n ) {\n state.default.session.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(journeyData, resolveTreeExport);\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(journeyData.saml2Entities)) {\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.getT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,CAAE,EAAC,EAAE,MAAM,CAAC;IACpE;EACF;;EAEA;EACA,IAAIvE,MAAM,CAACwD,OAAO,CAAC9D,WAAW,CAAC8E,cAAc,CAAC,CAACrF,MAAM,EAAE;IACrDlF,YAAY,CACT,8BACC+F,MAAM,CAACwD,OAAO,CAAC9D,WAAW,CAAC8E,cAAc,CAAC,CAACrF,MAC5C,GAAE,EACH,MACF,CAAC;IACDlF,YAAY,CAACa,cAAc,CAACiK,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;IACvD,KAAK,MAAMN,OAAO,IAAIzE,MAAM,CAACmC,MAAM,CAACzC,WAAW,CAAC8E,cAAc,CAAC,EAAE;MAC/DvK,YAAY,CAAE,GAAEa,cAAc,CAACkK,aAAa,CAACP,OAAO,CAAE,EAAC,EAAE,MAAM,CAAC;IAClE;EACF;AACF"}
|
package/esm/ops/NodeOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeOps.js","names":["Node","Types","getNodeClassification","nodeType","map","it","NodeClassification","STANDARD","toString","CLOUD","CUSTOM","PREMIUM","getNodeClassificationMd","getOneLineDescription","nodeObj","nodeRef","description","_id","_type","join","displayName","getOneLineDescriptionMd","getTableHeaderMd","markdown","getTableRowMd","row"],"sources":["ops/NodeOps.ts"],"sourcesContent":["import {\n InnerNodeRefSkeletonInterface,\n NodeRefSkeletonInterface,\n NodeSkeleton,\n} from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { Node, Types } from '@rockcarver/frodo-lib';\n\n/**\n * Get node classification\n * @param {string} nodeType node type\n * @returns {stringp[]} Colored string array of classifications\n */\nexport function getNodeClassification(nodeType: string): string[] {\n return Node.getNodeClassification(nodeType).map((it) => {\n switch (it) {\n case Types.NodeClassification.STANDARD:\n return it.toString()['brightGreen'];\n\n case Types.NodeClassification.CLOUD:\n return it.toString()['brightMagenta'];\n\n case Types.NodeClassification.CUSTOM:\n return it.toString()['brightRed'];\n\n case Types.NodeClassification.PREMIUM:\n return it.toString()['brightYellow'];\n }\n });\n}\n\n/**\n * Get node classification in markdown\n * @param {string} nodeType node type\n * @returns {stringp[]} Colored string array of classifications\n */\nexport function getNodeClassificationMd(nodeType: string): string[] {\n return Node.getNodeClassification(nodeType).map((it) => {\n switch (it) {\n case Types.NodeClassification.STANDARD:\n return `:green_circle: \\`${it.toString()}\\``;\n\n case Types.NodeClassification.CLOUD:\n return `:purple_circle: \\`${it.toString()}\\``;\n\n case Types.NodeClassification.CUSTOM:\n return `:red_circle: \\`${it.toString()}\\``;\n\n case Types.NodeClassification.PREMIUM:\n return `:yellow_circle: \\`${it.toString()}\\``;\n }\n });\n}\n\n/**\n * Get a one-line description of the node\n * @param {NodeSkeleton} nodeObj node object to describe\n * @param {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} nodeRef node reference object\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n nodeObj: NodeSkeleton,\n nodeRef?: NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface\n): string {\n const description = `[${nodeObj._id['brightCyan']}] (${getNodeClassification(\n nodeObj._type._id\n ).join(', ')}) ${nodeObj._type._id}${\n nodeRef ? ' - ' + nodeRef?.displayName : ''\n }`;\n return description;\n}\n\n/**\n * Get a one-line description of the node in markdown\n * @param {NodeSkeleton} nodeObj node object to describe\n * @param {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} nodeRef node reference object\n * @returns {string} a one-line description in markdown\n */\nexport function getOneLineDescriptionMd(\n nodeObj: NodeSkeleton,\n nodeRef?: NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface\n): string {\n const description = `${nodeObj._id} (${getNodeClassificationMd(\n nodeObj._type._id\n ).join(', ')}) ${nodeObj._type._id}${\n nodeRef ? ' - ' + nodeRef?.displayName : ''\n }`;\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 += '| Display Name | Type | Classification | Id |\\n';\n markdown += '| ------------ | ---- | -------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the node in markdown\n * @param {NodeSkeleton} nodeObj node object to describe\n * @param {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} nodeRef node reference object\n * @returns {string} a table-row of the node in markdown\n */\nexport function getTableRowMd(\n nodeObj: NodeSkeleton,\n nodeRef?: NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface\n): string {\n const row = `| ${nodeRef ? nodeRef.displayName : ''} | ${\n nodeObj._type._id\n } | ${getNodeClassificationMd(nodeObj._type._id).join('<br>')} | \\`${\n nodeObj._id\n }\\` |`;\n return row;\n}\n"],"mappings":"AAKA,SAASA,IAAI,EAAEC,KAAK,QAAQ,uBAAuB;;AAEnD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,
|
|
1
|
+
{"version":3,"file":"NodeOps.js","names":["Node","Types","getNodeClassification","nodeType","map","it","NodeClassification","STANDARD","toString","CLOUD","CUSTOM","PREMIUM","getNodeClassificationMd","getOneLineDescription","nodeObj","nodeRef","description","_id","_type","join","displayName","getOneLineDescriptionMd","getTableHeaderMd","markdown","getTableRowMd","row"],"sources":["ops/NodeOps.ts"],"sourcesContent":["import {\n InnerNodeRefSkeletonInterface,\n NodeRefSkeletonInterface,\n NodeSkeleton,\n} from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { Node, Types } from '@rockcarver/frodo-lib';\n\n/**\n * Get node classification\n * @param {string} nodeType node type\n * @returns {stringp[]} Colored string array of classifications\n */\nexport function getNodeClassification(nodeType: string): string[] {\n return Node.getNodeClassification(nodeType).map((it) => {\n switch (it) {\n case Types.NodeClassification.STANDARD:\n return it.toString()['brightGreen'];\n\n case Types.NodeClassification.CLOUD:\n return it.toString()['brightMagenta'];\n\n case Types.NodeClassification.CUSTOM:\n return it.toString()['brightRed'];\n\n case Types.NodeClassification.PREMIUM:\n return it.toString()['brightYellow'];\n }\n });\n}\n\n/**\n * Get node classification in markdown\n * @param {string} nodeType node type\n * @returns {stringp[]} Colored string array of classifications\n */\nexport function getNodeClassificationMd(nodeType: string): string[] {\n return Node.getNodeClassification(nodeType).map((it) => {\n switch (it) {\n case Types.NodeClassification.STANDARD:\n return `:green_circle: \\`${it.toString()}\\``;\n\n case Types.NodeClassification.CLOUD:\n return `:purple_circle: \\`${it.toString()}\\``;\n\n case Types.NodeClassification.CUSTOM:\n return `:red_circle: \\`${it.toString()}\\``;\n\n case Types.NodeClassification.PREMIUM:\n return `:yellow_circle: \\`${it.toString()}\\``;\n }\n });\n}\n\n/**\n * Get a one-line description of the node\n * @param {NodeSkeleton} nodeObj node object to describe\n * @param {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} nodeRef node reference object\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n nodeObj: NodeSkeleton,\n nodeRef?: NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface\n): string {\n const description = `[${nodeObj._id['brightCyan']}] (${getNodeClassification(\n nodeObj._type._id\n ).join(', ')}) ${nodeObj._type._id}${\n nodeRef ? ' - ' + nodeRef?.displayName : ''\n }`;\n return description;\n}\n\n/**\n * Get a one-line description of the node in markdown\n * @param {NodeSkeleton} nodeObj node object to describe\n * @param {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} nodeRef node reference object\n * @returns {string} a one-line description in markdown\n */\nexport function getOneLineDescriptionMd(\n nodeObj: NodeSkeleton,\n nodeRef?: NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface\n): string {\n const description = `${nodeObj._id} (${getNodeClassificationMd(\n nodeObj._type._id\n ).join(', ')}) ${nodeObj._type._id}${\n nodeRef ? ' - ' + nodeRef?.displayName : ''\n }`;\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 += '| Display Name | Type | Classification | Id |\\n';\n markdown += '| ------------ | ---- | -------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the node in markdown\n * @param {NodeSkeleton} nodeObj node object to describe\n * @param {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} nodeRef node reference object\n * @returns {string} a table-row of the node in markdown\n */\nexport function getTableRowMd(\n nodeObj: NodeSkeleton,\n nodeRef?: NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface\n): string {\n const row = `| ${nodeRef ? nodeRef.displayName : ''} | ${\n nodeObj._type._id\n } | ${getNodeClassificationMd(nodeObj._type._id).join('<br>')} | \\`${\n nodeObj._id\n }\\` |`;\n return row;\n}\n"],"mappings":"AAKA,SAASA,IAAI,EAAEC,KAAK,QAAQ,uBAAuB;;AAEnD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,QAAgB,EAAY;EAChE,OAAOH,IAAI,CAACE,qBAAqB,CAACC,QAAQ,CAAC,CAACC,GAAG,CAAEC,EAAE,IAAK;IACtD,QAAQA,EAAE;MACR,KAAKJ,KAAK,CAACK,kBAAkB,CAACC,QAAQ;QACpC,OAAOF,EAAE,CAACG,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;MAErC,KAAKP,KAAK,CAACK,kBAAkB,CAACG,KAAK;QACjC,OAAOJ,EAAE,CAACG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC;MAEvC,KAAKP,KAAK,CAACK,kBAAkB,CAACI,MAAM;QAClC,OAAOL,EAAE,CAACG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;MAEnC,KAAKP,KAAK,CAACK,kBAAkB,CAACK,OAAO;QACnC,OAAON,EAAE,CAACG,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;IACxC;EACF,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,uBAAuBA,CAACT,QAAgB,EAAY;EAClE,OAAOH,IAAI,CAACE,qBAAqB,CAACC,QAAQ,CAAC,CAACC,GAAG,CAAEC,EAAE,IAAK;IACtD,QAAQA,EAAE;MACR,KAAKJ,KAAK,CAACK,kBAAkB,CAACC,QAAQ;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ACA;AACA;AACA,OAAO,SAASM,gBAAgBA,CAAA,EAAW;EACzC,IAAIC,QAAQ,GAAG,EAAE;EACjBA,QAAQ,IAAI,iDAAiD;EAC7DA,QAAQ,IAAI,+CAA+C;EAC3D,OAAOA,QAAQ;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAC3BV,OAAqB,EACrBC,OAAkE,EAC1D;EACR,MAAMU,GAAG,GAAI,KAAIV,OAAO,GAAGA,OAAO,CAACK,WAAW,GAAG,EAAG,MAClDN,OAAO,CAACI,KAAK,CAACD,GACf,MAAKL,uBAAuB,CAACE,OAAO,CAACI,KAAK,CAACD,GAAG,CAAC,CAACE,IAAI,CAAC,MAAM,CAAE,QAC5DL,OAAO,CAACG,GACT,MAAK;EACN,OAAOQ,GAAG;AACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2ClientOps.js","names":["fs","OAuth2Client","ExportImportUtils","Utils","state","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","getTypedFilename","titleCase","getOAuth2Clients","exportOAuth2Client","exportOAuth2Clients","importOAuth2Client","importFirstOAuth2Client","importOAuth2Clients","getRealmName","listOAuth2Clients","long","clients","sort","a","b","_id","localeCompare","table","grantTypesMap","authorization_code","client_credentials","refresh_token","password","implicit","forEach","client","push","coreOAuth2ClientConfig","status","brightRed","clientType","advancedOAuth2ClientConfig","grantTypes","map","type","join","scopes","redirectionUris","toString","error","exportOAuth2ClientToFile","clientId","file","options","useStringArrays","deps","outcome","fileName","exportData","message","exportOAuth2ClientsToFile","getRealm","exportOAuth2ClientsToFiles","errors","length","importOAuth2ClientFromFile","data","readFileSync","fileData","JSON","parse","importFirstOAuth2ClientFromFile","importOAuth2ClientsFromFile","applicationData","importOAuth2ClientsFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","application"],"sources":["ops/OAuth2ClientOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n OAuth2Client,\n ExportImportUtils,\n Utils,\n state,\n} from '@rockcarver/frodo-lib';\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport {\n OAuth2ClientExportInterface,\n OAuth2ClientExportOptions,\n OAuth2ClientImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OAuth2ClientOps';\n\nconst { getTypedFilename, titleCase } = ExportImportUtils;\nconst {\n getOAuth2Clients,\n exportOAuth2Client,\n exportOAuth2Clients,\n importOAuth2Client,\n importFirstOAuth2Client,\n importOAuth2Clients,\n} = OAuth2Client;\nconst { getRealmName } = Utils;\n\n/**\n * List OAuth2 clients\n */\nexport async function listOAuth2Clients(long = false) {\n try {\n const clients = await getOAuth2Clients();\n clients.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable([\n 'Client Id',\n 'Status',\n 'Client Type',\n 'Grant Types',\n 'Scopes',\n 'Redirect URIs',\n // 'Description',\n ]);\n const grantTypesMap = {\n authorization_code: 'Authz Code',\n client_credentials: 'Client Creds',\n refresh_token: 'Refresh Token',\n password: 'ROPC',\n 'urn:ietf:params:oauth:grant-type:uma-ticket': 'UMA',\n implicit: 'Implicit',\n 'urn:ietf:params:oauth:grant-type:device_code': 'Device Code',\n 'urn:ietf:params:oauth:grant-type:saml2-bearer': 'SAML2 Bearer',\n 'urn:openid:params:grant-type:ciba': 'CIBA',\n 'urn:ietf:params:oauth:grant-type:token-exchange': 'Token Exchange',\n 'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer',\n };\n clients.forEach((client) => {\n table.push([\n client._id,\n client.coreOAuth2ClientConfig.status === 'Active'\n ? 'Active'['brightGreen']\n : client.coreOAuth2ClientConfig.status.brightRed,\n client.coreOAuth2ClientConfig.clientType,\n client.advancedOAuth2ClientConfig.grantTypes\n .map((type) => grantTypesMap[type])\n .join('\\n'),\n client.coreOAuth2ClientConfig.scopes.join('\\n'),\n client.coreOAuth2ClientConfig.redirectionUris.join('\\n'),\n // wordwrap(client.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n clients.forEach((client) => {\n printMessage(`${client._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Export OAuth2 client to file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientToFile(\n clientId: string,\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: begin`);\n showSpinner(`Exporting ${clientId}...`);\n try {\n let fileName = getTypedFilename(clientId, 'oauth2.app');\n if (file) {\n fileName = file;\n }\n const exportData = await exportOAuth2Client(clientId, options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${clientId} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${clientId}: ${error.message}`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: end`);\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to file\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFile(\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: begin`);\n showSpinner(`Exporting all clients...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Applications`,\n 'oauth2.app'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportOAuth2Clients(options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all clients to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all clients`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(\n `cli.OAuth2ClientOps.exportOAuth2ClientsToFile: end [${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to separate files\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFiles(\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: begin`);\n const errors = [];\n try {\n const clients = await getOAuth2Clients();\n createProgressBar(clients.length, 'Exporting clients...');\n for (const client of clients) {\n const file = getTypedFilename(client._id, 'oauth2.app');\n try {\n const exportData: OAuth2ClientExportInterface =\n await exportOAuth2Client(client._id, options);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${client._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${client._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting client(s) to file(s)`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientFromFile(\n clientId: string,\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${clientId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importOAuth2Client(clientId, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${clientId}.`);\n } catch (error) {\n failSpinner(`Error importing ${clientId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstOAuth2ClientFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstOAuth2Client(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const applicationData = JSON.parse(data);\n await importOAuth2Clients(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from files\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFiles(\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.oauth2.app.json')\n );\n createProgressBar(files.length, 'Importing clients...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: OAuth2ClientExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await importOAuth2Clients(fileData, options);\n updateProgressBar(`Imported ${count} client(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing client(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} client(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing client(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAC9B,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAM;EAAEC,gBAAgB;EAAEC;AAAU,CAAC,GAAGd,iBAAiB;AACzD,MAAM;EACJe,gBAAgB;EAChBC,kBAAkB;EAClBC,mBAAmB;EACnBC,kBAAkB;EAClBC,uBAAuB;EACvBC;AACF,CAAC,GAAGrB,YAAY;AAChB,MAAM;EAAEsB;AAAa,CAAC,GAAGpB,KAAK;;AAE9B;AACA;AACA;AACA,OAAO,eAAeqB,iBAAiB,CAACC,IAAI,GAAG,KAAK,EAAE;EACpD,IAA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5C7C,iBAAiB,CAAE,YAAW2E,KAAM,mBAAkB/B,IAAK,EAAC,CAAC;MAC/D,CAAC,CAAC,OAAOH,KAAK,EAAE;QACdc,MAAM,CAAC3B,IAAI,CAACa,KAAK,CAAC;QAClBzC,iBAAiB,CAAE,kCAAiC4C,IAAK,EAAC,CAAC;QAC3DhD,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA3C,eAAe,CACZ,sBAAqB4E,KAAM,mBAAkBL,KAAK,CAACb,MAAO,WAAU,CACtE;EACH,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdc,MAAM,CAAC3B,IAAI,CAACa,KAAK,CAAC;IAClB3C,eAAe,CAAE,yCAAwC,CAAC;IAC1DF,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA/C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK6D,MAAM,CAACC,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"OAuth2ClientOps.js","names":["fs","OAuth2Client","ExportImportUtils","Utils","state","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","getTypedFilename","titleCase","getOAuth2Clients","exportOAuth2Client","exportOAuth2Clients","importOAuth2Client","importFirstOAuth2Client","importOAuth2Clients","getRealmName","listOAuth2Clients","long","clients","sort","a","b","_id","localeCompare","table","grantTypesMap","authorization_code","client_credentials","refresh_token","password","implicit","forEach","client","push","coreOAuth2ClientConfig","status","brightRed","clientType","advancedOAuth2ClientConfig","grantTypes","map","type","join","scopes","redirectionUris","toString","error","exportOAuth2ClientToFile","clientId","file","options","useStringArrays","deps","outcome","fileName","exportData","message","exportOAuth2ClientsToFile","getRealm","exportOAuth2ClientsToFiles","errors","length","importOAuth2ClientFromFile","data","readFileSync","fileData","JSON","parse","importFirstOAuth2ClientFromFile","importOAuth2ClientsFromFile","applicationData","importOAuth2ClientsFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","application"],"sources":["ops/OAuth2ClientOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n OAuth2Client,\n ExportImportUtils,\n Utils,\n state,\n} from '@rockcarver/frodo-lib';\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport {\n OAuth2ClientExportInterface,\n OAuth2ClientExportOptions,\n OAuth2ClientImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OAuth2ClientOps';\n\nconst { getTypedFilename, titleCase } = ExportImportUtils;\nconst {\n getOAuth2Clients,\n exportOAuth2Client,\n exportOAuth2Clients,\n importOAuth2Client,\n importFirstOAuth2Client,\n importOAuth2Clients,\n} = OAuth2Client;\nconst { getRealmName } = Utils;\n\n/**\n * List OAuth2 clients\n */\nexport async function listOAuth2Clients(long = false) {\n try {\n const clients = await getOAuth2Clients();\n clients.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable([\n 'Client Id',\n 'Status',\n 'Client Type',\n 'Grant Types',\n 'Scopes',\n 'Redirect URIs',\n // 'Description',\n ]);\n const grantTypesMap = {\n authorization_code: 'Authz Code',\n client_credentials: 'Client Creds',\n refresh_token: 'Refresh Token',\n password: 'ROPC',\n 'urn:ietf:params:oauth:grant-type:uma-ticket': 'UMA',\n implicit: 'Implicit',\n 'urn:ietf:params:oauth:grant-type:device_code': 'Device Code',\n 'urn:ietf:params:oauth:grant-type:saml2-bearer': 'SAML2 Bearer',\n 'urn:openid:params:grant-type:ciba': 'CIBA',\n 'urn:ietf:params:oauth:grant-type:token-exchange': 'Token Exchange',\n 'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer',\n };\n clients.forEach((client) => {\n table.push([\n client._id,\n client.coreOAuth2ClientConfig.status === 'Active'\n ? 'Active'['brightGreen']\n : client.coreOAuth2ClientConfig.status.brightRed,\n client.coreOAuth2ClientConfig.clientType,\n client.advancedOAuth2ClientConfig.grantTypes\n .map((type) => grantTypesMap[type])\n .join('\\n'),\n client.coreOAuth2ClientConfig.scopes.join('\\n'),\n client.coreOAuth2ClientConfig.redirectionUris.join('\\n'),\n // wordwrap(client.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n clients.forEach((client) => {\n printMessage(`${client._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Export OAuth2 client to file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientToFile(\n clientId: string,\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: begin`);\n showSpinner(`Exporting ${clientId}...`);\n try {\n let fileName = getTypedFilename(clientId, 'oauth2.app');\n if (file) {\n fileName = file;\n }\n const exportData = await exportOAuth2Client(clientId, options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${clientId} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${clientId}: ${error.message}`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: end`);\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to file\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFile(\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: begin`);\n showSpinner(`Exporting all clients...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Applications`,\n 'oauth2.app'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportOAuth2Clients(options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all clients to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all clients`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(\n `cli.OAuth2ClientOps.exportOAuth2ClientsToFile: end [${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to separate files\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFiles(\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: begin`);\n const errors = [];\n try {\n const clients = await getOAuth2Clients();\n createProgressBar(clients.length, 'Exporting clients...');\n for (const client of clients) {\n const file = getTypedFilename(client._id, 'oauth2.app');\n try {\n const exportData: OAuth2ClientExportInterface =\n await exportOAuth2Client(client._id, options);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${client._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${client._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting client(s) to file(s)`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientFromFile(\n clientId: string,\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${clientId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importOAuth2Client(clientId, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${clientId}.`);\n } catch (error) {\n failSpinner(`Error importing ${clientId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstOAuth2ClientFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstOAuth2Client(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const applicationData = JSON.parse(data);\n await importOAuth2Clients(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from files\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFiles(\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.oauth2.app.json')\n );\n createProgressBar(files.length, 'Importing clients...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: OAuth2ClientExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await importOAuth2Clients(fileData, options);\n updateProgressBar(`Imported ${count} client(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing client(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} client(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing client(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAC9B,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAM;EAAEC,gBAAgB;EAAEC;AAAU,CAAC,GAAGd,iBAAiB;AACzD,MAAM;EACJe,gBAAgB;EAChBC,kBAAkB;EAClBC,mBAAmB;EACnBC,kBAAkB;EAClBC,uBAAuB;EACvBC;AACF,CAAC,GAAGrB,YAAY;AAChB,MAAM;EAAEsB;AAAa,CAAC,GAAGpB,KAAK;;AAE9B;AACA;AACA;AACA,OAAO,eA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,MAAM;QACtDkB,KAAK,IAAIC,KAAK;QACd,MAAMlE,mBAAmB,CAACmD,QAAQ,EAAEf,OAAO,CAAC;QAC5C7C,iBAAiB,CAAE,YAAW2E,KAAM,mBAAkB/B,IAAK,EAAC,CAAC;MAC/D,CAAC,CAAC,OAAOH,KAAK,EAAE;QACdc,MAAM,CAAC3B,IAAI,CAACa,KAAK,CAAC;QAClBzC,iBAAiB,CAAE,kCAAiC4C,IAAK,EAAC,CAAC;QAC3DhD,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA3C,eAAe,CACZ,sBAAqB4E,KAAM,mBAAkBL,KAAK,CAACb,MAAO,WAC7D,CAAC;EACH,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdc,MAAM,CAAC3B,IAAI,CAACa,KAAK,CAAC;IAClB3C,eAAe,CAAE,yCAAwC,CAAC;IAC1DF,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA/C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK6D,MAAM,CAACC,MAAM;AAC5B"}
|
package/esm/ops/PolicyOps.js
CHANGED
|
@@ -216,8 +216,9 @@ export async function deletePoliciesByPolicySet(policySetId) {
|
|
|
216
216
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
217
217
|
*/
|
|
218
218
|
export async function exportPolicyToFile(policyId, file, options = {
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
deps: true,
|
|
220
|
+
prereqs: false,
|
|
221
|
+
useStringArrays: true
|
|
221
222
|
}) {
|
|
222
223
|
let outcome = false;
|
|
223
224
|
debugMessage(`cli.PolicyOps.exportPolicyToFile: begin`);
|
|
@@ -245,8 +246,9 @@ export async function exportPolicyToFile(policyId, file, options = {
|
|
|
245
246
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
246
247
|
*/
|
|
247
248
|
export async function exportPoliciesToFile(file, options = {
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
deps: true,
|
|
250
|
+
prereqs: false,
|
|
251
|
+
useStringArrays: true
|
|
250
252
|
}) {
|
|
251
253
|
let outcome = false;
|
|
252
254
|
debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);
|
|
@@ -275,14 +277,15 @@ export async function exportPoliciesToFile(file, options = {
|
|
|
275
277
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
276
278
|
*/
|
|
277
279
|
export async function exportPoliciesByPolicySetToFile(policySetId, file, options = {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
deps: true,
|
|
281
|
+
prereqs: false,
|
|
282
|
+
useStringArrays: true
|
|
280
283
|
}) {
|
|
281
284
|
let outcome = false;
|
|
282
285
|
debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);
|
|
283
286
|
showSpinner(`Exporting all policy sets...`);
|
|
284
287
|
try {
|
|
285
|
-
let fileName = getTypedFilename(`all${titleCase(getRealmName(state.getRealm()))}Policies`, 'policy.authz');
|
|
288
|
+
let fileName = getTypedFilename(`all${titleCase(getRealmName(state.getRealm())) + titleCase(policySetId)}Policies`, 'policy.authz');
|
|
286
289
|
if (file) {
|
|
287
290
|
fileName = file;
|
|
288
291
|
}
|
|
@@ -303,8 +306,9 @@ export async function exportPoliciesByPolicySetToFile(policySetId, file, options
|
|
|
303
306
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
304
307
|
*/
|
|
305
308
|
export async function exportPoliciesToFiles(options = {
|
|
306
|
-
|
|
307
|
-
|
|
309
|
+
deps: true,
|
|
310
|
+
prereqs: false,
|
|
311
|
+
useStringArrays: true
|
|
308
312
|
}) {
|
|
309
313
|
debugMessage(`cli.PolicyOps.exportPoliciesToFiles: begin`);
|
|
310
314
|
const errors = [];
|
|
@@ -337,8 +341,9 @@ export async function exportPoliciesToFiles(options = {
|
|
|
337
341
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
338
342
|
*/
|
|
339
343
|
export async function exportPoliciesByPolicySetToFiles(policySetId, options = {
|
|
340
|
-
|
|
341
|
-
|
|
344
|
+
deps: true,
|
|
345
|
+
prereqs: false,
|
|
346
|
+
useStringArrays: true
|
|
342
347
|
}) {
|
|
343
348
|
debugMessage(`cli.PolicyOps.exportPoliciesToFiles: begin`);
|
|
344
349
|
const errors = [];
|
|
@@ -373,7 +378,8 @@ export async function exportPoliciesByPolicySetToFiles(policySetId, options = {
|
|
|
373
378
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
374
379
|
*/
|
|
375
380
|
export async function importPolicyFromFile(policyId, file, options = {
|
|
376
|
-
deps: true
|
|
381
|
+
deps: true,
|
|
382
|
+
prereqs: false
|
|
377
383
|
}) {
|
|
378
384
|
let outcome = false;
|
|
379
385
|
debugMessage(`cli.PolicyOps.importPolicyFromFile: begin`);
|
|
@@ -399,7 +405,8 @@ export async function importPolicyFromFile(policyId, file, options = {
|
|
|
399
405
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
400
406
|
*/
|
|
401
407
|
export async function importFirstPolicyFromFile(file, options = {
|
|
402
|
-
deps: true
|
|
408
|
+
deps: true,
|
|
409
|
+
prereqs: false
|
|
403
410
|
}) {
|
|
404
411
|
let outcome = false;
|
|
405
412
|
debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: begin`);
|
|
@@ -425,7 +432,8 @@ export async function importFirstPolicyFromFile(file, options = {
|
|
|
425
432
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
426
433
|
*/
|
|
427
434
|
export async function importPoliciesFromFile(file, options = {
|
|
428
|
-
deps: true
|
|
435
|
+
deps: true,
|
|
436
|
+
prereqs: false
|
|
429
437
|
}) {
|
|
430
438
|
let outcome = false;
|
|
431
439
|
debugMessage(`cli.PolicyOps.importPoliciesFromFile: begin`);
|
|
@@ -435,9 +443,9 @@ export async function importPoliciesFromFile(file, options = {
|
|
|
435
443
|
const fileData = JSON.parse(data);
|
|
436
444
|
await importPolicies(fileData, options);
|
|
437
445
|
outcome = true;
|
|
438
|
-
succeedSpinner(`Imported ${file}
|
|
446
|
+
succeedSpinner(`Imported ${file}${options.policySetName ? ' into policy set ' + options.policySetName : '.'}`);
|
|
439
447
|
} catch (error) {
|
|
440
|
-
failSpinner(`Error importing ${file}
|
|
448
|
+
failSpinner(`Error importing ${file}${options.policySetName ? ' into policy set ' + options.policySetName : '.'}`);
|
|
441
449
|
printMessage(error, 'error');
|
|
442
450
|
}
|
|
443
451
|
debugMessage(`cli.PolicyOps.importPoliciesFromFile: end`);
|
|
@@ -450,7 +458,8 @@ export async function importPoliciesFromFile(file, options = {
|
|
|
450
458
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
451
459
|
*/
|
|
452
460
|
export async function importPoliciesFromFiles(options = {
|
|
453
|
-
deps: true
|
|
461
|
+
deps: true,
|
|
462
|
+
prereqs: false
|
|
454
463
|
}) {
|
|
455
464
|
const errors = [];
|
|
456
465
|
try {
|