@rockcarver/frodo-cli 0.23.1-4 → 0.23.1-5
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 +5 -1
- package/esm/app.js +2 -0
- package/esm/app.js.map +1 -1
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +13 -6
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
- package/esm/cli/authz/authz-policy-delete.js +43 -0
- package/esm/cli/authz/authz-policy-delete.js.map +1 -0
- package/esm/cli/authz/authz-policy-describe.js +30 -0
- package/esm/cli/authz/authz-policy-describe.js.map +1 -0
- package/esm/cli/authz/authz-policy-export.js +70 -0
- package/esm/cli/authz/authz-policy-export.js.map +1 -0
- package/esm/cli/authz/authz-policy-import.js +26 -0
- package/esm/cli/authz/authz-policy-import.js.map +1 -0
- package/esm/cli/authz/authz-policy-list.js +37 -0
- package/esm/cli/authz/authz-policy-list.js.map +1 -0
- package/esm/cli/authz/authz-policy.js +10 -0
- package/esm/cli/authz/authz-policy.js.map +1 -0
- package/esm/cli/authz/authz-set-delete.js +37 -0
- package/esm/cli/authz/authz-set-delete.js.map +1 -0
- package/esm/cli/authz/authz-set-describe.js +30 -0
- package/esm/cli/authz/authz-set-describe.js.map +1 -0
- package/esm/cli/authz/authz-set-export.js +52 -0
- package/esm/cli/authz/authz-set-export.js.map +1 -0
- package/esm/cli/authz/authz-set-import.js +57 -0
- package/esm/cli/authz/authz-set-import.js.map +1 -0
- package/esm/cli/authz/authz-set-list.js +25 -0
- package/esm/cli/authz/authz-set-list.js.map +1 -0
- package/esm/cli/authz/authz-set.js +10 -0
- package/esm/cli/authz/authz-set.js.map +1 -0
- package/esm/cli/authz/authz-type-delete.js +38 -0
- package/esm/cli/authz/authz-type-delete.js.map +1 -0
- package/esm/cli/authz/authz-type-describe.js +30 -0
- package/esm/cli/authz/authz-type-describe.js.map +1 -0
- package/esm/cli/authz/authz-type-export.js +22 -0
- package/esm/cli/authz/authz-type-export.js.map +1 -0
- package/esm/cli/authz/authz-type-import.js +22 -0
- package/esm/cli/authz/authz-type-import.js.map +1 -0
- package/esm/cli/authz/authz-type-list.js +32 -0
- package/esm/cli/authz/authz-type-list.js.map +1 -0
- package/esm/cli/authz/authz-type.js +10 -0
- package/esm/cli/authz/authz-type.js.map +1 -0
- package/esm/cli/authz/authz.js +12 -0
- package/esm/cli/authz/authz.js.map +1 -0
- package/esm/cli/idm/idm-import.js +8 -3
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/ops/IdmOps.js +25 -2
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +392 -0
- package/esm/ops/PolicyOps.js.map +1 -0
- package/esm/ops/PolicySetOps.js +373 -0
- package/esm/ops/PolicySetOps.js.map +1 -0
- package/esm/ops/ResourceTypeOps.js +323 -0
- package/esm/ops/ResourceTypeOps.js.map +1 -0
- package/esm/utils/Console.js +2 -0
- package/esm/utils/Console.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate } from '@rockcarver/frodo-lib';
|
|
4
|
+
import { importFirstPolicySetFromFile, importPolicySetFromFile, importPolicySetsFromFile, importPolicySetsFromFiles } from '../../ops/PolicySetOps';
|
|
5
|
+
import { verboseMessage } from '../../utils/Console';
|
|
6
|
+
const {
|
|
7
|
+
getTokens
|
|
8
|
+
} = Authenticate;
|
|
9
|
+
const program = new FrodoCommand('frodo authz set import');
|
|
10
|
+
program.description('Import authorization policy sets.').addOption(new Option('-i, --set-id <set-id>', 'Policy set id/name. If specified, only one policy set is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-a, --all', 'Import all policy sets from single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all policy sets from separate files (*.policyset.authz.json) in the current directory. Ignored with -i or -a.')).addOption(new Option('--no-deps', 'Do not include any dependencies (policies, scripts, resource types).')).action(
|
|
11
|
+
// implement command logic inside action handler
|
|
12
|
+
async (host, realm, user, password, options, command) => {
|
|
13
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
|
+
// export
|
|
15
|
+
if (options.setId && (await getTokens())) {
|
|
16
|
+
verboseMessage('Importing authorization policy set from file...');
|
|
17
|
+
const outcome = importPolicySetFromFile(options.setId, options.file, {
|
|
18
|
+
deps: options.deps
|
|
19
|
+
});
|
|
20
|
+
if (!outcome) process.exitCode = 1;
|
|
21
|
+
}
|
|
22
|
+
// -a/--all
|
|
23
|
+
else if (options.all && (await getTokens())) {
|
|
24
|
+
verboseMessage('Importing all authorization policy sets from file...');
|
|
25
|
+
const outcome = await importPolicySetsFromFile(options.file, {
|
|
26
|
+
deps: options.deps
|
|
27
|
+
});
|
|
28
|
+
if (!outcome) process.exitCode = 1;
|
|
29
|
+
}
|
|
30
|
+
// -A/--all-separate
|
|
31
|
+
else if (options.allSeparate && (await getTokens())) {
|
|
32
|
+
verboseMessage('Importing all authorization policy sets from separate files...');
|
|
33
|
+
const outcome = await importPolicySetsFromFiles({
|
|
34
|
+
deps: options.deps
|
|
35
|
+
});
|
|
36
|
+
if (!outcome) process.exitCode = 1;
|
|
37
|
+
}
|
|
38
|
+
// import first policy set from file
|
|
39
|
+
else if (options.file && (await getTokens())) {
|
|
40
|
+
verboseMessage(`Importing first authorization policy set from file "${options.file}"...`);
|
|
41
|
+
const outcome = await importFirstPolicySetFromFile(options.file, {
|
|
42
|
+
deps: options.deps
|
|
43
|
+
});
|
|
44
|
+
if (!outcome) process.exitCode = 1;
|
|
45
|
+
}
|
|
46
|
+
// unrecognized combination of options or no options
|
|
47
|
+
else {
|
|
48
|
+
verboseMessage('Unrecognized combination of options or no options...');
|
|
49
|
+
program.help();
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// end command logic inside action handler
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
program.parse();
|
|
57
|
+
//# sourceMappingURL=authz-set-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-set-import.js","names":["FrodoCommand","Option","Authenticate","importFirstPolicySetFromFile","importPolicySetFromFile","importPolicySetsFromFile","importPolicySetsFromFiles","verboseMessage","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","setId","outcome","file","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["cli/authz/authz-set-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport {\n importFirstPolicySetFromFile,\n importPolicySetFromFile,\n importPolicySetsFromFile,\n importPolicySetsFromFiles,\n} from '../../ops/PolicySetOps';\nimport { verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo authz set import');\n\nprogram\n .description('Import authorization policy sets.')\n .addOption(\n new Option(\n '-i, --set-id <set-id>',\n 'Policy set id/name. If specified, only one policy set is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all policy sets from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all policy sets from separate files (*.policyset.authz.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '--no-deps',\n 'Do not include any dependencies (policies, scripts, resource types).'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.setId && (await getTokens())) {\n verboseMessage('Importing authorization policy set from file...');\n const outcome = importPolicySetFromFile(options.setId, options.file, {\n deps: options.deps,\n });\n if (!outcome) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Importing all authorization policy sets from file...');\n const outcome = await importPolicySetsFromFile(options.file, {\n deps: options.deps,\n });\n if (!outcome) process.exitCode = 1;\n }\n // -A/--all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage(\n 'Importing all authorization policy sets from separate files...'\n );\n const outcome = await importPolicySetsFromFiles({\n deps: options.deps,\n });\n if (!outcome) process.exitCode = 1;\n }\n // import first policy set from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first authorization policy set from file \"${options.file}\"...`\n );\n const outcome = await importFirstPolicySetFromFile(options.file, {\n deps: options.deps,\n });\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SACEC,4BAA4B,EAC5BC,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,QACpB,wBAAwB;AAC/B,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,MAAM;EAAEC;AAAU,CAAC,GAAGN,YAAY;AAElC,MAAMO,OAAO,GAAG,IAAIT,YAAY,CAAC,wBAAwB,CAAC;AAE1DS,OAAO,CACJC,WAAW,CAAC,mCAAmC,CAAC,CAChDC,SAAS,CACR,IAAIV,MAAM,CACR,uBAAuB,EACvB,0GAA0G,CAC3G,CACF,CACAU,SAAS,CAAC,IAAIV,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,2DAA2D,CAC5D,CACF,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,oBAAoB,EACpB,sHAAsH,CACvH,CACF,CACAU,SAAS,CACR,IA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C,EAAE;IAC5CD,cAAc,CACX,uDAAsDU,OAAO,CAACK,IAAK,MAAK,CAC1E;IACD,MAAMD,OAAO,GAAG,MAAMlB,4BAA4B,CAACc,OAAO,CAACK,IAAI,EAAE;MAC/DC,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;IACF,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHlB,cAAc,CAAC,sDAAsD,CAAC;IACtEE,OAAO,CAACmB,IAAI,EAAE;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHhB,OAAO,CAACoB,KAAK,EAAE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Authenticate } from '@rockcarver/frodo-lib';
|
|
3
|
+
import { verboseMessage } from '../../utils/Console.js';
|
|
4
|
+
import { listPolicySets } from '../../ops/PolicySetOps';
|
|
5
|
+
const {
|
|
6
|
+
getTokens
|
|
7
|
+
} = Authenticate;
|
|
8
|
+
const program = new FrodoCommand('frodo authz set list');
|
|
9
|
+
program.description('List authorization policy sets.').action(
|
|
10
|
+
// implement command logic inside action handler
|
|
11
|
+
async (host, realm, user, password, options, command) => {
|
|
12
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
13
|
+
if (await getTokens()) {
|
|
14
|
+
verboseMessage('Listing authorization policy sets...');
|
|
15
|
+
const outcome = listPolicySets();
|
|
16
|
+
if (!outcome) process.exitCode = 1;
|
|
17
|
+
} else {
|
|
18
|
+
process.exitCode = 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// end command logic inside action handler
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
program.parse();
|
|
25
|
+
//# sourceMappingURL=authz-set-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-set-list.js","names":["FrodoCommand","Authenticate","verboseMessage","listPolicySets","getTokens","program","description","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outcome","process","exitCode","parse"],"sources":["cli/authz/authz-set-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { listPolicySets } from '../../ops/PolicySetOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo authz set list');\n\nprogram.description('List authorization policy sets.').action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n verboseMessage('Listing authorization policy sets...');\n const outcome = listPolicySets();\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n);\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAM;EAAEC;AAAU,CAAC,GAAGH,YAAY;AAElC,MAAMI,OAAO,GAAG,IAAIL,YAAY,CAAC,sBAAsB,CAAC;AAExDK,OAAO,CAACC,WAAW,CAAC,iCAAiC,CAAC,CAACC,MAAM;AAC3D;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD,IAAI,MAAMT,SAAS,EAAE,EAAE;IACrBF,cAAc,CAAC,sCAAsC,CAAC;IACtD,MAAMa,OAAO,GAAGZ,cAAc,EAAE;IAChC,IAAI,CAACY,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEDZ,OAAO,CAACa,KAAK,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FrodoStubCommand } from '../FrodoCommand';
|
|
2
|
+
const program = new FrodoStubCommand('frodo authz set').alias('policyset');
|
|
3
|
+
program.description('Manage authorization policy sets.');
|
|
4
|
+
program.command('delete', 'Delete authorization policy sets.');
|
|
5
|
+
program.command('describe', 'Describe authorization policy sets.');
|
|
6
|
+
program.command('export', 'Export authorization policy sets.');
|
|
7
|
+
program.command('import', 'Import authorization policy sets.');
|
|
8
|
+
program.command('list', 'List authorization policy sets.');
|
|
9
|
+
program.parse();
|
|
10
|
+
//# sourceMappingURL=authz-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-set.js","names":["FrodoStubCommand","program","alias","description","command","parse"],"sources":["cli/authz/authz-set.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\n\nconst program = new FrodoStubCommand('frodo authz set').alias('policyset');\n\nprogram.description('Manage authorization policy sets.');\n\nprogram.command('delete', 'Delete authorization policy sets.');\n\nprogram.command('describe', 'Describe authorization policy sets.');\n\nprogram.command('export', 'Export authorization policy sets.');\n\nprogram.command('import', 'Import authorization policy sets.');\n\nprogram.command('list', 'List authorization policy sets.');\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,OAAO,GAAG,IAAID,gBAAgB,CAAC,iBAAiB,CAAC,CAACE,KAAK,CAAC,WAAW,CAAC;AAE1ED,OAAO,CAACE,WAAW,CAAC,mCAAmC,CAAC;AAExDF,OAAO,CAACG,OAAO,CAAC,QAAQ,EAAE,mCAAmC,CAAC;AAE9DH,OAAO,CAACG,OAAO,CAAC,UAAU,EAAE,qCAAqC,CAAC;AAElEH,OAAO,CAACG,OAAO,CAAC,QAAQ,EAAE,mCAAmC,CAAC;AAE9DH,OAAO,CAACG,OAAO,CAAC,QAAQ,EAAE,mCAAmC,CAAC;AAE9DH,OAAO,CAACG,OAAO,CAAC,MAAM,EAAE,iCAAiC,CAAC;AAE1DH,OAAO,CAACI,KAAK,EAAE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate, Variables } from '@rockcarver/frodo-lib';
|
|
4
|
+
import { printMessage, verboseMessage } from '../../utils/Console.js';
|
|
5
|
+
const {
|
|
6
|
+
getTokens
|
|
7
|
+
} = Authenticate;
|
|
8
|
+
const {
|
|
9
|
+
deleteVariableCmd,
|
|
10
|
+
deleteVariablesCmd
|
|
11
|
+
} = Variables;
|
|
12
|
+
const program = new FrodoCommand('frodo cmd sub2 delete');
|
|
13
|
+
program.description('Delete variables.').addOption(new Option('-i, --variable-id <variable-id>', 'Variable id. If specified, -a is ignored.')).addOption(new Option('-a, --all', 'Delete all variable in a realm. Ignored with -i.')).addOption(new Option('--no-deep', 'No deep delete. This leaves orphaned configuration artifacts behind.')).action(
|
|
14
|
+
// implement command logic inside action handler
|
|
15
|
+
async (host, realm, user, password, options, command) => {
|
|
16
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
17
|
+
// delete by id
|
|
18
|
+
if (options.variableId && (await getTokens())) {
|
|
19
|
+
verboseMessage('Deleting variable...');
|
|
20
|
+
deleteVariableCmd(options.variableId);
|
|
21
|
+
}
|
|
22
|
+
// --all -a
|
|
23
|
+
else if (options.all && (await getTokens())) {
|
|
24
|
+
verboseMessage('Deleting all variables...');
|
|
25
|
+
deleteVariablesCmd();
|
|
26
|
+
}
|
|
27
|
+
// unrecognized combination of options or no options
|
|
28
|
+
else {
|
|
29
|
+
printMessage('Unrecognized combination of options or no options...');
|
|
30
|
+
program.help();
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// end command logic inside action handler
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
program.parse();
|
|
38
|
+
//# sourceMappingURL=authz-type-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-type-delete.js","names":["FrodoCommand","Option","Authenticate","Variables","printMessage","verboseMessage","getTokens","deleteVariableCmd","deleteVariablesCmd","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","all","help","process","exitCode","parse"],"sources":["cli/authz/authz-type-delete.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Variables } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\n\nconst { getTokens } = Authenticate;\nconst { deleteVariableCmd, deleteVariablesCmd } = Variables;\n\nconst program = new FrodoCommand('frodo cmd sub2 delete');\n\nprogram\n .description('Delete variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. If specified, -a is ignored.'\n )\n )\n .addOption(\n new Option('-a, --all', 'Delete all variable in a realm. Ignored with -i.')\n )\n .addOption(\n new Option(\n '--no-deep',\n 'No deep delete. This leaves orphaned configuration artifacts behind.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // delete by id\n if (options.variableId && (await getTokens())) {\n verboseMessage('Deleting variable...');\n deleteVariableCmd(options.variableId);\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Deleting all variables...');\n deleteVariablesCmd();\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAA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,0 +1,30 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate } from '@rockcarver/frodo-lib';
|
|
4
|
+
import { verboseMessage } from '../../utils/Console.js';
|
|
5
|
+
import { describeResourceType } from '../../ops/ResourceTypeOps';
|
|
6
|
+
const {
|
|
7
|
+
getTokens
|
|
8
|
+
} = Authenticate;
|
|
9
|
+
const program = new FrodoCommand('frodo authz type describe');
|
|
10
|
+
program.description('Describe authorization resource types.').addOption(new Option('-i, --type-id <type-id>', 'Resource type id.').makeOptionMandatory()).addOption(new Option('--json', 'Output in JSON format.')).action(
|
|
11
|
+
// implement command logic inside action handler
|
|
12
|
+
async (host, realm, user, password, options, command) => {
|
|
13
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
14
|
+
if (options.typeId && (await getTokens())) {
|
|
15
|
+
verboseMessage(`Describing authorization resource type ${options.typeId}...`);
|
|
16
|
+
const outcome = await describeResourceType(options.typeId, options.json);
|
|
17
|
+
if (!outcome) process.exitCode = 1;
|
|
18
|
+
}
|
|
19
|
+
// unrecognized combination of options or no options
|
|
20
|
+
else {
|
|
21
|
+
verboseMessage('Unrecognized combination of options or no options...');
|
|
22
|
+
program.help();
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// end command logic inside action handler
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
program.parse();
|
|
30
|
+
//# sourceMappingURL=authz-type-describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-type-describe.js","names":["FrodoCommand","Option","Authenticate","verboseMessage","describeResourceType","getTokens","program","description","addOption","makeOptionMandatory","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","typeId","outcome","json","process","exitCode","help","parse"],"sources":["cli/authz/authz-type-describe.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { describeResourceType } from '../../ops/ResourceTypeOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo authz type describe');\n\nprogram\n .description('Describe authorization resource types.')\n .addOption(\n new Option(\n '-i, --type-id <type-id>',\n 'Resource type id.'\n ).makeOptionMandatory()\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (options.typeId && (await getTokens())) {\n verboseMessage(\n `Describing authorization resource type ${options.typeId}...`\n );\n const outcome = await describeResourceType(\n options.typeId,\n options.json\n );\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,MAAM;EAAEC;AAAU,CAAC,GAAGH,YAAY;AAElC,MAAMI,OAAO,GAAG,IAAIN,YAAY,CAAC,2BAA2B,CAAC;AAE7DM,OAAO,CACJC,WAAW,CAAC,wCAAwC,CAAC,CACrDC,SAAS,CACR,IAAIP,MAAM,CACR,yBAAyB,EACzB,mBAAmB,CACpB,CAACQ,mBAAmB,EAAE,CACxB,CACAD,SAAS,CAAC,IAAIP,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CACzDS,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD,IAAID,OAAO,CAACG,MAAM,KAAK,MAAMb,SAAS,EAAE,CAAC,EAAE;IACzCF,cAAc,CACX,0CAAyCY,OAAO,CAACG,MAAO,KAAI,CAC9D;IACD,MAAMC,OAAO,GAAG,MAAMf,oBAAoB,CACxCW,OAAO,CAACG,MAAM,EACdH,OAAO,CAACK,IAAI,CACb;IACD,IAAI,CAACD,OAAO,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHnB,cAAc,CAAC,sDAAsD,CAAC;IACtEG,OAAO,CAACiB,IAAI,EAAE;IACdF,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHhB,OAAO,CAACkB,KAAK,EAAE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate } from '@rockcarver/frodo-lib';
|
|
4
|
+
const {
|
|
5
|
+
getTokens
|
|
6
|
+
} = Authenticate;
|
|
7
|
+
const program = new FrodoCommand('frodo esv variable export');
|
|
8
|
+
program.description('Export variables.').addOption(new Option('-i, --variable-id <variable-id>', 'Variable id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all variables to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all variables to separate files (*.variable.json) in the current directory. Ignored with -i or -a.')).action(
|
|
9
|
+
// implement command logic inside action handler
|
|
10
|
+
async (host, realm, user, password, options, command) => {
|
|
11
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
12
|
+
if (await getTokens()) {
|
|
13
|
+
// code goes here
|
|
14
|
+
} else {
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// end command logic inside action handler
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
program.parse();
|
|
22
|
+
//# sourceMappingURL=authz-type-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-type-export.js","names":["FrodoCommand","Option","Authenticate","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["cli/authz/authz-type-export.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo esv variable export');\n\nprogram\n .description('Export variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all variables to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all variables to separate files (*.variable.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AAEpD,MAAM;EAAEC;AAAU,CAAC,GAAGD,YAAY;AAElC,MAAME,OAAO,GAAG,IAAIJ,YAAY,CAAC,2BAA2B,CAAC;AAE7DI,OAAO,CACJC,WAAW,CAAC,mBAAmB,CAAC,CAChCC,SAAS,CACR,IAAIL,MAAM,CACR,iCAAiC,EACjC,mDAAmD,CACpD,CACF,CACAK,SAAS,CAAC,IAAIL,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEK,SAAS,CACR,IAAIL,MAAM,CACR,WAAW,EACX,yDAAyD,CAC1D,CACF,CACAK,SAAS,CACR,IAAIL,MAAM,CACR,oBAAoB,EACpB,2GAA2G,CAC5G,CACF,CACAM,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD,IAAI,MAAMV,SAAS,EAAE,EAAE;IACrB;EAAA,CACD,MAAM;IACLY,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHZ,OAAO,CAACa,KAAK,EAAE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate } from '@rockcarver/frodo-lib';
|
|
4
|
+
const {
|
|
5
|
+
getTokens
|
|
6
|
+
} = Authenticate;
|
|
7
|
+
const program = new FrodoCommand('frodo esv variable import');
|
|
8
|
+
program.description('Import variables.').addOption(new Option('-i, --variable-id <variable-id>', 'Variable id. If specified, only one variable is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-a, --all', 'Import all variables from single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all variables from separate files (*.variable.json) in the current directory. Ignored with -i or -a.')).action(
|
|
9
|
+
// implement command logic inside action handler
|
|
10
|
+
async (host, realm, user, password, options, command) => {
|
|
11
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
12
|
+
if (await getTokens()) {
|
|
13
|
+
// code goes here
|
|
14
|
+
} else {
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// end command logic inside action handler
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
program.parse();
|
|
22
|
+
//# sourceMappingURL=authz-type-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-type-import.js","names":["FrodoCommand","Option","Authenticate","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["cli/authz/authz-type-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo esv variable import');\n\nprogram\n .description('Import variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. If specified, only one variable is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all variables from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all variables from separate files (*.variable.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AAEpD,MAAM;EAAEC;AAAU,CAAC,GAAGD,YAAY;AAElC,MAAME,OAAO,GAAG,IAAIJ,YAAY,CAAC,2BAA2B,CAAC;AAE7DI,OAAO,CACJC,WAAW,CAAC,mBAAmB,CAAC,CAChCC,SAAS,CACR,IAAIL,MAAM,CACR,iCAAiC,EACjC,iGAAiG,CAClG,CACF,CACAK,SAAS,CAAC,IAAIL,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEK,SAAS,CACR,IAAIL,MAAM,CACR,WAAW,EACX,yDAAyD,CAC1D,CACF,CACAK,SAAS,CACR,IAAIL,MAAM,CACR,oBAAoB,EACpB,6GAA6G,CAC9G,CACF,CACAM,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD,IAAI,MAAMV,SAAS,EAAE,EAAE;IACrB;EAAA,CACD,MAAM;IACLY,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHZ,OAAO,CAACa,KAAK,EAAE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Authenticate, Variables } from '@rockcarver/frodo-lib';
|
|
3
|
+
import { verboseMessage } from '../../utils/Console.js';
|
|
4
|
+
import { listResourceTypes } from '../../ops/ResourceTypeOps';
|
|
5
|
+
const {
|
|
6
|
+
getTokens
|
|
7
|
+
} = Authenticate;
|
|
8
|
+
const {
|
|
9
|
+
listVariables
|
|
10
|
+
} = Variables;
|
|
11
|
+
const program = new FrodoCommand('frodo authz type list');
|
|
12
|
+
program.description('List authorization resource types.')
|
|
13
|
+
// .addOption(
|
|
14
|
+
// new Option('-l, --long', 'Long with all fields.').default(false, 'false')
|
|
15
|
+
// )
|
|
16
|
+
.action(
|
|
17
|
+
// implement command logic inside action handler
|
|
18
|
+
async (host, realm, user, password, options, command) => {
|
|
19
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
20
|
+
if (await getTokens()) {
|
|
21
|
+
verboseMessage('Listing resource types...');
|
|
22
|
+
const outcome = listResourceTypes();
|
|
23
|
+
if (!outcome) process.exitCode = 1;
|
|
24
|
+
} else {
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// end command logic inside action handler
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
program.parse();
|
|
32
|
+
//# sourceMappingURL=authz-type-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-type-list.js","names":["FrodoCommand","Authenticate","Variables","verboseMessage","listResourceTypes","getTokens","listVariables","program","description","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outcome","process","exitCode","parse"],"sources":["cli/authz/authz-type-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Variables } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { listResourceTypes } from '../../ops/ResourceTypeOps';\n\nconst { getTokens } = Authenticate;\nconst { listVariables } = Variables;\n\nconst program = new FrodoCommand('frodo authz type list');\n\nprogram\n .description('List authorization resource types.')\n // .addOption(\n // new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n // )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n verboseMessage('Listing resource types...');\n const outcome = listResourceTypes();\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAE9C,SAASC,YAAY,EAAEC,SAAS,QAAQ,uBAAuB;AAC/D,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAClC,MAAM;EAAEK;AAAc,CAAC,GAAGJ,SAAS;AAEnC,MAAMK,OAAO,GAAG,IAAIP,YAAY,CAAC,uBAAuB,CAAC;AAEzDO,OAAO,CACJC,WAAW,CAAC,oCAAoC;AACjD;AACA;AACA;AAAA,CACCC,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD,IAAI,MAAMV,SAAS,EAAE,EAAE;IACrBF,cAAc,CAAC,2BAA2B,CAAC;IAC3C,MAAMc,OAAO,GAAGb,iBAAiB,EAAE;IACnC,IAAI,CAACa,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHZ,OAAO,CAACa,KAAK,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FrodoStubCommand } from '../FrodoCommand';
|
|
2
|
+
const program = new FrodoStubCommand('frodo authz type');
|
|
3
|
+
program.description('Manage authorization resource types.');
|
|
4
|
+
program.command('delete', 'Delete authorization resource types.');
|
|
5
|
+
program.command('describe', 'Describe authorization resource types.');
|
|
6
|
+
program.command('export', 'Export authorization resource types.');
|
|
7
|
+
program.command('import', 'Import authorization resource types.');
|
|
8
|
+
program.command('list', 'List authorization resource types.');
|
|
9
|
+
program.parse();
|
|
10
|
+
//# sourceMappingURL=authz-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-type.js","names":["FrodoStubCommand","program","description","command","parse"],"sources":["cli/authz/authz-type.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\n\nconst program = new FrodoStubCommand('frodo authz type');\n\nprogram.description('Manage authorization resource types.');\n\nprogram.command('delete', 'Delete authorization resource types.');\n\nprogram.command('describe', 'Describe authorization resource types.');\n\nprogram.command('export', 'Export authorization resource types.');\n\nprogram.command('import', 'Import authorization resource types.');\n\nprogram.command('list', 'List authorization resource types.');\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,OAAO,GAAG,IAAID,gBAAgB,CAAC,kBAAkB,CAAC;AAExDC,OAAO,CAACC,WAAW,CAAC,sCAAsC,CAAC;AAE3DD,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,sCAAsC,CAAC;AAEjEF,OAAO,CAACE,OAAO,CAAC,UAAU,EAAE,wCAAwC,CAAC;AAErEF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,sCAAsC,CAAC;AAEjEF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,sCAAsC,CAAC;AAEjEF,OAAO,CAACE,OAAO,CAAC,MAAM,EAAE,oCAAoC,CAAC;AAE7DF,OAAO,CAACG,KAAK,EAAE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FrodoStubCommand } from '../FrodoCommand';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
export default function setup() {
|
|
6
|
+
const program = new FrodoStubCommand('authz').description('Manage authotiztion policies, policy sets, and resource types.').executableDir(__dirname);
|
|
7
|
+
program.command('set', 'Manage policy sets.');
|
|
8
|
+
program.command('policy', 'Manages policies.');
|
|
9
|
+
program.command('type', 'Manage resource types.');
|
|
10
|
+
return program;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=authz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz.js","names":["FrodoStubCommand","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["cli/authz/authz.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('authz')\n .description(\n 'Manage authotiztion policies, policy sets, and resource types.'\n )\n .executableDir(__dirname);\n\n program.command('set', 'Manage policy sets.');\n\n program.command('policy', 'Manages policies.');\n\n program.command('type', 'Manage resource types.');\n\n return program;\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAClD,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAK,GAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIT,gBAAgB,CAAC,OAAO,CAAC,CAC1CU,WAAW,CACV,gEAAgE,CACjE,CACAC,aAAa,CAACR,SAAS,CAAC;EAE3BM,OAAO,CAACG,OAAO,CAAC,KAAK,EAAE,qBAAqB,CAAC;EAE7CH,OAAO,CAACG,OAAO,CAAC,QAAQ,EAAE,mBAAmB,CAAC;EAE9CH,OAAO,CAACG,OAAO,CAAC,MAAM,EAAE,wBAAwB,CAAC;EAEjD,OAAOH,OAAO;AAChB"}
|
|
@@ -2,7 +2,7 @@ import { FrodoCommand } from '../FrodoCommand';
|
|
|
2
2
|
import { Option } from 'commander';
|
|
3
3
|
import { Authenticate } from '@rockcarver/frodo-lib';
|
|
4
4
|
import { printMessage, verboseMessage } from '../../utils/Console';
|
|
5
|
-
import { importAllConfigEntities, importAllRawConfigEntities,
|
|
5
|
+
import { importAllConfigEntities, importAllRawConfigEntities, importConfigEntityByIdFromFile, importConfigEntityFromFile } from '../../ops/IdmOps';
|
|
6
6
|
const {
|
|
7
7
|
getTokens
|
|
8
8
|
} = Authenticate;
|
|
@@ -14,7 +14,12 @@ async (host, realm, user, password, options, command) => {
|
|
|
14
14
|
// import by id/name
|
|
15
15
|
if (options.name && (await getTokens())) {
|
|
16
16
|
verboseMessage(`Importing object "${options.name}"...`);
|
|
17
|
-
await
|
|
17
|
+
await importConfigEntityByIdFromFile(options.name, options.file);
|
|
18
|
+
}
|
|
19
|
+
// import from file
|
|
20
|
+
if (options.file && (await getTokens())) {
|
|
21
|
+
verboseMessage(`Importing object from file...`);
|
|
22
|
+
await importConfigEntityFromFile(options.file);
|
|
18
23
|
}
|
|
19
24
|
// --all-separate -A
|
|
20
25
|
else if (options.allSeparate && options.directory && options.entitiesFile && options.envFile && (await getTokens())) {
|
|
@@ -23,7 +28,7 @@ async (host, realm, user, password, options, command) => {
|
|
|
23
28
|
}
|
|
24
29
|
// --all-separate -A without variable replacement
|
|
25
30
|
else if (options.allSeparate && options.directory && (await getTokens())) {
|
|
26
|
-
verboseMessage(`Importing all IDM configuration objects
|
|
31
|
+
verboseMessage(`Importing all IDM configuration objects from separate files in ${options.directory}...`);
|
|
27
32
|
await importAllRawConfigEntities(options.directory);
|
|
28
33
|
}
|
|
29
34
|
// unrecognized combination of options or no options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idm-import.js","names":["FrodoCommand","Option","Authenticate","printMessage","verboseMessage","importAllConfigEntities","importAllRawConfigEntities","
|
|
1
|
+
{"version":3,"file":"idm-import.js","names":["FrodoCommand","Option","Authenticate","printMessage","verboseMessage","importAllConfigEntities","importAllRawConfigEntities","importConfigEntityByIdFromFile","importConfigEntityFromFile","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","name","file","allSeparate","directory","entitiesFile","envFile","help","process","exitCode","parse"],"sources":["cli/idm/idm-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport {\n importAllConfigEntities,\n importAllRawConfigEntities,\n importConfigEntityByIdFromFile,\n importConfigEntityFromFile,\n} from '../../ops/IdmOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo idm import');\n\ninterface IdmImportOptions {\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n name?: string;\n file?: string;\n entitiesFile?: string;\n envFile?: string;\n all?: string;\n allSeparate?: string;\n directory?: string;\n}\n\nprogram\n .description('Import IDM configuration objects.')\n .addOption(\n new Option(\n '-N, --name <name>',\n 'Config entity name. E.g. \"managed\", \"sync\", \"provisioner-<connector-name>\", etc.'\n )\n )\n .addOption(new Option('-f, --file [file]', 'Import file. Ignored with -A.'))\n .addOption(\n new Option(\n '-E, --entities-file [entities-file]',\n 'Name of the entity file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-e, --env-file [envfile]',\n 'Name of the env file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all IDM configuration objects from separate files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Import directory. Required with and ignored without -a/-A.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: IdmImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id/name\n if (options.name && (await getTokens())) {\n verboseMessage(`Importing object \"${options.name}\"...`);\n await importConfigEntityByIdFromFile(options.name, options.file);\n }\n // import from file\n if (options.file && (await getTokens())) {\n verboseMessage(`Importing object from file...`);\n await importConfigEntityFromFile(options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile &&\n (await getTokens())\n ) {\n verboseMessage(\n `Importing IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n await importAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (\n options.allSeparate &&\n options.directory &&\n (await getTokens())\n ) {\n verboseMessage(\n `Importing all IDM configuration objects from separate files in ${options.directory}...`\n );\n await importAllRawConfigEntities(options.directory);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,0BAA0B,QACrB,kBAAkB;AAEzB,MAAM;EAAEC;AAAU,CAAC,GAAGP,YAAY;AAElC,MAAMQ,OAAO,GAAG,IAAIV,YAAY,CAAC,kBAAkB,CAAC;AAiBpDU,OAAO,CACJC,WAAW,CAAC,mCAAmC,CAAC,CAChDC,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,kFAAkF,CACnF,CACF,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,+BAA+B,CAAC,CAAC,CAC3EW,SAAS,CACR,IAAIX,MAAM,CACR,qCAAqC,EACrC,2CAA2C,CAC5C,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,0BAA0B,EAC1B,wCAAwC,CACzC,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,oGAAoG,CACrG,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,6BAA6B,EAC7B,4DAA4D,CAC7D,CACF,CACAY,MAAM;AACL;AACA,OACEC,IAAY,EACZC,KAAa,EACbC,IAAY,EACZC,QAAgB,EAChBC,OAAyB,EACzBC,OAAO,KACJ;EACHA,OAAO,C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nB,OAAO,CAACoB,KAAK,EAAE"}
|
package/esm/ops/IdmOps.js
CHANGED
|
@@ -175,11 +175,12 @@ export async function exportAllConfigEntities(directory, entitiesFile, envFile)
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
|
-
* Import an IDM configuration object.
|
|
178
|
+
* Import an IDM configuration object by id from file.
|
|
179
179
|
* @param entityId the configuration object to import
|
|
180
180
|
* @param file optional file to import
|
|
181
|
+
* @param validate validate script hooks
|
|
181
182
|
*/
|
|
182
|
-
export async function
|
|
183
|
+
export async function importConfigEntityByIdFromFile(entityId, file, validate) {
|
|
183
184
|
if (!file) {
|
|
184
185
|
file = getTypedFilename(entityId, 'idm');
|
|
185
186
|
}
|
|
@@ -198,6 +199,28 @@ export async function importConfigEntity(entityId, file, validate) {
|
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Import IDM configuration object from file.
|
|
204
|
+
* @param file optional file to import
|
|
205
|
+
* @param validate validate script hooks
|
|
206
|
+
*/
|
|
207
|
+
export async function importConfigEntityFromFile(file, validate) {
|
|
208
|
+
const importData = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');
|
|
209
|
+
const jsObject = JSON.parse(importData);
|
|
210
|
+
const entityId = jsObject._id;
|
|
211
|
+
const isValid = validateScriptHooks(jsObject);
|
|
212
|
+
if (validate && !isValid) {
|
|
213
|
+
printMessage('Invalid IDM configuration object', 'error');
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
await putConfigEntity(entityId, importData);
|
|
218
|
+
} catch (putConfigEntityError) {
|
|
219
|
+
printMessage(putConfigEntityError, 'error');
|
|
220
|
+
printMessage(`Error: ${putConfigEntityError}`, 'error');
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
201
224
|
/**
|
|
202
225
|
* Import all IDM configuration objects from separate JSON files in a directory specified by <directory>
|
|
203
226
|
* @param baseDirectory export directory
|
package/esm/ops/IdmOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdmOps.js","names":["fs","fse","path","propertiesReader","replaceall","Idm","Utils","ValidationUtils","createProgressIndicator","printMessage","stopProgressIndicator","getTypedFilename","readFiles","unSubstituteEnvParams","validateScriptHooks","getAllConfigEntities","getConfigEntity","putConfigEntity","queryAllManagedObjectsByType","testConnectorServers","warnAboutOfflineConnectorServers","all","offline","filter","status","ok","map","name","length","join","error","message","listAllConfigEntities","configurations","configEntity","_id","getAllConfigEntitiesError","exportConfigEntity","id","file","fileName","writeFile","JSON","stringify","err","exportAllRawConfigEntities","directory","existsSync","mkdirSync","undefined","entityPromises","push","catch","getConfigEntityError","response","data","includes","reason","results","Promise","item","outputFile","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","entriesData","parse","idm","envParams","configEntityString","each","key","value","importConfigEntity","entityId","validate","entityData","readFileSync","resolve","process","cwd","jsObject","isValid","putConfigEntityError","importAllRawConfigEntities","baseDirectory","files","jsonFiles","toLowerCase","endsWith","content","substring","everyScriptValid","isScriptValid","allSettled","errors","result","importAllConfigEntities","entriesToImport","envReader","unsubstituted","countManagedObjects","type","count","resultCount","pagedResultsCookie","totalPagedResultsPolicy","totalPagedResults","remainingPagedResults"],"sources":["ops/IdmOps.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport path from 'path';\nimport propertiesReader from 'properties-reader';\nimport replaceall from 'replaceall';\n\nimport { Idm, Utils, ValidationUtils } from '@rockcarver/frodo-lib';\nimport {\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { getTypedFilename } from '../utils/ExportImportUtils';\n\nconst { readFiles, unSubstituteEnvParams } = Utils;\nconst { validateScriptHooks } = ValidationUtils;\nconst {\n getAllConfigEntities,\n getConfigEntity,\n putConfigEntity,\n queryAllManagedObjectsByType,\n testConnectorServers,\n} = Idm;\n\n/**\n * Warn about and list offline remote connector servers\n */\nexport async function warnAboutOfflineConnectorServers() {\n try {\n const all = await testConnectorServers();\n const offline = all\n .filter((status) => !status.ok)\n .map((status) => status.name);\n if (offline.length) {\n printMessage(\n `\\nThe following connector server(s) are offline and their connectors and configuration unavailable:\\n${offline.join(\n '\\n'\n )}`,\n 'warn'\n );\n }\n } catch (error) {\n printMessage(error, 'error');\n printMessage(\n `Error getting offline connector servers: ${error.message}`,\n 'error'\n );\n }\n}\n\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n try {\n const { configurations } = await getAllConfigEntities();\n for (const configEntity of configurations) {\n printMessage(`${configEntity._id}`, 'data');\n }\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await getConfigEntity(id);\n fs.writeFile(fileName, JSON.stringify(configEntity, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n * @param {String} directory export directory\n */\nexport async function exportAllRawConfigEntities(directory) {\n try {\n const { configurations } = await getAllConfigEntities();\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n entityPromises.push(\n getConfigEntity(configEntity._id).catch((getConfigEntityError) => {\n if (\n !(\n getConfigEntityError.response?.status === 403 &&\n getConfigEntityError.response?.data?.message ===\n 'This operation is not available in ForgeRock Identity Cloud.'\n ) &&\n !(\n // list of config entities, which do not exist by default or ever.\n (\n [\n 'script',\n 'notificationFactory',\n 'apiVersion',\n 'metrics',\n 'repo.init',\n 'endpoint/validateQueryFilter',\n 'endpoint/oauthproxy',\n 'external.rest',\n 'scheduler',\n 'org.apache.felix.fileinstall/openidm',\n 'cluster',\n 'endpoint/mappingDetails',\n 'fieldPolicy/teammember',\n ].includes(configEntity._id) &&\n getConfigEntityError.response?.status === 404 &&\n getConfigEntityError.response?.data?.reason === 'Not Found'\n )\n ) &&\n // https://bugster.forgerock.org/jira/browse/OPENIDM-18270\n !(\n getConfigEntityError.response?.status === 404 &&\n getConfigEntityError.response?.data?.message ===\n 'No configuration exists for id org.apache.felix.fileinstall/openidm'\n )\n ) {\n printMessage(getConfigEntityError.response?.data, 'error');\n printMessage(\n `Error getting config entity ${configEntity._id}: ${getConfigEntityError}`,\n 'error'\n );\n }\n })\n );\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator('Exported config objects.', 'success');\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} directory export directory\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(\n directory,\n entitiesFile,\n envFile\n) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n try {\n const { configurations } = await getAllConfigEntities();\n // create export directory if not exist\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n if (entriesToExport.includes(configEntity._id)) {\n entityPromises.push(getConfigEntity(configEntity._id));\n }\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n let configEntityString = JSON.stringify(item, null, 2);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n `${directory}/${item._id}.json`,\n configEntityString,\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator(null, 'success');\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n });\n}\n\n/**\n * Import an IDM configuration object.\n * @param entityId the configuration object to import\n * @param file optional file to import\n */\nexport async function importConfigEntity(\n entityId: string,\n file?: string,\n validate?: boolean\n) {\n if (!file) {\n file = getTypedFilename(entityId, 'idm');\n }\n\n const entityData = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');\n\n const jsObject = JSON.parse(entityData);\n const isValid = validateScriptHooks(jsObject);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await putConfigEntity(entityId, entityData);\n } catch (putConfigEntityError) {\n printMessage(putConfigEntityError, 'error');\n printMessage(`Error: ${putConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import all IDM configuration objects from separate JSON files in a directory specified by <directory>\n * @param baseDirectory export directory\n * @param validate validate script hooks\n */\nexport async function importAllRawConfigEntities(\n baseDirectory: string,\n validate?: boolean\n) {\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ path, content }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = validateScriptHooks(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles.map((file) => {\n return putConfigEntity(file.entityId, file.content);\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Import all IDM configuration objects\n * @param baseDirectory import directory\n * @param entitiesFile JSON file that specifies the config entities to export/import\n * @param envFile File that defines environment specific variables for replacement during configuration export/import\n * @param validate validate script hooks\n */\nexport async function importAllConfigEntities(\n baseDirectory: string,\n entitiesFile: string,\n envFile: string,\n validate?: boolean\n) {\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const entriesToImport = JSON.parse(fs.readFileSync(entitiesFile, 'utf8')).idm;\n\n const envReader = propertiesReader(envFile);\n\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ content, path }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = validateScriptHooks(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles\n .filter(({ entityId }) => {\n return entriesToImport.includes(entityId);\n })\n .map(({ entityId, content }) => {\n const unsubstituted = unSubstituteEnvParams(content, envReader);\n return putConfigEntity(entityId, unsubstituted);\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type) {\n let count = 0;\n let result = {\n result: [],\n resultCount: 0,\n pagedResultsCookie: null,\n totalPagedResultsPolicy: 'NONE',\n totalPagedResults: -1,\n remainingPagedResults: -1,\n };\n try {\n do {\n result = await queryAllManagedObjectsByType(\n type,\n [],\n result.pagedResultsCookie\n );\n count += result.resultCount;\n } while (result.pagedResultsCookie);\n printMessage(`${type}: ${count}`);\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":"AAAA;AACA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,GAAG,MAAM,UAAU;AAC1B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,GAAG,EAAEC,KAAK,EAAEC,eAAe,QAAQ,uBAAuB;AACnE,SACEC,uBAAuB,EACvBC,YAAY,EACZC,q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E,CAAC;EAC1B,CAAC;EACD,IAAI;IACF,GAAG;MACDZ,MAAM,GAAG,MAAMhF,4BAA4B,CACzCsF,IAAI,EACJ,EAAE,EACFN,MAAM,CAACS,kBAAkB,CAC1B;MACDF,KAAK,IAAIP,MAAM,CAACQ,WAAW;IAC7B,CAAC,QAAQR,MAAM,CAACS,kBAAkB;IAClClG,YAAY,CAAE,GAAE+F,IAAK,KAAIC,KAAM,EAAC,CAAC;EACnC,CAAC,CAAC,OAAO3E,KAAK,EAAE;IACdrB,YAAY,CAACqB,KAAK,CAACwB,QAAQ,CAACC,IAAI,EAAE,OAAO,CAAC;IAC1C9C,YAAY,CAAE,2CAA0CqB,KAAM,EAAC,EAAE,OAAO,CAAC;EAC3E;AACF"}
|
|
1
|
+
{"version":3,"file":"IdmOps.js","names":["fs","fse","path","propertiesReader","replaceall","Idm","Utils","ValidationUtils","createProgressIndicator","printMessage","stopProgressIndicator","getTypedFilename","readFiles","unSubstituteEnvParams","validateScriptHooks","getAllConfigEntities","getConfigEntity","putConfigEntity","queryAllManagedObjectsByType","testConnectorServers","warnAboutOfflineConnectorServers","all","offline","filter","status","ok","map","name","length","join","error","message","listAllConfigEntities","configurations","configEntity","_id","getAllConfigEntitiesError","exportConfigEntity","id","file","fileName","writeFile","JSON","stringify","err","exportAllRawConfigEntities","directory","existsSync","mkdirSync","undefined","entityPromises","push","catch","getConfigEntityError","response","data","includes","reason","results","Promise","item","outputFile","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","entriesData","parse","idm","envParams","configEntityString","each","key","value","importConfigEntityByIdFromFile","entityId","validate","entityData","readFileSync","resolve","process","cwd","jsObject","isValid","putConfigEntityError","importConfigEntityFromFile","importData","importAllRawConfigEntities","baseDirectory","files","jsonFiles","toLowerCase","endsWith","content","substring","everyScriptValid","isScriptValid","allSettled","errors","result","importAllConfigEntities","entriesToImport","envReader","unsubstituted","countManagedObjects","type","count","resultCount","pagedResultsCookie","totalPagedResultsPolicy","totalPagedResults","remainingPagedResults"],"sources":["ops/IdmOps.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport path from 'path';\nimport propertiesReader from 'properties-reader';\nimport replaceall from 'replaceall';\n\nimport { Idm, Utils, ValidationUtils } from '@rockcarver/frodo-lib';\nimport {\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { getTypedFilename } from '../utils/ExportImportUtils';\n\nconst { readFiles, unSubstituteEnvParams } = Utils;\nconst { validateScriptHooks } = ValidationUtils;\nconst {\n getAllConfigEntities,\n getConfigEntity,\n putConfigEntity,\n queryAllManagedObjectsByType,\n testConnectorServers,\n} = Idm;\n\n/**\n * Warn about and list offline remote connector servers\n */\nexport async function warnAboutOfflineConnectorServers() {\n try {\n const all = await testConnectorServers();\n const offline = all\n .filter((status) => !status.ok)\n .map((status) => status.name);\n if (offline.length) {\n printMessage(\n `\\nThe following connector server(s) are offline and their connectors and configuration unavailable:\\n${offline.join(\n '\\n'\n )}`,\n 'warn'\n );\n }\n } catch (error) {\n printMessage(error, 'error');\n printMessage(\n `Error getting offline connector servers: ${error.message}`,\n 'error'\n );\n }\n}\n\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n try {\n const { configurations } = await getAllConfigEntities();\n for (const configEntity of configurations) {\n printMessage(`${configEntity._id}`, 'data');\n }\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await getConfigEntity(id);\n fs.writeFile(fileName, JSON.stringify(configEntity, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n * @param {String} directory export directory\n */\nexport async function exportAllRawConfigEntities(directory) {\n try {\n const { configurations } = await getAllConfigEntities();\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n entityPromises.push(\n getConfigEntity(configEntity._id).catch((getConfigEntityError) => {\n if (\n !(\n getConfigEntityError.response?.status === 403 &&\n getConfigEntityError.response?.data?.message ===\n 'This operation is not available in ForgeRock Identity Cloud.'\n ) &&\n !(\n // list of config entities, which do not exist by default or ever.\n (\n [\n 'script',\n 'notificationFactory',\n 'apiVersion',\n 'metrics',\n 'repo.init',\n 'endpoint/validateQueryFilter',\n 'endpoint/oauthproxy',\n 'external.rest',\n 'scheduler',\n 'org.apache.felix.fileinstall/openidm',\n 'cluster',\n 'endpoint/mappingDetails',\n 'fieldPolicy/teammember',\n ].includes(configEntity._id) &&\n getConfigEntityError.response?.status === 404 &&\n getConfigEntityError.response?.data?.reason === 'Not Found'\n )\n ) &&\n // https://bugster.forgerock.org/jira/browse/OPENIDM-18270\n !(\n getConfigEntityError.response?.status === 404 &&\n getConfigEntityError.response?.data?.message ===\n 'No configuration exists for id org.apache.felix.fileinstall/openidm'\n )\n ) {\n printMessage(getConfigEntityError.response?.data, 'error');\n printMessage(\n `Error getting config entity ${configEntity._id}: ${getConfigEntityError}`,\n 'error'\n );\n }\n })\n );\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator('Exported config objects.', 'success');\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} directory export directory\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(\n directory,\n entitiesFile,\n envFile\n) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n try {\n const { configurations } = await getAllConfigEntities();\n // create export directory if not exist\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n if (entriesToExport.includes(configEntity._id)) {\n entityPromises.push(getConfigEntity(configEntity._id));\n }\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n let configEntityString = JSON.stringify(item, null, 2);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n `${directory}/${item._id}.json`,\n configEntityString,\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator(null, 'success');\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n });\n}\n\n/**\n * Import an IDM configuration object by id from file.\n * @param entityId the configuration object to import\n * @param file optional file to import\n * @param validate validate script hooks\n */\nexport async function importConfigEntityByIdFromFile(\n entityId: string,\n file?: string,\n validate?: boolean\n) {\n if (!file) {\n file = getTypedFilename(entityId, 'idm');\n }\n\n const entityData = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');\n\n const jsObject = JSON.parse(entityData);\n const isValid = validateScriptHooks(jsObject);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await putConfigEntity(entityId, entityData);\n } catch (putConfigEntityError) {\n printMessage(putConfigEntityError, 'error');\n printMessage(`Error: ${putConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import IDM configuration object from file.\n * @param file optional file to import\n * @param validate validate script hooks\n */\nexport async function importConfigEntityFromFile(\n file: string,\n validate?: boolean\n) {\n const importData = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');\n const jsObject = JSON.parse(importData);\n const entityId = jsObject._id;\n const isValid = validateScriptHooks(jsObject);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await putConfigEntity(entityId, importData);\n } catch (putConfigEntityError) {\n printMessage(putConfigEntityError, 'error');\n printMessage(`Error: ${putConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import all IDM configuration objects from separate JSON files in a directory specified by <directory>\n * @param baseDirectory export directory\n * @param validate validate script hooks\n */\nexport async function importAllRawConfigEntities(\n baseDirectory: string,\n validate?: boolean\n) {\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ path, content }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = validateScriptHooks(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles.map((file) => {\n return putConfigEntity(file.entityId, file.content);\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Import all IDM configuration objects\n * @param baseDirectory import directory\n * @param entitiesFile JSON file that specifies the config entities to export/import\n * @param envFile File that defines environment specific variables for replacement during configuration export/import\n * @param validate validate script hooks\n */\nexport async function importAllConfigEntities(\n baseDirectory: string,\n entitiesFile: string,\n envFile: string,\n validate?: boolean\n) {\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const entriesToImport = JSON.parse(fs.readFileSync(entitiesFile, 'utf8')).idm;\n\n const envReader = propertiesReader(envFile);\n\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ content, path }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = validateScriptHooks(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles\n .filter(({ entityId }) => {\n return entriesToImport.includes(entityId);\n })\n .map(({ entityId, content }) => {\n const unsubstituted = unSubstituteEnvParams(content, envReader);\n return putConfigEntity(entityId, unsubstituted);\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type) {\n let count = 0;\n let result = {\n result: [],\n resultCount: 0,\n pagedResultsCookie: null,\n totalPagedResultsPolicy: 'NONE',\n totalPagedResults: -1,\n remainingPagedResults: -1,\n };\n try {\n do {\n result = await queryAllManagedObjectsByType(\n type,\n [],\n result.pagedResultsCookie\n );\n count += result.resultCount;\n } while (result.pagedResultsCookie);\n printMessage(`${type}: ${count}`);\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":"AAAA;AACA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,GAAG,MAAM,UAAU;AAC1B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,GAAG,EAAEC,KAAK,EAAEC,eAAe,QAAQ,uBAAuB;AACnE,SACEC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,4BAA4B;AAE7D,MAAM;EAAEC,SAAS;EAAEC;AAAsB,CAAC,GAAGP,KAAK;AAClD,MAAM;EAAEQ;AAAoB,CAAC,GAAGP,eAAe;AAC/C,MAAM;EACJQ,oBAAoB;EACpBC,eAAe;EACfC,eAAe;EACfC,4BAA4B;EAC5BC;AACF,CAAC,GAAGd,GAAG;;AAEP;AACA;AACA;AACA,OAAO,eAAee,gCAAgC,GAAG;EACvD,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMF,oBAAoB,EAAE;IACxC,MAAMG,OA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