@rockcarver/frodo-lib 0.12.2-4 → 0.12.2-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,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.12.2-5] - 2022-09-09
11
+
10
12
  ## [0.12.2-4] - 2022-09-09
11
13
 
12
14
  ## [0.12.2-3] - 2022-09-09
@@ -461,7 +463,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
461
463
  - Fixed problem with adding connection profiles
462
464
  - Miscellaneous bug fixes
463
465
 
464
- [Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.12.2-4...HEAD
466
+ [Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.12.2-5...HEAD
467
+
468
+ [0.12.2-5]: https://github.com/rockcarver/frodo-lib/compare/v0.12.2-4...v0.12.2-5
465
469
 
466
470
  [0.12.2-4]: https://github.com/rockcarver/frodo-lib/compare/v0.12.2-3...v0.12.2-4
467
471
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VariablesApi.test.js","names":["mock","MockAdapter","axios","state","default","session","setTenant","setRealm","setCookieName","setCookieValue","describe","test","expect","VariablesRaw","getVariables","toBeDefined","mockResponse","pagedResultsCookie","remainingPagedResults","result","_id","description","expressionType","lastChangeDate","lastChangedBy","loaded","valueBase64","resultCount","totalPagedResults","totalPagedResultsPolicy","onGet","reply","response","toBeTruthy","toMatchObject","message","code","assertions","error","status","toBe","data","getVariable","putVariable","onPut","setVariableDescription","onPost","deleteVariable","onDelete"],"sources":["api/VariablesApi.test.ts"],"sourcesContent":["import axios from 'axios';\nimport MockAdapter from 'axios-mock-adapter';\nimport { VariablesRaw, state } from '../index';\n\nconst mock = new MockAdapter(axios);\n\nstate.default.session.setTenant('https://openam-frodo-dev.forgeblocks.com/am');\nstate.default.session.setRealm('alpha');\nstate.default.session.setCookieName('cookieName');\nstate.default.session.setCookieValue('cookieValue');\n\ndescribe('VariablesApi - getVariables()', () => {\n test('getVariables() 0: Method is implemented', async () => {\n expect(VariablesRaw.getVariables).toBeDefined();\n });\n\n test('getVariables() 1: Get all variables - success', async () => {\n const mockResponse = {\n pagedResultsCookie: null,\n remainingPagedResults: -1,\n result: [\n {\n _id: 'esv-twilio-phone-number',\n description:\n 'Twilio phone number. Get your own at: https://twilio.com',\n expressionType: '',\n lastChangeDate: '2022-08-12T21:27:18.560Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64: 'KzEzMTc2NDQzMTA3',\n },\n {\n _id: 'esv-461016d8d2-configurationpropertiescredentials',\n description:\n 'Configuration parameter /configurationProperties/credentials in file idm/conf/provisioner.openicf-OUD.json',\n expressionType: '',\n lastChangeDate: '2021-12-09T16:48:18.482Z',\n lastChangedBy: 'forgerock-automation',\n loaded: true,\n valueBase64: 'RnJkcC0yMDEw',\n },\n {\n _id: 'esv-twilio-account-sid',\n description:\n 'Twilio account SID. Get your own at: https://twilio.com',\n expressionType: '',\n lastChangeDate: '2022-08-12T21:26:32.688Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64: 'QUM3NTA0MTVlMzE2M2EyZTU3YjdhZWVhN2VlZDgyZDk0NA==',\n },\n {\n _id: 'esv-ipv4-cidr-access-rules',\n description:\n 'IPv4 CIDR access rules: { \"allow\": [ \"address/mask\" ] }',\n expressionType: '',\n lastChangeDate: '2022-08-25T20:16:54.243Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64:\n 'eyAiYWxsb3ciOiBbICIxNDUuMTE4LjAuMC8xNiIsICIxMzIuMzUuMC4wLzE2IiwgIjEwMS4yMjYuMC4wLzE2IiwgIjk5LjcyLjI4LjE4Mi8zMiIgXSB9',\n },\n {\n _id: 'esv-volkerstestvariable1',\n description: \"Volker's Updated Test Variable Description\",\n expressionType: '',\n lastChangeDate: '2022-04-10T20:55:39.746Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo=',\n },\n ],\n resultCount: 5,\n totalPagedResults: -1,\n totalPagedResultsPolicy: 'NONE',\n };\n mock\n .onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables')\n .reply(200, mockResponse);\n const response = await VariablesRaw.getVariables();\n expect(response).toBeTruthy();\n expect(response).toMatchObject(mockResponse);\n });\n\n test('getVariables() 2: Get all variables - error', async () => {\n const mockResponse = {\n message: 'Server Error',\n code: 500,\n };\n mock\n .onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables')\n .reply(500, mockResponse);\n expect.assertions(4);\n try {\n await VariablesRaw.getVariables();\n } catch (error) {\n // console.dir(error);\n expect(error).toBeTruthy();\n expect(error.response.status).toBe(500);\n expect(error.response.data.code).toBe(500);\n expect(error.response.data.message).toBe('Server Error');\n }\n });\n});\n\ndescribe('VariablesApi - getVariable()', () => {\n test('getVariable() 0: Method is implemented', async () => {\n expect(VariablesRaw.getVariable).toBeDefined();\n });\n\n test('getVariable() 1: Get existing variable: esv-volkerstestvariable1', async () => {\n const mockResponse = {\n _id: 'esv-volkerstestvariable1',\n description: \"Volker's Updated Test Variable Description\",\n expressionType: '',\n lastChangeDate: '2022-04-10T20:55:39.746Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo=',\n };\n mock\n .onGet(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1'\n )\n .reply(200, mockResponse);\n const response = await VariablesRaw.getVariable('esv-volkerstestvariable1');\n expect(response).toBeTruthy();\n expect(response).toMatchObject(mockResponse);\n });\n\n test('getVariable() 2: Get non-existing variable: esv-does-not-exist', async () => {\n const mockResponse = {\n code: 404,\n message: 'The variable does not exist',\n };\n mock\n .onGet(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-does-not-exist'\n )\n .reply(404, mockResponse);\n expect.assertions(4);\n try {\n await VariablesRaw.getVariable('esv-does-not-exist');\n } catch (error) {\n // console.dir(error);\n expect(error).toBeTruthy();\n expect(error.response.status).toBe(404);\n expect(error.response.data.code).toBe(404);\n expect(error.response.data.message).toBe('The variable does not exist');\n }\n });\n});\n\ndescribe('VariablesApi - putVariable()', () => {\n test('putVariable() 0: Method is implemented', async () => {\n expect(VariablesRaw.putVariable).toBeDefined();\n });\n\n test('putVariable() 1: Create variable: esv-volkerstestvariable1 - success', async () => {\n const mockResponse = {\n _id: 'esv-volkerstestvariable1',\n description: \"Volker's Updated Test Variable Description\",\n expressionType: '',\n lastChangeDate: '2022-04-10T20:55:39.746Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo=',\n };\n mock\n .onPut(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1'\n )\n .reply(200, mockResponse);\n const response = await VariablesRaw.putVariable(\n 'esv-volkerstestvariable1',\n \"Volker's Test Variable Value\",\n \"Volker's Test Variable Description\"\n );\n expect(response).toBeTruthy();\n expect(response).toMatchObject(mockResponse);\n });\n\n test('putVariable() 2: Create variable: esv-volkerstestvariable1 - error', async () => {\n const mockResponse = {\n code: 500,\n message: 'Server Error',\n };\n mock\n .onPut(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1'\n )\n .reply(500, mockResponse);\n expect.assertions(4);\n try {\n await VariablesRaw.putVariable(\n 'esv-volkerstestvariable1',\n \"Volker's Test Variable Value\",\n \"Volker's Test Variable Description\"\n );\n } catch (error) {\n // console.dir(error);\n expect(error).toBeTruthy();\n expect(error.response.status).toBe(500);\n expect(error.response.data.code).toBe(500);\n expect(error.response.data.message).toBe('Server Error');\n }\n });\n});\n\ndescribe('VariablesApi - setVariableDescription()', () => {\n test('setVariableDescription() 0: Method is implemented', async () => {\n expect(VariablesRaw.setVariableDescription).toBeDefined();\n });\n\n test('setVariableDescription() 1: Set variable description: esv-volkerstestvariable1 - success', async () => {\n const mockResponse = '';\n mock\n .onPost(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription'\n )\n .reply(200, mockResponse);\n const response = await VariablesRaw.setVariableDescription(\n 'esv-volkerstestvariable1',\n \"Volker's Updated Test Secret Description\"\n );\n expect(response).toBe('');\n });\n\n test('setVariableDescription() 2: Set variable description: esv-volkerstestvariable1 - error', async () => {\n const mockResponse = {\n code: 500,\n message: 'Server Error',\n };\n mock\n .onPost(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription'\n )\n .reply(500, mockResponse);\n expect.assertions(4);\n try {\n await VariablesRaw.setVariableDescription(\n 'esv-volkerstestvariable1',\n \"Volker's Updated Test Secret Description\"\n );\n } catch (error) {\n // console.dir(error);\n expect(error).toBeTruthy();\n expect(error.response.status).toBe(500);\n expect(error.response.data.code).toBe(500);\n expect(error.response.data.message).toBe('Server Error');\n }\n });\n});\n\ndescribe('VariablesApi - deleteVariable()', () => {\n test('deleteVariable() 0: Method is implemented', async () => {\n expect(VariablesRaw.deleteVariable).toBeDefined();\n });\n\n test('deleteVariable() 1: Delete variable: esv-volkerstestvariable1 - success', async () => {\n const mockResponse = {\n _id: 'esv-volkerstestvariable1',\n description: \"Volker's Updated Test Variable Description\",\n expressionType: '',\n lastChangeDate: '2022-04-10T20:55:39.746Z',\n lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',\n loaded: true,\n valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo=',\n };\n mock\n .onDelete(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1'\n )\n .reply(200, mockResponse);\n const response = await VariablesRaw.deleteVariable(\n 'esv-volkerstestvariable1'\n );\n expect(response).toBeTruthy();\n expect(response).toMatchObject(mockResponse);\n });\n\n test('deleteVariable() 2: Delete variable: esv-volkerstestvariable1 - error', async () => {\n const mockResponse = {\n code: 500,\n message:\n 'Cannot delete a variable that has an existing config placeholder',\n };\n mock\n .onDelete(\n 'https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1'\n )\n .reply(500, mockResponse);\n expect.assertions(4);\n try {\n await VariablesRaw.deleteVariable('esv-volkerstestvariable1');\n } catch (error) {\n // console.dir(error);\n expect(error).toBeTruthy();\n expect(error.response.status).toBe(500);\n expect(error.response.data.code).toBe(500);\n expect(error.response.data.message).toBe(\n 'Cannot delete a variable that has an existing config placeholder'\n );\n }\n });\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,IAAI,GAAG,IAAIC,yBAAJ,CAAgBC,cAAhB,CAAb;;AAEAC,YAAA,CAAMC,OAAN,CAAcC,OAAd,CAAsBC,SAAtB,CAAgC,6CAAhC;;AACAH,YAAA,CAAMC,OAAN,CAAcC,OAAd,CAAsBE,QAAtB,CAA+B,OAA/B;;AACAJ,YAAA,CAAMC,OAAN,CAAcC,OAAd,CAAsBG,aAAtB,CAAoC,YAApC;;AACAL,YAAA,CAAMC,OAAN,CAAcC,OAAd,CAAsBI,cAAtB,CAAqC,aAArC;;AAEAC,QAAQ,CAAC,+BAAD,EAAkC,MAAM;EAC9CC,IAAI,CAAC,yCAAD,iCAA4C,aAAY;IAC1DC,MAAM,CAACC,mBAAA,CAAaC,YAAd,CAAN,CAAkCC,WAAlC;EACD,CAFG,EAAJ;EAIAJ,IAAI,CAAC,+CAAD,iCAAkD,aAAY;IAChE,IAAMK,YAAY,GAAG;MACnBC,kBAAkB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0B,KAAD,CAAN,CAAcL,UAAd;MACArB,MAAM,CAAC0B,KAAK,CAACN,QAAN,CAAeO,MAAhB,CAAN,CAA8BC,IAA9B,CAAmC,GAAnC;MACA5B,MAAM,CAAC0B,KAAK,CAACN,QAAN,CAAeS,IAAf,CAAoBL,IAArB,CAAN,CAAiCI,IAAjC,CAAsC,GAAtC;MACA5B,MAAM,CAAC0B,KAAK,CAACN,QAAN,CAAeS,IAAf,CAAoBN,OAArB,CAAN,CAAoCK,IAApC,CACE,kEADF;IAGD;EACF,CAvBG,EAAJ;AAwBD,CAnDO,CAAR"}
package/cjs/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Variables = exports.Utils = exports.TreeRaw = exports.Theme = exports.StartupRaw = exports.Startup = exports.SecretsRaw = exports.Secrets = exports.Script = exports.Saml = exports.Realm = exports.Organization = exports.OAuth2OIDCApi = exports.OAuth2Client = exports.NodeRaw = exports.ManagedObject = exports.Log = exports.Journey = exports.Idp = exports.Idm = exports.EmailTemplate = exports.ConnectionProfile = exports.CirclesOfTrust = exports.Authenticate = exports.Admin = void 0;
6
+ exports.VariablesRaw = exports.Variables = exports.Utils = exports.TreeRaw = exports.Theme = exports.StartupRaw = exports.Startup = exports.SecretsRaw = exports.Secrets = exports.Script = exports.Saml = exports.Realm = exports.Organization = exports.OAuth2OIDCApi = exports.OAuth2Client = exports.NodeRaw = exports.ManagedObject = exports.Log = exports.Journey = exports.Idp = exports.Idm = exports.EmailTemplate = exports.ConnectionProfile = exports.CirclesOfTrust = exports.Authenticate = exports.Admin = void 0;
7
7
  exports.getVersion = getVersion;
8
8
  exports.state = void 0;
9
9
 
@@ -29,6 +29,10 @@ var _SecretsRaw = _interopRequireWildcard(require("./api/SecretsApi"));
29
29
 
30
30
  exports.SecretsRaw = _SecretsRaw;
31
31
 
32
+ var _VariablesRaw = _interopRequireWildcard(require("./api/VariablesApi"));
33
+
34
+ exports.VariablesRaw = _VariablesRaw;
35
+
32
36
  var _Admin = _interopRequireWildcard(require("./ops/AdminOps"));
33
37
 
34
38
  exports.Admin = _Admin;
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","getVersion","version"],"sources":["index.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')\n);\n\nexport function getVersion() {\n return `v${pkg.version}`;\n}\n\n// Api Layer\nexport * as NodeRaw from './api/NodeApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as SecretsRaw from './api/SecretsApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdmOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml from './ops/SamlOps';\nexport * as Script from './ops/ScriptOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,QAAS,GAAGC,aAAA,CAAKC,OAAL,CAAa,IAAAC,kBAAA,sDAAb,CAAlB;;AAEA,IAAMC,GAAG,GAAGC,IAAI,CAACC,KAAL,CACVC,WAAA,CAAGC,YAAH,CAAgBP,aAAA,CAAKQ,OAAL,CAAaT,QAAb,EAAwB,iBAAxB,CAAhB,EAA4D,MAA5D,CADU,CAAZ;;AAIO,SAASU,UAAT,GAAsB;EAC3B,kBAAWN,GAAG,CAACO,OAAf;AACD,C,CAED"}
1
+ {"version":3,"file":"index.js","names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","getVersion","version"],"sources":["index.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')\n);\n\nexport function getVersion() {\n return `v${pkg.version}`;\n}\n\n// Api Layer\nexport * as NodeRaw from './api/NodeApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as SecretsRaw from './api/SecretsApi';\nexport * as VariablesRaw from './api/VariablesApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdmOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml from './ops/SamlOps';\nexport * as Script from './ops/ScriptOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,QAAS,GAAGC,aAAA,CAAKC,OAAL,CAAa,IAAAC,kBAAA,sDAAb,CAAlB;;AAEA,IAAMC,GAAG,GAAGC,IAAI,CAACC,KAAL,CACVC,WAAA,CAAGC,YAAH,CAAgBP,aAAA,CAAKQ,OAAL,CAAaT,QAAb,EAAwB,iBAAxB,CAAhB,EAA4D,MAA5D,CADU,CAAZ;;AAIO,SAASU,UAAT,GAAsB;EAC3B,kBAAWN,GAAG,CAACO,OAAf;AACD,C,CAED"}
@@ -0,0 +1,229 @@
1
+ import axios from 'axios';
2
+ import MockAdapter from 'axios-mock-adapter';
3
+ import { VariablesRaw, state } from '../index';
4
+ const mock = new MockAdapter(axios);
5
+ state.default.session.setTenant('https://openam-frodo-dev.forgeblocks.com/am');
6
+ state.default.session.setRealm('alpha');
7
+ state.default.session.setCookieName('cookieName');
8
+ state.default.session.setCookieValue('cookieValue');
9
+ describe('VariablesApi - getVariables()', () => {
10
+ test('getVariables() 0: Method is implemented', async () => {
11
+ expect(VariablesRaw.getVariables).toBeDefined();
12
+ });
13
+ test('getVariables() 1: Get all variables - success', async () => {
14
+ const mockResponse = {
15
+ pagedResultsCookie: null,
16
+ remainingPagedResults: -1,
17
+ result: [{
18
+ _id: 'esv-twilio-phone-number',
19
+ description: 'Twilio phone number. Get your own at: https://twilio.com',
20
+ expressionType: '',
21
+ lastChangeDate: '2022-08-12T21:27:18.560Z',
22
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
23
+ loaded: true,
24
+ valueBase64: 'KzEzMTc2NDQzMTA3'
25
+ }, {
26
+ _id: 'esv-461016d8d2-configurationpropertiescredentials',
27
+ description: 'Configuration parameter /configurationProperties/credentials in file idm/conf/provisioner.openicf-OUD.json',
28
+ expressionType: '',
29
+ lastChangeDate: '2021-12-09T16:48:18.482Z',
30
+ lastChangedBy: 'forgerock-automation',
31
+ loaded: true,
32
+ valueBase64: 'RnJkcC0yMDEw'
33
+ }, {
34
+ _id: 'esv-twilio-account-sid',
35
+ description: 'Twilio account SID. Get your own at: https://twilio.com',
36
+ expressionType: '',
37
+ lastChangeDate: '2022-08-12T21:26:32.688Z',
38
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
39
+ loaded: true,
40
+ valueBase64: 'QUM3NTA0MTVlMzE2M2EyZTU3YjdhZWVhN2VlZDgyZDk0NA=='
41
+ }, {
42
+ _id: 'esv-ipv4-cidr-access-rules',
43
+ description: 'IPv4 CIDR access rules: { "allow": [ "address/mask" ] }',
44
+ expressionType: '',
45
+ lastChangeDate: '2022-08-25T20:16:54.243Z',
46
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
47
+ loaded: true,
48
+ valueBase64: 'eyAiYWxsb3ciOiBbICIxNDUuMTE4LjAuMC8xNiIsICIxMzIuMzUuMC4wLzE2IiwgIjEwMS4yMjYuMC4wLzE2IiwgIjk5LjcyLjI4LjE4Mi8zMiIgXSB9'
49
+ }, {
50
+ _id: 'esv-volkerstestvariable1',
51
+ description: "Volker's Updated Test Variable Description",
52
+ expressionType: '',
53
+ lastChangeDate: '2022-04-10T20:55:39.746Z',
54
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
55
+ loaded: true,
56
+ valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
57
+ }],
58
+ resultCount: 5,
59
+ totalPagedResults: -1,
60
+ totalPagedResultsPolicy: 'NONE'
61
+ };
62
+ mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables').reply(200, mockResponse);
63
+ const response = await VariablesRaw.getVariables();
64
+ expect(response).toBeTruthy();
65
+ expect(response).toMatchObject(mockResponse);
66
+ });
67
+ test('getVariables() 2: Get all variables - error', async () => {
68
+ const mockResponse = {
69
+ message: 'Server Error',
70
+ code: 500
71
+ };
72
+ mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables').reply(500, mockResponse);
73
+ expect.assertions(4);
74
+
75
+ try {
76
+ await VariablesRaw.getVariables();
77
+ } catch (error) {
78
+ // console.dir(error);
79
+ expect(error).toBeTruthy();
80
+ expect(error.response.status).toBe(500);
81
+ expect(error.response.data.code).toBe(500);
82
+ expect(error.response.data.message).toBe('Server Error');
83
+ }
84
+ });
85
+ });
86
+ describe('VariablesApi - getVariable()', () => {
87
+ test('getVariable() 0: Method is implemented', async () => {
88
+ expect(VariablesRaw.getVariable).toBeDefined();
89
+ });
90
+ test('getVariable() 1: Get existing variable: esv-volkerstestvariable1', async () => {
91
+ const mockResponse = {
92
+ _id: 'esv-volkerstestvariable1',
93
+ description: "Volker's Updated Test Variable Description",
94
+ expressionType: '',
95
+ lastChangeDate: '2022-04-10T20:55:39.746Z',
96
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
97
+ loaded: true,
98
+ valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
99
+ };
100
+ mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
101
+ const response = await VariablesRaw.getVariable('esv-volkerstestvariable1');
102
+ expect(response).toBeTruthy();
103
+ expect(response).toMatchObject(mockResponse);
104
+ });
105
+ test('getVariable() 2: Get non-existing variable: esv-does-not-exist', async () => {
106
+ const mockResponse = {
107
+ code: 404,
108
+ message: 'The variable does not exist'
109
+ };
110
+ mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-does-not-exist').reply(404, mockResponse);
111
+ expect.assertions(4);
112
+
113
+ try {
114
+ await VariablesRaw.getVariable('esv-does-not-exist');
115
+ } catch (error) {
116
+ // console.dir(error);
117
+ expect(error).toBeTruthy();
118
+ expect(error.response.status).toBe(404);
119
+ expect(error.response.data.code).toBe(404);
120
+ expect(error.response.data.message).toBe('The variable does not exist');
121
+ }
122
+ });
123
+ });
124
+ describe('VariablesApi - putVariable()', () => {
125
+ test('putVariable() 0: Method is implemented', async () => {
126
+ expect(VariablesRaw.putVariable).toBeDefined();
127
+ });
128
+ test('putVariable() 1: Create variable: esv-volkerstestvariable1 - success', async () => {
129
+ const mockResponse = {
130
+ _id: 'esv-volkerstestvariable1',
131
+ description: "Volker's Updated Test Variable Description",
132
+ expressionType: '',
133
+ lastChangeDate: '2022-04-10T20:55:39.746Z',
134
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
135
+ loaded: true,
136
+ valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
137
+ };
138
+ mock.onPut('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
139
+ const response = await VariablesRaw.putVariable('esv-volkerstestvariable1', "Volker's Test Variable Value", "Volker's Test Variable Description");
140
+ expect(response).toBeTruthy();
141
+ expect(response).toMatchObject(mockResponse);
142
+ });
143
+ test('putVariable() 2: Create variable: esv-volkerstestvariable1 - error', async () => {
144
+ const mockResponse = {
145
+ code: 500,
146
+ message: 'Server Error'
147
+ };
148
+ mock.onPut('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(500, mockResponse);
149
+ expect.assertions(4);
150
+
151
+ try {
152
+ await VariablesRaw.putVariable('esv-volkerstestvariable1', "Volker's Test Variable Value", "Volker's Test Variable Description");
153
+ } catch (error) {
154
+ // console.dir(error);
155
+ expect(error).toBeTruthy();
156
+ expect(error.response.status).toBe(500);
157
+ expect(error.response.data.code).toBe(500);
158
+ expect(error.response.data.message).toBe('Server Error');
159
+ }
160
+ });
161
+ });
162
+ describe('VariablesApi - setVariableDescription()', () => {
163
+ test('setVariableDescription() 0: Method is implemented', async () => {
164
+ expect(VariablesRaw.setVariableDescription).toBeDefined();
165
+ });
166
+ test('setVariableDescription() 1: Set variable description: esv-volkerstestvariable1 - success', async () => {
167
+ const mockResponse = '';
168
+ mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription').reply(200, mockResponse);
169
+ const response = await VariablesRaw.setVariableDescription('esv-volkerstestvariable1', "Volker's Updated Test Secret Description");
170
+ expect(response).toBe('');
171
+ });
172
+ test('setVariableDescription() 2: Set variable description: esv-volkerstestvariable1 - error', async () => {
173
+ const mockResponse = {
174
+ code: 500,
175
+ message: 'Server Error'
176
+ };
177
+ mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription').reply(500, mockResponse);
178
+ expect.assertions(4);
179
+
180
+ try {
181
+ await VariablesRaw.setVariableDescription('esv-volkerstestvariable1', "Volker's Updated Test Secret Description");
182
+ } catch (error) {
183
+ // console.dir(error);
184
+ expect(error).toBeTruthy();
185
+ expect(error.response.status).toBe(500);
186
+ expect(error.response.data.code).toBe(500);
187
+ expect(error.response.data.message).toBe('Server Error');
188
+ }
189
+ });
190
+ });
191
+ describe('VariablesApi - deleteVariable()', () => {
192
+ test('deleteVariable() 0: Method is implemented', async () => {
193
+ expect(VariablesRaw.deleteVariable).toBeDefined();
194
+ });
195
+ test('deleteVariable() 1: Delete variable: esv-volkerstestvariable1 - success', async () => {
196
+ const mockResponse = {
197
+ _id: 'esv-volkerstestvariable1',
198
+ description: "Volker's Updated Test Variable Description",
199
+ expressionType: '',
200
+ lastChangeDate: '2022-04-10T20:55:39.746Z',
201
+ lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
202
+ loaded: true,
203
+ valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
204
+ };
205
+ mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
206
+ const response = await VariablesRaw.deleteVariable('esv-volkerstestvariable1');
207
+ expect(response).toBeTruthy();
208
+ expect(response).toMatchObject(mockResponse);
209
+ });
210
+ test('deleteVariable() 2: Delete variable: esv-volkerstestvariable1 - error', async () => {
211
+ const mockResponse = {
212
+ code: 500,
213
+ message: 'Cannot delete a variable that has an existing config placeholder'
214
+ };
215
+ mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(500, mockResponse);
216
+ expect.assertions(4);
217
+
218
+ try {
219
+ await VariablesRaw.deleteVariable('esv-volkerstestvariable1');
220
+ } catch (error) {
221
+ // console.dir(error);
222
+ expect(error).toBeTruthy();
223
+ expect(error.response.status).toBe(500);
224
+ expect(error.response.data.code).toBe(500);
225
+ expect(error.response.data.message).toBe('Cannot delete a variable that has an existing config placeholder');
226
+ }
227
+ });
228
+ });
229
+ //# sourceMappingURL=VariablesApi.test.js.map
package/esm/index.mjs CHANGED
@@ -12,7 +12,8 @@ export function getVersion() {
12
12
  export * as NodeRaw from './api/NodeApi';
13
13
  export * as TreeRaw from './api/TreeApi';
14
14
  export * as StartupRaw from './api/StartupApi';
15
- export * as SecretsRaw from './api/SecretsApi'; // Ops Layer
15
+ export * as SecretsRaw from './api/SecretsApi';
16
+ export * as VariablesRaw from './api/VariablesApi'; // Ops Layer
16
17
 
17
18
  export * as Admin from './ops/AdminOps';
18
19
  export * as Authenticate from './ops/AuthenticateOps';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-lib",
3
- "version": "0.12.2-4",
3
+ "version": "0.12.2-5",
4
4
  "type": "commonjs",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.mjs",
package/types/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * as NodeRaw from './api/NodeApi';
3
3
  export * as TreeRaw from './api/TreeApi';
4
4
  export * as StartupRaw from './api/StartupApi';
5
5
  export * as SecretsRaw from './api/SecretsApi';
6
+ export * as VariablesRaw from './api/VariablesApi';
6
7
  export * as Admin from './ops/AdminOps';
7
8
  export * as Authenticate from './ops/AuthenticateOps';
8
9
  export * as CirclesOfTrust from './ops/CirclesOfTrustOps';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAUA,wBAAgB,UAAU,WAEzB;AAGD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAG/C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAG9C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAIlD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC","file":"index.d.ts","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')\n);\n\nexport function getVersion() {\n return `v${pkg.version}`;\n}\n\n// Api Layer\nexport * as NodeRaw from './api/NodeApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as SecretsRaw from './api/SecretsApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdmOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml from './ops/SamlOps';\nexport * as Script from './ops/ScriptOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAUA,wBAAgB,UAAU,WAEzB;AAGD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAG9C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAIlD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC","file":"index.d.ts","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')\n);\n\nexport function getVersion() {\n return `v${pkg.version}`;\n}\n\n// Api Layer\nexport * as NodeRaw from './api/NodeApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as SecretsRaw from './api/SecretsApi';\nexport * as VariablesRaw from './api/VariablesApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdmOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml from './ops/SamlOps';\nexport * as Script from './ops/ScriptOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"]}