@rockcarver/frodo-lib 2.0.0-47 → 2.0.0-49
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/build.zip +0 -0
- package/cjs/api/AuthenticationSettingsApi.js.map +1 -1
- package/cjs/api/ScriptApi.js +74 -2
- package/cjs/api/ScriptApi.js.map +1 -1
- package/cjs/lib/FrodoLib.js +3 -1
- package/cjs/lib/FrodoLib.js.map +1 -1
- package/cjs/ops/AuthenticationSettingsOps.js +12 -35
- package/cjs/ops/AuthenticationSettingsOps.js.map +1 -1
- package/cjs/ops/ManagedObjectOps.js +84 -0
- package/cjs/ops/ManagedObjectOps.js.map +1 -1
- package/cjs/ops/ScriptOps.js +71 -15
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/ScriptOps.test.js +40 -0
- package/cjs/ops/ScriptOps.test.js.map +1 -1
- package/cjs/utils/ExportImportUtils.js +3 -1
- package/cjs/utils/ExportImportUtils.js.map +1 -1
- package/esm/api/AuthenticationSettingsApi.js.map +1 -1
- package/esm/api/ScriptApi.js +60 -2
- package/esm/api/ScriptApi.js.map +1 -1
- package/esm/lib/FrodoLib.js +3 -1
- package/esm/lib/FrodoLib.js.map +1 -1
- package/esm/ops/AuthenticationSettingsOps.js +6 -22
- package/esm/ops/AuthenticationSettingsOps.js.map +1 -1
- package/esm/ops/ManagedObjectOps.js +73 -0
- package/esm/ops/ManagedObjectOps.js.map +1 -1
- package/esm/ops/ScriptOps.js +39 -1
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/ScriptOps.test.js +40 -0
- package/esm/ops/ScriptOps.test.js.map +1 -1
- package/esm/utils/ExportImportUtils.js +3 -1
- package/esm/utils/ExportImportUtils.js.map +1 -1
- package/package.json +1 -1
- package/types/api/AuthenticationSettingsApi.d.ts +2 -2
- package/types/api/AuthenticationSettingsApi.d.ts.map +1 -1
- package/types/api/ScriptApi.d.ts +19 -3
- package/types/api/ScriptApi.d.ts.map +1 -1
- package/types/lib/FrodoLib.d.ts +2 -0
- package/types/lib/FrodoLib.d.ts.map +1 -1
- package/types/ops/AuthenticationSettingsOps.d.ts +2 -9
- package/types/ops/AuthenticationSettingsOps.d.ts.map +1 -1
- package/types/ops/ManagedObjectOps.d.ts +10 -0
- package/types/ops/ManagedObjectOps.d.ts.map +1 -1
- package/types/ops/ScriptOps.d.ts +27 -0
- package/types/ops/ScriptOps.d.ts.map +1 -1
- package/types/utils/ExportImportUtils.d.ts.map +1 -1
- /package/cjs/test/mocks/Saml2Ops/importSaml2Provider/{urn:federation:MicrosoftOnline.saml.json → urnfederationMicrosoftOnline.saml.json} +0 -0
- /package/esm/test/mocks/Saml2Ops/importSaml2Provider/{urn:federation:MicrosoftOnline.saml.json → urnfederationMicrosoftOnline.saml.json} +0 -0
package/build.zip
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationSettingsApi.js","names":["_util","_interopRequireDefault","require","_Console","_ForgeRockUtils","_BaseApi","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","authenticationSettingsURLTemplate","apiVersion","getApiConfig","getAuthenticationSettings","_x","_getAuthenticationSettings","_ref","state","debugMessage","message","urlString","util","format","getHost","getCurrentRealmPath","data","generateAmApi","resource","get","withCredentials","putAuthenticationSettings","_x2","_putAuthenticationSettings","_ref2","settings","put"],"sources":["../../src/api/AuthenticationSettingsApi.ts"],"sourcesContent":["import util from 'util';\n\nimport { State } from '../shared/State';\nimport { debugMessage } from '../utils/Console';\nimport { getCurrentRealmPath } from '../utils/ForgeRockUtils';\nimport { type IdObjectSkeletonInterface } from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\n\nconst authenticationSettingsURLTemplate =\n '%s/json%s/realm-config/authentication';\nconst apiVersion = 'resource=1.0';\nconst getApiConfig = () => {\n return {\n apiVersion,\n };\n};\n\nexport type AuthenticationSettingsSkeleton = IdObjectSkeletonInterface & {\n _id: '';\n _type: {\n _id: 'EMPTY';\n name: 'Core';\n collection: false;\n };\n};\n\n/**\n * Get authentication settings\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves to an authentication settings object\n */\nexport async function getAuthenticationSettings({
|
|
1
|
+
{"version":3,"file":"AuthenticationSettingsApi.js","names":["_util","_interopRequireDefault","require","_Console","_ForgeRockUtils","_BaseApi","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","authenticationSettingsURLTemplate","apiVersion","getApiConfig","getAuthenticationSettings","_x","_getAuthenticationSettings","_ref","state","debugMessage","message","urlString","util","format","getHost","getCurrentRealmPath","data","generateAmApi","resource","get","withCredentials","putAuthenticationSettings","_x2","_putAuthenticationSettings","_ref2","settings","put"],"sources":["../../src/api/AuthenticationSettingsApi.ts"],"sourcesContent":["import util from 'util';\n\nimport { State } from '../shared/State';\nimport { debugMessage } from '../utils/Console';\nimport { getCurrentRealmPath } from '../utils/ForgeRockUtils';\nimport { type IdObjectSkeletonInterface } from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\n\nconst authenticationSettingsURLTemplate =\n '%s/json%s/realm-config/authentication';\nconst apiVersion = 'resource=1.0';\nconst getApiConfig = () => {\n return {\n apiVersion,\n };\n};\n\nexport type AuthenticationSettingsSkeleton = IdObjectSkeletonInterface & {\n _id: '';\n _type: {\n _id: 'EMPTY';\n name: 'Core';\n collection: false;\n };\n};\n\n/**\n * Get authentication settings\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves to an authentication settings object\n */\nexport async function getAuthenticationSettings({\n state,\n}: {\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n debugMessage({\n message: `AuthenticationSettingsApi.getAuthenticationSettings: start`,\n state,\n });\n const urlString = util.format(\n authenticationSettingsURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get(\n urlString,\n {\n withCredentials: true,\n }\n );\n debugMessage({\n message: `AuthenticationSettingsApi.getAuthenticationSettings: end`,\n state,\n });\n return data;\n}\n\n/**\n * Put authentiction settings\n * @param {AuthenticationSettingsSkeleton} settings authentiction settings object\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves to an authentiction settings object\n */\nexport async function putAuthenticationSettings({\n settings,\n state,\n}: {\n settings: AuthenticationSettingsSkeleton;\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n debugMessage({\n message: `AuthenticationSettingsApi.putAuthenticationSettings: start`,\n state,\n });\n const urlString = util.format(\n authenticationSettingsURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).put(\n urlString,\n settings,\n {\n withCredentials: true,\n }\n );\n debugMessage({\n message: `AuthenticationSettingsApi.putAuthenticationSettings: end`,\n state,\n });\n return data;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwB,IAAAC,QAAA,GAAAD,OAAA;AAAA,IAAAE,eAAA,GAAAF,OAAA;AAAA,IAAAG,QAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,CAAAV,OAAA,CAAAO,KAAA,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C3ER,SAAS,EACT;MACES,eAAe,EAAE;IACnB,CACF,CAAC;IACD,IAAAX,qBAAY,EAAC;MACXC,OAAO,4DAA4D;MACnEF;IACF,CAAC,CAAC;IACF,OAAOQ,IAAI;EACb,CAAC;EAAA,OAAAV,0BAAA,CAAAR,KAAA,OAAAD,SAAA;AAAA;AAAA,SAOqBwB,yBAAyBA,CAAAC,GAAA;EAAA,OAAAC,0BAAA,CAAAzB,KAAA,OAAAD,SAAA;AAAA;AAAA,SAAA0B,2BAAA;EAAAA,0BAAA,GAAA9B,iBAAA,CAAxC,WAAA+B,KAAA,EAMqC;IAAA,IANI;MAC9CC,QAAQ;MACRjB;IAIF,CAAC,GAAAgB,KAAA;IACC,IAAAf,qBAAY,EAAC;MACXC,OAAO,8DAA8D;MACrEF;IACF,CAAC,CAAC;IACF,IAAMG,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BZ,iCAAiC,EACjCO,KAAK,CAACM,OAAO,CAAC,CAAC,EACf,IAAAC,mCAAmB,EAACP,KAAK,CAC3B,CAAC;IACD,IAAM;MAAEQ;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAAC;MAAEC,QAAQ,EAAEf,YAAY,CAAC,CAAC;MAAEK;IAAM,CAAC,CAAC,CAACkB,GAAG,CAC3Ef,SAAS,EACTc,QAAQ,EACR;MACEL,eAAe,EAAE;IACnB,CACF,CAAC;IACD,IAAAX,qBAAY,EAAC;MACXC,OAAO,4DAA4D;MACnEF;IACF,CAAC,CAAC;IACF,OAAOQ,IAAI;EACb,CAAC;EAAA,OAAAO,0BAAA,CAAAzB,KAAA,OAAAD,SAAA;AAAA"}
|
package/cjs/api/ScriptApi.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deleteScript = deleteScript;
|
|
7
|
+
exports.deleteScriptByName = deleteScriptByName;
|
|
8
|
+
exports.deleteScripts = deleteScripts;
|
|
7
9
|
exports.getScript = getScript;
|
|
8
10
|
exports.getScriptByName = getScriptByName;
|
|
9
11
|
exports.getScripts = getScripts;
|
|
@@ -113,8 +115,8 @@ function putScript(_x4) {
|
|
|
113
115
|
}
|
|
114
116
|
/**
|
|
115
117
|
* Delete script by id
|
|
116
|
-
* @param {String} scriptId script uuid
|
|
117
|
-
* @returns {Promise} a promise that resolves to a script object
|
|
118
|
+
* @param {String} scriptId script uuid
|
|
119
|
+
* @returns {Promise<ScriptSkeleton>>} a promise that resolves to a script object
|
|
118
120
|
*/
|
|
119
121
|
function _putScript() {
|
|
120
122
|
_putScript = _asyncToGenerator(function* (_ref4) {
|
|
@@ -139,6 +141,11 @@ function _putScript() {
|
|
|
139
141
|
function deleteScript(_x5) {
|
|
140
142
|
return _deleteScript.apply(this, arguments);
|
|
141
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Delete script by name
|
|
146
|
+
* @param {String} scriptId script name
|
|
147
|
+
* @returns {Promise<ScriptSkeleton>} a promise that resolves to a script object
|
|
148
|
+
*/
|
|
142
149
|
function _deleteScript() {
|
|
143
150
|
_deleteScript = _asyncToGenerator(function* (_ref5) {
|
|
144
151
|
var {
|
|
@@ -158,4 +165,69 @@ function _deleteScript() {
|
|
|
158
165
|
});
|
|
159
166
|
return _deleteScript.apply(this, arguments);
|
|
160
167
|
}
|
|
168
|
+
function deleteScriptByName(_x6) {
|
|
169
|
+
return _deleteScriptByName.apply(this, arguments);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Delete all non-default scripts
|
|
173
|
+
* @returns {Promise<ScriptSkeleton[]>>} a promise that resolves to an array of script objects
|
|
174
|
+
*/
|
|
175
|
+
function _deleteScriptByName() {
|
|
176
|
+
_deleteScriptByName = _asyncToGenerator(function* (_ref6) {
|
|
177
|
+
var {
|
|
178
|
+
scriptName,
|
|
179
|
+
state
|
|
180
|
+
} = _ref6;
|
|
181
|
+
var {
|
|
182
|
+
result
|
|
183
|
+
} = yield getScriptByName({
|
|
184
|
+
scriptName,
|
|
185
|
+
state
|
|
186
|
+
});
|
|
187
|
+
if (!result[0]) {
|
|
188
|
+
throw new Error("Script with name ".concat(scriptName, " does not exist."));
|
|
189
|
+
}
|
|
190
|
+
var scriptId = result[0]._id;
|
|
191
|
+
return deleteScript({
|
|
192
|
+
scriptId,
|
|
193
|
+
state
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
return _deleteScriptByName.apply(this, arguments);
|
|
197
|
+
}
|
|
198
|
+
function deleteScripts(_x7) {
|
|
199
|
+
return _deleteScripts.apply(this, arguments);
|
|
200
|
+
}
|
|
201
|
+
function _deleteScripts() {
|
|
202
|
+
_deleteScripts = _asyncToGenerator(function* (_ref7) {
|
|
203
|
+
var {
|
|
204
|
+
state
|
|
205
|
+
} = _ref7;
|
|
206
|
+
var {
|
|
207
|
+
result
|
|
208
|
+
} = yield getScripts({
|
|
209
|
+
state
|
|
210
|
+
});
|
|
211
|
+
//Unable to delete default scripts, so filter them out
|
|
212
|
+
var scripts = result.filter(s => !s.default);
|
|
213
|
+
var deletedScripts = [];
|
|
214
|
+
var errors = [];
|
|
215
|
+
for (var script of scripts) {
|
|
216
|
+
try {
|
|
217
|
+
deletedScripts.push(yield deleteScript({
|
|
218
|
+
scriptId: script._id,
|
|
219
|
+
state
|
|
220
|
+
}));
|
|
221
|
+
} catch (error) {
|
|
222
|
+
errors.push(error);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (errors.length) {
|
|
226
|
+
var errorMessages = errors.map(error => error.message).join('\n');
|
|
227
|
+
throw new Error("Delete error:\n".concat(errorMessages));
|
|
228
|
+
}
|
|
229
|
+
return deletedScripts;
|
|
230
|
+
});
|
|
231
|
+
return _deleteScripts.apply(this, arguments);
|
|
232
|
+
}
|
|
161
233
|
//# sourceMappingURL=ScriptApi.js.map
|
package/cjs/api/ScriptApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptApi.js","names":["_util","_interopRequireDefault","require","_ForgeRockUtils","_BaseApi","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","scriptURLTemplate","scriptListURLTemplate","scriptQueryURLTemplate","apiVersion","getApiConfig","getScripts","_x","_getScripts","_ref","state","urlString","util","format","getHost","getCurrentRealmPath","data","generateAmApi","resource","get","withCredentials","getScriptByName","_x2","_getScriptByName","_ref2","scriptName","encodeURIComponent","getScript","_x3","_getScript","_ref3","scriptId","putScript","_x4","_putScript","_ref4","scriptData","put","deleteScript","_x5","_deleteScript","_ref5","delete"],"sources":["../../src/api/ScriptApi.ts"],"sourcesContent":["import util from 'util';\n\nimport { State } from '../shared/State';\nimport { getCurrentRealmPath } from '../utils/ForgeRockUtils';\nimport { type IdObjectSkeletonInterface, type PagedResult } from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\n\nconst scriptURLTemplate = '%s/json%s/scripts/%s';\nconst scriptListURLTemplate = '%s/json%s/scripts?_queryFilter=true';\nconst scriptQueryURLTemplate =\n '%s/json%s/scripts?_queryFilter=name+eq+%%22%s%%22';\nconst apiVersion = 'protocol=2.0,resource=1.0';\nconst getApiConfig = () => {\n return {\n apiVersion,\n };\n};\n\nexport type ScriptLanguage = 'GROOVY' | 'JAVASCRIPT';\n\nexport type ScriptContext =\n | 'OAUTH2_ACCESS_TOKEN_MODIFICATION'\n | 'AUTHENTICATION_CLIENT_SIDE'\n | 'AUTHENTICATION_TREE_DECISION_NODE'\n | 'AUTHENTICATION_SERVER_SIDE'\n | 'SOCIAL_IDP_PROFILE_TRANSFORMATION'\n | 'OAUTH2_VALIDATE_SCOPE'\n | 'CONFIG_PROVIDER_NODE'\n | 'OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER'\n | 'OAUTH2_EVALUATE_SCOPE'\n | 'POLICY_CONDITION'\n | 'OIDC_CLAIMS'\n | 'SAML2_IDP_ADAPTER'\n | 'SAML2_IDP_ATTRIBUTE_MAPPER'\n | 'OAUTH2_MAY_ACT';\n\nexport type ScriptSkeleton = IdObjectSkeletonInterface & {\n name: string;\n description: string;\n default: boolean;\n script: string | string[];\n language: ScriptLanguage;\n context: ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\n/**\n * Get all scripts\n * @returns {Promise} a promise that resolves to an object containing an array of script objects\n */\nexport async function getScripts({\n state,\n}: {\n state: State;\n}): Promise<PagedResult<ScriptSkeleton>> {\n const urlString = util.format(\n scriptListURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get<\n PagedResult<ScriptSkeleton>\n >(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get script by name\n * @param {String} scriptName script name\n * @returns {Promise} a promise that resolves to an object containing a script object\n */\nexport async function getScriptByName({\n scriptName,\n state,\n}: {\n scriptName: string;\n state: State;\n}): Promise<PagedResult<ScriptSkeleton>> {\n const urlString = util.format(\n scriptQueryURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n encodeURIComponent(scriptName)\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get<\n PagedResult<ScriptSkeleton>\n >(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get script by id\n * @param {String} scriptId script uuid/name\n * @returns {Promise} a promise that resolves to a script object\n */\nexport async function getScript({\n scriptId,\n state,\n}: {\n scriptId: string;\n state: State;\n}) {\n const urlString = util.format(\n scriptURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n scriptId\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get(\n urlString,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Put script\n * @param {string} scriptId script uuid\n * @param {Object} scriptData script object\n * @returns {Promise} a promise that resolves to an object containing a script object\n */\nexport async function putScript({\n scriptId,\n scriptData,\n state,\n}: {\n scriptId: string;\n scriptData: ScriptSkeleton;\n state: State;\n}) {\n const urlString = util.format(\n scriptURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n scriptId\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).put(\n urlString,\n scriptData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Delete script by id\n * @param {String} scriptId script uuid/name\n * @returns {Promise} a promise that resolves to a script object\n */\nexport async function deleteScript({\n scriptId,\n state,\n}: {\n scriptId: string;\n state: State;\n}) {\n const urlString = util.format(\n scriptURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n scriptId\n );\n const { data } = await generateAmApi({\n resource: getApiConfig(),\n state,\n }).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwB,IAAAC,eAAA,GAAAD,OAAA;AAAA,IAAAE,QAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,CAAAV,OAAA,CAAAO,KAAA,EAAAI,IAAA,CAAAT,KAAA,EAAAC,MAAA;AAAA,SAAAS,kBAAAC,EAAA,6BAAAC,IAAA,SAAAC,IAAA,GAAAC,SAAA,aAAAN,OAAA,WAAAV,OAAA,EAAAC,MAAA,QAAAF,GAAA,GAAAc,EAAA,CAAAI,KAAA,CAAAH,I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SAAS,IAAAC,sBAAa,EAAC;MACnCC,QAAQ,EAAEb,YAAY,CAAC,CAAC;MACxBK;IACF,CAAC,CAAC,CAACgC,MAAM,CAAC/B,SAAS,EAAE;MACnBS,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOJ,IAAI;EACb,CAAC;EAAA,OAAAwB,aAAA,CAAA1C,KAAA,OAAAD,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"ScriptApi.js","names":["_util","_interopRequireDefault","require","_ForgeRockUtils","_BaseApi","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","scriptURLTemplate","scriptListURLTemplate","scriptQueryURLTemplate","apiVersion","getApiConfig","getScripts","_x","_getScripts","_ref","state","urlString","util","format","getHost","getCurrentRealmPath","data","generateAmApi","resource","get","withCredentials","getScriptByName","_x2","_getScriptByName","_ref2","scriptName","encodeURIComponent","getScript","_x3","_getScript","_ref3","scriptId","putScript","_x4","_putScript","_ref4","scriptData","put","deleteScript","_x5","_deleteScript","_ref5","delete","deleteScriptByName","_x6","_deleteScriptByName","_ref6","result","Error","concat","_id","deleteScripts","_x7","_deleteScripts","_ref7","scripts","filter","s","deletedScripts","errors","script","push","length","errorMessages","map","message","join"],"sources":["../../src/api/ScriptApi.ts"],"sourcesContent":["import util from 'util';\n\nimport { State } from '../shared/State';\nimport { getCurrentRealmPath } from '../utils/ForgeRockUtils';\nimport { type IdObjectSkeletonInterface, type PagedResult } from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\n\nconst scriptURLTemplate = '%s/json%s/scripts/%s';\nconst scriptListURLTemplate = '%s/json%s/scripts?_queryFilter=true';\nconst scriptQueryURLTemplate =\n '%s/json%s/scripts?_queryFilter=name+eq+%%22%s%%22';\nconst apiVersion = 'protocol=2.0,resource=1.0';\nconst getApiConfig = () => {\n return {\n apiVersion,\n };\n};\n\nexport type ScriptLanguage = 'GROOVY' | 'JAVASCRIPT';\n\nexport type ScriptContext =\n | 'OAUTH2_ACCESS_TOKEN_MODIFICATION'\n | 'AUTHENTICATION_CLIENT_SIDE'\n | 'AUTHENTICATION_TREE_DECISION_NODE'\n | 'AUTHENTICATION_SERVER_SIDE'\n | 'SOCIAL_IDP_PROFILE_TRANSFORMATION'\n | 'OAUTH2_VALIDATE_SCOPE'\n | 'CONFIG_PROVIDER_NODE'\n | 'OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER'\n | 'OAUTH2_EVALUATE_SCOPE'\n | 'POLICY_CONDITION'\n | 'OIDC_CLAIMS'\n | 'SAML2_IDP_ADAPTER'\n | 'SAML2_IDP_ATTRIBUTE_MAPPER'\n | 'OAUTH2_MAY_ACT';\n\nexport type ScriptSkeleton = IdObjectSkeletonInterface & {\n name: string;\n description: string;\n default: boolean;\n script: string | string[];\n language: ScriptLanguage;\n context: ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\n/**\n * Get all scripts\n * @returns {Promise} a promise that resolves to an object containing an array of script objects\n */\nexport async function getScripts({\n state,\n}: {\n state: State;\n}): Promise<PagedResult<ScriptSkeleton>> {\n const urlString = util.format(\n scriptListURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get<\n PagedResult<ScriptSkeleton>\n >(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get script by name\n * @param {String} scriptName script name\n * @returns {Promise} a promise that resolves to an object containing a script object\n */\nexport async function getScriptByName({\n scriptName,\n state,\n}: {\n scriptName: string;\n state: State;\n}): Promise<PagedResult<ScriptSkeleton>> {\n const urlString = util.format(\n scriptQueryURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n encodeURIComponent(scriptName)\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get<\n PagedResult<ScriptSkeleton>\n >(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get script by id\n * @param {String} scriptId script uuid/name\n * @returns {Promise} a promise that resolves to a script object\n */\nexport async function getScript({\n scriptId,\n state,\n}: {\n scriptId: string;\n state: State;\n}) {\n const urlString = util.format(\n scriptURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n scriptId\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).get(\n urlString,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Put script\n * @param {string} scriptId script uuid\n * @param {Object} scriptData script object\n * @returns {Promise} a promise that resolves to an object containing a script object\n */\nexport async function putScript({\n scriptId,\n scriptData,\n state,\n}: {\n scriptId: string;\n scriptData: ScriptSkeleton;\n state: State;\n}) {\n const urlString = util.format(\n scriptURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n scriptId\n );\n const { data } = await generateAmApi({ resource: getApiConfig(), state }).put(\n urlString,\n scriptData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Delete script by id\n * @param {String} scriptId script uuid\n * @returns {Promise<ScriptSkeleton>>} a promise that resolves to a script object\n */\nexport async function deleteScript({\n scriptId,\n state,\n}: {\n scriptId: string;\n state: State;\n}): Promise<ScriptSkeleton> {\n const urlString = util.format(\n scriptURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n scriptId\n );\n const { data } = await generateAmApi({\n resource: getApiConfig(),\n state,\n }).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Delete script by name\n * @param {String} scriptId script name\n * @returns {Promise<ScriptSkeleton>} a promise that resolves to a script object\n */\nexport async function deleteScriptByName({\n scriptName,\n state,\n}: {\n scriptName: string;\n state: State;\n}): Promise<ScriptSkeleton> {\n const { result } = await getScriptByName({ scriptName, state });\n if (!result[0]) {\n throw new Error(`Script with name ${scriptName} does not exist.`);\n }\n const scriptId = result[0]._id;\n return deleteScript({\n scriptId,\n state,\n });\n}\n\n/**\n * Delete all non-default scripts\n * @returns {Promise<ScriptSkeleton[]>>} a promise that resolves to an array of script objects\n */\nexport async function deleteScripts({\n state,\n}: {\n state: State;\n}): Promise<ScriptSkeleton[]> {\n const { result } = await getScripts({ state });\n //Unable to delete default scripts, so filter them out\n const scripts = result.filter((s) => !s.default);\n const deletedScripts = [];\n const errors = [];\n for (const script of scripts) {\n try {\n deletedScripts.push(\n await deleteScript({\n scriptId: script._id,\n state,\n })\n );\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n throw new Error(`Delete error:\\n${errorMessages}`);\n }\n return deletedScripts;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwB,IAAAC,eAAA,GAAAD,OAAA;AAAA,IAAAE,QAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,CAAAV,OAAA,CAAAO,KAAA,EAAAI,IAAA,CAAAT,KAAA,EAAAC,MAAA;AAAA,SAAAS,kBAAAC,EAAA,6BAAAC,IAAA,SAAAC,IAAA,GAAAC,SAAA,aAAAN,OAAA,WAAAV,OAAA,EAAAC,MAAA,QAAAF,GAAA,GAAAc,EAAA,CAAAI,KAAA,CAAAH,IAAA,EAAAC,IAAA,YAAAb,MAAAK,KAAA,IAAAT,kBAAA,CAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,E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C;IAChD,IAAMgF,cAAc,GAAG,EAAE;IACzB,IAAMC,MAAM,GAAG,EAAE;IACjB,KAAK,IAAMC,MAAM,IAAIL,OAAO,EAAE;MAC5B,IAAI;QACFG,cAAc,CAACG,IAAI,OACXvB,YAAY,CAAC;UACjBP,QAAQ,EAAE6B,MAAM,CAACV,GAAG;UACpBxC;QACF,CAAC,CACH,CAAC;MACH,CAAC,CAAC,OAAOrB,KAAK,EAAE;QACdsE,MAAM,CAACE,IAAI,CAACxE,KAAK,CAAC;MACpB;IACF;IACA,IAAIsE,MAAM,CAACG,MAAM,EAAE;MACjB,IAAMC,aAAa,GAAGJ,MAAM,CAACK,GAAG,CAAE3E,KAAK,IAAKA,KAAK,CAAC4E,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;MACrE,MAAM,IAAIlB,KAAK,mBAAAC,MAAA,CAAmBc,aAAa,CAAE,CAAC;IACpD;IACA,OAAOL,cAAc;EACvB,CAAC;EAAA,OAAAL,cAAA,CAAAvD,KAAA,OAAAD,SAAA;AAAA"}
|
package/cjs/lib/FrodoLib.js
CHANGED
|
@@ -8,6 +8,7 @@ var _AdminOps = _interopRequireDefault(require("../ops/AdminOps.js"));
|
|
|
8
8
|
var _AgentOps = _interopRequireDefault(require("../ops/AgentOps.js"));
|
|
9
9
|
var _ApplicationOps = _interopRequireDefault(require("../ops/ApplicationOps.js"));
|
|
10
10
|
var _AuthenticateOps = _interopRequireDefault(require("../ops/AuthenticateOps.js"));
|
|
11
|
+
var _AuthenticationSettingsOps = _interopRequireDefault(require("../ops/AuthenticationSettingsOps.js"));
|
|
11
12
|
var _CirclesOfTrustOps = _interopRequireDefault(require("../ops/CirclesOfTrustOps.js"));
|
|
12
13
|
var _AdminFederationOps = _interopRequireDefault(require("../ops/cloud/AdminFederationOps.js"));
|
|
13
14
|
var _FeatureOps = _interopRequireDefault(require("../ops/cloud/FeatureOps.js"));
|
|
@@ -76,7 +77,8 @@ var FrodoLib = exports.FrodoLib = function FrodoLib() {
|
|
|
76
77
|
app: (0, _ApplicationOps.default)(state),
|
|
77
78
|
authn: {
|
|
78
79
|
journey: (0, _JourneyOps.default)(state),
|
|
79
|
-
node: (0, _NodeOps.default)(state)
|
|
80
|
+
node: (0, _NodeOps.default)(state),
|
|
81
|
+
settings: (0, _AuthenticationSettingsOps.default)(state)
|
|
80
82
|
},
|
|
81
83
|
authz: {
|
|
82
84
|
policy: (0, _PolicyOps.default)(state),
|
package/cjs/lib/FrodoLib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrodoLib.js","names":["FrodoLib","exports","config","arguments","length","undefined","state","StateImpl","admin","AdminOps","agent","AgentOps","app","ApplicationOps","authn","journey","JourneyOps","node","NodeOps","authz","policy","PolicyOps","policySet","PolicySetOps","resourceType","ResourceTypeOps","cloud","adminFed","AdminFederationOps","feature","FeatureOps","log","LogOps","secret","SecretsOps","serviceAccount","ServiceAccountOps","startup","StartupOps","variable","VariablesOps","conn","ConnectionProfileOps","cache","TokenCacheOps","email","template","EmailTemplateOps","idm","IdmConfigOps","connector","ConnectorOps","managed","ManagedObjectOps","mapping","MappingOps","organization","OrganizationOps","recon","ReconOps","system","IdmSystemOps","info","InfoOps","login","AuthenticateOps","oauth2oidc","client","OAuth2ClientOps","endpoint","OAuth2OidcOps","external","IdpOps","provider","OAuth2ProviderOps","realm","RealmOps","saml2","circlesOfTrust","CirclesOfTrustOps","entityProvider","Saml2Ops","script","ScriptOps","service","ServiceOps","theme","ThemeOps","utils","_objectSpread","ForgeRockUtils","ScriptValidationUtils","ExportImportUtils","Base64Utils","constants","ConstantsImpl","jose","JoseOps","json","JsonUtils","version","VersionUtils","createInstance","createInstanceWithAdminAccount","createInstanceWithServiceAccount","frodo","host","serviceAccountId","serviceAccountJwkStr","deploymentType","allowInsecureConnection","debug","curlirize","serviceAccountJwk","JSON","parse","username","password","_default","default"],"sources":["../../src/lib/FrodoLib.ts"],"sourcesContent":["// instantiable modules\nimport AdminOps, { Admin } from '../ops/AdminOps';\nimport AgentOps, { Agent } from '../ops/AgentOps';\nimport ApplicationOps, { Application } from '../ops/ApplicationOps';\nimport AuthenticateOps, { Authenticate } from '../ops/AuthenticateOps';\nimport CirclesOfTrustOps, { CirclesOfTrust } from '../ops/CirclesOfTrustOps';\nimport AdminFederationOps, {\n AdminFederation,\n} from '../ops/cloud/AdminFederationOps';\nimport FeatureOps, { Feature } from '../ops/cloud/FeatureOps';\nimport LogOps, { Log } from '../ops/cloud/LogOps';\nimport SecretsOps, { Secret } from '../ops/cloud/SecretsOps';\nimport ServiceAccountOps, {\n ServiceAccount,\n} from '../ops/cloud/ServiceAccountOps';\nimport StartupOps, { Startup } from '../ops/cloud/StartupOps';\nimport VariablesOps, { Variable } from '../ops/cloud/VariablesOps';\nimport ConnectionProfileOps, {\n ConnectionProfile,\n} from '../ops/ConnectionProfileOps';\nimport ConnectorOps, { Connector } from '../ops/ConnectorOps';\nimport EmailTemplateOps, { EmailTemplate } from '../ops/EmailTemplateOps';\nimport IdmConfigOps, { IdmConfig } from '../ops/IdmConfigOps';\nimport IdmSystemOps, { IdmSystem } from '../ops/IdmSystemOps';\nimport IdpOps, { Idp } from '../ops/IdpOps';\nimport InfoOps, { Info } from '../ops/InfoOps';\nimport JoseOps, { Jose } from '../ops/JoseOps';\nimport JourneyOps, { Journey } from '../ops/JourneyOps';\nimport ManagedObjectOps, { ManagedObject } from '../ops/ManagedObjectOps';\nimport MappingOps, { Mapping } from '../ops/MappingOps';\nimport NodeOps, { Node } from '../ops/NodeOps';\nimport OAuth2ClientOps, { OAuth2Client } from '../ops/OAuth2ClientOps';\nimport OAuth2OidcOps, { OAuth2Oidc } from '../ops/OAuth2OidcOps';\nimport OAuth2ProviderOps, { OAuth2Provider } from '../ops/OAuth2ProviderOps';\nimport OrganizationOps, { Organization } from '../ops/OrganizationOps';\nimport PolicyOps, { Policy } from '../ops/PolicyOps';\nimport PolicySetOps, { PolicySet } from '../ops/PolicySetOps';\nimport RealmOps, { Realm } from '../ops/RealmOps';\nimport ReconOps, { Recon } from '../ops/ReconOps';\nimport ResourceTypeOps, { ResourceType } from '../ops/ResourceTypeOps';\nimport Saml2Ops, { Saml2 } from '../ops/Saml2Ops';\nimport ScriptOps, { Script } from '../ops/ScriptOps';\nimport ServiceOps, { Service } from '../ops/ServiceOps';\nimport ThemeOps, { Theme } from '../ops/ThemeOps';\nimport TokenCacheOps, { TokenCache } from '../ops/TokenCacheOps';\nimport VersionUtils, { Version } from '../ops/VersionUtils';\n// non-instantiable modules\nimport ConstantsImpl, { Constants } from '../shared/Constants';\nimport StateImpl, { State, StateInterface } from '../shared/State';\nimport Base64Utils, { Base64 } from '../utils/Base64Utils';\nimport ExportImportUtils, { ExportImport } from '../utils/ExportImportUtils';\nimport ForgeRockUtils, { FRUtils } from '../utils/ForgeRockUtils';\nimport JsonUtils, { Json } from '../utils/JsonUtils';\nimport ScriptValidationUtils, {\n ScriptValidation,\n} from '../utils/ScriptValidationUtils';\n\n/**\n * Frodo Library\n */\nexport type Frodo = {\n state: State;\n admin: Admin;\n agent: Agent;\n app: Application;\n\n authn: {\n journey: Journey;\n node: Node;\n };\n\n authz: {\n policy: Policy;\n policySet: PolicySet;\n resourceType: ResourceType;\n };\n\n cloud: {\n adminFed: AdminFederation;\n feature: Feature;\n log: Log;\n secret: Secret;\n serviceAccount: ServiceAccount;\n startup: Startup;\n variable: Variable;\n };\n\n conn: ConnectionProfile;\n cache: TokenCache;\n\n email: {\n template: EmailTemplate;\n };\n\n idm: {\n config: IdmConfig;\n connector: Connector;\n managed: ManagedObject;\n mapping: Mapping;\n organization: Organization;\n recon: Recon;\n system: IdmSystem;\n };\n\n info: Info;\n login: Authenticate;\n\n oauth2oidc: {\n client: OAuth2Client;\n endpoint: OAuth2Oidc;\n external: Idp;\n provider: OAuth2Provider;\n };\n\n realm: Realm;\n\n saml2: {\n circlesOfTrust: CirclesOfTrust;\n entityProvider: Saml2;\n };\n\n script: Script;\n service: Service;\n\n theme: Theme;\n\n utils: FRUtils &\n ScriptValidation &\n ExportImport &\n Base64 & {\n constants: Constants;\n jose: Jose;\n json: Json;\n version: Version;\n };\n\n /**\n * Create a new frodo instance\n * @param {StateInterface} config Initial state configuration to use with the new instance\n * @returns {Frodo} frodo instance\n */\n createInstance(config: StateInterface): Frodo;\n\n /**\n * Factory helper to create a frodo instance ready for logging in with an admin user account\n * @param {string} host host base URL, e.g. 'https://openam-my-tenant.forgeblocks.com/am'\n * @param {string} username admin account username\n * @param {string} password admin account password\n * @param {string} realm (optional) override default realm\n * @param {string} deploymentType (optional) override deployment type ('cloud', 'forgeops', or 'classic')\n * @param {boolean} allowInsecureConnection (optional) allow insecure connection\n * @param {boolean} debug (optional) enable debug output\n * @param {boolean} curlirize (optional) enable output of all library REST calls as curl commands\n * @returns {Frodo} frodo instance\n */\n createInstanceWithAdminAccount(\n host: string,\n serviceAccountId: string,\n serviceAccountJwkStr: string,\n realm?: string,\n deploymentType?: string,\n allowInsecureConnection?: boolean,\n debug?: boolean,\n curlirize?: boolean\n ): Frodo;\n\n /**\n * Factory helper to create a frodo instance ready for logging in with a service account\n * @param {string} host host base URL, e.g. 'https://openam-my-tenant.forgeblocks.com/am'\n * @param {string} serviceAccountId service account uuid\n * @param {string} serviceAccountJwkStr service account JWK as stringified JSON\n * @param {string} realm (optional) override default realm\n * @param {string} deploymentType (optional) override deployment type ('cloud', 'forgeops', or 'classic')\n * @param {boolean} allowInsecureConnection (optional) allow insecure connection\n * @param {boolean} debug (optional) enable debug output\n * @param {boolean} curlirize (optional) enable output of all library REST calls as curl commands\n * @returns {Frodo} frodo instance\n */\n createInstanceWithServiceAccount(\n host: string,\n serviceAccountId: string,\n serviceAccountJwkStr: string,\n realm?: string,\n deploymentType?: string,\n allowInsecureConnection?: boolean,\n debug?: boolean,\n curlirize?: boolean\n ): Frodo;\n};\n\n/**\n * Create a new frodo instance\n * @param {StateInterface} config Initial state configuration to use with the new instance\n * @returns {Frodo} frodo instance\n */\nconst FrodoLib = (config: StateInterface = {}): Frodo => {\n const state = StateImpl(config);\n return {\n state: state,\n admin: AdminOps(state),\n agent: AgentOps(state),\n app: ApplicationOps(state),\n\n authn: {\n journey: JourneyOps(state),\n node: NodeOps(state),\n },\n\n authz: {\n policy: PolicyOps(state),\n policySet: PolicySetOps(state),\n resourceType: ResourceTypeOps(state),\n },\n\n cloud: {\n adminFed: AdminFederationOps(state),\n feature: FeatureOps(state),\n log: LogOps(state),\n secret: SecretsOps(state),\n serviceAccount: ServiceAccountOps(state),\n startup: StartupOps(state),\n variable: VariablesOps(state),\n },\n\n conn: ConnectionProfileOps(state),\n cache: TokenCacheOps(state),\n\n email: {\n template: EmailTemplateOps(state),\n },\n\n idm: {\n config: IdmConfigOps(state),\n connector: ConnectorOps(state),\n managed: ManagedObjectOps(state),\n mapping: MappingOps(state),\n organization: OrganizationOps(state),\n recon: ReconOps(state),\n system: IdmSystemOps(state),\n },\n\n info: InfoOps(state),\n login: AuthenticateOps(state),\n\n oauth2oidc: {\n client: OAuth2ClientOps(state),\n endpoint: OAuth2OidcOps(state),\n external: IdpOps(state),\n provider: OAuth2ProviderOps(state),\n },\n\n realm: RealmOps(state),\n\n saml2: {\n circlesOfTrust: CirclesOfTrustOps(state),\n entityProvider: Saml2Ops(state),\n },\n\n script: ScriptOps(state),\n service: ServiceOps(state),\n\n theme: ThemeOps(state),\n\n utils: {\n ...ForgeRockUtils(state),\n ...ScriptValidationUtils(state),\n ...ExportImportUtils(state),\n ...Base64Utils(),\n constants: ConstantsImpl,\n jose: JoseOps(state),\n json: JsonUtils(),\n version: VersionUtils(state),\n },\n\n createInstance,\n createInstanceWithAdminAccount,\n createInstanceWithServiceAccount,\n };\n};\n\nfunction createInstance(config: StateInterface): Frodo {\n const frodo = FrodoLib(config);\n return frodo;\n}\n\nfunction createInstanceWithServiceAccount(\n host: string,\n serviceAccountId: string,\n serviceAccountJwkStr: string,\n realm: string = undefined,\n deploymentType: string = undefined,\n allowInsecureConnection = false,\n debug = false,\n curlirize = false\n): Frodo {\n const config: StateInterface = {\n host,\n serviceAccountId,\n serviceAccountJwk: JSON.parse(serviceAccountJwkStr),\n realm,\n deploymentType,\n allowInsecureConnection,\n debug,\n curlirize,\n };\n const frodo = FrodoLib(config);\n return frodo;\n}\n\nfunction createInstanceWithAdminAccount(\n host: string,\n username: string,\n password: string,\n realm: string = undefined,\n deploymentType: string = undefined,\n allowInsecureConnection = false,\n debug = false,\n curlirize = false\n): Frodo {\n const config: StateInterface = {\n host,\n username,\n password,\n realm,\n deploymentType,\n allowInsecureConnection,\n debug,\n curlirize,\n };\n const frodo = FrodoLib(config);\n return frodo;\n}\n\n/**\n * Default frodo instance\n *\n * @remarks\n *\n * If your application requires a single connection to a ForgeRock Identity Platform\n * instance at a time, then this default instance is all you need:\n *\n * In order to use the default {@link Frodo | frodo} instance, you must populate its {@link State | state} with the\n * minimum required information to login to your ForgeRock Identity Platform instance:\n *\n * ```javascript\n * // configure the state before invoking any library functions that require credentials\n * state.setHost('https://instance0/am');\n * state.setUsername('admin');\n * state.setPassword('p@ssw0rd!');\n *\n * // now the library can login\n * frodo.login.getTokens();\n *\n * // and perform operations\n * frodo.authn.journey.exportJourney('Login');\n * ```\n *\n * If your application needs to connect to multiple ForgeRock Identity Platform instances\n * simultaneously, then you will want to create additional frodo instances using any of\n * the available factory methods accessible from the default instance:\n *\n * {@link frodo.createInstance}\n * ```javascript\n * // use factory method to create a new Frodo instance\n * const instance1 = frodo.createInstance({\n * host: 'https://instance1/am',\n * username: 'admin',\n * password: 'p@ssw0rd!',\n * });\n *\n * // now the instance can login\n * instance1.login.getTokens();\n *\n * // and perform operations\n * instance1.authn.journey.exportJourney('Login');\n * ```\n *\n * {@link frodo.createInstanceWithAdminAccount}\n * ```javascript\n * // use factory method to create a new Frodo instance ready to login with an admin user account\n * const instance2 = frodo.createInstanceWithAdminAccount(\n * 'https://instance2/am',\n * 'admin',\n * 'p@ssw0rd!'\n * );\n *\n * // now the instance can login\n * instance2.login.getTokens();\n *\n * // and perform operations\n * instance2.authn.journey.exportJourney('Login');\n * ```\n *\n * {@link frodo.createInstanceWithServiceAccount}\n * ```javascript\n * // use factory method to create a new Frodo instance ready to login with a service account\n * const instance3 = frodo.createInstanceWithServiceAccount(\n * 'https://instance3/am',\n * 'serviceAccount',\n * '{\"k\":\"jwk\"}'\n * );\n *\n * // now the instance can login\n * instance3.login.getTokens();\n *\n * // and perform operations\n * instance3.authn.journey.exportJourney('Login');\n * ```\n */\nconst frodo = FrodoLib();\n\n/**\n * Default state instance\n *\n * @remarks\n *\n * {@link Frodo} maintains a {@link State | state} for each instance. The state is where Frodo gets configuration\n * information from like host to connecto to, username and password to use, whether to\n * allow insecure connections or not, etc. As the library operates, it updates its state.\n *\n * The default frodo instance contains an empty state instance by default. In order to\n * use the default frodo instance, you must populate its state with the minimum required\n * information to login to your ForgeRock Identity Platform instance:\n *\n * ```javascript\n * // configure the state before invoking any library functions that require credentials\n * state.setHost('https://instance0/am');\n * state.setUsername('admin');\n * state.setPassword('p@ssw0rd!');\n *\n * // now the library can login\n * frodo.login.getTokens();\n *\n * // and perform operations\n * frodo.authn.journey.exportJourney('Login');\n * ```\n */\nconst state = frodo.state;\n\nexport { frodo, FrodoLib, state };\n\nexport default FrodoLib;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0XAAA;AA8CA;AAWA;AACA;AACA;;AAmIA;AACA;AACA;AACA;AACA;AACA,IAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,SAAXA,QAAQA,CAAA,EAA2C;EAAA,IAAvCE,MAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC3C,IAAMG,KAAK,GAAG,IAAAC,cAAS,EAACL,MAAM,CAAC;EAC/B,OAAO;IACLI,KAAK,EAAEA,KAAK;IACZE,KAAK,EAAE,IAAAC,iBAAQ,EAAC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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMM,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGmG,KAAK,CAACnG,KAAK;AAAC,IAAAgH,QAAA,GAAArH,OAAA,CAAAsH,OAAA,GAIXvH,QAAQ"}
|
|
1
|
+
{"version":3,"file":"FrodoLib.js","names":["FrodoLib","exports","config","arguments","length","undefined","state","StateImpl","admin","AdminOps","agent","AgentOps","app","ApplicationOps","authn","journey","JourneyOps","node","NodeOps","settings","AuthenticationSettingsOps","authz","policy","PolicyOps","policySet","PolicySetOps","resourceType","ResourceTypeOps","cloud","adminFed","AdminFederationOps","feature","FeatureOps","log","LogOps","secret","SecretsOps","serviceAccount","ServiceAccountOps","startup","StartupOps","variable","VariablesOps","conn","ConnectionProfileOps","cache","TokenCacheOps","email","template","EmailTemplateOps","idm","IdmConfigOps","connector","ConnectorOps","managed","ManagedObjectOps","mapping","MappingOps","organization","OrganizationOps","recon","ReconOps","system","IdmSystemOps","info","InfoOps","login","AuthenticateOps","oauth2oidc","client","OAuth2ClientOps","endpoint","OAuth2OidcOps","external","IdpOps","provider","OAuth2ProviderOps","realm","RealmOps","saml2","circlesOfTrust","CirclesOfTrustOps","entityProvider","Saml2Ops","script","ScriptOps","service","ServiceOps","theme","ThemeOps","utils","_objectSpread","ForgeRockUtils","ScriptValidationUtils","ExportImportUtils","Base64Utils","constants","ConstantsImpl","jose","JoseOps","json","JsonUtils","version","VersionUtils","createInstance","createInstanceWithAdminAccount","createInstanceWithServiceAccount","frodo","host","serviceAccountId","serviceAccountJwkStr","deploymentType","allowInsecureConnection","debug","curlirize","serviceAccountJwk","JSON","parse","username","password","_default","default"],"sources":["../../src/lib/FrodoLib.ts"],"sourcesContent":["// instantiable modules\nimport AdminOps, { Admin } from '../ops/AdminOps';\nimport AgentOps, { Agent } from '../ops/AgentOps';\nimport ApplicationOps, { Application } from '../ops/ApplicationOps';\nimport AuthenticateOps, { Authenticate } from '../ops/AuthenticateOps';\nimport AuthenticationSettingsOps, {\n AuthenticationSettings,\n} from '../ops/AuthenticationSettingsOps';\nimport CirclesOfTrustOps, { CirclesOfTrust } from '../ops/CirclesOfTrustOps';\nimport AdminFederationOps, {\n AdminFederation,\n} from '../ops/cloud/AdminFederationOps';\nimport FeatureOps, { Feature } from '../ops/cloud/FeatureOps';\nimport LogOps, { Log } from '../ops/cloud/LogOps';\nimport SecretsOps, { Secret } from '../ops/cloud/SecretsOps';\nimport ServiceAccountOps, {\n ServiceAccount,\n} from '../ops/cloud/ServiceAccountOps';\nimport StartupOps, { Startup } from '../ops/cloud/StartupOps';\nimport VariablesOps, { Variable } from '../ops/cloud/VariablesOps';\nimport ConnectionProfileOps, {\n ConnectionProfile,\n} from '../ops/ConnectionProfileOps';\nimport ConnectorOps, { Connector } from '../ops/ConnectorOps';\nimport EmailTemplateOps, { EmailTemplate } from '../ops/EmailTemplateOps';\nimport IdmConfigOps, { IdmConfig } from '../ops/IdmConfigOps';\nimport IdmSystemOps, { IdmSystem } from '../ops/IdmSystemOps';\nimport IdpOps, { Idp } from '../ops/IdpOps';\nimport InfoOps, { Info } from '../ops/InfoOps';\nimport JoseOps, { Jose } from '../ops/JoseOps';\nimport JourneyOps, { Journey } from '../ops/JourneyOps';\nimport ManagedObjectOps, { ManagedObject } from '../ops/ManagedObjectOps';\nimport MappingOps, { Mapping } from '../ops/MappingOps';\nimport NodeOps, { Node } from '../ops/NodeOps';\nimport OAuth2ClientOps, { OAuth2Client } from '../ops/OAuth2ClientOps';\nimport OAuth2OidcOps, { OAuth2Oidc } from '../ops/OAuth2OidcOps';\nimport OAuth2ProviderOps, { OAuth2Provider } from '../ops/OAuth2ProviderOps';\nimport OrganizationOps, { Organization } from '../ops/OrganizationOps';\nimport PolicyOps, { Policy } from '../ops/PolicyOps';\nimport PolicySetOps, { PolicySet } from '../ops/PolicySetOps';\nimport RealmOps, { Realm } from '../ops/RealmOps';\nimport ReconOps, { Recon } from '../ops/ReconOps';\nimport ResourceTypeOps, { ResourceType } from '../ops/ResourceTypeOps';\nimport Saml2Ops, { Saml2 } from '../ops/Saml2Ops';\nimport ScriptOps, { Script } from '../ops/ScriptOps';\nimport ServiceOps, { Service } from '../ops/ServiceOps';\nimport ThemeOps, { Theme } from '../ops/ThemeOps';\nimport TokenCacheOps, { TokenCache } from '../ops/TokenCacheOps';\nimport VersionUtils, { Version } from '../ops/VersionUtils';\n// non-instantiable modules\nimport ConstantsImpl, { Constants } from '../shared/Constants';\nimport StateImpl, { State, StateInterface } from '../shared/State';\nimport Base64Utils, { Base64 } from '../utils/Base64Utils';\nimport ExportImportUtils, { ExportImport } from '../utils/ExportImportUtils';\nimport ForgeRockUtils, { FRUtils } from '../utils/ForgeRockUtils';\nimport JsonUtils, { Json } from '../utils/JsonUtils';\nimport ScriptValidationUtils, {\n ScriptValidation,\n} from '../utils/ScriptValidationUtils';\n\n/**\n * Frodo Library\n */\nexport type Frodo = {\n state: State;\n admin: Admin;\n agent: Agent;\n app: Application;\n\n authn: {\n journey: Journey;\n node: Node;\n settings: AuthenticationSettings;\n };\n\n authz: {\n policy: Policy;\n policySet: PolicySet;\n resourceType: ResourceType;\n };\n\n cloud: {\n adminFed: AdminFederation;\n feature: Feature;\n log: Log;\n secret: Secret;\n serviceAccount: ServiceAccount;\n startup: Startup;\n variable: Variable;\n };\n\n conn: ConnectionProfile;\n cache: TokenCache;\n\n email: {\n template: EmailTemplate;\n };\n\n idm: {\n config: IdmConfig;\n connector: Connector;\n managed: ManagedObject;\n mapping: Mapping;\n organization: Organization;\n recon: Recon;\n system: IdmSystem;\n };\n\n info: Info;\n login: Authenticate;\n\n oauth2oidc: {\n client: OAuth2Client;\n endpoint: OAuth2Oidc;\n external: Idp;\n provider: OAuth2Provider;\n };\n\n realm: Realm;\n\n saml2: {\n circlesOfTrust: CirclesOfTrust;\n entityProvider: Saml2;\n };\n\n script: Script;\n service: Service;\n\n theme: Theme;\n\n utils: FRUtils &\n ScriptValidation &\n ExportImport &\n Base64 & {\n constants: Constants;\n jose: Jose;\n json: Json;\n version: Version;\n };\n\n /**\n * Create a new frodo instance\n * @param {StateInterface} config Initial state configuration to use with the new instance\n * @returns {Frodo} frodo instance\n */\n createInstance(config: StateInterface): Frodo;\n\n /**\n * Factory helper to create a frodo instance ready for logging in with an admin user account\n * @param {string} host host base URL, e.g. 'https://openam-my-tenant.forgeblocks.com/am'\n * @param {string} username admin account username\n * @param {string} password admin account password\n * @param {string} realm (optional) override default realm\n * @param {string} deploymentType (optional) override deployment type ('cloud', 'forgeops', or 'classic')\n * @param {boolean} allowInsecureConnection (optional) allow insecure connection\n * @param {boolean} debug (optional) enable debug output\n * @param {boolean} curlirize (optional) enable output of all library REST calls as curl commands\n * @returns {Frodo} frodo instance\n */\n createInstanceWithAdminAccount(\n host: string,\n serviceAccountId: string,\n serviceAccountJwkStr: string,\n realm?: string,\n deploymentType?: string,\n allowInsecureConnection?: boolean,\n debug?: boolean,\n curlirize?: boolean\n ): Frodo;\n\n /**\n * Factory helper to create a frodo instance ready for logging in with a service account\n * @param {string} host host base URL, e.g. 'https://openam-my-tenant.forgeblocks.com/am'\n * @param {string} serviceAccountId service account uuid\n * @param {string} serviceAccountJwkStr service account JWK as stringified JSON\n * @param {string} realm (optional) override default realm\n * @param {string} deploymentType (optional) override deployment type ('cloud', 'forgeops', or 'classic')\n * @param {boolean} allowInsecureConnection (optional) allow insecure connection\n * @param {boolean} debug (optional) enable debug output\n * @param {boolean} curlirize (optional) enable output of all library REST calls as curl commands\n * @returns {Frodo} frodo instance\n */\n createInstanceWithServiceAccount(\n host: string,\n serviceAccountId: string,\n serviceAccountJwkStr: string,\n realm?: string,\n deploymentType?: string,\n allowInsecureConnection?: boolean,\n debug?: boolean,\n curlirize?: boolean\n ): Frodo;\n};\n\n/**\n * Create a new frodo instance\n * @param {StateInterface} config Initial state configuration to use with the new instance\n * @returns {Frodo} frodo instance\n */\nconst FrodoLib = (config: StateInterface = {}): Frodo => {\n const state = StateImpl(config);\n return {\n state: state,\n admin: AdminOps(state),\n agent: AgentOps(state),\n app: ApplicationOps(state),\n\n authn: {\n journey: JourneyOps(state),\n node: NodeOps(state),\n settings: AuthenticationSettingsOps(state),\n },\n\n authz: {\n policy: PolicyOps(state),\n policySet: PolicySetOps(state),\n resourceType: ResourceTypeOps(state),\n },\n\n cloud: {\n adminFed: AdminFederationOps(state),\n feature: FeatureOps(state),\n log: LogOps(state),\n secret: SecretsOps(state),\n serviceAccount: ServiceAccountOps(state),\n startup: StartupOps(state),\n variable: VariablesOps(state),\n },\n\n conn: ConnectionProfileOps(state),\n cache: TokenCacheOps(state),\n\n email: {\n template: EmailTemplateOps(state),\n },\n\n idm: {\n config: IdmConfigOps(state),\n connector: ConnectorOps(state),\n managed: ManagedObjectOps(state),\n mapping: MappingOps(state),\n organization: OrganizationOps(state),\n recon: ReconOps(state),\n system: IdmSystemOps(state),\n },\n\n info: InfoOps(state),\n login: AuthenticateOps(state),\n\n oauth2oidc: {\n client: OAuth2ClientOps(state),\n endpoint: OAuth2OidcOps(state),\n external: IdpOps(state),\n provider: OAuth2ProviderOps(state),\n },\n\n realm: RealmOps(state),\n\n saml2: {\n circlesOfTrust: CirclesOfTrustOps(state),\n entityProvider: Saml2Ops(state),\n },\n\n script: ScriptOps(state),\n service: ServiceOps(state),\n\n theme: ThemeOps(state),\n\n utils: {\n ...ForgeRockUtils(state),\n ...ScriptValidationUtils(state),\n ...ExportImportUtils(state),\n ...Base64Utils(),\n constants: ConstantsImpl,\n jose: JoseOps(state),\n json: JsonUtils(),\n version: VersionUtils(state),\n },\n\n createInstance,\n createInstanceWithAdminAccount,\n createInstanceWithServiceAccount,\n };\n};\n\nfunction createInstance(config: StateInterface): Frodo {\n const frodo = FrodoLib(config);\n return frodo;\n}\n\nfunction createInstanceWithServiceAccount(\n host: string,\n serviceAccountId: string,\n serviceAccountJwkStr: string,\n realm: string = undefined,\n deploymentType: string = undefined,\n allowInsecureConnection = false,\n debug = false,\n curlirize = false\n): Frodo {\n const config: StateInterface = {\n host,\n serviceAccountId,\n serviceAccountJwk: JSON.parse(serviceAccountJwkStr),\n realm,\n deploymentType,\n allowInsecureConnection,\n debug,\n curlirize,\n };\n const frodo = FrodoLib(config);\n return frodo;\n}\n\nfunction createInstanceWithAdminAccount(\n host: string,\n username: string,\n password: string,\n realm: string = undefined,\n deploymentType: string = undefined,\n allowInsecureConnection = false,\n debug = false,\n curlirize = false\n): Frodo {\n const config: StateInterface = {\n host,\n username,\n password,\n realm,\n deploymentType,\n allowInsecureConnection,\n debug,\n curlirize,\n };\n const frodo = FrodoLib(config);\n return frodo;\n}\n\n/**\n * Default frodo instance\n *\n * @remarks\n *\n * If your application requires a single connection to a ForgeRock Identity Platform\n * instance at a time, then this default instance is all you need:\n *\n * In order to use the default {@link Frodo | frodo} instance, you must populate its {@link State | state} with the\n * minimum required information to login to your ForgeRock Identity Platform instance:\n *\n * ```javascript\n * // configure the state before invoking any library functions that require credentials\n * state.setHost('https://instance0/am');\n * state.setUsername('admin');\n * state.setPassword('p@ssw0rd!');\n *\n * // now the library can login\n * frodo.login.getTokens();\n *\n * // and perform operations\n * frodo.authn.journey.exportJourney('Login');\n * ```\n *\n * If your application needs to connect to multiple ForgeRock Identity Platform instances\n * simultaneously, then you will want to create additional frodo instances using any of\n * the available factory methods accessible from the default instance:\n *\n * {@link frodo.createInstance}\n * ```javascript\n * // use factory method to create a new Frodo instance\n * const instance1 = frodo.createInstance({\n * host: 'https://instance1/am',\n * username: 'admin',\n * password: 'p@ssw0rd!',\n * });\n *\n * // now the instance can login\n * instance1.login.getTokens();\n *\n * // and perform operations\n * instance1.authn.journey.exportJourney('Login');\n * ```\n *\n * {@link frodo.createInstanceWithAdminAccount}\n * ```javascript\n * // use factory method to create a new Frodo instance ready to login with an admin user account\n * const instance2 = frodo.createInstanceWithAdminAccount(\n * 'https://instance2/am',\n * 'admin',\n * 'p@ssw0rd!'\n * );\n *\n * // now the instance can login\n * instance2.login.getTokens();\n *\n * // and perform operations\n * instance2.authn.journey.exportJourney('Login');\n * ```\n *\n * {@link frodo.createInstanceWithServiceAccount}\n * ```javascript\n * // use factory method to create a new Frodo instance ready to login with a service account\n * const instance3 = frodo.createInstanceWithServiceAccount(\n * 'https://instance3/am',\n * 'serviceAccount',\n * '{\"k\":\"jwk\"}'\n * );\n *\n * // now the instance can login\n * instance3.login.getTokens();\n *\n * // and perform operations\n * instance3.authn.journey.exportJourney('Login');\n * ```\n */\nconst frodo = FrodoLib();\n\n/**\n * Default state instance\n *\n * @remarks\n *\n * {@link Frodo} maintains a {@link State | state} for each instance. The state is where Frodo gets configuration\n * information from like host to connecto to, username and password to use, whether to\n * allow insecure connections or not, etc. As the library operates, it updates its state.\n *\n * The default frodo instance contains an empty state instance by default. In order to\n * use the default frodo instance, you must populate its state with the minimum required\n * information to login to your ForgeRock Identity Platform instance:\n *\n * ```javascript\n * // configure the state before invoking any library functions that require credentials\n * state.setHost('https://instance0/am');\n * state.setUsername('admin');\n * state.setPassword('p@ssw0rd!');\n *\n * // now the library can login\n * frodo.login.getTokens();\n *\n * // and perform operations\n * frodo.authn.journey.exportJourney('Login');\n * ```\n */\nconst state = frodo.state;\n\nexport { frodo, FrodoLib, state };\n\nexport default FrodoLib;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0XAAA;AAiDA;AAWA;AACA;AACA;;AAoIA;AACA;AACA;AACA;AACA;AACA,IAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,SAAXA,QAAQA,CAAA,EAA2C;EAAA,IAAvCE,MAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC3C,IAAMG,KAAK,GAAG,IAAAC,cAAS,EAACL,MAAM,CAAC;EAC/B,OAAO;IACLI,KAAK,EAAEA,KAAK;IACZE,KAAK,EAAE,IAAAC,iBAAQ,EAACH,KAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMM,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGqG,KAAK,CAACrG,KAAK;AAAC,IAAAkH,QAAA,GAAAvH,OAAA,CAAAwH,OAAA,GAIXzH,QAAQ"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.exportAuthenticationSettings = exportAuthenticationSettings;
|
|
8
|
-
exports.exportSocialProviders = exportSocialProviders;
|
|
9
8
|
exports.importAuthenticationSettings = importAuthenticationSettings;
|
|
10
9
|
exports.readAuthenticationSettings = readAuthenticationSettings;
|
|
11
10
|
exports.updateAuthenticationSettings = updateAuthenticationSettings;
|
|
@@ -77,12 +76,10 @@ function _readAuthenticationSettings() {
|
|
|
77
76
|
var {
|
|
78
77
|
state
|
|
79
78
|
} = _ref2;
|
|
80
|
-
var {
|
|
81
|
-
result
|
|
82
|
-
} = yield (0, _AuthenticationSettingsApi.getAuthenticationSettings)({
|
|
79
|
+
var settings = yield (0, _AuthenticationSettingsApi.getAuthenticationSettings)({
|
|
83
80
|
state
|
|
84
81
|
});
|
|
85
|
-
return
|
|
82
|
+
return settings;
|
|
86
83
|
});
|
|
87
84
|
return _readAuthenticationSettings.apply(this, arguments);
|
|
88
85
|
}
|
|
@@ -119,8 +116,9 @@ function exportAuthenticationSettings(_x3) {
|
|
|
119
116
|
return _exportAuthenticationSettings.apply(this, arguments);
|
|
120
117
|
}
|
|
121
118
|
/**
|
|
122
|
-
*
|
|
123
|
-
* @
|
|
119
|
+
* Import authentication settings
|
|
120
|
+
* @param {AuthenticationSettingsExportInterface} importData import data
|
|
121
|
+
* @returns {Promise<AuthenticationSettingsSkeleton>} a promise resolving to a authentication settings object
|
|
124
122
|
*/
|
|
125
123
|
function _exportAuthenticationSettings() {
|
|
126
124
|
_exportAuthenticationSettings = _asyncToGenerator(function* (_ref4) {
|
|
@@ -146,39 +144,15 @@ function _exportAuthenticationSettings() {
|
|
|
146
144
|
});
|
|
147
145
|
return _exportAuthenticationSettings.apply(this, arguments);
|
|
148
146
|
}
|
|
149
|
-
function
|
|
150
|
-
return _exportSocialProviders.apply(this, arguments);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Import authentication settings
|
|
154
|
-
* @param {AuthenticationSettingsExportInterface} importData import data
|
|
155
|
-
* @returns {Promise<AuthenticationSettingsSkeleton>} a promise resolving to a authentication settings object
|
|
156
|
-
*/
|
|
157
|
-
function _exportSocialProviders() {
|
|
158
|
-
_exportSocialProviders = _asyncToGenerator(function* (_ref5) {
|
|
159
|
-
var {
|
|
160
|
-
state
|
|
161
|
-
} = _ref5;
|
|
162
|
-
var exportData = createAuthenticationSettingsExportTemplate({
|
|
163
|
-
state
|
|
164
|
-
});
|
|
165
|
-
var settingsData = yield readAuthenticationSettings({
|
|
166
|
-
state
|
|
167
|
-
});
|
|
168
|
-
exportData.authentication = settingsData;
|
|
169
|
-
return exportData;
|
|
170
|
-
});
|
|
171
|
-
return _exportSocialProviders.apply(this, arguments);
|
|
172
|
-
}
|
|
173
|
-
function importAuthenticationSettings(_x5) {
|
|
147
|
+
function importAuthenticationSettings(_x4) {
|
|
174
148
|
return _importAuthenticationSettings.apply(this, arguments);
|
|
175
149
|
}
|
|
176
150
|
function _importAuthenticationSettings() {
|
|
177
|
-
_importAuthenticationSettings = _asyncToGenerator(function* (
|
|
151
|
+
_importAuthenticationSettings = _asyncToGenerator(function* (_ref5) {
|
|
178
152
|
var {
|
|
179
153
|
importData,
|
|
180
154
|
state
|
|
181
|
-
} =
|
|
155
|
+
} = _ref5;
|
|
182
156
|
var response = null;
|
|
183
157
|
var errors = [];
|
|
184
158
|
try {
|
|
@@ -190,7 +164,10 @@ function _importAuthenticationSettings() {
|
|
|
190
164
|
errors.push(error);
|
|
191
165
|
}
|
|
192
166
|
if (errors.length) {
|
|
193
|
-
var errorMessages = errors.map(error =>
|
|
167
|
+
var errorMessages = errors.map(error => {
|
|
168
|
+
var _error$response, _error$response2, _error$response3, _error$response4, _error$response5;
|
|
169
|
+
return "".concat((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status).concat((_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data['reason'] ? ' ' + ((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data['reason']) : '').concat((_error$response4 = error.response) !== null && _error$response4 !== void 0 && _error$response4.data['message'] ? ' - ' + ((_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : _error$response5.data['message']) : '');
|
|
170
|
+
}).join('\n');
|
|
194
171
|
throw new Error("Import error:\n".concat(errorMessages));
|
|
195
172
|
}
|
|
196
173
|
return response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationSettingsOps.js","names":["state","readAuthenticationSettings","_asyncToGenerator","updateAuthenticationSettings","settings","exportAuthenticationSettings","importAuthenticationSettings","importData","exports","default","_default","createAuthenticationSettingsExportTemplate","_ref","meta","getMetadata","authentication","_x","_readAuthenticationSettings","apply","arguments","_ref2","result","_getAuthenticationSettings","_x2","_updateAuthenticationSettings","_ref3","debugMessage","message","response","_putAuthenticationSettings","_x3","_exportAuthenticationSettings","_ref4","settingsData","exportData","exportSocialProviders","_x4","_exportSocialProviders","_ref5","_x5","_importAuthenticationSettings","_ref6","errors","error","push","length","errorMessages","map","join","Error","concat"],"sources":["../../src/ops/AuthenticationSettingsOps.ts"],"sourcesContent":["import {\n type AuthenticationSettingsSkeleton,\n getAuthenticationSettings as _getAuthenticationSettings,\n putAuthenticationSettings as _putAuthenticationSettings,\n} from '../api/AuthenticationSettingsApi';\nimport { State } from '../shared/State';\nimport { debugMessage } from '../utils/Console';\nimport { getMetadata } from '../utils/ExportImportUtils';\nimport { type ExportMetaData } from './OpsTypes';\n\nexport type Idp = {\n /**\n * Read authentication settings\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves an authentication settings object\n */\n readAuthenticationSettings(): Promise<AuthenticationSettingsSkeleton>;\n /**\n * Update authentication settings\n * @param {AuthenticationSettingsSkeleton} settings authentication settings data\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves an authentication settings object\n */\n updateAuthenticationSettings(\n settings: AuthenticationSettingsSkeleton\n ): Promise<AuthenticationSettingsSkeleton>;\n /**\n * Export authentication settings\n * @returns {Promise<AuthenticationSettingsExportInterface>} a promise that resolves to an AuthenticationSettingsExportInterface object\n */\n exportAuthenticationSettings(): Promise<AuthenticationSettingsExportInterface>;\n /**\n * Import authentication settings\n * @param {AuthenticationSettingsExportInterface} importData import data\n */\n importAuthenticationSettings(\n importData: AuthenticationSettingsExportInterface\n ): Promise<AuthenticationSettingsSkeleton>;\n};\n\nexport default (state: State): Idp => {\n return {\n async readAuthenticationSettings() {\n return readAuthenticationSettings({ state });\n },\n async updateAuthenticationSettings(\n settings: AuthenticationSettingsSkeleton\n ) {\n return updateAuthenticationSettings({\n settings,\n state,\n });\n },\n async exportAuthenticationSettings(): Promise<AuthenticationSettingsExportInterface> {\n return exportAuthenticationSettings({ state });\n },\n async importAuthenticationSettings(\n importData: AuthenticationSettingsExportInterface\n ): Promise<AuthenticationSettingsSkeleton> {\n return importAuthenticationSettings({ importData, state });\n },\n };\n};\n\nexport interface AuthenticationSettingsExportInterface {\n meta?: ExportMetaData;\n authentication: AuthenticationSettingsSkeleton;\n}\n\n/**\n * Create an empty authentication settings export template\n * @returns {AuthenticationSettingsExportInterface} an empty authentication settings export template\n */\nfunction createAuthenticationSettingsExportTemplate({\n state,\n}: {\n state: State;\n}): AuthenticationSettingsExportInterface {\n return {\n meta: getMetadata({ state }),\n authentication: {},\n } as AuthenticationSettingsExportInterface;\n}\n\n/**\n * Read authentication settings\n * @returns {Promise} a promise that resolves to an object containing an array of authentication settingss\n */\nexport async function readAuthenticationSettings({\n state,\n}: {\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n const { result } = await _getAuthenticationSettings({ state });\n return result;\n}\n\nexport async function updateAuthenticationSettings({\n settings,\n state,\n}: {\n settings: AuthenticationSettingsSkeleton;\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n debugMessage({\n message: `AuthenticationSettingsOps.updateAuthenticationSettings: start`,\n state,\n });\n const response = await _putAuthenticationSettings({\n settings,\n state,\n });\n debugMessage({\n message: `AuthenticationSettingsOps.updateAuthenticationSettings: end`,\n state,\n });\n return response;\n}\n\n/**\n * Export authentication settings\n * @returns {Promise<AuthenticationSettingsExportInterface>} a promise that resolves to a AuthenticationSettingsExportInterface object\n */\nexport async function exportAuthenticationSettings({\n state,\n}: {\n state: State;\n}): Promise<AuthenticationSettingsExportInterface> {\n debugMessage({\n message: `AuthenticationSettingsOps.exportAuthenticationSettings: start`,\n state,\n });\n const settingsData = await readAuthenticationSettings({ state });\n const exportData = createAuthenticationSettingsExportTemplate({ state });\n exportData.authentication = settingsData;\n debugMessage({\n message: `AuthenticationSettingsOps.exportAuthenticationSettings: end`,\n state,\n });\n return exportData;\n}\n\n/**\n * Export authentication settings\n * @returns {Promise<AuthenticationSettingsExportInterface>} a promise that resolves to a AuthenticationSettingsExportInterface object\n */\nexport async function exportSocialProviders({\n state,\n}: {\n state: State;\n}): Promise<AuthenticationSettingsExportInterface> {\n const exportData = createAuthenticationSettingsExportTemplate({ state });\n const settingsData = await readAuthenticationSettings({\n state,\n });\n exportData.authentication = settingsData;\n return exportData;\n}\n\n/**\n * Import authentication settings\n * @param {AuthenticationSettingsExportInterface} importData import data\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise resolving to a authentication settings object\n */\nexport async function importAuthenticationSettings({\n importData,\n state,\n}: {\n importData: AuthenticationSettingsExportInterface;\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n let response = null;\n const errors = [];\n try {\n response = await updateAuthenticationSettings({\n settings: importData.authentication,\n state,\n });\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n return response;\n}\n"],"mappings":";;;;;;;;;;;;;;;;eAsCgBA,KAAY,IAAU;EACpC,OAAO;IACCC,0BAA0BA,CAAA,EAAG;MAAA,OAAAC,iBAAA;QACjC,OAAOD,0BAA0B,CAAC;UAAED;QAAM,CAAC,CAAC;MAAC;IAC/C,CAAC;IACKG,4BAA4BA,CAChCC,QAAwC,EACxC;MAAA,OAAAF,iBAAA;QACA,OAAOC,4BAA4B,CAAC;UAClCC,QAAQ;UACRJ;QACF,CAAC,CAAC;MAAC;IACL,CAAC;IACKK,4BAA4BA,CAAA,EAAmD;MAAA,OAAAH,iBAAA;QACnF,OAAOG,4BAA4B,CAAC;UAAEL;QAAM,CAAC,CAAC;MAAC;IACjD,CAAC;IACKM,4BAA4BA,CAChCC,UAAiD,EACR;MAAA,OAAAL,iBAAA;QACzC,OAAOI,4BAA4B,CAAC;UAAEC,UAAU;UAAEP;QAAM,CAAC,CAAC;MAAC;IAC7D;EACF,CAAC;AACH,CAAC;AAAAQ,OAAA,CAAAC,OAAA,GAAAC,QAAA;AAOD;AACA;AACA;AACA;AACA,SAASC,0CAA0CA,CAAAC,IAAA,EAIT;EAAA,IAJU;IAClDZ;EAGF,CAAC,GAAAY,IAAA;EACC,OAAO;IACLC,IAAI,EAAE,IAAAC,8BAAW,EAAC;MAAEd;IAAM,CAAC,CAAC;IAC5Be,cAAc,EAAE,CAAC;EACnB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AAHA,SAIsBd,0BAA0BA,CAAAe,EAAA;EAAA,OAAAC,2BAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,4BAAA;EAAAA,2BAAA,GAAAf,iBAAA,CAAzC,WAAAkB,KAAA,EAIqC;IAAA,IAJK;MAC/CpB;IAGF,CAAC,GAAAoB,KAAA;IACC,IAAM;MAAEC;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IAAKA,KAAK,CAAChB,OAAO,CAAC,CAACqB,IAAI,CAAC,IAAI,CAAC;MACrE,MAAM,IAAIC,KAAK,mBAAAC,MAAA,CAAmBJ,aAAa,CAAE,CAAC;IACpD;IACA,OAAOlB,QAAQ;EACjB,CAAC;EAAA,OAAAY,6BAAA,CAAAtB,KAAA,OAAAC,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"AuthenticationSettingsOps.js","names":["state","readAuthenticationSettings","_asyncToGenerator","updateAuthenticationSettings","settings","exportAuthenticationSettings","importAuthenticationSettings","importData","exports","default","_default","createAuthenticationSettingsExportTemplate","_ref","meta","getMetadata","authentication","_x","_readAuthenticationSettings","apply","arguments","_ref2","_getAuthenticationSettings","_x2","_updateAuthenticationSettings","_ref3","debugMessage","message","response","_putAuthenticationSettings","_x3","_exportAuthenticationSettings","_ref4","settingsData","exportData","_x4","_importAuthenticationSettings","_ref5","errors","error","push","length","errorMessages","map","_error$response","_error$response2","_error$response3","_error$response4","_error$response5","concat","status","data","join","Error"],"sources":["../../src/ops/AuthenticationSettingsOps.ts"],"sourcesContent":["import {\n type AuthenticationSettingsSkeleton,\n getAuthenticationSettings as _getAuthenticationSettings,\n putAuthenticationSettings as _putAuthenticationSettings,\n} from '../api/AuthenticationSettingsApi';\nimport { State } from '../shared/State';\nimport { debugMessage } from '../utils/Console';\nimport { getMetadata } from '../utils/ExportImportUtils';\nimport { type ExportMetaData } from './OpsTypes';\n\nexport type AuthenticationSettings = {\n /**\n * Read authentication settings\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves an authentication settings object\n */\n readAuthenticationSettings(): Promise<AuthenticationSettingsSkeleton>;\n /**\n * Update authentication settings\n * @param {AuthenticationSettingsSkeleton} settings authentication settings data\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves an authentication settings object\n */\n updateAuthenticationSettings(\n settings: AuthenticationSettingsSkeleton\n ): Promise<AuthenticationSettingsSkeleton>;\n /**\n * Export authentication settings\n * @returns {Promise<AuthenticationSettingsExportInterface>} a promise that resolves to an AuthenticationSettingsExportInterface object\n */\n exportAuthenticationSettings(): Promise<AuthenticationSettingsExportInterface>;\n /**\n * Import authentication settings\n * @param {AuthenticationSettingsExportInterface} importData import data\n */\n importAuthenticationSettings(\n importData: AuthenticationSettingsExportInterface\n ): Promise<AuthenticationSettingsSkeleton>;\n};\n\nexport default (state: State): AuthenticationSettings => {\n return {\n async readAuthenticationSettings() {\n return readAuthenticationSettings({ state });\n },\n async updateAuthenticationSettings(\n settings: AuthenticationSettingsSkeleton\n ) {\n return updateAuthenticationSettings({\n settings,\n state,\n });\n },\n async exportAuthenticationSettings(): Promise<AuthenticationSettingsExportInterface> {\n return exportAuthenticationSettings({ state });\n },\n async importAuthenticationSettings(\n importData: AuthenticationSettingsExportInterface\n ): Promise<AuthenticationSettingsSkeleton> {\n return importAuthenticationSettings({ importData, state });\n },\n };\n};\n\nexport interface AuthenticationSettingsExportInterface {\n meta?: ExportMetaData;\n authentication: AuthenticationSettingsSkeleton;\n}\n\n/**\n * Create an empty authentication settings export template\n * @returns {AuthenticationSettingsExportInterface} an empty authentication settings export template\n */\nfunction createAuthenticationSettingsExportTemplate({\n state,\n}: {\n state: State;\n}): AuthenticationSettingsExportInterface {\n return {\n meta: getMetadata({ state }),\n authentication: {},\n } as AuthenticationSettingsExportInterface;\n}\n\n/**\n * Read authentication settings\n * @returns {Promise} a promise that resolves to an object containing an array of authentication settingss\n */\nexport async function readAuthenticationSettings({\n state,\n}: {\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n const settings = await _getAuthenticationSettings({ state });\n return settings;\n}\n\nexport async function updateAuthenticationSettings({\n settings,\n state,\n}: {\n settings: AuthenticationSettingsSkeleton;\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n debugMessage({\n message: `AuthenticationSettingsOps.updateAuthenticationSettings: start`,\n state,\n });\n const response = await _putAuthenticationSettings({\n settings,\n state,\n });\n debugMessage({\n message: `AuthenticationSettingsOps.updateAuthenticationSettings: end`,\n state,\n });\n return response;\n}\n\n/**\n * Export authentication settings\n * @returns {Promise<AuthenticationSettingsExportInterface>} a promise that resolves to a AuthenticationSettingsExportInterface object\n */\nexport async function exportAuthenticationSettings({\n state,\n}: {\n state: State;\n}): Promise<AuthenticationSettingsExportInterface> {\n debugMessage({\n message: `AuthenticationSettingsOps.exportAuthenticationSettings: start`,\n state,\n });\n const settingsData = await readAuthenticationSettings({ state });\n const exportData = createAuthenticationSettingsExportTemplate({ state });\n exportData.authentication = settingsData;\n debugMessage({\n message: `AuthenticationSettingsOps.exportAuthenticationSettings: end`,\n state,\n });\n return exportData;\n}\n\n/**\n * Import authentication settings\n * @param {AuthenticationSettingsExportInterface} importData import data\n * @returns {Promise<AuthenticationSettingsSkeleton>} a promise resolving to a authentication settings object\n */\nexport async function importAuthenticationSettings({\n importData,\n state,\n}: {\n importData: AuthenticationSettingsExportInterface;\n state: State;\n}): Promise<AuthenticationSettingsSkeleton> {\n let response = null;\n const errors = [];\n try {\n response = await updateAuthenticationSettings({\n settings: importData.authentication,\n state,\n });\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map(\n (error) =>\n `${error.response?.status}${\n error.response?.data['reason']\n ? ' ' + error.response?.data['reason']\n : ''\n }${\n error.response?.data['message']\n ? ' - ' + error.response?.data['message']\n : ''\n }`\n )\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n return response;\n}\n"],"mappings":";;;;;;;;;;;;;;;eAsCgBA,KAAY,IAA6B;EACvD,OAAO;IACCC,0BAA0BA,CAAA,EAAG;MAAA,OAAAC,iBAAA;QACjC,OAAOD,0BAA0B,CAAC;UAAED;QAAM,CAAC,CAAC;MAAC;IAC/C,CAAC;IACKG,4BAA4BA,CAChCC,QAAwC,EACxC;MAAA,OAAAF,iBAAA;QACA,OAAOC,4BAA4B,CAAC;UAClCC,QAAQ;UACRJ;QACF,CAAC,CAAC;MAAC;IACL,CAAC;IACKK,4BAA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
10
10
|
exports.readManagedObject = readManagedObject;
|
|
11
11
|
exports.readManagedObjects = readManagedObjects;
|
|
12
12
|
exports.resolveFullName = resolveFullName;
|
|
13
|
+
exports.resolvePerpetratorUuid = resolvePerpetratorUuid;
|
|
13
14
|
exports.resolveUserName = resolveUserName;
|
|
14
15
|
exports.updateManagedObject = updateManagedObject;
|
|
15
16
|
exports.updateManagedObjectProperties = updateManagedObjectProperties;
|
|
16
17
|
var _ManagedObjectApi = require("../api/ManagedObjectApi.js");
|
|
18
|
+
var _Constants = _interopRequireDefault(require("../shared/Constants.js"));
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
20
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
18
21
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
19
22
|
var _default = state => {
|
|
@@ -109,6 +112,14 @@ var _default = state => {
|
|
|
109
112
|
state
|
|
110
113
|
});
|
|
111
114
|
})();
|
|
115
|
+
},
|
|
116
|
+
resolvePerpetratorUuid(id) {
|
|
117
|
+
return _asyncToGenerator(function* () {
|
|
118
|
+
return resolvePerpetratorUuid({
|
|
119
|
+
id,
|
|
120
|
+
state
|
|
121
|
+
});
|
|
122
|
+
})();
|
|
112
123
|
}
|
|
113
124
|
};
|
|
114
125
|
};
|
|
@@ -323,4 +334,77 @@ function _resolveFullName() {
|
|
|
323
334
|
});
|
|
324
335
|
return _resolveFullName.apply(this, arguments);
|
|
325
336
|
}
|
|
337
|
+
function resolvePerpetratorUuid(_x10) {
|
|
338
|
+
return _resolvePerpetratorUuid.apply(this, arguments);
|
|
339
|
+
}
|
|
340
|
+
function _resolvePerpetratorUuid() {
|
|
341
|
+
_resolvePerpetratorUuid = _asyncToGenerator(function* (_ref10) {
|
|
342
|
+
var {
|
|
343
|
+
id,
|
|
344
|
+
state
|
|
345
|
+
} = _ref10;
|
|
346
|
+
try {
|
|
347
|
+
if (state.getDeploymentType() === _Constants.default.CLOUD_DEPLOYMENT_TYPE_KEY) {
|
|
348
|
+
var lookupPromises = [];
|
|
349
|
+
lookupPromises.push((0, _ManagedObjectApi.getManagedObject)({
|
|
350
|
+
type: 'teammember',
|
|
351
|
+
id,
|
|
352
|
+
fields: ['givenName', 'sn', 'userName'],
|
|
353
|
+
state
|
|
354
|
+
}));
|
|
355
|
+
lookupPromises.push((0, _ManagedObjectApi.getManagedObject)({
|
|
356
|
+
type: 'svcacct',
|
|
357
|
+
id,
|
|
358
|
+
fields: ['name', 'description'],
|
|
359
|
+
state
|
|
360
|
+
}));
|
|
361
|
+
lookupPromises.push((0, _ManagedObjectApi.getManagedObject)({
|
|
362
|
+
type: 'alpha_user',
|
|
363
|
+
id,
|
|
364
|
+
fields: ['givenName', 'sn', 'userName'],
|
|
365
|
+
state
|
|
366
|
+
}));
|
|
367
|
+
lookupPromises.push((0, _ManagedObjectApi.getManagedObject)({
|
|
368
|
+
type: 'bravo_user',
|
|
369
|
+
id,
|
|
370
|
+
fields: ['givenName', 'sn', 'userName'],
|
|
371
|
+
state
|
|
372
|
+
}));
|
|
373
|
+
var lookupResults = yield Promise.allSettled(lookupPromises);
|
|
374
|
+
// tenant admin
|
|
375
|
+
if (lookupResults[0].status === 'fulfilled') {
|
|
376
|
+
var admin = lookupResults[0].value;
|
|
377
|
+
return "Admin user: ".concat(admin.givenName, " ").concat(admin.sn, " (").concat(admin.userName, ")");
|
|
378
|
+
}
|
|
379
|
+
// service account
|
|
380
|
+
if (lookupResults[1].status === 'fulfilled') {
|
|
381
|
+
var sa = lookupResults[1].value;
|
|
382
|
+
return "Service account: ".concat(sa.name, " (").concat(sa.description, ")");
|
|
383
|
+
}
|
|
384
|
+
// alpha user
|
|
385
|
+
if (lookupResults[2].status === 'fulfilled') {
|
|
386
|
+
var user = lookupResults[2].value;
|
|
387
|
+
return "Alpha user: ".concat(user.givenName, " ").concat(user.sn, " (").concat(user.userName, ")");
|
|
388
|
+
}
|
|
389
|
+
// bravo user
|
|
390
|
+
if (lookupResults[3].status === 'fulfilled') {
|
|
391
|
+
var _user = lookupResults[3].value;
|
|
392
|
+
return "Bravo user:".concat(_user.givenName, " ").concat(_user.sn, " (").concat(_user.userName, ")");
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
var _user2 = yield (0, _ManagedObjectApi.getManagedObject)({
|
|
396
|
+
type: 'user',
|
|
397
|
+
id,
|
|
398
|
+
fields: ['givenName', 'sn', 'userName'],
|
|
399
|
+
state
|
|
400
|
+
});
|
|
401
|
+
return "".concat(_user2.givenName, " ").concat(_user2.sn, " (").concat(_user2.userName, ")");
|
|
402
|
+
}
|
|
403
|
+
} catch (error) {
|
|
404
|
+
// ignore
|
|
405
|
+
}
|
|
406
|
+
return id;
|
|
407
|
+
});
|
|
408
|
+
return _resolvePerpetratorUuid.apply(this, arguments);
|
|
409
|
+
}
|
|
326
410
|
//# sourceMappingURL=ManagedObjectOps.js.map
|