@rockcarver/frodo-cli 2.0.0-43 → 2.0.0-44

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 CHANGED
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0-43] - 2024-01-05
11
+
10
12
  ## [2.0.0-42] - 2024-01-04
11
13
 
12
14
  ## [2.0.0-41] - 2023-12-23
@@ -1451,7 +1453,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1451
1453
  - Fixed problem with adding connection profiles
1452
1454
  - Miscellaneous bug fixes
1453
1455
 
1454
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-42...HEAD
1456
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-43...HEAD
1457
+
1458
+ [2.0.0-43]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-42...v2.0.0-43
1455
1459
 
1456
1460
  [2.0.0-42]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-41...v2.0.0-42
1457
1461
 
@@ -7,24 +7,30 @@ 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.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.')).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.')).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 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, options.metadata);
17
+ await exportSaml2ProviderToFile(options.entityId, options.file, options.metadata, {
18
+ deps: options.deps
19
+ });
18
20
  }
19
21
  // --all -a
20
22
  else if (options.all && (await getTokens())) {
21
23
  verboseMessage('Exporting all providers to a single file...');
22
- await exportSaml2ProvidersToFile(options.file, options.metadata);
24
+ await exportSaml2ProvidersToFile(options.file, options.metadata, {
25
+ deps: options.deps
26
+ });
23
27
  }
24
28
  // --all-separate -A
25
29
  else if (options.allSeparate && (await getTokens())) {
26
30
  verboseMessage('Exporting all providers to separate files...');
27
- await exportSaml2ProvidersToFiles(options.metadata);
31
+ await exportSaml2ProvidersToFiles(options.metadata, {
32
+ deps: options.deps
33
+ });
28
34
  }
29
35
  // unrecognized combination of options or no options
30
36
  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","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 );\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M,QACV,CAAC;EACH;EACA;EAAA,KACK,IAAIN,OAAO,CAACO,GAAG,KAAK,MAAMjB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CF,cAAc,CAAC,6CAA6C,CAAC;IAC7D,MAAMJ,0BAA0B,CAACgB,OAAO,CAACK,IAAI,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"}
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","deps","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 .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 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 deps: options.deps,\n }\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 deps: options.deps,\n });\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 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,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,yBAAyB,QACpB,oBAAoB;AAC3B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAA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MJ,0BAA0B,CAACgB,OAAO,CAACK,IAAI,EAAEL,OAAO,CAACM,QAAQ,EAAE;MAC/DC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIP,OAAO,CAACS,WAAW,KAAK,MAAMnB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,8CAA8C,CAAC;IAC9D,MAAMH,2BAA2B,CAACe,OAAO,CAACM,QAAQ,EAAE;MAClDC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;EACJ;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"}
@@ -149,7 +149,9 @@ export async function exportSaml2MetadataToFile(entityId, file = null) {
149
149
  * @param {String} file Optional filename
150
150
  * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
151
151
  */
152
- export async function exportSaml2ProviderToFile(entityId, file = null, includeMeta = true) {
152
+ export async function exportSaml2ProviderToFile(entityId, file = null, includeMeta = true, options = {
153
+ deps: true
154
+ }) {
153
155
  debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`);
154
156
  if (!file) {
155
157
  file = getTypedFilename(entityId, 'saml');
@@ -158,7 +160,7 @@ export async function exportSaml2ProviderToFile(entityId, file = null, includeMe
158
160
  let indicatorId;
159
161
  try {
160
162
  indicatorId = createProgressIndicator('determinate', 1, `Exporting provider ${entityId}`);
161
- const fileData = await exportSaml2Provider(entityId);
163
+ const fileData = await exportSaml2Provider(entityId, options);
162
164
  saveJsonToFile(fileData, filePath, includeMeta);
163
165
  updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);
164
166
  stopProgressIndicator(indicatorId,
@@ -176,13 +178,15 @@ export async function exportSaml2ProviderToFile(entityId, file = null, includeMe
176
178
  * @param {String} file Optional filename
177
179
  * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
178
180
  */
179
- export async function exportSaml2ProvidersToFile(file = null, includeMeta = true) {
181
+ export async function exportSaml2ProvidersToFile(file = null, includeMeta = true, options = {
182
+ deps: true
183
+ }) {
180
184
  debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);
181
185
  if (!file) {
182
186
  file = getTypedFilename(`all${getRealmString()}Providers`, 'saml');
183
187
  }
184
188
  try {
185
- const exportData = await exportSaml2Providers();
189
+ const exportData = await exportSaml2Providers(options);
186
190
  saveJsonToFile(exportData, getFilePath(file, true), includeMeta);
187
191
  } catch (error) {
188
192
  var _error$response;
@@ -196,13 +200,15 @@ export async function exportSaml2ProvidersToFile(file = null, includeMeta = true
196
200
  * Export all entity providers to individual files
197
201
  * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
198
202
  */
199
- export async function exportSaml2ProvidersToFiles(includeMeta = true) {
203
+ export async function exportSaml2ProvidersToFiles(includeMeta = true, options = {
204
+ deps: true
205
+ }) {
200
206
  const stubs = await readSaml2ProviderStubs();
201
207
  if (stubs.length > 0) {
202
208
  const indicatorId = createProgressIndicator('determinate', stubs.length, 'Exporting providers');
203
209
  for (const stub of stubs) {
204
210
  const file = getFilePath(getTypedFilename(stub.entityId, 'saml'), true);
205
- const fileData = await exportSaml2Provider(stub.entityId);
211
+ const fileData = await exportSaml2Provider(stub.entityId, options);
206
212
  saveJsonToFile(fileData, file, includeMeta);
207
213
  updateProgressIndicator(indicatorId, `Exported provider ${stub.entityId}`);
208
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","decodeBase64","saveTextToFile","getFilePath","getWorkingDirectory","utils","getTypedFilename","saveJsonToFile","getRealmString","validateImport","readSaml2ProviderStubs","readSaml2Provider","readSaml2ProviderStub","getSaml2ProviderMetadataUrl","getSaml2ProviderMetadata","exportSaml2Provider","exportSaml2Providers","importSaml2Provider","importSaml2Providers","saml2","entityProvider","roleMap","identityProvider","serviceProvider","attributeQueryProvider","xacmlPolicyEnforcementPoint","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","filePath","indicatorId","metaData","brightCyan","exportSaml2ProviderToFile","includeMeta","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","options","deps","data","readFileSync","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","total","result"],"sources":["../../src/ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { type Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/Saml2Api';\nimport {\n type Saml2ExportInterface,\n type Saml2ProviderImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/Saml2Ops';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { decodeBase64, saveTextToFile, getFilePath, getWorkingDirectory } =\n frodo.utils;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils;\nconst {\n readSaml2ProviderStubs,\n readSaml2Provider,\n readSaml2ProviderStub,\n getSaml2ProviderMetadataUrl,\n getSaml2ProviderMetadata,\n exportSaml2Provider,\n exportSaml2Providers,\n importSaml2Provider,\n importSaml2Providers,\n} = frodo.saml2.entityProvider;\n\nconst roleMap = {\n identityProvider: 'IDP',\n serviceProvider: 'SP',\n attributeQueryProvider: 'AttrQuery',\n xacmlPolicyEnforcementPoint: 'XACML PEP',\n};\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await readSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await readSaml2ProviderStub(entityId);\n const { location } = stub;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await readSaml2Provider(entityId);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getSaml2ProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString(), 'data');\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n if (!file) {\n file = getTypedFilename(entityId, 'metadata', 'xml');\n }\n const filePath = getFilePath(file, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting metadata for: ${entityId}`\n );\n try {\n updateProgressIndicator(indicatorId, `Writing file ${filePath}`);\n const metaData = await getSaml2ProviderMetadata(entityId);\n saveTextToFile(metaData, filePath);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} metadata to ${filePath.brightCyan}.`\n );\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProviderToFile(\n entityId,\n file = null,\n includeMeta = true\n) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n if (!file) {\n file = getTypedFilename(entityId, 'saml');\n }\n const filePath = getFilePath(file, true);\n let indicatorId: string;\n try {\n indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting provider ${entityId}`\n );\n const fileData = await exportSaml2Provider(entityId);\n saveJsonToFile(fileData, filePath, includeMeta);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} to ${filePath.brightCyan}.`\n );\n } catch (err) {\n stopProgressIndicator(indicatorId, `${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${filePath}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFile(\n file = null,\n includeMeta = true\n) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers();\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFiles(includeMeta = true) {\n const stubs = await readSaml2ProviderStubs();\n if (stubs.length > 0) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n stubs.length,\n 'Exporting providers'\n );\n for (const stub of stubs) {\n const file = getFilePath(getTypedFilename(stub.entityId, 'saml'), true);\n const fileData = await exportSaml2Provider(stub.entityId);\n saveJsonToFile(fileData, file, includeMeta);\n updateProgressIndicator(\n indicatorId,\n `Exported provider ${stub.entityId}`\n );\n }\n stopProgressIndicator(indicatorId, `${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string,\n options: Saml2ProviderImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(\n `Error importing saml2 provider ${entityId}: ${error}`,\n 'error'\n );\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importFirstSaml2ProviderFromFile(\n file: string,\n options: Saml2ProviderImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId64 =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n const entityId = decodeBase64(entityId64);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(`Error importing first saml2 provider: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFile(\n file: string,\n options: Saml2ProviderImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData, options);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n } catch (error) {\n printMessage(`Error importing saml2 providers: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFiles(\n options: Saml2ProviderImportOptions = { deps: true }\n) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.saml.json'))\n .map((name) => getFilePath(name));\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing providers...'\n );\n let total = 0;\n for (const file of jsonFiles) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const result = await importSaml2Providers(fileData, options);\n total += result.length;\n updateProgressIndicator(\n indicatorId,\n `Imported ${result.length} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n } catch (error) {\n printMessage(\n `Error importing providers from ${file}: ${error.message}`,\n 'error'\n );\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Imported ${total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAM7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,YAAY;EAAEC,cAAc;EAAEC,W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AGxE,uBAAuB,CACzC,aAAa,EACbwG,SAAS,CAAC9D,MAAM,EAChB,wBACF,CAAC;EACD,IAAImE,KAAK,GAAG,CAAC;EACb,KAAK,MAAMvC,IAAI,IAAIkC,SAAS,EAAE;IAC5B,IAAI;MACF,MAAMf,IAAI,GAAG3F,EAAE,CAAC4F,YAAY,CAACpB,IAAI,EAAE,MAAM,CAAC;MAC1C,MAAMO,QAAQ,GAAGc,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;MACjC,IAAI3E,cAAc,CAAC+D,QAAQ,CAACuB,IAAI,CAAC,EAAE;QACjC,MAAMU,MAAM,GAAG,MAAMvF,oBAAoB,CAACsD,QAAQ,EAAEU,OAAO,CAAC;QAC5DsB,KAAK,IAAIC,MAAM,CAACpE,MAAM;QACtBrC,uBAAuB,CACrBmE,WAAW,EACV,YAAWsC,MAAM,CAACpE,MAAO,qBAAoB4B,IAAK,GACrD,CAAC;MACH,CAAC,MAAM;QACLnE,YAAY,CAAE,iBAAgBmE,IAAK,UAAS,EAAE,OAAO,CAAC;MACxD;IACF,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdhE,YAAY,CACT,kCAAiCmE,IAAK,KAAIH,KAAK,CAACC,OAAQ,EAAC,EAC1D,OACF,CAAC;IACH;EACF;EACAhE,qBAAqB,CACnBoE,WAAW,EACV,YAAWqC,KAAM,qBAAoBL,SAAS,CAAC9D,MAAO,WACzD,CAAC;AACH"}
1
+ {"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","decodeBase64","saveTextToFile","getFilePath","getWorkingDirectory","utils","getTypedFilename","saveJsonToFile","getRealmString","validateImport","readSaml2ProviderStubs","readSaml2Provider","readSaml2ProviderStub","getSaml2ProviderMetadataUrl","getSaml2ProviderMetadata","exportSaml2Provider","exportSaml2Providers","importSaml2Provider","importSaml2Providers","saml2","entityProvider","roleMap","identityProvider","serviceProvider","attributeQueryProvider","xacmlPolicyEnforcementPoint","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","filePath","indicatorId","metaData","brightCyan","exportSaml2ProviderToFile","includeMeta","options","deps","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","data","readFileSync","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","total","result"],"sources":["../../src/ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { type Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/Saml2Api';\nimport type {\n Saml2EntitiesExportOptions,\n Saml2EntitiesImportOptions,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/Saml2Ops';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { decodeBase64, saveTextToFile, getFilePath, getWorkingDirectory } =\n frodo.utils;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils;\nconst {\n readSaml2ProviderStubs,\n readSaml2Provider,\n readSaml2ProviderStub,\n getSaml2ProviderMetadataUrl,\n getSaml2ProviderMetadata,\n exportSaml2Provider,\n exportSaml2Providers,\n importSaml2Provider,\n importSaml2Providers,\n} = frodo.saml2.entityProvider;\n\nconst roleMap = {\n identityProvider: 'IDP',\n serviceProvider: 'SP',\n attributeQueryProvider: 'AttrQuery',\n xacmlPolicyEnforcementPoint: 'XACML PEP',\n};\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await readSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await readSaml2ProviderStub(entityId);\n const { location } = stub;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await readSaml2Provider(entityId);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getSaml2ProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString(), 'data');\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n if (!file) {\n file = getTypedFilename(entityId, 'metadata', 'xml');\n }\n const filePath = getFilePath(file, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting metadata for: ${entityId}`\n );\n try {\n updateProgressIndicator(indicatorId, `Writing file ${filePath}`);\n const metaData = await getSaml2ProviderMetadata(entityId);\n saveTextToFile(metaData, filePath);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} metadata to ${filePath.brightCyan}.`\n );\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProviderToFile(\n entityId: string,\n file: string = null,\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n if (!file) {\n file = getTypedFilename(entityId, 'saml');\n }\n const filePath = getFilePath(file, true);\n let indicatorId: string;\n try {\n indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting provider ${entityId}`\n );\n const fileData = await exportSaml2Provider(entityId, options);\n saveJsonToFile(fileData, filePath, includeMeta);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} to ${filePath.brightCyan}.`\n );\n } catch (err) {\n stopProgressIndicator(indicatorId, `${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${filePath}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFile(\n file: string = null,\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers(options);\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFiles(\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n const stubs = await readSaml2ProviderStubs();\n if (stubs.length > 0) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n stubs.length,\n 'Exporting providers'\n );\n for (const stub of stubs) {\n const file = getFilePath(getTypedFilename(stub.entityId, 'saml'), true);\n const fileData = await exportSaml2Provider(stub.entityId, options);\n saveJsonToFile(fileData, file, includeMeta);\n updateProgressIndicator(\n indicatorId,\n `Exported provider ${stub.entityId}`\n );\n }\n stopProgressIndicator(indicatorId, `${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(\n `Error importing saml2 provider ${entityId}: ${error}`,\n 'error'\n );\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importFirstSaml2ProviderFromFile(\n file: string, \n options: Saml2EntitiesImportOptions = { deps: true }) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId64 =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n const entityId = decodeBase64(entityId64);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(`Error importing first saml2 provider: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFile(\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData, options);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n } catch (error) {\n printMessage(`Error importing saml2 providers: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFiles(\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.saml.json'))\n .map((name) => getFilePath(name));\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing providers...'\n );\n let total = 0;\n for (const file of jsonFiles) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const result = await importSaml2Providers(fileData, options);\n total += result.length;\n updateProgressIndicator(\n indicatorId,\n `Imported ${result.length} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n } catch (error) {\n printMessage(\n `Error importing providers from ${file}: ${error.message}`,\n 'error'\n );\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Imported ${total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAO7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,YAAY;EAAEC,cAAc;EAAEC,WAAW;EAAEC;AAAoB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AM,CAAEC,IAAI,IAAKA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAC3DjD,GAAG,CAAE+C,IAAI,IAAKlG,WAAW,CAACkG,IAAI,CAAC,CAAC;EACnC,MAAMlC,WAAW,GAAGxE,uBAAuB,CACzC,aAAa,EACbwG,SAAS,CAAC9D,MAAM,EAChB,wBACF,CAAC;EACD,IAAImE,KAAK,GAAG,CAAC;EACb,KAAK,MAAMvC,IAAI,IAAIkC,SAAS,EAAE;IAC5B,IAAI;MACF,MAAMf,IAAI,GAAG3F,EAAE,CAAC4F,YAAY,CAACpB,IAAI,EAAE,MAAM,CAAC;MAC1C,MAAMS,QAAQ,GAAGY,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;MACjC,IAAI3E,cAAc,CAACiE,QAAQ,CAACqB,IAAI,CAAC,EAAE;QACjC,MAAMU,MAAM,GAAG,MAAMvF,oBAAoB,CAACwD,QAAQ,EAAEF,OAAO,CAAC;QAC5DgC,KAAK,IAAIC,MAAM,CAACpE,MAAM;QACtBrC,uBAAuB,CACrBmE,WAAW,EACV,YAAWsC,MAAM,CAACpE,MAAO,qBAAoB4B,IAAK,GACrD,CAAC;MACH,CAAC,MAAM;QACLnE,YAAY,CAAE,iBAAgBmE,IAAK,UAAS,EAAE,OAAO,CAAC;MACxD;IACF,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdhE,YAAY,CACT,kCAAiCmE,IAAK,KAAIH,KAAK,CAACC,OAAQ,EAAC,EAC1D,OACF,CAAC;IACH;EACF;EACAhE,qBAAqB,CACnBoE,WAAW,EACV,YAAWqC,KAAM,qBAAoBL,SAAS,CAAC9D,MAAO,WACzD,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "2.0.0-43",
3
+ "version": "2.0.0-44",
4
4
  "type": "module",
5
5
  "description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
6
  "keywords": [
@@ -116,7 +116,7 @@
116
116
  ]
117
117
  },
118
118
  "dependencies": {
119
- "@rockcarver/frodo-lib": "2.0.0-59",
119
+ "@rockcarver/frodo-lib": "2.0.0-60",
120
120
  "chokidar": "^3.5.3",
121
121
  "cli-progress": "^3.11.2",
122
122
  "cli-table3": "^0.6.3",