@rockcarver/frodo-lib 0.11.1-1 → 0.11.1-4

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.
Files changed (65) hide show
  1. package/.eslintrc +10 -0
  2. package/.github/README.md +8 -2
  3. package/.github/workflows/pipeline.yml +27 -3
  4. package/CHANGELOG.md +17 -1
  5. package/README.md +2 -2
  6. package/gulpfile.mjs +35 -0
  7. package/package.json +43 -13
  8. package/src/api/{AuthenticateApi.js → AuthenticateApi.mjs} +2 -2
  9. package/src/api/{BaseApi.js → BaseApi.mjs} +2 -2
  10. package/src/api/{CirclesOfTrustApi.js → CirclesOfTrustApi.mjs} +3 -3
  11. package/src/api/{EmailTemplateApi.js → EmailTemplateApi.mjs} +1 -1
  12. package/src/api/{IdmConfigApi.js → IdmConfigApi.mjs} +3 -3
  13. package/src/api/{LogApi.js → LogApi.mjs} +3 -3
  14. package/src/api/{ManagedObjectApi.js → ManagedObjectApi.mjs} +3 -3
  15. package/src/api/{OAuth2ClientApi.js → OAuth2ClientApi.mjs} +3 -3
  16. package/src/api/{OAuth2OIDCApi.js → OAuth2OIDCApi.mjs} +4 -4
  17. package/src/api/{OAuth2ProviderApi.js → OAuth2ProviderApi.mjs} +3 -3
  18. package/src/api/{RealmApi.js → RealmApi.mjs} +3 -3
  19. package/src/api/{Saml2Api.js → Saml2Api.mjs} +3 -3
  20. package/src/api/{ScriptApi.js → ScriptApi.mjs} +3 -3
  21. package/src/api/{SecretsApi.js → SecretsApi.mjs} +4 -4
  22. package/src/api/{ServerInfoApi.js → ServerInfoApi.mjs} +2 -2
  23. package/src/api/{SocialIdentityProvidersApi.js → SocialIdentityProvidersApi.mjs} +3 -3
  24. package/src/api/{StartupApi.js → StartupApi.mjs} +3 -3
  25. package/src/api/{ThemeApi.js → ThemeApi.mjs} +2 -2
  26. package/src/api/{TreeApi.js → TreeApi.mjs} +3 -3
  27. package/src/api/{VariablesApi.js → VariablesApi.mjs} +4 -4
  28. package/src/api/utils/{ApiUtils.js → ApiUtils.mjs} +1 -1
  29. package/src/api/utils/{ApiUtils.test.js → ApiUtils.test.mjs} +2 -5
  30. package/src/api/utils/{Base64.js → Base64.mjs} +0 -0
  31. package/src/index.mjs +38 -0
  32. package/src/{index.test.js → index.test.mjs} +1 -1
  33. package/src/ops/{AdminOps.js → AdminOps.mjs} +8 -8
  34. package/src/ops/{AuthenticateOps.js → AuthenticateOps.mjs} +8 -8
  35. package/src/ops/{AuthenticationOps.test.js → AuthenticateOps.test.mjs} +2 -2
  36. package/src/ops/{CirclesOfTrustOps.js → CirclesOfTrustOps.mjs} +3 -3
  37. package/src/ops/{ConnectionProfileOps.js → ConnectionProfileOps.mjs} +4 -8
  38. package/src/ops/{ConnectionProfileOps.test.js → ConnectionProfileOps.test.mjs} +3 -3
  39. package/src/ops/{EmailTemplateOps.js → EmailTemplateOps.mjs} +4 -4
  40. package/src/ops/{IdmOps.js → IdmOps.mjs} +4 -4
  41. package/src/ops/{IdpOps.js → IdpOps.mjs} +5 -5
  42. package/src/ops/{JourneyOps.js → JourneyOps.mjs} +15 -15
  43. package/src/ops/{LogOps.js → LogOps.mjs} +15 -15
  44. package/src/ops/{ManagedObjectOps.js → ManagedObjectOps.mjs} +1 -1
  45. package/src/ops/{OAuth2ClientOps.js → OAuth2ClientOps.mjs} +6 -6
  46. package/src/ops/{OrganizationOps.js → OrganizationOps.mjs} +3 -3
  47. package/src/ops/{RealmOps.js → RealmOps.mjs} +2 -2
  48. package/src/ops/{SamlOps.js → SamlOps.mjs} +6 -6
  49. package/src/ops/{ScriptOps.js → ScriptOps.mjs} +6 -6
  50. package/src/ops/{SecretsOps.js → SecretsOps.mjs} +4 -4
  51. package/src/ops/{StartupOps.js → StartupOps.mjs} +5 -5
  52. package/src/ops/{ThemeOps.js → ThemeOps.mjs} +3 -3
  53. package/src/ops/{VariablesOps.js → VariablesOps.mjs} +5 -5
  54. package/src/ops/utils/{Console.js → Console.mjs} +1 -1
  55. package/src/ops/utils/{DataProtection.js → DataProtection.mjs} +3 -3
  56. package/src/ops/utils/{DataProtection.test.js → DataProtection.test.mjs} +1 -1
  57. package/src/ops/utils/{ExportImportUtils.js → ExportImportUtils.mjs} +4 -4
  58. package/src/ops/utils/{ExportImportUtils.test.js → ExportImportUtils.test.mjs} +1 -1
  59. package/src/ops/utils/{OpsUtils.js → OpsUtils.mjs} +12 -2
  60. package/src/ops/utils/{Wordwrap.js → Wordwrap.mjs} +0 -0
  61. package/src/storage/{SessionStorage.js → SessionStorage.mjs} +0 -0
  62. package/src/storage/{StaticStorage.js → StaticStorage.mjs} +0 -0
  63. package/src/index.js +0 -32
  64. package/test/e2e/setup.js +0 -104
  65. package/test/global/setup.js +0 -65
package/.eslintrc CHANGED
@@ -1,4 +1,14 @@
1
1
  {
2
+ "settings": {
3
+ "import/resolver": {
4
+ "node": {
5
+ "extensions": [
6
+ ".mjs",
7
+ ".js"
8
+ ]
9
+ }
10
+ }
11
+ },
2
12
  "extends": ["airbnb", "prettier"],
3
13
  "parser": "@babel/eslint-parser",
4
14
  "parserOptions": {
package/.github/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  <!-- README.md for GitHub; the one for NPM is ../README.md. -->
2
+
2
3
  # Frodo Library - @rockcarver/frodo-lib
3
4
 
4
- ForgeROck DO library, frodo-lib, a library to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
5
+ ForgeROck DO library, frodo-lib, a library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.
5
6
 
6
7
  Frodo-lib powers [frodo-cli](https://github.com/rockcarver/frodo-cli), the command line tool to manage ForgeRock deployments.
7
8
 
@@ -86,6 +87,7 @@ Frodo allows an administrator to easily connect to and manage any number of Iden
86
87
  ## Installing
87
88
 
88
89
  ### Developer Mode
90
+
89
91
  For those who want to contribute or are just curious about the build process.
90
92
 
91
93
  - Make sure you have Node.js v18 (the version used by developers) or newer and npm.
@@ -100,6 +102,7 @@ For those who want to contribute or are just curious about the build process.
100
102
  ```
101
103
 
102
104
  ### NPM package
105
+
103
106
  If you are a node developer and want to use frodo-lib as a library for your own applications, you can install the npm package:
104
107
 
105
108
  - To install the latest version as a dependency for you own application:
@@ -112,10 +115,13 @@ If you are a node developer and want to use frodo-lib as a library for your own
112
115
  ```
113
116
 
114
117
  ## Feature requests
118
+
115
119
  Please use the repository's [issues](https://github.com/rockcarver/frodo-lib/issues) to request new features/enhancements or report bugs/issues.
116
120
 
117
121
  ## Contributing
122
+
118
123
  If you would like to contribute to frodo, please refer to the [contributing instructions](../docs/CONTRIBUTE.md).
119
124
 
120
125
  ## Maintaining
121
- If you are a maintainer of this repository, please refer to the [pipeline and release process instructions](../docs/PIPELINE.md).
126
+
127
+ If you are a maintainer of this repository, please refer to the [pipeline and release process instructions](../docs/PIPELINE.md).
@@ -39,10 +39,18 @@ jobs:
39
39
  node-version: ${{ matrix.node-version }}
40
40
  cache: 'npm'
41
41
 
42
- - name: Install dependencies and install frodo globally
42
+ - name: Update npm and install dependencies
43
43
  run: |
44
+ npm install -g npm
44
45
  npm ci
45
- npm i -g
46
+
47
+ - name: Lint
48
+ run: |
49
+ npm run lint
50
+
51
+ - name: Build commonjs
52
+ run: |
53
+ npm run build
46
54
 
47
55
  #
48
56
  # Run tests.
@@ -66,7 +74,7 @@ jobs:
66
74
 
67
75
  - name: Security Audit
68
76
  run: |
69
- npm audit
77
+ npm audit --omit=dev
70
78
 
71
79
  update-changelog:
72
80
  needs: smoke-tests
@@ -255,20 +263,36 @@ jobs:
255
263
  - uses: actions/checkout@v3
256
264
  with:
257
265
  ref: ${{ github.ref }}
266
+
258
267
  - uses: actions/setup-node@v3
259
268
  with:
260
269
  node-version: 14
270
+
271
+ - name: Install dependencies
272
+ run: |
273
+ npm ci
274
+
275
+ - name: Lint
276
+ run: |
277
+ npm run lint
278
+
279
+ - name: Build commonjs
280
+ run: |
281
+ npm run build
282
+
261
283
  - name: Pre-Release
262
284
  if: ${{ fromJSON(needs.bump-version.outputs.preRelease) }}
263
285
  uses: JS-DevTools/npm-publish@v1
264
286
  with:
265
287
  tag: 'next'
266
288
  token: ${{ secrets.NPM_ACCESS_TOKEN }}
289
+
267
290
  - name: Release
268
291
  if: ${{ ! fromJSON(needs.bump-version.outputs.preRelease) }}
269
292
  uses: JS-DevTools/npm-publish@v1
270
293
  with:
271
294
  token: ${{ secrets.NPM_ACCESS_TOKEN }}
295
+
272
296
  - name: Remove Pre-Release Tag
273
297
  if: ${{ ! fromJSON(needs.bump-version.outputs.preRelease) }}
274
298
  run: |
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.1-4] - 2022-08-21
11
+
12
+ ### Changed
13
+
14
+ - \#10: frodo-lib is now a hybrid npm package supporting both ES modules and CommonJS modules.
15
+
16
+ ## [0.11.1-3] - 2022-08-18
17
+
18
+ ## [0.11.1-2] - 2022-08-18
19
+
10
20
  ## [0.11.1-1] - 2022-08-18
11
21
 
12
22
  ## [0.11.1-0] - 2022-08-17
@@ -415,7 +425,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
415
425
  - Fixed problem with adding connection profiles
416
426
  - Miscellaneous bug fixes
417
427
 
418
- [Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.11.1-1...HEAD
428
+ [Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.11.1-4...HEAD
429
+
430
+ [0.11.1-4]: https://github.com/rockcarver/frodo-lib/compare/v0.11.1-3...v0.11.1-4
431
+
432
+ [0.11.1-3]: https://github.com/rockcarver/frodo-lib/compare/v0.11.1-2...v0.11.1-3
433
+
434
+ [0.11.1-2]: https://github.com/rockcarver/frodo-lib/compare/v0.11.1-1...v0.11.1-2
419
435
 
420
436
  [0.11.1-1]: https://github.com/rockcarver/frodo-lib/compare/v0.11.1-0...v0.11.1-1
421
437
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- README.md for NPM; the one for GitHub is .github/README.md. -->
2
- # Frodo Library - @rockcarver/frodo-lib
2
+ # Frodo Library
3
3
 
4
- ForgeROck DO Library, frodo-lib, a library to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
4
+ A library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.
5
5
 
6
6
  Frodo-lib powers [frodo-cli](https://github.com/rockcarver/frodo-cli), the command line tool to manage ForgeRock deployments.
7
7
 
package/gulpfile.mjs ADDED
@@ -0,0 +1,35 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import gulp from 'gulp';
3
+ import babel from 'gulp-babel';
4
+ import del from 'del';
5
+ import sourcemaps from 'gulp-sourcemaps';
6
+
7
+ gulp.task('clean', () => del(['cjs']));
8
+
9
+ gulp.task('transpile', () =>
10
+ gulp
11
+ .src(['src/*.mjs', 'src/**/*.mjs'])
12
+ .pipe(sourcemaps.init({ loadMaps: true }))
13
+ .pipe(
14
+ babel({
15
+ plugins: [
16
+ ['@babel/plugin-proposal-export-namespace-from'],
17
+ [
18
+ '@babel/plugin-transform-modules-commonjs',
19
+ {
20
+ importInterop: 'babel',
21
+ },
22
+ ],
23
+ ['babel-plugin-transform-import-meta'],
24
+ ],
25
+ })
26
+ )
27
+ .pipe(sourcemaps.write('./'))
28
+ .pipe(gulp.dest('cjs'))
29
+ );
30
+
31
+ gulp.task('resources', () =>
32
+ gulp.src(['src/**/*.json'], { base: './src/' }).pipe(gulp.dest('cjs'))
33
+ );
34
+
35
+ gulp.task('default', gulp.series('clean', 'transpile', 'resources'));
package/package.json CHANGED
@@ -1,13 +1,43 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-lib",
3
- "version": "0.11.1-1",
4
- "type": "module",
5
- "description": "ForgeROck DO Library, frodo-lib, a library to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
3
+ "version": "0.11.1-4",
4
+ "type": "commonjs",
5
+ "main": "./cjs/index.js",
6
+ "module": "./src/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./cjs/index.js",
10
+ "default": "./src/index.mjs"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "test": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js",
15
+ "test:watch": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
16
+ "lint": "npx eslint --ext .mjs --ignore-path .gitignore .",
17
+ "build": "npx gulp"
18
+ },
19
+ "jest": {
20
+ "roots": [
21
+ "<rootDir>/src/"
22
+ ],
23
+ "testMatch": [
24
+ "**/?(*.)(test).js?(x)",
25
+ "**/?(*.)(test).mjs"
26
+ ],
27
+ "testPathIgnorePatterns": [
28
+ "/node_modules/",
29
+ "/dist/"
30
+ ],
31
+ "verbose": true
32
+ },
33
+ "description": "A library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
34
  "keywords": [
7
35
  "forgerock",
8
36
  "library",
9
37
  "am",
38
+ "openam",
10
39
  "idm",
40
+ "openidm",
11
41
  "forgeops",
12
42
  "identity cloud",
13
43
  "export",
@@ -25,15 +55,6 @@
25
55
  "bugs": {
26
56
  "url": "https://github.com/rockcarver/frodo-lib/issues"
27
57
  },
28
- "main": "src/index.js",
29
- "scripts": {
30
- "test": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js",
31
- "test:watch": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
32
- "lint": "eslint --ext .js --ignore-path .gitignore ."
33
- },
34
- "jest": {
35
- "globalSetup": "<rootDir>/test/global/setup.js"
36
- },
37
58
  "contributors": [
38
59
  {
39
60
  "name": "Sandeep Chaturvedi",
@@ -79,6 +100,10 @@
79
100
  },
80
101
  "devDependencies": {
81
102
  "@babel/eslint-parser": "^7.18.9",
103
+ "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
104
+ "@babel/plugin-syntax-import-assertions": "^7.16.7",
105
+ "@babel/plugin-transform-modules-commonjs": "^7.16.8",
106
+ "babel-plugin-transform-import-meta": "^2.1.1",
82
107
  "del": "^6.0.0",
83
108
  "eslint": "^8.21.0",
84
109
  "eslint-config-airbnb": "^19.0.4",
@@ -89,7 +114,12 @@
89
114
  "eslint-plugin-prettier": "^4.2.1",
90
115
  "eslint-plugin-react": "^7.29.2",
91
116
  "eslint-plugin-react-hooks": "^4.3.0",
117
+ "gulp": "^4.0.2",
118
+ "gulp-babel": "^8.0.0",
119
+ "gulp-sourcemaps": "^3.0.0",
92
120
  "jest": "^28.1.3",
93
- "map-stream": "^0.0.7"
121
+ "map-stream": "^0.0.7",
122
+ "pkg": "^5.8.0",
123
+ "prettier": "^2.7.1"
94
124
  }
95
125
  }
@@ -1,6 +1,6 @@
1
1
  import util from 'util';
2
- import { generateAmApi } from './BaseApi.js';
3
- import storage from '../storage/SessionStorage.js';
2
+ import { generateAmApi } from './BaseApi';
3
+ import storage from '../storage/SessionStorage';
4
4
 
5
5
  const authenticateUrlTemplate = '%s/json%s/authenticate';
6
6
 
@@ -4,8 +4,8 @@ import * as https from 'https';
4
4
  import HttpsProxyAgent from 'https-proxy-agent';
5
5
  import url from 'url';
6
6
  import fs from 'fs';
7
- import storage from '../storage/SessionStorage.js';
8
- import { getTenantURL } from './utils/ApiUtils.js';
7
+ import storage from '../storage/SessionStorage';
8
+ import { getTenantURL } from './utils/ApiUtils';
9
9
  // import pkg from '../../package.json' assert { type: 'json' };
10
10
 
11
11
  const pkg = JSON.parse(
@@ -1,8 +1,8 @@
1
1
  import util from 'util';
2
2
  import _ from 'lodash';
3
- import { generateAmApi } from './BaseApi.js';
4
- import { getCurrentRealmPath } from './utils/ApiUtils.js';
5
- import storage from '../storage/SessionStorage.js';
3
+ import { generateAmApi } from './BaseApi';
4
+ import { getCurrentRealmPath } from './utils/ApiUtils';
5
+ import storage from '../storage/SessionStorage';
6
6
 
7
7
  const circleOfTrustByIdURLTemplate =
8
8
  '%s/json%s/realm-config/federation/circlesoftrust/%s';
@@ -2,7 +2,7 @@ import {
2
2
  getConfigEntitiesByType,
3
3
  getConfigEntity,
4
4
  putConfigEntity,
5
- } from './IdmConfigApi.js';
5
+ } from './IdmConfigApi';
6
6
 
7
7
  /**
8
8
  * Email template type key used to build the IDM id: 'emailTemplate/<id>'
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { generateIdmApi } from './BaseApi.js';
3
- import { getTenantURL } from './utils/ApiUtils.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { generateIdmApi } from './BaseApi';
3
+ import { getTenantURL } from './utils/ApiUtils';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const idmAllConfigURLTemplate = '%s/openidm/config';
7
7
  const idmConfigURLTemplate = '%s/openidm/config/%s';
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { generateLogApi, generateLogKeysApi } from './BaseApi.js';
3
- import { getTenantURL } from './utils/ApiUtils.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { generateLogApi, generateLogKeysApi } from './BaseApi';
3
+ import { getTenantURL } from './utils/ApiUtils';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const logsTailURLTemplate = '%s/monitoring/logs/tail?source=%s';
7
7
  const logsSourcesURLTemplate = '%s/monitoring/logs/sources';
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { generateIdmApi } from './BaseApi.js';
3
- import { getTenantURL } from './utils/ApiUtils.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { generateIdmApi } from './BaseApi';
3
+ import { getTenantURL } from './utils/ApiUtils';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const managedObjectURLTemplate = '%s/openidm/managed/%s';
7
7
  const managedObjectByIdURLTemplate = '%s/openidm/managed/%s/%s';
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { generateAmApi } from './BaseApi.js';
3
- import { getCurrentRealmPath } from './utils/ApiUtils.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { generateAmApi } from './BaseApi';
3
+ import { getCurrentRealmPath } from './utils/ApiUtils';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const oauth2ClientURLTemplate = '%s/json%s/realm-config/agents/OAuth2Client/%s';
7
7
  const oauth2ClientListURLTemplate =
@@ -1,9 +1,9 @@
1
1
  import util from 'util';
2
2
  import qs from 'qs';
3
- import { generateOauth2Api } from './BaseApi.js';
4
- import { getCurrentRealmPath } from './utils/ApiUtils.js';
5
- import storage from '../storage/SessionStorage.js';
6
- import { encode } from './utils/Base64.js';
3
+ import { generateOauth2Api } from './BaseApi';
4
+ import { getCurrentRealmPath } from './utils/ApiUtils';
5
+ import storage from '../storage/SessionStorage';
6
+ import { encode } from './utils/Base64';
7
7
 
8
8
  const authorizeUrlTemplate = '%s/oauth2%s/authorize';
9
9
  const accessTokenUrlTemplate = '%s/oauth2%s/access_token';
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
2
  import util from 'util';
3
- import { generateAmApi } from './BaseApi.js';
4
- import { getCurrentRealmPath } from './utils/ApiUtils.js';
5
- import storage from '../storage/SessionStorage.js';
3
+ import { generateAmApi } from './BaseApi';
4
+ import { getCurrentRealmPath } from './utils/ApiUtils';
5
+ import storage from '../storage/SessionStorage';
6
6
 
7
7
  const oauthProviderServiceURLTemplate =
8
8
  '%s/json%s/realm-config/services/oauth-oidc';
@@ -3,9 +3,9 @@ import {
3
3
  getTenantURL,
4
4
  getCurrentRealmPath,
5
5
  getRealmName,
6
- } from './utils/ApiUtils.js';
7
- import { generateAmApi } from './BaseApi.js';
8
- import storage from '../storage/SessionStorage.js';
6
+ } from './utils/ApiUtils';
7
+ import { generateAmApi } from './BaseApi';
8
+ import storage from '../storage/SessionStorage';
9
9
 
10
10
  const realmsListURLTemplate = '%s/json/global-config/realms/?_queryFilter=true';
11
11
  const realmURLTemplate = '%s/json/global-config/realms/%s';
@@ -1,8 +1,8 @@
1
1
  import util from 'util';
2
2
  import _ from 'lodash';
3
- import { generateAmApi } from './BaseApi.js';
4
- import { getCurrentRealmPath } from './utils/ApiUtils.js';
5
- import storage from '../storage/SessionStorage.js';
3
+ import { generateAmApi } from './BaseApi';
4
+ import { getCurrentRealmPath } from './utils/ApiUtils';
5
+ import storage from '../storage/SessionStorage';
6
6
 
7
7
  const providerByLocationAndIdURLTemplate = '%s/json%s/realm-config/saml2/%s/%s';
8
8
  const createHostedProviderURLTemplate =
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { generateAmApi } from './BaseApi.js';
3
- import { getCurrentRealmPath } from './utils/ApiUtils.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { generateAmApi } from './BaseApi';
3
+ import { getCurrentRealmPath } from './utils/ApiUtils';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const scriptURLTemplate = '%s/json%s/scripts/%s';
7
7
  const scriptListURLTemplate = '%s/json%s/scripts?_queryFilter=true';
@@ -1,8 +1,8 @@
1
1
  import util from 'util';
2
- import { encode } from './utils/Base64.js';
3
- import { getTenantURL } from './utils/ApiUtils.js';
4
- import { generateESVApi } from './BaseApi.js';
5
- import storage from '../storage/SessionStorage.js';
2
+ import { encode } from './utils/Base64';
3
+ import { getTenantURL } from './utils/ApiUtils';
4
+ import { generateESVApi } from './BaseApi';
5
+ import storage from '../storage/SessionStorage';
6
6
 
7
7
  const secretsListURLTemplate = '%s/environment/secrets';
8
8
  const secretListVersionsURLTemplate = '%s/environment/secrets/%s/versions';
@@ -1,6 +1,6 @@
1
1
  import util from 'util';
2
- import { generateAmApi } from './BaseApi.js';
3
- import storage from '../storage/SessionStorage.js';
2
+ import { generateAmApi } from './BaseApi';
3
+ import storage from '../storage/SessionStorage';
4
4
 
5
5
  const serverInfoUrlTemplate = '%s/json/serverinfo/%s';
6
6
 
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { generateAmApi } from './BaseApi.js';
3
- import { deleteDeepByKey, getCurrentRealmPath } from './utils/ApiUtils.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { generateAmApi } from './BaseApi';
3
+ import { deleteDeepByKey, getCurrentRealmPath } from './utils/ApiUtils';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const getAllProviderTypesURLTemplate =
7
7
  '%s/json%s/realm-config/services/SocialIdentityProviders?_action=getAllTypes';
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { getTenantURL } from './utils/ApiUtils.js';
3
- import { generateESVApi } from './BaseApi.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { getTenantURL } from './utils/ApiUtils';
3
+ import { generateESVApi } from './BaseApi';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const startupURLTemplate = '%s/environment/startup';
7
7
  const startupInitiateRestartURLTemplate = `${startupURLTemplate}?_action=restart`;
@@ -1,5 +1,5 @@
1
- import { getConfigEntity, putConfigEntity } from './IdmConfigApi.js';
2
- import { getCurrentRealmName } from './utils/ApiUtils.js';
1
+ import { getConfigEntity, putConfigEntity } from './IdmConfigApi';
2
+ import { getCurrentRealmName } from './utils/ApiUtils';
3
3
 
4
4
  const THEMEREALM_ID = 'ui/themerealm';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import util from 'util';
2
- import { deleteDeepByKey, getCurrentRealmPath } from './utils/ApiUtils.js';
3
- import { generateAmApi } from './BaseApi.js';
4
- import storage from '../storage/SessionStorage.js';
2
+ import { deleteDeepByKey, getCurrentRealmPath } from './utils/ApiUtils';
3
+ import { generateAmApi } from './BaseApi';
4
+ import storage from '../storage/SessionStorage';
5
5
 
6
6
  const nodeURLTemplate =
7
7
  '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s/%s';
@@ -1,8 +1,8 @@
1
1
  import util from 'util';
2
- import { encode } from './utils/Base64.js';
3
- import { getTenantURL, getCurrentRealmPath } from './utils/ApiUtils.js';
4
- import { generateESVApi } from './BaseApi.js';
5
- import storage from '../storage/SessionStorage.js';
2
+ import { encode } from './utils/Base64';
3
+ import { getTenantURL, getCurrentRealmPath } from './utils/ApiUtils';
4
+ import { generateESVApi } from './BaseApi';
5
+ import storage from '../storage/SessionStorage';
6
6
 
7
7
  const variablesListURLTemplate = '%s/environment/variables';
8
8
  const variableURLTemplate = '%s/environment/variables/%s';
@@ -1,5 +1,5 @@
1
1
  import util from 'util';
2
- import storage from '../../storage/SessionStorage.js';
2
+ import storage from '../../storage/SessionStorage';
3
3
 
4
4
  const realmPathTemplate = '/realms/%s';
5
5
 
@@ -1,8 +1,5 @@
1
- import {
2
- getCurrentRealmPath,
3
- getTenantURL,
4
- } from './ApiUtils.js';
5
- import sessionStorage from '../../storage/SessionStorage.js';
1
+ import { getCurrentRealmPath, getTenantURL } from './ApiUtils';
2
+ import sessionStorage from '../../storage/SessionStorage';
6
3
 
7
4
  test.skip('replaceAll should be deleted because it works like native String.replaceAll', () => {
8
5
  // Arrange
File without changes
package/src/index.mjs ADDED
@@ -0,0 +1,38 @@
1
+ import fs from 'fs';
2
+
3
+ const pkg = JSON.parse(
4
+ fs.readFileSync(new URL('../package.json', import.meta.url))
5
+ );
6
+
7
+ export function getVersion() {
8
+ return `v${pkg.version}`;
9
+ }
10
+
11
+ export * as Admin from './ops/AdminOps';
12
+ export * as Authenticate from './ops/AuthenticateOps';
13
+ export * as CirclesOfTrust from './ops/CirclesOfTrustOps';
14
+ export * as ConnectionProfile from './ops/ConnectionProfileOps';
15
+ export * as EmailTemplate from './ops/EmailTemplateOps';
16
+ export * as Idm from './ops/IdmOps';
17
+ export * as Idp from './ops/IdmOps';
18
+ export * as Journey from './ops/JourneyOps';
19
+ export * as Log from './ops/LogOps';
20
+ export * as ManagedObject from './ops/ManagedObjectOps';
21
+ export * as OAuth2Client from './ops/OAuth2ClientOps';
22
+ export * as Organization from './ops/OrganizationOps';
23
+ export * as Realm from './ops/RealmOps';
24
+ export * as Saml from './ops/SamlOps';
25
+ export * as Script from './ops/ScriptOps';
26
+ export * as Secrets from './ops/SecretsOps';
27
+ export * as Startup from './ops/StartupOps';
28
+ export * as Theme from './ops/ThemeOps';
29
+ export * as Variables from './ops/VariablesOps';
30
+ // TODO: revisit if there are better ways
31
+ export * as Utils from './ops/utils/OpsUtils';
32
+ // TODO: reconsider the aproach to pass in state from client
33
+ // lib should be stateless, an aplication should own its state
34
+ export * as state from './storage/SessionStorage';
35
+ // TODO: need to figure out if this is the right approach or if we should even
36
+ // use a public oauth2/oidc library. might be ok for now since there is only
37
+ // one place where the cli needs to execute an oauth flow.
38
+ export * as OAuth2OIDCApi from './api/OAuth2OIDCApi';
@@ -5,7 +5,7 @@ const pkg = JSON.parse(
5
5
  fs.readFileSync(new URL('../package.json', import.meta.url))
6
6
  );
7
7
 
8
- describe('index.js', () => {
8
+ describe('index', () => {
9
9
  test('get library version', () => {
10
10
  const result = getVersion();
11
11
  expect(result).toEqual(`v${pkg.version}`);
@@ -4,17 +4,17 @@ import {
4
4
  getOAuth2Clients,
5
5
  getOAuth2Client,
6
6
  putOAuth2Client,
7
- } from '../api/OAuth2ClientApi.js';
8
- import { getConfigEntity, putConfigEntity } from '../api/IdmConfigApi.js';
9
- import { isEqualJson, getRealmManagedUser } from './utils/OpsUtils.js';
10
- import { getRealmManagedOrganization } from './OrganizationOps.js';
11
- import { getOAuth2Provider } from '../api/OAuth2ProviderApi.js';
12
- import { putSecret } from '../api/SecretsApi.js';
13
- import { clientCredentialsGrant } from '../api/OAuth2OIDCApi.js';
7
+ } from '../api/OAuth2ClientApi';
8
+ import { getConfigEntity, putConfigEntity } from '../api/IdmConfigApi';
9
+ import { isEqualJson, getRealmManagedUser } from './utils/OpsUtils';
10
+ import { getRealmManagedOrganization } from './OrganizationOps';
11
+ import { getOAuth2Provider } from '../api/OAuth2ProviderApi';
12
+ import { putSecret } from '../api/SecretsApi';
13
+ import { clientCredentialsGrant } from '../api/OAuth2OIDCApi';
14
14
  // import OAUTH2_CLIENT from './templates/OAuth2ClientTemplate.json' assert { type: 'json' };
15
15
  // import ORG_MODEL_USER_ATTRIBUTES from './templates/OrgModelUserAttributesTemplate.json' assert { type: 'json' };
16
16
  // import GENERIC_EXTENSION_ATTRIBUTES from './templates/cloud/GenericExtensionAttributesTemplate.json' assert { type: 'json' };
17
- import { printMessage } from './utils/Console.js';
17
+ import { printMessage } from './utils/Console';
18
18
 
19
19
  const OAUTH2_CLIENT = JSON.parse(
20
20
  fs.readFileSync(