@mojaloop/sdk-scheme-adapter 24.9.8-snapshot.2 → 24.9.8-snapshot.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 (35) hide show
  1. package/.ncurc.yaml +1 -2
  2. package/.yarn/cache/{@mojaloop-central-services-shared-npm-18.26.2-e822c6028a-504c725d38.zip → @mojaloop-central-services-shared-npm-18.27.0-66f0d90603-bf265a09bd.zip} +0 -0
  3. package/.yarn/cache/{@mojaloop-inter-scheme-proxy-cache-lib-npm-2.5.0-eeb80fe407-bf7e14ce33.zip → @mojaloop-inter-scheme-proxy-cache-lib-npm-2.6.0-94424a1568-2f05e6e272.zip} +0 -0
  4. package/.yarn/cache/{@redis-bloom-npm-5.1.1-c40a006b49-acf551ecd9.zip → @redis-bloom-npm-5.5.5-08ba788570-bde4c98288.zip} +0 -0
  5. package/.yarn/cache/{@redis-client-npm-5.1.1-1bf41c09fc-5d31776707.zip → @redis-client-npm-5.5.5-de45fa1462-638e7e85fb.zip} +0 -0
  6. package/.yarn/cache/{@redis-json-npm-5.1.1-cafaa4c2f2-4dd9fa324d.zip → @redis-json-npm-5.5.5-6caae5d1e6-26c0deb195.zip} +0 -0
  7. package/.yarn/cache/{@redis-search-npm-5.1.1-f91b17a98d-6626955a56.zip → @redis-search-npm-5.5.5-be3d1b0301-6b269f544a.zip} +0 -0
  8. package/.yarn/cache/{@redis-time-series-npm-5.1.1-2e2f40066a-94de04e8a3.zip → @redis-time-series-npm-5.5.5-3a80ea3c7f-5d5d7cc857.zip} +0 -0
  9. package/.yarn/cache/async-exit-hook-npm-2.0.1-09570c5c6b-b72cbdd19e.zip +0 -0
  10. package/.yarn/cache/async-retry-npm-1.3.3-bc90c5cee0-38a7152ff7.zip +0 -0
  11. package/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-888cf5493f.zip +0 -0
  12. package/.yarn/cache/debug-npm-4.3.4-4513954577-3dbad3f94e.zip +0 -0
  13. package/.yarn/cache/esm-npm-3.2.25-762b3ebd40-978aabe2de.zip +0 -0
  14. package/.yarn/cache/getopts-npm-2.3.0-4b1830217c-bbb5fcef8d.zip +0 -0
  15. package/.yarn/cache/interpret-npm-2.2.0-3603a544e1-f51efef7cb.zip +0 -0
  16. package/.yarn/cache/knex-npm-3.1.0-87fad39c7a-3905f8d279.zip +0 -0
  17. package/.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip +0 -0
  18. package/.yarn/cache/pg-connection-string-npm-2.6.2-43a4a40be5-22265882c3.zip +0 -0
  19. package/.yarn/cache/rechoir-npm-0.8.0-fb660b3bc8-ad3caed8af.zip +0 -0
  20. package/.yarn/cache/redis-npm-5.5.5-e30d8c3be4-fa4864e201.zip +0 -0
  21. package/.yarn/cache/retry-npm-0.13.1-89eb100ab6-47c4d5be67.zip +0 -0
  22. package/.yarn/cache/tarn-npm-3.0.2-4324dc10b0-27a69658f0.zip +0 -0
  23. package/.yarn/cache/tildify-npm-2.0.0-324bfdd523-0f5fee9362.zip +0 -0
  24. package/.yarn/install-state.gz +0 -0
  25. package/modules/api-svc/package.json +4 -3
  26. package/modules/api-svc/src/InboundServer/api.yaml +3 -1
  27. package/modules/api-svc/src/InboundServer/index.js +0 -14
  28. package/modules/api-svc/src/index.js +45 -5
  29. package/modules/api-svc/test/unit/InboundServer.test.js +0 -54
  30. package/modules/outbound-command-event-handler/package.json +3 -3
  31. package/modules/outbound-domain-event-handler/package.json +2 -2
  32. package/modules/private-shared-lib/package.json +3 -3
  33. package/package.json +1 -2
  34. package/.yarn/cache/@mojaloop-central-services-logger-npm-11.8.1-b87fd96eee-32d5d8371e.zip +0 -0
  35. package/.yarn/cache/redis-npm-5.1.1-42b1539552-99d33a2430.zip +0 -0
package/.ncurc.yaml CHANGED
@@ -12,6 +12,5 @@ reject: [
12
12
  ## esLint 9.15.0 caused the error: TypeError: Error while loading rule '@typescript-eslint/no-unused-expressions': Cannot read properties of undefined (reading 'allowShortCircuit')
13
13
  "eslint",
14
14
  ## express >5 introduces breaking changes that are not compatible with the current codebase.
15
- "express",
16
- "@mojaloop/central-services-shared"
15
+ "express"
17
16
  ]
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-api-svc",
3
- "version": "21.0.0-snapshot.40",
3
+ "version": "21.0.0-snapshot.42",
4
4
  "description": "An adapter for connecting to Mojaloop API enabled switches.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -68,7 +68,7 @@
68
68
  "@mojaloop/central-services-error-handling": "13.1.0",
69
69
  "@mojaloop/central-services-logger": "11.9.0",
70
70
  "@mojaloop/central-services-metrics": "12.6.0",
71
- "@mojaloop/central-services-shared": "18.26.2",
71
+ "@mojaloop/central-services-shared": "18.27.0",
72
72
  "@mojaloop/event-sdk": "14.5.1",
73
73
  "@mojaloop/logging-bc-client-lib": "0.5.8",
74
74
  "@mojaloop/ml-schema-transformer-lib": "2.7.1",
@@ -86,6 +86,7 @@
86
86
  "javascript-state-machine": "3.1.0",
87
87
  "js-yaml": "4.1.0",
88
88
  "json-schema-ref-parser": "9.0.9",
89
+ "knex": "3.1.0",
89
90
  "koa": "3.0.0",
90
91
  "koa-body": "6.0.1",
91
92
  "lodash": "4.17.21",
@@ -95,7 +96,7 @@
95
96
  "prom-client": "15.1.3",
96
97
  "promise-timeout": "1.3.0",
97
98
  "random-word-slugs": "0.1.7",
98
- "redis": "5.1.1",
99
+ "redis": "5.5.5",
99
100
  "uuidv4": "6.2.13",
100
101
  "ws": "8.18.2"
101
102
  },
@@ -67,7 +67,9 @@ paths:
67
67
  - ping
68
68
  operationId: handlePostPing
69
69
  requestBody:
70
- description: The object sent in the POST/PUT `/ping` requests with validation request ID.
70
+ description: >-
71
+ The object sent in the POST/PUT `/ping` requests with validation
72
+ request ID.
71
73
  required: true
72
74
  content:
73
75
  application/json:
@@ -26,7 +26,6 @@
26
26
  ******/
27
27
  const Koa = require('koa');
28
28
 
29
- const _ = require('lodash');
30
29
  const assert = require('assert').strict;
31
30
  const https = require('https');
32
31
  const http = require('http');
@@ -87,19 +86,6 @@ class InboundApi extends EventEmitter {
87
86
  return this._api.callback();
88
87
  }
89
88
 
90
- _updatePeerJwsKeys(peerJwsKeys) {
91
- // Security Risk only for testing purposes.
92
- this._logger && this._logger.isDebugEnabled && this._logger.debug('Old peer JWS keys:', Object.entries(this._jwsVerificationKeys).map(([k, v]) => [k, v.toString()]));
93
- this._logger && this._logger.isDebugEnabled && this._logger.debug('New peer JWS keys:', Object.entries(peerJwsKeys).map(([k, v]) => [k, v.toString()]));
94
- if (this._conf.pm4mlEnabled && !_.isEqual(this._jwsVerificationKeys, peerJwsKeys) &&
95
- this._jwsVerificationKeys && typeof this._jwsVerificationKeys === 'object') {
96
- this._logger && this._logger.isVerboseEnabled && this._logger.verbose('Clearing existing JWS verification keys');
97
- Object.keys(this._jwsVerificationKeys).forEach(key => delete this._jwsVerificationKeys[key]);
98
- this._logger && this._logger.isVerboseEnabled && this._logger.verbose('Assigning new peer JWS keys');
99
- Object.assign(this._jwsVerificationKeys, peerJwsKeys);
100
- }
101
- }
102
-
103
89
  _startJwsWatcher() {
104
90
  const FS_EVENT_TYPES = {
105
91
  CHANGE: 'change',
@@ -140,8 +140,36 @@ class Server extends EventEmitter {
140
140
  }
141
141
 
142
142
  _shouldUpdateInboundServer(newConf) {
143
- return !_.isEqual(this.conf.inbound, newConf.inbound)
144
- || !_.isEqual(this.conf.outbound, newConf.outbound);
143
+ const isInboundDifferent = !_.isEqual(this.conf.inbound, newConf.inbound);
144
+ const isOutboundDifferent = !_.isEqual(this.conf.outbound, newConf.outbound);
145
+
146
+ if (isInboundDifferent) {
147
+ this.logger.debug('Inbound config is different', {
148
+ oldInbound: this.conf.inbound,
149
+ newInbound: newConf.inbound
150
+ });
151
+ }
152
+ if (isOutboundDifferent) {
153
+ this.logger.debug('Outbound config is different (checked in inbound update)', {
154
+ oldOutbound: this.conf.outbound,
155
+ newOutbound: newConf.outbound
156
+ });
157
+ }
158
+
159
+ return isInboundDifferent || isOutboundDifferent;
160
+ }
161
+
162
+ _shouldUpdateOutboundServer(newConf) {
163
+ const isOutboundDifferent = !_.isEqual(this.conf.outbound, newConf.outbound);
164
+
165
+ if (isOutboundDifferent) {
166
+ this.logger.debug('Outbound config is different', {
167
+ oldOutbound: this.conf.outbound,
168
+ newOutbound: newConf.outbound
169
+ });
170
+ }
171
+
172
+ return isOutboundDifferent;
145
173
  }
146
174
 
147
175
  async start() {
@@ -247,10 +275,8 @@ class Server extends EventEmitter {
247
275
  restartActionsTaken.updateInboundServer = true;
248
276
  }
249
277
 
250
- this.inboundServer._api._updatePeerJwsKeys(newConf.peerJWSKeys);
251
-
252
278
  this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.outbound, newConf: newConf.outbound }).debug('Outbound server configuration');
253
- const updateOutboundServer = !_.isEqual(this.conf.outbound, newConf.outbound);
279
+ const updateOutboundServer = this._shouldUpdateOutboundServer(this.conf, newConf);
254
280
  if (updateOutboundServer) {
255
281
  await this.outboundServer.stop();
256
282
  this.outboundServer = new OutboundServer(
@@ -269,6 +295,20 @@ class Server extends EventEmitter {
269
295
  restartActionsTaken.updateOutboundServer = true;
270
296
  }
271
297
 
298
+ if(!_.isEqual(this.conf.jwsSigningKey, newConf.jwsSigningKey) ||
299
+ !_.isEqual(this.conf.peerJWSKeys, newConf.peerJWSKeys)) {
300
+ this.logger.isDebugEnabled && this.logger.push({
301
+ oldJwsSigningKey: this.conf.jwsSigningKey,
302
+ newJwsSigningKey: newConf.jwsSigningKey,
303
+ oldPeerJWSKeys: this.conf.peerJWSKeys,
304
+ newPeerJWSKeys: newConf.peerJWSKeys
305
+ }).debug('JWS signing key or peer JWS keys configuration changed');
306
+ this.outboundServer._conf.jwsSigningKey = newConf.jwsSigningKey;
307
+ this.outboundServer._conf.peerJWSKeys = newConf.peerJWSKeys;
308
+ this.inboundServer._conf.jwsSigningKey = newConf.jwsSigningKey;
309
+ this.inboundServer._conf.peerJWSKeys = newConf.peerJWSKeys;
310
+ }
311
+
272
312
  const updateFspiopEventHandler = !_.isEqual(this.conf.outbound, newConf.outbound)
273
313
  && this.conf.fspiopEventHandler.enabled;
274
314
  if (updateFspiopEventHandler) {
@@ -490,59 +490,5 @@ describe('Inbound Server', () => {
490
490
 
491
491
  expect(Jws.validator.__validationKeys['mock-jws'].toString()).toEqual('foo-key-updated');
492
492
  });
493
-
494
- it('should overwrite an existing peer JWS key when _updatePeerJwsKeys is called with the same key name', async () => {
495
- // Arrange
496
- const serverConfig = JSON.parse(JSON.stringify(defaultConfig));
497
- serverConfig.validateInboundJws = true;
498
- const cache = new Cache({
499
- cacheUrl: serverConfig.cacheUrl,
500
- logger: logger.push({ component: 'cache' }),
501
- unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs,
502
- });
503
- serverConfig.validateInboundJws = true;
504
- serverConfig.pm4mlEnabled = true;
505
- serverConfig.peerJWSKeys = {
506
- 'peer1': 'original-key'
507
- };
508
- const svr = new InboundServer(serverConfig, logger, cache);
509
-
510
- // Save reference before update
511
- const keysRef = svr._api._jwsVerificationKeys;
512
-
513
- // Act: Overwrite the key
514
- svr._api._updatePeerJwsKeys({ 'peer1': 'new-key' });
515
-
516
- // Assert
517
- expect(svr._api._jwsVerificationKeys['peer1']).toBe('new-key');
518
- expect(svr._api._jwsVerificationKeys).toBe(keysRef); // memory reference unchanged
519
- });
520
-
521
- it('should add a new peer JWS key when _updatePeerJwsKeys is called with a new key name', async () => {
522
- // Arrange
523
- const serverConfig = JSON.parse(JSON.stringify(defaultConfig));
524
- serverConfig.validateInboundJws = true;
525
- const cache = new Cache({
526
- cacheUrl: serverConfig.cacheUrl,
527
- logger: logger.push({ component: 'cache' }),
528
- unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs,
529
- });
530
- serverConfig.validateInboundJws = true;
531
- serverConfig.pm4mlEnabled = true;
532
- serverConfig.peerJWSKeys = {
533
- 'peer1': 'original-key'
534
- };
535
- const svr = new InboundServer(serverConfig, logger, cache);
536
-
537
- // Save reference before update
538
- const keysRef = svr._api._jwsVerificationKeys;
539
-
540
- // Act: Add a new key
541
- svr._api._updatePeerJwsKeys({ 'peer1': 'original-key', 'peer2': 'another-key' });
542
- // Assert
543
- expect(svr._api._jwsVerificationKeys['peer1']).toBe('original-key');
544
- expect(svr._api._jwsVerificationKeys['peer2']).toBe('another-key');
545
- expect(svr._api._jwsVerificationKeys).toBe(keysRef); // memory reference unchanged
546
- });
547
493
  });
548
494
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
3
- "version": "0.3.0-snapshot.36",
3
+ "version": "0.3.0-snapshot.39",
4
4
  "description": "Mojaloop sdk scheme adapter command event handler",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@mojaloop/api-snippets": "17.10.3",
45
- "@mojaloop/central-services-shared": "18.26.2",
45
+ "@mojaloop/central-services-shared": "18.27.0",
46
46
  "@mojaloop/logging-bc-client-lib": "0.5.8",
47
47
  "@mojaloop/logging-bc-public-types-lib": "0.5.5",
48
48
  "@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
@@ -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.1",
54
+ "redis": "5.5.5",
55
55
  "swagger-ui-express": "5.0.1",
56
56
  "yamljs": "0.3.0"
57
57
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
3
- "version": "0.3.0-snapshot.36",
3
+ "version": "0.3.0-snapshot.39",
4
4
  "description": "mojaloop sdk scheme adapter outbound domain event handler",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
@@ -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.1",
52
+ "redis": "5.5.5",
53
53
  "swagger-ui-express": "5.0.1",
54
54
  "yamljs": "0.3.0"
55
55
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
3
- "version": "0.4.0-snapshot.36",
3
+ "version": "0.4.0-snapshot.39",
4
4
  "description": "SDK Scheme Adapter private shared library.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
@@ -30,12 +30,12 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@mojaloop/api-snippets": "17.10.3",
33
- "@mojaloop/central-services-shared": "18.26.2",
33
+ "@mojaloop/central-services-shared": "18.27.0",
34
34
  "@mojaloop/logging-bc-public-types-lib": "0.5.5",
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.1",
38
+ "redis": "5.5.5",
39
39
  "uuid": "11.1.0"
40
40
  },
41
41
  "devDependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "24.9.8-snapshot.2",
3
+ "version": "24.9.8-snapshot.4",
4
4
  "description": "mojaloop sdk-scheme-adapter",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
@@ -77,7 +77,6 @@
77
77
  "wait-4-docker": "node ./scripts/_wait4_all.js"
78
78
  },
79
79
  "dependencies": {
80
- "@mojaloop/central-services-shared": "18.26.2",
81
80
  "nx": "16.5.0",
82
81
  "tslib": "2.8.1"
83
82
  },