@mojaloop/ml-testing-toolkit-shared-lib 14.3.2 → 14.3.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.
package/.ncurc.yaml CHANGED
@@ -1,7 +1,2 @@
1
1
  ## Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
2
- reject:
3
- # @apidevtools/json-schema-ref-parser v15+ is ESM-only ("type": "module").
4
- # This project uses CommonJS require() in src/lib/openApiMockGenerator.js.
5
- # Upgrading would require migrating the entire project to ESM or using dynamic imports.
6
- # Migrate to ESM when the project is ready for a major version bump.
7
- - '@apidevtools/json-schema-ref-parser'
2
+ reject: []
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 22.15.1
1
+ 24.18.0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
  # Changelog: [mojaloop/als-consent-oracle](https://github.com/mojaloop/als-consent-oracle)
2
+ ### [14.3.4](https://github.com/mojaloop/ml-testing-toolkit-shared-lib/compare/v14.3.3...v14.3.4) (2026-07-08)
3
+
4
+
5
+ ### Chore
6
+
7
+ * take dependency majors per no-preemptive-reject policy [mojalo… ([#32](https://github.com/mojaloop/ml-testing-toolkit-shared-lib/issues/32)) ([8cdca56](https://github.com/mojaloop/ml-testing-toolkit-shared-lib/commit/8cdca567756559d50fbdb57534b84dddb0a8a4c8))
8
+
9
+ ### [14.3.3](https://github.com/mojaloop/ml-testing-toolkit-shared-lib/compare/v14.3.2...v14.3.3) (2026-02-13)
10
+
11
+
12
+ ### Chore
13
+
14
+ * **ci:** update CircleCI orb to 1.1.10 ([84d8b02](https://github.com/mojaloop/ml-testing-toolkit-shared-lib/commit/84d8b024d333d520aad2a9465ecda51c1fc4ea8e))
15
+
2
16
  ### [14.3.2](https://github.com/mojaloop/ml-testing-toolkit-shared-lib/compare/v14.3.1...v14.3.2) (2026-01-13)
3
17
 
4
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/ml-testing-toolkit-shared-lib",
3
- "version": "14.3.2",
3
+ "version": "14.3.4",
4
4
  "description": "Shared library for ml-testing-toolkit re-usable functions",
5
5
  "main": "src/index.js",
6
6
  "contributors": [
@@ -31,12 +31,12 @@
31
31
  "lint": "npm run standard",
32
32
  "lint:fix": "npm run standard:fix",
33
33
  "test": "npm run test:unit",
34
- "test:unit": "jest --testMatch '**/test/unit/**/*.test.js'",
34
+ "test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --testMatch '**/test/unit/**/*.test.js'",
35
35
  "test:xunit": "npm run test:unit",
36
- "test:int": "jest --reporters=default --reporters=jest-junit --testMatch '**/test/integration/**/*.test.js'",
37
- "test:coverage": "jest --coverage --coverageThreshold='{}' --testMatch '**/test/unit/**/*.test.js'",
38
- "test:coverage-check": "jest --coverage --testMatch '**/test/unit/**/*.test.js'",
39
- "test:junit": "jest --reporters=default --reporters=jest-junit --testMatch '**/test/unit/**/*.test.js'",
36
+ "test:int": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=default --reporters=jest-junit --testMatch '**/test/integration/**/*.test.js'",
37
+ "test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage --coverageThreshold='{}' --testMatch '**/test/unit/**/*.test.js'",
38
+ "test:coverage-check": "NODE_OPTIONS=--experimental-vm-modules jest --coverage --testMatch '**/test/unit/**/*.test.js'",
39
+ "test:junit": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=default --reporters=jest-junit --testMatch '**/test/unit/**/*.test.js'",
40
40
  "test:integration": "echo 'No integration tests defined'",
41
41
  "test:functional": "echo 'No functional tests defined'",
42
42
  "cover": "npx nyc --all report --reporter=lcov npm run test",
@@ -48,22 +48,22 @@
48
48
  "snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
49
49
  },
50
50
  "dependencies": {
51
- "@apidevtools/json-schema-ref-parser": "14.2.1",
52
- "@faker-js/faker": "10.1.0",
53
- "ajv": "8.17.1",
54
- "json-schema-faker": "0.5.9",
55
- "lodash": "4.17.21",
51
+ "@apidevtools/json-schema-ref-parser": "15.4.0",
52
+ "@faker-js/faker": "10.5.0",
53
+ "ajv": "8.20.0",
54
+ "json-schema-faker": "0.6.2",
55
+ "lodash": "4.18.1",
56
56
  "node-dir": "0.1.17"
57
57
  },
58
58
  "devDependencies": {
59
- "@commitlint/cli": "^20.2.0",
60
- "@commitlint/config-conventional": "^20.2.0",
59
+ "@commitlint/cli": "^21.2.0",
60
+ "@commitlint/config-conventional": "^21.2.0",
61
61
  "@types/jest": "30.0.0",
62
62
  "audit-ci": "^7.1.0",
63
- "jest": "30.2.0",
64
- "jest-junit": "16.0.0",
65
- "npm-check-updates": "19.1.2",
66
- "pre-commit": "^1.2.2",
63
+ "jest": "30.4.2",
64
+ "jest-junit": "17.0.0",
65
+ "npm-check-updates": "22.2.9",
66
+ "pre-commit": "^2.0.0",
67
67
  "replace": "^1.2.2",
68
68
  "standard": "^17.1.2",
69
69
  "standard-version": "^9.5.0"
@@ -73,8 +73,11 @@
73
73
  "glob": "9.3.5",
74
74
  "rimraf": "5.0.10",
75
75
  "@babel/helpers": "7.26.10",
76
- "brace-expansion": "1.1.12",
77
- "js-yaml": "4.1.1"
76
+ "brace-expansion": "1.1.13",
77
+ "js-yaml": "4.2.0",
78
+ "replace": {
79
+ "minimatch": "3.1.5"
80
+ }
78
81
  },
79
82
  "standard-version": {
80
83
  "scripts": {
@@ -32,18 +32,38 @@ const _ = require('lodash')
32
32
  // const jref = require('json-ref-lite')
33
33
  // const yaml = require('js-yaml')
34
34
  const { faker } = require('@faker-js/faker')
35
- const jsf = require('json-schema-faker')
36
35
  const $RefParser = require('@apidevtools/json-schema-ref-parser')
37
36
  const Ajv = require('ajv')
38
37
 
39
- jsf.format('byte', () => Buffer.alloc(faker.lorem.sentence({ min: 12, max: 12 })).toString('base64'))
38
+ // json-schema-faker v0.6+ is ESM-only (exports map only defines an "import" condition),
39
+ // so it cannot be require()d from this CommonJS module and is lazy-loaded via dynamic import.
40
+ let jsfModulePromise = null
41
+ const getJsf = () => {
42
+ if (!jsfModulePromise) {
43
+ jsfModulePromise = import('json-schema-faker')
44
+ }
45
+ return jsfModulePromise
46
+ }
40
47
 
41
- jsf.option({
42
- alwaysFakeOptionals: true,
43
- ignoreMissingRefs: true,
44
- maxItems: 2
45
- })
46
- jsf.extend('faker', () => require('@faker-js/faker').faker)
48
+ // v0.6 replaced the global jsf.format()/jsf.option()/jsf.extend()/jsf.resolve() API with a
49
+ // per-call generate(schema, options) API. jsfRefs ({ id, ... }) entries are served through
50
+ // options.refResolver; unknown $refs resolve to an empty schema (v0.5 ignoreMissingRefs: true).
51
+ const jsfGenerate = async (schema, jsfRefs = []) => {
52
+ const { generate } = await getJsf()
53
+ const refSchemas = {}
54
+ jsfRefs.forEach(({ id, ...refSchema }) => {
55
+ refSchemas[id] = refSchema
56
+ })
57
+ return generate(schema, {
58
+ alwaysFakeOptionals: true,
59
+ maxItems: 2,
60
+ formats: {
61
+ byte: () => Buffer.alloc(faker.lorem.sentence({ min: 12, max: 12 })).toString('base64')
62
+ },
63
+ extensions: { faker },
64
+ refResolver: (ref) => refSchemas[ref] || {}
65
+ })
66
+ }
47
67
 
48
68
  const ajv = new Ajv({
49
69
  strict: false,
@@ -160,7 +180,7 @@ const generateMockResponseBody = async (method, name, data, jsfRefs) => {
160
180
  })
161
181
 
162
182
  const fakedResponse = {}
163
- fakedResponse.body = await jsf.resolve(newResponseSchema, jsfRefs)
183
+ fakedResponse.body = await jsfGenerate(newResponseSchema, jsfRefs)
164
184
  for (const key in data.responses) {
165
185
  fakedResponse.status = key
166
186
  if (key >= 200 && key <= 299) {
@@ -186,7 +206,7 @@ const generateMockOperation = async (method, name, data, jsfRefs) => {
186
206
  }
187
207
  })
188
208
 
189
- const fakedResponse = await jsf.resolve(newRequestSchema, jsfRefs)
209
+ const fakedResponse = await jsfGenerate(newRequestSchema, jsfRefs)
190
210
 
191
211
  return fakedResponse
192
212
  }
@@ -208,7 +228,7 @@ const generateMockHeaders = async (method, name, data, jsfRefs) => {
208
228
  return {}
209
229
  }
210
230
 
211
- const fakedResponse = await jsf.resolve(headers, jsfRefs)
231
+ const fakedResponse = await jsfGenerate(headers, jsfRefs)
212
232
 
213
233
  return fakedResponse
214
234
  }
@@ -230,7 +250,7 @@ const generateMockQueryParams = async (method, name, data, jsfRefs) => {
230
250
  return {}
231
251
  }
232
252
 
233
- const fakedResponse = await jsf.resolve(queryParams, jsfRefs)
253
+ const fakedResponse = await jsfGenerate(queryParams, jsfRefs)
234
254
 
235
255
  return fakedResponse
236
256
  }
@@ -252,7 +272,7 @@ const generateMockPathParams = async (method, name, data, jsfRefs) => {
252
272
  return {}
253
273
  }
254
274
 
255
- const fakedResponse = await jsf.resolve(pathParams, jsfRefs)
275
+ const fakedResponse = await jsfGenerate(pathParams, jsfRefs)
256
276
 
257
277
  return fakedResponse
258
278
  }