@rockcarver/frodo-cli 2.0.6-0 → 2.0.6-1
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 +8 -5
- package/dist/app.cjs +331 -87
- package/dist/app.cjs.map +1 -1
- package/package.json +1 -1
package/dist/app.cjs
CHANGED
|
@@ -177540,6 +177540,8 @@ var {
|
|
|
177540
177540
|
saveToFile: saveToFile3
|
|
177541
177541
|
} = frodo.utils;
|
|
177542
177542
|
var {
|
|
177543
|
+
readScript: readScript2,
|
|
177544
|
+
readScriptByName: readScriptByName2,
|
|
177543
177545
|
readScripts: readScripts2,
|
|
177544
177546
|
exportScript: exportScript2,
|
|
177545
177547
|
exportScriptByName: exportScriptByName2,
|
|
@@ -177549,6 +177551,7 @@ var {
|
|
|
177549
177551
|
deleteScriptByName: deleteScriptByName3,
|
|
177550
177552
|
deleteScripts: deleteScripts3
|
|
177551
177553
|
} = frodo.script;
|
|
177554
|
+
var langMap = { JAVASCRIPT: "JavaScript", GROOVY: "Groovy" };
|
|
177552
177555
|
function getOneLineDescription(scriptObj) {
|
|
177553
177556
|
const description = `[${scriptObj._id["brightCyan"]}] ${scriptObj.context} - ${scriptObj.name}`;
|
|
177554
177557
|
return description;
|
|
@@ -177560,7 +177563,6 @@ function getTableHeaderMd() {
|
|
|
177560
177563
|
return markdown;
|
|
177561
177564
|
}
|
|
177562
177565
|
function getTableRowMd(scriptObj) {
|
|
177563
|
-
const langMap = { JAVASCRIPT: "JavaScript", GROOVY: "Groovy" };
|
|
177564
177566
|
const description = `| ${scriptObj.name} | ${langMap[scriptObj.language]} | ${titleCase7(scriptObj.context.split("_").join(" "))} | \`${scriptObj._id}\` |`;
|
|
177565
177567
|
return description;
|
|
177566
177568
|
}
|
|
@@ -177602,11 +177604,12 @@ async function listScripts(long = false, usage = false, file = null) {
|
|
|
177602
177604
|
printError2(error2);
|
|
177603
177605
|
return false;
|
|
177604
177606
|
}
|
|
177605
|
-
|
|
177607
|
+
for (const realmExport of Object.values(fullExport.realm)) {
|
|
177608
|
+
delete realmExport.script;
|
|
177609
|
+
}
|
|
177606
177610
|
headers2.push("Used");
|
|
177607
177611
|
}
|
|
177608
177612
|
const table = createTable(headers2);
|
|
177609
|
-
const langMap = { JAVASCRIPT: "JS", GROOVY: "Groovy" };
|
|
177610
177613
|
scripts.forEach((script) => {
|
|
177611
177614
|
const values3 = long ? [
|
|
177612
177615
|
wordwrap(script.name, 25, " "),
|
|
@@ -177616,9 +177619,9 @@ async function listScripts(long = false, usage = false, file = null) {
|
|
|
177616
177619
|
wordwrap(script.description, 30)
|
|
177617
177620
|
] : [wordwrap(script.name, 25, " ")];
|
|
177618
177621
|
if (usage) {
|
|
177619
|
-
const
|
|
177622
|
+
const locations = getIdLocations(fullExport, script._id, false);
|
|
177620
177623
|
values3.push(
|
|
177621
|
-
|
|
177624
|
+
locations.length > 0 ? `${"yes"["brightGreen"]} (${locations.length === 1 ? `at` : `${locations.length} uses, including:`} ${locations[0]})` : "no"["brightRed"]
|
|
177622
177625
|
);
|
|
177623
177626
|
}
|
|
177624
177627
|
table.push(values3);
|
|
@@ -177627,6 +177630,87 @@ async function listScripts(long = false, usage = false, file = null) {
|
|
|
177627
177630
|
debugMessage2(`Cli.ScriptOps.listScripts: end`);
|
|
177628
177631
|
return true;
|
|
177629
177632
|
}
|
|
177633
|
+
async function describeScript(scriptId, scriptName, file, usage = false, json = false) {
|
|
177634
|
+
const spinnerId = createProgressIndicator2(
|
|
177635
|
+
"indeterminate",
|
|
177636
|
+
0,
|
|
177637
|
+
`Describing script '${scriptId ? scriptId : scriptName}'...`
|
|
177638
|
+
);
|
|
177639
|
+
try {
|
|
177640
|
+
let script;
|
|
177641
|
+
if (scriptId) {
|
|
177642
|
+
script = await readScript2(scriptId);
|
|
177643
|
+
} else {
|
|
177644
|
+
script = await readScriptByName2(scriptName);
|
|
177645
|
+
}
|
|
177646
|
+
if (usage) {
|
|
177647
|
+
try {
|
|
177648
|
+
const fullExport = await getFullExportConfig(file);
|
|
177649
|
+
for (const realmExport of Object.values(fullExport.realm)) {
|
|
177650
|
+
delete realmExport.script;
|
|
177651
|
+
}
|
|
177652
|
+
script.locations = getIdLocations(fullExport, script._id, false);
|
|
177653
|
+
} catch (error2) {
|
|
177654
|
+
stopProgressIndicator2(
|
|
177655
|
+
spinnerId,
|
|
177656
|
+
`Error determining usage for script '${scriptId ? scriptId : scriptName}'`,
|
|
177657
|
+
"fail"
|
|
177658
|
+
);
|
|
177659
|
+
printError2(error2);
|
|
177660
|
+
return false;
|
|
177661
|
+
}
|
|
177662
|
+
}
|
|
177663
|
+
stopProgressIndicator2(
|
|
177664
|
+
spinnerId,
|
|
177665
|
+
`Successfully retrieved script '${scriptId ? scriptId : scriptName}'`,
|
|
177666
|
+
"success"
|
|
177667
|
+
);
|
|
177668
|
+
if (json) {
|
|
177669
|
+
printMessage2(script, "data");
|
|
177670
|
+
} else {
|
|
177671
|
+
const table = createKeyValueTable();
|
|
177672
|
+
table.push(["Id"["brightCyan"], script._id]);
|
|
177673
|
+
table.push(["Name"["brightCyan"], script.name]);
|
|
177674
|
+
table.push(["Language"["brightCyan"], langMap[script.language]]);
|
|
177675
|
+
table.push([
|
|
177676
|
+
"Context"["brightCyan"],
|
|
177677
|
+
titleCase7(script.context.split("_").join(" "))
|
|
177678
|
+
]);
|
|
177679
|
+
table.push(["Description"["brightCyan"], script.description]);
|
|
177680
|
+
table.push([
|
|
177681
|
+
"Default"["brightCyan"],
|
|
177682
|
+
script.default ? "true"["brightGreen"] : "false"["brightRed"]
|
|
177683
|
+
]);
|
|
177684
|
+
table.push(["Evaluator Version"["brightCyan"], script.evaluatorVersion]);
|
|
177685
|
+
const scriptWrapLength = 80;
|
|
177686
|
+
const wrapRegex = new RegExp(`.{1,${scriptWrapLength + 1}}`, "g");
|
|
177687
|
+
const scriptParts = script.script.match(wrapRegex);
|
|
177688
|
+
table.push(["Script (Base 64)"["brightCyan"], scriptParts[0]]);
|
|
177689
|
+
for (let i2 = 1; i2 < scriptParts.length; i2++) {
|
|
177690
|
+
table.push(["", scriptParts[i2]]);
|
|
177691
|
+
}
|
|
177692
|
+
if (usage) {
|
|
177693
|
+
table.push([
|
|
177694
|
+
`Usage Locations (${script.locations.length} total)`["brightCyan"],
|
|
177695
|
+
script.locations.length > 0 ? script.locations[0] : ""
|
|
177696
|
+
]);
|
|
177697
|
+
for (let i2 = 1; i2 < script.locations.length; i2++) {
|
|
177698
|
+
table.push(["", script.locations[i2]]);
|
|
177699
|
+
}
|
|
177700
|
+
}
|
|
177701
|
+
printMessage2(table.toString(), "data");
|
|
177702
|
+
}
|
|
177703
|
+
return true;
|
|
177704
|
+
} catch (error2) {
|
|
177705
|
+
stopProgressIndicator2(
|
|
177706
|
+
spinnerId,
|
|
177707
|
+
`Error describing script '${scriptId ? scriptId : scriptName}'`,
|
|
177708
|
+
"fail"
|
|
177709
|
+
);
|
|
177710
|
+
printError2(error2);
|
|
177711
|
+
}
|
|
177712
|
+
return false;
|
|
177713
|
+
}
|
|
177630
177714
|
async function exportScriptToFile(scriptId, file, includeMeta = true, extract = false, options2) {
|
|
177631
177715
|
debugMessage2(`Cli.ScriptOps.exportScriptToFile: start`);
|
|
177632
177716
|
try {
|
|
@@ -178143,8 +178227,8 @@ async function getConfigFromDirectory(directory, exportConfig) {
|
|
|
178143
178227
|
});
|
|
178144
178228
|
}
|
|
178145
178229
|
}
|
|
178146
|
-
function
|
|
178147
|
-
return
|
|
178230
|
+
function getIdLocations(configuration, id7, isEsv) {
|
|
178231
|
+
return getIdLocationsRecurse(
|
|
178148
178232
|
configuration,
|
|
178149
178233
|
isEsv ? (
|
|
178150
178234
|
// For ESV ids, they contain either letters, numbers, dashes, or underscores. The dashes get replaced with periods (escaped with a \ for the regex)
|
|
@@ -178160,24 +178244,24 @@ function isIdUsed(configuration, id7, isEsv) {
|
|
|
178160
178244
|
)
|
|
178161
178245
|
);
|
|
178162
178246
|
}
|
|
178163
|
-
function
|
|
178247
|
+
function getIdLocationsRecurse(configuration, regex2) {
|
|
178248
|
+
let locations = [];
|
|
178164
178249
|
const type = typeof configuration;
|
|
178165
178250
|
if (type === "object" && configuration !== null) {
|
|
178166
178251
|
for (const [id7, value] of Object.entries(
|
|
178167
178252
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
178168
178253
|
configuration
|
|
178169
178254
|
)) {
|
|
178170
|
-
const
|
|
178171
|
-
|
|
178172
|
-
|
|
178173
|
-
|
|
178174
|
-
|
|
178255
|
+
const usedLocations = getIdLocationsRecurse(value, regex2);
|
|
178256
|
+
const updatedLocations = usedLocations.map(
|
|
178257
|
+
(loc) => id7 + (value.name ? `(name: '${value.name}')` : "") + (loc === "" ? "" : ".") + loc
|
|
178258
|
+
);
|
|
178259
|
+
locations = locations.concat(updatedLocations);
|
|
178175
178260
|
}
|
|
178261
|
+
} else if (type === "string" && regex2.test(configuration)) {
|
|
178262
|
+
locations.push("");
|
|
178176
178263
|
}
|
|
178177
|
-
return
|
|
178178
|
-
used: type === "string" && regex2.test(configuration),
|
|
178179
|
-
location: ""
|
|
178180
|
-
};
|
|
178264
|
+
return locations;
|
|
178181
178265
|
}
|
|
178182
178266
|
|
|
178183
178267
|
// src/ops/ConfigOps.ts
|
|
@@ -180019,8 +180103,8 @@ async function listSecrets(long = false, usage = false, file = null) {
|
|
|
180019
180103
|
return false;
|
|
180020
180104
|
}
|
|
180021
180105
|
if (!long && !usage) {
|
|
180022
|
-
secrets.forEach((
|
|
180023
|
-
printMessage2(
|
|
180106
|
+
secrets.forEach((secret) => {
|
|
180107
|
+
printMessage2(secret._id, "data");
|
|
180024
180108
|
});
|
|
180025
180109
|
return true;
|
|
180026
180110
|
}
|
|
@@ -180041,7 +180125,7 @@ async function listSecrets(long = false, usage = false, file = null) {
|
|
|
180041
180125
|
printError2(error2);
|
|
180042
180126
|
return false;
|
|
180043
180127
|
}
|
|
180044
|
-
delete fullExport.secrets;
|
|
180128
|
+
delete fullExport.global.secrets;
|
|
180045
180129
|
headers2.push("Used"["brightCyan"]);
|
|
180046
180130
|
}
|
|
180047
180131
|
const table = createTable(headers2);
|
|
@@ -180063,9 +180147,9 @@ async function listSecrets(long = false, usage = false, file = null) {
|
|
|
180063
180147
|
new Date(secret.lastChangeDate).toUTCString()
|
|
180064
180148
|
] : [secret._id];
|
|
180065
180149
|
if (usage) {
|
|
180066
|
-
const
|
|
180150
|
+
const locations = getIdLocations(fullExport, secret._id, true);
|
|
180067
180151
|
values3.push(
|
|
180068
|
-
|
|
180152
|
+
locations.length > 0 ? `${"yes"["brightGreen"]} (${locations.length === 1 ? `at` : `${locations.length} uses, including:`} ${locations[0]})` : "no"["brightRed"]
|
|
180069
180153
|
);
|
|
180070
180154
|
}
|
|
180071
180155
|
table.push(values3);
|
|
@@ -180193,7 +180277,7 @@ async function deleteSecrets() {
|
|
|
180193
180277
|
}
|
|
180194
180278
|
return false;
|
|
180195
180279
|
}
|
|
180196
|
-
async function listSecretVersions(secretId) {
|
|
180280
|
+
async function listSecretVersions(secretId, json = false) {
|
|
180197
180281
|
let spinnerId;
|
|
180198
180282
|
let versions5 = [];
|
|
180199
180283
|
try {
|
|
@@ -180208,6 +180292,10 @@ async function listSecretVersions(secretId) {
|
|
|
180208
180292
|
`Successfully read ${versions5.length} secret versions.`,
|
|
180209
180293
|
"success"
|
|
180210
180294
|
);
|
|
180295
|
+
if (json) {
|
|
180296
|
+
printMessage2(versions5, "data");
|
|
180297
|
+
return true;
|
|
180298
|
+
}
|
|
180211
180299
|
const table = createTable([
|
|
180212
180300
|
{ hAlign: "right", content: "Version"["brightCyan"] },
|
|
180213
180301
|
"Status"["brightCyan"],
|
|
@@ -180235,46 +180323,79 @@ async function listSecretVersions(secretId) {
|
|
|
180235
180323
|
}
|
|
180236
180324
|
return false;
|
|
180237
180325
|
}
|
|
180238
|
-
async function describeSecret(secretId) {
|
|
180326
|
+
async function describeSecret(secretId, file, usage = false, json = false) {
|
|
180239
180327
|
let spinnerId;
|
|
180240
|
-
let secret = null;
|
|
180241
180328
|
try {
|
|
180242
180329
|
spinnerId = createProgressIndicator2(
|
|
180243
180330
|
"indeterminate",
|
|
180244
180331
|
0,
|
|
180245
180332
|
`Reading secret ${secretId}...`
|
|
180246
180333
|
);
|
|
180247
|
-
secret = await readSecret2(secretId);
|
|
180334
|
+
const secret = await readSecret2(secretId);
|
|
180335
|
+
if (usage) {
|
|
180336
|
+
try {
|
|
180337
|
+
const fullExport = await getFullExportConfig(file);
|
|
180338
|
+
delete fullExport.global.secrets;
|
|
180339
|
+
secret.locations = getIdLocations(fullExport, secretId, true);
|
|
180340
|
+
} catch (error2) {
|
|
180341
|
+
stopProgressIndicator2(
|
|
180342
|
+
spinnerId,
|
|
180343
|
+
`Error determining usage for secret with id ${secretId}`,
|
|
180344
|
+
"fail"
|
|
180345
|
+
);
|
|
180346
|
+
printError2(error2);
|
|
180347
|
+
return false;
|
|
180348
|
+
}
|
|
180349
|
+
}
|
|
180248
180350
|
stopProgressIndicator2(
|
|
180249
180351
|
spinnerId,
|
|
180250
180352
|
`Successfully read secret ${secretId}.`,
|
|
180251
180353
|
"success"
|
|
180252
180354
|
);
|
|
180253
|
-
|
|
180254
|
-
|
|
180255
|
-
|
|
180256
|
-
|
|
180257
|
-
|
|
180258
|
-
"
|
|
180259
|
-
|
|
180260
|
-
|
|
180261
|
-
|
|
180262
|
-
|
|
180263
|
-
|
|
180264
|
-
|
|
180265
|
-
|
|
180266
|
-
|
|
180267
|
-
|
|
180268
|
-
|
|
180269
|
-
|
|
180355
|
+
if (json) {
|
|
180356
|
+
printMessage2(secret, "data");
|
|
180357
|
+
} else {
|
|
180358
|
+
const table = createKeyValueTable();
|
|
180359
|
+
table.push(["Name"["brightCyan"], secret._id]);
|
|
180360
|
+
table.push(["Active Version"["brightCyan"], secret.activeVersion]);
|
|
180361
|
+
table.push(["Loaded Version"["brightCyan"], secret.loadedVersion]);
|
|
180362
|
+
table.push([
|
|
180363
|
+
"Status"["brightCyan"],
|
|
180364
|
+
secret.loaded ? "loaded"["brightGreen"] : "unloaded"["brightRed"]
|
|
180365
|
+
]);
|
|
180366
|
+
table.push([
|
|
180367
|
+
"Description"["brightCyan"],
|
|
180368
|
+
wordwrap(secret.description, 60)
|
|
180369
|
+
]);
|
|
180370
|
+
table.push([
|
|
180371
|
+
"Modified"["brightCyan"],
|
|
180372
|
+
new Date(secret.lastChangeDate).toLocaleString()
|
|
180373
|
+
]);
|
|
180374
|
+
let lastChangedBy = secret.lastChangedBy;
|
|
180375
|
+
try {
|
|
180376
|
+
lastChangedBy = state.getUseBearerTokenForAmApis() ? secret.lastChangedBy : await resolveUserName3("teammember", secret.lastChangedBy);
|
|
180377
|
+
} catch (error2) {
|
|
180378
|
+
}
|
|
180379
|
+
table.push(["Modifier"["brightCyan"], lastChangedBy]);
|
|
180380
|
+
table.push(["Modifier UUID"["brightCyan"], secret.lastChangedBy]);
|
|
180381
|
+
table.push(["Encoding"["brightCyan"], secret.encoding]);
|
|
180382
|
+
table.push([
|
|
180383
|
+
"Use In Placeholders"["brightCyan"],
|
|
180384
|
+
secret.useInPlaceholders
|
|
180385
|
+
]);
|
|
180386
|
+
if (usage) {
|
|
180387
|
+
table.push([
|
|
180388
|
+
`Usage Locations (${secret.locations.length} total)`["brightCyan"],
|
|
180389
|
+
secret.locations.length > 0 ? secret.locations[0] : ""
|
|
180390
|
+
]);
|
|
180391
|
+
for (let i2 = 1; i2 < secret.locations.length; i2++) {
|
|
180392
|
+
table.push(["", secret.locations[i2]]);
|
|
180393
|
+
}
|
|
180394
|
+
}
|
|
180395
|
+
printMessage2(table.toString(), "data");
|
|
180270
180396
|
}
|
|
180271
|
-
table.push(["Modifier"["brightCyan"], lastChangedBy]);
|
|
180272
|
-
table.push(["Modifier UUID"["brightCyan"], secret.lastChangedBy]);
|
|
180273
|
-
table.push(["Encoding"["brightCyan"], secret.encoding]);
|
|
180274
|
-
table.push(["Use In Placeholders"["brightCyan"], secret.useInPlaceholders]);
|
|
180275
|
-
printMessage2(table.toString(), "data");
|
|
180276
180397
|
printMessage2("\nSecret Versions:", "data");
|
|
180277
|
-
await listSecretVersions(secretId);
|
|
180398
|
+
await listSecretVersions(secretId, json);
|
|
180278
180399
|
return true;
|
|
180279
180400
|
} catch (error2) {
|
|
180280
180401
|
stopProgressIndicator2(
|
|
@@ -180705,7 +180826,17 @@ function setup89() {
|
|
|
180705
180826
|
"-i, --secret-id <secret-id>",
|
|
180706
180827
|
"Secret id."
|
|
180707
180828
|
).makeOptionMandatory()
|
|
180708
|
-
).
|
|
180829
|
+
).addOption(
|
|
180830
|
+
new Option(
|
|
180831
|
+
"-f, --file [file]",
|
|
180832
|
+
"Optional export file to use to determine usage. Overrides -D, --directory. Only used if -u or --usage is provided as well."
|
|
180833
|
+
)
|
|
180834
|
+
).addOption(
|
|
180835
|
+
new Option(
|
|
180836
|
+
"-u, --usage",
|
|
180837
|
+
"List all uses of the secret. If a file is provided with -f or --file, it will search for usage in the file. If a directory is provided with -D or --directory, it will search for usage in all .json files in the directory and sub-directories. If no file or directory is provided, it will perform a full export automatically to determine usage."
|
|
180838
|
+
).default(false, "false")
|
|
180839
|
+
).addOption(new Option("--json", "Output in JSON format.")).action(
|
|
180709
180840
|
// implement command logic inside action handler
|
|
180710
180841
|
async (host2, user2, password3, options2, command2) => {
|
|
180711
180842
|
command2.handleDefaultArgsAndOpts(
|
|
@@ -180715,11 +180846,21 @@ function setup89() {
|
|
|
180715
180846
|
options2,
|
|
180716
180847
|
command2
|
|
180717
180848
|
);
|
|
180718
|
-
if (await getTokens2(false, true, deploymentTypes25)) {
|
|
180849
|
+
if (options2.secretId && await getTokens2(false, true, deploymentTypes25)) {
|
|
180719
180850
|
verboseMessage2(`Describing secret ${options2.secretId}...`);
|
|
180720
|
-
const outcome = await describeSecret(
|
|
180851
|
+
const outcome = await describeSecret(
|
|
180852
|
+
options2.secretId,
|
|
180853
|
+
options2.file,
|
|
180854
|
+
options2.usage,
|
|
180855
|
+
options2.json
|
|
180856
|
+
);
|
|
180721
180857
|
if (!outcome) process.exitCode = 1;
|
|
180722
180858
|
} else {
|
|
180859
|
+
printMessage2(
|
|
180860
|
+
"Unrecognized combination of options or no options...",
|
|
180861
|
+
"error"
|
|
180862
|
+
);
|
|
180863
|
+
program3.help();
|
|
180723
180864
|
process.exitCode = 1;
|
|
180724
180865
|
}
|
|
180725
180866
|
}
|
|
@@ -181327,7 +181468,7 @@ async function listVariables(long = false, usage = false, file = null) {
|
|
|
181327
181468
|
printError2(error2);
|
|
181328
181469
|
return false;
|
|
181329
181470
|
}
|
|
181330
|
-
delete fullExport.variables;
|
|
181471
|
+
delete fullExport.global.variables;
|
|
181331
181472
|
headers2.push("Used"["brightCyan"]);
|
|
181332
181473
|
}
|
|
181333
181474
|
const table = createTable(headers2);
|
|
@@ -181344,9 +181485,9 @@ async function listVariables(long = false, usage = false, file = null) {
|
|
|
181344
181485
|
new Date(variable.lastChangeDate).toUTCString()
|
|
181345
181486
|
] : [variable._id];
|
|
181346
181487
|
if (usage) {
|
|
181347
|
-
const
|
|
181488
|
+
const locations = getIdLocations(fullExport, variable._id, true);
|
|
181348
181489
|
values3.push(
|
|
181349
|
-
|
|
181490
|
+
locations.length > 0 ? `${"yes"["brightGreen"]} (${locations.length === 1 ? `at` : `${locations.length} uses, including:`} ${locations[0]})` : "no"["brightRed"]
|
|
181350
181491
|
);
|
|
181351
181492
|
}
|
|
181352
181493
|
table.push(values3);
|
|
@@ -181481,7 +181622,7 @@ async function deleteVariables() {
|
|
|
181481
181622
|
}
|
|
181482
181623
|
return false;
|
|
181483
181624
|
}
|
|
181484
|
-
async function describeVariable(variableId, json = false) {
|
|
181625
|
+
async function describeVariable(variableId, file, usage = false, json = false) {
|
|
181485
181626
|
const spinnerId = createProgressIndicator2(
|
|
181486
181627
|
"indeterminate",
|
|
181487
181628
|
0,
|
|
@@ -181489,6 +181630,21 @@ async function describeVariable(variableId, json = false) {
|
|
|
181489
181630
|
);
|
|
181490
181631
|
try {
|
|
181491
181632
|
const variable = await readVariable2(variableId);
|
|
181633
|
+
if (usage) {
|
|
181634
|
+
try {
|
|
181635
|
+
const fullExport = await getFullExportConfig(file);
|
|
181636
|
+
delete fullExport.global.variables;
|
|
181637
|
+
variable.locations = getIdLocations(fullExport, variableId, true);
|
|
181638
|
+
} catch (error2) {
|
|
181639
|
+
stopProgressIndicator2(
|
|
181640
|
+
spinnerId,
|
|
181641
|
+
`Error determining usage for variable with id ${variableId}`,
|
|
181642
|
+
"fail"
|
|
181643
|
+
);
|
|
181644
|
+
printError2(error2);
|
|
181645
|
+
return false;
|
|
181646
|
+
}
|
|
181647
|
+
}
|
|
181492
181648
|
stopProgressIndicator2(
|
|
181493
181649
|
spinnerId,
|
|
181494
181650
|
`Successfully retrieved variable ${variableId}`,
|
|
@@ -181528,6 +181684,15 @@ async function describeVariable(variableId, json = false) {
|
|
|
181528
181684
|
table.push(["Modifier"["brightCyan"], modifierName]);
|
|
181529
181685
|
}
|
|
181530
181686
|
table.push(["Modifier UUID"["brightCyan"], variable.lastChangedBy]);
|
|
181687
|
+
if (usage) {
|
|
181688
|
+
table.push([
|
|
181689
|
+
`Usage Locations (${variable.locations.length} total)`["brightCyan"],
|
|
181690
|
+
variable.locations.length > 0 ? variable.locations[0] : ""
|
|
181691
|
+
]);
|
|
181692
|
+
for (let i2 = 1; i2 < variable.locations.length; i2++) {
|
|
181693
|
+
table.push(["", variable.locations[i2]]);
|
|
181694
|
+
}
|
|
181695
|
+
}
|
|
181531
181696
|
printMessage2(table.toString(), "data");
|
|
181532
181697
|
}
|
|
181533
181698
|
return true;
|
|
@@ -181856,6 +182021,16 @@ function setup103() {
|
|
|
181856
182021
|
"-i, --variable-id <variable-id>",
|
|
181857
182022
|
"Variable id."
|
|
181858
182023
|
).makeOptionMandatory()
|
|
182024
|
+
).addOption(
|
|
182025
|
+
new Option(
|
|
182026
|
+
"-f, --file [file]",
|
|
182027
|
+
"Optional export file to use to determine usage. Overrides -D, --directory. Only used if -u or --usage is provided as well."
|
|
182028
|
+
)
|
|
182029
|
+
).addOption(
|
|
182030
|
+
new Option(
|
|
182031
|
+
"-u, --usage",
|
|
182032
|
+
"List all uses of the variable. If a file is provided with -f or --file, it will search for usage in the file. If a directory is provided with -D or --directory, it will search for usage in all .json files in the directory and sub-directories. If no file or directory is provided, it will perform a full export automatically to determine usage."
|
|
182033
|
+
).default(false, "false")
|
|
181859
182034
|
).addOption(new Option("--json", "Output in JSON format.")).action(
|
|
181860
182035
|
// implement command logic inside action handler
|
|
181861
182036
|
async (host2, user2, password3, options2, command2) => {
|
|
@@ -181866,14 +182041,21 @@ function setup103() {
|
|
|
181866
182041
|
options2,
|
|
181867
182042
|
command2
|
|
181868
182043
|
);
|
|
181869
|
-
if (await getTokens2(false, true, deploymentTypes37)) {
|
|
182044
|
+
if (options2.variableId && await getTokens2(false, true, deploymentTypes37)) {
|
|
181870
182045
|
verboseMessage2(`Describing variable ${options2.variableId}...`);
|
|
181871
182046
|
const outcome = await describeVariable(
|
|
181872
182047
|
options2.variableId,
|
|
182048
|
+
options2.file,
|
|
182049
|
+
options2.usage,
|
|
181873
182050
|
options2.json
|
|
181874
182051
|
);
|
|
181875
182052
|
if (!outcome) process.exitCode = 1;
|
|
181876
182053
|
} else {
|
|
182054
|
+
printMessage2(
|
|
182055
|
+
"Unrecognized combination of options or no options...",
|
|
182056
|
+
"error"
|
|
182057
|
+
);
|
|
182058
|
+
program3.help();
|
|
181877
182059
|
process.exitCode = 1;
|
|
181878
182060
|
}
|
|
181879
182061
|
}
|
|
@@ -187490,9 +187672,70 @@ function setup165() {
|
|
|
187490
187672
|
return program3;
|
|
187491
187673
|
}
|
|
187492
187674
|
|
|
187493
|
-
// src/cli/script/script-
|
|
187675
|
+
// src/cli/script/script-describe.ts
|
|
187494
187676
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
187495
187677
|
function setup166() {
|
|
187678
|
+
const program3 = new FrodoCommand("frodo script describe");
|
|
187679
|
+
program3.description("Describe script.").addOption(
|
|
187680
|
+
new Option(
|
|
187681
|
+
"-i, --script-id <uuid>",
|
|
187682
|
+
"Uuid of the script. If specified, -a and -A are ignored."
|
|
187683
|
+
)
|
|
187684
|
+
).addOption(
|
|
187685
|
+
new Option(
|
|
187686
|
+
"-n, --script-name <name>",
|
|
187687
|
+
"Name of the script. If specified, -a and -A are ignored."
|
|
187688
|
+
)
|
|
187689
|
+
).addOption(
|
|
187690
|
+
new Option(
|
|
187691
|
+
"-f, --file [file]",
|
|
187692
|
+
"Optional export file to use to determine usage. Overrides -D, --directory. Only used if -u or --usage is provided as well."
|
|
187693
|
+
)
|
|
187694
|
+
).addOption(
|
|
187695
|
+
new Option(
|
|
187696
|
+
"-u, --usage",
|
|
187697
|
+
"List all uses of the script. If a file is provided with -f or --file, it will search for usage in the file. If a directory is provided with -D or --directory, it will search for usage in all .json files in the directory and sub-directories. If no file or directory is provided, it will perform a full export automatically to determine usage."
|
|
187698
|
+
).default(false, "false")
|
|
187699
|
+
).addOption(new Option("--json", "Output in JSON format.")).action(
|
|
187700
|
+
// implement command logic inside action handler
|
|
187701
|
+
async (host2, realm2, user2, password3, options2, command2) => {
|
|
187702
|
+
command2.handleDefaultArgsAndOpts(
|
|
187703
|
+
host2,
|
|
187704
|
+
realm2,
|
|
187705
|
+
user2,
|
|
187706
|
+
password3,
|
|
187707
|
+
options2,
|
|
187708
|
+
command2
|
|
187709
|
+
);
|
|
187710
|
+
if ((options2.scriptName || options2.scriptId) && await getTokens2()) {
|
|
187711
|
+
verboseMessage2(
|
|
187712
|
+
`Describing script ${options2.scriptName ? options2.scriptName : options2.scriptId}...`
|
|
187713
|
+
);
|
|
187714
|
+
const outcome = await describeScript(
|
|
187715
|
+
options2.scriptId,
|
|
187716
|
+
options2.scriptName,
|
|
187717
|
+
options2.file,
|
|
187718
|
+
options2.usage,
|
|
187719
|
+
options2.json
|
|
187720
|
+
);
|
|
187721
|
+
if (!outcome) process.exitCode = 1;
|
|
187722
|
+
} else {
|
|
187723
|
+
printMessage2(
|
|
187724
|
+
"Unrecognized combination of options or no options...",
|
|
187725
|
+
"error"
|
|
187726
|
+
);
|
|
187727
|
+
program3.help();
|
|
187728
|
+
process.exitCode = 1;
|
|
187729
|
+
}
|
|
187730
|
+
}
|
|
187731
|
+
// end command logic inside action handler
|
|
187732
|
+
);
|
|
187733
|
+
return program3;
|
|
187734
|
+
}
|
|
187735
|
+
|
|
187736
|
+
// src/cli/script/script-export.ts
|
|
187737
|
+
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
187738
|
+
function setup167() {
|
|
187496
187739
|
const program3 = new FrodoCommand("frodo script export");
|
|
187497
187740
|
program3.description("Export scripts.").addOption(
|
|
187498
187741
|
new Option(
|
|
@@ -187618,7 +187861,7 @@ function setup166() {
|
|
|
187618
187861
|
|
|
187619
187862
|
// src/cli/script/script-import.ts
|
|
187620
187863
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
187621
|
-
function
|
|
187864
|
+
function setup168() {
|
|
187622
187865
|
const program3 = new FrodoCommand("frodo script import");
|
|
187623
187866
|
program3.description("Import scripts.").addOption(new Option("-f, --file <file>", "Name of the file to import.")).addOption(
|
|
187624
187867
|
new Option(
|
|
@@ -187719,7 +187962,7 @@ function setup167() {
|
|
|
187719
187962
|
|
|
187720
187963
|
// src/cli/script/script-list.ts
|
|
187721
187964
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
187722
|
-
function
|
|
187965
|
+
function setup169() {
|
|
187723
187966
|
const program3 = new FrodoCommand("frodo script list");
|
|
187724
187967
|
program3.description("List scripts.").addOption(
|
|
187725
187968
|
new Option("-l, --long", "Long with all fields besides usage.").default(
|
|
@@ -187765,11 +188008,12 @@ function setup168() {
|
|
|
187765
188008
|
}
|
|
187766
188009
|
|
|
187767
188010
|
// src/cli/script/script.ts
|
|
187768
|
-
function
|
|
188011
|
+
function setup170() {
|
|
187769
188012
|
const program3 = new FrodoStubCommand("script").description("Manage scripts.");
|
|
187770
|
-
program3.addCommand(
|
|
187771
|
-
program3.addCommand(setup166().name("
|
|
187772
|
-
program3.addCommand(setup167().name("
|
|
188013
|
+
program3.addCommand(setup169().name("list"));
|
|
188014
|
+
program3.addCommand(setup166().name("describe"));
|
|
188015
|
+
program3.addCommand(setup167().name("export"));
|
|
188016
|
+
program3.addCommand(setup168().name("import"));
|
|
187773
188017
|
program3.addCommand(setup165().name("delete"));
|
|
187774
188018
|
return program3;
|
|
187775
188019
|
}
|
|
@@ -188023,7 +188267,7 @@ async function deleteServices(globalConfig = false) {
|
|
|
188023
188267
|
}
|
|
188024
188268
|
|
|
188025
188269
|
// src/cli/service/service-delete.ts
|
|
188026
|
-
function
|
|
188270
|
+
function setup171() {
|
|
188027
188271
|
const program3 = new FrodoCommand("frodo service delete");
|
|
188028
188272
|
program3.description("Delete AM services.").addOption(new Option("-i, --id <id>", "Id of Service to be deleted.")).addOption(new Option("-a, --all", "Delete all services. Ignored with -i.")).addOption(new Option("-g, --global", "Delete global services.")).action(
|
|
188029
188273
|
async (host2, realm2, user2, password3, options2, command2) => {
|
|
@@ -188053,7 +188297,7 @@ function setup170() {
|
|
|
188053
188297
|
|
|
188054
188298
|
// src/cli/service/service-export.ts
|
|
188055
188299
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188056
|
-
function
|
|
188300
|
+
function setup172() {
|
|
188057
188301
|
const program3 = new FrodoCommand("frodo service export");
|
|
188058
188302
|
program3.description("Export AM services.").addOption(
|
|
188059
188303
|
new Option(
|
|
@@ -188121,7 +188365,7 @@ function setup171() {
|
|
|
188121
188365
|
|
|
188122
188366
|
// src/cli/service/service-import.ts
|
|
188123
188367
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188124
|
-
function
|
|
188368
|
+
function setup173() {
|
|
188125
188369
|
const program3 = new FrodoCommand("frodo service import");
|
|
188126
188370
|
program3.description("Import AM services.").addOption(
|
|
188127
188371
|
new Option(
|
|
@@ -188217,7 +188461,7 @@ function setup172() {
|
|
|
188217
188461
|
|
|
188218
188462
|
// src/cli/service/service-list.ts
|
|
188219
188463
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188220
|
-
function
|
|
188464
|
+
function setup174() {
|
|
188221
188465
|
const program3 = new FrodoCommand("frodo service list");
|
|
188222
188466
|
program3.description("List AM services.").addOption(
|
|
188223
188467
|
new Option("-l, --long", "Long with all fields.").default(false, "false")
|
|
@@ -188242,14 +188486,14 @@ function setup173() {
|
|
|
188242
188486
|
}
|
|
188243
188487
|
|
|
188244
188488
|
// src/cli/service/service.ts
|
|
188245
|
-
function
|
|
188489
|
+
function setup175() {
|
|
188246
188490
|
const program3 = new FrodoStubCommand("service").description(
|
|
188247
188491
|
"Manage AM services."
|
|
188248
188492
|
);
|
|
188249
|
-
program3.addCommand(
|
|
188250
|
-
program3.addCommand(
|
|
188251
|
-
program3.addCommand(
|
|
188252
|
-
program3.addCommand(
|
|
188493
|
+
program3.addCommand(setup174().name("list"));
|
|
188494
|
+
program3.addCommand(setup172().name("export"));
|
|
188495
|
+
program3.addCommand(setup173().name("import"));
|
|
188496
|
+
program3.addCommand(setup171().name("delete"));
|
|
188253
188497
|
return program3;
|
|
188254
188498
|
}
|
|
188255
188499
|
|
|
@@ -188271,7 +188515,7 @@ function searchFunctions(_answers, input = "") {
|
|
|
188271
188515
|
);
|
|
188272
188516
|
});
|
|
188273
188517
|
}
|
|
188274
|
-
function
|
|
188518
|
+
function setup176() {
|
|
188275
188519
|
const program = new FrodoCommand("shell");
|
|
188276
188520
|
program.description("Launch the frodo interactive shell.").addHelpText(
|
|
188277
188521
|
"after",
|
|
@@ -188328,7 +188572,7 @@ _chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
|
188328
188572
|
// src/cli/theme/theme-delete.ts
|
|
188329
188573
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188330
188574
|
var deploymentTypes57 = ["cloud", "forgeops"];
|
|
188331
|
-
function
|
|
188575
|
+
function setup177() {
|
|
188332
188576
|
const program3 = new FrodoCommand("frodo theme delete", [], deploymentTypes57);
|
|
188333
188577
|
program3.description("Delete themes.").addOption(
|
|
188334
188578
|
new Option(
|
|
@@ -188391,7 +188635,7 @@ function setup176() {
|
|
|
188391
188635
|
// src/cli/theme/theme-export.ts
|
|
188392
188636
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188393
188637
|
var deploymentTypes58 = ["cloud", "forgeops"];
|
|
188394
|
-
function
|
|
188638
|
+
function setup178() {
|
|
188395
188639
|
const program3 = new FrodoCommand("frodo theme export", [], deploymentTypes58);
|
|
188396
188640
|
program3.description("Export themes.").addOption(
|
|
188397
188641
|
new Option(
|
|
@@ -188482,7 +188726,7 @@ function setup177() {
|
|
|
188482
188726
|
// src/cli/theme/theme-import.ts
|
|
188483
188727
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188484
188728
|
var deploymentTypes59 = ["cloud", "forgeops"];
|
|
188485
|
-
function
|
|
188729
|
+
function setup179() {
|
|
188486
188730
|
const program3 = new FrodoCommand("frodo theme import", [], deploymentTypes59);
|
|
188487
188731
|
program3.description("Import themes.").addOption(
|
|
188488
188732
|
new Option(
|
|
@@ -188570,7 +188814,7 @@ function setup178() {
|
|
|
188570
188814
|
// src/cli/theme/theme-list.ts
|
|
188571
188815
|
_chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
|
|
188572
188816
|
var deploymentTypes60 = ["cloud", "forgeops"];
|
|
188573
|
-
function
|
|
188817
|
+
function setup180() {
|
|
188574
188818
|
const program3 = new FrodoCommand("frodo theme list", [], deploymentTypes60);
|
|
188575
188819
|
program3.description("List themes.").addOption(
|
|
188576
188820
|
new Option("-l, --long", "Long with more fields.").default(false, "false")
|
|
@@ -188599,12 +188843,12 @@ function setup179() {
|
|
|
188599
188843
|
}
|
|
188600
188844
|
|
|
188601
188845
|
// src/cli/theme/theme.ts
|
|
188602
|
-
function
|
|
188846
|
+
function setup181() {
|
|
188603
188847
|
const program3 = new FrodoStubCommand("theme").description("Manage themes.");
|
|
188604
|
-
program3.addCommand(
|
|
188605
|
-
program3.addCommand(
|
|
188606
|
-
program3.addCommand(
|
|
188607
|
-
program3.addCommand(
|
|
188848
|
+
program3.addCommand(setup180().name("list"));
|
|
188849
|
+
program3.addCommand(setup178().name("export"));
|
|
188850
|
+
program3.addCommand(setup179().name("import"));
|
|
188851
|
+
program3.addCommand(setup177().name("delete"));
|
|
188608
188852
|
return program3;
|
|
188609
188853
|
}
|
|
188610
188854
|
|
|
@@ -188682,7 +188926,7 @@ var compareVersions = (v12, v2) => {
|
|
|
188682
188926
|
// package.json
|
|
188683
188927
|
var package_default2 = {
|
|
188684
188928
|
name: "@rockcarver/frodo-cli",
|
|
188685
|
-
version: "2.0.6-
|
|
188929
|
+
version: "2.0.6-1",
|
|
188686
188930
|
type: "module",
|
|
188687
188931
|
description: "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
|
|
188688
188932
|
keywords: [
|
|
@@ -189016,10 +189260,10 @@ var { initTokenCache: initTokenCache2 } = frodo.cache;
|
|
|
189016
189260
|
program3.addCommand(setup147());
|
|
189017
189261
|
program3.addCommand(setup152());
|
|
189018
189262
|
program3.addCommand(setup164());
|
|
189019
|
-
program3.addCommand(
|
|
189020
|
-
program3.addCommand(setup174());
|
|
189263
|
+
program3.addCommand(setup170());
|
|
189021
189264
|
program3.addCommand(setup175());
|
|
189022
|
-
program3.addCommand(
|
|
189265
|
+
program3.addCommand(setup176());
|
|
189266
|
+
program3.addCommand(setup181());
|
|
189023
189267
|
program3.showHelpAfterError();
|
|
189024
189268
|
program3.enablePositionalOptions();
|
|
189025
189269
|
await program3.parseAsync();
|