@rockcarver/frodo-cli 2.0.0-40 → 2.0.0-42
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/admin/admin-execute-rfc7523-authz-grant-flow.js.map +1 -1
- package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.js.map +1 -1
- package/esm/cli/app/app-delete.js.map +1 -1
- package/esm/cli/app/app-describe.js.map +1 -1
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/app/app-list.js.map +1 -1
- package/esm/cli/app/app.js.map +1 -1
- package/esm/cli/config/config-export.js +5 -3
- package/esm/cli/config/config-export.js.map +1 -1
- package/esm/cli/config/config-import.js +37 -4
- package/esm/cli/config/config-import.js.map +1 -1
- package/esm/cli/config/config.js +1 -2
- package/esm/cli/config/config.js.map +1 -1
- package/esm/cli/idp/idp-import.js +13 -5
- package/esm/cli/idp/idp-import.js.map +1 -1
- package/esm/cli/journey/journey-export.js +7 -4
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/saml/saml-import.js +13 -5
- package/esm/cli/saml/saml-import.js.map +1 -1
- package/esm/cli/service/service-import.js +22 -5
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/ops/ApplicationOps.js +1 -1
- package/esm/ops/ApplicationOps.js.map +1 -1
- package/esm/ops/ConfigOps.js +39 -5
- package/esm/ops/ConfigOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js +12 -17
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js +41 -91
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/IdpOps.js +20 -8
- package/esm/ops/IdpOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +10 -6
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js +20 -8
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/ServiceOps.js +30 -14
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js +16 -23
- package/esm/ops/ThemeOps.js.map +1 -1
- package/esm/utils/Config.js +13 -3
- package/esm/utils/Config.js.map +1 -1
- package/package.json +2 -2
package/esm/ops/ServiceOps.js
CHANGED
|
@@ -96,9 +96,13 @@ export async function exportServicesToFiles(globalConfig = false, includeMeta =
|
|
|
96
96
|
* Import a service from file
|
|
97
97
|
* @param {string} serviceId service id/name
|
|
98
98
|
* @param {string} file import file name
|
|
99
|
-
* @param {
|
|
99
|
+
* @param {ServiceImportOptions} options import options
|
|
100
100
|
*/
|
|
101
|
-
export async function importServiceFromFile(serviceId, file,
|
|
101
|
+
export async function importServiceFromFile(serviceId, file, options = {
|
|
102
|
+
clean: false,
|
|
103
|
+
global: false,
|
|
104
|
+
realm: false
|
|
105
|
+
}) {
|
|
102
106
|
const filePath = getFilePath(file);
|
|
103
107
|
debugMessage(`cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${filePath}]`);
|
|
104
108
|
const verbose = state.getVerbose();
|
|
@@ -109,7 +113,7 @@ export async function importServiceFromFile(serviceId, file, clean, globalConfig
|
|
|
109
113
|
if (!verbose) showSpinner(`Importing ${serviceId}...`);
|
|
110
114
|
try {
|
|
111
115
|
if (verbose) showSpinner(`Importing ${serviceId}...`);
|
|
112
|
-
await importService(serviceId, importData,
|
|
116
|
+
await importService(serviceId, importData, options);
|
|
113
117
|
succeedSpinner(`Imported ${serviceId}.`);
|
|
114
118
|
} catch (importError) {
|
|
115
119
|
var _importError$response, _importError$response2;
|
|
@@ -129,9 +133,13 @@ export async function importServiceFromFile(serviceId, file, clean, globalConfig
|
|
|
129
133
|
/**
|
|
130
134
|
* Import first service from file
|
|
131
135
|
* @param {string} file import file name
|
|
132
|
-
* @param {
|
|
136
|
+
* @param {ServiceImportOptions} options import options
|
|
133
137
|
*/
|
|
134
|
-
export async function importFirstServiceFromFile(file,
|
|
138
|
+
export async function importFirstServiceFromFile(file, options = {
|
|
139
|
+
clean: false,
|
|
140
|
+
global: false,
|
|
141
|
+
realm: false
|
|
142
|
+
}) {
|
|
135
143
|
const filePath = getFilePath(file);
|
|
136
144
|
debugMessage(`cli.ServiceOps.importFirstServiceFromFile: start [file=${filePath}]`);
|
|
137
145
|
const verbose = state.getVerbose();
|
|
@@ -143,7 +151,7 @@ export async function importFirstServiceFromFile(file, clean, globalConfig = fal
|
|
|
143
151
|
if (!verbose) showSpinner(`Importing ${serviceId}...`);
|
|
144
152
|
try {
|
|
145
153
|
if (verbose) showSpinner(`Importing ${serviceId}...`);
|
|
146
|
-
await importService(serviceId, importData,
|
|
154
|
+
await importService(serviceId, importData, options);
|
|
147
155
|
succeedSpinner(`Imported ${serviceId}.`);
|
|
148
156
|
} catch (importError) {
|
|
149
157
|
var _importError$response3, _importError$response4;
|
|
@@ -163,9 +171,13 @@ export async function importFirstServiceFromFile(file, clean, globalConfig = fal
|
|
|
163
171
|
/**
|
|
164
172
|
* Import services from file
|
|
165
173
|
* @param {String} file file name
|
|
166
|
-
* @param {
|
|
174
|
+
* @param {ServiceImportOptions} options import options
|
|
167
175
|
*/
|
|
168
|
-
export async function importServicesFromFile(file,
|
|
176
|
+
export async function importServicesFromFile(file, options = {
|
|
177
|
+
clean: false,
|
|
178
|
+
global: false,
|
|
179
|
+
realm: false
|
|
180
|
+
}) {
|
|
169
181
|
const filePath = getFilePath(file);
|
|
170
182
|
debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${filePath}]`);
|
|
171
183
|
fs.readFile(filePath, 'utf8', async (err, data) => {
|
|
@@ -173,7 +185,7 @@ export async function importServicesFromFile(file, clean, globalConfig = false)
|
|
|
173
185
|
debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${filePath}`);
|
|
174
186
|
const importData = JSON.parse(data);
|
|
175
187
|
try {
|
|
176
|
-
await importServices(importData,
|
|
188
|
+
await importServices(importData, options);
|
|
177
189
|
} catch (error) {
|
|
178
190
|
printMessage(`${error.message}`, 'error');
|
|
179
191
|
printMessage(error.response.status, 'error');
|
|
@@ -184,14 +196,18 @@ export async function importServicesFromFile(file, clean, globalConfig = false)
|
|
|
184
196
|
|
|
185
197
|
/**
|
|
186
198
|
* Import all services from separate files
|
|
187
|
-
* @param {
|
|
199
|
+
* @param {ServiceImportOptions} options import options
|
|
188
200
|
*/
|
|
189
|
-
export async function importServicesFromFiles(
|
|
201
|
+
export async function importServicesFromFiles(options = {
|
|
202
|
+
clean: false,
|
|
203
|
+
global: false,
|
|
204
|
+
realm: false
|
|
205
|
+
}) {
|
|
190
206
|
debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);
|
|
191
207
|
const names = fs.readdirSync(getWorkingDirectory());
|
|
192
|
-
const
|
|
193
|
-
for (const file of
|
|
194
|
-
await importServicesFromFile(file,
|
|
208
|
+
const serviceFiles = names.filter(name => name.toLowerCase().endsWith('.service.json'));
|
|
209
|
+
for (const file of serviceFiles) {
|
|
210
|
+
await importServicesFromFile(file, options);
|
|
195
211
|
}
|
|
196
212
|
debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);
|
|
197
213
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceOps.js","names":["frodo","state","fs","createTable","debugMessage","failSpinner","printMessage","showSpinner","succeedSpinner","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","getListOfServices","exportServices","exportService","getFullServices","createServiceExportTemplate","importService","importServices","deleteFullService","deleteFullServices","service","listServices","long","globalConfig","services","sort","a","b","_id","localeCompare","table","push","name","toString","error","stack","exportServicesToFile","file","includeMeta","exportData","fileName","getRealm","exportServiceToFile","serviceId","exportServicesToFiles","_type","filePath","importServiceFromFile","clean","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","_importError$response","_importError$response2","message","response","detail","importFirstServiceFromFile","Object","keys","length","_importError$response3","_importError$response4","importServicesFromFile","status","importServicesFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","map","deleteService","_error$response","deleteServices"],"sources":["../../src/ops/ServiceOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type ServiceExportInterface } from '@rockcarver/frodo-lib/types/ops/ServiceOps';\nimport fs from 'fs';\n\nimport {\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n succeedSpinner,\n} from '../utils/Console';\n\nconst {\n getRealmName,\n getTypedFilename,\n titleCase,\n saveJsonToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n getListOfServices,\n exportServices,\n exportService,\n getFullServices,\n createServiceExportTemplate,\n importService,\n importServices,\n deleteFullService,\n deleteFullServices,\n} = frodo.service;\n\n/**\n * List services\n */\nexport async function listServices(long = false, globalConfig = false) {\n try {\n const services = await getListOfServices(globalConfig);\n services.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Service Id', 'Service Name']);\n for (const service of services) {\n table.push([\n service._id,\n globalConfig ? service['_type'].name : service.name,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const service of services) {\n printMessage(`${service._id}`, 'data');\n }\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all services to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportServicesToFile(\n file,\n globalConfig = false,\n includeMeta = true\n) {\n const exportData = await exportServices(globalConfig);\n let fileName = getTypedFilename(\n `all${\n globalConfig ? 'Global' : titleCase(getRealmName(state.getRealm()))\n }Services`,\n `service`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true), includeMeta);\n}\n\n/**\n * Export service to file\n * @param {string} serviceId service id\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportServiceToFile(\n serviceId: string,\n file: string,\n globalConfig = false,\n includeMeta = true\n) {\n const exportData = await exportService(serviceId, globalConfig);\n let fileName = getTypedFilename(serviceId, `service`);\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true), includeMeta);\n}\n\n/**\n * Export all services to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportServicesToFiles(\n globalConfig = false,\n includeMeta = true\n) {\n debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);\n const services = await getFullServices(globalConfig);\n for (const service of services) {\n const fileName = getTypedFilename(service._type._id, `service`);\n const filePath = getFilePath(fileName, true);\n const exportData = createServiceExportTemplate();\n exportData.service[service._type._id] = service;\n debugMessage(\n `cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${filePath}`\n );\n saveJsonToFile(exportData, filePath, includeMeta);\n }\n debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);\n}\n\n/**\n * Import a service from file\n * @param {string} serviceId service id/name\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServiceFromFile(\n serviceId: string,\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n const filePath = getFilePath(file);\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${filePath}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && importData.service[serviceId]) {\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean, globalConfig);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${serviceId} not found!`);\n }\n });\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${filePath}]`\n );\n}\n\n/**\n * Import first service from file\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importFirstServiceFromFile(\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n const filePath = getFilePath(file);\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: start [file=${filePath}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && Object.keys(importData.service).length) {\n const serviceId = Object.keys(importData.service)[0];\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean, globalConfig);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing service...`);\n failSpinner(`No service found in ${filePath}!`);\n }\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: end [file=${filePath}]`\n );\n });\n}\n\n/**\n * Import services from file\n * @param {String} file file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFile(\n file: string,\n clean: boolean,\n globalConfig = false\n) {\n const filePath = getFilePath(file);\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [file=${filePath}]`\n );\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${filePath}`);\n const importData = JSON.parse(data) as ServiceExportInterface;\n try {\n await importServices(importData, clean, globalConfig);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [file=${filePath}]`\n );\n });\n}\n\n/**\n * Import all services from separate files\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFiles(\n clean: boolean,\n globalConfig = false\n) {\n debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names\n .filter((name) => name.toLowerCase().endsWith('.service.json'))\n .map((name) => getFilePath(name));\n for (const file of agentFiles) {\n await importServicesFromFile(file, clean, globalConfig);\n }\n debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);\n}\n\n/**\n * Delete a service by id/name\n * @param {string} serviceId Reference to the service to delete\n */\nexport async function deleteService(serviceId: string, globalConfig = false) {\n try {\n await deleteFullService(serviceId, globalConfig);\n } catch (error) {\n const message = error.response?.data?.message;\n printMessage(`Delete service '${serviceId}': ${message}`, 'error');\n }\n}\n\n/**\n * Delete all services\n */\nexport async function deleteServices(globalConfig = false) {\n await deleteFullServices(globalConfig);\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,QACT,kBAAkB;AAEzB,MAAM;EACJC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGd,KAAK,CAACe,KAAK;AACf,MAAM;EACJC,iBAAiB;EACjBC,cAAc;EACdC,aAAa;EACbC,eAAe;EACfC,2BAA2B;EAC3BC,aAAa;EACbC,cAAc;EACdC,iBAAiB;EACjBC;AACF,CAAC,GAAGxB,KAAK,CAACyB,OAAO;;AAEjB;AACA;AACA;AACA,OAAO,eAAeC,YAAYA,CAACC,IAAI,GAAG,KAAK,EAAEC,YAAY,GAAG,KAAK,EAAE;EACrE,IAAI;IACF,MAAMC,QAAQ,GAAG,MAAMb,iBAAiB,CAACY,YAAY,CAAC;IACtDC,QAAQ,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,GAAG,CAACC,aAA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,cAAAmB,eAAA,gBAAAA,eAAA,GAAdA,eAAA,CAAgB3B,IAAI,cAAA2B,eAAA,uBAApBA,eAAA,CAAsBpB,OAAO;IAC7C3D,YAAY,CAAE,mBAAkB0C,SAAU,MAAKiB,OAAQ,EAAC,EAAE,OAAO,CAAC;EACpE;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAeqB,cAAcA,CAAC1D,YAAY,GAAG,KAAK,EAAE;EACzD,MAAMJ,kBAAkB,CAACI,YAAY,CAAC;AACxC"}
|
|
1
|
+
{"version":3,"file":"ServiceOps.js","names":["frodo","state","fs","createTable","debugMessage","failSpinner","printMessage","showSpinner","succeedSpinner","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","getListOfServices","exportServices","exportService","getFullServices","createServiceExportTemplate","importService","importServices","deleteFullService","deleteFullServices","service","listServices","long","globalConfig","services","sort","a","b","_id","localeCompare","table","push","name","toString","error","stack","exportServicesToFile","file","includeMeta","exportData","fileName","getRealm","exportServiceToFile","serviceId","exportServicesToFiles","_type","filePath","importServiceFromFile","options","clean","global","realm","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","_importError$response","_importError$response2","message","response","detail","importFirstServiceFromFile","Object","keys","length","_importError$response3","_importError$response4","importServicesFromFile","status","importServicesFromFiles","names","readdirSync","serviceFiles","filter","toLowerCase","endsWith","deleteService","_error$response","deleteServices"],"sources":["../../src/ops/ServiceOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport {\n type ServiceExportInterface,\n type ServiceImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ServiceOps';\nimport fs from 'fs';\n\nimport {\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n succeedSpinner,\n} from '../utils/Console';\n\nconst {\n getRealmName,\n getTypedFilename,\n titleCase,\n saveJsonToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n getListOfServices,\n exportServices,\n exportService,\n getFullServices,\n createServiceExportTemplate,\n importService,\n importServices,\n deleteFullService,\n deleteFullServices,\n} = frodo.service;\n\n/**\n * List services\n */\nexport async function listServices(long = false, globalConfig = false) {\n try {\n const services = await getListOfServices(globalConfig);\n services.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Service Id', 'Service Name']);\n for (const service of services) {\n table.push([\n service._id,\n globalConfig ? service['_type'].name : service.name,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const service of services) {\n printMessage(`${service._id}`, 'data');\n }\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all services to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportServicesToFile(\n file,\n globalConfig = false,\n includeMeta = true\n) {\n const exportData = await exportServices(globalConfig);\n let fileName = getTypedFilename(\n `all${\n globalConfig ? 'Global' : titleCase(getRealmName(state.getRealm()))\n }Services`,\n `service`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true), includeMeta);\n}\n\n/**\n * Export service to file\n * @param {string} serviceId service id\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportServiceToFile(\n serviceId: string,\n file: string,\n globalConfig = false,\n includeMeta = true\n) {\n const exportData = await exportService(serviceId, globalConfig);\n let fileName = getTypedFilename(serviceId, `service`);\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true), includeMeta);\n}\n\n/**\n * Export all services to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportServicesToFiles(\n globalConfig = false,\n includeMeta = true\n) {\n debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);\n const services = await getFullServices(globalConfig);\n for (const service of services) {\n const fileName = getTypedFilename(service._type._id, `service`);\n const filePath = getFilePath(fileName, true);\n const exportData = createServiceExportTemplate();\n exportData.service[service._type._id] = service;\n debugMessage(\n `cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${filePath}`\n );\n saveJsonToFile(exportData, filePath, includeMeta);\n }\n debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);\n}\n\n/**\n * Import a service from file\n * @param {string} serviceId service id/name\n * @param {string} file import file name\n * @param {ServiceImportOptions} options import options\n */\nexport async function importServiceFromFile(\n serviceId: string,\n file: string,\n options: ServiceImportOptions = {\n clean: false,\n global: false,\n realm: false,\n }\n) {\n const filePath = getFilePath(file);\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${filePath}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && importData.service[serviceId]) {\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, options);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${serviceId} not found!`);\n }\n });\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${filePath}]`\n );\n}\n\n/**\n * Import first service from file\n * @param {string} file import file name\n * @param {ServiceImportOptions} options import options\n */\nexport async function importFirstServiceFromFile(\n file: string,\n options: ServiceImportOptions = {\n clean: false,\n global: false,\n realm: false,\n }\n) {\n const filePath = getFilePath(file);\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: start [file=${filePath}]`\n );\n const verbose = state.getVerbose();\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && Object.keys(importData.service).length) {\n const serviceId = Object.keys(importData.service)[0];\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, options);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing service...`);\n failSpinner(`No service found in ${filePath}!`);\n }\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: end [file=${filePath}]`\n );\n });\n}\n\n/**\n * Import services from file\n * @param {String} file file name\n * @param {ServiceImportOptions} options import options\n */\nexport async function importServicesFromFile(\n file: string,\n options: ServiceImportOptions = {\n clean: false,\n global: false,\n realm: false,\n }\n) {\n const filePath = getFilePath(file);\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [file=${filePath}]`\n );\n fs.readFile(filePath, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${filePath}`);\n const importData = JSON.parse(data) as ServiceExportInterface;\n try {\n await importServices(importData, options);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [file=${filePath}]`\n );\n });\n}\n\n/**\n * Import all services from separate files\n * @param {ServiceImportOptions} options import options\n */\nexport async function importServicesFromFiles(\n options: ServiceImportOptions = {\n clean: false,\n global: false,\n realm: false,\n }\n) {\n debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const serviceFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.service.json')\n );\n for (const file of serviceFiles) {\n await importServicesFromFile(file, options);\n }\n debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);\n}\n\n/**\n * Delete a service by id/name\n * @param {string} serviceId Reference to the service to delete\n */\nexport async function deleteService(serviceId: string, globalConfig = false) {\n try {\n await deleteFullService(serviceId, globalConfig);\n } catch (error) {\n const message = error.response?.data?.message;\n printMessage(`Delete service '${serviceId}': ${message}`, 'error');\n }\n}\n\n/**\n * Delete all services\n */\nexport async function deleteServices(globalConfig = false) {\n await deleteFullServices(globalConfig);\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAKpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,QACT,kBAAkB;AAEzB,MAAM;EACJC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGd,KAAK,CAACe,KAAK;AACf,MAAM;EACJC,iBAAiB;EACjBC,cAAc;EACdC,aAAa;EACbC,eAAe;EACfC,2BAA2B;EAC3BC,aAAa;EACbC,cAAc;EACdC,iBAAiB;EACjBC;AACF,CAAC,GAAGxB,KAAK,CAACyB,OAAO;;AAEjB;AACA;AACA;AACA,OAAO,eAAeC,YAAYA,CAACC,IAAI,GAAG,KAAK,EAAEC,YAAY,GAAG,KAAK,EAAE;EACrE,IAAI;IACF,MAAMC,QAAQ,GAAG,MAAMb,iBAAiB,CAACY,YAAY,CAAC;IACtDC,QAAQ,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,GAAG,CAACC,aAAa,CAACF,CAAC,CAACC,GAAG,CAAC,CAAC;IACnD,IAAIN,IAAI,EAAE;MACR,MAAMQ,KAAK,GAAGhC,WAAW,CAAC,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;MACzD,KAAK,MAAMsB,OAAO,IAAII,QAAQ,EAAE;QAC9BM,KAAK,CAACC,IAAI,CAAC,CACTX,OAAO,CAACQ,GAAG,EACXL,YAAY,GAAGH,OAAO,CAAC,OAAO,CAAC,CAACY,IAAI,GAAGZ,OAAO,CAACY,IAAI,C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AcA,CAAC5D,YAAY,GAAG,KAAK,EAAE;EACzD,MAAMJ,kBAAkB,CAACI,YAAY,CAAC;AACxC"}
|
package/esm/ops/ThemeOps.js
CHANGED
|
@@ -17,7 +17,7 @@ const {
|
|
|
17
17
|
readTheme,
|
|
18
18
|
updateThemeByName,
|
|
19
19
|
updateTheme,
|
|
20
|
-
|
|
20
|
+
importThemes,
|
|
21
21
|
exportThemes,
|
|
22
22
|
deleteTheme,
|
|
23
23
|
deleteThemeByName,
|
|
@@ -233,17 +233,9 @@ export async function importThemesFromFile(file) {
|
|
|
233
233
|
try {
|
|
234
234
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
235
235
|
const themeExport = JSON.parse(data);
|
|
236
|
-
const indicatorId = createProgressIndicator('
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
const result = await updateThemes(themeExport.theme);
|
|
241
|
-
if (result == null) {
|
|
242
|
-
stopProgressIndicator(indicatorId, `Error importing ${Object.keys(themeExport.theme).length} themes!`);
|
|
243
|
-
printMessage(`Error importing ${Object.keys(themeExport.theme).length} themes from ${filePath}`, 'error');
|
|
244
|
-
} else {
|
|
245
|
-
stopProgressIndicator(indicatorId, `Successfully imported ${Object.keys(themeExport.theme).length} themes.`);
|
|
246
|
-
}
|
|
236
|
+
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing themes from ${filePath}...`);
|
|
237
|
+
await importThemes(themeExport);
|
|
238
|
+
stopProgressIndicator(indicatorId, `Successfully imported ${Object.keys(themeExport.theme).length} themes.`);
|
|
247
239
|
} catch (error) {
|
|
248
240
|
printMessage(`Error importing themes: ${error}`, 'error');
|
|
249
241
|
}
|
|
@@ -261,21 +253,22 @@ export async function importThemesFromFiles() {
|
|
|
261
253
|
let total = 0;
|
|
262
254
|
let files = 0;
|
|
263
255
|
for (const file of jsonFiles) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (result == null) {
|
|
271
|
-
printMessage(`Error importing ${count} themes from ${file}`, 'error');
|
|
272
|
-
} else {
|
|
256
|
+
try {
|
|
257
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
258
|
+
fileData = JSON.parse(data);
|
|
259
|
+
if (validateImport(fileData.meta)) {
|
|
260
|
+
count = Object.keys(fileData.theme).length;
|
|
261
|
+
await importThemes(fileData);
|
|
273
262
|
files += 1;
|
|
274
263
|
total += count;
|
|
275
264
|
updateProgressIndicator(indicatorId, `Imported ${count} theme(s) from ${file}`);
|
|
265
|
+
} else {
|
|
266
|
+
printMessage(`Validation of ${file} failed!`, 'error');
|
|
276
267
|
}
|
|
277
|
-
}
|
|
278
|
-
|
|
268
|
+
} catch (error) {
|
|
269
|
+
var _error$response;
|
|
270
|
+
updateProgressIndicator(indicatorId, `Error importing theme(s) from ${file}`);
|
|
271
|
+
printMessage(((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error, 'error');
|
|
279
272
|
}
|
|
280
273
|
}
|
|
281
274
|
stopProgressIndicator(indicatorId, `Finished importing ${total} theme(s) from ${files} file(s).`);
|
package/esm/ops/ThemeOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeOps.js","names":["frodo","fs","v4","uuidv4","createProgressIndicator","createTable","printMessage","stopProgressIndicator","updateProgressIndicator","getRealmString","validateImport","getTypedFilename","saveJsonToFile","saveToFile","getFilePath","getWorkingDirectory","utils","readThemes","readThemeByName","readTheme","updateThemeByName","updateTheme","updateThemes","exportThemes","deleteTheme","deleteThemeByName","deleteThemes","theme","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","sort","a","b","localeCompare","forEach","isDefault","table","push","toString","exportThemeByName","file","includeMeta","fileName","filePath","indicatorId","themeData","error","message","exportThemeById","id","exportThemesToFile","exportData","exportThemesToFiles","themes","barId","length","fileBarId","importThemeByName","data","readFileSync","themeExport","JSON","parse","found","Object","keys","importThemeById","themeId","importThemesFromFile","result","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","map","fileData","count","total","files","meta","importFirstThemeFromFile","then","deleteThemeCmd","undefined","deleteThemeByNameCmd","deleteAllThemes","deleteThemesCmd"],"sources":["../../src/ops/ThemeOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport {\n ThemeExportInterface,\n type ThemeSkeleton,\n} from '@rockcarver/frodo-lib/types/ops/ThemeOps';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n createProgressIndicator,\n createTable,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst {\n getRealmString,\n validateImport,\n getTypedFilename,\n saveJsonToFile,\n saveToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readThemes,\n readThemeByName,\n readTheme,\n updateThemeByName,\n updateTheme,\n updateThemes,\n exportThemes,\n deleteTheme,\n deleteThemeByName,\n deleteThemes,\n} = frodo.theme;\n\n/**\n * Get a one-line description of the theme\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(themeObj: ThemeSkeleton): string {\n const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${\n themeObj.linkedTrees\n ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')'\n : ''\n }`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Linked Journey(s) | Id |\\n';\n markdown += '| ---- | ----------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the theme in markdown\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a table-row of the theme in markdown\n */\nexport function getTableRowMd(themeObj: ThemeSkeleton): string {\n const row = `| ${themeObj.name} | ${\n themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''\n } | \\`${themeObj._id}\\` |`;\n return row;\n}\n\n/**\n * List all the themes\n * @param {boolean} long Long version, more fields\n */\nexport async function listThemes(long = false) {\n const themeList = await readThemes();\n themeList.sort((a, b) => a.name.localeCompare(b.name));\n if (!long) {\n themeList.forEach((theme) => {\n printMessage(\n `${theme.isDefault ? theme.name['brightCyan'] : theme.name}`,\n 'data'\n );\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Id'['brightCyan'],\n 'Default'['brightCyan'],\n ]);\n themeList.forEach((theme) => {\n table.push([\n `${theme.name}`,\n `${theme._id}`,\n `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`,\n ]);\n });\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Export theme by name to file\n * @param {String} name theme name\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemeByName(name, file, includeMeta = true) {\n let fileName = getTypedFilename(name, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${name}`\n );\n try {\n const themeData = await readThemeByName(name);\n if (!themeData._id) themeData._id = uuidv4();\n updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);\n saveToFile('theme', [themeData], '_id', filePath, includeMeta);\n stopProgressIndicator(indicatorId, `Successfully exported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export theme by uuid to file\n * @param {String} id theme uuid\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemeById(id, file, includeMeta = true) {\n let fileName = getTypedFilename(id, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${id}`\n );\n try {\n const themeData = await readTheme(id);\n updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);\n saveToFile('theme', [themeData], '_id', filePath, includeMeta);\n stopProgressIndicator(indicatorId, `Successfully exported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export all themes to file\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemesToFile(file, includeMeta = true) {\n let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportThemes();\n saveJsonToFile(exportData, filePath, includeMeta);\n}\n\n/**\n * Export all themes to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemesToFiles(includeMeta = true) {\n const themes = await readThemes();\n const barId = createProgressIndicator(\n 'determinate',\n themes.length,\n 'Exporting themes'\n );\n for (const theme of themes) {\n if (!theme._id) theme._id = uuidv4();\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting theme ${theme.name}...`\n );\n updateProgressIndicator(barId, `Exporting theme ${theme.name}`);\n const file = getFilePath(getTypedFilename(theme.name, 'theme'), true);\n saveToFile('theme', theme, '_id', file, includeMeta);\n updateProgressIndicator(fileBarId, `${theme.name} saved to ${file}`);\n stopProgressIndicator(fileBarId, `${theme.name} saved to ${file}.`);\n }\n stopProgressIndicator(barId, `${themes.length} themes exported.`);\n}\n\n/**\n * Import theme by name from file\n * @param {String} name theme name\n * @param {String} file import file name\n */\nexport async function importThemeByName(name, file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n let found = false;\n for (const id of Object.keys(themeExport.theme)) {\n if (themeExport.theme[id].name === name) {\n found = true;\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n try {\n await updateThemeByName(name, themeExport.theme[id]);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${name}.`\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[id].name}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[id].name}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n if (!found) {\n stopProgressIndicator(indicatorId, `Theme ${name} not found!`);\n }\n } catch (error) {\n printMessage(`Error importing theme ${name}: ${error}`, 'error');\n }\n}\n\n/**\n * Import theme by uuid from file\n * @param {String} id theme uuid\n * @param {String} file import file name\n */\nexport async function importThemeById(id, file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n let found = false;\n for (const themeId of Object.keys(themeExport.theme)) {\n if (themeId === id) {\n found = true;\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[themeId]._id}`\n );\n try {\n await updateTheme(themeId, themeExport.theme[themeId]);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${id}.`\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n if (!found) {\n stopProgressIndicator(indicatorId, `Theme ${id} not found!`);\n }\n } catch (error) {\n printMessage(`Error importing theme ${id}: ${error}`, 'error');\n }\n}\n\n/**\n * Import all themes from single file\n * @param {String} file import file name\n */\nexport async function importThemesFromFile(file) {\n const filePath = getFilePath(file);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n Object.keys(themeExport.theme).length,\n 'Importing themes...'\n );\n for (const id of Object.keys(themeExport.theme)) {\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n }\n const result = await updateThemes(themeExport.theme);\n if (result == null) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${Object.keys(themeExport.theme).length} themes!`\n );\n printMessage(\n `Error importing ${\n Object.keys(themeExport.theme).length\n } themes from ${filePath}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n indicatorId,\n `Successfully imported ${Object.keys(themeExport.theme).length} themes.`\n );\n }\n } catch (error) {\n printMessage(`Error importing themes: ${error}`, 'error');\n }\n}\n\n/**\n * Import themes from separate files\n */\nexport async function importThemesFromFiles() {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.theme.json'))\n .map((name) => getFilePath(name));\n\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing themes...'\n );\n let fileData = null;\n let count = 0;\n let total = 0;\n let files = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n // eslint-disable-next-line no-await-in-loop\n const result = await updateThemes(fileData.theme);\n if (result == null) {\n printMessage(`Error importing ${count} themes from ${file}`, 'error');\n } else {\n files += 1;\n total += count;\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} theme(s) from ${file}`\n );\n }\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} theme(s) from ${files} file(s).`\n );\n}\n\n/**\n * Import first theme from file\n * @param {String} file import file name\n */\nexport async function importFirstThemeFromFile(file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n for (const id of Object.keys(themeExport.theme)) {\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n updateTheme(id, themeExport.theme[id]).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[id].name}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[id].name}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${themeExport.theme[id].name}`\n );\n }\n });\n break;\n }\n } catch (error) {\n printMessage(`Error importing themes: ${error}`, 'error');\n }\n}\n\n/**\n * Delete theme by id\n * @param {String} id theme id\n */\nexport async function deleteThemeCmd(id) {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${id}...`\n );\n try {\n await deleteTheme(id);\n stopProgressIndicator(indicatorId, `Deleted ${id}.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete theme by name\n * @param {String} name theme name\n */\nexport async function deleteThemeByNameCmd(name) {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${name}...`\n );\n try {\n await deleteThemeByName(name);\n stopProgressIndicator(indicatorId, `Deleted ${name}.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n */\nexport async function deleteAllThemes() {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all realm themes...`\n );\n try {\n await deleteThemes();\n stopProgressIndicator(indicatorId, `Deleted all realm themes.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n * @deprecated since version 0.14.0\n */\nexport async function deleteThemesCmd() {\n return deleteAllThemes();\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAK7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,SACEC,uBAAuB,EACvBC,WAAW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S,CAAC;EACjE,CAAC,CAAC,OAAOH,KAAK,EAAE;IACdnD,qBAAqB,CAACiD,WAAW,EAAG,UAASE,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EACvE;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAewC,oBAAoBA,CAACnE,IAAI,EAAE;EAC/C,MAAMwB,WAAW,GAAGpD,uBAAuB,CACzC,eAAe,EACf8F,SAAS,EACR,YAAWlE,IAAK,KACnB,CAAC;EACD,IAAI;IACF,MAAMP,iBAAiB,CAACO,IAAI,CAAC;IAC7BzB,qBAAqB,CAACiD,WAAW,EAAG,WAAUxB,IAAK,GAAE,EAAE,SAAS,CAAC;EACnE,CAAC,CAAC,OAAO0B,KAAK,EAAE;IACdnD,qBAAqB,CAACiD,WAAW,EAAG,UAASE,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EACvE;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAeyC,eAAeA,CAAA,EAAG;EACtC,MAAM5C,WAAW,GAAGpD,uBAAuB,CACzC,eAAe,EACf8F,SAAS,EACR,8BACH,CAAC;EACD,IAAI;IACF,MAAMxE,YAAY,CAAC,CAAC;IACpBnB,qBAAqB,CAACiD,WAAW,EAAG,2BAA0B,EAAE,SAAS,CAAC;EAC5E,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdnD,qBAAqB,CAACiD,WAAW,EAAG,UAASE,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EACvE;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAe0C,eAAeA,CAAA,EAAG;EACtC,OAAOD,eAAe,CAAC,CAAC;AAC1B"}
|
|
1
|
+
{"version":3,"file":"ThemeOps.js","names":["frodo","fs","v4","uuidv4","createProgressIndicator","createTable","printMessage","stopProgressIndicator","updateProgressIndicator","getRealmString","validateImport","getTypedFilename","saveJsonToFile","saveToFile","getFilePath","getWorkingDirectory","utils","readThemes","readThemeByName","readTheme","updateThemeByName","updateTheme","importThemes","exportThemes","deleteTheme","deleteThemeByName","deleteThemes","theme","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","sort","a","b","localeCompare","forEach","isDefault","table","push","toString","exportThemeByName","file","includeMeta","fileName","filePath","indicatorId","themeData","error","message","exportThemeById","id","exportThemesToFile","exportData","exportThemesToFiles","themes","barId","length","fileBarId","importThemeByName","data","readFileSync","themeExport","JSON","parse","found","Object","keys","importThemeById","themeId","importThemesFromFile","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","map","fileData","count","total","files","meta","_error$response","response","importFirstThemeFromFile","then","result","deleteThemeCmd","undefined","deleteThemeByNameCmd","deleteAllThemes","deleteThemesCmd"],"sources":["../../src/ops/ThemeOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport {\n ThemeExportInterface,\n type ThemeSkeleton,\n} from '@rockcarver/frodo-lib/types/ops/ThemeOps';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n createProgressIndicator,\n createTable,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst {\n getRealmString,\n validateImport,\n getTypedFilename,\n saveJsonToFile,\n saveToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readThemes,\n readThemeByName,\n readTheme,\n updateThemeByName,\n updateTheme,\n importThemes,\n exportThemes,\n deleteTheme,\n deleteThemeByName,\n deleteThemes,\n} = frodo.theme;\n\n/**\n * Get a one-line description of the theme\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(themeObj: ThemeSkeleton): string {\n const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${\n themeObj.linkedTrees\n ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')'\n : ''\n }`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Linked Journey(s) | Id |\\n';\n markdown += '| ---- | ----------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the theme in markdown\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a table-row of the theme in markdown\n */\nexport function getTableRowMd(themeObj: ThemeSkeleton): string {\n const row = `| ${themeObj.name} | ${\n themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''\n } | \\`${themeObj._id}\\` |`;\n return row;\n}\n\n/**\n * List all the themes\n * @param {boolean} long Long version, more fields\n */\nexport async function listThemes(long = false) {\n const themeList = await readThemes();\n themeList.sort((a, b) => a.name.localeCompare(b.name));\n if (!long) {\n themeList.forEach((theme) => {\n printMessage(\n `${theme.isDefault ? theme.name['brightCyan'] : theme.name}`,\n 'data'\n );\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Id'['brightCyan'],\n 'Default'['brightCyan'],\n ]);\n themeList.forEach((theme) => {\n table.push([\n `${theme.name}`,\n `${theme._id}`,\n `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`,\n ]);\n });\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Export theme by name to file\n * @param {String} name theme name\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemeByName(name, file, includeMeta = true) {\n let fileName = getTypedFilename(name, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${name}`\n );\n try {\n const themeData = await readThemeByName(name);\n if (!themeData._id) themeData._id = uuidv4();\n updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);\n saveToFile('theme', [themeData], '_id', filePath, includeMeta);\n stopProgressIndicator(indicatorId, `Successfully exported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export theme by uuid to file\n * @param {String} id theme uuid\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemeById(id, file, includeMeta = true) {\n let fileName = getTypedFilename(id, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${id}`\n );\n try {\n const themeData = await readTheme(id);\n updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);\n saveToFile('theme', [themeData], '_id', filePath, includeMeta);\n stopProgressIndicator(indicatorId, `Successfully exported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export all themes to file\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemesToFile(file, includeMeta = true) {\n let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportThemes();\n saveJsonToFile(exportData, filePath, includeMeta);\n}\n\n/**\n * Export all themes to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemesToFiles(includeMeta = true) {\n const themes = await readThemes();\n const barId = createProgressIndicator(\n 'determinate',\n themes.length,\n 'Exporting themes'\n );\n for (const theme of themes) {\n if (!theme._id) theme._id = uuidv4();\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting theme ${theme.name}...`\n );\n updateProgressIndicator(barId, `Exporting theme ${theme.name}`);\n const file = getFilePath(getTypedFilename(theme.name, 'theme'), true);\n saveToFile('theme', theme, '_id', file, includeMeta);\n updateProgressIndicator(fileBarId, `${theme.name} saved to ${file}`);\n stopProgressIndicator(fileBarId, `${theme.name} saved to ${file}.`);\n }\n stopProgressIndicator(barId, `${themes.length} themes exported.`);\n}\n\n/**\n * Import theme by name from file\n * @param {String} name theme name\n * @param {String} file import file name\n */\nexport async function importThemeByName(name, file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n let found = false;\n for (const id of Object.keys(themeExport.theme)) {\n if (themeExport.theme[id].name === name) {\n found = true;\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n try {\n await updateThemeByName(name, themeExport.theme[id]);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${name}.`\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[id].name}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[id].name}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n if (!found) {\n stopProgressIndicator(indicatorId, `Theme ${name} not found!`);\n }\n } catch (error) {\n printMessage(`Error importing theme ${name}: ${error}`, 'error');\n }\n}\n\n/**\n * Import theme by uuid from file\n * @param {String} id theme uuid\n * @param {String} file import file name\n */\nexport async function importThemeById(id, file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n let found = false;\n for (const themeId of Object.keys(themeExport.theme)) {\n if (themeId === id) {\n found = true;\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[themeId]._id}`\n );\n try {\n await updateTheme(themeId, themeExport.theme[themeId]);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${id}.`\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n if (!found) {\n stopProgressIndicator(indicatorId, `Theme ${id} not found!`);\n }\n } catch (error) {\n printMessage(`Error importing theme ${id}: ${error}`, 'error');\n }\n}\n\n/**\n * Import all themes from single file\n * @param {String} file import file name\n */\nexport async function importThemesFromFile(file) {\n const filePath = getFilePath(file);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing themes from ${filePath}...`\n );\n await importThemes(themeExport);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported ${Object.keys(themeExport.theme).length} themes.`\n );\n } catch (error) {\n printMessage(`Error importing themes: ${error}`, 'error');\n }\n}\n\n/**\n * Import themes from separate files\n */\nexport async function importThemesFromFiles() {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.theme.json'))\n .map((name) => getFilePath(name));\n\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing themes...'\n );\n let fileData = null;\n let count = 0;\n let total = 0;\n let files = 0;\n for (const file of jsonFiles) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n await importThemes(fileData);\n files += 1;\n total += count;\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} theme(s) from ${file}`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n } catch (error) {\n updateProgressIndicator(\n indicatorId,\n `Error importing theme(s) from ${file}`\n );\n printMessage(error.response?.data || error, 'error');\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} theme(s) from ${files} file(s).`\n );\n}\n\n/**\n * Import first theme from file\n * @param {String} file import file name\n */\nexport async function importFirstThemeFromFile(file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n for (const id of Object.keys(themeExport.theme)) {\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n updateTheme(id, themeExport.theme[id]).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[id].name}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[id].name}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${themeExport.theme[id].name}`\n );\n }\n });\n break;\n }\n } catch (error) {\n printMessage(`Error importing themes: ${error}`, 'error');\n }\n}\n\n/**\n * Delete theme by id\n * @param {String} id theme id\n */\nexport async function deleteThemeCmd(id) {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${id}...`\n );\n try {\n await deleteTheme(id);\n stopProgressIndicator(indicatorId, `Deleted ${id}.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete theme by name\n * @param {String} name theme name\n */\nexport async function deleteThemeByNameCmd(name) {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${name}...`\n );\n try {\n await deleteThemeByName(name);\n stopProgressIndicator(indicatorId, `Deleted ${name}.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n */\nexport async function deleteAllThemes() {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all realm themes...`\n );\n try {\n await deleteThemes();\n stopProgressIndicator(indicatorId, `Deleted all realm themes.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n * @deprecated since version 0.14.0\n */\nexport async function deleteThemesCmd() {\n return deleteAllThemes();\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAK7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,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AAC,OAAO0B,KAAK,EAAE;IACdnD,qBAAqB,CAACiD,WAAW,EAAG,UAASE,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EACvE;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAe2C,eAAeA,CAAA,EAAG;EACtC,MAAM9C,WAAW,GAAGpD,uBAAuB,CACzC,eAAe,EACfgG,SAAS,EACR,8BACH,CAAC;EACD,IAAI;IACF,MAAM1E,YAAY,CAAC,CAAC;IACpBnB,qBAAqB,CAACiD,WAAW,EAAG,2BAA0B,EAAE,SAAS,CAAC;EAC5E,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdnD,qBAAqB,CAACiD,WAAW,EAAG,UAASE,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EACvE;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAe4C,eAAeA,CAAA,EAAG;EACtC,OAAOD,eAAe,CAAC,CAAC;AAC1B"}
|
package/esm/utils/Config.js
CHANGED
|
@@ -67,10 +67,20 @@ export async function getFullExportConfig(file = null) {
|
|
|
67
67
|
if (!workingDirectory) {
|
|
68
68
|
return await exportFullConfiguration({
|
|
69
69
|
useStringArrays: true,
|
|
70
|
-
noDecode: false
|
|
70
|
+
noDecode: false,
|
|
71
|
+
coords: true
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
// Go through files in directory and reconstruct the full export
|
|
74
|
+
// Go through files in the working directory and reconstruct the full export
|
|
75
|
+
return getFullExportConfigFromDirectory(workingDirectory);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Reconstructs the full export config from files in the given directory
|
|
80
|
+
* @param directory The directory
|
|
81
|
+
* @return The full export config
|
|
82
|
+
*/
|
|
83
|
+
export async function getFullExportConfigFromDirectory(directory) {
|
|
74
84
|
const fullExportConfig = {
|
|
75
85
|
meta: {},
|
|
76
86
|
agents: {},
|
|
@@ -96,7 +106,7 @@ export async function getFullExportConfig(file = null) {
|
|
|
96
106
|
trees: {},
|
|
97
107
|
variables: {}
|
|
98
108
|
};
|
|
99
|
-
const files = await readFiles(
|
|
109
|
+
const files = await readFiles(directory);
|
|
100
110
|
const jsonFiles = files.filter(f => f.path.endsWith('.json'));
|
|
101
111
|
const idmConfigFiles = jsonFiles.filter(f => f.path.startsWith('config/'));
|
|
102
112
|
const samlFiles = jsonFiles.filter(f => f.path.startsWith('saml/') || f.path.startsWith('cot/'));
|
package/esm/utils/Config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","names":["frodo","state","fs","os","slugify","printMessage","getFilePath","readFiles","utils","exportFullConfiguration","config","getDefaultNoiseFilter","cloud","log","FRODO_CONFIG_PATH_KEY","FRODO_LOG_NOISEFILTER_FILENAME","getConfigPath","process","env","homedir","getCustomNoiseFilters","filename","noiseFilter","data","readFileSync","JSON","parse","e","message","getNoiseFilters","defaults","length","writeFileSync","stringify","getFullExportConfig","file","workingDirectory","getDirectory","useStringArrays","noDecode","fullExportConfig","meta","agents","application","authentication","emailTemplate","idp","managedApplication","policy","policyset","resourcetype","saml","hosted","remote","metadata","cot","script","secrets","service","theme","trees","variables","files","jsonFiles","filter","f","path","endsWith","idmConfigFiles","startsWith","samlFiles","otherFiles","scriptFiles","id","value","Object","entries","content","assign","_id","scriptExports","values","name","substring","lastIndexOf","indexOf","scriptLines","split","find","s","replace","remove","Error","isIdUsed","configuration","isEsv","isIdUsedRecurse","RegExp","replaceAll","regex","type","used","location","test"],"sources":["../../src/utils/Config.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { FullExportInterface } from '@rockcarver/frodo-lib/types/ops/ConfigOps';\nimport fs from 'fs';\nimport os from 'os';\nimport slugify from 'slugify';\n\nimport { printMessage } from './Console';\n\nconst { getFilePath, readFiles } = frodo.utils;\n\nconst { exportFullConfiguration } = frodo.config;\n\nconst { getDefaultNoiseFilter } = frodo.cloud.log;\n\nexport const FRODO_CONFIG_PATH_KEY = 'FRODO_CONFIG_PATH';\nexport const FRODO_LOG_NOISEFILTER_FILENAME = 'LoggingNoiseFilter.json';\n\nexport function getConfigPath(): string {\n return process.env[FRODO_CONFIG_PATH_KEY] || `${os.homedir()}/.frodo`;\n}\n\nfunction getCustomNoiseFilters(): Array<string> {\n const filename = `${getConfigPath()}/${FRODO_LOG_NOISEFILTER_FILENAME}`;\n let noiseFilter = [];\n try {\n const data = fs.readFileSync(filename, 'utf8');\n noiseFilter = JSON.parse(data);\n } catch (e) {\n printMessage(`Error reading ${filename} (${e.message})`, 'error');\n }\n return noiseFilter;\n}\n\nexport function getNoiseFilters(defaults: boolean): Array<string> {\n const filename = `${getConfigPath()}/${FRODO_LOG_NOISEFILTER_FILENAME}`;\n if (defaults) {\n printMessage(`Using default logging noise filters.`, 'info');\n return getDefaultNoiseFilter();\n }\n let noiseFilter = getCustomNoiseFilters();\n if (noiseFilter.length == 0) {\n printMessage(`No custom noise filters defined. Using defaults.`, 'info');\n noiseFilter = getDefaultNoiseFilter();\n try {\n fs.writeFileSync(filename, JSON.stringify(noiseFilter, null, 2));\n printMessage(\n `The default filters were saved in ${filename}. You can change the filters as needed.`,\n 'info'\n );\n } catch (e) {\n printMessage(\n `Error creating noise filter configuration with default values.`,\n 'error'\n );\n }\n }\n return noiseFilter;\n}\n\n/**\n * Gets the full export config from one of three locations:\n * 1. The file passed into the function if one is provided.\n * 2. The working directory if it exists (provided by the user)\n * 3. The cloud tenant if the exports are not locally provided\n * @param file The optional file path\n * @returns The full export config\n */\nexport async function getFullExportConfig(\n file: string | null = null\n): Promise<FullExportInterface> {\n // Get export from file if it exists\n if (file) {\n return JSON.parse(fs.readFileSync(getFilePath(file), 'utf8'));\n }\n // If working directory doesn't exist, export from the cloud\n const workingDirectory = state.getDirectory();\n if (!workingDirectory) {\n return await exportFullConfiguration({\n useStringArrays: true,\n noDecode: false,\n });\n }\n // Go through files in directory and reconstruct the full export\n const fullExportConfig = {\n meta: {},\n agents: {},\n application: {},\n authentication: {},\n config: {},\n emailTemplate: {},\n idp: {},\n managedApplication: {},\n policy: {},\n policyset: {},\n resourcetype: {},\n saml: {\n hosted: {},\n remote: {},\n metadata: {},\n cot: {},\n },\n script: {},\n secrets: {},\n service: {},\n theme: {},\n trees: {},\n variables: {},\n } as FullExportInterface;\n const files = await readFiles(workingDirectory);\n const jsonFiles = files.filter((f) => f.path.endsWith('.json'));\n const idmConfigFiles = jsonFiles.filter((f) => f.path.startsWith('config/'));\n const samlFiles = jsonFiles.filter(\n (f) => f.path.startsWith('saml/') || f.path.startsWith('cot/')\n );\n const otherFiles = jsonFiles.filter(\n (f) =>\n !f.path.startsWith('config/') &&\n !f.path.startsWith('saml/') &&\n !f.path.startsWith('cot/')\n );\n const scriptFiles = files.filter(\n (f) => f.path.endsWith('.js') || f.path.endsWith('.groovy')\n );\n // Handle json files\n for (const f of otherFiles) {\n for (const [id, value] of Object.entries(JSON.parse(f.content))) {\n if (value == null || fullExportConfig[id] == null) {\n continue;\n }\n Object.assign(fullExportConfig[id], value);\n }\n }\n // Handle saml files\n for (const f of samlFiles) {\n let content = JSON.parse(f.content);\n content = content.saml;\n for (const [id, value] of Object.entries(content)) {\n Object.assign(fullExportConfig.saml[id], value);\n }\n }\n // Handle idm config files\n for (const f of idmConfigFiles) {\n const content = JSON.parse(f.content);\n fullExportConfig.config[content._id] = content;\n }\n // Handle extracted scripts, adding them to their corresponding script objects in the export\n if (scriptFiles.length > 0 && fullExportConfig.script != null) {\n const scriptExports = Object.values(fullExportConfig.script);\n for (const f of scriptFiles) {\n const name = f.path.substring(\n f.path.lastIndexOf('/') + 1,\n f.path.indexOf('.', f.path.lastIndexOf('/'))\n );\n const scriptLines = f.content.split('\\n');\n const script = scriptExports.find(\n (s) =>\n slugify(s.name.replace(/^http(s?):\\/\\//, ''), {\n remove: /[^\\w\\s$*_+~.()'\"!\\-@]+/g,\n }) === name\n );\n if (!script) {\n throw Error(\n `Can't find the script corresponding to the file '${f.path}' in the export files`\n );\n }\n script.script = scriptLines;\n }\n }\n return fullExportConfig;\n}\n\n/**\n * Determines if a string id is being used anywhere within the given configuration object\n * @param configuration The configuration object\n * @param id The id being search for\n * @param isEsv Whether the id corresponds to an ESV or not\n */\nexport function isIdUsed(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n configuration: any,\n id: string,\n isEsv: boolean\n): {\n used: boolean;\n location: string;\n} {\n return isIdUsedRecurse(\n configuration,\n isEsv\n ? // For ESV ids, they contain either letters, numbers, dashes, or underscores. The dashes get replaced with periods (escaped with a \\ for the regex)\n // since anywhere they are being used they will be used with periods, not dashes. Note that the (?:[^a-z0-9._]|$) expressions at the beginning and\n // end are meant to ensure that the id found is not a substring of some other id (i.e. the id found must either be at the beginning or end of the\n // string, or if in the middle of a string, is not preceded or followed by a character that would be part of another id).\n new RegExp(\n `(?:[^a-z0-9._]|^)${id.replaceAll('-', '\\\\.')}(?:[^a-z0-9._]|$)`\n )\n : // For normal ids, they contain only letters, numbers, or dashes.\n new RegExp(`(?:[^a-z0-9-]|^)${id}(?:[^a-z0-9-]|$)`)\n );\n}\n\n/**\n * Recursive helper for isIdUsed that finds any strings contained in the configuration that pass the regex\n * @param configuration The configuration (could be anything)\n * @param regex The regex test\n */\nfunction isIdUsedRecurse(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n configuration: any,\n regex: RegExp\n): {\n used: boolean;\n location: string;\n} {\n const type = typeof configuration;\n if (type === 'object' && configuration !== null) {\n for (const [id, value] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n configuration as Record<string, any>\n )) {\n const isIdUsed = isIdUsedRecurse(value, regex);\n if (isIdUsed.used) {\n isIdUsed.location =\n id +\n (value.name ? `(name: '${value.name}')` : '') +\n (isIdUsed.location === '' ? '' : '.') +\n isIdUsed.location;\n return isIdUsed;\n }\n }\n }\n return {\n used: type === 'string' && regex.test(configuration),\n location: '',\n };\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uB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AAIM,IAAI,KAAK,QAAQ,IAAIN,aAAa,KAAK,IAAI,EAAE;IAC/C,KAAK,MAAM,CAACrB,EAAE,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO;IACtC;IACAkB,aACF,CAAC,EAAE;MACD,MAAMD,QAAQ,GAAGG,eAAe,CAACtB,KAAK,EAAEyB,KAAK,CAAC;MAC9C,IAAIN,QAAQ,CAACQ,IAAI,EAAE;QACjBR,QAAQ,CAACS,QAAQ,GACf7B,EAAE,IACDC,KAAK,CAACQ,IAAI,GAAI,WAAUR,KAAK,CAACQ,IAAK,IAAG,GAAG,EAAE,CAAC,IAC5CW,QAAQ,CAACS,QAAQ,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,GACrCT,QAAQ,CAACS,QAAQ;QACnB,OAAOT,QAAQ;MACjB;IACF;EACF;EACA,OAAO;IACLQ,IAAI,EAAED,IAAI,KAAK,QAAQ,IAAID,KAAK,CAACI,IAAI,CAACT,aAAa,CAAC;IACpDQ,QAAQ,EAAE;EACZ,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"Config.js","names":["frodo","state","fs","os","slugify","printMessage","getFilePath","readFiles","utils","exportFullConfiguration","config","getDefaultNoiseFilter","cloud","log","FRODO_CONFIG_PATH_KEY","FRODO_LOG_NOISEFILTER_FILENAME","getConfigPath","process","env","homedir","getCustomNoiseFilters","filename","noiseFilter","data","readFileSync","JSON","parse","e","message","getNoiseFilters","defaults","length","writeFileSync","stringify","getFullExportConfig","file","workingDirectory","getDirectory","useStringArrays","noDecode","coords","getFullExportConfigFromDirectory","directory","fullExportConfig","meta","agents","application","authentication","emailTemplate","idp","managedApplication","policy","policyset","resourcetype","saml","hosted","remote","metadata","cot","script","secrets","service","theme","trees","variables","files","jsonFiles","filter","f","path","endsWith","idmConfigFiles","startsWith","samlFiles","otherFiles","scriptFiles","id","value","Object","entries","content","assign","_id","scriptExports","values","name","substring","lastIndexOf","indexOf","scriptLines","split","find","s","replace","remove","Error","isIdUsed","configuration","isEsv","isIdUsedRecurse","RegExp","replaceAll","regex","type","used","location","test"],"sources":["../../src/utils/Config.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { FullExportInterface } from '@rockcarver/frodo-lib/types/ops/ConfigOps';\nimport fs from 'fs';\nimport os from 'os';\nimport slugify from 'slugify';\n\nimport { printMessage } from './Console';\n\nconst { getFilePath, readFiles } = frodo.utils;\n\nconst { exportFullConfiguration } = frodo.config;\n\nconst { getDefaultNoiseFilter } = frodo.cloud.log;\n\nexport const FRODO_CONFIG_PATH_KEY = 'FRODO_CONFIG_PATH';\nexport const FRODO_LOG_NOISEFILTER_FILENAME = 'LoggingNoiseFilter.json';\n\nexport function getConfigPath(): string {\n return process.env[FRODO_CONFIG_PATH_KEY] || `${os.homedir()}/.frodo`;\n}\n\nfunction getCustomNoiseFilters(): Array<string> {\n const filename = `${getConfigPath()}/${FRODO_LOG_NOISEFILTER_FILENAME}`;\n let noiseFilter = [];\n try {\n const data = fs.readFileSync(filename, 'utf8');\n noiseFilter = JSON.parse(data);\n } catch (e) {\n printMessage(`Error reading ${filename} (${e.message})`, 'error');\n }\n return noiseFilter;\n}\n\nexport function getNoiseFilters(defaults: boolean): Array<string> {\n const filename = `${getConfigPath()}/${FRODO_LOG_NOISEFILTER_FILENAME}`;\n if (defaults) {\n printMessage(`Using default logging noise filters.`, 'info');\n return getDefaultNoiseFilter();\n }\n let noiseFilter = getCustomNoiseFilters();\n if (noiseFilter.length == 0) {\n printMessage(`No custom noise filters defined. Using defaults.`, 'info');\n noiseFilter = getDefaultNoiseFilter();\n try {\n fs.writeFileSync(filename, JSON.stringify(noiseFilter, null, 2));\n printMessage(\n `The default filters were saved in ${filename}. You can change the filters as needed.`,\n 'info'\n );\n } catch (e) {\n printMessage(\n `Error creating noise filter configuration with default values.`,\n 'error'\n );\n }\n }\n return noiseFilter;\n}\n\n/**\n * Gets the full export config from one of three locations:\n * 1. The file passed into the function if one is provided.\n * 2. The working directory if it exists (provided by the user)\n * 3. The cloud tenant if the exports are not locally provided\n * @param file The optional file path\n * @returns The full export config\n */\nexport async function getFullExportConfig(\n file: string | null = null\n): Promise<FullExportInterface> {\n // Get export from file if it exists\n if (file) {\n return JSON.parse(fs.readFileSync(getFilePath(file), 'utf8'));\n }\n // If working directory doesn't exist, export from the cloud\n const workingDirectory = state.getDirectory();\n if (!workingDirectory) {\n return await exportFullConfiguration({\n useStringArrays: true,\n noDecode: false,\n coords: true,\n });\n }\n // Go through files in the working directory and reconstruct the full export\n return getFullExportConfigFromDirectory(workingDirectory);\n}\n\n/**\n * Reconstructs the full export config from files in the given directory\n * @param directory The directory\n * @return The full export config\n */\nexport async function getFullExportConfigFromDirectory(\n directory: string\n): Promise<FullExportInterface> {\n const fullExportConfig = {\n meta: {},\n agents: {},\n application: {},\n authentication: {},\n config: {},\n emailTemplate: {},\n idp: {},\n managedApplication: {},\n policy: {},\n policyset: {},\n resourcetype: {},\n saml: {\n hosted: {},\n remote: {},\n metadata: {},\n cot: {},\n },\n script: {},\n secrets: {},\n service: {},\n theme: {},\n trees: {},\n variables: {},\n } as FullExportInterface;\n const files = await readFiles(directory);\n const jsonFiles = files.filter((f) => f.path.endsWith('.json'));\n const idmConfigFiles = jsonFiles.filter((f) => f.path.startsWith('config/'));\n const samlFiles = jsonFiles.filter(\n (f) => f.path.startsWith('saml/') || f.path.startsWith('cot/')\n );\n const otherFiles = jsonFiles.filter(\n (f) =>\n !f.path.startsWith('config/') &&\n !f.path.startsWith('saml/') &&\n !f.path.startsWith('cot/')\n );\n const scriptFiles = files.filter(\n (f) => f.path.endsWith('.js') || f.path.endsWith('.groovy')\n );\n // Handle json files\n for (const f of otherFiles) {\n for (const [id, value] of Object.entries(JSON.parse(f.content))) {\n if (value == null || fullExportConfig[id] == null) {\n continue;\n }\n Object.assign(fullExportConfig[id], value);\n }\n }\n // Handle saml files\n for (const f of samlFiles) {\n let content = JSON.parse(f.content);\n content = content.saml;\n for (const [id, value] of Object.entries(content)) {\n Object.assign(fullExportConfig.saml[id], value);\n }\n }\n // Handle idm config files\n for (const f of idmConfigFiles) {\n const content = JSON.parse(f.content);\n fullExportConfig.config[content._id] = content;\n }\n // Handle extracted scripts, adding them to their corresponding script objects in the export\n if (scriptFiles.length > 0 && fullExportConfig.script != null) {\n const scriptExports = Object.values(fullExportConfig.script);\n for (const f of scriptFiles) {\n const name = f.path.substring(\n f.path.lastIndexOf('/') + 1,\n f.path.indexOf('.', f.path.lastIndexOf('/'))\n );\n const scriptLines = f.content.split('\\n');\n const script = scriptExports.find(\n (s) =>\n slugify(s.name.replace(/^http(s?):\\/\\//, ''), {\n remove: /[^\\w\\s$*_+~.()'\"!\\-@]+/g,\n }) === name\n );\n if (!script) {\n throw Error(\n `Can't find the script corresponding to the file '${f.path}' in the export files`\n );\n }\n script.script = scriptLines;\n }\n }\n return fullExportConfig;\n}\n\n/**\n * Determines if a string id is being used anywhere within the given configuration object\n * @param configuration The configuration object\n * @param id The id being search for\n * @param isEsv Whether the id corresponds to an ESV or not\n */\nexport function isIdUsed(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n configuration: any,\n id: string,\n isEsv: boolean\n): {\n used: boolean;\n location: string;\n} {\n return isIdUsedRecurse(\n configuration,\n isEsv\n ? // For ESV ids, they contain either letters, numbers, dashes, or underscores. The dashes get replaced with periods (escaped with a \\ for the regex)\n // since anywhere they are being used they will be used with periods, not dashes. Note that the (?:[^a-z0-9._]|$) expressions at the beginning and\n // end are meant to ensure that the id found is not a substring of some other id (i.e. the id found must either be at the beginning or end of the\n // string, or if in the middle of a string, is not preceded or followed by a character that would be part of another id).\n new RegExp(\n `(?:[^a-z0-9._]|^)${id.replaceAll('-', '\\\\.')}(?:[^a-z0-9._]|$)`\n )\n : // For normal ids, they contain only letters, numbers, or dashes.\n new RegExp(`(?:[^a-z0-9-]|^)${id}(?:[^a-z0-9-]|$)`)\n );\n}\n\n/**\n * Recursive helper for isIdUsed that finds any strings contained in the configuration that pass the regex\n * @param configuration The configuration (could be anything)\n * @param regex The regex test\n */\nfunction isIdUsedRecurse(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n configuration: any,\n regex: RegExp\n): {\n used: boolean;\n location: string;\n} {\n const type = typeof configuration;\n if (type === 'object' && configuration !== null) {\n for (const [id, value] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n configuration as Record<string, any>\n )) {\n const isIdUsed = isIdUsedRecurse(value, regex);\n if (isIdUsed.used) {\n isIdUsed.location =\n id +\n (value.name ? `(name: '${value.name}')` : '') +\n (isIdUsed.location === '' ? '' : '.') +\n isIdUsed.location;\n return isIdUsed;\n }\n }\n }\n return {\n used: type === 'string' && regex.test(configuration),\n location: '',\n };\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,OAAO,MAAM,SAAS;AAE7B,SAASC,YAAY,QAAQ,WAAW;AAExC,MAAM;EAAEC,WAAW;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAACQ,KAAK;AAE9C,MAAM;EAAEC;AAAwB,CAAC,GAAGT,KAAK,CAACU,MAAM;AAEhD,MAAM;EAAEC;AAAsB,CAAC,GAAGX,KAAK,CAACY,KAAK,CAACC,GAAG;AAEjD,OAAO,MAAMC,qBAAqB,GAAG,mBAAmB;AACxD,OAAO,MAAMC,8BAA8B,GAAG,yBAAyB;AAEvE,OAAO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOC,OAAO,CAACC,GAAG,CAACJ,qBAAqB,CAAC,IAAK,GAAEX,EAAE,CAACgB,OAAO,CAAC,CAAE,SAAQ;AACvE;AAEA,SAASC,qBAAqBA,CAAA,EAAkB;EAC9C,MAAMC,QAAQ,GAAI,GAAEL,aAAa,CAAC,CAAE,IAAGD,8BAA+B,EAAC;EACvE,IAAIO,WAAW,GAAG,EAAE;EACpB,IAAI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Q,IAAID,KAAK,CAACI,IAAI,CAACT,aAAa,CAAC;IACpDQ,QAAQ,EAAE;EACZ,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-cli",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
|
|
6
6
|
"keywords": [
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
]
|
|
117
117
|
},
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@rockcarver/frodo-lib": "2.0.0-
|
|
119
|
+
"@rockcarver/frodo-lib": "2.0.0-58",
|
|
120
120
|
"chokidar": "^3.5.3",
|
|
121
121
|
"cli-progress": "^3.11.2",
|
|
122
122
|
"cli-table3": "^0.6.3",
|