@rockcarver/frodo-lib 0.12.0 → 0.12.2-0
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 +22 -2
- package/cjs/api/AuthenticateApi.js +44 -14
- package/cjs/api/AuthenticateApi.js.map +1 -1
- package/cjs/api/BaseApi.js +171 -90
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/api/CirclesOfTrustApi.js +87 -31
- package/cjs/api/CirclesOfTrustApi.js.map +1 -1
- package/cjs/api/EmailTemplateApi.js +48 -9
- package/cjs/api/EmailTemplateApi.js.map +1 -1
- package/cjs/api/IdmConfigApi.js +91 -25
- package/cjs/api/IdmConfigApi.js.map +1 -1
- package/cjs/api/LogApi.js +84 -29
- package/cjs/api/LogApi.js.map +1 -1
- package/cjs/api/ManagedObjectApi.js +66 -19
- package/cjs/api/ManagedObjectApi.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 +73 -27
- package/cjs/api/OAuth2ClientApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.js +82 -31
- package/cjs/api/OAuth2OIDCApi.js.map +1 -1
- package/cjs/api/OAuth2ProviderApi.js +39 -14
- package/cjs/api/OAuth2ProviderApi.js.map +1 -1
- package/cjs/api/RealmApi.js +100 -36
- package/cjs/api/RealmApi.js.map +1 -1
- package/cjs/api/Saml2Api.js +162 -74
- package/cjs/api/Saml2Api.js.map +1 -1
- package/cjs/api/ScriptApi.js +84 -29
- package/cjs/api/ScriptApi.js.map +1 -1
- package/cjs/api/SecretsApi.js +188 -69
- package/cjs/api/SecretsApi.js.map +1 -1
- package/cjs/api/ServerInfoApi.js +48 -14
- package/cjs/api/ServerInfoApi.js.map +1 -1
- package/cjs/api/SocialIdentityProvidersApi.js +103 -37
- package/cjs/api/SocialIdentityProvidersApi.js.map +1 -1
- package/cjs/api/StartupApi.js +74 -26
- package/cjs/api/StartupApi.js.map +1 -1
- package/cjs/api/StartupApi.test.js.map +1 -0
- package/cjs/api/ThemeApi.js +188 -96
- package/cjs/api/ThemeApi.js.map +1 -1
- package/cjs/api/TreeApi.js +96 -113
- package/cjs/api/TreeApi.js.map +1 -1
- package/cjs/api/TreeApi.test.js.map +1 -0
- package/cjs/api/VariablesApi.js +106 -39
- package/cjs/api/VariablesApi.js.map +1 -1
- package/cjs/api/utils/ApiUtils.js +41 -21
- package/cjs/api/utils/ApiUtils.js.map +1 -1
- package/cjs/api/utils/ApiUtils.test.js.map +1 -1
- package/cjs/api/utils/Base64.js +35 -10
- package/cjs/api/utils/Base64.js.map +1 -1
- package/cjs/index.js +126 -41
- package/cjs/index.js.map +1 -1
- package/cjs/index.test.js.map +1 -1
- package/cjs/ops/AdminOps.js +649 -480
- package/cjs/ops/AdminOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +302 -211
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.test.js.map +1 -1
- package/cjs/ops/CirclesOfTrustOps.js +356 -219
- package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +200 -122
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.test.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.js +301 -192
- package/cjs/ops/EmailTemplateOps.js.map +1 -1
- package/cjs/ops/IdmOps.js +190 -121
- package/cjs/ops/IdmOps.js.map +1 -1
- package/cjs/ops/IdpOps.js +327 -196
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/JourneyOps.js +1402 -1131
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/LogOps.js +125 -75
- package/cjs/ops/LogOps.js.map +1 -1
- package/cjs/ops/ManagedObjectOps.js +43 -16
- package/cjs/ops/ManagedObjectOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +155 -87
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/OrganizationOps.js +89 -56
- package/cjs/ops/OrganizationOps.js.map +1 -1
- package/cjs/ops/RealmOps.js +131 -83
- package/cjs/ops/RealmOps.js.map +1 -1
- package/cjs/ops/SamlOps.js +497 -331
- package/cjs/ops/SamlOps.js.map +1 -1
- package/cjs/ops/ScriptOps.js +215 -133
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/SecretsOps.js +269 -156
- package/cjs/ops/SecretsOps.js.map +1 -1
- package/cjs/ops/StartupOps.js +100 -75
- package/cjs/ops/StartupOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +373 -221
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/VariablesOps.js +168 -90
- package/cjs/ops/VariablesOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +68 -33
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/DataProtection.js +100 -64
- package/cjs/ops/utils/DataProtection.js.map +1 -1
- package/cjs/ops/utils/DataProtection.test.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +86 -47
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.test.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.js +47 -20
- package/cjs/ops/utils/OpsUtils.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.js +10 -2
- package/cjs/ops/utils/Wordwrap.js.map +1 -1
- package/cjs/storage/SessionStorage.js +20 -8
- package/cjs/storage/SessionStorage.js.map +1 -1
- package/cjs/storage/StaticStorage.js +26 -10
- package/cjs/storage/StaticStorage.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/StartupApi.mjs +18 -8
- package/esm/api/StartupApi.test.mjs +56 -0
- package/esm/api/TreeApi.mjs +27 -99
- package/esm/api/TreeApi.test.mjs +175 -0
- package/esm/index.mjs +7 -5
- package/esm/ops/IdpOps.mjs +1 -1
- package/esm/ops/JourneyOps.mjs +165 -154
- package/esm/ops/StartupOps.mjs +59 -62
- package/esm/ops/utils/Console.mjs +3 -2
- 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 +145 -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
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()).data.result;
|
|
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()).data.result.filter(secret => !secret.loaded);
|
|
24
|
+
updates.variables = (await getVariables()).data.result.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
|
|
@@ -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') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-lib",
|
|
3
|
-
"version": "0.12.0",
|
|
3
|
+
"version": "0.12.2-0",
|
|
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/NodeApi.ts"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,wBAAsB,YAAY,iBAejC;AAED;;;GAGG;AACH,wBAAsB,QAAQ,iBAe7B;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,gBAWpD;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAY7D;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,KAAA,gBAmBvE;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAYhE","file":"NodeApi.d.ts","sourcesContent":["import util from 'util';\nimport { deleteDeepByKey, getCurrentRealmPath } from './utils/ApiUtils';\nimport { generateAmApi } from './BaseApi';\nimport storage from '../storage/SessionStorage';\n\nconst queryAllNodeTypesURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=getAllTypes';\nconst queryAllNodesByTypeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_queryFilter=true';\nconst queryAllNodesURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=nextdescendents';\nconst nodeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s/%s';\n\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getNodeApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/authentication/authenticationtrees`,\n apiVersion,\n };\n};\n\n/**\n * Get all node types\n * @returns {Promise} a promise that resolves to an array of node type objects\n */\nexport async function getNodeTypes() {\n const urlString = util.format(\n queryAllNodeTypesURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const response = await generateAmApi(getNodeApiConfig()).post(\n urlString,\n {},\n {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n }\n );\n return response.data.result;\n}\n\n/**\n * Get all nodes\n * @returns {Promise} a promise that resolves to an array of node objects\n */\nexport async function getNodes() {\n const urlString = util.format(\n queryAllNodesURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const response = await generateAmApi(getNodeApiConfig()).post(\n urlString,\n {},\n {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n }\n );\n return response.data.result;\n}\n\n/**\n * Get all nodes by type\n * @param {string} nodeType node type\n * @returns {Promise} a promise that resolves to an array of node objects of the requested type\n */\nexport async function getNodesByType(nodeType: string) {\n const urlString = util.format(\n queryAllNodesByTypeURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n nodeType\n );\n const response = await generateAmApi(getNodeApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return response.data.result;\n}\n\n/**\n * Get node by uuid and type\n * @param {String} nodeId node uuid\n * @param {String} nodeType node type\n * @returns {Promise} a promise that resolves to a node object\n */\nexport async function getNode(nodeId: string, nodeType: string) {\n const urlString = util.format(\n nodeURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi(getNodeApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Put node by uuid and type\n * @param {String} nodeId node uuid\n * @param {String} nodeType node type\n * @param {Object} nodeData node object\n * @returns {Promise} a promise that resolves to an object containing a node object\n */\nexport async function putNode(nodeId: string, nodeType: string, nodeData) {\n // until we figure out a way to use transport keys in Frodo,\n // we'll have to drop those encrypted attributes.\n const cleanData = deleteDeepByKey(nodeData, '-encrypted');\n const urlString = util.format(\n nodeURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi(getNodeApiConfig()).put(\n urlString,\n cleanData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Delete node by uuid and type\n * @param {String} nodeId node uuid\n * @param {String} nodeType node type\n * @returns {Promise} a promise that resolves to an object containing a node object\n */\nexport async function deleteNode(nodeId: string, nodeType: string) {\n const urlString = util.format(\n nodeURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi(getNodeApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get OAuth2 Clients
|
|
3
|
+
* @returns {Promise} a promise that resolves to an object containing an array of oauth2client objects
|
|
4
|
+
*/
|
|
5
|
+
export declare function getOAuth2Clients(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
+
/**
|
|
7
|
+
* Get OAuth2 Client
|
|
8
|
+
* @param {String} id client id
|
|
9
|
+
* @returns {Promise} a promise that resolves to an object containing an oauth2client object
|
|
10
|
+
*/
|
|
11
|
+
export declare function getOAuth2Client(id: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Put OAuth2 Client
|
|
14
|
+
* @param {String} id client id
|
|
15
|
+
* @param {Object} data oauth2client object
|
|
16
|
+
* @returns {Promise} a promise that resolves to an object containing an oauth2client object
|
|
17
|
+
*/
|
|
18
|
+
export declare function putOAuth2Client(id: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/OAuth2ClientApi.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,wBAAsB,gBAAgB,qDASrC;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EAAE,KAAA,oDAUvC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA,oDAa7C","file":"OAuth2ClientApi.d.ts","sourcesContent":["import util from 'util';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst oauth2ClientURLTemplate = '%s/json%s/realm-config/agents/OAuth2Client/%s';\nconst oauth2ClientListURLTemplate =\n '%s/json%s/realm-config/agents/OAuth2Client?_queryFilter=true';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/agents/OAuth2Client`,\n apiVersion,\n };\n};\n\n/**\n * Get OAuth2 Clients\n * @returns {Promise} a promise that resolves to an object containing an array of oauth2client objects\n */\nexport async function getOAuth2Clients() {\n const urlString = util.format(\n oauth2ClientListURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n return generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n}\n\n/**\n * Get OAuth2 Client\n * @param {String} id client id\n * @returns {Promise} a promise that resolves to an object containing an oauth2client object\n */\nexport async function getOAuth2Client(id) {\n const urlString = util.format(\n oauth2ClientURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n id\n );\n return generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n}\n\n/**\n * Put OAuth2 Client\n * @param {String} id client id\n * @param {Object} data oauth2client object\n * @returns {Promise} a promise that resolves to an object containing an oauth2client object\n */\nexport async function putOAuth2Client(id, data) {\n const client = data;\n delete client._provider;\n delete client._rev;\n const urlString = util.format(\n oauth2ClientURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n id\n );\n return generateAmApi(getApiConfig()).put(urlString, client, {\n withCredentials: true,\n });\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform the authorization step of the authorization code grant flow
|
|
3
|
+
* @param {String} data body form data
|
|
4
|
+
* @param {Object} config axios request config object
|
|
5
|
+
* @returns {Promise} a promise resolving to an object containing the authorization server response object
|
|
6
|
+
*/
|
|
7
|
+
export declare function authorize(data: any, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
|
+
/**
|
|
9
|
+
* Perform access token request step of the authorization code grant flow
|
|
10
|
+
* @param {*} data body form data
|
|
11
|
+
* @param {*} config config axios request config object
|
|
12
|
+
* @returns {Promise} a promise resolving to an object containing the authorization server response object containing the access token
|
|
13
|
+
*/
|
|
14
|
+
export declare function accessToken(data: any, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
+
/**
|
|
16
|
+
* Perform client credentials grant flow
|
|
17
|
+
* @param {String} clientId client id
|
|
18
|
+
* @param {String} clientSecret client secret
|
|
19
|
+
* @param {String} scope space-delimited scope list
|
|
20
|
+
* @returns {Promise} a promise resolving to an object containing the authorization server response object
|
|
21
|
+
*/
|
|
22
|
+
export declare function clientCredentialsGrant(clientId: any, clientSecret: any, scope: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/OAuth2OIDCApi.ts"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,IAAI,KAAA,EAAE,MAAM,KAAK,oDAOhD;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,KAAA,EAAE,MAAM,KAAK,oDAOlD;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,KAAA,EAAE,YAAY,KAAA,EAAE,KAAK,KAAA,oDAqBzE","file":"OAuth2OIDCApi.d.ts","sourcesContent":["import util from 'util';\nimport qs from 'qs';\nimport { generateOauth2Api } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\nimport { encode } from './utils/Base64';\n\nconst authorizeUrlTemplate = '%s/oauth2%s/authorize';\nconst accessTokenUrlTemplate = '%s/oauth2%s/access_token';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => ({\n apiVersion,\n});\n\n/**\n * Perform the authorization step of the authorization code grant flow\n * @param {String} data body form data\n * @param {Object} config axios request config object\n * @returns {Promise} a promise resolving to an object containing the authorization server response object\n */\nexport async function authorize(data, config = {}) {\n const authorizeURL = util.format(\n authorizeUrlTemplate,\n storage.session.getTenant(),\n ''\n );\n return generateOauth2Api(getApiConfig()).post(authorizeURL, data, config);\n}\n\n/**\n * Perform access token request step of the authorization code grant flow\n * @param {*} data body form data\n * @param {*} config config axios request config object\n * @returns {Promise} a promise resolving to an object containing the authorization server response object containing the access token\n */\nexport async function accessToken(data, config = {}) {\n const accessTokenURL = util.format(\n accessTokenUrlTemplate,\n storage.session.getTenant(),\n ''\n );\n return generateOauth2Api(getApiConfig()).post(accessTokenURL, data, config);\n}\n\n/**\n * Perform client credentials grant flow\n * @param {String} clientId client id\n * @param {String} clientSecret client secret\n * @param {String} scope space-delimited scope list\n * @returns {Promise} a promise resolving to an object containing the authorization server response object\n */\nexport async function clientCredentialsGrant(clientId, clientSecret, scope) {\n const urlString = util.format(\n accessTokenUrlTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const requestOverride = {\n headers: {\n Authorization: `Basic ${encode(`${clientId}:${clientSecret}`)}`,\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n };\n const requestBody = {\n grant_type: 'client_credentials',\n scope,\n };\n return generateOauth2Api(getApiConfig(), requestOverride).post(\n urlString,\n qs.stringify(requestBody),\n { withCredentials: true }\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/OAuth2ProviderApi.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,wBAAsB,iBAAiB,qDAStC","file":"OAuth2ProviderApi.d.ts","sourcesContent":["import util from 'util';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst oauthProviderServiceURLTemplate =\n '%s/json%s/realm-config/services/oauth-oidc';\n\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/authentication/authenticationtrees`,\n apiVersion,\n };\n};\n\n/**\n * Get OAuth2 Provider\n * @returns {Promise} a promise that resolves to an object containing an OAuth2Provider object\n */\nexport async function getOAuth2Provider() {\n const urlString = util.format(\n oauthProviderServiceURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n return generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get all realms
|
|
3
|
+
* @returns {Promise} a promise that resolves to an object containing an array of realm objects
|
|
4
|
+
*/
|
|
5
|
+
export declare function getRealms(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
+
/**
|
|
7
|
+
* Get realm by id
|
|
8
|
+
* @param {String} id realm id
|
|
9
|
+
* @returns {Promise} a promise that resolves to an object containing a realm object
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRealm(id: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get realm by name
|
|
14
|
+
* @param {String} name realm name
|
|
15
|
+
* @returns {Promise} a promise that resolves to a realm object
|
|
16
|
+
*/
|
|
17
|
+
export declare function getRealmByName(name: any): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Put realm
|
|
20
|
+
* @param {String} id realm id
|
|
21
|
+
* @param {Object} data realm config object
|
|
22
|
+
* @returns {Promise} a promise that resolves to an object containing a realm object
|
|
23
|
+
*/
|
|
24
|
+
export declare function putRealm(id: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete realm
|
|
27
|
+
* @param {String} id realm id
|
|
28
|
+
* @returns {Promise} a promise that resolves to an object containing a realm object
|
|
29
|
+
*/
|
|
30
|
+
export declare function deleteRealm(id: any): Promise<import("axios").AxiosResponse<any, any>>;
|