@rockcarver/frodo-cli 2.0.0-10 → 2.0.0-12
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 +13 -1
- package/esm/cli/conn/conn-save.js +1 -1
- package/esm/cli/conn/conn-save.js.map +1 -1
- package/esm/cli/esv/esv-variable-create.js +3 -2
- package/esm/cli/esv/esv-variable-create.js.map +1 -1
- package/esm/cli/realm/realm-describe.js +1 -1
- package/esm/cli/realm/realm-describe.js.map +1 -1
- package/esm/ops/AgentOps.js +1 -1
- package/esm/ops/AgentOps.js.map +1 -1
- package/esm/ops/CirclesOfTrustOps.js +1 -1
- package/esm/ops/CirclesOfTrustOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js +1 -1
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js +3 -6
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +1 -1
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/OAuth2ClientOps.js +2 -2
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +1 -1
- package/esm/ops/PolicyOps.js.map +1 -1
- package/esm/ops/PolicySetOps.js +1 -1
- package/esm/ops/PolicySetOps.js.map +1 -1
- package/esm/ops/ResourceTypeOps.js +1 -1
- package/esm/ops/ResourceTypeOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js +4 -4
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/ServiceOps.js +2 -2
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js +1 -1
- package/esm/ops/ThemeOps.js.map +1 -1
- package/esm/ops/VariablesOps.js +17 -16
- package/esm/ops/VariablesOps.js.map +1 -1
- package/esm/ops/utils/Wordwrap.js.map +1 -1
- package/esm/utils/Console.js +1 -1
- package/esm/utils/Console.js.map +1 -1
- package/esm/utils/ExportImportUtils.js +28 -1
- package/esm/utils/ExportImportUtils.js.map +1 -1
- package/package.json +6 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTypeOps.js","names":["frodo","state","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","getTypedFilename","saveJsonToFile","titleCase","getRealmName","helper","utils","getResourceTypes","getResourceType","getResourceTypeByName","exportResourceType","exportResourceTypeByName","exportResourceTypes","importResourceType","importResourceTypeByName","importFirstResourceType","importResourceTypes","authz","resourceType","listResourceTypes","long","outcome","resourceTypes","sort","a","b","name","localeCompare","table","push","description","uuid","toString","err","message","describeResourceType","resourceTypeUuid","json","error","_error$response","response","status","getRealm","_error$response2","_error$response2$data","data","describeResourceTypeByName","resourceTypeName","_error$response3","_error$response4","_error$response4$data","deleteResourceType","errors","length","errorMessages","map","_error$response5","_error$response5$data","join","deleteResourceTypeByName","_error$response6","_error$response6$data","deleteResourceTypes","resourceTypeId","exportResourceTypeToFile","file","fileName","exportData","exportResourceTypeByNameToFile","exportResourceTypesToFile","exportResourceTypesToFiles","importResourceTypeFromFile","readFileSync","fileData","JSON","parse","importResourceTypeByNameFromFile","importFirstResourceTypeFromFile","importResourceTypesFromFile","importResourceTypesFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys","resourcetype"],"sources":["../../src/ops/ResourceTypeOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ResourceTypeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\nimport { ResourceTypeExportInterface } from '@rockcarver/frodo-lib/types/ops/ResourceTypeOps';\n\nconst { getRealmName } = frodo.helper.utils;\nconst {\n getResourceTypes,\n getResourceType,\n getResourceTypeByName,\n exportResourceType,\n exportResourceTypeByName,\n exportResourceTypes,\n importResourceType,\n importResourceTypeByName,\n importFirstResourceType,\n importResourceTypes,\n} = frodo.authz.resourceType;\n\n/**\n * List resource types\n * @param {boolean} long more fields\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listResourceTypes(long = false): Promise<boolean> {\n let outcome = false;\n try {\n const resourceTypes = await getResourceTypes();\n resourceTypes.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable(['Name', 'Description', 'Uuid']);\n for (const resourceType of resourceTypes) {\n table.push([\n `${resourceType.name}`,\n `${resourceType.description}`,\n `${resourceType.uuid}`,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const resourceType of resourceTypes) {\n printMessage(`${resourceType.name}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listResourceTypes ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceType(\n resourceTypeUuid: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await getResourceType(resourceTypeUuid);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Describe resource type by name\n * @param {string} resourceTypeName resource type name\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceTypeByName(\n resourceTypeName: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await getResourceTypeByName(resourceTypeName);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Delete resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceType(\n resourceTypeUuid: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);\n showSpinner(`Deleting ${resourceTypeUuid}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeUuid}`);\n await deleteResourceType(resourceTypeUuid);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeUuid}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeUuid}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceType: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeByName(\n resourceTypeName: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);\n showSpinner(`Deleting ${resourceTypeName}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeName}`);\n await deleteResourceTypeByName(resourceTypeName);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeName}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeName}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypeByName: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete all resource types\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypes(): Promise<\n boolean | ResourceTypeSkeleton\n> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);\n let outcome = false;\n const errors = [];\n let resourceTypes: ResourceTypeSkeleton[] = [];\n try {\n showSpinner(`Retrieving all resource types...`);\n try {\n resourceTypes = await getResourceTypes();\n succeedSpinner(`Found ${resourceTypes.length} resource types.`);\n } catch (error) {\n error.message = `Error retrieving all resource types: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (resourceTypes.length)\n createProgressBar(\n resourceTypes.length,\n `Deleting ${resourceTypes.length} resource types...`\n );\n for (const resourceType of resourceTypes) {\n const resourceTypeId = resourceType.uuid;\n try {\n debugMessage(`Deleting resource type ${resourceTypeId}`);\n await deleteResourceType(resourceTypeId);\n updateProgressBar(`Deleted ${resourceTypeId}`);\n } catch (error) {\n error.message = `Error deleting resource type ${resourceTypeId}: ${error}`;\n updateProgressBar(error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting resource types: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (resourceTypes.length)\n stopProgressBar(`Error deleting all resource types: ${errorMessages}`);\n } else {\n if (resourceTypes.length)\n stopProgressBar(`Deleted ${resourceTypes.length} resource types.`);\n outcome = true;\n }\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypes: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export resource type to file\n * @param {string} resourceTypeUuid resource type uuid\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeToFile(\n resourceTypeUuid: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);\n showSpinner(`Exporting ${resourceTypeUuid}...`);\n try {\n let fileName = getTypedFilename(resourceTypeUuid, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceType(resourceTypeUuid);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeUuid} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeUuid}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource type by name to file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeByNameToFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);\n showSpinner(`Exporting ${resourceTypeName}...`);\n try {\n let fileName = getTypedFilename(resourceTypeName, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceTypeByName(resourceTypeName);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeName} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeName}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource types to file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);\n showSpinner(`Exporting all resource types...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}ResourceTypes`,\n 'resourcetype.authz'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceTypes();\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all resource types to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting resource types: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);\n return outcome;\n}\n\n/**\n * Export all resource types to separate files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFiles(): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: begin`);\n const errors = [];\n try {\n const resourceTypes: ResourceTypeSkeleton[] = await getResourceTypes();\n createProgressBar(resourceTypes.length, 'Exporting resource types...');\n for (const resourceType of resourceTypes) {\n const file = getTypedFilename(resourceType.name, 'resourcetype.authz');\n try {\n const exportData: ResourceTypeExportInterface =\n await exportResourceType(resourceType.uuid);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${resourceType.name}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${resourceType.name}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting resource types to files`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import resource type from file\n * @param {string} resourceTypeId resource type id\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeFromFile(\n resourceTypeId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);\n showSpinner(`Importing ${resourceTypeId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceType(resourceTypeId, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeId}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeId}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource type by name from file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeByNameFromFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);\n showSpinner(`Importing ${resourceTypeName}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypeByName(resourceTypeName, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeName}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeName}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first resource type from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstResourceTypeFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstResourceType(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypes(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFiles(): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.resourcetype.authz.json')\n );\n createProgressBar(files.length, 'Importing resource types...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ResourceTypeExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.resourcetype).length;\n total += count;\n await importResourceTypes(fileData);\n updateProgressBar(`Imported ${count} resource types from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing resource types from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} resource types from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing resource types from files.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,QACJ,4BAA4B;AAGnC,MAAM;EAAEC;AAAa,CAAC,GAAGhB,KAAK,CAACiB,MAAM,CAACC,KAAK;AAC3C,MAAM;EAC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MAAMrB,IAAI,IAAIiB,KAAK,EAAE;MACxB,IAAI;QACF,MAAMrC,IAAI,GAAGvD,EAAE,CAACkF,YAAY,CAACP,IAAI,EAAE,MAAM,CAAC;QAC1C,MAAMQ,QAAqC,GAAGC,IAAI,CAACC,KAAK,CAAC9B,IAAI,CAAC;QAC9D,MAAM0C,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAChB,QAAQ,CAACiB,YAAY,CAAC,CAACrC,MAAM;QACvDiC,KAAK,IAAIC,KAAK;QACd,MAAMvE,mBAAmB,CAACyD,QAAQ,CAAC;QACnCzE,iBAAiB,CAAE,YAAWuF,KAAM,wBAAuBtB,IAAK,EAAC,CAAC;MACpE,CAAC,CAAC,OAAO3B,KAAK,EAAE;QACdc,MAAM,CAACvB,IAAI,CAACS,KAAK,CAAC;QAClBtC,iBAAiB,CAAE,uCAAsCiE,IAAK,EAAC,CAAC;QAChErE,YAAY,CAAC0C,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACAxC,eAAe,CACZ,sBAAqBwF,KAAM,wBAAuBJ,KAAK,CAAC7B,MAAO,SAClE,CAAC;EACH,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdc,MAAM,CAACvB,IAAI,CAACS,KAAK,CAAC;IAClBxC,eAAe,CAAE,4CAA2C,CAAC;IAC7DF,YAAY,CAAC0C,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA5C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK0D,MAAM,CAACC,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"ResourceTypeOps.js","names":["frodo","state","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","getTypedFilename","saveJsonToFile","titleCase","getRealmName","utils","getResourceTypes","getResourceType","getResourceTypeByName","exportResourceType","exportResourceTypeByName","exportResourceTypes","importResourceType","importResourceTypeByName","importFirstResourceType","importResourceTypes","authz","resourceType","listResourceTypes","long","outcome","resourceTypes","sort","a","b","name","localeCompare","table","push","description","uuid","toString","err","message","describeResourceType","resourceTypeUuid","json","error","_error$response","response","status","getRealm","_error$response2","_error$response2$data","data","describeResourceTypeByName","resourceTypeName","_error$response3","_error$response4","_error$response4$data","deleteResourceType","errors","length","errorMessages","map","_error$response5","_error$response5$data","join","deleteResourceTypeByName","_error$response6","_error$response6$data","deleteResourceTypes","resourceTypeId","exportResourceTypeToFile","file","fileName","exportData","exportResourceTypeByNameToFile","exportResourceTypesToFile","exportResourceTypesToFiles","importResourceTypeFromFile","readFileSync","fileData","JSON","parse","importResourceTypeByNameFromFile","importFirstResourceTypeFromFile","importResourceTypesFromFile","importResourceTypesFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys","resourcetype"],"sources":["../../src/ops/ResourceTypeOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ResourceTypeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\nimport { ResourceTypeExportInterface } from '@rockcarver/frodo-lib/types/ops/ResourceTypeOps';\n\nconst { getRealmName } = frodo.utils;\nconst {\n getResourceTypes,\n getResourceType,\n getResourceTypeByName,\n exportResourceType,\n exportResourceTypeByName,\n exportResourceTypes,\n importResourceType,\n importResourceTypeByName,\n importFirstResourceType,\n importResourceTypes,\n} = frodo.authz.resourceType;\n\n/**\n * List resource types\n * @param {boolean} long more fields\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listResourceTypes(long = false): Promise<boolean> {\n let outcome = false;\n try {\n const resourceTypes = await getResourceTypes();\n resourceTypes.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable(['Name', 'Description', 'Uuid']);\n for (const resourceType of resourceTypes) {\n table.push([\n `${resourceType.name}`,\n `${resourceType.description}`,\n `${resourceType.uuid}`,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const resourceType of resourceTypes) {\n printMessage(`${resourceType.name}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listResourceTypes ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceType(\n resourceTypeUuid: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await getResourceType(resourceTypeUuid);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Describe resource type by name\n * @param {string} resourceTypeName resource type name\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceTypeByName(\n resourceTypeName: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await getResourceTypeByName(resourceTypeName);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Delete resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceType(\n resourceTypeUuid: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);\n showSpinner(`Deleting ${resourceTypeUuid}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeUuid}`);\n await deleteResourceType(resourceTypeUuid);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeUuid}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeUuid}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceType: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeByName(\n resourceTypeName: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);\n showSpinner(`Deleting ${resourceTypeName}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeName}`);\n await deleteResourceTypeByName(resourceTypeName);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeName}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeName}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypeByName: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete all resource types\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypes(): Promise<\n boolean | ResourceTypeSkeleton\n> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);\n let outcome = false;\n const errors = [];\n let resourceTypes: ResourceTypeSkeleton[] = [];\n try {\n showSpinner(`Retrieving all resource types...`);\n try {\n resourceTypes = await getResourceTypes();\n succeedSpinner(`Found ${resourceTypes.length} resource types.`);\n } catch (error) {\n error.message = `Error retrieving all resource types: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (resourceTypes.length)\n createProgressBar(\n resourceTypes.length,\n `Deleting ${resourceTypes.length} resource types...`\n );\n for (const resourceType of resourceTypes) {\n const resourceTypeId = resourceType.uuid;\n try {\n debugMessage(`Deleting resource type ${resourceTypeId}`);\n await deleteResourceType(resourceTypeId);\n updateProgressBar(`Deleted ${resourceTypeId}`);\n } catch (error) {\n error.message = `Error deleting resource type ${resourceTypeId}: ${error}`;\n updateProgressBar(error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting resource types: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (resourceTypes.length)\n stopProgressBar(`Error deleting all resource types: ${errorMessages}`);\n } else {\n if (resourceTypes.length)\n stopProgressBar(`Deleted ${resourceTypes.length} resource types.`);\n outcome = true;\n }\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypes: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export resource type to file\n * @param {string} resourceTypeUuid resource type uuid\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeToFile(\n resourceTypeUuid: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);\n showSpinner(`Exporting ${resourceTypeUuid}...`);\n try {\n let fileName = getTypedFilename(resourceTypeUuid, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceType(resourceTypeUuid);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeUuid} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeUuid}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource type by name to file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeByNameToFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);\n showSpinner(`Exporting ${resourceTypeName}...`);\n try {\n let fileName = getTypedFilename(resourceTypeName, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceTypeByName(resourceTypeName);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeName} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeName}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource types to file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);\n showSpinner(`Exporting all resource types...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}ResourceTypes`,\n 'resourcetype.authz'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceTypes();\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all resource types to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting resource types: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);\n return outcome;\n}\n\n/**\n * Export all resource types to separate files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFiles(): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: begin`);\n const errors = [];\n try {\n const resourceTypes: ResourceTypeSkeleton[] = await getResourceTypes();\n createProgressBar(resourceTypes.length, 'Exporting resource types...');\n for (const resourceType of resourceTypes) {\n const file = getTypedFilename(resourceType.name, 'resourcetype.authz');\n try {\n const exportData: ResourceTypeExportInterface =\n await exportResourceType(resourceType.uuid);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${resourceType.name}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${resourceType.name}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting resource types to files`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import resource type from file\n * @param {string} resourceTypeId resource type id\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeFromFile(\n resourceTypeId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);\n showSpinner(`Importing ${resourceTypeId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceType(resourceTypeId, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeId}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeId}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource type by name from file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeByNameFromFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);\n showSpinner(`Importing ${resourceTypeName}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypeByName(resourceTypeName, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeName}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeName}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first resource type from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstResourceTypeFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstResourceType(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypes(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFiles(): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.resourcetype.authz.json')\n );\n createProgressBar(files.length, 'Importing resource types...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ResourceTypeExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.resourcetype).length;\n total += count;\n await importResourceTypes(fileData);\n updateProgressBar(`Imported ${count} resource types from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing resource types from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} resource types from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing resource types from files.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,QACJ,4BAA4B;AAGnC,MAAM;EAAEC;AAAa,CAAC,GAAGhB,KAAK,CAACiB,KAAK;AACpC,MAAM;EACJC,gBAAgB;EAChBC,eAAe;EACfC,qBAAqB;EACrBC,kBAAkB;EAClBC,wBAAwB;EACxBC,mBAAmB;EACnBC,kBAAkB;EAClBC,wBAAwB;EACxBC,uBAAuB;EACvBC;AACF,CAAC,GAAG3B,KAAK,CAAC4B,KAAK,CAACC,YAAY;;AAE5B;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CAACC,IAAI,GAAG,KAAK,EAAoB;EACtE,IAAIC,OAAO,GAAG,KAAK;EACnB,IAAI;IACF,MAAMC,aAAa,GAAG,MAAMf,gBAAgB,CAAC,C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,YAAWsF,KAAM,wBAAuBtB,IAAK,EAAC,CAAC;MACpE,CAAC,CAAC,OAAO3B,KAAK,EAAE;QACdc,MAAM,CAACvB,IAAI,CAACS,KAAK,CAAC;QAClBrC,iBAAiB,CAAE,uCAAsCgE,IAAK,EAAC,CAAC;QAChEpE,YAAY,CAACyC,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACAvC,eAAe,CACZ,sBAAqBuF,KAAM,wBAAuBJ,KAAK,CAAC7B,MAAO,SAClE,CAAC;EACH,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdc,MAAM,CAACvB,IAAI,CAACS,KAAK,CAAC;IAClBvC,eAAe,CAAE,4CAA2C,CAAC;IAC7DF,YAAY,CAACyC,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA3C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAKyD,MAAM,CAACC,MAAM;AAC5B"}
|
package/esm/ops/Saml2Ops.js
CHANGED
|
@@ -3,14 +3,14 @@ import fs from 'fs';
|
|
|
3
3
|
import { createObjectTable, createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
|
|
4
4
|
import { saveTextToFile } from '../utils/ExportImportUtils';
|
|
5
5
|
const {
|
|
6
|
-
|
|
7
|
-
} = frodo.
|
|
6
|
+
decodeBase64
|
|
7
|
+
} = frodo.utils;
|
|
8
8
|
const {
|
|
9
9
|
getTypedFilename,
|
|
10
10
|
saveJsonToFile,
|
|
11
11
|
getRealmString,
|
|
12
12
|
validateImport
|
|
13
|
-
} = frodo.utils
|
|
13
|
+
} = frodo.utils;
|
|
14
14
|
const {
|
|
15
15
|
getSaml2ProviderStubs,
|
|
16
16
|
getProviderByLocationAndId,
|
|
@@ -234,7 +234,7 @@ export async function importFirstSaml2ProviderFromFile(file) {
|
|
|
234
234
|
const fileData = JSON.parse(data);
|
|
235
235
|
// pick the first provider and run with it
|
|
236
236
|
const entityId64 = Object.keys(fileData.saml.remote)[0] || Object.keys(fileData.saml.hosted)[0];
|
|
237
|
-
const entityId =
|
|
237
|
+
const entityId = decodeBase64(entityId64);
|
|
238
238
|
showSpinner(`Importing ${entityId}...`);
|
|
239
239
|
try {
|
|
240
240
|
await importSaml2Provider(entityId, fileData);
|
package/esm/ops/Saml2Ops.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveTextToFile","decode","helper","base64","getTypedFilename","saveJsonToFile","getRealmString","validateImport","utils","impex","getSaml2ProviderStubs","getProviderByLocationAndId","getSaml2ProviderStub","getProviderMetadataUrl","getProviderMetadata","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","id","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","fileName","metaData","brightCyan","exportSaml2ProviderToFile","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","readFile","data","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","totalStatus","total","successes","warnings","failures","readFileSync","myStatus"],"sources":["../../src/ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveTextToFile } from '../utils/ExportImportUtils';\nimport type {\n MultiOpStatusInterface,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport type { Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\n\nconst { decode } = frodo.helper.base64;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils.impex;\nconst {\n getSaml2ProviderStubs,\n getProviderByLocationAndId,\n getSaml2ProviderStub,\n getProviderMetadataUrl,\n getProviderMetadata,\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 getSaml2ProviderStubs();\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());\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 getSaml2ProviderStub(entityId);\n printMessage(stub);\n const { location } = stub;\n const id = stub._id;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await getProviderByLocationAndId(location, id);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString());\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 let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'metadata', 'xml');\n }\n createProgressBar(1, `Exporting metadata for: ${entityId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const metaData = await getProviderMetadata(entityId);\n saveTextToFile(metaData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`\n );\n } catch (error) {\n stopProgressBar(`${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 */\nexport async function exportSaml2ProviderToFile(entityId, file = null) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'saml');\n }\n try {\n createProgressBar(1, `Exporting provider ${entityId}`);\n const fileData = await exportSaml2Provider(entityId);\n saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${fileName}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProvidersToFile(file = null) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers();\n saveJsonToFile(exportData, fileName);\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 */\nexport async function exportSaml2ProvidersToFiles() {\n const stubs = await getSaml2ProviderStubs();\n if (stubs.length > 0) {\n createProgressBar(stubs.length, 'Exporting providers');\n for (const stub of stubs) {\n const fileName = getTypedFilename(stub.entityId, 'saml');\n const fileData = await exportSaml2Provider(stub.entityId);\n saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${stub.entityId}`);\n }\n stopProgressBar(`${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 */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string\n) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n */\nexport async function importFirstSaml2ProviderFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\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 = decode(entityId64);\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n */\nexport async function importSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n */\nexport async function importSaml2ProvidersFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.saml.json')\n );\n createProgressBar(jsonFiles.length, 'Importing providers...');\n const totalStatus: MultiOpStatusInterface = {\n total: 0,\n successes: 0,\n warnings: 0,\n failures: 0,\n };\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const myStatus = await importSaml2Providers(fileData);\n totalStatus.total += myStatus.total;\n totalStatus.successes += myStatus.successes;\n totalStatus.warnings += myStatus.warnings;\n totalStatus.failures += myStatus.failures;\n updateProgressBar(\n `Imported ${myStatus.successes}/${myStatus.total} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressBar(\n `Imported ${totalStatus.successes} of ${totalStatus.total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAM;EAAEC;AAAO,CAAC,GAAGb,KAAK,CAACc,MAAM,CAACC,MAAM;AACtC,MAAM;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,cAAc;EAAEC;AAAe,CAAC,GACxEnB,KAAK,CAACoB,KAAK,CAACC,KAAK;AACnB,MAAM;EACJC,qBAAqB;EACrBC,0BAA0B;EAC1BC,oBAAoB;EACpBC,sBAAsB;EACtBC,mBAAmB;EACnBC,mBAAmB;EACnBC,oBAAoB;EACpBC,mBAAmB;EACnBC;AACF,CAAC,GAAG9B,KAAK,CAAC+B,KAAK,CAACC,cAAc;AAE9B,MAAMC,OAAO,GAAG;EACdC,gBAAgB,EAAE,KAAK;EACvBC,eAAe,EAAE,IAAI;EACrBC,sBAAsB,EAAE,WAAW;EACnCC,2BAA2B,EAAE;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AACF,IAAI,CAAC;IACjC,IAAI3E,cAAc,CAACgE,QAAQ,CAACqB,IAAI,CAAC,EAAE;MACjC,MAAMe,QAAQ,GAAG,MAAMzF,oBAAoB,CAACqD,QAAQ,CAAC;MACrD8B,WAAW,CAACC,KAAK,IAAIK,QAAQ,CAACL,KAAK;MACnCD,WAAW,CAACE,SAAS,IAAII,QAAQ,CAACJ,SAAS;MAC3CF,WAAW,CAACG,QAAQ,IAAIG,QAAQ,CAACH,QAAQ;MACzCH,WAAW,CAACI,QAAQ,IAAIE,QAAQ,CAACF,QAAQ;MACzC1G,iBAAiB,CACd,YAAW4G,QAAQ,CAACJ,SAAU,IAAGI,QAAQ,CAACL,KAAM,qBAAoBpC,IAAK,GAC5E,CAAC;IACH,CAAC,MAAM;MACLvE,YAAY,CAAE,iBAAgBuE,IAAK,UAAS,EAAE,OAAO,CAAC;IACxD;EACF;EACArE,eAAe,CACZ,YAAWwG,WAAW,CAACE,SAAU,OAAMF,WAAW,CAACC,KAAM,qBAAoBN,SAAS,CAAC3D,MAAO,WACjG,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveTextToFile","decodeBase64","utils","getTypedFilename","saveJsonToFile","getRealmString","validateImport","getSaml2ProviderStubs","getProviderByLocationAndId","getSaml2ProviderStub","getProviderMetadataUrl","getProviderMetadata","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","id","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","fileName","metaData","brightCyan","exportSaml2ProviderToFile","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","readFile","data","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","totalStatus","total","successes","warnings","failures","readFileSync","myStatus"],"sources":["../../src/ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveTextToFile } from '../utils/ExportImportUtils';\nimport type {\n MultiOpStatusInterface,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport type { Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/Saml2Api';\n\nconst { decodeBase64 } = frodo.utils;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils;\nconst {\n getSaml2ProviderStubs,\n getProviderByLocationAndId,\n getSaml2ProviderStub,\n getProviderMetadataUrl,\n getProviderMetadata,\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 getSaml2ProviderStubs();\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());\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 getSaml2ProviderStub(entityId);\n printMessage(stub);\n const { location } = stub;\n const id = stub._id;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await getProviderByLocationAndId(location, id);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString());\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 let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'metadata', 'xml');\n }\n createProgressBar(1, `Exporting metadata for: ${entityId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const metaData = await getProviderMetadata(entityId);\n saveTextToFile(metaData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`\n );\n } catch (error) {\n stopProgressBar(`${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 */\nexport async function exportSaml2ProviderToFile(entityId, file = null) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'saml');\n }\n try {\n createProgressBar(1, `Exporting provider ${entityId}`);\n const fileData = await exportSaml2Provider(entityId);\n saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${fileName}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProvidersToFile(file = null) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers();\n saveJsonToFile(exportData, fileName);\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 */\nexport async function exportSaml2ProvidersToFiles() {\n const stubs = await getSaml2ProviderStubs();\n if (stubs.length > 0) {\n createProgressBar(stubs.length, 'Exporting providers');\n for (const stub of stubs) {\n const fileName = getTypedFilename(stub.entityId, 'saml');\n const fileData = await exportSaml2Provider(stub.entityId);\n saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${stub.entityId}`);\n }\n stopProgressBar(`${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 */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string\n) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n */\nexport async function importFirstSaml2ProviderFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\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 showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n */\nexport async function importSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n */\nexport async function importSaml2ProvidersFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.saml.json')\n );\n createProgressBar(jsonFiles.length, 'Importing providers...');\n const totalStatus: MultiOpStatusInterface = {\n total: 0,\n successes: 0,\n warnings: 0,\n failures: 0,\n };\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const myStatus = await importSaml2Providers(fileData);\n totalStatus.total += myStatus.total;\n totalStatus.successes += myStatus.successes;\n totalStatus.warnings += myStatus.warnings;\n totalStatus.failures += myStatus.failures;\n updateProgressBar(\n `Imported ${myStatus.successes}/${myStatus.total} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressBar(\n `Imported ${totalStatus.successes} of ${totalStatus.total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAM;EAAEC;AAAa,CAAC,GAAGb,KAAK,CAACc,KAAK;AACpC,MAAM;EAAEC,gBA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AC,YAAY,CAC1C,CAAC;EACD1G,iBAAiB,CAACsG,SAAS,CAAC3D,MAAM,EAAE,wBAAwB,CAAC;EAC7D,MAAMgE,WAAmC,GAAG;IAC1CC,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,CAAC;IACXC,QAAQ,EAAE;EACZ,CAAC;EACD,KAAK,MAAMvC,IAAI,IAAI8B,SAAS,EAAE;IAC5B,MAAMd,IAAI,GAAG1F,EAAE,CAACkH,YAAY,CAACxC,IAAI,EAAE,MAAM,CAAC;IAC1C,MAAMK,QAAQ,GAAGY,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;IACjC,IAAIzE,cAAc,CAAC8D,QAAQ,CAACqB,IAAI,CAAC,EAAE;MACjC,MAAMe,QAAQ,GAAG,MAAMzF,oBAAoB,CAACqD,QAAQ,CAAC;MACrD8B,WAAW,CAACC,KAAK,IAAIK,QAAQ,CAACL,KAAK;MACnCD,WAAW,CAACE,SAAS,IAAII,QAAQ,CAACJ,SAAS;MAC3CF,WAAW,CAACG,QAAQ,IAAIG,QAAQ,CAACH,QAAQ;MACzCH,WAAW,CAACI,QAAQ,IAAIE,QAAQ,CAACF,QAAQ;MACzCvG,iBAAiB,CACd,YAAWyG,QAAQ,CAACJ,SAAU,IAAGI,QAAQ,CAACL,KAAM,qBAAoBpC,IAAK,GAC5E,CAAC;IACH,CAAC,MAAM;MACLpE,YAAY,CAAE,iBAAgBoE,IAAK,UAAS,EAAE,OAAO,CAAC;IACxD;EACF;EACAlE,eAAe,CACZ,YAAWqG,WAAW,CAACE,SAAU,OAAMF,WAAW,CAACC,KAAM,qBAAoBN,SAAS,CAAC3D,MAAO,WACjG,CAAC;AACH"}
|
package/esm/ops/ServiceOps.js
CHANGED
|
@@ -3,13 +3,13 @@ import fs from 'fs';
|
|
|
3
3
|
import { printMessage, createTable, debugMessage, showSpinner, succeedSpinner, failSpinner } from '../utils/Console';
|
|
4
4
|
const {
|
|
5
5
|
getRealmName
|
|
6
|
-
} = frodo.
|
|
6
|
+
} = frodo.utils;
|
|
7
7
|
const {
|
|
8
8
|
getTypedFilename,
|
|
9
9
|
titleCase,
|
|
10
10
|
saveJsonToFile,
|
|
11
11
|
getWorkingDirectory
|
|
12
|
-
} = frodo.utils
|
|
12
|
+
} = frodo.utils;
|
|
13
13
|
const {
|
|
14
14
|
getListOfServices,
|
|
15
15
|
exportServices,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceOps.js","names":["frodo","state","fs","printMessage","createTable","debugMessage","showSpinner","succeedSpinner","failSpinner","getRealmName","helper","utils","getTypedFilename","titleCase","saveJsonToFile","getWorkingDirectory","impex","getListOfServices","exportServices","exportService","getFullServices","createServiceExportTemplate","importService","importServices","deleteFullService","deleteFullServices","service","listServices","long","globalConfig","services","sort","a","b","_id","localeCompare","table","push","name","toString","error","stack","exportServicesToFile","file","exportData","fileName","getRealm","exportServiceToFile","serviceId","exportServicesToFiles","_type","importServiceFromFile","clean","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","_importError$response","_importError$response2","_importError$response3","_importError$response4","message","response","detail","importFirstServiceFromFile","Object","keys","length","_importError$response5","_importError$response6","_importError$response7","_importError$response8","importServicesFromFile","status","importServicesFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","deleteService","_error$response","_error$response$data","deleteServices"],"sources":["../../src/ops/ServiceOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n printMessage,\n createTable,\n debugMessage,\n showSpinner,\n succeedSpinner,\n failSpinner,\n} from '../utils/Console';\nimport type { ServiceExportInterface } from '@rockcarver/frodo-lib/types/ops/OpsTypes';\n\nconst { getRealmName } = frodo.helper.utils;\nconst { getTypedFilename, titleCase, saveJsonToFile, getWorkingDirectory } =\n frodo.utils.impex;\nconst {\n getListOfServices,\n exportServices,\n exportService,\n getFullServices,\n createServiceExportTemplate,\n importService,\n importServices,\n deleteFullService,\n deleteFullServices,\n} = frodo.service;\n\n/**\n * List services\n */\nexport async function listServices(long = false, globalConfig = false) {\n try {\n const services = await getListOfServices(globalConfig);\n services.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Service Id', 'Service Name']);\n for (const service of services) {\n table.push([service._id, service.name]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const service of services) {\n printMessage(`${service._id}`, 'data');\n }\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all services to file\n * @param {string} file file name\n */\nexport async function exportServicesToFile(file, globalConfig = false) {\n const exportData = await exportServices(globalConfig);\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Services`,\n `service`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export service to file\n * @param {string} serviceId service id\n * @param {string} file file name\n */\nexport async function exportServiceToFile(\n serviceId: string,\n file: string,\n globalConfig = false\n) {\n const exportData = await exportService(serviceId, globalConfig);\n let fileName = getTypedFilename(serviceId, `service`);\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all services to separate files\n */\nexport async function exportServicesToFiles(globalConfig = false) {\n debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);\n const services = await getFullServices(globalConfig);\n for (const service of services) {\n const fileName = getTypedFilename(service._type._id, `service`);\n const exportData = createServiceExportTemplate();\n exportData.service[service._type._id] = service;\n debugMessage(\n `cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${fileName}`\n );\n saveJsonToFile(exportData, fileName);\n }\n debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);\n}\n\n/**\n * Import a service from file\n * @param {string} serviceId service id/name\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServiceFromFile(\n serviceId: string,\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${file}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && importData.service[serviceId]) {\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean, globalConfig);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${serviceId} not found!`);\n }\n });\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${file}]`\n );\n}\n\n/**\n * Import first service from file\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importFirstServiceFromFile(\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: start [file=${file}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && Object.keys(importData.service).length) {\n const serviceId = Object.keys(importData.service)[0];\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean, globalConfig);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing service...`);\n failSpinner(`No service found in ${file}!`);\n }\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: end [file=${file}]`\n );\n });\n}\n\n/**\n * Import services from file\n * @param {String} file file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFile(\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${file}]`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${file}`);\n const importData = JSON.parse(data) as ServiceExportInterface;\n try {\n await importServices(importData, clean, globalConfig);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.ServiceOps.importServiceFromFile: end [file=${file}]`);\n });\n}\n\n/**\n * Import all services from separate files\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFiles(\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.service.json')\n );\n for (const file of agentFiles) {\n await importServicesFromFile(file, clean, globalConfig);\n }\n debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);\n}\n\n/**\n * Delete a service by id/name\n * @param {string} serviceId Reference to the service to delete\n */\nexport async function deleteService(serviceId: string, globalConfig = false) {\n try {\n await deleteFullService(serviceId, globalConfig);\n } catch (error) {\n const message = error.response?.data?.message;\n printMessage(`Delete service '${serviceId}': ${message}`, 'error');\n }\n}\n\n/**\n * Delete all services\n */\nexport async function deleteServices(globalConfig = false) {\n await deleteFullServices(globalConfig);\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,EACdC,WAAW,QACN,kBAAkB;AAGzB,MAAM;EAAEC;AAAa,CAAC,GAAGT,KAAK,CAACU,MAAM,CAACC,KAAK;AAC3C,MAAM;EAAEC,gBAAgB;EAAEC,SAAS;EAAEC,cAAc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oB,eAAA,wBAAAC,oBAAA,GAAdD,eAAA,CAAgB9B,IAAI,cAAA+B,oBAAA,uBAApBA,oBAAA,CAAsBtB,OAAO;IAC7C/D,YAAY,CAAE,mBAAkB6C,SAAU,MAAKkB,OAAQ,EAAC,EAAE,OAAO,CAAC;EACpE;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAeuB,cAAcA,CAAC5D,YAAY,GAAG,KAAK,EAAE;EACzD,MAAMJ,kBAAkB,CAACI,YAAY,CAAC;AACxC"}
|
|
1
|
+
{"version":3,"file":"ServiceOps.js","names":["frodo","state","fs","printMessage","createTable","debugMessage","showSpinner","succeedSpinner","failSpinner","getRealmName","utils","getTypedFilename","titleCase","saveJsonToFile","getWorkingDirectory","getListOfServices","exportServices","exportService","getFullServices","createServiceExportTemplate","importService","importServices","deleteFullService","deleteFullServices","service","listServices","long","globalConfig","services","sort","a","b","_id","localeCompare","table","push","name","toString","error","stack","exportServicesToFile","file","exportData","fileName","getRealm","exportServiceToFile","serviceId","exportServicesToFiles","_type","importServiceFromFile","clean","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","_importError$response","_importError$response2","_importError$response3","_importError$response4","message","response","detail","importFirstServiceFromFile","Object","keys","length","_importError$response5","_importError$response6","_importError$response7","_importError$response8","importServicesFromFile","status","importServicesFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","deleteService","_error$response","_error$response$data","deleteServices"],"sources":["../../src/ops/ServiceOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n printMessage,\n createTable,\n debugMessage,\n showSpinner,\n succeedSpinner,\n failSpinner,\n} from '../utils/Console';\nimport type { ServiceExportInterface } from '@rockcarver/frodo-lib/types/ops/OpsTypes';\n\nconst { getRealmName } = frodo.utils;\nconst { getTypedFilename, titleCase, saveJsonToFile, getWorkingDirectory } =\n frodo.utils;\nconst {\n getListOfServices,\n exportServices,\n exportService,\n getFullServices,\n createServiceExportTemplate,\n importService,\n importServices,\n deleteFullService,\n deleteFullServices,\n} = frodo.service;\n\n/**\n * List services\n */\nexport async function listServices(long = false, globalConfig = false) {\n try {\n const services = await getListOfServices(globalConfig);\n services.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Service Id', 'Service Name']);\n for (const service of services) {\n table.push([service._id, service.name]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const service of services) {\n printMessage(`${service._id}`, 'data');\n }\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all services to file\n * @param {string} file file name\n */\nexport async function exportServicesToFile(file, globalConfig = false) {\n const exportData = await exportServices(globalConfig);\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Services`,\n `service`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export service to file\n * @param {string} serviceId service id\n * @param {string} file file name\n */\nexport async function exportServiceToFile(\n serviceId: string,\n file: string,\n globalConfig = false\n) {\n const exportData = await exportService(serviceId, globalConfig);\n let fileName = getTypedFilename(serviceId, `service`);\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all services to separate files\n */\nexport async function exportServicesToFiles(globalConfig = false) {\n debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);\n const services = await getFullServices(globalConfig);\n for (const service of services) {\n const fileName = getTypedFilename(service._type._id, `service`);\n const exportData = createServiceExportTemplate();\n exportData.service[service._type._id] = service;\n debugMessage(\n `cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${fileName}`\n );\n saveJsonToFile(exportData, fileName);\n }\n debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);\n}\n\n/**\n * Import a service from file\n * @param {string} serviceId service id/name\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServiceFromFile(\n serviceId: string,\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${file}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && importData.service[serviceId]) {\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean, globalConfig);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${serviceId} not found!`);\n }\n });\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${file}]`\n );\n}\n\n/**\n * Import first service from file\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importFirstServiceFromFile(\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: start [file=${file}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && Object.keys(importData.service).length) {\n const serviceId = Object.keys(importData.service)[0];\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean, globalConfig);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing service...`);\n failSpinner(`No service found in ${file}!`);\n }\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: end [file=${file}]`\n );\n });\n}\n\n/**\n * Import services from file\n * @param {String} file file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFile(\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${file}]`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${file}`);\n const importData = JSON.parse(data) as ServiceExportInterface;\n try {\n await importServices(importData, clean, globalConfig);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.ServiceOps.importServiceFromFile: end [file=${file}]`);\n });\n}\n\n/**\n * Import all services from separate files\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFiles(\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.service.json')\n );\n for (const file of agentFiles) {\n await importServicesFromFile(file, clean, globalConfig);\n }\n debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);\n}\n\n/**\n * Delete a service by id/name\n * @param {string} serviceId Reference to the service to delete\n */\nexport async function deleteService(serviceId: string, globalConfig = false) {\n try {\n await deleteFullService(serviceId, globalConfig);\n } catch (error) {\n const message = error.response?.data?.message;\n printMessage(`Delete service '${serviceId}': ${message}`, 'error');\n }\n}\n\n/**\n * Delete all services\n */\nexport async function deleteServices(globalConfig = false) {\n await deleteFullServices(globalConfig);\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,EACdC,WAAW,QACN,kBAAkB;AAGzB,MAAM;EAAEC;AAAa,CAAC,GAAGT,KAAK,CAACU,KAAK;AACpC,MAAM;EAAEC,gBAAgB;EAAEC,SAAS;EAAE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wBAAAC,oBAAA,GAAdD,eAAA,CAAgB9B,IAAI,cAAA+B,oBAAA,uBAApBA,oBAAA,CAAsBtB,OAAO;IAC7C7D,YAAY,CAAE,mBAAkB2C,SAAU,MAAKkB,OAAQ,EAAC,EAAE,OAAO,CAAC;EACpE;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAeuB,cAAcA,CAAC5D,YAAY,GAAG,KAAK,EAAE;EACzD,MAAMJ,kBAAkB,CAACI,YAAY,CAAC;AACxC"}
|
package/esm/ops/ThemeOps.js
CHANGED
package/esm/ops/ThemeOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeOps.js","names":["frodo","fs","printMessage","createTable","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","saveToFile","getTypedFilename","getRealmString","validateImport","utils","impex","getThemes","getThemeByName","getTheme","putThemeByName","putTheme","putThemes","deleteTheme","deleteThemeByName","deleteThemes","theme","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","sort","a","b","localeCompare","forEach","isDefault","table","push","toString","exportThemeByName","file","fileName","themeData","error","message","exportThemeById","id","exportThemesToFile","allThemesData","length","exportThemesToFiles","importThemeByName","readFile","err","data","JSON","parse","meta","found","hasOwnProperty","call","importThemeById","themeId","importThemesFromFile","fileData","Object","keys","then","result","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","count","total","files","readFileSync","importFirstThemeFromFile","deleteThemeCmd","undefined","deleteThemeByNameCmd","deleteAllThemes","deleteThemesCmd"],"sources":["../../src/ops/ThemeOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ThemeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n printMessage,\n createTable,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { saveToFile, getTypedFilename } from '../utils/ExportImportUtils';\n\nconst { getRealmString, validateImport } = frodo.utils.impex;\nconst {\n getThemes,\n getThemeByName,\n getTheme,\n putThemeByName,\n putTheme,\n putThemes,\n deleteTheme,\n deleteThemeByName,\n deleteThemes,\n} = frodo.theme;\n\n/**\n * Get a one-line description of the theme\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(themeObj: ThemeSkeleton): string {\n const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${\n themeObj.linkedTrees\n ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')'\n : ''\n }`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Linked Journey(s) | Id |\\n';\n markdown += '| ---- | ----------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the theme in markdown\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a table-row of the theme in markdown\n */\nexport function getTableRowMd(themeObj: ThemeSkeleton): string {\n const row = `| ${themeObj.name} | ${\n themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''\n } | \\`${themeObj._id}\\` |`;\n return row;\n}\n\n/**\n * List all the themes\n * @param {boolean} long Long version, more fields\n */\nexport async function listThemes(long = false) {\n const themeList = await getThemes();\n themeList.sort((a, b) => a.name.localeCompare(b.name));\n if (!long) {\n themeList.forEach((theme) => {\n printMessage(\n `${theme.isDefault ? theme.name['brightCyan'] : theme.name}`,\n 'data'\n );\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Id'['brightCyan'],\n 'Default'['brightCyan'],\n ]);\n themeList.forEach((theme) => {\n table.push([\n `${theme.name}`,\n `${theme._id}`,\n `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`,\n ]);\n });\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Export theme by name to file\n * @param {String} name theme name\n * @param {String} file optional export file name\n */\nexport async function exportThemeByName(name, file) {\n let fileName = getTypedFilename(name, 'theme');\n if (file) {\n fileName = file;\n }\n createProgressIndicator('determinate', 1, `Exporting ${name}`);\n try {\n const themeData = await getThemeByName(name);\n updateProgressIndicator(`Writing file ${fileName}`);\n saveToFile('theme', [themeData], '_id', fileName);\n stopProgressIndicator(`Successfully exported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(`${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export theme by uuid to file\n * @param {String} id theme uuid\n * @param {String} file optional export file name\n */\nexport async function exportThemeById(id, file) {\n let fileName = getTypedFilename(id, 'theme');\n if (file) {\n fileName = file;\n }\n createProgressIndicator('determinate', 1, `Exporting ${id}`);\n try {\n const themeData = await getTheme(id);\n updateProgressIndicator(`Writing file ${fileName}`);\n saveToFile('theme', [themeData], '_id', fileName);\n stopProgressIndicator(`Successfully exported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(`${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export all themes to file\n * @param {String} file optional export file name\n */\nexport async function exportThemesToFile(file) {\n let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');\n if (file) {\n fileName = file;\n }\n const allThemesData = await getThemes();\n createProgressIndicator(\n 'determinate',\n allThemesData.length,\n 'Exporting themes'\n );\n for (const themeData of allThemesData) {\n updateProgressIndicator(`Exporting theme ${themeData.name}`);\n }\n saveToFile('theme', allThemesData, '_id', fileName);\n stopProgressIndicator(\n `${allThemesData.length} themes exported to ${fileName}.`\n );\n}\n\n/**\n * Export all themes to separate files\n */\nexport async function exportThemesToFiles() {\n const allThemesData = await getThemes();\n createProgressIndicator(\n 'determinate',\n allThemesData.length,\n 'Exporting themes'\n );\n for (const themeData of allThemesData) {\n updateProgressIndicator(`Writing theme ${themeData.name}`);\n const fileName = getTypedFilename(themeData.name, 'theme');\n saveToFile('theme', themeData, '_id', fileName);\n }\n stopProgressIndicator(`${allThemesData.length} themes exported.`);\n}\n\n/**\n * Import theme by name from file\n * @param {String} name theme name\n * @param {String} file import file name\n */\nexport async function importThemeByName(name, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n let found = false;\n for (const id in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, id)) {\n if (themeData.theme[id].name === name) {\n found = true;\n updateProgressIndicator(`Importing ${themeData.theme[id].name}`);\n try {\n await putThemeByName(name, themeData.theme[id]);\n stopProgressIndicator(`Successfully imported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[id].name}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[id].name}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n }\n if (!found) {\n stopProgressIndicator(`Theme ${name} not found!`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import theme by uuid from file\n * @param {String} id theme uuid\n * @param {String} file import file name\n */\nexport async function importThemeById(id, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n let found = false;\n for (const themeId in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, themeId)) {\n if (themeId === id) {\n found = true;\n updateProgressIndicator(\n `Importing ${themeData.theme[themeId]._id}`\n );\n try {\n await putTheme(themeId, themeData.theme[themeId]);\n stopProgressIndicator(`Successfully imported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n }\n if (!found) {\n stopProgressIndicator(`Theme ${id} not found!`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all themes from single file\n * @param {String} file import file name\n */\nexport async function importThemesFromFile(file) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(\n 'determinate',\n Object.keys(fileData.theme).length,\n 'Importing themes...'\n );\n for (const id in fileData.theme) {\n if ({}.hasOwnProperty.call(fileData.theme, id)) {\n updateProgressIndicator(`Importing ${fileData.theme[id].name}`);\n }\n }\n putThemes(fileData.theme).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n `Error importing ${Object.keys(fileData.theme).length} themes!`\n );\n printMessage(\n `Error importing ${\n Object.keys(fileData.theme).length\n } themes from ${file}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n `Successfully imported ${\n Object.keys(fileData.theme).length\n } themes.`\n );\n }\n });\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import themes from separate files\n */\nexport async function importThemesFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.theme.json')\n );\n\n createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing themes...'\n );\n let fileData = null;\n let count = 0;\n let total = 0;\n let files = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n // eslint-disable-next-line no-await-in-loop\n const result = await putThemes(fileData.theme);\n if (result == null) {\n printMessage(`Error importing ${count} themes from ${file}`, 'error');\n } else {\n files += 1;\n total += count;\n updateProgressIndicator(`Imported ${count} theme(s) from ${file}`);\n }\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n `Finished importing ${total} theme(s) from ${files} file(s).`\n );\n}\n\n/**\n * Import first theme from file\n * @param {String} file import file name\n */\nexport async function importFirstThemeFromFile(file) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n for (const id in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, id)) {\n updateProgressIndicator(`Importing ${themeData.theme[id].name}`);\n putTheme(id, themeData.theme[id]).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[id].name}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[id].name}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n `Successfully imported theme ${themeData.theme[id].name}`\n );\n }\n });\n break;\n }\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Delete theme by id\n * @param {String} id theme id\n */\nexport async function deleteThemeCmd(id) {\n createProgressIndicator('indeterminate', undefined, `Deleting ${id}...`);\n try {\n await deleteTheme(id);\n stopProgressIndicator(`Deleted ${id}.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete theme by name\n * @param {String} name theme name\n */\nexport async function deleteThemeByNameCmd(name) {\n createProgressIndicator('indeterminate', undefined, `Deleting ${name}...`);\n try {\n await deleteThemeByName(name);\n stopProgressIndicator(`Deleted ${name}.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n */\nexport async function deleteAllThemes() {\n createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all realm themes...`\n );\n try {\n await deleteThemes();\n stopProgressIndicator(`Deleted all realm themes.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n * @deprecated since version 0.14.0\n */\nexport async function deleteThemesCmd() {\n return deleteAllThemes();\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,YAAY,EACZC,WAAW,EACXC,uBAAuB,EACvB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IAAI;IACF,MAAMpE,YAAY,CAAC,CAAC;IACpBf,qBAAqB,CAAE,2BAA0B,EAAE,SAAS,CAAC;EAC/D,CAAC,CAAC,OAAO4C,KAAK,EAAE;IACd5C,qBAAqB,CAAE,UAAS4C,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EAC1D;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAeyC,eAAeA,CAAA,EAAG;EACtC,OAAOD,eAAe,CAAC,CAAC;AAC1B"}
|
|
1
|
+
{"version":3,"file":"ThemeOps.js","names":["frodo","fs","printMessage","createTable","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","saveToFile","getTypedFilename","getRealmString","validateImport","utils","getThemes","getThemeByName","getTheme","putThemeByName","putTheme","putThemes","deleteTheme","deleteThemeByName","deleteThemes","theme","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","sort","a","b","localeCompare","forEach","isDefault","table","push","toString","exportThemeByName","file","fileName","themeData","error","message","exportThemeById","id","exportThemesToFile","allThemesData","length","exportThemesToFiles","importThemeByName","readFile","err","data","JSON","parse","meta","found","hasOwnProperty","call","importThemeById","themeId","importThemesFromFile","fileData","Object","keys","then","result","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","count","total","files","readFileSync","importFirstThemeFromFile","deleteThemeCmd","undefined","deleteThemeByNameCmd","deleteAllThemes","deleteThemesCmd"],"sources":["../../src/ops/ThemeOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ThemeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n printMessage,\n createTable,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { saveToFile, getTypedFilename } from '../utils/ExportImportUtils';\n\nconst { getRealmString, validateImport } = frodo.utils;\nconst {\n getThemes,\n getThemeByName,\n getTheme,\n putThemeByName,\n putTheme,\n putThemes,\n deleteTheme,\n deleteThemeByName,\n deleteThemes,\n} = frodo.theme;\n\n/**\n * Get a one-line description of the theme\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(themeObj: ThemeSkeleton): string {\n const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${\n themeObj.linkedTrees\n ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')'\n : ''\n }`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Linked Journey(s) | Id |\\n';\n markdown += '| ---- | ----------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the theme in markdown\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a table-row of the theme in markdown\n */\nexport function getTableRowMd(themeObj: ThemeSkeleton): string {\n const row = `| ${themeObj.name} | ${\n themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''\n } | \\`${themeObj._id}\\` |`;\n return row;\n}\n\n/**\n * List all the themes\n * @param {boolean} long Long version, more fields\n */\nexport async function listThemes(long = false) {\n const themeList = await getThemes();\n themeList.sort((a, b) => a.name.localeCompare(b.name));\n if (!long) {\n themeList.forEach((theme) => {\n printMessage(\n `${theme.isDefault ? theme.name['brightCyan'] : theme.name}`,\n 'data'\n );\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Id'['brightCyan'],\n 'Default'['brightCyan'],\n ]);\n themeList.forEach((theme) => {\n table.push([\n `${theme.name}`,\n `${theme._id}`,\n `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`,\n ]);\n });\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Export theme by name to file\n * @param {String} name theme name\n * @param {String} file optional export file name\n */\nexport async function exportThemeByName(name, file) {\n let fileName = getTypedFilename(name, 'theme');\n if (file) {\n fileName = file;\n }\n createProgressIndicator('determinate', 1, `Exporting ${name}`);\n try {\n const themeData = await getThemeByName(name);\n updateProgressIndicator(`Writing file ${fileName}`);\n saveToFile('theme', [themeData], '_id', fileName);\n stopProgressIndicator(`Successfully exported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(`${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export theme by uuid to file\n * @param {String} id theme uuid\n * @param {String} file optional export file name\n */\nexport async function exportThemeById(id, file) {\n let fileName = getTypedFilename(id, 'theme');\n if (file) {\n fileName = file;\n }\n createProgressIndicator('determinate', 1, `Exporting ${id}`);\n try {\n const themeData = await getTheme(id);\n updateProgressIndicator(`Writing file ${fileName}`);\n saveToFile('theme', [themeData], '_id', fileName);\n stopProgressIndicator(`Successfully exported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(`${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export all themes to file\n * @param {String} file optional export file name\n */\nexport async function exportThemesToFile(file) {\n let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');\n if (file) {\n fileName = file;\n }\n const allThemesData = await getThemes();\n createProgressIndicator(\n 'determinate',\n allThemesData.length,\n 'Exporting themes'\n );\n for (const themeData of allThemesData) {\n updateProgressIndicator(`Exporting theme ${themeData.name}`);\n }\n saveToFile('theme', allThemesData, '_id', fileName);\n stopProgressIndicator(\n `${allThemesData.length} themes exported to ${fileName}.`\n );\n}\n\n/**\n * Export all themes to separate files\n */\nexport async function exportThemesToFiles() {\n const allThemesData = await getThemes();\n createProgressIndicator(\n 'determinate',\n allThemesData.length,\n 'Exporting themes'\n );\n for (const themeData of allThemesData) {\n updateProgressIndicator(`Writing theme ${themeData.name}`);\n const fileName = getTypedFilename(themeData.name, 'theme');\n saveToFile('theme', themeData, '_id', fileName);\n }\n stopProgressIndicator(`${allThemesData.length} themes exported.`);\n}\n\n/**\n * Import theme by name from file\n * @param {String} name theme name\n * @param {String} file import file name\n */\nexport async function importThemeByName(name, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n let found = false;\n for (const id in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, id)) {\n if (themeData.theme[id].name === name) {\n found = true;\n updateProgressIndicator(`Importing ${themeData.theme[id].name}`);\n try {\n await putThemeByName(name, themeData.theme[id]);\n stopProgressIndicator(`Successfully imported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[id].name}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[id].name}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n }\n if (!found) {\n stopProgressIndicator(`Theme ${name} not found!`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import theme by uuid from file\n * @param {String} id theme uuid\n * @param {String} file import file name\n */\nexport async function importThemeById(id, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n let found = false;\n for (const themeId in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, themeId)) {\n if (themeId === id) {\n found = true;\n updateProgressIndicator(\n `Importing ${themeData.theme[themeId]._id}`\n );\n try {\n await putTheme(themeId, themeData.theme[themeId]);\n stopProgressIndicator(`Successfully imported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n }\n if (!found) {\n stopProgressIndicator(`Theme ${id} not found!`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all themes from single file\n * @param {String} file import file name\n */\nexport async function importThemesFromFile(file) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(\n 'determinate',\n Object.keys(fileData.theme).length,\n 'Importing themes...'\n );\n for (const id in fileData.theme) {\n if ({}.hasOwnProperty.call(fileData.theme, id)) {\n updateProgressIndicator(`Importing ${fileData.theme[id].name}`);\n }\n }\n putThemes(fileData.theme).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n `Error importing ${Object.keys(fileData.theme).length} themes!`\n );\n printMessage(\n `Error importing ${\n Object.keys(fileData.theme).length\n } themes from ${file}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n `Successfully imported ${\n Object.keys(fileData.theme).length\n } themes.`\n );\n }\n });\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import themes from separate files\n */\nexport async function importThemesFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.theme.json')\n );\n\n createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing themes...'\n );\n let fileData = null;\n let count = 0;\n let total = 0;\n let files = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n // eslint-disable-next-line no-await-in-loop\n const result = await putThemes(fileData.theme);\n if (result == null) {\n printMessage(`Error importing ${count} themes from ${file}`, 'error');\n } else {\n files += 1;\n total += count;\n updateProgressIndicator(`Imported ${count} theme(s) from ${file}`);\n }\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n `Finished importing ${total} theme(s) from ${files} file(s).`\n );\n}\n\n/**\n * Import first theme from file\n * @param {String} file import file name\n */\nexport async function importFirstThemeFromFile(file) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n for (const id in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, id)) {\n updateProgressIndicator(`Importing ${themeData.theme[id].name}`);\n putTheme(id, themeData.theme[id]).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[id].name}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[id].name}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n `Successfully imported theme ${themeData.theme[id].name}`\n );\n }\n });\n break;\n }\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Delete theme by id\n * @param {String} id theme id\n */\nexport async function deleteThemeCmd(id) {\n createProgressIndicator('indeterminate', undefined, `Deleting ${id}...`);\n try {\n await deleteTheme(id);\n stopProgressIndicator(`Deleted ${id}.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete theme by name\n * @param {String} name theme name\n */\nexport async function deleteThemeByNameCmd(name) {\n createProgressIndicator('indeterminate', undefined, `Deleting ${name}...`);\n try {\n await deleteThemeByName(name);\n stopProgressIndicator(`Deleted ${name}.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n */\nexport async function deleteAllThemes() {\n createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all realm themes...`\n );\n try {\n await deleteThemes();\n stopProgressIndicator(`Deleted all realm themes.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n * @deprecated since version 0.14.0\n */\nexport async function deleteThemesCmd() {\n return deleteAllThemes();\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,YAAY,EACZC,WAAW,EACXC,uBAAuB,EACvBC,uBAAuB,EACvBC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,UAAU,EAAEC,gBAAgB,QAAQ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