@rockcarver/frodo-cli 2.0.0-21 → 2.0.0-23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/esm/cli/FrodoCommand.js +3 -1
- package/esm/cli/FrodoCommand.js.map +1 -1
- package/esm/cli/agent/agent-web.js +2 -2
- package/esm/cli/agent/agent-web.js.map +1 -1
- package/esm/cli/app/app-import.js +1 -1
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/idm/idm-export.js +14 -8
- package/esm/cli/idm/idm-export.js.map +1 -1
- package/esm/cli/idm/idm-import.js +14 -8
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/cli/journey/journey-export.js +2 -3
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/oauth/oauth-client-import.js +1 -1
- package/esm/cli/oauth/oauth-client-import.js.map +1 -1
- package/esm/cli/service/service-import.js +2 -3
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/ops/AdminFederationOps.js +29 -20
- package/esm/ops/AdminFederationOps.js.map +1 -1
- package/esm/ops/AgentOps.js +41 -34
- package/esm/ops/AgentOps.js.map +1 -1
- package/esm/ops/ApplicationOps.js +23 -17
- package/esm/ops/ApplicationOps.js.map +1 -1
- package/esm/ops/CirclesOfTrustOps.js +27 -20
- package/esm/ops/CirclesOfTrustOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js +19 -14
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js +14 -22
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/IdpOps.js +27 -19
- package/esm/ops/IdpOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +18 -51
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/OAuth2ClientOps.js +23 -17
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +27 -20
- package/esm/ops/PolicyOps.js.map +1 -1
- package/esm/ops/PolicySetOps.js +23 -17
- package/esm/ops/PolicySetOps.js.map +1 -1
- package/esm/ops/ResourceTypeOps.js +27 -20
- package/esm/ops/ResourceTypeOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js +22 -14
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/ScriptOps.js +22 -15
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/ServiceOps.js +21 -16
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js +21 -15
- package/esm/ops/ThemeOps.js.map +1 -1
- package/package.json +2 -2
package/esm/ops/AgentOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOps.js","names":["frodo","state","fs","createTable","debugMessage","failSpinner","printMessage","showSpinner","succeedSpinner","getTypedFilename","saveJsonToFile","titleCase","getRealmName","utils","createAgentExportTemplate","readAgents","readIdentityGatewayAgents","readJavaAgents","readWebAgents","exportAgents","exportIdentityGatewayAgents","exportJavaAgents","exportWebAgents","exportAgent","exportIdentityGatewayAgent","exportJavaAgent","exportWebAgent","importAgent","importIdentityGatewayAgent","importJavaAgent","importWebAgent","importAgents","importIdentityGatewayAgents","importJavaAgents","importWebAgents","agent","agentTypeToFileIdMap","IdentityGatewayAgent","J2EEAgent","WebAgent","listAgents","long","agents","table","status","_type","_id","push","name","toString","forEach","error","stack","listIdentityGatewayAgents","listJavaAgents","listWebAgents","exportAgentsToFile","file","exportData","fileName","getRealm","exportIdentityGatewayAgentsToFile","exportJavaAgentsToFile","exportWebAgentsToFile","exportAgentToFile","agentId","exportIdentityGatewayAgentToFile","exportJavaAgentToFile","exportWebAgentToFile","exportAgentsToFiles","length","exportIdentityGatewayAgentsToFiles","exportJavaAgentsToFiles","exportWebAgentsToFiles","importAgentFromFile","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","importFirstAgentFromFile","Object","keys","values","importAgentsFromFile","message","response","importAgentsFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","importIdentityGatewayAgentFromFile","importFirstIdentityGatewayAgentFromFile","importIdentityGatewayAgentsFromFile","importIdentityGatewayAgentsFromFiles","importJavaAgentFromFile","importFirstJavaAgentFromFile","importJavaAgentsFromFile","importJavaAgentsFromFiles","importWebAgentFromFile","importFirstWebAgentFromFile","importWebAgentsFromFile","importWebAgentsFromFiles"],"sources":["../../src/ops/AgentOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type AgentExportInterface } from '@rockcarver/frodo-lib/types/ops/AgentOps';\nimport fs from 'fs';\n\nimport {\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n succeedSpinner,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\n\nconst { getRealmName } = frodo.utils;\nconst {\n createAgentExportTemplate,\n readAgents,\n readIdentityGatewayAgents,\n readJavaAgents,\n readWebAgents,\n exportAgents,\n exportIdentityGatewayAgents,\n exportJavaAgents,\n exportWebAgents,\n exportAgent,\n exportIdentityGatewayAgent,\n exportJavaAgent,\n exportWebAgent,\n importAgent,\n importIdentityGatewayAgent,\n importJavaAgent,\n importWebAgent,\n importAgents,\n importIdentityGatewayAgents,\n importJavaAgents,\n importWebAgents,\n} = frodo.agent;\n\nconst agentTypeToFileIdMap = {\n IdentityGatewayAgent: 'gateway.agent',\n J2EEAgent: 'java.agent',\n WebAgent: 'web.agent',\n};\n\n/**\n * List agents\n */\nexport async function listAgents(long = false) {\n try {\n const agents = await readAgents();\n if (long) {\n const table = createTable(['Agent Id', 'Status', 'Agent Type']);\n for (const agent of agents) {\n let status = 'Unknown';\n switch (agent._type._id) {\n case 'J2EEAgent':\n status = agent['globalJ2EEAgentConfig']['status'];\n break;\n case 'WebAgent':\n status = agent['globalWebAgentConfig']['status'];\n break;\n default:\n status = agent.status as string;\n break;\n }\n table.push([\n agent._id,\n status === 'Active' ? 'Active'['brightGreen'] : status['brightRed'],\n agent._type.name,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * List identity gateway agents\n */\nexport async function listIdentityGatewayAgents(long = false) {\n try {\n const agents = await readIdentityGatewayAgents();\n if (long) {\n const table = createTable(['Gateway Agent Id', 'Status']);\n for (const agent of agents) {\n table.push([\n agent._id,\n agent.status === 'Active'\n ? 'Active'['brightGreen']\n : agent.status['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing gateway agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * List java agents\n */\nexport async function listJavaAgents(long = false) {\n try {\n const agents = await readJavaAgents();\n if (long) {\n const table = createTable(['Java Agent Id', 'Status']);\n for (const agent of agents) {\n table.push([\n agent._id,\n agent['globalJ2EEAgentConfig']['status'] === 'Active'\n ? 'Active'['brightGreen']\n : agent['globalJ2EEAgentConfig']['status']['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing java agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * List web agents\n */\nexport async function listWebAgents(long = false) {\n try {\n const agents = await readWebAgents();\n if (long) {\n const table = createTable(['Web Agent Id', 'Status']);\n for (const agent of agents) {\n table.push([\n agent._id,\n agent['globalWebAgentConfig']['status'] === 'Active'\n ? 'Active'['brightGreen']\n : agent['globalWebAgentConfig']['status']['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing web agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all agents to file\n * @param {string} file file name\n */\nexport async function exportAgentsToFile(file) {\n const exportData = await exportAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n 'agent'\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all identity gateway agents to file\n * @param {string} file file name\n */\nexport async function exportIdentityGatewayAgentsToFile(file) {\n const exportData = await exportIdentityGatewayAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n agentTypeToFileIdMap['IdentityGatewayAgent']\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all java agents to file\n * @param {string} file file name\n */\nexport async function exportJavaAgentsToFile(file) {\n const exportData = await exportJavaAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n agentTypeToFileIdMap['J2EEAgent']\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all web agents to file\n * @param {string} file file name\n */\nexport async function exportWebAgentsToFile(file) {\n const exportData = await exportWebAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n agentTypeToFileIdMap['WebAgent']\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportAgentToFile(agentId, file) {\n const exportData = await exportAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export identity gateway agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportIdentityGatewayAgentToFile(agentId, file) {\n const exportData = await exportIdentityGatewayAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export java agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportJavaAgentToFile(agentId, file) {\n const exportData = await exportJavaAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export web agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportWebAgentToFile(agentId, file) {\n const exportData = await exportWebAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all agents to separate files\n */\nexport async function exportAgentsToFiles() {\n const agents = await readAgents();\n debugMessage(`exportAgentsToFiles: ${agents.length} agents`);\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n debugMessage(`exportAgentsToFiles: exporting ${agent._id} to ${fileName}`);\n saveJsonToFile(exportData, fileName);\n }\n debugMessage(`exportAgentsToFiles: done.`);\n}\n\n/**\n * Export all identity gateway agents to separate files\n */\nexport async function exportIdentityGatewayAgentsToFiles() {\n const agents = await readIdentityGatewayAgents();\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n saveJsonToFile(exportData, fileName);\n }\n}\n\n/**\n * Export all java agents to separate files\n */\nexport async function exportJavaAgentsToFiles() {\n const agents = await readJavaAgents();\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n saveJsonToFile(exportData, fileName);\n }\n}\n\n/**\n * Export all web agents to separate files\n */\nexport async function exportWebAgentsToFiles() {\n const agents = await readWebAgents();\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n saveJsonToFile(exportData, fileName);\n }\n}\n\n/**\n * Import an agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importAgentFromFile(agentId: string, file: string) {\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 // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n });\n}\n\n/**\n * Import first agent from file\n * @param {string} file import file name\n */\nexport async function importFirstAgentFromFile(file: string) {\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 (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n failSpinner(`${importError}`);\n }\n return;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n });\n}\n\n/**\n * Import agents from file\n * @param {String} file file name\n */\nexport async function importAgentsFromFile(file) {\n debugMessage(`importAgentsFromFile: start`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`importAgentsFromFile: importing ${file}`);\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`importAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all agents from separate files\n */\nexport async function importAgentsFromFiles() {\n const names = fs.readdirSync('.');\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importAgentsFromFile(file);\n }\n}\n\n/**\n * Import an identity gateway agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importIdentityGatewayAgentFromFile(\n agentId: string,\n file: string\n) {\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentFromFile: start`);\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 // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importIdentityGatewayAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentFromFile: end`);\n });\n}\n\n/**\n * Import first identity gateway agent from file\n * @param {string} file import file name\n */\nexport async function importFirstIdentityGatewayAgentFromFile(file: string) {\n debugMessage(`cli.AgentOps.importFirstIdentityGatewayAgentFromFile: start`);\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 (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importIdentityGatewayAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n return;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n debugMessage(`cli.AgentOps.importFirstIdentityGatewayAgentFromFile: end`);\n });\n}\n\n/**\n * Import identity gateway agents from file\n * @param {String} file file name\n */\nexport async function importIdentityGatewayAgentsFromFile(file) {\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFile: start`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(\n `cli.AgentOps.importIdentityGatewayAgentsFromFile: importing ${file}`\n );\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importIdentityGatewayAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all identity gateway agents from separate files\n */\nexport async function importIdentityGatewayAgentsFromFiles() {\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFiles: start`);\n const names = fs.readdirSync('.');\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importIdentityGatewayAgentsFromFile(file);\n }\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFiles: end`);\n}\n\n/**\n * Import an java agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importJavaAgentFromFile(agentId: string, file: string) {\n debugMessage(`cli.AgentOps.importJavaAgentFromFile: start`);\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 // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importJavaAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n debugMessage(`cli.AgentOps.importJavaAgentFromFile: end`);\n });\n}\n\n/**\n * Import first java agent from file\n * @param {string} file import file name\n */\nexport async function importFirstJavaAgentFromFile(file: string) {\n debugMessage(`cli.AgentOps.importFirstJavaAgentFromFile: start`);\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 (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importJavaAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n return;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n debugMessage(`cli.AgentOps.importFirstJavaAgentFromFile: end`);\n });\n}\n\n/**\n * Import java agents from file\n * @param {String} file file name\n */\nexport async function importJavaAgentsFromFile(file) {\n debugMessage(`cli.AgentOps.importJavaAgentsFromFile: start`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.AgentOps.importJavaAgentsFromFile: importing ${file}`);\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importJavaAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.AgentOps.importJavaAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all java agents from separate files\n */\nexport async function importJavaAgentsFromFiles() {\n debugMessage(`cli.AgentOps.importJavaAgentsFromFiles: start`);\n const names = fs.readdirSync('.');\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importJavaAgentsFromFile(file);\n }\n debugMessage(`cli.AgentOps.importJavaAgentsFromFiles: end`);\n}\n\n/**\n * Import an web agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importWebAgentFromFile(agentId: string, file: string) {\n debugMessage(`cli.AgentOps.importWebAgentFromFile: start`);\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 // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importWebAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n debugMessage(`cli.AgentOps.importWebAgentFromFile: end`);\n });\n}\n\n/**\n * Import web gateway agent from file\n * @param {string} file import file name\n */\nexport async function importFirstWebAgentFromFile(file: string) {\n debugMessage(`cli.AgentOps.importFirstWebAgentFromFile: start`);\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 (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importWebAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n failSpinner(`caught it here ${importError}`);\n }\n break;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n debugMessage(`cli.AgentOps.importFirstWebAgentFromFile: end`);\n });\n}\n\n/**\n * Import web agents from file\n * @param {String} file file name\n */\nexport async function importWebAgentsFromFile(file) {\n debugMessage(`cli.AgentOps.importWebAgentsFromFile: start`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.AgentOps.importWebAgentsFromFile: importing ${file}`);\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importWebAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.AgentOps.importWebAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all web agents from separate files\n */\nexport async function importWebAgentsFromFiles() {\n debugMessage(`cli.AgentOps.importWebAgentsFromFiles: start`);\n const names = fs.readdirSync('.');\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importWebAgentsFromFile(file);\n }\n debugMessage(`cli.AgentOps.importWebAgentsFromFiles: end`);\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,QACT,kBAAkB;AACzB,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F,KAAK,GAAG1F,EAAE,CAAC2F,WAAW,CAAC,GAAG,CAAC;EACjC,MAAMC,UAAU,GAAGF,KAAK,CAACG,MAAM,CAAE/C,IAAI,IACnCA,IAAI,CAACgD,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,aAAa,CAC3C,CAAC;EACD,KAAK,MAAMxC,IAAI,IAAIqC,UAAU,EAAE;IAC7B,MAAMc,uBAAuB,CAACnD,IAAI,CAAC;EACrC;EACArD,YAAY,CAAE,4CAA2C,CAAC;AAC5D"}
|
|
1
|
+
{"version":3,"file":"AgentOps.js","names":["frodo","state","fs","createTable","debugMessage","failSpinner","printMessage","showSpinner","succeedSpinner","getTypedFilename","saveJsonToFile","titleCase","getRealmName","getFilePath","getWorkingDirectory","utils","createAgentExportTemplate","readAgents","readIdentityGatewayAgents","readJavaAgents","readWebAgents","exportAgents","exportIdentityGatewayAgents","exportJavaAgents","exportWebAgents","exportAgent","exportIdentityGatewayAgent","exportJavaAgent","exportWebAgent","importAgent","importIdentityGatewayAgent","importJavaAgent","importWebAgent","importAgents","importIdentityGatewayAgents","importJavaAgents","importWebAgents","agent","agentTypeToFileIdMap","IdentityGatewayAgent","J2EEAgent","WebAgent","listAgents","long","agents","table","status","_type","_id","push","name","toString","forEach","error","stack","listIdentityGatewayAgents","listJavaAgents","listWebAgents","exportAgentsToFile","file","exportData","fileName","getRealm","exportIdentityGatewayAgentsToFile","exportJavaAgentsToFile","exportWebAgentsToFile","exportAgentToFile","agentId","exportIdentityGatewayAgentToFile","exportJavaAgentToFile","exportWebAgentToFile","exportAgentsToFiles","length","filePath","exportIdentityGatewayAgentsToFiles","exportJavaAgentsToFiles","exportWebAgentsToFiles","importAgentFromFile","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","importFirstAgentFromFile","Object","keys","values","importAgentsFromFile","message","response","importAgentsFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","importIdentityGatewayAgentFromFile","importFirstIdentityGatewayAgentFromFile","importIdentityGatewayAgentsFromFile","importIdentityGatewayAgentsFromFiles","importJavaAgentFromFile","importFirstJavaAgentFromFile","importJavaAgentsFromFile","importJavaAgentsFromFiles","importWebAgentFromFile","importFirstWebAgentFromFile","importWebAgentsFromFile","importWebAgentsFromFiles"],"sources":["../../src/ops/AgentOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type AgentExportInterface } from '@rockcarver/frodo-lib/types/ops/AgentOps';\nimport fs from 'fs';\n\nimport {\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n succeedSpinner,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\n\nconst { getRealmName, getFilePath, getWorkingDirectory } = frodo.utils;\nconst {\n createAgentExportTemplate,\n readAgents,\n readIdentityGatewayAgents,\n readJavaAgents,\n readWebAgents,\n exportAgents,\n exportIdentityGatewayAgents,\n exportJavaAgents,\n exportWebAgents,\n exportAgent,\n exportIdentityGatewayAgent,\n exportJavaAgent,\n exportWebAgent,\n importAgent,\n importIdentityGatewayAgent,\n importJavaAgent,\n importWebAgent,\n importAgents,\n importIdentityGatewayAgents,\n importJavaAgents,\n importWebAgents,\n} = frodo.agent;\n\nconst agentTypeToFileIdMap = {\n IdentityGatewayAgent: 'gateway.agent',\n J2EEAgent: 'java.agent',\n WebAgent: 'web.agent',\n};\n\n/**\n * List agents\n */\nexport async function listAgents(long = false) {\n try {\n const agents = await readAgents();\n if (long) {\n const table = createTable(['Agent Id', 'Status', 'Agent Type']);\n for (const agent of agents) {\n let status = 'Unknown';\n switch (agent._type._id) {\n case 'J2EEAgent':\n status = agent['globalJ2EEAgentConfig']['status'];\n break;\n case 'WebAgent':\n status = agent['globalWebAgentConfig']['status'];\n break;\n default:\n status = agent.status as string;\n break;\n }\n table.push([\n agent._id,\n status === 'Active' ? 'Active'['brightGreen'] : status['brightRed'],\n agent._type.name,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * List identity gateway agents\n */\nexport async function listIdentityGatewayAgents(long = false) {\n try {\n const agents = await readIdentityGatewayAgents();\n if (long) {\n const table = createTable(['Gateway Agent Id', 'Status']);\n for (const agent of agents) {\n table.push([\n agent._id,\n agent.status === 'Active'\n ? 'Active'['brightGreen']\n : agent.status['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing gateway agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * List java agents\n */\nexport async function listJavaAgents(long = false) {\n try {\n const agents = await readJavaAgents();\n if (long) {\n const table = createTable(['Java Agent Id', 'Status']);\n for (const agent of agents) {\n table.push([\n agent._id,\n agent['globalJ2EEAgentConfig']['status'] === 'Active'\n ? 'Active'['brightGreen']\n : agent['globalJ2EEAgentConfig']['status']['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing java agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * List web agents\n */\nexport async function listWebAgents(long = false) {\n try {\n const agents = await readWebAgents();\n if (long) {\n const table = createTable(['Web Agent Id', 'Status']);\n for (const agent of agents) {\n table.push([\n agent._id,\n agent['globalWebAgentConfig']['status'] === 'Active'\n ? 'Active'['brightGreen']\n : agent['globalWebAgentConfig']['status']['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n agents.forEach((agent) => {\n printMessage(`${agent._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing web agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all agents to file\n * @param {string} file file name\n */\nexport async function exportAgentsToFile(file) {\n const exportData = await exportAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n 'agent'\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export all identity gateway agents to file\n * @param {string} file file name\n */\nexport async function exportIdentityGatewayAgentsToFile(file) {\n const exportData = await exportIdentityGatewayAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n agentTypeToFileIdMap['IdentityGatewayAgent']\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export all java agents to file\n * @param {string} file file name\n */\nexport async function exportJavaAgentsToFile(file) {\n const exportData = await exportJavaAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n agentTypeToFileIdMap['J2EEAgent']\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export all web agents to file\n * @param {string} file file name\n */\nexport async function exportWebAgentsToFile(file) {\n const exportData = await exportWebAgents();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Agents`,\n agentTypeToFileIdMap['WebAgent']\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportAgentToFile(agentId, file) {\n const exportData = await exportAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export identity gateway agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportIdentityGatewayAgentToFile(agentId, file) {\n const exportData = await exportIdentityGatewayAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export java agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportJavaAgentToFile(agentId, file) {\n const exportData = await exportJavaAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export web agent to file\n * @param {string} agentId agent id\n * @param {string} file file name\n */\nexport async function exportWebAgentToFile(agentId, file) {\n const exportData = await exportWebAgent(agentId);\n let fileName = getTypedFilename(\n agentId,\n agentTypeToFileIdMap[exportData.agents[agentId]._type._id]\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export all agents to separate files\n */\nexport async function exportAgentsToFiles() {\n const agents = await readAgents();\n debugMessage(`exportAgentsToFiles: ${agents.length} agents`);\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const filePath = getFilePath(fileName, true);\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n debugMessage(`exportAgentsToFiles: exporting ${agent._id} to ${filePath}`);\n saveJsonToFile(exportData, filePath);\n }\n debugMessage(`exportAgentsToFiles: done.`);\n}\n\n/**\n * Export all identity gateway agents to separate files\n */\nexport async function exportIdentityGatewayAgentsToFiles() {\n const agents = await readIdentityGatewayAgents();\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n saveJsonToFile(exportData, getFilePath(fileName, true));\n }\n}\n\n/**\n * Export all java agents to separate files\n */\nexport async function exportJavaAgentsToFiles() {\n const agents = await readJavaAgents();\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n saveJsonToFile(exportData, getFilePath(fileName, true));\n }\n}\n\n/**\n * Export all web agents to separate files\n */\nexport async function exportWebAgentsToFiles() {\n const agents = await readWebAgents();\n for (const agent of agents) {\n const fileName = getTypedFilename(\n agent._id,\n agentTypeToFileIdMap[agent._type._id]\n );\n const exportData = createAgentExportTemplate();\n exportData.agents[agent._id] = agent;\n saveJsonToFile(exportData, getFilePath(fileName, true));\n }\n}\n\n/**\n * Import an agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importAgentFromFile(agentId: string, file: string) {\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n });\n}\n\n/**\n * Import first agent from file\n * @param {string} file import file name\n */\nexport async function importFirstAgentFromFile(file: string) {\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n failSpinner(`${importError}`);\n }\n return;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n });\n}\n\n/**\n * Import agents from file\n * @param {String} file file name\n */\nexport async function importAgentsFromFile(file) {\n debugMessage(`importAgentsFromFile: start`);\n const filePath = getFilePath(file);\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`importAgentsFromFile: importing ${filePath}`);\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`importAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all agents from separate files\n */\nexport async function importAgentsFromFiles() {\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importAgentsFromFile(file);\n }\n}\n\n/**\n * Import an identity gateway agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importIdentityGatewayAgentFromFile(\n agentId: string,\n file: string\n) {\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentFromFile: start`);\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importIdentityGatewayAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentFromFile: end`);\n });\n}\n\n/**\n * Import first identity gateway agent from file\n * @param {string} file import file name\n */\nexport async function importFirstIdentityGatewayAgentFromFile(file: string) {\n debugMessage(`cli.AgentOps.importFirstIdentityGatewayAgentFromFile: start`);\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importIdentityGatewayAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n return;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n debugMessage(`cli.AgentOps.importFirstIdentityGatewayAgentFromFile: end`);\n });\n}\n\n/**\n * Import identity gateway agents from file\n * @param {String} file file name\n */\nexport async function importIdentityGatewayAgentsFromFile(file) {\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFile: start`);\n const filePath = getFilePath(file);\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(\n `cli.AgentOps.importIdentityGatewayAgentsFromFile: importing ${filePath}`\n );\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importIdentityGatewayAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all identity gateway agents from separate files\n */\nexport async function importIdentityGatewayAgentsFromFiles() {\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importIdentityGatewayAgentsFromFile(file);\n }\n debugMessage(`cli.AgentOps.importIdentityGatewayAgentsFromFiles: end`);\n}\n\n/**\n * Import an java agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importJavaAgentFromFile(agentId: string, file: string) {\n debugMessage(`cli.AgentOps.importJavaAgentFromFile: start`);\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importJavaAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n debugMessage(`cli.AgentOps.importJavaAgentFromFile: end`);\n });\n}\n\n/**\n * Import first java agent from file\n * @param {string} file import file name\n */\nexport async function importFirstJavaAgentFromFile(file: string) {\n debugMessage(`cli.AgentOps.importFirstJavaAgentFromFile: start`);\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importJavaAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n return;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n debugMessage(`cli.AgentOps.importFirstJavaAgentFromFile: end`);\n });\n}\n\n/**\n * Import java agents from file\n * @param {String} file file name\n */\nexport async function importJavaAgentsFromFile(file) {\n debugMessage(`cli.AgentOps.importJavaAgentsFromFile: start`);\n const filePath = getFilePath(file);\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(\n `cli.AgentOps.importJavaAgentsFromFile: importing ${filePath}`\n );\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importJavaAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.AgentOps.importJavaAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all java agents from separate files\n */\nexport async function importJavaAgentsFromFiles() {\n debugMessage(`cli.AgentOps.importJavaAgentsFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importJavaAgentsFromFile(file);\n }\n debugMessage(`cli.AgentOps.importJavaAgentsFromFiles: end`);\n}\n\n/**\n * Import an web agent from file\n * @param {string} agentId agent id/name\n * @param {string} file import file name\n */\nexport async function importWebAgentFromFile(agentId: string, file: string) {\n debugMessage(`cli.AgentOps.importWebAgentFromFile: start`);\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n // check if this is a file with multiple agents and get agent by id\n if (importData.agents && importData.agents[agentId]) {\n const agent = importData.agents[agentId];\n importData.agents = {};\n importData.agents[agentId] = agent;\n } else if (importData.agents) {\n importData.agents = null;\n }\n // if an agentId was specified, only import the matching agent\n if (importData.agents) {\n if (!verbose) showSpinner(`Importing ${agentId}...`);\n try {\n if (verbose) showSpinner(`Importing ${agentId}...`);\n await importWebAgent(agentId, importData);\n succeedSpinner(`Imported ${agentId}.`);\n } catch (importError) {\n failSpinner(`${importError}`);\n }\n } else {\n showSpinner(`Importing ${agentId}...`);\n failSpinner(`${agentId} not found!`);\n }\n debugMessage(`cli.AgentOps.importWebAgentFromFile: end`);\n });\n}\n\n/**\n * Import web gateway agent from file\n * @param {string} file import file name\n */\nexport async function importFirstWebAgentFromFile(file: string) {\n debugMessage(`cli.AgentOps.importFirstWebAgentFromFile: start`);\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (Object.keys(importData.agents).length > 0) {\n for (const agent of Object.values(importData.agents)) {\n if (!verbose) showSpinner(`Importing ${agent['_id']}...`);\n try {\n if (verbose) showSpinner(`Importing ${agent['_id']}...`);\n await importWebAgent(agent['_id'], importData);\n succeedSpinner(`Imported ${agent['_id']}.`);\n } catch (importError) {\n failSpinner(`caught it here ${importError}`);\n }\n break;\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No agents found!`);\n }\n debugMessage(`cli.AgentOps.importFirstWebAgentFromFile: end`);\n });\n}\n\n/**\n * Import web agents from file\n * @param {String} file file name\n */\nexport async function importWebAgentsFromFile(file) {\n debugMessage(`cli.AgentOps.importWebAgentsFromFile: start`);\n const filePath = getFilePath(file);\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.AgentOps.importWebAgentsFromFile: importing ${filePath}`);\n const importData = JSON.parse(data) as AgentExportInterface;\n try {\n await importWebAgents(importData);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.AgentOps.importWebAgentsFromFile: end`);\n });\n}\n\n/**\n * Import all web agents from separate files\n */\nexport async function importWebAgentsFromFiles() {\n debugMessage(`cli.AgentOps.importWebAgentsFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.agent.json')\n );\n for (const file of agentFiles) {\n await importWebAgentsFromFile(file);\n }\n debugMessage(`cli.AgentOps.importWebAgentsFromFiles: end`);\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,QACT,kBAAkB;AACzB,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,QACJ,4BAA4B;AAEnC,MAAM;EAAEC,YAAY;EAAEC,WAAW;EAAEC;AAAoB,CAAC,GAAGd,KAAK,CAACe,KAAK;AACtE,MAAM;EACJC,yBAAyB;EACzBC,UAAU;EACVC,yBAAyB;EACzBC,cAAc;EACdC,aAAa;EACbC,YAAY;EACZC,2BAA2B;EAC3BC,gBAAgB;EAChBC,eAAe;EACfC,WAAW;EACXC,0BAA0B;EAC1BC,eAAe;EACfC,cAAc;EACdC,WAAW;EACXC,0BAA0B;EAC1BC,eAAe;EACfC,cAAc;EACdC,YAAY;EACZC,2BAA2B;EAC3BC,gBAAgB;EAChBC;AACF,CAAC,GAAGpC,KAAK,CAACqC,KAAK;AAEf,MAAMC,oBAAoB,GAAG;EAC3BC,oBAAoB,EAAE,eAAe;EACrCC,SAAS,EAAE,YAAY;EACvBC,QAAQ,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,OAAO,eAAeC,UAAUA,CAACC,IAAI,GAAG,KAAK,EAAE;EAC7C,IAAI;IACF,MAAMC,MAAM,GAAG,MAAM3B,UAAU,CAAC,CAAC;IACjC,IAAI0B,IAAI,EAAE;MACR,MAAME,KAAK,GAAG1C,WAAW,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;MAC/D,KAAK,MAAMkC,KAAK,IAAIO,MAAM,EAAE;QAC1B,IAAIE,MAAM,GAAG,SAAS;QACtB,QAAQT,KAAK,CAACU,KAAK,CAACC,GAAG;UACrB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AC,CAAC;EACnD,MAAMmF,UAAU,GAAGF,KAAK,CAACG,MAAM,CAAEhD,IAAI,IACnCA,IAAI,CAACiD,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,aAAa,CAC3C,CAAC;EACD,KAAK,MAAMzC,IAAI,IAAIsC,UAAU,EAAE;IAC7B,MAAMc,uBAAuB,CAACpD,IAAI,CAAC;EACrC;EACAvD,YAAY,CAAE,4CAA2C,CAAC;AAC5D"}
|
|
@@ -5,7 +5,9 @@ import { saveJsonToFile } from '../utils/ExportImportUtils';
|
|
|
5
5
|
import wordwrap from './utils/Wordwrap';
|
|
6
6
|
const {
|
|
7
7
|
getTypedFilename,
|
|
8
|
-
titleCase
|
|
8
|
+
titleCase,
|
|
9
|
+
getFilePath,
|
|
10
|
+
getWorkingDirectory
|
|
9
11
|
} = frodo.utils;
|
|
10
12
|
const {
|
|
11
13
|
readApplications: _readApplications,
|
|
@@ -114,9 +116,10 @@ export async function exportApplicationToFile(applicationName, file, options = {
|
|
|
114
116
|
if (file) {
|
|
115
117
|
fileName = file;
|
|
116
118
|
}
|
|
119
|
+
const filePath = getFilePath(fileName, true);
|
|
117
120
|
const exportData = await _exportApplicationByName(applicationName, options);
|
|
118
|
-
saveJsonToFile(exportData,
|
|
119
|
-
succeedSpinner(`Exported ${applicationName} to ${
|
|
121
|
+
saveJsonToFile(exportData, filePath);
|
|
122
|
+
succeedSpinner(`Exported ${applicationName} to ${filePath}.`);
|
|
120
123
|
outcome = true;
|
|
121
124
|
} catch (error) {
|
|
122
125
|
failSpinner(`Error exporting ${applicationName}: ${error.message}`);
|
|
@@ -143,9 +146,10 @@ export async function exportApplicationsToFile(file, options = {
|
|
|
143
146
|
if (file) {
|
|
144
147
|
fileName = file;
|
|
145
148
|
}
|
|
149
|
+
const filePath = getFilePath(fileName, true);
|
|
146
150
|
const exportData = await _exportApplications(options);
|
|
147
|
-
saveJsonToFile(exportData,
|
|
148
|
-
succeedSpinner(`Exported all applications to ${
|
|
151
|
+
saveJsonToFile(exportData, filePath);
|
|
152
|
+
succeedSpinner(`Exported all applications to ${filePath}.`);
|
|
149
153
|
outcome = true;
|
|
150
154
|
} catch (error) {
|
|
151
155
|
failSpinner(`Error exporting all applications`);
|
|
@@ -173,7 +177,7 @@ export async function exportApplicationsToFiles(options = {
|
|
|
173
177
|
const file = getTypedFilename(application.name, 'application');
|
|
174
178
|
try {
|
|
175
179
|
const exportData = await _exportApplication(application._id, options);
|
|
176
|
-
saveJsonToFile(exportData, file);
|
|
180
|
+
saveJsonToFile(exportData, getFilePath(file, true));
|
|
177
181
|
updateProgressBar(`Exported ${application._id}.`);
|
|
178
182
|
} catch (error) {
|
|
179
183
|
errors.push(error);
|
|
@@ -203,7 +207,7 @@ export async function importApplicationFromFile(applicationName, file, options =
|
|
|
203
207
|
debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);
|
|
204
208
|
showSpinner(`Importing ${applicationName}...`);
|
|
205
209
|
try {
|
|
206
|
-
const data = fs.readFileSync(file, 'utf8');
|
|
210
|
+
const data = fs.readFileSync(getFilePath(file), 'utf8');
|
|
207
211
|
const fileData = JSON.parse(data);
|
|
208
212
|
await _importApplicationByName(applicationName, fileData, options);
|
|
209
213
|
outcome = true;
|
|
@@ -227,15 +231,16 @@ export async function importFirstApplicationFromFile(file, options = {
|
|
|
227
231
|
}) {
|
|
228
232
|
let outcome = false;
|
|
229
233
|
debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);
|
|
230
|
-
|
|
234
|
+
const filePath = getFilePath(file);
|
|
235
|
+
showSpinner(`Importing ${filePath}...`);
|
|
231
236
|
try {
|
|
232
|
-
const data = fs.readFileSync(
|
|
237
|
+
const data = fs.readFileSync(filePath, 'utf8');
|
|
233
238
|
const fileData = JSON.parse(data);
|
|
234
239
|
await _importFirstApplication(fileData, options);
|
|
235
240
|
outcome = true;
|
|
236
|
-
succeedSpinner(`Imported ${
|
|
241
|
+
succeedSpinner(`Imported ${filePath}.`);
|
|
237
242
|
} catch (error) {
|
|
238
|
-
failSpinner(`Error importing ${
|
|
243
|
+
failSpinner(`Error importing ${filePath}.`);
|
|
239
244
|
printMessage(error, 'error');
|
|
240
245
|
}
|
|
241
246
|
debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);
|
|
@@ -253,15 +258,16 @@ export async function importApplicationsFromFile(file, options = {
|
|
|
253
258
|
}) {
|
|
254
259
|
let outcome = false;
|
|
255
260
|
debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);
|
|
256
|
-
|
|
261
|
+
const filePath = getFilePath(file);
|
|
262
|
+
showSpinner(`Importing ${filePath}...`);
|
|
257
263
|
try {
|
|
258
|
-
const data = fs.readFileSync(
|
|
264
|
+
const data = fs.readFileSync(filePath, 'utf8');
|
|
259
265
|
const applicationData = JSON.parse(data);
|
|
260
266
|
await _importApplications(applicationData, options);
|
|
261
267
|
outcome = true;
|
|
262
|
-
succeedSpinner(`Imported ${
|
|
268
|
+
succeedSpinner(`Imported ${filePath}.`);
|
|
263
269
|
} catch (error) {
|
|
264
|
-
failSpinner(`Error importing ${
|
|
270
|
+
failSpinner(`Error importing ${filePath}.`);
|
|
265
271
|
printMessage(error, 'error');
|
|
266
272
|
}
|
|
267
273
|
debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);
|
|
@@ -279,8 +285,8 @@ export async function importApplicationsFromFiles(options = {
|
|
|
279
285
|
const errors = [];
|
|
280
286
|
try {
|
|
281
287
|
debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);
|
|
282
|
-
const names = fs.readdirSync(
|
|
283
|
-
const files = names.filter(name => name.toLowerCase().endsWith('.application.json'));
|
|
288
|
+
const names = fs.readdirSync(getWorkingDirectory());
|
|
289
|
+
const files = names.filter(name => name.toLowerCase().endsWith('.application.json')).map(name => getFilePath(name));
|
|
284
290
|
createProgressBar(files.length, 'Importing applications...');
|
|
285
291
|
let total = 0;
|
|
286
292
|
for (const file of files) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationOps.js","names":["frodo","state","fs","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","wordwrap","getTypedFilename","titleCase","utils","readApplications","_readApplications","deleteApplicationByName","_deleteApplicationByName","deleteApplications","_deleteApplications","exportApplication","_exportApplication","exportApplicationByName","_exportApplicationByName","exportApplications","_exportApplications","importApplicationByName","_importApplicationByName","importFirstApplication","_importFirstApplication","importApplications","_importApplications","app","listApplications","long","applications","sort","a","b","name","localeCompare","table","hAlign","content","forEach","push","_id","templateName","templateVersion","authoritative","description","toString","error","deleteApplication","applicationName","deep","outcome","message","deleted","length","exportApplicationToFile","file","options","useStringArrays","deps","fileName","exportData","exportApplicationsToFile","getRealmName","getRealm","exportApplicationsToFiles","errors","application","importApplicationFromFile","data","readFileSync","fileData","JSON","parse","importFirstApplicationFromFile","importApplicationsFromFile","applicationData","importApplicationsFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys"],"sources":["../../src/ops/ApplicationOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport type {\n ApplicationExportInterface,\n ApplicationExportOptions,\n ApplicationImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ApplicationOps';\nimport fs from 'fs';\n\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport wordwrap from './utils/Wordwrap';\n\nconst { getTypedFilename, titleCase } = frodo.utils;\nconst {\n readApplications: _readApplications,\n deleteApplicationByName: _deleteApplicationByName,\n deleteApplications: _deleteApplications,\n exportApplication: _exportApplication,\n exportApplicationByName: _exportApplicationByName,\n exportApplications: _exportApplications,\n importApplicationByName: _importApplicationByName,\n importFirstApplication: _importFirstApplication,\n importApplications: _importApplications,\n} = frodo.app;\n\n/**\n * List applications\n */\nexport async function listApplications(long = false) {\n try {\n const applications = await _readApplications();\n applications.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'Id',\n 'Template',\n {\n hAlign: 'right',\n content: 'Version',\n },\n {\n hAlign: 'right',\n content: 'Authoritative',\n },\n 'Description',\n ]);\n applications.forEach((app) => {\n table.push([\n app.name,\n app._id,\n app.templateName,\n {\n hAlign: 'right',\n content: app.templateVersion,\n },\n {\n hAlign: 'right',\n content: app.authoritative,\n },\n wordwrap(app.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n applications.forEach((app) => {\n printMessage(`${app.name}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Delete application\n * @param {string} applicationName application name\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplication(\n applicationName: string,\n deep: boolean\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplication: begin`);\n showSpinner(`Deleting ${applicationName}...`);\n try {\n await _deleteApplicationByName(applicationName, deep);\n outcome = true;\n succeedSpinner(`Deleted ${applicationName}`);\n } catch (error) {\n failSpinner(`Error deleting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplication: end`);\n return outcome;\n}\n\n/**\n * Delete all applications\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplications(deep: boolean): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplications: begin`);\n showSpinner(`Deleting all applications...`);\n try {\n const deleted = await _deleteApplications(deep);\n outcome = true;\n succeedSpinner(`Deleted ${deleted.length} applications`);\n } catch (error) {\n failSpinner(`Error deleting applications: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplications: end`);\n return outcome;\n}\n\n/**\n * Export application to file\n * @param {string} applicationName application name\n * @param {string} file file name\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationToFile(\n applicationName: string,\n file: string,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: begin`);\n showSpinner(`Exporting ${applicationName}...`);\n try {\n let fileName = getTypedFilename(applicationName, 'application');\n if (file) {\n fileName = file;\n }\n const exportData = await _exportApplicationByName(applicationName, options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${applicationName} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: end`);\n return outcome;\n}\n\n/**\n * Export all applications to file\n * @param {string} file file name\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFile(\n file: string,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: begin`);\n showSpinner(`Exporting all applications...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(frodo.utils.getRealmName(state.getRealm()))}Applications`,\n 'application'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await _exportApplications(options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all applications to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all applications`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Export all applications to separate files\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFiles(\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: begin`);\n const errors = [];\n try {\n const applications = await _readApplications();\n createProgressBar(applications.length, 'Exporting applications...');\n for (const application of applications) {\n const file = getTypedFilename(application.name, 'application');\n try {\n const exportData = await _exportApplication(application._id, options);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${application._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${application._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting applications(s) to file(s)`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import application from file\n * @param {string} applicationName client id\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationFromFile(\n applicationName: string,\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);\n showSpinner(`Importing ${applicationName}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await _importApplicationByName(applicationName, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${applicationName}.`);\n } catch (error) {\n failSpinner(`Error importing ${applicationName}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first application from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstApplicationFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await _importFirstApplication(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const applicationData = JSON.parse(data);\n await _importApplications(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from files\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFiles(\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.application.json')\n );\n createProgressBar(files.length, 'Importing applications...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ApplicationExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await _importApplications(fileData, options);\n updateProgressBar(`Imported ${count} application(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing application(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} application(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing application(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFrom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E,MAAM,CAAC;QAC1C,MAAMe,QAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC;QAC7D,MAAMgB,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAChB,QAAQ,CAACJ,WAAW,CAAC,CAACb,MAAM;QACtD8B,KAAK,IAAIC,KAAK;QACd,MAAM3D,mBAAmB,CAAC6C,QAAQ,EAAEd,OAAO,CAAC;QAC5CtD,iBAAiB,CAAE,YAAWkF,KAAM,wBAAuB7B,IAAK,EAAC,CAAC;MACpE,CAAC,CAAC,OAAOT,KAAK,EAAE;QACdmB,MAAM,CAAC1B,IAAI,CAACO,KAAK,CAAC;QAClB5C,iBAAiB,CAAE,uCAAsCqD,IAAK,EAAC,CAAC;QAChEzD,YAAY,CAACgD,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA9C,eAAe,CACZ,sBAAqBmF,KAAM,wBAAuBJ,KAAK,CAAC1B,MAAO,WAClE,CAAC;EACH,CAAC,CAAC,OAAOP,KAAK,EAAE;IACdmB,MAAM,CAAC1B,IAAI,CAACO,KAAK,CAAC;IAClB9C,eAAe,CAAE,8CAA6C,CAAC;IAC/DF,YAAY,CAACgD,KAAK,EAAE,OAAO,CAAC;EAC9B;EACAlD,YAAY,CAAE,qDAAoD,CAAC;EACnE,OAAO,CAAC,KAAKqE,MAAM,CAACZ,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"ApplicationOps.js","names":["frodo","state","fs","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","wordwrap","getTypedFilename","titleCase","getFilePath","getWorkingDirectory","utils","readApplications","_readApplications","deleteApplicationByName","_deleteApplicationByName","deleteApplications","_deleteApplications","exportApplication","_exportApplication","exportApplicationByName","_exportApplicationByName","exportApplications","_exportApplications","importApplicationByName","_importApplicationByName","importFirstApplication","_importFirstApplication","importApplications","_importApplications","app","listApplications","long","applications","sort","a","b","name","localeCompare","table","hAlign","content","forEach","push","_id","templateName","templateVersion","authoritative","description","toString","error","deleteApplication","applicationName","deep","outcome","message","deleted","length","exportApplicationToFile","file","options","useStringArrays","deps","fileName","filePath","exportData","exportApplicationsToFile","getRealmName","getRealm","exportApplicationsToFiles","errors","application","importApplicationFromFile","data","readFileSync","fileData","JSON","parse","importFirstApplicationFromFile","importApplicationsFromFile","applicationData","importApplicationsFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","map","total","count","Object","keys"],"sources":["../../src/ops/ApplicationOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport type {\n ApplicationExportInterface,\n ApplicationExportOptions,\n ApplicationImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ApplicationOps';\nimport fs from 'fs';\n\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport wordwrap from './utils/Wordwrap';\n\nconst { getTypedFilename, titleCase, getFilePath, getWorkingDirectory } =\n frodo.utils;\nconst {\n readApplications: _readApplications,\n deleteApplicationByName: _deleteApplicationByName,\n deleteApplications: _deleteApplications,\n exportApplication: _exportApplication,\n exportApplicationByName: _exportApplicationByName,\n exportApplications: _exportApplications,\n importApplicationByName: _importApplicationByName,\n importFirstApplication: _importFirstApplication,\n importApplications: _importApplications,\n} = frodo.app;\n\n/**\n * List applications\n */\nexport async function listApplications(long = false) {\n try {\n const applications = await _readApplications();\n applications.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'Id',\n 'Template',\n {\n hAlign: 'right',\n content: 'Version',\n },\n {\n hAlign: 'right',\n content: 'Authoritative',\n },\n 'Description',\n ]);\n applications.forEach((app) => {\n table.push([\n app.name,\n app._id,\n app.templateName,\n {\n hAlign: 'right',\n content: app.templateVersion,\n },\n {\n hAlign: 'right',\n content: app.authoritative,\n },\n wordwrap(app.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n applications.forEach((app) => {\n printMessage(`${app.name}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Delete application\n * @param {string} applicationName application name\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplication(\n applicationName: string,\n deep: boolean\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplication: begin`);\n showSpinner(`Deleting ${applicationName}...`);\n try {\n await _deleteApplicationByName(applicationName, deep);\n outcome = true;\n succeedSpinner(`Deleted ${applicationName}`);\n } catch (error) {\n failSpinner(`Error deleting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplication: end`);\n return outcome;\n}\n\n/**\n * Delete all applications\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplications(deep: boolean): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplications: begin`);\n showSpinner(`Deleting all applications...`);\n try {\n const deleted = await _deleteApplications(deep);\n outcome = true;\n succeedSpinner(`Deleted ${deleted.length} applications`);\n } catch (error) {\n failSpinner(`Error deleting applications: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplications: end`);\n return outcome;\n}\n\n/**\n * Export application to file\n * @param {string} applicationName application name\n * @param {string} file file name\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationToFile(\n applicationName: string,\n file: string,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: begin`);\n showSpinner(`Exporting ${applicationName}...`);\n try {\n let fileName = getTypedFilename(applicationName, 'application');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplicationByName(applicationName, options);\n saveJsonToFile(exportData, filePath);\n succeedSpinner(`Exported ${applicationName} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: end`);\n return outcome;\n}\n\n/**\n * Export all applications to file\n * @param {string} file file name\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFile(\n file: string,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: begin`);\n showSpinner(`Exporting all applications...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(frodo.utils.getRealmName(state.getRealm()))}Applications`,\n 'application'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplications(options);\n saveJsonToFile(exportData, filePath);\n succeedSpinner(`Exported all applications to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all applications`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Export all applications to separate files\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFiles(\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: begin`);\n const errors = [];\n try {\n const applications = await _readApplications();\n createProgressBar(applications.length, 'Exporting applications...');\n for (const application of applications) {\n const file = getTypedFilename(application.name, 'application');\n try {\n const exportData = await _exportApplication(application._id, options);\n saveJsonToFile(exportData, getFilePath(file, true));\n updateProgressBar(`Exported ${application._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${application._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting applications(s) to file(s)`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import application from file\n * @param {string} applicationName client id\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationFromFile(\n applicationName: string,\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);\n showSpinner(`Importing ${applicationName}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await _importApplicationByName(applicationName, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${applicationName}.`);\n } catch (error) {\n failSpinner(`Error importing ${applicationName}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first application from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstApplicationFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await _importFirstApplication(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const applicationData = JSON.parse(data);\n await _importApplications(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from files\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFiles(\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.application.json'))\n .map((name) => getFilePath(name));\n createProgressBar(files.length, 'Importing applications...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ApplicationExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await _importApplications(fileData, options);\n updateProgressBar(`Imported ${count} application(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing application(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} application(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing application(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACX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IAAI,CAAC,CAAC;IACnCzC,iBAAiB,CAACwF,KAAK,CAAC3B,MAAM,EAAE,2BAA2B,CAAC;IAC5D,IAAIgC,KAAK,GAAG,CAAC;IACb,KAAK,MAAM9B,IAAI,IAAIyB,KAAK,EAAE;MACxB,IAAI;QACF,MAAMX,IAAI,GAAG9E,EAAE,CAAC+E,YAAY,CAACf,IAAI,EAAE,MAAM,CAAC;QAC1C,MAAMgB,QAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC;QAC7D,MAAMiB,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACjB,QAAQ,CAACJ,WAAW,CAAC,CAACd,MAAM;QACtDgC,KAAK,IAAIC,KAAK;QACd,MAAM7D,mBAAmB,CAAC8C,QAAQ,EAAEf,OAAO,CAAC;QAC5CxD,iBAAiB,CAAE,YAAWsF,KAAM,wBAAuB/B,IAAK,EAAC,CAAC;MACpE,CAAC,CAAC,OAAOT,KAAK,EAAE;QACdoB,MAAM,CAAC3B,IAAI,CAACO,KAAK,CAAC;QAClB9C,iBAAiB,CAAE,uCAAsCuD,IAAK,EAAC,CAAC;QAChE3D,YAAY,CAACkD,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACAhD,eAAe,CACZ,sBAAqBuF,KAAM,wBAAuBL,KAAK,CAAC3B,MAAO,WAClE,CAAC;EACH,CAAC,CAAC,OAAOP,KAAK,EAAE;IACdoB,MAAM,CAAC3B,IAAI,CAACO,KAAK,CAAC;IAClBhD,eAAe,CAAE,8CAA6C,CAAC;IAC/DF,YAAY,CAACkD,KAAK,EAAE,OAAO,CAAC;EAC9B;EACApD,YAAY,CAAE,qDAAoD,CAAC;EACnE,OAAO,CAAC,KAAKwE,MAAM,CAACb,MAAM;AAC5B"}
|
|
@@ -3,7 +3,9 @@ import fs from 'fs';
|
|
|
3
3
|
import { createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
|
|
4
4
|
import { getTypedFilename, saveJsonToFile, titleCase } from '../utils/ExportImportUtils';
|
|
5
5
|
const {
|
|
6
|
-
getRealmName
|
|
6
|
+
getRealmName,
|
|
7
|
+
getFilePath,
|
|
8
|
+
getWorkingDirectory
|
|
7
9
|
} = frodo.utils;
|
|
8
10
|
const {
|
|
9
11
|
readCirclesOfTrust,
|
|
@@ -89,9 +91,10 @@ export async function exportCircleOfTrustToFile(cotId, file = null) {
|
|
|
89
91
|
if (file) {
|
|
90
92
|
fileName = file;
|
|
91
93
|
}
|
|
94
|
+
const filePath = getFilePath(fileName, true);
|
|
92
95
|
const exportData = await exportCircleOfTrust(cotId);
|
|
93
|
-
saveJsonToFile(exportData,
|
|
94
|
-
succeedSpinner(`Exported ${cotId} to ${
|
|
96
|
+
saveJsonToFile(exportData, filePath);
|
|
97
|
+
succeedSpinner(`Exported ${cotId} to ${filePath}.`);
|
|
95
98
|
outcome = true;
|
|
96
99
|
} catch (error) {
|
|
97
100
|
failSpinner(`Error exporting ${cotId}: ${error.message}`);
|
|
@@ -113,9 +116,10 @@ export async function exportCirclesOfTrustToFile(file = null) {
|
|
|
113
116
|
if (file) {
|
|
114
117
|
fileName = file;
|
|
115
118
|
}
|
|
119
|
+
const filePath = getFilePath(fileName, true);
|
|
116
120
|
const exportData = await exportCirclesOfTrust();
|
|
117
|
-
saveJsonToFile(exportData,
|
|
118
|
-
succeedSpinner(`Exported all circles of trust to ${
|
|
121
|
+
saveJsonToFile(exportData, filePath);
|
|
122
|
+
succeedSpinner(`Exported all circles of trust to ${filePath}.`);
|
|
119
123
|
outcome = true;
|
|
120
124
|
} catch (error) {
|
|
121
125
|
failSpinner(`Error exporting circles of trust: ${error.message}`);
|
|
@@ -137,7 +141,7 @@ export async function exportCirclesOfTrustToFiles() {
|
|
|
137
141
|
const file = getTypedFilename(cot._id, 'cot.saml');
|
|
138
142
|
try {
|
|
139
143
|
const exportData = await exportCircleOfTrust(cot._id);
|
|
140
|
-
saveJsonToFile(exportData, file);
|
|
144
|
+
saveJsonToFile(exportData, getFilePath(file, true));
|
|
141
145
|
updateProgressBar(`Exported ${cot.name}.`);
|
|
142
146
|
} catch (error) {
|
|
143
147
|
errors.push(error);
|
|
@@ -160,17 +164,18 @@ export async function exportCirclesOfTrustToFiles() {
|
|
|
160
164
|
*/
|
|
161
165
|
export async function importCircleOfTrustFromFile(cotId, file) {
|
|
162
166
|
let outcome = false;
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
const filePath = getFilePath(file);
|
|
168
|
+
showSpinner(`Importing circle of trust ${cotId} from ${filePath}...`);
|
|
169
|
+
fs.readFile(filePath, 'utf8', async (err, data) => {
|
|
165
170
|
if (err) throw err;
|
|
166
171
|
try {
|
|
167
172
|
const fileData = JSON.parse(data);
|
|
168
173
|
await importCircleOfTrust(cotId, fileData);
|
|
169
174
|
outcome = true;
|
|
170
|
-
succeedSpinner(`Imported circle of trust ${cotId} from ${
|
|
175
|
+
succeedSpinner(`Imported circle of trust ${cotId} from ${filePath}.`);
|
|
171
176
|
} catch (error) {
|
|
172
177
|
var _error$response;
|
|
173
|
-
failSpinner(`Error importing circle of trust ${cotId} from ${
|
|
178
|
+
failSpinner(`Error importing circle of trust ${cotId} from ${filePath}.`);
|
|
174
179
|
printMessage(((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error, 'error');
|
|
175
180
|
}
|
|
176
181
|
});
|
|
@@ -183,17 +188,18 @@ export async function importCircleOfTrustFromFile(cotId, file) {
|
|
|
183
188
|
*/
|
|
184
189
|
export async function importFirstCircleOfTrustFromFile(file) {
|
|
185
190
|
let outcome = false;
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
const filePath = getFilePath(file);
|
|
192
|
+
showSpinner(`Importing first circle of trust from ${filePath}...`);
|
|
193
|
+
fs.readFile(filePath, 'utf8', async (err, data) => {
|
|
188
194
|
if (err) throw err;
|
|
189
195
|
try {
|
|
190
196
|
const fileData = JSON.parse(data);
|
|
191
197
|
await importFirstCircleOfTrust(fileData);
|
|
192
198
|
outcome = true;
|
|
193
|
-
succeedSpinner(`Imported first circle of trust from ${
|
|
199
|
+
succeedSpinner(`Imported first circle of trust from ${filePath}.`);
|
|
194
200
|
} catch (error) {
|
|
195
201
|
var _error$response2;
|
|
196
|
-
failSpinner(`Error importing first circle of trust from ${
|
|
202
|
+
failSpinner(`Error importing first circle of trust from ${filePath}.`);
|
|
197
203
|
printMessage(((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) || error, 'error');
|
|
198
204
|
}
|
|
199
205
|
});
|
|
@@ -206,17 +212,18 @@ export async function importFirstCircleOfTrustFromFile(file) {
|
|
|
206
212
|
*/
|
|
207
213
|
export async function importCirclesOfTrustFromFile(file) {
|
|
208
214
|
let outcome = false;
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
const filePath = getFilePath(file);
|
|
216
|
+
showSpinner(`Importing circles of trust from ${filePath}...`);
|
|
217
|
+
fs.readFile(filePath, 'utf8', async (err, data) => {
|
|
211
218
|
if (err) throw err;
|
|
212
219
|
try {
|
|
213
220
|
const fileData = JSON.parse(data);
|
|
214
221
|
await importCirclesOfTrust(fileData);
|
|
215
222
|
outcome = true;
|
|
216
|
-
succeedSpinner(`Imported circles of trust from ${
|
|
223
|
+
succeedSpinner(`Imported circles of trust from ${filePath}.`);
|
|
217
224
|
} catch (error) {
|
|
218
225
|
var _error$response3;
|
|
219
|
-
failSpinner(`Error importing circles of trust from ${
|
|
226
|
+
failSpinner(`Error importing circles of trust from ${filePath}.`);
|
|
220
227
|
printMessage(((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data) || error, 'error');
|
|
221
228
|
}
|
|
222
229
|
});
|
|
@@ -230,8 +237,8 @@ export async function importCirclesOfTrustFromFiles() {
|
|
|
230
237
|
const errors = [];
|
|
231
238
|
try {
|
|
232
239
|
debugMessage(`cli.CirclesOfTrustOps.importCirclesOfTrustFromFiles: begin`);
|
|
233
|
-
const names = fs.readdirSync(
|
|
234
|
-
const files = names.filter(name => name.toLowerCase().endsWith('.cot.saml.json'));
|
|
240
|
+
const names = fs.readdirSync(getWorkingDirectory());
|
|
241
|
+
const files = names.filter(name => name.toLowerCase().endsWith('.cot.saml.json')).map(name => getFilePath(name));
|
|
235
242
|
createProgressBar(files.length, 'Importing circles of trust...');
|
|
236
243
|
let total = 0;
|
|
237
244
|
for (const file of files) {
|