@rockcarver/frodo-lib 0.12.4 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.12.5] - 2022-09-29
11
+
12
+ ## [0.12.5-0] - 2022-09-19
13
+
10
14
  ## [0.12.4] - 2022-09-17
11
15
 
12
16
  ### Added
@@ -549,7 +553,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
549
553
  - Fixed problem with adding connection profiles
550
554
  - Miscellaneous bug fixes
551
555
 
552
- [Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.12.4...HEAD
556
+ [Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.12.5...HEAD
557
+
558
+ [0.12.5]: https://github.com/rockcarver/frodo-lib/compare/v0.12.5-0...v0.12.5
559
+
560
+ [0.12.5-0]: https://github.com/rockcarver/frodo-lib/compare/v0.12.4...v0.12.5-0
553
561
 
554
562
  [0.12.4]: https://github.com/rockcarver/frodo-lib/compare/v0.12.3...v0.12.4
555
563
 
@@ -10,31 +10,23 @@ exports.getRealmName = getRealmName;
10
10
  exports.getTenantURL = getTenantURL;
11
11
  exports.parseUrl = parseUrl;
12
12
 
13
- var _util = _interopRequireDefault(require("util"));
14
-
15
13
  var _SessionStorage = _interopRequireDefault(require("../../storage/SessionStorage"));
16
14
 
17
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
16
 
19
- var realmPathTemplate = '/realms/%s';
20
17
  /**
21
18
  * Get current realm path
22
19
  * @returns {String} a CREST-compliant realm path, e.g. /realms/root/realms/alpha
23
20
  */
24
-
25
21
  function getCurrentRealmPath() {
26
22
  var realm = _SessionStorage.default.session.getRealm();
27
23
 
28
- if (realm.startsWith('/') && realm.length > 1) {
24
+ if (realm.startsWith('/')) {
29
25
  realm = realm.substring(1);
30
26
  }
31
27
 
32
- var realmPath = _util.default.format(realmPathTemplate, 'root');
33
-
34
- if (realm !== '/') {
35
- realmPath += _util.default.format(realmPathTemplate, realm);
36
- }
37
-
28
+ var elements = ['root'].concat(realm.split('/').filter(element => element !== ''));
29
+ var realmPath = "/realms/".concat(elements.join('/realms/'));
38
30
  return realmPath;
39
31
  }
40
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ApiUtils.js","names":["realmPathTemplate","getCurrentRealmPath","realm","storage","session","getRealm","startsWith","length","substring","realmPath","util","format","getCurrentRealmName","components","split","realmName","getRealmName","getTenantURL","tenant","parsedUrl","URL","protocol","host","deleteDeepByKey","object","obj","keys","Object","key","indexOf","parseUrl","href","m","match","r","hash","hostname","origin","pathname","port","search","username","password","searchParam","toUpperCase","query","substr","vars","i","pair","decodeURIComponent"],"sources":["api/utils/ApiUtils.ts"],"sourcesContent":["import util from 'util';\nimport storage from '../../storage/SessionStorage';\n\nconst realmPathTemplate = '/realms/%s';\n\n/**\n * Get current realm path\n * @returns {String} a CREST-compliant realm path, e.g. /realms/root/realms/alpha\n */\nexport function getCurrentRealmPath() {\n let realm = storage.session.getRealm();\n if (realm.startsWith('/') && realm.length > 1) {\n realm = realm.substring(1);\n }\n let realmPath = util.format(realmPathTemplate, 'root');\n if (realm !== '/') {\n realmPath += util.format(realmPathTemplate, realm);\n }\n return realmPath;\n}\n\n/**\n * Get current realm name\n * @returns {String} name of the current realm. /alpha -> alpha\n */\nexport function getCurrentRealmName() {\n const realm = storage.session.getRealm();\n const components = realm.split('/');\n let realmName = '/';\n if (components.length > 0 && realmName !== realm) {\n realmName = components[components.length - 1];\n }\n return realmName;\n}\n\n/**\n * Get current realm name\n * @param {String} realm realm\n * @returns {String} name of the realm. /alpha -> alpha\n */\nexport function getRealmName(realm) {\n const components = realm.split('/');\n let realmName = '/';\n if (components.length > 0 && realmName !== realm) {\n realmName = components[components.length - 1];\n }\n return realmName;\n}\n\n/**\n * Get tenant base URL\n * @param {String} tenant tenant URL with path and query params\n * @returns {String} tenant base URL without path and query params\n */\nexport function getTenantURL(tenant) {\n const parsedUrl = new URL(tenant);\n return `${parsedUrl.protocol}//${parsedUrl.host}`;\n}\n\n/**\n * Deep delete keys and their values from an input object. If a key in object contains substring, the key an its value is deleted.\n * @param {Object} object input object that needs keys removed\n * @param {String} substring substring to search for in key\n * @returns the modified object without the matching keys and their values\n */\nexport function deleteDeepByKey(object, substring) {\n const obj = object;\n const keys = Object.keys(obj);\n for (const key of keys) {\n if (key.indexOf(substring) > 0) {\n delete obj[key];\n } else if (Object(obj[key]) === obj[key]) {\n obj[key] = deleteDeepByKey(obj[key], substring);\n }\n }\n return obj;\n}\n\n/*\n * Parse a URL into its components and make them easily accessible by name\n *\n * Use in a Scripte Decision Node Script as follows:\n * var referer = parseUrl(requestHeaders.get(\"referer\").get(0));\n * var origin = referer.origin;\n *\n * e.g.: https://openam-volker-dev.forgeblocks.com/am/XUI/?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim#/\n * {\n * hash: '#/',\n * host: 'openam-volker-dev.forgeblocks.com',\n * hostname: 'openam-volker-dev.forgeblocks.com',\n * href: 'https://openam-volker-dev.forgeblocks.com/am/XUI/?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim#/',\n * origin: 'https://openam-volker-dev.forgeblocks.com',\n * pathname: '/am/XUI/',\n * port: '',\n * protocol: 'https',\n * search: '?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim',\n * username: '',\n * password: '',\n * searchParam: {\n * realm: '/bravo',\n * authIndexType: 'service',\n * authIndexValue: 'InitiateOwnerClaim'\n * }\n * }\n */\nexport function parseUrl(href) {\n const m = href.match(\n /^(([^:/?#]+):?(?:\\/\\/((?:([^/?#:]*):([^/?#:]*)@)?([^/?#:]*)(?::([^/?#:]*))?)))?([^?#]*)(\\?[^#]*)?(#.*)?$/\n ),\n r = {\n hash: m[10] || '', // #/\n host: m[3] || '', // openam-volker-dev.forgeblocks.com\n hostname: m[6] || '', // openam-volker-dev.forgeblocks.com\n href: m[0] || '', // https://openam-volker-dev.forgeblocks.com/am/XUI/?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim#/\n origin: m[1] || '', // https://openam-volker-dev.forgeblocks.com\n pathname: m[8] || (m[1] ? '/' : ''), // /am/XUI/\n port: m[7] || '', //\n protocol: m[2] || '', // https\n search: m[9] || '', // ?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim\n username: m[4] || '', //\n password: m[5] || '', //\n searchParam: {}, // { realm: '/bravo',\n // authIndexType: 'service',\n // authIndexValue: 'InitiateOwnerClaim' }\n };\n if (r.protocol.length == 2) {\n r.protocol = 'file:///' + r.protocol.toUpperCase();\n r.origin = r.protocol + '//' + r.host;\n }\n if (r.search.length > 2) {\n const query = r.search.indexOf('?') === 0 ? r.search.substr(1) : r.search;\n const vars = query.split('&');\n for (let i = 0; i < vars.length; i++) {\n const pair = vars[i].split('=');\n r.searchParam[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n }\n r.href = r.origin + r.pathname + r.search + r.hash;\n return r;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;;;AAEA,IAAMA,iBAAiB,GAAG,YAA1B;AAEA;AACA;AACA;AACA;;AACO,SAASC,mBAAT,GAA+B;EACpC,IAAIC,KAAK,GAAGC,uBAAA,CAAQC,OAAR,CAAgBC,QAAhB,EAAZ;;EACA,IAAIH,KAAK,CAACI,UAAN,CAAiB,GAAjB,KAAyBJ,KAAK,CAACK,MAAN,GAAe,CAA5C,EAA+C;IAC7CL,KAAK,GAAGA,KAAK,CAACM,SAAN,CAAgB,CAAhB,CAAR;EACD;;EACD,IAAIC,SAAS,GAAGC,aAAA,CAAKC,MAAL,CAAYX,iBAAZ,EAA+B,MAA/B,CAAhB;;EACA,IAAIE,KAAK,KAAK,GAAd,EAAmB;IACjBO,SAAS,IAAIC,aAAA,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,OAAOD,CAAP;AACD"}
1
+ {"version":3,"file":"ApiUtils.js","names":["getCurrentRealmPath","realm","storage","session","getRealm","startsWith","substring","elements","concat","split","filter","element","realmPath","join","getCurrentRealmName","components","realmName","length","getRealmName","getTenantURL","tenant","parsedUrl","URL","protocol","host","deleteDeepByKey","object","obj","keys","Object","key","indexOf","parseUrl","href","m","match","r","hash","hostname","origin","pathname","port","search","username","password","searchParam","toUpperCase","query","substr","vars","i","pair","decodeURIComponent"],"sources":["api/utils/ApiUtils.ts"],"sourcesContent":["import storage from '../../storage/SessionStorage';\n\n/**\n * Get current realm path\n * @returns {String} a CREST-compliant realm path, e.g. /realms/root/realms/alpha\n */\nexport function getCurrentRealmPath() {\n let realm = storage.session.getRealm();\n if (realm.startsWith('/')) {\n realm = realm.substring(1);\n }\n const elements = ['root'].concat(\n realm.split('/').filter((element) => element !== '')\n );\n const realmPath = `/realms/${elements.join('/realms/')}`;\n return realmPath;\n}\n\n/**\n * Get current realm name\n * @returns {String} name of the current realm. /alpha -> alpha\n */\nexport function getCurrentRealmName() {\n const realm = storage.session.getRealm();\n const components = realm.split('/');\n let realmName = '/';\n if (components.length > 0 && realmName !== realm) {\n realmName = components[components.length - 1];\n }\n return realmName;\n}\n\n/**\n * Get current realm name\n * @param {String} realm realm\n * @returns {String} name of the realm. /alpha -> alpha\n */\nexport function getRealmName(realm) {\n const components = realm.split('/');\n let realmName = '/';\n if (components.length > 0 && realmName !== realm) {\n realmName = components[components.length - 1];\n }\n return realmName;\n}\n\n/**\n * Get tenant base URL\n * @param {String} tenant tenant URL with path and query params\n * @returns {String} tenant base URL without path and query params\n */\nexport function getTenantURL(tenant) {\n const parsedUrl = new URL(tenant);\n return `${parsedUrl.protocol}//${parsedUrl.host}`;\n}\n\n/**\n * Deep delete keys and their values from an input object. If a key in object contains substring, the key an its value is deleted.\n * @param {Object} object input object that needs keys removed\n * @param {String} substring substring to search for in key\n * @returns the modified object without the matching keys and their values\n */\nexport function deleteDeepByKey(object, substring) {\n const obj = object;\n const keys = Object.keys(obj);\n for (const key of keys) {\n if (key.indexOf(substring) > 0) {\n delete obj[key];\n } else if (Object(obj[key]) === obj[key]) {\n obj[key] = deleteDeepByKey(obj[key], substring);\n }\n }\n return obj;\n}\n\n/*\n * Parse a URL into its components and make them easily accessible by name\n *\n * Use in a Scripte Decision Node Script as follows:\n * var referer = parseUrl(requestHeaders.get(\"referer\").get(0));\n * var origin = referer.origin;\n *\n * e.g.: https://openam-volker-dev.forgeblocks.com/am/XUI/?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim#/\n * {\n * hash: '#/',\n * host: 'openam-volker-dev.forgeblocks.com',\n * hostname: 'openam-volker-dev.forgeblocks.com',\n * href: 'https://openam-volker-dev.forgeblocks.com/am/XUI/?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim#/',\n * origin: 'https://openam-volker-dev.forgeblocks.com',\n * pathname: '/am/XUI/',\n * port: '',\n * protocol: 'https',\n * search: '?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim',\n * username: '',\n * password: '',\n * searchParam: {\n * realm: '/bravo',\n * authIndexType: 'service',\n * authIndexValue: 'InitiateOwnerClaim'\n * }\n * }\n */\nexport function parseUrl(href) {\n const m = href.match(\n /^(([^:/?#]+):?(?:\\/\\/((?:([^/?#:]*):([^/?#:]*)@)?([^/?#:]*)(?::([^/?#:]*))?)))?([^?#]*)(\\?[^#]*)?(#.*)?$/\n ),\n r = {\n hash: m[10] || '', // #/\n host: m[3] || '', // openam-volker-dev.forgeblocks.com\n hostname: m[6] || '', // openam-volker-dev.forgeblocks.com\n href: m[0] || '', // https://openam-volker-dev.forgeblocks.com/am/XUI/?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim#/\n origin: m[1] || '', // https://openam-volker-dev.forgeblocks.com\n pathname: m[8] || (m[1] ? '/' : ''), // /am/XUI/\n port: m[7] || '', //\n protocol: m[2] || '', // https\n search: m[9] || '', // ?realm=/bravo&authIndexType=service&authIndexValue=InitiateOwnerClaim\n username: m[4] || '', //\n password: m[5] || '', //\n searchParam: {}, // { realm: '/bravo',\n // authIndexType: 'service',\n // authIndexValue: 'InitiateOwnerClaim' }\n };\n if (r.protocol.length == 2) {\n r.protocol = 'file:///' + r.protocol.toUpperCase();\n r.origin = r.protocol + '//' + r.host;\n }\n if (r.search.length > 2) {\n const query = r.search.indexOf('?') === 0 ? r.search.substr(1) : r.search;\n const vars = query.split('&');\n for (let i = 0; i < vars.length; i++) {\n const pair = vars[i].split('=');\n r.searchParam[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n }\n r.href = r.origin + r.pathname + r.search + r.hash;\n return r;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,mBAAT,GAA+B;EACpC,IAAIC,KAAK,GAAGC,uBAAA,CAAQC,OAAR,CAAgBC,QAAhB,EAAZ;;EACA,IAAIH,KAAK,CAACI,UAAN,CAAiB,GAAjB,CAAJ,EAA2B;IACzBJ,KAAK,GAAGA,KAAK,CAACK,SAAN,CAAgB,CAAhB,CAAR;EACD;;EACD,IAAMC,QAAQ,GAAG,CAAC,MAAD,EAASC,MAAT,CACfP,KAAK,CAACQ,KAAN,CAAY,GAAZ,EAAiBC,MAAjB,CAAyBC,OAAD,IAAaA,OAAO,KAAK,EAAjD,CADe,CAAjB;EAGA,IAAMC,SAAS,qBAAcL,QAAQ,CAACM,IAAT,CAAc,UAAd,CAAd,CAAf;EACA,OAAOD,SAAP;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASE,mBAAT,GAA+B;EACpC,IAAMb,KAAK,GAAGC,uBAAA,CAAQC,OAAR,CAAgBC,QAAhB,EAAd;;EACA,IAAMW,UAAU,GAAGd,KAAK,CAACQ,KAAN,CAAY,GAAZ,CAAnB;EACA,IAAIO,SAAS,GAAG,GAAhB;;EACA,IAAID,UAAU,CAACE,MAAX,GAAoB,CAApB,IAAyBD,SAAS,KAAKf,KAA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CAAC,CAACG,MAAF,GAAWH,CAAC,CAACb,QAAF,GAAa,IAAb,GAAoBa,CAAC,CAACZ,IAAjC;EACD;;EACD,IAAIY,CAAC,CAACM,MAAF,CAASzB,MAAT,GAAkB,CAAtB,EAAyB;IACvB,IAAM8B,KAAK,GAAGX,CAAC,CAACM,MAAF,CAASX,OAAT,CAAiB,GAAjB,MAA0B,CAA1B,GAA8BK,CAAC,CAACM,MAAF,CAASM,MAAT,CAAgB,CAAhB,CAA9B,GAAmDZ,CAAC,CAACM,MAAnE;IACA,IAAMO,IAAI,GAAGF,KAAK,CAACtC,KAAN,CAAY,GAAZ,CAAb;;IACA,KAAK,IAAIyC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,IAAI,CAAChC,MAAzB,EAAiCiC,CAAC,EAAlC,EAAsC;MACpC,IAAMC,IAAI,GAAGF,IAAI,CAACC,CAAD,CAAJ,CAAQzC,KAAR,CAAc,GAAd,CAAb;MACA2B,CAAC,CAACS,WAAF,CAAcO,kBAAkB,CAACD,IAAI,CAAC,CAAD,CAAL,CAAhC,IAA6CC,kBAAkB,CAACD,IAAI,CAAC,CAAD,CAAL,CAA/D;IACD;EACF;;EACDf,CAAC,CAACH,IAAF,GAASG,CAAC,CAACG,MAAF,GAAWH,CAAC,CAACI,QAAb,GAAwBJ,CAAC,CAACM,MAA1B,GAAmCN,CAAC,CAACC,IAA9C;EACA,OAAOD,CAAP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiUtils.test.js","names":["test","skip","expect","toBe","REALM_PATH","sessionStorage","session","setItem","testString","getCurrentRealmPath","URL_WITH_TENANT","parsed","getTenantURL","trap","toThrow"],"sources":["api/utils/ApiUtils.test.ts"],"sourcesContent":["import { getCurrentRealmPath, getTenantURL } from './ApiUtils';\nimport sessionStorage from '../../storage/SessionStorage';\n\ntest.skip('replaceAll should be deleted because it works like native String.replaceAll', () => {\n // Arrange\n // Act\n // Assert\n expect(true).toBe(false);\n});\n\ntest('getCurrentRealmPath should prepend realmPath to specified realm', () => {\n // Arrange\n const REALM_PATH = 'alpha';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/alpha');\n});\n\ntest('getCurrentRealmPath should prepend realmPath to specified realm with leading slash', () => {\n // Arrange\n const REALM_PATH = '/alpha';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/alpha');\n});\n\ntest('getCurrentRealmPath \"/\" should resolve to root', () => {\n // Arrange\n const REALM_PATH = '/';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root');\n});\n\ntest('getCurrentRealmPath should not handle multiple leading slash', () => {\n // Arrange\n const REALM_PATH = '//alpha';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms//alpha');\n});\n\ntest('getCurrentRealmPath should not handle nested depth realms', () => {\n // Arrange\n const REALM_PATH = '/alpha/erm';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/alpha/erm');\n});\n\ntest('getTenantURL should parse the https protocol and the hostname', () => {\n // Arrange\n const URL_WITH_TENANT =\n 'https://example.frodo.com/am/ui-admin/#realms/%2Falpha/dashboard';\n\n // Act\n const parsed = getTenantURL(URL_WITH_TENANT);\n\n // Assert\n expect(parsed).toBe('https://example.frodo.com');\n});\n\ntest('getTenantURL should not validate protocol', () => {\n // Arrange\n const URL_WITH_TENANT =\n 'ftp://example.frodo.com/am/ui-admin/#realms/%2Falpha/dashboard';\n // Act\n const parsed = getTenantURL(URL_WITH_TENANT);\n // Assert\n expect(parsed).toBe('ftp://example.frodo.com');\n});\n\ntest('getTenantURL Invalid URL should throw', () => {\n // Arrange\n const URL_WITH_TENANT =\n '//:example.frodo.com/am/ui-admin/#realms/%2Falpha/dashboard';\n // Act\n const trap = () => {\n getTenantURL(URL_WITH_TENANT);\n };\n // Assert\n expect(trap).toThrow('Invalid URL');\n});\n"],"mappings":";;AAAA;;AACA;;;;AAEAA,IAAI,CAACC,IAAL,CAAU,6EAAV,EAAyF,MAAM;EAC7F;EACA;EACA;EACAC,MAAM,CAAC,IAAD,CAAN,CAAaC,IAAb,CAAkB,KAAlB;AACD,CALD;AAOAH,IAAI,CAAC,iEAAD,EAAoE,MAAM;EAC5E;EACA,IAAMI,UAAU,GAAG,OAAnB;;EACAC,uBAAA,CAAeC,OAAf,CAAuBC,OAAvB,CAA+B,OAA/B,EAAwCH,UAAxC,EAH4E,CAI5E;;;EACA,IAAMI,UAAU,GAAG,IAAAC,6BAAA,GAAnB,CAL4E,CAM5E;;EACAP,MAAM,CAACM,UAAD,CAAN,CAAmBL,IAAnB,CAAwB,2BAAxB;AACD,CARG,CAAJ;AAUAH,IAAI,CAAC,oFAAD,EAAuF,MAAM;EAC/F;EACA,IAAMI,UAAU,GAAG,QAAnB;;EACAC,uBAAA,CAAeC,OAAf,CAAuBC,OAAvB,CAA+B,OAA/B,EAAwCH,UAAxC,EAH+F,CAI/F;;;EACA,IAAMI,UAAU,GAAG,IAAAC,6BAAA,GAAnB,CAL+F,CAM/F;;EACAP,MAAM,CAACM,UAAD,CAAN,CAAmBL,IAAnB,CAAwB,2BAAxB;AACD,CARG,CAAJ;AAUAH,IAAI,CAAC,gDAAD,EAAmD,MAAM;EAC3D;EACA,IAAMI,UAAU,GAAG,GAAnB;;EACAC,uBAAA,CAAeC,OAAf,CAAuBC,OAAvB,CAA+B,OAA/B,EAAwCH,UAAxC,EAH2D,CAI3D;;;EACA,IAAMI,UAAU,GAAG,IAAAC,6BAAA,GAAnB,CAL2D,CAM3D;;EACAP,MAAM,CAACM,UAAD,CAAN,CAAmBL,IAAnB,CAAwB,cAAxB;AACD,CARG,CAAJ;AAU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aF,eAAb;EACD,CAFD,CALkD,CAQlD;;;EACAR,MAAM,CAACW,IAAD,CAAN,CAAaC,OAAb,CAAqB,aAArB;AACD,CAVG,CAAJ"}
1
+ {"version":3,"file":"ApiUtils.test.js","names":["test","skip","expect","toBe","REALM_PATH","sessionStorage","session","setItem","testString","getCurrentRealmPath","URL_WITH_TENANT","parsed","getTenantURL","trap","toThrow"],"sources":["api/utils/ApiUtils.test.ts"],"sourcesContent":["import { getCurrentRealmPath, getTenantURL } from './ApiUtils';\nimport sessionStorage from '../../storage/SessionStorage';\n\ntest.skip('replaceAll should be deleted because it works like native String.replaceAll', () => {\n // Arrange\n // Act\n // Assert\n expect(true).toBe(false);\n});\n\ntest('getCurrentRealmPath should prepend realmPath to specified realm', () => {\n // Arrange\n const REALM_PATH = 'alpha';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/alpha');\n});\n\ntest('getCurrentRealmPath should prepend realmPath to specified realm with leading slash', () => {\n // Arrange\n const REALM_PATH = '/alpha';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/alpha');\n});\n\ntest('getCurrentRealmPath \"/\" should resolve to root', () => {\n // Arrange\n const REALM_PATH = '/';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root');\n});\n\ntest('getCurrentRealmPath should handle multiple leading slashes', () => {\n // Arrange\n const REALM_PATH = '//alpha';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/alpha');\n});\n\ntest('getCurrentRealmPath should handle nested realms', () => {\n // Arrange\n const REALM_PATH = '/parent/child';\n sessionStorage.session.setItem('realm', REALM_PATH);\n // Act\n const testString = getCurrentRealmPath();\n // Assert\n expect(testString).toBe('/realms/root/realms/parent/realms/child');\n});\n\ntest('getTenantURL should parse the https protocol and the hostname', () => {\n // Arrange\n const URL_WITH_TENANT =\n 'https://example.frodo.com/am/ui-admin/#realms/%2Falpha/dashboard';\n\n // Act\n const parsed = getTenantURL(URL_WITH_TENANT);\n\n // Assert\n expect(parsed).toBe('https://example.frodo.com');\n});\n\ntest('getTenantURL should not validate protocol', () => {\n // Arrange\n const URL_WITH_TENANT =\n 'ftp://example.frodo.com/am/ui-admin/#realms/%2Falpha/dashboard';\n // Act\n const parsed = getTenantURL(URL_WITH_TENANT);\n // Assert\n expect(parsed).toBe('ftp://example.frodo.com');\n});\n\ntest('getTenantURL Invalid URL should throw', () => {\n // Arrange\n const URL_WITH_TENANT =\n '//:example.frodo.com/am/ui-admin/#realms/%2Falpha/dashboard';\n // Act\n const trap = () => {\n getTenantURL(URL_WITH_TENANT);\n };\n // Assert\n expect(trap).toThrow('Invalid URL');\n});\n"],"mappings":";;AAAA;;AACA;;;;AAEAA,IAAI,CAACC,IAAL,CAAU,6EAAV,EAAyF,MAAM;EAC7F;EACA;EACA;EACAC,MAAM,CAAC,IAAD,CAAN,CAAaC,IAAb,CAAkB,KAAlB;AACD,CALD;AAOAH,IAAI,CAAC,iEAAD,EAAoE,MAAM;EAC5E;EACA,IAAMI,UAAU,GAAG,OAAnB;;EACAC,uBAAA,CAAeC,OAAf,CAAuBC,OAAvB,CAA+B,OAA/B,EAAwCH,UAAxC,EAH4E,CAI5E;;;EACA,IAAMI,UAAU,GAAG,IAAAC,6BAAA,GAAnB,CAL4E,CAM5E;;EACAP,MAAM,CAACM,UAAD,CAAN,CAAmBL,IAAnB,CAAwB,2BAAxB;AACD,CARG,CAAJ;AAUAH,IAAI,CAAC,oFAAD,EAAuF,MAAM;EAC/F;EACA,IAAMI,UAAU,GAAG,QAAnB;;EACAC,uBAAA,CAAeC,OAAf,CAAuBC,OAAvB,CAA+B,OAA/B,EAAwCH,UAAxC,EAH+F,CAI/F;;;EACA,IAAMI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S,MAAD,CAAN,CAAeR,IAAf,CAAoB,2BAApB;AACD,CAVG,CAAJ;AAYAH,IAAI,CAAC,2CAAD,EAA8C,MAAM;EACtD;EACA,IAAMU,eAAe,GACnB,gEADF,CAFsD,CAItD;;EACA,IAAMC,MAAM,GAAG,IAAAC,sBAAA,EAAaF,eAAb,CAAf,CALsD,CAMtD;;EACAR,MAAM,CAACS,MAAD,CAAN,CAAeR,IAAf,CAAoB,yBAApB;AACD,CARG,CAAJ;AAUAH,IAAI,CAAC,uCAAD,EAA0C,MAAM;EAClD;EACA,IAAMU,eAAe,GACnB,6DADF,CAFkD,CAIlD;;EACA,IAAMG,IAAI,GAAG,MAAM;IACjB,IAAAD,sBAAA,EAAaF,eAAb;EACD,CAFD,CALkD,CAQlD;;;EACAR,MAAM,CAACW,IAAD,CAAN,CAAaC,OAAb,CAAqB,aAArB;AACD,CAVG,CAAJ"}
package/cjs/ops/IdmOps.js CHANGED
@@ -123,8 +123,13 @@ function _exportAllRawConfigEntities() {
123
123
  var entityPromises = [];
124
124
  configEntities['configurations'].forEach(x => {
125
125
  entityPromises.push((0, _IdmConfigApi.getConfigEntity)(x._id).catch(getConfigEntityError => {
126
- if (!(getConfigEntityError.response.status === 403 && getConfigEntityError.response.data.message === 'This operation is not available in ForgeRock Identity Cloud.')) {
127
- (0, _Console.printMessage)(getConfigEntityError, 'error');
126
+ var _getConfigEntityError, _getConfigEntityError2, _getConfigEntityError3, _getConfigEntityError4, _getConfigEntityError5, _getConfigEntityError6;
127
+
128
+ if (!(((_getConfigEntityError = getConfigEntityError.response) === null || _getConfigEntityError === void 0 ? void 0 : _getConfigEntityError.status) === 403 && ((_getConfigEntityError2 = getConfigEntityError.response) === null || _getConfigEntityError2 === void 0 ? void 0 : (_getConfigEntityError3 = _getConfigEntityError2.data) === null || _getConfigEntityError3 === void 0 ? void 0 : _getConfigEntityError3.message) === 'This operation is not available in ForgeRock Identity Cloud.') && // https://bugster.forgerock.org/jira/browse/OPENIDM-18270
129
+ !(((_getConfigEntityError4 = getConfigEntityError.response) === null || _getConfigEntityError4 === void 0 ? void 0 : _getConfigEntityError4.status) === 404 && ((_getConfigEntityError5 = getConfigEntityError.response) === null || _getConfigEntityError5 === void 0 ? void 0 : (_getConfigEntityError6 = _getConfigEntityError5.data) === null || _getConfigEntityError6 === void 0 ? void 0 : _getConfigEntityError6.message) === 'No configuration exists for id org.apache.felix.fileinstall/openidm')) {
130
+ var _getConfigEntityError7;
131
+
132
+ (0, _Console.printMessage)((_getConfigEntityError7 = getConfigEntityError.response) === null || _getConfigEntityError7 === void 0 ? void 0 : _getConfigEntityError7.data, 'error');
128
133
  (0, _Console.printMessage)("Error getting config entity: ".concat(getConfigEntityError), 'error');
129
134
  }
130
135
  }));
@@ -141,7 +146,7 @@ function _exportAllRawConfigEntities() {
141
146
  });
142
147
  }
143
148
  });
144
- (0, _Console.stopProgressIndicator)(null, 'success');
149
+ (0, _Console.stopProgressIndicator)('Exported config objects.', 'success');
145
150
  });
146
151
  }
147
152
  });
@@ -1 +1 @@
1
- {"version":3,"file":"IdmOps.js","names":["listAllConfigEntities","configEntities","getAllConfigEntities","getAllConfigEntitiesError","printMessage","forEach","configEntity","_id","exportConfigEntity","id","file","fileName","getTypedFilename","getConfigEntity","fs","writeFile","JSON","stringify","err","exportAllRawConfigEntities","directory","existsSync","mkdirSync","createProgressIndicator","undefined","entityPromises","x","push","catch","getConfigEntityError","response","status","data","message","Promise","all","then","result","item","fse","outputFile","stopProgressIndicator","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","entriesData","parse","idm","envParams","propertiesReader","includes","configEntityString","each","key","value","replaceall","error","countManagedObjects","type","count","resultCount","pagedResultsCookie","totalPagedResultsPolicy","totalPagedResults","remainingPagedResults","queryAllManagedObjectsByType"],"sources":["ops/IdmOps.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport replaceall from 'replaceall';\nimport propertiesReader from 'properties-reader';\nimport {\n getAllConfigEntities,\n getConfigEntity,\n queryAllManagedObjectsByType,\n} from '../api/IdmConfigApi';\nimport {\n printMessage,\n createProgressIndicator,\n stopProgressIndicator,\n} from './utils/Console';\nimport { getTypedFilename } from './utils/ExportImportUtils';\n\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n let configEntities = [];\n try {\n configEntities = await getAllConfigEntities();\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n if ('configurations' in configEntities) {\n configEntities['configurations'].forEach((configEntity) => {\n printMessage(`${configEntity._id}`, 'data');\n });\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await getConfigEntity(id);\n fs.writeFile(fileName, JSON.stringify(configEntity, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n * @param {String} directory export directory\n */\nexport async function exportAllRawConfigEntities(directory) {\n let configEntities = [];\n try {\n configEntities = await getAllConfigEntities();\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n if ('configurations' in configEntities) {\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n undefined,\n 'Exporting config objects...',\n 'indeterminate'\n );\n const entityPromises = [];\n configEntities['configurations'].forEach((x) => {\n entityPromises.push(\n getConfigEntity(x._id).catch((getConfigEntityError) => {\n if (\n !(\n getConfigEntityError.response.status === 403 &&\n getConfigEntityError.response.data.message ===\n 'This operation is not available in ForgeRock Identity Cloud.'\n )\n ) {\n printMessage(getConfigEntityError, 'error');\n printMessage(\n `Error getting config entity: ${getConfigEntityError}`,\n 'error'\n );\n }\n })\n );\n });\n Promise.all(entityPromises).then((result) => {\n // console.log(result);\n result.forEach((item) => {\n if (item != null) {\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n // eslint-disable-next-line consistent-return\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n });\n stopProgressIndicator(null, 'success');\n });\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} directory export directory\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(\n directory,\n entitiesFile,\n envFile\n) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n let configEntities = [];\n try {\n configEntities = await getAllConfigEntities();\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n if ('configurations' in configEntities) {\n // create export directory if not exist\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n undefined,\n 'Exporting config objects...',\n 'indeterminate'\n );\n const entityPromises = [];\n configEntities['configurations'].forEach((x) => {\n if (entriesToExport.includes(x._id)) {\n // console.log(`- ${x._id}`);\n entityPromises.push(getConfigEntity(x._id));\n }\n });\n Promise.all(entityPromises).then((result) => {\n // console.log(result);\n result.forEach((item) => {\n if (item != null) {\n let configEntityString = JSON.stringify(item, null, 2);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n // eslint-disable-next-line consistent-return\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n });\n stopProgressIndicator(null, 'success');\n });\n }\n });\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type) {\n let count = 0;\n let result = {\n result: [],\n resultCount: 0,\n pagedResultsCookie: null,\n totalPagedResultsPolicy: 'NONE',\n totalPagedResults: -1,\n remainingPagedResults: -1,\n };\n try {\n do {\n result = await queryAllManagedObjectsByType(\n type,\n [],\n result.pagedResultsCookie\n );\n count += result.resultCount;\n // printMessage(result);\n } while (result.pagedResultsCookie);\n printMessage(`${type}: ${count}`);\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;;;;;;;AAEA;AACA;AACA;SACsBA,qB;;;AAkBtB;AACA;AACA;AACA;AACA;;;;6CAtBO,aAAuC;IAC5C,IAAIC,cAAc,GAAG,EAArB;;IACA,IAAI;MACFA,cAAc,SAAS,IAAAC,kCAAA,GAAvB;IACD,CAFD,CAEE,OAAOC,yBAAP,EAAkC;MAClC,IAAAC,qBAAA,EAAaD,yBAAb,EAAwC,OAAxC;MACA,IAAAC,qBAAA,2CACoCD,yBADpC,GAEE,OAFF;IAID;;IACD,IAAI,oBAAoBF,cAAxB,EAAwC;MACtCA,cAAc,CAAC,gBAAD,CAAd,CAAiCI,OAAjC,CAA0CC,YAAD,IAAkB;QACzD,IAAAF,qBAAA,YAAgBE,YAAY,CAACC,GAA7B,GAAoC,MAApC;MACD,CAFD;IAGD;EACF,C;;;;SAOqBC,kB;;;AActB;AACA;AACA;AACA;;;;0CAjB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Entities","getAllConfigEntities","getAllConfigEntitiesError","printMessage","forEach","configEntity","_id","exportConfigEntity","id","file","fileName","getTypedFilename","getConfigEntity","fs","writeFile","JSON","stringify","err","exportAllRawConfigEntities","directory","existsSync","mkdirSync","createProgressIndicator","undefined","entityPromises","x","push","catch","getConfigEntityError","response","status","data","message","Promise","all","then","result","item","fse","outputFile","stopProgressIndicator","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","entriesData","parse","idm","envParams","propertiesReader","includes","configEntityString","each","key","value","replaceall","error","countManagedObjects","type","count","resultCount","pagedResultsCookie","totalPagedResultsPolicy","totalPagedResults","remainingPagedResults","queryAllManagedObjectsByType"],"sources":["ops/IdmOps.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport replaceall from 'replaceall';\nimport propertiesReader from 'properties-reader';\nimport {\n getAllConfigEntities,\n getConfigEntity,\n queryAllManagedObjectsByType,\n} from '../api/IdmConfigApi';\nimport {\n printMessage,\n createProgressIndicator,\n stopProgressIndicator,\n} from './utils/Console';\nimport { getTypedFilename } from './utils/ExportImportUtils';\n\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n let configEntities = [];\n try {\n configEntities = await getAllConfigEntities();\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n if ('configurations' in configEntities) {\n configEntities['configurations'].forEach((configEntity) => {\n printMessage(`${configEntity._id}`, 'data');\n });\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await getConfigEntity(id);\n fs.writeFile(fileName, JSON.stringify(configEntity, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n * @param {String} directory export directory\n */\nexport async function exportAllRawConfigEntities(directory) {\n let configEntities = [];\n try {\n configEntities = await getAllConfigEntities();\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n if ('configurations' in configEntities) {\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n undefined,\n 'Exporting config objects...',\n 'indeterminate'\n );\n const entityPromises = [];\n configEntities['configurations'].forEach((x) => {\n entityPromises.push(\n getConfigEntity(x._id).catch((getConfigEntityError) => {\n if (\n !(\n getConfigEntityError.response?.status === 403 &&\n getConfigEntityError.response?.data?.message ===\n 'This operation is not available in ForgeRock Identity Cloud.'\n ) &&\n // https://bugster.forgerock.org/jira/browse/OPENIDM-18270\n !(\n getConfigEntityError.response?.status === 404 &&\n getConfigEntityError.response?.data?.message ===\n 'No configuration exists for id org.apache.felix.fileinstall/openidm'\n )\n ) {\n printMessage(getConfigEntityError.response?.data, 'error');\n printMessage(\n `Error getting config entity: ${getConfigEntityError}`,\n 'error'\n );\n }\n })\n );\n });\n Promise.all(entityPromises).then((result) => {\n // console.log(result);\n result.forEach((item) => {\n if (item != null) {\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n // eslint-disable-next-line consistent-return\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n });\n stopProgressIndicator('Exported config objects.', 'success');\n });\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} directory export directory\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(\n directory,\n entitiesFile,\n envFile\n) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n let configEntities = [];\n try {\n configEntities = await getAllConfigEntities();\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n if ('configurations' in configEntities) {\n // create export directory if not exist\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n undefined,\n 'Exporting config objects...',\n 'indeterminate'\n );\n const entityPromises = [];\n configEntities['configurations'].forEach((x) => {\n if (entriesToExport.includes(x._id)) {\n // console.log(`- ${x._id}`);\n entityPromises.push(getConfigEntity(x._id));\n }\n });\n Promise.all(entityPromises).then((result) => {\n // console.log(result);\n result.forEach((item) => {\n if (item != null) {\n let configEntityString = JSON.stringify(item, null, 2);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n // eslint-disable-next-line consistent-return\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n });\n stopProgressIndicator(null, 'success');\n });\n }\n });\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type) {\n let count = 0;\n let result = {\n result: [],\n resultCount: 0,\n pagedResultsCookie: null,\n totalPagedResultsPolicy: 'NONE',\n totalPagedResults: -1,\n remainingPagedResults: -1,\n };\n try {\n do {\n result = await queryAllManagedObjectsByType(\n type,\n [],\n result.pagedResultsCookie\n );\n count += result.resultCount;\n // printMessage(result);\n } while (result.pagedResultsCookie);\n printMessage(`${type}: ${count}`);\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;;;;;;;AAEA;AACA;AACA;SACsBA,qB;;;AAkBtB;AACA;AACA;AACA;AACA;;;;6CAtBO,aAAuC;IAC5C,IAAIC,cAAc,GAAG,EAArB;;IACA,IAAI;MACFA,cAAc,SAAS,IAAAC,kCAAA,GAAvB;IACD,CAFD,CAEE,OAAOC,yBAAP,EAAkC;MAClC,IAAAC,qBAAA,EAAaD,yBAAb,EAAwC,OAAxC;MACA,IAAAC,qBAAA,2CACoCD,yBADpC,GAEE,OAFF;IAID;;IACD,IAAI,oBAAoBF,cAAxB,EAAwC;MACtCA,cAAc,CAAC,gBAAD,CAAd,CAAiCI,OAAjC,CAA0CC,YAAD,IAAkB;QACzD,IAAAF,qBAAA,YAAgBE,YAAY,CAACC,GAA7B,GAAoC,MAApC;MACD,CAFD;IAGD;EACF,C;;;;SAOqBC,kB;;;AActB;AACA;AACA;AACA;;;;0CAjBO,WAAkCC,EAAlC,EAAsCC,IAAtC,EAA4C;IACjD,IAAIC,QAAQ,GAAGD,IAAf;;IACA,IAAI,CAACC,QAAL,EAAe;MACbA,QAAQ,GAAG,IAAAC,mCAAA,YAAoBH,EAApB,GAA0B,KAA1B,CAAX;IACD;;IACD,IAAMH,YAAY,SAAS,IAAAO,6BAAA,EAAgBJ,EAAhB,CAA3B;;IACAK,WAAA,CAAGC,SAAH,CAAaJ,QAAb,EAAuBK,IAAI,CAACC,SAAL,CAAeX,YAAf,EAA6B,IAA7B,EAAmC,CAAnC,CAAvB,EAA+DY,GAAD,IAAS;MACrE,IAAIA,GAAJ,EAAS;QACP,OAAO,IAAAd,qBAAA,+BAAmCK,EAAnC,sBAAwD,OAAxD,CAAP;MACD;;MACD,OAAO,EAAP;IACD,CALD;EAMD,C;;;;SAMqBU,0B;;;AAsE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