@rockcarver/frodo-cli 2.0.0-37 → 2.0.0-39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/esm/cli/_template/something-else-export.js +1 -1
- package/esm/cli/_template/something-else-export.js.map +1 -1
- package/esm/cli/_template/something-export.js +1 -1
- package/esm/cli/_template/something-export.js.map +1 -1
- package/esm/cli/_template/something-other-export.js +1 -1
- package/esm/cli/_template/something-other-export.js.map +1 -1
- package/esm/cli/admin/admin-federation-export.js +4 -4
- package/esm/cli/admin/admin-federation-export.js.map +1 -1
- package/esm/cli/agent/agent-export.js +4 -4
- package/esm/cli/agent/agent-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-export.js +4 -4
- package/esm/cli/agent/agent-gateway-export.js.map +1 -1
- package/esm/cli/agent/agent-java-export.js +4 -4
- package/esm/cli/agent/agent-java-export.js.map +1 -1
- package/esm/cli/agent/agent-web-export.js +4 -4
- package/esm/cli/agent/agent-web-export.js.map +1 -1
- package/esm/cli/app/app-export.js +4 -4
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/authn/authn-export.js +2 -2
- package/esm/cli/authn/authn-export.js.map +1 -1
- package/esm/cli/authz/authz-policy-export.js +6 -6
- package/esm/cli/authz/authz-policy-export.js.map +1 -1
- package/esm/cli/authz/authz-set-export.js +4 -4
- package/esm/cli/authz/authz-set-export.js.map +1 -1
- package/esm/cli/authz/authz-type-export.js +5 -5
- package/esm/cli/authz/authz-type-export.js.map +1 -1
- package/esm/cli/config/config-export.js +3 -3
- package/esm/cli/config/config-export.js.map +1 -1
- package/esm/cli/email/email-template-export.js +4 -4
- package/esm/cli/email/email-template-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-export.js +4 -4
- package/esm/cli/esv/esv-secret-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-list.js +2 -2
- package/esm/cli/esv/esv-secret-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-export.js +4 -4
- package/esm/cli/esv/esv-variable-export.js.map +1 -1
- package/esm/cli/esv/esv-variable-list.js +2 -2
- package/esm/cli/esv/esv-variable-list.js.map +1 -1
- package/esm/cli/idp/idp-export.js +4 -4
- package/esm/cli/idp/idp-export.js.map +1 -1
- package/esm/cli/journey/journey-describe.js +3 -1
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/journey/journey-export.js +4 -4
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/oauth/oauth-client-export.js +4 -4
- package/esm/cli/oauth/oauth-client-export.js.map +1 -1
- package/esm/cli/saml/saml-cot-export.js +4 -4
- package/esm/cli/saml/saml-cot-export.js.map +1 -1
- package/esm/cli/saml/saml-export.js +4 -4
- package/esm/cli/saml/saml-export.js.map +1 -1
- package/esm/cli/script/script-export.js +4 -4
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/script/script-list.js +2 -2
- package/esm/cli/script/script-list.js.map +1 -1
- package/esm/cli/service/service-export.js +4 -4
- package/esm/cli/service/service-export.js.map +1 -1
- package/esm/cli/theme/theme-export.js +5 -5
- package/esm/cli/theme/theme-export.js.map +1 -1
- package/esm/ops/AdminFederationOps.js +11 -7
- package/esm/ops/AdminFederationOps.js.map +1 -1
- package/esm/ops/AgentOps.js +39 -25
- package/esm/ops/AgentOps.js.map +1 -1
- package/esm/ops/ApplicationOps.js +11 -8
- package/esm/ops/ApplicationOps.js.map +1 -1
- package/esm/ops/AuthenticationSettingsOps.js +4 -3
- package/esm/ops/AuthenticationSettingsOps.js.map +1 -1
- package/esm/ops/CirclesOfTrustOps.js +12 -7
- package/esm/ops/CirclesOfTrustOps.js.map +1 -1
- package/esm/ops/ConfigOps.js +9 -7
- package/esm/ops/ConfigOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js +11 -7
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js +3 -2
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/IdpOps.js +14 -7
- package/esm/ops/IdpOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +15 -6
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/OAuth2ClientOps.js +10 -7
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +18 -11
- package/esm/ops/PolicyOps.js.map +1 -1
- package/esm/ops/PolicySetOps.js +12 -7
- package/esm/ops/PolicySetOps.js.map +1 -1
- package/esm/ops/ResourceTypeOps.js +15 -9
- package/esm/ops/ResourceTypeOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js +10 -7
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/ScriptOps.js +73 -36
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/SecretsOps.js +76 -48
- package/esm/ops/SecretsOps.js.map +1 -1
- package/esm/ops/ServiceOps.js +10 -9
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js +15 -9
- package/esm/ops/ThemeOps.js.map +1 -1
- package/esm/ops/VariablesOps.js +49 -23
- package/esm/ops/VariablesOps.js.map +1 -1
- package/esm/utils/Config.js +147 -1
- package/esm/utils/Config.js.map +1 -1
- package/package.json +2 -2
- package/esm/utils/ExportImportUtils.js +0 -48
- package/esm/utils/ExportImportUtils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-describe.js","names":["frodo","state","Option","fs","describeJourney","describeJourneyMd","printMessage","verboseMessage","saveTextToFile","FrodoCommand","getTokens","login","createFileParamTreeExportResolver","readJourneys","exportJourney","authn","journey","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getHost","outputFile","setOutputFile","file","process","exitCode","_fileData$tree","_fileData$tree2","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","markdown","error","message","getRealm","journeys","treeData"],"sources":["../../../src/cli/journey/journey-describe.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\nimport fs from 'fs';\n\nimport { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { saveTextToFile } from '../../utils/ExportImportUtils';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\nconst { createFileParamTreeExportResolver, readJourneys, exportJourney } =\n frodo.authn.journey;\n\nconst program = new FrodoCommand('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the journey export file to describe. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-F, --output-file <file>',\n 'Name of the file to write the output to.'\n )\n )\n .addOption(new Option('--markdown', 'Output in markdown.'))\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n host = host ? host : state.getHost();\n if (options.outputFile) state.setOutputFile(options.outputFile);\n // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n printMessage('Need either [host] or -f.', 'error');\n process.exitCode = 1;\n return;\n }\n verboseMessage(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n verboseMessage(\n `Describing journey(s) in realm \"${state.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys = [];\n journeys = await readJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AAEnB,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,sBAAsB;AACzE,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AACjC,MAAM;EAAEC,iCAAiC;EAAEC,YAAY;EAAEC;AAAc,CAAC,GACtEd,KAAK,CAACe,KAAK,CAACC,OAAO;AAErB,MAAMC,OAAO,GAAG,IAAIR,YAAY,CAAC,wBAAwB,CAAC;AAE1DQ,OAAO,CACJC,WAAW,CACV,yLACF,CAAC,CACAC,SAAS,CACR,IAAIjB,MAAM,CACR,4BAA4B,EAC5B,8DACF,CACF,CAAC,CACAiB,SAAS,CACR,IAAIjB,MAAM,CACR,mBAAmB,EACnB,+DACF,CACF,CAAC,CACAiB,SAAS,CACR,IAAIjB,MAAM,CACR,0BAA0B,EAC1B,0CACF,CACF,CAAC,CACAiB,SAAS,CAAC,IAAIjB,MAAM,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC,CAC1DiB,SAAS,CACR,IAAIjB,MAAM,CACR,kCAAkC,EAClC,iTACF,CACF,CAAC,CACAkB,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,E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,KAAK,CAACC,OAAO,EAAE,OAAO,CAAC;QACpCpB,OAAO,CAACC,QAAQ,GAAG,CAAC;MACtB;IACF;EACF;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"journey-describe.js","names":["frodo","state","Option","fs","describeJourney","describeJourneyMd","printMessage","verboseMessage","FrodoCommand","saveTextToFile","utils","getTokens","login","createFileParamTreeExportResolver","readJourneys","exportJourney","authn","journey","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getHost","outputFile","setOutputFile","file","process","exitCode","_fileData$tree","_fileData$tree2","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","markdown","error","message","getRealm","journeys","treeData"],"sources":["../../../src/cli/journey/journey-describe.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\nimport fs from 'fs';\n\nimport { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { saveTextToFile } = frodo.utils;\nconst { getTokens } = frodo.login;\nconst { createFileParamTreeExportResolver, readJourneys, exportJourney } =\n frodo.authn.journey;\n\nconst program = new FrodoCommand('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the journey export file to describe. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-F, --output-file <file>',\n 'Name of the file to write the output to.'\n )\n )\n .addOption(new Option('--markdown', 'Output in markdown.'))\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n host = host ? host : state.getHost();\n if (options.outputFile) state.setOutputFile(options.outputFile);\n // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n printMessage('Need either [host] or -f.', 'error');\n process.exitCode = 1;\n return;\n }\n verboseMessage(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n verboseMessage(\n `Describing journey(s) in realm \"${state.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys = [];\n journeys = await readJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AAEnB,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,sBAAsB;AACzE,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAe,CAAC,GAAGT,KAAK,CAACU,KAAK;AACtC,MAAM;EAAEC;AAAU,CAAC,GAAGX,KAAK,CAACY,KAAK;AACjC,MAAM;EAAEC,iCAAiC;EAAEC,YAAY;EAAEC;AAAc,CAAC,GACtEf,KAAK,CAACgB,KAAK,CAACC,OAAO;AAErB,MAAMC,OAAO,GAAG,IAAIV,YAAY,CAAC,wBAAwB,CAAC;AA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,CAAC,CAAC,OAAOJ,KAAK,EAAE;UACd9C,YAAY,CAAC8C,KAAK,CAACC,OAAO,EAAE,OAAO,CAAC;UACpCpB,OAAO,CAACC,QAAQ,GAAG,CAAC;QACtB;MACF;IACF,CAAC,MAAM;MACL,IAAI;QACF,MAAMsB,QAAQ,GAAG,MAAMzC,aAAa,CAACW,OAAO,CAACkB,SAAS,CAAC;QACvD;QACA,IAAI,CAAClB,OAAO,CAACyB,QAAQ,EAAE;UACrB,MAAM/C,eAAe,CAACoD,QAAQ,CAAC;QACjC;QACA;QAAA,KACK;UACH;UACA,IAAI9B,OAAO,CAACI,UAAU,EAAErB,cAAc,CAAC,EAAE,EAAEiB,OAAO,CAACI,UAAU,CAAC;UAC9D,MAAMzB,iBAAiB,CAACmD,QAAQ,CAAC;QACnC;MACF,CAAC,CAAC,OAAOJ,KAAK,EAAE;QACd9C,YAAY,CAAC8C,KAAK,CAACC,OAAO,EAAE,OAAO,CAAC;QACpCpB,OAAO,CAACC,QAAQ,GAAG,CAAC;MACtB;IACF;EACF;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
getTokens
|
|
8
8
|
} = frodo.login;
|
|
9
9
|
const program = new FrodoCommand('frodo journey export');
|
|
10
|
-
program.description('Export journeys/trees.').addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to write the exported journey(s) to. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all the journeys/trees in a realm. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.')).addOption(new Option('--use-string-arrays', 'Where applicable, use string arrays to store multi-line text (e.g. scripts).').default(false, 'off')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'))
|
|
10
|
+
program.description('Export journeys/trees.').addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to write the exported journey(s) to. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all the journeys/trees in a realm. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).addOption(new Option('--use-string-arrays', 'Where applicable, use string arrays to store multi-line text (e.g. scripts).').default(false, 'off')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'))
|
|
11
11
|
// .addOption(
|
|
12
12
|
// new Option(
|
|
13
13
|
// '-O, --organize <method>',
|
|
@@ -24,7 +24,7 @@ async (host, realm, user, password, options, command) => {
|
|
|
24
24
|
// export
|
|
25
25
|
if (options.journeyId && (await getTokens())) {
|
|
26
26
|
verboseMessage('Exporting journey...');
|
|
27
|
-
await exportJourneyToFile(options.journeyId, options.file, {
|
|
27
|
+
await exportJourneyToFile(options.journeyId, options.file, options.metadata, {
|
|
28
28
|
useStringArrays: options.useStringArrays,
|
|
29
29
|
deps: options.deps
|
|
30
30
|
});
|
|
@@ -32,7 +32,7 @@ async (host, realm, user, password, options, command) => {
|
|
|
32
32
|
// --all -a
|
|
33
33
|
else if (options.all && (await getTokens())) {
|
|
34
34
|
verboseMessage('Exporting all journeys to a single file...');
|
|
35
|
-
await exportJourneysToFile(options.file, {
|
|
35
|
+
await exportJourneysToFile(options.file, options.metadata, {
|
|
36
36
|
useStringArrays: options.useStringArrays,
|
|
37
37
|
deps: options.deps
|
|
38
38
|
});
|
|
@@ -40,7 +40,7 @@ async (host, realm, user, password, options, command) => {
|
|
|
40
40
|
// --all-separate -A
|
|
41
41
|
else if (options.allSeparate && (await getTokens())) {
|
|
42
42
|
verboseMessage('Exporting all journeys to separate files...');
|
|
43
|
-
await exportJourneysToFiles({
|
|
43
|
+
await exportJourneysToFiles(options.metadata, {
|
|
44
44
|
useStringArrays: options.useStringArrays,
|
|
45
45
|
deps: options.deps
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-export.js","names":["frodo","Option","exportJourneysToFile","exportJourneysToFiles","exportJourneyToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","journeyId","file","useStringArrays","deps","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/journey/journey-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportJourneysToFile,\n exportJourneysToFiles,\n exportJourneyToFile,\n} from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo journey export');\n\nprogram\n .description('Export journeys/trees.')\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to write the exported journey(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the journeys/trees in a realm. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '--use-string-arrays',\n 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--no-deps',\n 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'\n )\n )\n // .addOption(\n // new Option(\n // '-O, --organize <method>',\n // 'Organize exports into folders using the indicated method. Valid values for method:\\n' +\n // 'id: folders named by id of exported object\\n' +\n // 'type: folders named by type (e.g. script, journey, idp)\\n' +\n // 'type/id: folders named by type with sub-folders named by id'\n // )\n // )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.journeyId && (await getTokens())) {\n verboseMessage('Exporting journey...');\n await exportJourneyToFile(options.journeyId
|
|
1
|
+
{"version":3,"file":"journey-export.js","names":["frodo","Option","exportJourneysToFile","exportJourneysToFiles","exportJourneyToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","journeyId","file","metadata","useStringArrays","deps","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/journey/journey-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportJourneysToFile,\n exportJourneysToFiles,\n exportJourneyToFile,\n} from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo journey export');\n\nprogram\n .description('Export journeys/trees.')\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to write the exported journey(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the journeys/trees in a realm. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n .addOption(\n new Option(\n '--use-string-arrays',\n 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--no-deps',\n 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'\n )\n )\n // .addOption(\n // new Option(\n // '-O, --organize <method>',\n // 'Organize exports into folders using the indicated method. Valid values for method:\\n' +\n // 'id: folders named by id of exported object\\n' +\n // 'type: folders named by type (e.g. script, journey, idp)\\n' +\n // 'type/id: folders named by type with sub-folders named by id'\n // )\n // )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.journeyId && (await getTokens())) {\n verboseMessage('Exporting journey...');\n await exportJourneyToFile(\n options.journeyId,\n options.file,\n options.metadata,\n {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n }\n );\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all journeys to a single file...');\n await exportJourneysToFile(options.file, options.metadata, {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all journeys to separate files...');\n await exportJourneysToFiles(options.metadata, {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,mBAAmB,QACd,sBAAsB;AAC7B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAExDG,OAAO,CACJC,W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oBAAoB,CAACiB,OAAO,CAACI,IAAI,EAAEJ,OAAO,CAACK,QAAQ,EAAE;MACzDC,eAAe,EAAEN,OAAO,CAACM,eAAe;MACxCC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIP,OAAO,CAACS,WAAW,KAAK,MAAMpB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,6CAA6C,CAAC;IAC7D,MAAMH,qBAAqB,CAACgB,OAAO,CAACK,QAAQ,EAAE;MAC5CC,eAAe,EAAEN,OAAO,CAACM,eAAe;MACxCC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK;IACHrB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACmB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHrB,OAAO,CAACsB,KAAK,CAAC,CAAC"}
|
|
@@ -7,14 +7,14 @@ const {
|
|
|
7
7
|
getTokens
|
|
8
8
|
} = frodo.login;
|
|
9
9
|
const program = new FrodoCommand('frodo oauth client export');
|
|
10
|
-
program.description('Export OAuth2 applications.').addOption(new Option('-i, --app-id <app-id>', 'App id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all OAuth2 apps to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts).')).action(
|
|
10
|
+
program.description('Export OAuth2 applications.').addOption(new Option('-i, --app-id <app-id>', 'App id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all OAuth2 apps to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts).')).action(
|
|
11
11
|
// implement command logic inside action handler
|
|
12
12
|
async (host, realm, user, password, options, command) => {
|
|
13
13
|
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
14
|
// export
|
|
15
15
|
if (options.appId && (await getTokens())) {
|
|
16
16
|
verboseMessage('Exporting OAuth2 application...');
|
|
17
|
-
const status = await exportOAuth2ClientToFile(options.appId, options.file, {
|
|
17
|
+
const status = await exportOAuth2ClientToFile(options.appId, options.file, options.metadata, {
|
|
18
18
|
useStringArrays: true,
|
|
19
19
|
deps: options.deps
|
|
20
20
|
});
|
|
@@ -23,7 +23,7 @@ async (host, realm, user, password, options, command) => {
|
|
|
23
23
|
// -a/--all
|
|
24
24
|
else if (options.all && (await getTokens())) {
|
|
25
25
|
verboseMessage('Exporting all OAuth2 applications to file...');
|
|
26
|
-
const status = await exportOAuth2ClientsToFile(options.file, {
|
|
26
|
+
const status = await exportOAuth2ClientsToFile(options.file, options.metadata, {
|
|
27
27
|
useStringArrays: true,
|
|
28
28
|
deps: options.deps
|
|
29
29
|
});
|
|
@@ -32,7 +32,7 @@ async (host, realm, user, password, options, command) => {
|
|
|
32
32
|
// -A/--all-separate
|
|
33
33
|
else if (options.allSeparate && (await getTokens())) {
|
|
34
34
|
verboseMessage('Exporting all applications to separate files...');
|
|
35
|
-
const status = await exportOAuth2ClientsToFiles({
|
|
35
|
+
const status = await exportOAuth2ClientsToFiles(options.metadata, {
|
|
36
36
|
useStringArrays: true,
|
|
37
37
|
deps: options.deps
|
|
38
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-client-export.js","names":["frodo","Option","exportOAuth2ClientsToFile","exportOAuth2ClientsToFiles","exportOAuth2ClientToFile","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","file","useStringArrays","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/oauth/oauth-client-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportOAuth2ClientsToFile,\n exportOAuth2ClientsToFiles,\n exportOAuth2ClientToFile,\n} from '../../ops/OAuth2ClientOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo oauth client export');\n\nprogram\n .description('Export OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <app-id>',\n 'App id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all OAuth2 apps to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.appId && (await getTokens())) {\n verboseMessage('Exporting OAuth2 application...');\n const status = await exportOAuth2ClientToFile(\n options.appId,\n options.file,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all OAuth2 applications to file...');\n const status = await exportOAuth2ClientsToFile(options.file
|
|
1
|
+
{"version":3,"file":"oauth-client-export.js","names":["frodo","Option","exportOAuth2ClientsToFile","exportOAuth2ClientsToFiles","exportOAuth2ClientToFile","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","file","metadata","useStringArrays","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/oauth/oauth-client-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportOAuth2ClientsToFile,\n exportOAuth2ClientsToFiles,\n exportOAuth2ClientToFile,\n} from '../../ops/OAuth2ClientOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo oauth client export');\n\nprogram\n .description('Export OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <app-id>',\n 'App id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all OAuth2 apps to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.appId && (await getTokens())) {\n verboseMessage('Exporting OAuth2 application...');\n const status = await exportOAuth2ClientToFile(\n options.appId,\n options.file,\n options.metadata,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all OAuth2 applications to file...');\n const status = await exportOAuth2ClientsToFile(\n options.file,\n options.metadata,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -A/--all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all applications to separate files...');\n const status = await exportOAuth2ClientsToFiles(options.metadata, {\n useStringArrays: true,\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,wBAAwB,QACnB,2BAA2B;AAClC,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAACQ,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,2BAA2B,CAAC;AAE7DG,OAAO,CACJC,WAAW,CAAC,6BAA6B,CAAC,CAC1CC,SAAS,CACR,IAAIV,MAAM,CACR,uBAAuB,EACvB,8CACF,CACF,CAAC,CACAU,SAAS,CAAC,IAAIV,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,2DACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,oBAAoB,EACpB,+GACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,mBAAmB,EACnB,+CACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CAAC,WAAW,EAAE,4CAA4C,CACtE,CAAC,CACAW,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD;EACA,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lB,OAAO,CAACsB,KAAK,CAAC,CAAC"}
|
|
@@ -7,26 +7,26 @@ const {
|
|
|
7
7
|
getTokens
|
|
8
8
|
} = frodo.login;
|
|
9
9
|
const program = new FrodoCommand('frodo saml cot export');
|
|
10
|
-
program.description('Export SAML circles of trust.').addOption(new Option('-i, --cot-id <cot-id>', 'Circle of trust id/name. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the export file. Ignored with -A. Defaults to <cot-id>.cot.saml.json.')).addOption(new Option('-a, --all', 'Export all the circles of trust in a realm to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all the circles of trust in a realm as separate files <cot-id>.cot.saml.json. Ignored with -i, and -a.')).action(
|
|
10
|
+
program.description('Export SAML circles of trust.').addOption(new Option('-i, --cot-id <cot-id>', 'Circle of trust id/name. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the export file. Ignored with -A. Defaults to <cot-id>.cot.saml.json.')).addOption(new Option('-a, --all', 'Export all the circles of trust in a realm to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all the circles of trust in a realm as separate files <cot-id>.cot.saml.json. Ignored with -i, and -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).action(
|
|
11
11
|
// implement command logic inside action handler
|
|
12
12
|
async (host, realm, user, password, options, command) => {
|
|
13
13
|
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
14
|
// export by id/name
|
|
15
15
|
if (options.cotId && (await getTokens())) {
|
|
16
16
|
verboseMessage(`Exporting circle of trust "${options.cotId}" from realm "${state.getRealm()}"...`);
|
|
17
|
-
const outcome = await exportCircleOfTrustToFile(options.cotId, options.file);
|
|
17
|
+
const outcome = await exportCircleOfTrustToFile(options.cotId, options.file, options.metadata);
|
|
18
18
|
if (!outcome) process.exitCode = 1;
|
|
19
19
|
}
|
|
20
20
|
// --all -a
|
|
21
21
|
else if (options.all && (await getTokens())) {
|
|
22
22
|
verboseMessage('Exporting all circles of trust to a single file...');
|
|
23
|
-
const outcome = await exportCirclesOfTrustToFile(options.file);
|
|
23
|
+
const outcome = await exportCirclesOfTrustToFile(options.file, options.metadata);
|
|
24
24
|
if (!outcome) process.exitCode = 1;
|
|
25
25
|
}
|
|
26
26
|
// --all-separate -A
|
|
27
27
|
else if (options.allSeparate && (await getTokens())) {
|
|
28
28
|
verboseMessage('Exporting all circles of trust to separate files...');
|
|
29
|
-
const outcome = await exportCirclesOfTrustToFiles();
|
|
29
|
+
const outcome = await exportCirclesOfTrustToFiles(options.metadata);
|
|
30
30
|
if (!outcome) process.exitCode = 1;
|
|
31
31
|
}
|
|
32
32
|
// unrecognized combination of options or no options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saml-cot-export.js","names":["frodo","state","Option","exportCircleOfTrustToFile","exportCirclesOfTrustToFile","exportCirclesOfTrustToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","cotId","getRealm","outcome","file","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/saml/saml-cot-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportCircleOfTrustToFile,\n exportCirclesOfTrustToFile,\n exportCirclesOfTrustToFiles,\n} from '../../ops/CirclesOfTrustOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo saml cot export');\n\nprogram\n .description('Export SAML circles of trust.')\n .addOption(\n new Option(\n '-i, --cot-id <cot-id>',\n 'Circle of trust id/name. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the export file. Ignored with -A. Defaults to <cot-id>.cot.saml.json.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the circles of trust in a realm to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the circles of trust in a realm as separate files <cot-id>.cot.saml.json. Ignored with -i, and -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by id/name\n if (options.cotId && (await getTokens())) {\n verboseMessage(\n `Exporting circle of trust \"${\n options.cotId\n }\" from realm \"${state.getRealm()}\"...`\n );\n const outcome = await exportCircleOfTrustToFile(\n options.cotId,\n options.file\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all circles of trust to a single file...');\n const outcome = await exportCirclesOfTrustToFile(options.file);\n if (!outcome) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all circles of trust to separate files...');\n const outcome = await exportCirclesOfTrustToFiles();\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,2BAA2B,QACtB,6BAA6B;AACpC,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,uBAAuB,CAAC;AAEzDG,OAAO,CACJC,WAAW,CAAC,+BAA+B,CAAC,CAC5CC,SAAS,CACR,IAAIX,MAAM,CACR,uBAAuB,EACvB,+DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,+EACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,+EACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,+GACF,CACF,CAAC,CACAY,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD;EACA,IAAID,OAAO,CAACG,KAAK,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IACxCF,cAAc,CACX,8BACCY,OAAO,CAACG,KACT,iBAAgBrB,KAAK,CAACsB,QAAQ,CAAC,CAAE,MACpC,CAAC;IACD,MAAMC,OAAO,GAAG,MAAMrB,yBAAyB,CAC7CgB,OAAO,CAACG,KAAK,EACbH,OAAO,CAACM,
|
|
1
|
+
{"version":3,"file":"saml-cot-export.js","names":["frodo","state","Option","exportCircleOfTrustToFile","exportCirclesOfTrustToFile","exportCirclesOfTrustToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","cotId","getRealm","outcome","file","metadata","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/saml/saml-cot-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportCircleOfTrustToFile,\n exportCirclesOfTrustToFile,\n exportCirclesOfTrustToFiles,\n} from '../../ops/CirclesOfTrustOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo saml cot export');\n\nprogram\n .description('Export SAML circles of trust.')\n .addOption(\n new Option(\n '-i, --cot-id <cot-id>',\n 'Circle of trust id/name. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the export file. Ignored with -A. Defaults to <cot-id>.cot.saml.json.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the circles of trust in a realm to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the circles of trust in a realm as separate files <cot-id>.cot.saml.json. Ignored with -i, and -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by id/name\n if (options.cotId && (await getTokens())) {\n verboseMessage(\n `Exporting circle of trust \"${\n options.cotId\n }\" from realm \"${state.getRealm()}\"...`\n );\n const outcome = await exportCircleOfTrustToFile(\n options.cotId,\n options.file,\n options.metadata\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all circles of trust to a single file...');\n const outcome = await exportCirclesOfTrustToFile(\n options.file,\n options.metadata\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all circles of trust to separate files...');\n const outcome = await exportCirclesOfTrustToFiles(options.metadata);\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,2BAA2B,QACtB,6BAA6B;AACpC,SAASC,YAAY,EA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c,CAAC,oDAAoD,CAAC;IACpE,MAAMiB,OAAO,GAAG,MAAMpB,0BAA0B,CAC9Ce,OAAO,CAACM,IAAI,EACZN,OAAO,CAACO,QACV,CAAC;IACD,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIT,OAAO,CAACW,WAAW,KAAK,MAAMrB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,qDAAqD,CAAC;IACrE,MAAMiB,OAAO,GAAG,MAAMnB,2BAA2B,CAACc,OAAO,CAACO,QAAQ,CAAC;IACnE,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHtB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACoB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHjB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
|
|
@@ -7,24 +7,24 @@ const {
|
|
|
7
7
|
getTokens
|
|
8
8
|
} = frodo.login;
|
|
9
9
|
const program = new FrodoCommand('frodo saml export');
|
|
10
|
-
program.description('Export SAML entity providers.').addOption(new Option('-i, --entity-id <entity-id>', 'Entity id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the file to write the exported provider(s) to. Ignored with -A. If not specified, the export file is named <id>.saml.json.')).addOption(new Option('-a, --all', 'Export all the providers in a realm to a single file. Ignored with -t and -i.')).addOption(new Option('-A, --all-separate', 'Export all the providers in a realm as separate files <provider name>.saml.json. Ignored with -t, -i, and -a.')).action(
|
|
10
|
+
program.description('Export SAML entity providers.').addOption(new Option('-i, --entity-id <entity-id>', 'Entity id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the file to write the exported provider(s) to. Ignored with -A. If not specified, the export file is named <id>.saml.json.')).addOption(new Option('-a, --all', 'Export all the providers in a realm to a single file. Ignored with -t and -i.')).addOption(new Option('-A, --all-separate', 'Export all the providers in a realm as separate files <provider name>.saml.json. Ignored with -t, -i, and -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).action(
|
|
11
11
|
// implement command logic inside action handler
|
|
12
12
|
async (host, realm, user, password, options, command) => {
|
|
13
13
|
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
14
|
// export by id/name
|
|
15
15
|
if (options.entityId && (await getTokens())) {
|
|
16
16
|
verboseMessage(`Exporting provider "${options.entityId}" from realm "${state.getRealm()}"...`);
|
|
17
|
-
await exportSaml2ProviderToFile(options.entityId, options.file);
|
|
17
|
+
await exportSaml2ProviderToFile(options.entityId, options.file, options.metadata);
|
|
18
18
|
}
|
|
19
19
|
// --all -a
|
|
20
20
|
else if (options.all && (await getTokens())) {
|
|
21
21
|
verboseMessage('Exporting all providers to a single file...');
|
|
22
|
-
await exportSaml2ProvidersToFile(options.file);
|
|
22
|
+
await exportSaml2ProvidersToFile(options.file, options.metadata);
|
|
23
23
|
}
|
|
24
24
|
// --all-separate -A
|
|
25
25
|
else if (options.allSeparate && (await getTokens())) {
|
|
26
26
|
verboseMessage('Exporting all providers to separate files...');
|
|
27
|
-
await exportSaml2ProvidersToFiles();
|
|
27
|
+
await exportSaml2ProvidersToFiles(options.metadata);
|
|
28
28
|
}
|
|
29
29
|
// unrecognized combination of options or no options
|
|
30
30
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saml-export.js","names":["frodo","state","Option","exportSaml2ProvidersToFile","exportSaml2ProvidersToFiles","exportSaml2ProviderToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","entityId","getRealm","file","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/saml/saml-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportSaml2ProvidersToFile,\n exportSaml2ProvidersToFiles,\n exportSaml2ProviderToFile,\n} from '../../ops/Saml2Ops';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo saml export');\n\nprogram\n .description('Export SAML entity providers.')\n .addOption(\n new Option(\n '-i, --entity-id <entity-id>',\n 'Entity id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the file to write the exported provider(s) to. Ignored with -A. If not specified, the export file is named <id>.saml.json.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the providers in a realm to a single file. Ignored with -t and -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the providers in a realm as separate files <provider name>.saml.json. Ignored with -t, -i, and -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by id/name\n if (options.entityId && (await getTokens())) {\n verboseMessage(\n `Exporting provider \"${\n options.entityId\n }\" from realm \"${state.getRealm()}\"...`\n );\n await exportSaml2ProviderToFile(options.entityId
|
|
1
|
+
{"version":3,"file":"saml-export.js","names":["frodo","state","Option","exportSaml2ProvidersToFile","exportSaml2ProvidersToFiles","exportSaml2ProviderToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","entityId","getRealm","file","metadata","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/saml/saml-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportSaml2ProvidersToFile,\n exportSaml2ProvidersToFiles,\n exportSaml2ProviderToFile,\n} from '../../ops/Saml2Ops';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo saml export');\n\nprogram\n .description('Export SAML entity providers.')\n .addOption(\n new Option(\n '-i, --entity-id <entity-id>',\n 'Entity id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the file to write the exported provider(s) to. Ignored with -A. If not specified, the export file is named <id>.saml.json.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the providers in a realm to a single file. Ignored with -t and -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the providers in a realm as separate files <provider name>.saml.json. Ignored with -t, -i, and -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by id/name\n if (options.entityId && (await getTokens())) {\n verboseMessage(\n `Exporting provider \"${\n options.entityId\n }\" from realm \"${state.getRealm()}\"...`\n );\n await exportSaml2ProviderToFile(\n options.entityId,\n options.file,\n options.metadata\n );\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all providers to a single file...');\n await exportSaml2ProvidersToFile(options.file, options.metadata);\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all providers to separate files...');\n await exportSaml2ProvidersToFiles(options.metadata);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,yBAAyB,QACpB,oBAAoB;AAC3B,SAASC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AAI,EAAEL,OAAO,CAACM,QAAQ,CAAC;EAClE;EACA;EAAA,KACK,IAAIN,OAAO,CAACQ,WAAW,KAAK,MAAMlB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,8CAA8C,CAAC;IAC9D,MAAMH,2BAA2B,CAACe,OAAO,CAACM,QAAQ,CAAC;EACrD;EACA;EAAA,KACK;IACHnB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACiB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHnB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
|
|
@@ -14,7 +14,7 @@ program.description('Export scripts.').addOption(new Option('-n, --script-name <
|
|
|
14
14
|
// 'Uuid of the script. If specified, -a and -A are ignored.'
|
|
15
15
|
// )
|
|
16
16
|
// )
|
|
17
|
-
.addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all scripts to a single file. Ignored with -n.')).addOption(new Option('-A, --all-separate', 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n or -a.'))
|
|
17
|
+
.addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all scripts to a single file. Ignored with -n.')).addOption(new Option('-A, --all-separate', 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n or -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.'))
|
|
18
18
|
// deprecated option
|
|
19
19
|
.addOption(new Option('-s, --script <script>', 'DEPRECATED! Use -n/--script-name instead. Name of the script.')).addOption(new Option('-x, --extract', 'Extract the script from the exported file, and save it to a separate file. Ignored with -n or -a.')).action(
|
|
20
20
|
// implement command logic inside action handler
|
|
@@ -30,18 +30,18 @@ async (host, realm, user, password, options, command) => {
|
|
|
30
30
|
// export by name
|
|
31
31
|
if (options.scriptName || options.script) {
|
|
32
32
|
verboseMessage('Exporting script...');
|
|
33
|
-
await exportScriptByNameToFile(options.scriptName || options.script, options.file);
|
|
33
|
+
await exportScriptByNameToFile(options.scriptName || options.script, options.file, options.metadata);
|
|
34
34
|
}
|
|
35
35
|
// -a / --all
|
|
36
36
|
else if (options.all) {
|
|
37
37
|
verboseMessage('Exporting all scripts to a single file...');
|
|
38
|
-
await exportScriptsToFile(options.file);
|
|
38
|
+
await exportScriptsToFile(options.file, options.metadata);
|
|
39
39
|
}
|
|
40
40
|
// -A / --all-separate
|
|
41
41
|
else if (options.allSeparate) {
|
|
42
42
|
verboseMessage('Exporting all scripts to separate files...');
|
|
43
43
|
// -x / --extract
|
|
44
|
-
await exportScriptsToFiles(options.extract);
|
|
44
|
+
await exportScriptsToFiles(options.extract, options.metadata);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// unrecognized combination of options or no options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-export.js","names":["frodo","Option","exportScriptByNameToFile","exportScriptsToFile","exportScriptsToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","tokens","help","process","exitCode","scriptName","script","file","all","allSeparate","extract","parse"],"sources":["../../../src/cli/script/script-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportScriptByNameToFile,\n exportScriptsToFile,\n exportScriptsToFiles,\n} from '../../ops/ScriptOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo script export');\n\nprogram\n .description('Export scripts.')\n .addOption(\n new Option(\n '-n, --script-name <name>',\n 'Name of the script. If specified, -a and -A are ignored.'\n )\n )\n // .addOption(\n // new Option(\n // '-i, --script-id <uuid>',\n // 'Uuid of the script. If specified, -a and -A are ignored.'\n // )\n // )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all scripts to a single file. Ignored with -n.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n or -a.'\n )\n )\n // deprecated option\n .addOption(\n new Option(\n '-s, --script <script>',\n 'DEPRECATED! Use -n/--script-name instead. Name of the script.'\n )\n )\n .addOption(\n new Option(\n '-x, --extract',\n 'Extract the script from the exported file, and save it to a separate file. Ignored with -n or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n const tokens = await getTokens();\n if (!tokens) {\n printMessage('Unable to get tokens. Exiting...', 'error');\n program.help();\n process.exitCode = 1;\n return;\n }\n // export by name\n if (options.scriptName || options.script) {\n verboseMessage('Exporting script...');\n await exportScriptByNameToFile(\n options.scriptName || options.script,\n options.file\n );\n }\n // -a / --all\n else if (options.all) {\n verboseMessage('Exporting all scripts to a single file...');\n await exportScriptsToFile(options.file);\n }\n // -A / --all-separate\n else if (options.allSeparate) {\n verboseMessage('Exporting all scripts to separate files...');\n // -x / --extract\n await exportScriptsToFiles(options.extract);\n }\n\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,wBAAwB,EACxBC,mBAAmB,EACnBC,oBAAoB,QACf,qBAAqB;AAC5B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,qBAAqB,CAAC;AAEvDG,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIX,MAAM,CACR,0BAA0B,EAC1B,0DACF,CACF;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,CACCW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,uDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,uGACF,CACF;AACA;AAAA,CACCW,SAAS,CACR,IAAIX,MAAM,CACR,uBAAuB,EACvB,+DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,eAAe,EACf,mGACF,CACF,CAAC,CACAY,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,MAAME,MAAM,GAAG,MAAMb,SAAS,CAAC,CAAC;EAChC,IAAI,CAACa,MAAM,EAAE;IACXhB,YAAY,CAAC,kCAAkC,EAAE,OAAO,CAAC;IACzDK,OAAO,CAACY,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpB;EACF;EACA;EACA,IAAIN,OAAO,CAACO,UAAU,IAAIP,OAAO,CAACQ,MAAM,EAAE;IACxCpB,cAAc,CAAC,qBAAqB,CAAC;IACrC,MAAMJ,wBAAwB,CAC5BgB,OAAO,CAACO,UAAU,IAAIP,OAAO,CAACQ,MAAM,EACpCR,OAAO,CAACS,
|
|
1
|
+
{"version":3,"file":"script-export.js","names":["frodo","Option","exportScriptByNameToFile","exportScriptsToFile","exportScriptsToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","tokens","help","process","exitCode","scriptName","script","file","metadata","all","allSeparate","extract","parse"],"sources":["../../../src/cli/script/script-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportScriptByNameToFile,\n exportScriptsToFile,\n exportScriptsToFiles,\n} from '../../ops/ScriptOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo script export');\n\nprogram\n .description('Export scripts.')\n .addOption(\n new Option(\n '-n, --script-name <name>',\n 'Name of the script. If specified, -a and -A are ignored.'\n )\n )\n // .addOption(\n // new Option(\n // '-i, --script-id <uuid>',\n // 'Uuid of the script. If specified, -a and -A are ignored.'\n // )\n // )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all scripts to a single file. Ignored with -n.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n or -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n // deprecated option\n .addOption(\n new Option(\n '-s, --script <script>',\n 'DEPRECATED! Use -n/--script-name instead. Name of the script.'\n )\n )\n .addOption(\n new Option(\n '-x, --extract',\n 'Extract the script from the exported file, and save it to a separate file. Ignored with -n or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n const tokens = await getTokens();\n if (!tokens) {\n printMessage('Unable to get tokens. Exiting...', 'error');\n program.help();\n process.exitCode = 1;\n return;\n }\n // export by name\n if (options.scriptName || options.script) {\n verboseMessage('Exporting script...');\n await exportScriptByNameToFile(\n options.scriptName || options.script,\n options.file,\n options.metadata\n );\n }\n // -a / --all\n else if (options.all) {\n verboseMessage('Exporting all scripts to a single file...');\n await exportScriptsToFile(options.file, options.metadata);\n }\n // -A / --all-separate\n else if (options.allSeparate) {\n verboseMessage('Exporting all scripts to separate files...');\n // -x / --extract\n await exportScriptsToFiles(options.extract, options.metadata);\n }\n\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,wBAAwB,EACxBC,mBAAmB,EACnBC,oBAAoB,QACf,qBAAqB;AAC5B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,qBAAqB,CAAC;AAEvDG,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIX,MAAM,CACR,0BAA0B,EAC1B,0DACF,CACF;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,CACCW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,uDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,uGACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,+CACF,CACF;AACA;AAAA,CACCW,SAAS,CACR,IAAIX,MAAM,CACR,uBAAuB,EACvB,+DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,eAAe,EACf,mGACF,CACF,CAAC,CACAY,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,K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.login;
|
|
9
9
|
const program = new FrodoCommand('frodo script list');
|
|
10
|
-
program.description('List scripts.').addOption(new Option('-l, --long', 'Long with all fields.').default(false, 'false')).action(
|
|
10
|
+
program.description('List scripts.').addOption(new Option('-l, --long', 'Long with all fields besides usage.').default(false, 'false')).addOption(new Option('-u, --usage', 'Display usage field. If a file is provided with -f or --file, it will search for usage in the file. If a directory is provided with -D or --directory, it will search for usage in all .json files in the directory and sub-directories. If no file or directory is provided, it will perform a full export automatically to determine usage.').default(false, 'false')).addOption(new Option('-f, --file [file]', 'Optional export file to use to determine usage. Overrides -D, --directory. Only used if -u or --usage is provided as well.')).action(
|
|
11
11
|
// implement command logic inside action handler
|
|
12
12
|
async (host, realm, user, password, options, command) => {
|
|
13
13
|
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
14
|
if (await getTokens()) {
|
|
15
15
|
verboseMessage(`Listing scripts in realm "${state.getRealm()}"...`);
|
|
16
|
-
const outcome = await listScripts(options.long);
|
|
16
|
+
const outcome = await listScripts(options.long, options.usage, options.file);
|
|
17
17
|
if (!outcome) process.exitCode = 1;
|
|
18
18
|
} else {
|
|
19
19
|
process.exitCode = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-list.js","names":["frodo","state","Option","listScripts","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","outcome","long","process","exitCode","parse"],"sources":["../../../src/cli/script/script-list.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { listScripts } from '../../ops/ScriptOps';\nimport { verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo script list');\n\nprogram\n .description('List scripts.')\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n verboseMessage(`Listing scripts in realm \"${state.getRealm()}\"...`);\n const outcome = await listScripts(options.long);\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGN,KAAK,CAACO,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,mBAAmB,CAAC;AAErDG,OAAO,CACJC,WAAW,CAAC,eAAe,CAAC,CAC5BC,SAAS,CACR,IAAIR,MAAM,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"script-list.js","names":["frodo","state","Option","listScripts","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","outcome","long","usage","file","process","exitCode","parse"],"sources":["../../../src/cli/script/script-list.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { listScripts } from '../../ops/ScriptOps';\nimport { verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo script list');\n\nprogram\n .description('List scripts.')\n .addOption(\n new Option('-l, --long', 'Long with all fields besides usage.').default(\n false,\n 'false'\n )\n )\n .addOption(\n new Option(\n '-u, --usage',\n 'Display usage field. If a file is provided with -f or --file, it will search for usage in the file. If a directory is provided with -D or --directory, it will search for usage in all .json files in the directory and sub-directories. If no file or directory is provided, it will perform a full export automatically to determine usage.'\n ).default(false, 'false')\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Optional export file to use to determine usage. Overrides -D, --directory. Only used if -u or --usage is provided as well.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n verboseMessage(`Listing scripts in realm \"${state.getRealm()}\"...`);\n const outcome = await listScripts(\n options.long,\n options.usage,\n options.file\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGN,KAAK,CAACO,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,mBAAmB,CAAC;AAErDG,OAAO,CACJC,WAAW,CAAC,eAAe,CAAC,CAC5BC,SAAS,CACR,IAAIR,MAAM,CAAC,YAAY,EAAE,qCAAqC,CAAC,CAACS,OAAO,CACrE,KAAK,EACL,OACF,CACF,CAAC,CACAD,SAAS,CACR,IAAIR,MAAM,CACR,aAAa,EACb,+UACF,CAAC,CAACS,OAAO,CAAC,KAAK,EAAE,OAAO,CAC1B,CAAC,CACAD,SAAS,CACR,IAAIR,MAAM,CACR,mBAAmB,EACnB,4HACF,CACF,CAAC,CACAU,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMZ,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAE,6BAA4BH,KAAK,CAACmB,QAAQ,CAAC,CAAE,MAAK,CAAC;IACnE,MAAMC,OAAO,GAAG,MAAMlB,WAAW,CAC/Bc,OAAO,CAACK,IAAI,EACZL,OAAO,CAACM,KAAK,EACbN,OAAO,CAACO,IACV,CAAC;IACD,IAAI,CAACH,OAAO,EAAEI,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHlB,OAAO,CAACmB,KAAK,CAAC,CAAC"}
|
|
@@ -7,24 +7,24 @@ const {
|
|
|
7
7
|
getTokens
|
|
8
8
|
} = frodo.login;
|
|
9
9
|
const program = new FrodoCommand('frodo service export');
|
|
10
|
-
program.description('Export AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all services to a single file.')).addOption(new Option('-A, --all-separate', 'Export all services to separate files (*.service.json) in the current directory. Ignored with -a.')).addOption(new Option('-g, --global', 'Export global services.')).action(async (host, realm, user, password, options, command) => {
|
|
10
|
+
program.description('Export AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all services to a single file.')).addOption(new Option('-A, --all-separate', 'Export all services to separate files (*.service.json) in the current directory. Ignored with -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).addOption(new Option('-g, --global', 'Export global services.')).action(async (host, realm, user, password, options, command) => {
|
|
11
11
|
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
12
12
|
const globalConfig = options.global ?? false;
|
|
13
13
|
|
|
14
14
|
// export by name
|
|
15
15
|
if (options.serviceId && (await getTokens())) {
|
|
16
16
|
verboseMessage('Exporting service...');
|
|
17
|
-
await exportServiceToFile(options.serviceId, options.file, globalConfig);
|
|
17
|
+
await exportServiceToFile(options.serviceId, options.file, globalConfig, options.metadata);
|
|
18
18
|
}
|
|
19
19
|
// -a / --all
|
|
20
20
|
else if (options.all && (await getTokens())) {
|
|
21
21
|
verboseMessage('Exporting all services to a single file...');
|
|
22
|
-
await exportServicesToFile(options.file, globalConfig);
|
|
22
|
+
await exportServicesToFile(options.file, globalConfig, options.metadata);
|
|
23
23
|
}
|
|
24
24
|
// -A / --all-separate
|
|
25
25
|
else if (options.allSeparate && (await getTokens())) {
|
|
26
26
|
verboseMessage('Exporting all services to separate files...');
|
|
27
|
-
await exportServicesToFiles(globalConfig);
|
|
27
|
+
await exportServicesToFiles(globalConfig, options.metadata);
|
|
28
28
|
}
|
|
29
29
|
// unrecognized combination of options or no options
|
|
30
30
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-export.js","names":["frodo","Option","exportServicesToFile","exportServicesToFiles","exportServiceToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","globalConfig","global","serviceId","file","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/service/service-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportServicesToFile,\n exportServicesToFiles,\n exportServiceToFile,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo service export');\n\ninterface ServiceExportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n}\n\nprogram\n .description('Export AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(new Option('-a, --all', 'Export all services to a single file.'))\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all services to separate files (*.service.json) in the current directory. Ignored with -a.'\n )\n )\n .addOption(new Option('-g, --global', 'Export global services.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceExportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const globalConfig = options.global ?? false;\n\n // export by name\n if (options.serviceId && (await getTokens())) {\n verboseMessage('Exporting service...');\n await exportServiceToFile(\n options.serviceId,\n options.file,\n globalConfig\n );\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all services to a single file...');\n await exportServicesToFile(options.file
|
|
1
|
+
{"version":3,"file":"service-export.js","names":["frodo","Option","exportServicesToFile","exportServicesToFiles","exportServiceToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","globalConfig","global","serviceId","file","metadata","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/service/service-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportServicesToFile,\n exportServicesToFiles,\n exportServiceToFile,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo service export');\n\ninterface ServiceExportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n metadata?: boolean;\n}\n\nprogram\n .description('Export AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(new Option('-a, --all', 'Export all services to a single file.'))\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all services to separate files (*.service.json) in the current directory. Ignored with -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n .addOption(new Option('-g, --global', 'Export global services.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceExportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const globalConfig = options.global ?? false;\n\n // export by name\n if (options.serviceId && (await getTokens())) {\n verboseMessage('Exporting service...');\n await exportServiceToFile(\n options.serviceId,\n options.file,\n globalConfig,\n options.metadata\n );\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all services to a single file...');\n await exportServicesToFile(\n options.file,\n globalConfig,\n options.metadata\n );\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all services to separate files...');\n await exportServicesToFiles(globalConfig, options.metadata);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAgBxDG,OA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AAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,6CAA6C,CAAC;IAC7D,MAAMH,qBAAqB,CAACkB,YAAY,EAAEH,OAAO,CAACO,QAAQ,CAAC;EAC7D;EACA;EAAA,KACK;IACHpB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACkB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHpB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
|
|
@@ -7,29 +7,29 @@ const {
|
|
|
7
7
|
getTokens
|
|
8
8
|
} = frodo.login;
|
|
9
9
|
const program = new FrodoCommand('frodo theme export');
|
|
10
|
-
program.description('Export themes.').addOption(new Option('-n, --theme-name <name>', 'Name of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-i, --theme-id <uuid>', 'Uuid of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the file to write the exported theme(s) to. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all the themes in a realm to a single file. Ignored with -n and -i.')).addOption(new Option('-A, --all-separate', 'Export all the themes in a realm as separate files <theme name>.theme.json. Ignored with -n, -i, and -a.')).action(
|
|
10
|
+
program.description('Export themes.').addOption(new Option('-n, --theme-name <name>', 'Name of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-i, --theme-id <uuid>', 'Uuid of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the file to write the exported theme(s) to. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all the themes in a realm to a single file. Ignored with -n and -i.')).addOption(new Option('-A, --all-separate', 'Export all the themes in a realm as separate files <theme name>.theme.json. Ignored with -n, -i, and -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).action(
|
|
11
11
|
// implement command logic inside action handler
|
|
12
12
|
async (host, realm, user, password, options, command) => {
|
|
13
13
|
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
14
|
// export by name
|
|
15
15
|
if (options.themeName && (await getTokens())) {
|
|
16
16
|
verboseMessage(`Exporting theme "${options.themeName}" from realm "${state.getRealm()}"...`);
|
|
17
|
-
await exportThemeByName(options.themeName, options.file);
|
|
17
|
+
await exportThemeByName(options.themeName, options.file, options.metadata);
|
|
18
18
|
}
|
|
19
19
|
// export by id
|
|
20
20
|
else if (options.themeId && (await getTokens())) {
|
|
21
21
|
verboseMessage(`Exporting theme "${options.themeId}" from realm "${state.getRealm()}"...`);
|
|
22
|
-
await exportThemeById(options.themeId, options.file);
|
|
22
|
+
await exportThemeById(options.themeId, options.file, options.metadata);
|
|
23
23
|
}
|
|
24
24
|
// --all -a
|
|
25
25
|
else if (options.all && (await getTokens())) {
|
|
26
26
|
verboseMessage('Exporting all themes to a single file...');
|
|
27
|
-
await exportThemesToFile(options.file);
|
|
27
|
+
await exportThemesToFile(options.file, options.metadata);
|
|
28
28
|
}
|
|
29
29
|
// --all-separate -A
|
|
30
30
|
else if (options.allSeparate && (await getTokens())) {
|
|
31
31
|
verboseMessage('Exporting all themes to separate files...');
|
|
32
|
-
await exportThemesToFiles();
|
|
32
|
+
await exportThemesToFiles(options.metadata);
|
|
33
33
|
}
|
|
34
34
|
// unrecognized combination of options or no options
|
|
35
35
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-export.js","names":["frodo","state","Option","exportThemeById","exportThemeByName","exportThemesToFile","exportThemesToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","themeName","getRealm","file","themeId","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/theme/theme-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportThemeById,\n exportThemeByName,\n exportThemesToFile,\n exportThemesToFiles,\n} from '../../ops/ThemeOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo theme export');\n\nprogram\n .description('Export themes.')\n .addOption(\n new Option(\n '-n, --theme-name <name>',\n 'Name of the theme. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-i, --theme-id <uuid>',\n 'Uuid of the theme. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the file to write the exported theme(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the themes in a realm to a single file. Ignored with -n and -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the themes in a realm as separate files <theme name>.theme.json. Ignored with -n, -i, and -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by name\n if (options.themeName && (await getTokens())) {\n verboseMessage(\n `Exporting theme \"${\n options.themeName\n }\" from realm \"${state.getRealm()}\"...`\n );\n await exportThemeByName(options.themeName
|
|
1
|
+
{"version":3,"file":"theme-export.js","names":["frodo","state","Option","exportThemeById","exportThemeByName","exportThemesToFile","exportThemesToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","themeName","getRealm","file","metadata","themeId","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/theme/theme-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportThemeById,\n exportThemeByName,\n exportThemesToFile,\n exportThemesToFiles,\n} from '../../ops/ThemeOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo theme export');\n\nprogram\n .description('Export themes.')\n .addOption(\n new Option(\n '-n, --theme-name <name>',\n 'Name of the theme. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-i, --theme-id <uuid>',\n 'Uuid of the theme. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the file to write the exported theme(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the themes in a realm to a single file. Ignored with -n and -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the themes in a realm as separate files <theme name>.theme.json. Ignored with -n, -i, and -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by name\n if (options.themeName && (await getTokens())) {\n verboseMessage(\n `Exporting theme \"${\n options.themeName\n }\" from realm \"${state.getRealm()}\"...`\n );\n await exportThemeByName(\n options.themeName,\n options.file,\n options.metadata\n );\n }\n // export by id\n else if (options.themeId && (await getTokens())) {\n verboseMessage(\n `Exporting theme \"${\n options.themeId\n }\" from realm \"${state.getRealm()}\"...`\n );\n await exportThemeById(options.themeId, options.file, options.metadata);\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all themes to a single file...');\n await exportThemesToFile(options.file, options.metadata);\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all themes to separate files...');\n await exportThemesToFiles(options.metadata);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,eAAe,EACfC,iBAAiB,E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