@rockcarver/frodo-lib 0.12.1 → 0.12.2-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/cjs/api/BaseApi.js +36 -8
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/api/NodeApi.js +190 -0
- package/cjs/api/NodeApi.js.map +1 -0
- package/cjs/api/NodeApi.test.js.map +1 -0
- package/cjs/api/OAuth2ClientApi.js +3 -1
- package/cjs/api/OAuth2ClientApi.js.map +1 -1
- package/cjs/api/SecretsApi.js +59 -29
- package/cjs/api/SecretsApi.js.map +1 -1
- package/cjs/api/StartupApi.js +21 -8
- package/cjs/api/StartupApi.js.map +1 -1
- package/cjs/api/StartupApi.test.js.map +1 -0
- package/cjs/api/TreeApi.js +30 -161
- package/cjs/api/TreeApi.js.map +1 -1
- package/cjs/api/TreeApi.test.js.map +1 -0
- package/cjs/api/VariablesApi.js +35 -20
- package/cjs/api/VariablesApi.js.map +1 -1
- package/cjs/index.js +15 -5
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +1 -1
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/IdpOps.js +1 -1
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/JourneyOps.js +233 -204
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +27 -20
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/SecretsOps.js +9 -7
- package/cjs/ops/SecretsOps.js.map +1 -1
- package/cjs/ops/StartupOps.js +61 -71
- package/cjs/ops/StartupOps.js.map +1 -1
- package/cjs/ops/VariablesOps.js +3 -3
- package/cjs/ops/VariablesOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +3 -2
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +1 -0
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/esm/api/BaseApi.mjs +35 -7
- package/esm/api/NodeApi.mjs +114 -0
- package/esm/api/NodeApi.test.mjs +105 -0
- package/esm/api/OAuth2ClientApi.mjs +4 -2
- package/esm/api/SecretsApi.mjs +59 -29
- package/esm/api/StartupApi.mjs +18 -8
- package/esm/api/StartupApi.test.mjs +56 -0
- package/esm/api/TreeApi.mjs +29 -99
- package/esm/api/TreeApi.test.mjs +175 -0
- package/esm/api/VariablesApi.mjs +35 -20
- package/esm/index.mjs +7 -5
- package/esm/ops/AuthenticateOps.mjs +1 -1
- package/esm/ops/IdpOps.mjs +1 -1
- package/esm/ops/JourneyOps.mjs +186 -154
- package/esm/ops/OAuth2ClientOps.mjs +9 -4
- package/esm/ops/SecretsOps.mjs +9 -7
- package/esm/ops/StartupOps.mjs +59 -62
- package/esm/ops/VariablesOps.mjs +3 -3
- package/esm/ops/utils/Console.mjs +3 -2
- package/esm/ops/utils/ExportImportUtils.mjs +1 -0
- package/package.json +7 -4
- package/types/api/AuthenticateApi.d.ts +2 -0
- package/types/api/AuthenticateApi.d.ts.map +1 -0
- package/types/api/BaseApi.d.ts +50 -0
- package/types/api/BaseApi.d.ts.map +1 -0
- package/types/api/CirclesOfTrustApi.d.ts +24 -0
- package/types/api/CirclesOfTrustApi.d.ts.map +1 -0
- package/types/api/EmailTemplateApi.d.ts +22 -0
- package/types/api/EmailTemplateApi.d.ts.map +1 -0
- package/types/api/IdmConfigApi.d.ts +39 -0
- package/types/api/IdmConfigApi.d.ts.map +1 -0
- package/types/api/LogApi.d.ts +4 -0
- package/types/api/LogApi.d.ts.map +1 -0
- package/types/api/ManagedObjectApi.d.ts +21 -0
- package/types/api/ManagedObjectApi.d.ts.map +1 -0
- package/types/api/NodeApi.d.ts +38 -0
- package/types/api/NodeApi.d.ts.map +1 -0
- package/types/api/OAuth2ClientApi.d.ts +18 -0
- package/types/api/OAuth2ClientApi.d.ts.map +1 -0
- package/types/api/OAuth2OIDCApi.d.ts +22 -0
- package/types/api/OAuth2OIDCApi.d.ts.map +1 -0
- package/types/api/OAuth2ProviderApi.d.ts +5 -0
- package/types/api/OAuth2ProviderApi.d.ts.map +1 -0
- package/types/api/RealmApi.d.ts +30 -0
- package/types/api/RealmApi.d.ts.map +1 -0
- package/types/api/Saml2Api.d.ts +52 -0
- package/types/api/Saml2Api.d.ts.map +1 -0
- package/types/api/ScriptApi.d.ts +24 -0
- package/types/api/ScriptApi.d.ts.map +1 -0
- package/types/api/SecretsApi.d.ts +10 -0
- package/types/api/SecretsApi.d.ts.map +1 -0
- package/types/api/ServerInfoApi.d.ts +10 -0
- package/types/api/ServerInfoApi.d.ts.map +1 -0
- package/types/api/SocialIdentityProvidersApi.d.ts +31 -0
- package/types/api/SocialIdentityProvidersApi.d.ts.map +1 -0
- package/types/api/StartupApi.d.ts +14 -0
- package/types/api/StartupApi.d.ts.map +1 -0
- package/types/api/ThemeApi.d.ts +54 -0
- package/types/api/ThemeApi.d.ts.map +1 -0
- package/types/api/TreeApi.d.ts +24 -0
- package/types/api/TreeApi.d.ts.map +1 -0
- package/types/api/VariablesApi.d.ts +32 -0
- package/types/api/VariablesApi.d.ts.map +1 -0
- package/types/api/utils/ApiUtils.d.ts +29 -0
- package/types/api/utils/ApiUtils.d.ts.map +1 -0
- package/types/api/utils/Base64.d.ts +30 -0
- package/types/api/utils/Base64.d.ts.map +1 -0
- package/types/index.d.ts +26 -0
- package/types/index.d.ts.map +1 -0
- package/types/ops/AdminOps.d.ts +11 -0
- package/types/ops/AdminOps.d.ts.map +1 -0
- package/types/ops/AuthenticateOps.d.ts +6 -0
- package/types/ops/AuthenticateOps.d.ts.map +1 -0
- package/types/ops/CirclesOfTrustOps.d.ts +40 -0
- package/types/ops/CirclesOfTrustOps.d.ts.map +1 -0
- package/types/ops/ConnectionProfileOps.d.ts +47 -0
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -0
- package/types/ops/EmailTemplateOps.d.ts +40 -0
- package/types/ops/EmailTemplateOps.d.ts.map +1 -0
- package/types/ops/IdmOps.d.ts +27 -0
- package/types/ops/IdmOps.d.ts.map +1 -0
- package/types/ops/IdpOps.d.ts +45 -0
- package/types/ops/IdpOps.d.ts.map +1 -0
- package/types/ops/JourneyOps.d.ts +151 -0
- package/types/ops/JourneyOps.d.ts.map +1 -0
- package/types/ops/LogOps.d.ts +5 -0
- package/types/ops/LogOps.d.ts.map +1 -0
- package/types/ops/ManagedObjectOps.d.ts +14 -0
- package/types/ops/ManagedObjectOps.d.ts.map +1 -0
- package/types/ops/OAuth2ClientOps.d.ts +24 -0
- package/types/ops/OAuth2ClientOps.d.ts.map +1 -0
- package/types/ops/OrganizationOps.d.ts +11 -0
- package/types/ops/OrganizationOps.d.ts.map +1 -0
- package/types/ops/RealmOps.d.ts +22 -0
- package/types/ops/RealmOps.d.ts.map +1 -0
- package/types/ops/SamlOps.d.ts +51 -0
- package/types/ops/SamlOps.d.ts.map +1 -0
- package/types/ops/ScriptOps.d.ts +30 -0
- package/types/ops/ScriptOps.d.ts.map +1 -0
- package/types/ops/SecretsOps.d.ts +63 -0
- package/types/ops/SecretsOps.d.ts.map +1 -0
- package/types/ops/StartupOps.d.ts +25 -0
- package/types/ops/StartupOps.d.ts.map +1 -0
- package/types/ops/ThemeOps.d.ts +66 -0
- package/types/ops/ThemeOps.d.ts.map +1 -0
- package/types/ops/VariablesOps.d.ts +39 -0
- package/types/ops/VariablesOps.d.ts.map +1 -0
- package/types/ops/utils/Console.d.ts +63 -0
- package/types/ops/utils/Console.d.ts.map +1 -0
- package/types/ops/utils/DataProtection.d.ts +6 -0
- package/types/ops/utils/DataProtection.d.ts.map +1 -0
- package/types/ops/utils/ExportImportUtils.d.ts +22 -0
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -0
- package/types/ops/utils/OpsUtils.d.ts +27 -0
- package/types/ops/utils/OpsUtils.d.ts.map +1 -0
- package/types/ops/utils/Wordwrap.d.ts +1 -0
- package/types/ops/utils/Wordwrap.d.ts.map +1 -0
- package/types/storage/SessionStorage.d.ts +47 -0
- package/types/storage/SessionStorage.d.ts.map +1 -0
- package/types/storage/StaticStorage.d.ts +14 -0
- package/types/storage/StaticStorage.d.ts.map +1 -0
|
@@ -105,7 +105,7 @@ export async function exportOAuth2ClientsToFiles() {
|
|
|
105
105
|
*/
|
|
106
106
|
|
|
107
107
|
export async function importOAuth2ClientsFromFile(file) {
|
|
108
|
-
fs.readFile(file, 'utf8', (err, data) => {
|
|
108
|
+
fs.readFile(file, 'utf8', async (err, data) => {
|
|
109
109
|
if (err) throw err;
|
|
110
110
|
const applicationData = JSON.parse(data);
|
|
111
111
|
|
|
@@ -114,9 +114,14 @@ export async function importOAuth2ClientsFromFile(file) {
|
|
|
114
114
|
if (Object.prototype.hasOwnProperty.call(applicationData.application, id)) {
|
|
115
115
|
delete applicationData.application[id]._provider;
|
|
116
116
|
delete applicationData.application[id]._rev;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
await putOAuth2Client(id, applicationData.application[id]);
|
|
120
|
+
printMessage(`Imported ${id}`);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
printMessage(`${error.message}`, 'error');
|
|
123
|
+
printMessage(error.response.status, 'error');
|
|
124
|
+
}
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
127
|
} else {
|
package/esm/ops/SecretsOps.mjs
CHANGED
|
@@ -11,7 +11,7 @@ export async function listSecrets(long) {
|
|
|
11
11
|
let secrets = [];
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
secrets =
|
|
14
|
+
secrets = await getSecrets();
|
|
15
15
|
} catch (error) {
|
|
16
16
|
printMessage(`${error.message}`, 'error');
|
|
17
17
|
printMessage(error.response.data, 'error');
|
|
@@ -101,7 +101,7 @@ export async function deleteSecretCmd(secretId) {
|
|
|
101
101
|
|
|
102
102
|
export async function deleteSecretsCmd() {
|
|
103
103
|
try {
|
|
104
|
-
const secrets =
|
|
104
|
+
const secrets = await getSecrets();
|
|
105
105
|
createProgressIndicator(secrets.length, `Deleting secrets...`);
|
|
106
106
|
|
|
107
107
|
for (const secret of secrets) {
|
|
@@ -128,7 +128,7 @@ export async function listSecretVersionsCmd(secretId) {
|
|
|
128
128
|
let versions = [];
|
|
129
129
|
|
|
130
130
|
try {
|
|
131
|
-
versions =
|
|
131
|
+
versions = await getSecretVersions(secretId);
|
|
132
132
|
} catch (error) {
|
|
133
133
|
printMessage(`${error.message}`, 'error');
|
|
134
134
|
printMessage(error.response.data, 'error');
|
|
@@ -144,12 +144,14 @@ export async function listSecretVersionsCmd(secretId) {
|
|
|
144
144
|
DISABLED: 'inactive'['brightRed'],
|
|
145
145
|
DESTROYED: 'deleted'['brightRed']
|
|
146
146
|
};
|
|
147
|
-
|
|
147
|
+
|
|
148
|
+
for (const version of versions) {
|
|
148
149
|
table.push([{
|
|
149
150
|
hAlign: 'right',
|
|
150
151
|
content: version.version
|
|
151
152
|
}, statusMap[version.status], version.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'], new Date(version.createDate).toLocaleString()]);
|
|
152
|
-
}
|
|
153
|
+
}
|
|
154
|
+
|
|
153
155
|
printMessage(table.toString());
|
|
154
156
|
}
|
|
155
157
|
/**
|
|
@@ -158,7 +160,7 @@ export async function listSecretVersionsCmd(secretId) {
|
|
|
158
160
|
*/
|
|
159
161
|
|
|
160
162
|
export async function describeSecret(secretId) {
|
|
161
|
-
const secret =
|
|
163
|
+
const secret = await getSecret(secretId);
|
|
162
164
|
const table = createKeyValueTable();
|
|
163
165
|
table.push(['Name'['brightCyan'], secret._id]);
|
|
164
166
|
table.push(['Active Version'['brightCyan'], secret.activeVersion]);
|
|
@@ -184,7 +186,7 @@ export async function createNewVersionOfSecretCmd(secretId, value) {
|
|
|
184
186
|
createProgressIndicator(undefined, `Creating new version of secret ${secretId}...`, 'indeterminate');
|
|
185
187
|
|
|
186
188
|
try {
|
|
187
|
-
const version =
|
|
189
|
+
const version = await createNewVersionOfSecret(secretId, value);
|
|
188
190
|
stopProgressIndicator(`Created version ${version.version} of secret ${secretId}`, 'success');
|
|
189
191
|
} catch (error) {
|
|
190
192
|
stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
|
package/esm/ops/StartupOps.mjs
CHANGED
|
@@ -1,86 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createTable, printMessage, createProgressIndicator, updateProgressIndicator, stopProgressIndicator } from './utils/Console';
|
|
1
|
+
import { createProgressIndicator, updateProgressIndicator, stopProgressIndicator } from './utils/Console';
|
|
3
2
|
import { getSecrets } from '../api/SecretsApi';
|
|
4
|
-
import { getStatus, initiateRestart } from '../api/StartupApi';
|
|
5
|
-
import { resolveUserName } from './ManagedObjectOps';
|
|
3
|
+
import { getStatus, initiateRestart, RestartStatus } from '../api/StartupApi';
|
|
6
4
|
import { getVariables } from '../api/VariablesApi';
|
|
5
|
+
/**
|
|
6
|
+
* Updates that need to be applied.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Check for updates that need applying
|
|
11
|
+
* @returns {Promise<boolean>} true if there are updates that need to be applied, false otherwise
|
|
12
|
+
*/
|
|
7
13
|
export async function checkForUpdates() {
|
|
14
|
+
var _updates$secrets, _updates$variables;
|
|
15
|
+
|
|
16
|
+
const updates = {
|
|
17
|
+
secrets: [],
|
|
18
|
+
variables: []
|
|
19
|
+
};
|
|
8
20
|
createProgressIndicator(undefined, `Checking for updates to apply...`, 'indeterminate');
|
|
9
|
-
const updates = createTable(['Type'['brightCyan'], 'Name'['brightCyan'], 'Modified'['brightCyan'], 'Modifier'['brightCyan']]);
|
|
10
|
-
let secrets = [];
|
|
11
|
-
let variables = [];
|
|
12
21
|
|
|
13
22
|
try {
|
|
14
|
-
secrets = (await getSecrets()).
|
|
15
|
-
|
|
16
|
-
for (const secret of secrets) {
|
|
17
|
-
if (!secret.loaded) {
|
|
18
|
-
updates.push(['secret', secret._id, new Date(secret.lastChangeDate).toLocaleString(), // eslint-disable-next-line no-await-in-loop
|
|
19
|
-
await resolveUserName('teammember', secret.lastChangedBy)]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
variables = (await getVariables()).data.result;
|
|
24
|
-
|
|
25
|
-
for (const variable of variables) {
|
|
26
|
-
if (!variable.loaded) {
|
|
27
|
-
updates.push(['variable', variable._id, new Date(variable.lastChangeDate).toLocaleString(), // eslint-disable-next-line no-await-in-loop
|
|
28
|
-
await resolveUserName('teammember', variable.lastChangedBy)]);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
23
|
+
updates.secrets = (await getSecrets()).filter(secret => !secret.loaded);
|
|
24
|
+
updates.variables = (await getVariables()).filter(variable => !variable.loaded);
|
|
31
25
|
} catch (error) {
|
|
32
26
|
stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
|
|
33
27
|
}
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const updateCount = ((_updates$secrets = updates.secrets) === null || _updates$secrets === void 0 ? void 0 : _updates$secrets.length) + ((_updates$variables = updates.variables) === null || _updates$variables === void 0 ? void 0 : _updates$variables.length) || 0;
|
|
30
|
+
|
|
31
|
+
if (updateCount > 0) {
|
|
32
|
+
stopProgressIndicator(`${updateCount} update(s) need to be applied`, 'success');
|
|
33
|
+
} else {
|
|
34
|
+
stopProgressIndicator(`No updates need to be applied`, 'success');
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
return false;
|
|
37
|
+
return updates;
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Apply updates
|
|
41
|
+
* @param {boolean} wait wait for the operation to complete or not
|
|
42
|
+
* @param {number} timeout timeout in milliseconds
|
|
43
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
44
|
+
*/
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
export async function applyUpdates(wait, timeout = 10 * 60 * 1000) {
|
|
47
|
+
createProgressIndicator(undefined, `Applying updates...`, 'indeterminate');
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (wait) {
|
|
57
|
-
const timeout = 10 * 60 * 1000;
|
|
58
|
-
const start = new Date().getTime();
|
|
59
|
-
let runtime = 0; // eslint-disable-next-line no-await-in-loop
|
|
49
|
+
try {
|
|
50
|
+
let status = await initiateRestart();
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
if (wait) {
|
|
53
|
+
const start = new Date().getTime();
|
|
54
|
+
let runtime = 0;
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
while (status !== RestartStatus.ready && start + timeout > new Date().getTime()) {
|
|
57
|
+
// eslint-disable-next-line no-await-in-loop, no-promise-executor-return
|
|
58
|
+
await new Promise(resolve => setTimeout(resolve, 5000)); // eslint-disable-next-line no-await-in-loop
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
status = await getStatus();
|
|
61
|
+
runtime = new Date().getTime() - start;
|
|
62
|
+
updateProgressIndicator(`${status} (${Math.round(runtime / 1000)}s)`);
|
|
63
|
+
}
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
stopProgressIndicator(`Updates are being applied. Changes may take up to 10 minutes to propagate, during which time you will not be able to make further updates.`, 'success');
|
|
79
|
-
}
|
|
80
|
-
} catch (error) {
|
|
81
|
-
stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
|
|
65
|
+
if (runtime < timeout) {
|
|
66
|
+
stopProgressIndicator(`Updates applied in ${Math.round(runtime / 1000)}s with final status: ${status}`, 'success');
|
|
67
|
+
return true;
|
|
68
|
+
} else {
|
|
69
|
+
stopProgressIndicator(`Updates timed out after ${Math.round(runtime / 1000)}s with final status: ${status}`, 'warn');
|
|
70
|
+
return false;
|
|
82
71
|
}
|
|
72
|
+
} else {
|
|
73
|
+
stopProgressIndicator(`Updates are being applied. Changes may take up to 10 minutes to propagate, during which time you will not be able to make further updates.`, 'success');
|
|
74
|
+
return true;
|
|
83
75
|
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
78
|
+
|
|
79
|
+
stopProgressIndicator(`Error: ${((_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.code) || error} - ${(_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.message}`, 'fail');
|
|
80
|
+
return false;
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
//# sourceMappingURL=StartupOps.js.map
|
package/esm/ops/VariablesOps.mjs
CHANGED
|
@@ -12,7 +12,7 @@ export async function listVariables(long) {
|
|
|
12
12
|
let variables = [];
|
|
13
13
|
|
|
14
14
|
try {
|
|
15
|
-
variables =
|
|
15
|
+
variables = await getVariables();
|
|
16
16
|
} catch (error) {
|
|
17
17
|
printMessage(`${error.message}`, 'error');
|
|
18
18
|
printMessage(error.response.data, 'error');
|
|
@@ -105,7 +105,7 @@ export async function deleteVariableCmd(variableId) {
|
|
|
105
105
|
|
|
106
106
|
export async function deleteVariablesCmd() {
|
|
107
107
|
try {
|
|
108
|
-
const variables =
|
|
108
|
+
const variables = await getVariables();
|
|
109
109
|
createProgressIndicator(variables.length, `Deleting variable...`);
|
|
110
110
|
|
|
111
111
|
for (const variable of variables) {
|
|
@@ -129,7 +129,7 @@ export async function deleteVariablesCmd() {
|
|
|
129
129
|
*/
|
|
130
130
|
|
|
131
131
|
export async function describeVariable(variableId) {
|
|
132
|
-
const variable =
|
|
132
|
+
const variable = await getVariable(variableId);
|
|
133
133
|
const table = createKeyValueTable();
|
|
134
134
|
table.push(['Name'['brightCyan'], variable._id]);
|
|
135
135
|
table.push(['Value'['brightCyan'], wordwrap(decode(variable.valueBase64), 40)]);
|
|
@@ -6,7 +6,7 @@ import storage from '../../storage/SessionStorage';
|
|
|
6
6
|
* on its side. `handler` is optional, and if not included by the caller,
|
|
7
7
|
* the data and messages will be lost.
|
|
8
8
|
*
|
|
9
|
-
* @param {string} message The string message to return
|
|
9
|
+
* @param {string | unknown} message The string message to return
|
|
10
10
|
* @param {string} [type=text] "text", "info", "warn", "error" or "data". All but
|
|
11
11
|
* type="data" will be written to stderr.
|
|
12
12
|
* @param {boolean} [newline=true] Whether to add a newline at the end of message
|
|
@@ -62,7 +62,8 @@ export function updateProgressIndicator(message = null) {
|
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Stop and hide the progress indicator
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {string} message optional message to show with the indicator
|
|
66
|
+
* @param {string} status one of 'none', 'success', 'warn', 'fail'
|
|
66
67
|
*/
|
|
67
68
|
|
|
68
69
|
export function stopProgressIndicator(message = null, status = 'none') {
|
|
@@ -12,6 +12,7 @@ export function getCurrentTimestamp() {
|
|
|
12
12
|
function getMetadata() {
|
|
13
13
|
const metadata = {
|
|
14
14
|
origin: storage.session.getTenant(),
|
|
15
|
+
originAmVersion: storage.session.getAmVersion(),
|
|
15
16
|
exportedBy: storage.session.getUsername(),
|
|
16
17
|
exportDate: getCurrentTimestamp(),
|
|
17
18
|
exportTool: FRODO_METADATA_ID,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-lib",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2-2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.mjs",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "node --no-warnings --experimental-vm-modules --experimental-specifier-resolution=node node_modules/jest/bin/jest.js --silent",
|
|
16
|
+
"test": "npx gulp && node --no-warnings --experimental-vm-modules --experimental-specifier-resolution=node node_modules/jest/bin/jest.js --silent",
|
|
17
|
+
"test:debug": "npx gulp && node --no-warnings --experimental-vm-modules --experimental-specifier-resolution=node node_modules/jest/bin/jest.js --verbose=true --silent=false",
|
|
17
18
|
"lint": "npx eslint --ext .ts --ignore-path .gitignore .",
|
|
18
19
|
"build": "npx gulp"
|
|
19
20
|
},
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
],
|
|
82
83
|
"license": "MIT",
|
|
83
84
|
"dependencies": {
|
|
85
|
+
"agentkeepalive": "^4.2.1",
|
|
84
86
|
"axios": "^0.27.2",
|
|
85
87
|
"axios-retry": "^3.3.1",
|
|
86
88
|
"cli-table3": "^0.6.2",
|
|
@@ -93,8 +95,7 @@
|
|
|
93
95
|
"readline-sync": "^1.4.10",
|
|
94
96
|
"replaceall": "^0.1.6",
|
|
95
97
|
"slugify": "^1.6.5",
|
|
96
|
-
"uuid": "^8.3.2"
|
|
97
|
-
"yesno": "^0.4.0"
|
|
98
|
+
"uuid": "^8.3.2"
|
|
98
99
|
},
|
|
99
100
|
"devDependencies": {
|
|
100
101
|
"@babel/core": "^7.18.13",
|
|
@@ -104,6 +105,7 @@
|
|
|
104
105
|
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
|
|
105
106
|
"@babel/preset-env": "^7.18.10",
|
|
106
107
|
"@babel/preset-typescript": "^7.18.6",
|
|
108
|
+
"@jest/globals": "^29.0.1",
|
|
107
109
|
"@types/colors": "^1.2.1",
|
|
108
110
|
"@types/jest": "^28.1.7",
|
|
109
111
|
"@types/lodash": "^4.14.184",
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
"@types/uuid": "^8.3.4",
|
|
112
114
|
"@typescript-eslint/eslint-plugin": "^5.34.0",
|
|
113
115
|
"@typescript-eslint/parser": "^5.34.0",
|
|
116
|
+
"axios-mock-adapter": "^1.21.2",
|
|
114
117
|
"babel-jest": "^28.1.3",
|
|
115
118
|
"babel-plugin-transform-import-meta": "^2.1.1",
|
|
116
119
|
"del": "^6.0.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/AuthenticateApi.ts"],"names":[],"mappings":"AAaA,wBAAgB,WAAW,CAAC,KAAK,KAAA,UAUhC;AAED,wBAAsB,IAAI,CAAC,IAAI,KAAK,EAAE,MAAM,KAAK,oDAOhD","file":"AuthenticateApi.d.ts","sourcesContent":["import util from 'util';\nimport { generateAmApi } from './BaseApi';\nimport storage from '../storage/SessionStorage';\n\nconst authenticateUrlTemplate = '%s/json%s/authenticate';\n\nconst apiVersion = 'resource=2.0, protocol=1.0';\nconst getApiConfig = () => ({\n apiVersion,\n});\n\nconst realmPathTemplate = '/realms/%s';\n\nexport function getRealmUrl(realm) {\n let localRealm = realm;\n if (localRealm.startsWith('/') && localRealm.length > 1) {\n localRealm = localRealm.substring(1);\n }\n let realmPath = util.format(realmPathTemplate, 'root');\n if (localRealm !== '/') {\n realmPath += util.format(realmPathTemplate, localRealm);\n }\n return realmPath;\n}\n\nexport async function step(data = {}, config = {}) {\n const urlString = util.format(\n authenticateUrlTemplate,\n storage.session.getTenant(),\n getRealmUrl('/')\n );\n return generateAmApi(getApiConfig()).post(urlString, data, config);\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates an AM Axios API instance
|
|
3
|
+
* @param {object} resource Takes an object takes a resource object. example:
|
|
4
|
+
* @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either
|
|
5
|
+
* add on extra information or override default properties https://github.com/axios/axios#request-config
|
|
6
|
+
*
|
|
7
|
+
* @returns {AxiosInstance}
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateAmApi(resource: any, requestOverride?: {}): import("axios").AxiosInstance;
|
|
10
|
+
/**
|
|
11
|
+
* Generates an OAuth2 Axios API instance
|
|
12
|
+
* @param {object} resource Takes an object takes a resource object. example:
|
|
13
|
+
* @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either
|
|
14
|
+
* add on extra information or override default properties https://github.com/axios/axios#request-config
|
|
15
|
+
*
|
|
16
|
+
* @returns {AxiosInstance}
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateOauth2Api(resource: any, requestOverride?: {}): import("axios").AxiosInstance;
|
|
19
|
+
/**
|
|
20
|
+
* Generates an IDM Axios API instance
|
|
21
|
+
* @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add
|
|
22
|
+
* on extra information or override default properties https://github.com/axios/axios#request-config
|
|
23
|
+
*
|
|
24
|
+
* @returns {AxiosInstance}
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateIdmApi(requestOverride?: {}): import("axios").AxiosInstance;
|
|
27
|
+
/**
|
|
28
|
+
* Generates a LogKeys API Axios instance
|
|
29
|
+
* @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add
|
|
30
|
+
* on extra information or override default properties https://github.com/axios/axios#request-config
|
|
31
|
+
*
|
|
32
|
+
* @returns {AxiosInstance}
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateLogKeysApi(requestOverride?: {}): import("axios").AxiosInstance;
|
|
35
|
+
/**
|
|
36
|
+
* Generates a Log API Axios instance
|
|
37
|
+
* @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add
|
|
38
|
+
* on extra information or override default properties https://github.com/axios/axios#request-config
|
|
39
|
+
*
|
|
40
|
+
* @returns {AxiosInstance}
|
|
41
|
+
*/
|
|
42
|
+
export declare function generateLogApi(requestOverride?: {}): import("axios").AxiosInstance;
|
|
43
|
+
/**
|
|
44
|
+
* Generates an ESV Axios API instance for Environment Secrets and Variables
|
|
45
|
+
* @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add
|
|
46
|
+
* on extra information or override default properties https://github.com/axios/axios#request-config
|
|
47
|
+
*
|
|
48
|
+
* @returns {AxiosInstance}
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateESVApi(resource: any, requestOverride?: {}): import("axios").AxiosInstance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/BaseApi.ts"],"names":[],"mappings":"AAqFA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,KAAA,EAAE,eAAe,KAAK,iCA2B3D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,KAAA,EAAE,eAAe,KAAK,iCA0B/D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,eAAe,KAAK,iCAuBlD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,eAAe,KAAK,iCAwBtD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,eAAe,KAAK,iCAmBlD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,KAAA,EAAE,eAAe,KAAK,iCAyB5D","file":"BaseApi.d.ts","sourcesContent":["import Agent from 'agentkeepalive';\nimport axios, { AxiosProxyConfig } from 'axios';\nimport axiosRetry from 'axios-retry';\nimport HttpsProxyAgent from 'https-proxy-agent';\nimport url from 'url';\nimport fs from 'fs';\nimport storage from '../storage/SessionStorage';\nimport { getTenantURL } from './utils/ApiUtils';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8')\n);\n\naxiosRetry(axios, {\n retries: 3,\n shouldResetTimeout: true,\n retryCondition: (_error) => true, // retry no matter what\n});\n\n// all agents\nconst timeout = 30000;\n\n// agentkeepalive\nconst maxSockets = 100;\nconst maxFreeSockets = 10;\nconst freeSocketTimeout = 30000;\n\nconst userAgent = `${pkg.name}/${pkg.version}`;\nlet httpAgent, httpsAgent;\n\nfunction getHttpAgent() {\n if (httpAgent) return httpAgent;\n httpAgent = new Agent({\n maxSockets,\n maxFreeSockets,\n timeout,\n freeSocketTimeout,\n });\n return httpAgent;\n}\n\n/**\n * Helper method to create properly configured httpsAgent\n * @returns {any} appropriate httpsAgent\n */\nfunction getHttpsAgent() {\n if (httpsAgent) return httpsAgent;\n const options = {\n rejectUnauthorized: !storage.session.getAllowInsecureConnection(),\n };\n const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;\n if (httpsProxy) {\n // https://github.com/axios/axios/issues/3459\n console.error(`Using proxy ${httpsProxy}`['yellow']);\n const parsed = url.parse(httpsProxy);\n options['host'] = parsed.hostname;\n options['port'] = parsed.port;\n options['protocol'] = parsed.protocol;\n options.rejectUnauthorized = !storage.session.getAllowInsecureConnection();\n httpsAgent = HttpsProxyAgent(options);\n return httpsAgent;\n }\n httpsAgent = new Agent.HttpsAgent({\n ...options,\n maxSockets,\n maxFreeSockets,\n timeout,\n freeSocketTimeout,\n });\n return httpsAgent;\n}\n\n/**\n * Get Proxy config\n * @returns {AxiosProxyConfig | false} axios proxy config or false\n */\nfunction getProxy(): AxiosProxyConfig | false {\n if (process.env.HTTPS_PROXY || process.env.https_proxy) return false;\n return null;\n}\n\n/**\n * Generates an AM Axios API instance\n * @param {object} resource Takes an object takes a resource object. example:\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either\n * add on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateAmApi(resource, requestOverride = {}) {\n let headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n 'Accept-API-Version': resource.apiVersion,\n Cookie: `${storage.session.getCookieName()}=${storage.session.getCookieValue()}`,\n };\n if (requestOverride['headers']) {\n headers = {\n ...headers,\n ...requestOverride['headers'],\n };\n }\n\n const requestDetails = {\n baseURL: `${storage.session.getTenant()}/json`,\n timeout,\n ...requestOverride,\n headers,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n return request;\n}\n\n/**\n * Generates an OAuth2 Axios API instance\n * @param {object} resource Takes an object takes a resource object. example:\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either\n * add on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateOauth2Api(resource, requestOverride = {}) {\n let headers = {\n 'User-Agent': userAgent,\n 'Accept-API-Version': resource.apiVersion,\n Cookie: `${storage.session.raw['cookieName']}=${storage.session.raw['cookieValue']}`,\n };\n if (requestOverride['headers']) {\n headers = {\n ...headers,\n ...requestOverride['headers'],\n };\n }\n\n const requestDetails = {\n baseURL: `${storage.session.getTenant()}/json${resource.path}`,\n timeout,\n ...requestOverride,\n headers,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n return request;\n}\n\n/**\n * Generates an IDM Axios API instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateIdmApi(requestOverride = {}) {\n const requestDetails = {\n baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers: {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n },\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n return request;\n}\n\n/**\n * Generates a LogKeys API Axios instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateLogKeysApi(requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n };\n const requestDetails = {\n baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n return request;\n}\n\n/**\n * Generates a Log API Axios instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateLogApi(requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'X-API-Key': storage.session.getLogApiKey(),\n 'X-API-Secret': storage.session.getLogApiSecret(),\n };\n const requestDetails = {\n baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n return request;\n}\n\n/**\n * Generates an ESV Axios API instance for Environment Secrets and Variables\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateESVApi(resource, requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n 'Accept-API-Version': resource.apiVersion,\n };\n const requestDetails = {\n baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n return request;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get all SAML2 circles of trust
|
|
3
|
+
* @returns {Promise} a promise that resolves to an array of circles of trust objects
|
|
4
|
+
*/
|
|
5
|
+
export declare function getCirclesOfTrust(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
+
/**
|
|
7
|
+
* Get SAML2 circle of trust by id/name
|
|
8
|
+
* @param {String} cotId Circle of trust id/name
|
|
9
|
+
* @returns {Promise} a promise that resolves to a saml2 circle of trust object
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCircleOfTrust(cotId: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a SAML2 circle of trust
|
|
14
|
+
* @param {Object} cotData Object representing a SAML circle of trust
|
|
15
|
+
* @returns {Promise} a promise that resolves to a saml2 circle of trust object
|
|
16
|
+
*/
|
|
17
|
+
export declare function createCircleOfTrust(cotData: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
+
/**
|
|
19
|
+
* Update SAML2 circle of trust
|
|
20
|
+
* @param {String} cotId Entity provider location (hosted or remote)
|
|
21
|
+
* @param {Object} cotData Object representing a SAML2 circle of trust
|
|
22
|
+
* @returns {Promise} a promise that resolves to a saml2 circle of trust object
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateCircleOfTrust(cotId: any, cotData: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/CirclesOfTrustApi.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,wBAAsB,iBAAiB,qDAStC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,KAAA,oDAU3C;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,KAAA,oDAUhD;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,KAAA,EAAE,OAAO,KAAA,oDAUvD","file":"CirclesOfTrustApi.d.ts","sourcesContent":["import util from 'util';\nimport _ from 'lodash';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst circleOfTrustByIdURLTemplate =\n '%s/json%s/realm-config/federation/circlesoftrust/%s';\nconst createCircleOfTrustURLTemplate =\n '%s/json%s/realm-config/federation/circlesoftrust/?_action=create';\nconst queryAllCirclesOfTrustURLTemplate =\n '%s/json%s/realm-config/federation/circlesoftrust?_queryFilter=true';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/federation/circlesoftrust`,\n apiVersion,\n };\n};\n\n/**\n * Get all SAML2 circles of trust\n * @returns {Promise} a promise that resolves to an array of circles of trust objects\n */\nexport async function getCirclesOfTrust() {\n const urlString = util.format(\n queryAllCirclesOfTrustURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n return generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n}\n\n/**\n * Get SAML2 circle of trust by id/name\n * @param {String} cotId Circle of trust id/name\n * @returns {Promise} a promise that resolves to a saml2 circle of trust object\n */\nexport async function getCircleOfTrust(cotId) {\n const urlString = util.format(\n circleOfTrustByIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n cotId\n );\n return generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n}\n\n/**\n * Create a SAML2 circle of trust\n * @param {Object} cotData Object representing a SAML circle of trust\n * @returns {Promise} a promise that resolves to a saml2 circle of trust object\n */\nexport async function createCircleOfTrust(cotData) {\n const postData = _.cloneDeep(cotData);\n const urlString = util.format(\n createCircleOfTrustURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n return generateAmApi(getApiConfig()).post(urlString, postData, {\n withCredentials: true,\n });\n}\n\n/**\n * Update SAML2 circle of trust\n * @param {String} cotId Entity provider location (hosted or remote)\n * @param {Object} cotData Object representing a SAML2 circle of trust\n * @returns {Promise} a promise that resolves to a saml2 circle of trust object\n */\nexport async function updateCircleOfTrust(cotId, cotData) {\n const urlString = util.format(\n circleOfTrustByIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n cotId\n );\n return generateAmApi(getApiConfig()).put(urlString, cotData, {\n withCredentials: true,\n });\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email template type key used to build the IDM id: 'emailTemplate/<id>'
|
|
3
|
+
*/
|
|
4
|
+
export declare const EMAIL_TEMPLATE_TYPE = "emailTemplate";
|
|
5
|
+
/**
|
|
6
|
+
* Get all email templates
|
|
7
|
+
* @returns {Promise} a promise that resolves to an object containing an array of email template objects
|
|
8
|
+
*/
|
|
9
|
+
export declare function getEmailTemplates(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
10
|
+
/**
|
|
11
|
+
* Get email template
|
|
12
|
+
* @param {String} id id/name of the email template without the type prefix
|
|
13
|
+
* @returns {Promise} a promise that resolves to an object containing the email template object
|
|
14
|
+
*/
|
|
15
|
+
export declare function getEmailTemplate(id: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
+
/**
|
|
17
|
+
* Put email template
|
|
18
|
+
* @param {String} id id/name of the email template without the type prefix
|
|
19
|
+
* @param {Object} data email template object
|
|
20
|
+
* @returns {Promise} a promise that resolves to an object containing the email template object
|
|
21
|
+
*/
|
|
22
|
+
export declare function putEmailTemplate(id: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/EmailTemplateApi.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,wBAAsB,iBAAiB,qDAEtC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,KAAA,oDAExC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA,oDAE9C","file":"EmailTemplateApi.d.ts","sourcesContent":["import {\n getConfigEntitiesByType,\n getConfigEntity,\n putConfigEntity,\n} from './IdmConfigApi';\n\n/**\n * Email template type key used to build the IDM id: 'emailTemplate/<id>'\n */\nexport const EMAIL_TEMPLATE_TYPE = 'emailTemplate';\n\n/**\n * Get all email templates\n * @returns {Promise} a promise that resolves to an object containing an array of email template objects\n */\nexport async function getEmailTemplates() {\n return getConfigEntitiesByType(EMAIL_TEMPLATE_TYPE);\n}\n\n/**\n * Get email template\n * @param {String} id id/name of the email template without the type prefix\n * @returns {Promise} a promise that resolves to an object containing the email template object\n */\nexport async function getEmailTemplate(id) {\n return getConfigEntity(`${EMAIL_TEMPLATE_TYPE}/${id}`);\n}\n\n/**\n * Put email template\n * @param {String} id id/name of the email template without the type prefix\n * @param {Object} data email template object\n * @returns {Promise} a promise that resolves to an object containing the email template object\n */\nexport async function putEmailTemplate(id, data) {\n return putConfigEntity(`${EMAIL_TEMPLATE_TYPE}/${id}`, data);\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get all IDM config entities
|
|
3
|
+
* @returns {Promise} a promise that resolves to an object containing all IDM config entities
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllConfigEntities(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
+
/**
|
|
7
|
+
* Get IDM config entities by type
|
|
8
|
+
* @param {String} type the desired type of config entity
|
|
9
|
+
* @returns {Promise} a promise that resolves to an object containing all IDM config entities of the desired type
|
|
10
|
+
*/
|
|
11
|
+
export declare function getConfigEntitiesByType(type: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get an IDM config entity
|
|
14
|
+
* @param {String} id the desired config entity
|
|
15
|
+
* @returns {Promise} a promise that resolves to an object containing an IDM config entity
|
|
16
|
+
*/
|
|
17
|
+
export declare function getConfigEntity(id: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
+
/**
|
|
19
|
+
* Put IDM config entity
|
|
20
|
+
* @param {String} id config entity id
|
|
21
|
+
* @param {String} data config entity object
|
|
22
|
+
* @returns {Promise} a promise that resolves to an object containing an IDM config entity
|
|
23
|
+
*/
|
|
24
|
+
export declare function putConfigEntity(id: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
25
|
+
/**
|
|
26
|
+
* Query managed objects
|
|
27
|
+
* @param {String} type managed object type
|
|
28
|
+
* @param {[String]} fields fields to retrieve
|
|
29
|
+
* @param {String} pageCookie paged results cookie
|
|
30
|
+
* @returns {Promise<{result: any[]; resultCount: number; pagedResultsCookie: any; totalPagedResultsPolicy: string; totalPagedResults: number; remainingPagedResults: number;}>} a promise that resolves to an object containing managed objects of the desired type
|
|
31
|
+
*/
|
|
32
|
+
export declare function queryAllManagedObjectsByType(type: any, fields: any, pageCookie: any): Promise<{
|
|
33
|
+
result: any[];
|
|
34
|
+
resultCount: number;
|
|
35
|
+
pagedResultsCookie: string;
|
|
36
|
+
totalPagedResultsPolicy: string;
|
|
37
|
+
totalPagedResults: number;
|
|
38
|
+
remainingPagedResults: number;
|
|
39
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/IdmConfigApi.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,oBAAoB,qDAMzC;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,KAAA,oDAOjD;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EAAE,KAAA,oDAOvC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA,oDAO7C;AAED;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,KAAA,EACJ,MAAM,KAAA,EACN,UAAU,KAAA,GACT,OAAO,CAAC;IACT,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC,CAcD","file":"IdmConfigApi.d.ts","sourcesContent":["import util from 'util';\nimport { generateIdmApi } from './BaseApi';\nimport { getTenantURL } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst idmAllConfigURLTemplate = '%s/openidm/config';\nconst idmConfigURLTemplate = '%s/openidm/config/%s';\nconst idmConfigEntityQueryTemplate = '%s/openidm/config?_queryFilter=%s';\nconst idmManagedObjectURLTemplate =\n '%s/openidm/managed/%s?_queryFilter=true&_pageSize=10000';\n\n/**\n * Get all IDM config entities\n * @returns {Promise} a promise that resolves to an object containing all IDM config entities\n */\nexport async function getAllConfigEntities() {\n const urlString = util.format(\n idmAllConfigURLTemplate,\n getTenantURL(storage.session.getTenant())\n );\n return generateIdmApi().get(urlString);\n}\n\n/**\n * Get IDM config entities by type\n * @param {String} type the desired type of config entity\n * @returns {Promise} a promise that resolves to an object containing all IDM config entities of the desired type\n */\nexport async function getConfigEntitiesByType(type) {\n const urlString = util.format(\n idmConfigEntityQueryTemplate,\n getTenantURL(storage.session.getTenant()),\n encodeURIComponent(`_id sw '${type}'`)\n );\n return generateIdmApi().get(urlString);\n}\n\n/**\n * Get an IDM config entity\n * @param {String} id the desired config entity\n * @returns {Promise} a promise that resolves to an object containing an IDM config entity\n */\nexport async function getConfigEntity(id) {\n const urlString = util.format(\n idmConfigURLTemplate,\n getTenantURL(storage.session.getTenant()),\n id\n );\n return generateIdmApi().get(urlString);\n}\n\n/**\n * Put IDM config entity\n * @param {String} id config entity id\n * @param {String} data config entity object\n * @returns {Promise} a promise that resolves to an object containing an IDM config entity\n */\nexport async function putConfigEntity(id, data) {\n const urlString = util.format(\n idmConfigURLTemplate,\n getTenantURL(storage.session.getTenant()),\n id\n );\n return generateIdmApi().put(urlString, data);\n}\n\n/**\n * Query managed objects\n * @param {String} type managed object type\n * @param {[String]} fields fields to retrieve\n * @param {String} pageCookie paged results cookie\n * @returns {Promise<{result: any[]; resultCount: number; pagedResultsCookie: any; totalPagedResultsPolicy: string; totalPagedResults: number; remainingPagedResults: number;}>} a promise that resolves to an object containing managed objects of the desired type\n */\nexport async function queryAllManagedObjectsByType(\n type,\n fields,\n pageCookie\n): Promise<{\n result: any[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: string;\n totalPagedResults: number;\n remainingPagedResults: number;\n}> {\n const fieldsParam =\n fields.length > 0 ? `&_fields=${fields.join(',')}` : '&_fields=_id';\n const urlTemplate = pageCookie\n ? `${idmManagedObjectURLTemplate}${fieldsParam}&_pagedResultsCookie=${encodeURIComponent(\n pageCookie\n )}`\n : `${idmManagedObjectURLTemplate}${fieldsParam}`;\n const urlString = util.format(\n urlTemplate,\n getTenantURL(storage.session.getTenant()),\n type\n );\n return generateIdmApi().get(urlString);\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function tail(source: any, cookie: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
+
export declare function getAPIKeys(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
+
export declare function getSources(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
+
export declare function createAPIKeyAndSecret(keyName: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/LogApi.ts"],"names":[],"mappings":"AAUA,wBAAsB,IAAI,CAAC,MAAM,KAAA,EAAE,MAAM,KAAA,oDAUxC;AAED,wBAAsB,UAAU,qDAM/B;AAED,wBAAsB,UAAU,qDAM/B;AAED,wBAAsB,qBAAqB,CAAC,OAAO,KAAA,oDAMlD","file":"LogApi.d.ts","sourcesContent":["import util from 'util';\nimport { generateLogApi, generateLogKeysApi } from './BaseApi';\nimport { getTenantURL } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst logsTailURLTemplate = '%s/monitoring/logs/tail?source=%s';\nconst logsSourcesURLTemplate = '%s/monitoring/logs/sources';\nconst logsCreateAPIKeyAndSecretURLTemplate = '%s/keys?_action=create';\nconst logsGetAPIKeysURLTemplate = '%s/keys';\n\nexport async function tail(source, cookie) {\n let urlString = util.format(\n logsTailURLTemplate,\n getTenantURL(storage.session.getTenant()),\n encodeURIComponent(source)\n );\n if (cookie) {\n urlString += `&_pagedResultsCookie=${encodeURIComponent(cookie)}`;\n }\n return generateLogApi().get(urlString);\n}\n\nexport async function getAPIKeys() {\n const urlString = util.format(\n logsGetAPIKeysURLTemplate,\n getTenantURL(storage.session.getTenant())\n );\n return generateLogKeysApi().get(urlString);\n}\n\nexport async function getSources() {\n const urlString = util.format(\n logsSourcesURLTemplate,\n getTenantURL(storage.session.getTenant())\n );\n return generateLogApi().get(urlString);\n}\n\nexport async function createAPIKeyAndSecret(keyName) {\n const urlString = util.format(\n logsCreateAPIKeyAndSecretURLTemplate,\n getTenantURL(storage.session.getTenant())\n );\n return generateLogKeysApi().post(urlString, { name: keyName });\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get managed object
|
|
3
|
+
* @param {String} id managed object id
|
|
4
|
+
* @returns {Promise} a promise that resolves to an object containing a managed object
|
|
5
|
+
*/
|
|
6
|
+
export declare function getManagedObject(type: any, id: any, fields: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
+
/**
|
|
8
|
+
* Put managed object
|
|
9
|
+
* @param {String} id managed object id
|
|
10
|
+
* @param {String} data managed object
|
|
11
|
+
* @returns {Promise} a promise that resolves to an object containing a managed object
|
|
12
|
+
*/
|
|
13
|
+
export declare function putManagedObject(type: any, id: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
14
|
+
/**
|
|
15
|
+
* Query managed objects
|
|
16
|
+
* @param {String} type managed object type
|
|
17
|
+
* @param {String} fields fields to retrieve
|
|
18
|
+
* @param {String} pageCookie paged results cookie
|
|
19
|
+
* @returns {Promise} a promise that resolves to an object containing managed objects of the desired type
|
|
20
|
+
*/
|
|
21
|
+
export declare function queryAllManagedObjectsByType(type: any, fields: any, pageCookie: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/ManagedObjectApi.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,KAAA,EAAE,EAAE,KAAA,EAAE,MAAM,KAAA,oDAUtD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,KAAA,EAAE,EAAE,KAAA,EAAE,IAAI,KAAA,oDAQpD;AAED;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,UAAU,KAAA,oDAY1E","file":"ManagedObjectApi.d.ts","sourcesContent":["import util from 'util';\nimport { generateIdmApi } from './BaseApi';\nimport { getTenantURL } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst managedObjectURLTemplate = '%s/openidm/managed/%s';\nconst managedObjectByIdURLTemplate = '%s/openidm/managed/%s/%s';\nconst managedObjectQueryAllURLTemplate = `${managedObjectURLTemplate}?_queryFilter=true&_pageSize=10000`;\n\n/**\n * Get managed object\n * @param {String} id managed object id\n * @returns {Promise} a promise that resolves to an object containing a managed object\n */\nexport async function getManagedObject(type, id, fields) {\n const fieldsParam =\n fields.length > 0 ? `_fields=${fields.join(',')}` : '_fields=*';\n const urlString = util.format(\n `${managedObjectByIdURLTemplate}?${fieldsParam}`,\n getTenantURL(storage.session.getTenant()),\n type,\n id\n );\n return generateIdmApi().get(urlString);\n}\n\n/**\n * Put managed object\n * @param {String} id managed object id\n * @param {String} data managed object\n * @returns {Promise} a promise that resolves to an object containing a managed object\n */\nexport async function putManagedObject(type, id, data) {\n const urlString = util.format(\n managedObjectByIdURLTemplate,\n getTenantURL(storage.session.getTenant()),\n type,\n id\n );\n return generateIdmApi().put(urlString, data);\n}\n\n/**\n * Query managed objects\n * @param {String} type managed object type\n * @param {String} fields fields to retrieve\n * @param {String} pageCookie paged results cookie\n * @returns {Promise} a promise that resolves to an object containing managed objects of the desired type\n */\nexport async function queryAllManagedObjectsByType(type, fields, pageCookie) {\n const fieldsParam =\n fields.length > 0 ? `&_fields=${fields.join(',')}` : '&_fields=_id';\n const urlTemplate = pageCookie\n ? `${managedObjectQueryAllURLTemplate}${fieldsParam}&_pagedResultsCookie=${pageCookie}`\n : `${managedObjectQueryAllURLTemplate}${fieldsParam}`;\n const urlString = util.format(\n urlTemplate,\n getTenantURL(storage.session.getTenant()),\n type\n );\n return generateIdmApi().get(urlString);\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get all node types
|
|
3
|
+
* @returns {Promise} a promise that resolves to an array of node type objects
|
|
4
|
+
*/
|
|
5
|
+
export declare function getNodeTypes(): Promise<any>;
|
|
6
|
+
/**
|
|
7
|
+
* Get all nodes
|
|
8
|
+
* @returns {Promise} a promise that resolves to an array of node objects
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNodes(): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* Get all nodes by type
|
|
13
|
+
* @param {string} nodeType node type
|
|
14
|
+
* @returns {Promise} a promise that resolves to an array of node objects of the requested type
|
|
15
|
+
*/
|
|
16
|
+
export declare function getNodesByType(nodeType: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Get node by uuid and type
|
|
19
|
+
* @param {String} nodeId node uuid
|
|
20
|
+
* @param {String} nodeType node type
|
|
21
|
+
* @returns {Promise} a promise that resolves to a node object
|
|
22
|
+
*/
|
|
23
|
+
export declare function getNode(nodeId: string, nodeType: string): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Put node by uuid and type
|
|
26
|
+
* @param {String} nodeId node uuid
|
|
27
|
+
* @param {String} nodeType node type
|
|
28
|
+
* @param {Object} nodeData node object
|
|
29
|
+
* @returns {Promise} a promise that resolves to an object containing a node object
|
|
30
|
+
*/
|
|
31
|
+
export declare function putNode(nodeId: string, nodeType: string, nodeData: any): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete node by uuid and type
|
|
34
|
+
* @param {String} nodeId node uuid
|
|
35
|
+
* @param {String} nodeType node type
|
|
36
|
+
* @returns {Promise} a promise that resolves to an object containing a node object
|
|
37
|
+
*/
|
|
38
|
+
export declare function deleteNode(nodeId: string, nodeType: string): Promise<any>;
|