@mojaloop/sdk-scheme-adapter 24.9.3 → 24.9.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.
Files changed (37) hide show
  1. package/.yarn/cache/{@babel-core-npm-7.27.1-0f1bf48e52-fce205f9ee.zip → @babel-core-npm-7.27.4-801e5891a4-e7f961274f.zip} +0 -0
  2. package/.yarn/cache/@babel-generator-npm-7.27.3-9f345034e6-c0b1b399ff.zip +0 -0
  3. package/.yarn/cache/@babel-helper-module-transforms-npm-7.27.3-90dc30d3d9-c611d42d3c.zip +0 -0
  4. package/.yarn/cache/{@babel-helpers-npm-7.27.1-cd553908c9-19ede1e996.zip → @babel-helpers-npm-7.27.4-ba8f87a40e-a50ce7ff92.zip} +0 -0
  5. package/.yarn/cache/@babel-parser-npm-7.27.3-3085b3fa96-aef2cfd154.zip +0 -0
  6. package/.yarn/cache/@babel-parser-npm-7.27.4-c8d264780c-846d267688.zip +0 -0
  7. package/.yarn/cache/@babel-traverse-npm-7.27.3-340ab882dc-9144023829.zip +0 -0
  8. package/.yarn/cache/@babel-traverse-npm-7.27.4-fe457ebf1b-ae0047fe78.zip +0 -0
  9. package/.yarn/cache/@babel-types-npm-7.27.3-7b6a22808d-f0d43c0231.zip +0 -0
  10. package/.yarn/cache/{@redis-bloom-npm-5.1.0-323d34032e-d59e173944.zip → @redis-bloom-npm-5.1.1-c40a006b49-acf551ecd9.zip} +0 -0
  11. package/.yarn/cache/{@redis-client-npm-5.1.0-b981e68f86-bd7cd019ac.zip → @redis-client-npm-5.1.1-1bf41c09fc-5d31776707.zip} +0 -0
  12. package/.yarn/cache/{@redis-json-npm-5.1.0-029036681e-89ff085315.zip → @redis-json-npm-5.1.1-cafaa4c2f2-4dd9fa324d.zip} +0 -0
  13. package/.yarn/cache/{@redis-search-npm-5.1.0-366c78e895-167d86c9f6.zip → @redis-search-npm-5.1.1-f91b17a98d-6626955a56.zip} +0 -0
  14. package/.yarn/cache/{@redis-time-series-npm-5.1.0-0de38641ac-b408065311.zip → @redis-time-series-npm-5.1.1-2e2f40066a-94de04e8a3.zip} +0 -0
  15. package/.yarn/cache/{@types-node-npm-22.15.21-a4f238de1a-989f1ce3a9.zip → @types-node-npm-22.15.28-a9d86ffc23-80a82dd77d.zip} +0 -0
  16. package/.yarn/cache/@typescript-eslint-eslint-plugin-npm-8.33.0-0c4da18297-d9d009e644.zip +0 -0
  17. package/.yarn/cache/@typescript-eslint-parser-npm-8.33.0-67664fe1c4-16b4e34626.zip +0 -0
  18. package/.yarn/cache/@typescript-eslint-project-service-npm-8.33.0-0b8e3c7267-efb90f2fea.zip +0 -0
  19. package/.yarn/cache/@typescript-eslint-scope-manager-npm-8.33.0-bdad5df8b4-e5a82f102a.zip +0 -0
  20. package/.yarn/cache/@typescript-eslint-tsconfig-utils-npm-8.33.0-d26e1ec245-5bb139be99.zip +0 -0
  21. package/.yarn/cache/@typescript-eslint-type-utils-npm-8.33.0-36d614815a-edd6bb629f.zip +0 -0
  22. package/.yarn/cache/@typescript-eslint-types-npm-8.33.0-a3afab3a2a-3fa8c45989.zip +0 -0
  23. package/.yarn/cache/@typescript-eslint-typescript-estree-npm-8.33.0-575e7dfb97-365de7456d.zip +0 -0
  24. package/.yarn/cache/@typescript-eslint-utils-npm-8.33.0-909f5cda94-e654ceac6a.zip +0 -0
  25. package/.yarn/cache/@typescript-eslint-visitor-keys-npm-8.33.0-f53e6c2cd3-c92eacedd9.zip +0 -0
  26. package/.yarn/cache/{eslint-plugin-jest-npm-28.11.0-a208fceab5-809ec7f0d4.zip → eslint-plugin-jest-npm-28.12.0-a05d8a1874-8d0bcb2133.zip} +0 -0
  27. package/.yarn/cache/{redis-npm-5.1.0-37820eea51-a1ee60be3b.zip → redis-npm-5.1.1-42b1539552-99d33a2430.zip} +0 -0
  28. package/.yarn/install-state.gz +0 -0
  29. package/CHANGELOG.md +14 -0
  30. package/modules/api-svc/package.json +3 -3
  31. package/modules/api-svc/src/InboundServer/index.js +10 -0
  32. package/modules/api-svc/src/index.js +15 -2
  33. package/modules/api-svc/test/unit/index.test.js +40 -0
  34. package/modules/outbound-command-event-handler/package.json +4 -4
  35. package/modules/outbound-domain-event-handler/package.json +4 -4
  36. package/modules/private-shared-lib/package.json +4 -4
  37. package/package.json +4 -4
Binary file
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
  # Changelog: [mojaloop/sdk-scheme-adapter](https://github.com/mojaloop/sdk-scheme-adapter)
2
+ ### [24.9.5](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.9.4...v24.9.5) (2025-05-30)
3
+
4
+
5
+ ### Chore
6
+
7
+ * hot mutate peerJwsKeys instead of restart ([#584](https://github.com/mojaloop/sdk-scheme-adapter/issues/584)) ([08983fc](https://github.com/mojaloop/sdk-scheme-adapter/commit/08983fcc5ab7cde0042cb3e17545d581accb9d3a))
8
+
9
+ ### [24.9.4](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.9.3...v24.9.4) (2025-05-30)
10
+
11
+
12
+ ### Chore
13
+
14
+ * restart inbound on diff peerJwsKeys ([#582](https://github.com/mojaloop/sdk-scheme-adapter/issues/582)) ([c388481](https://github.com/mojaloop/sdk-scheme-adapter/commit/c388481185ff7aab08c6e6151825adc849bf6124))
15
+
2
16
  ### [24.9.3](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.9.2...v24.9.3) (2025-05-27)
3
17
 
4
18
 
@@ -95,12 +95,12 @@
95
95
  "prom-client": "15.1.3",
96
96
  "promise-timeout": "1.3.0",
97
97
  "random-word-slugs": "0.1.7",
98
- "redis": "5.1.0",
98
+ "redis": "5.1.1",
99
99
  "uuidv4": "6.2.13",
100
100
  "ws": "8.18.2"
101
101
  },
102
102
  "devDependencies": {
103
- "@babel/core": "7.27.1",
103
+ "@babel/core": "7.27.4",
104
104
  "@babel/preset-env": "7.27.2",
105
105
  "@redocly/openapi-cli": "1.0.0-beta.95",
106
106
  "@types/jest": "29.5.14",
@@ -109,7 +109,7 @@
109
109
  "eslint": "9.15.0",
110
110
  "eslint-config-airbnb-base": "15.0.0",
111
111
  "eslint-plugin-import": "2.31.0",
112
- "eslint-plugin-jest": "28.11.0",
112
+ "eslint-plugin-jest": "28.12.0",
113
113
  "jest": "29.7.0",
114
114
  "jest-junit": "16.0.0",
115
115
  "npm-check-updates": "16.7.10",
@@ -52,6 +52,7 @@ class InboundApi extends EventEmitter {
52
52
  super({ captureExceptions: true });
53
53
  this._conf = conf;
54
54
  this._cache = cache;
55
+ this._logger = logger;
55
56
  _initialize ||= _validator.initialise(apiSpecs, conf);
56
57
 
57
58
  if (conf.validateInboundJws) {
@@ -85,6 +86,15 @@ class InboundApi extends EventEmitter {
85
86
  return this._api.callback();
86
87
  }
87
88
 
89
+ _updatePeerJwsKeys(peerJwsKeys) {
90
+ if (this._conf.pm4mlEnabled) {
91
+ this._logger && this._logger.isVerboseEnabled && this._logger.verbose('Clearing existing JWS verification keys');
92
+ Object.keys(this._jwsVerificationKeys).forEach(key => delete this._jwsVerificationKeys[key]);
93
+ this._logger && this._logger.isVerboseEnabled && this._logger.verbose('Assigning new peer JWS keys');
94
+ Object.assign(this._jwsVerificationKeys, peerJwsKeys);
95
+ }
96
+ }
97
+
88
98
  _startJwsWatcher() {
89
99
  const FS_EVENT_TYPES = {
90
100
  CHANGE: 'change',
@@ -139,6 +139,15 @@ class Server extends EventEmitter {
139
139
  }
140
140
  }
141
141
 
142
+ _shouldUpdateInboundServer(newConf) {
143
+ return !_.isEqual(this.conf.inbound, newConf.inbound)
144
+ || !_.isEqual(this.conf.outbound, newConf.outbound);
145
+ }
146
+
147
+ _shouldUpdatePeerJwsKeys(newConf) {
148
+ return !_.isEqual(this.conf.peerJWSKeys, newConf.peerJWSKeys);
149
+ }
150
+
142
151
  async start() {
143
152
  await this.cache.connect();
144
153
  await this.wso2.auth.start();
@@ -224,8 +233,7 @@ class Server extends EventEmitter {
224
233
  }
225
234
 
226
235
  this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.inbound, newConf: newConf.inbound }).debug('Inbound server configuration');
227
- const updateInboundServer = !_.isEqual(this.conf.inbound, newConf.inbound)
228
- || !_.isEqual(this.conf.outbound, newConf.outbound);
236
+ const updateInboundServer = this._shouldUpdateInboundServer(this.conf, newConf);
229
237
  if (updateInboundServer) {
230
238
  await this.inboundServer.stop();
231
239
  this.inboundServer = new InboundServer(
@@ -243,6 +251,11 @@ class Server extends EventEmitter {
243
251
  restartActionsTaken.updateInboundServer = true;
244
252
  }
245
253
 
254
+ const updatePeerJwsKeys = this._shouldUpdatePeerJwsKeys(newConf);
255
+ if (updatePeerJwsKeys) {
256
+ this.inboundServer._api._updatePeerJwsKeys(newConf.peerJWSKeys);
257
+ }
258
+
246
259
  this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.outbound, newConf: newConf.outbound }).debug('Outbound server configuration');
247
260
  const updateOutboundServer = !_.isEqual(this.conf.outbound, newConf.outbound);
248
261
  if (updateOutboundServer) {
@@ -98,5 +98,45 @@ describe('Server', () => {
98
98
  expect(server.restart).toHaveBeenCalledTimes(1);
99
99
  expect(server.restart).toHaveBeenCalledWith(newConf);
100
100
  });
101
+
102
+ it('hot mutates peerJwsKeys reference if peerJWSKeys config is different', async () => {
103
+ // Test that peerJwsKeys are updated without a full restart if config changes
104
+ const originalPeerJwsKeys = conf.peerJWSKeys;
105
+ const newPeerJwsKeys = { ...originalPeerJwsKeys, newKey: 'newValue' };
106
+ const newConfPeerJwsKeys = { ...conf, peerJWSKeys: newPeerJwsKeys };
107
+
108
+ expect(server._shouldUpdatePeerJwsKeys(newConfPeerJwsKeys)).toBe(true);
109
+
110
+ controlServer.broadcastConfigChange(newConfPeerJwsKeys);
111
+ await new Promise((wait) => setTimeout(wait, 1000));
112
+
113
+ // Should call restart with new config
114
+ expect(server.restart).toHaveBeenCalledWith(newConfPeerJwsKeys);
115
+ });
116
+
117
+ it('restarts inbound server if inbound or outbound is different', async () => {
118
+ // Clone the conf and change inbound config
119
+ const newConfInbound = JSON.parse(JSON.stringify(conf));
120
+ newConfInbound.inbound = { ...conf.inbound, newProp: 'value' };
121
+
122
+ expect(server._shouldUpdateInboundServer(newConfInbound)).toBe(true);
123
+
124
+ controlServer.broadcastConfigChange(newConfInbound);
125
+ await new Promise((wait) => setTimeout(wait, 1000));
126
+ expect(server.restart).toHaveBeenCalledWith(newConfInbound);
127
+
128
+ // Reset mock
129
+ server.restart.mockClear();
130
+
131
+ // Clone the conf and change outbound config
132
+ const newConfOutbound = JSON.parse(JSON.stringify(conf));
133
+ newConfOutbound.outbound = { ...conf.outbound, anotherProp: 'value' };
134
+
135
+ expect(server._shouldUpdateInboundServer(newConfOutbound)).toBe(true);
136
+
137
+ controlServer.broadcastConfigChange(newConfOutbound);
138
+ await new Promise((wait) => setTimeout(wait, 1000));
139
+ expect(server.restart).toHaveBeenCalledWith(newConfOutbound);
140
+ });
101
141
  });
102
142
  });
@@ -51,7 +51,7 @@
51
51
  "convict": "6.2.4",
52
52
  "express": "4.21.2",
53
53
  "openapi-backend": "5.12.0",
54
- "redis": "5.1.0",
54
+ "redis": "5.1.1",
55
55
  "swagger-ui-express": "5.0.1",
56
56
  "yamljs": "0.3.0"
57
57
  },
@@ -60,13 +60,13 @@
60
60
  "@types/convict": "6.1.6",
61
61
  "@types/express": "5.0.2",
62
62
  "@types/jest": "29.5.14",
63
- "@types/node": "22.15.21",
63
+ "@types/node": "22.15.28",
64
64
  "@types/node-cache": "4.2.5",
65
65
  "@types/supertest": "6.0.3",
66
66
  "@types/swagger-ui-express": "4.1.8",
67
67
  "@types/yamljs": "0.2.34",
68
- "@typescript-eslint/eslint-plugin": "8.32.1",
69
- "@typescript-eslint/parser": "8.32.1",
68
+ "@typescript-eslint/eslint-plugin": "8.33.0",
69
+ "@typescript-eslint/parser": "8.33.0",
70
70
  "copyfiles": "2.4.1",
71
71
  "eslint": "9.15.0",
72
72
  "jest": "29.7.0",
@@ -49,7 +49,7 @@
49
49
  "convict": "6.2.4",
50
50
  "express": "4.21.2",
51
51
  "openapi-backend": "5.12.0",
52
- "redis": "5.1.0",
52
+ "redis": "5.1.1",
53
53
  "swagger-ui-express": "5.0.1",
54
54
  "yamljs": "0.3.0"
55
55
  },
@@ -57,13 +57,13 @@
57
57
  "@types/convict": "6.1.6",
58
58
  "@types/express": "5.0.2",
59
59
  "@types/jest": "29.5.14",
60
- "@types/node": "22.15.21",
60
+ "@types/node": "22.15.28",
61
61
  "@types/node-cache": "4.2.5",
62
62
  "@types/supertest": "6.0.3",
63
63
  "@types/swagger-ui-express": "4.1.8",
64
64
  "@types/yamljs": "0.2.34",
65
- "@typescript-eslint/eslint-plugin": "8.32.1",
66
- "@typescript-eslint/parser": "8.32.1",
65
+ "@typescript-eslint/eslint-plugin": "8.33.0",
66
+ "@typescript-eslint/parser": "8.33.0",
67
67
  "copyfiles": "2.4.1",
68
68
  "eslint": "9.15.0",
69
69
  "jest": "29.7.0",
@@ -35,15 +35,15 @@
35
35
  "@mojaloop/platform-shared-lib-messaging-types-lib": "0.7.2",
36
36
  "@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": "0.5.18",
37
37
  "ajv": "8.17.1",
38
- "redis": "5.1.0",
38
+ "redis": "5.1.1",
39
39
  "uuid": "11.1.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@eslint/compat": "1.2.9",
43
- "@types/node": "22.15.21",
43
+ "@types/node": "22.15.28",
44
44
  "@types/uuid": "10.0.0",
45
- "@typescript-eslint/eslint-plugin": "8.32.1",
46
- "@typescript-eslint/parser": "8.32.1",
45
+ "@typescript-eslint/eslint-plugin": "8.33.0",
46
+ "@typescript-eslint/parser": "8.33.0",
47
47
  "eslint": "9.15.0",
48
48
  "jest": "29.7.0",
49
49
  "npm-check-updates": "16.7.10",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "24.9.3",
3
+ "version": "24.9.5",
4
4
  "description": "mojaloop sdk-scheme-adapter",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
@@ -82,10 +82,10 @@
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/jest": "29.5.14",
85
- "@types/node": "22.15.21",
85
+ "@types/node": "22.15.28",
86
86
  "@types/node-cache": "4.2.5",
87
- "@typescript-eslint/eslint-plugin": "8.32.1",
88
- "@typescript-eslint/parser": "8.32.1",
87
+ "@typescript-eslint/eslint-plugin": "8.33.0",
88
+ "@typescript-eslint/parser": "8.33.0",
89
89
  "audit-ci": "7.1.0",
90
90
  "eslint": "9.15.0",
91
91
  "eslint-config-airbnb-typescript": "18.0.0",