@mojaloop/sdk-scheme-adapter 24.10.0-snapshot.0 → 24.10.1

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.
Binary file
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # Changelog: [mojaloop/sdk-scheme-adapter](https://github.com/mojaloop/sdk-scheme-adapter)
2
+ ### [24.10.1](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.10.0...v24.10.1) (2025-06-09)
3
+
4
+
5
+ ### Chore
6
+
7
+ * **csi-1494:** more restarting logic ([#587](https://github.com/mojaloop/sdk-scheme-adapter/issues/587)) ([fcaa375](https://github.com/mojaloop/sdk-scheme-adapter/commit/fcaa3753ccb974669f1814d2cd7ca031305b8e8f))
8
+
2
9
  ## [24.10.0](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.9.7...v24.10.0) (2025-06-05)
3
10
 
4
11
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-api-svc",
3
- "version": "21.0.0-snapshot.50",
3
+ "version": "21.0.0-snapshot.49",
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",
@@ -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",
@@ -142,6 +142,8 @@ class Server extends EventEmitter {
142
142
  _shouldUpdateInboundServer(newConf) {
143
143
  const isInboundDifferent = !_.isEqual(this.conf.inbound, newConf.inbound);
144
144
  const isOutboundDifferent = !_.isEqual(this.conf.outbound, newConf.outbound);
145
+ const isPeerJWSKeysDifferent = !_.isEqual(this.conf.peerJWSKeys, newConf.peerJWSKeys);
146
+ const isJwsSigningKeyDifferent = !_.isEqual(this.conf.jwsSigningKey, newConf.jwsSigningKey);
145
147
 
146
148
  if (isInboundDifferent) {
147
149
  this.logger.debug('Inbound config is different', {
@@ -156,11 +158,26 @@ class Server extends EventEmitter {
156
158
  });
157
159
  }
158
160
 
159
- return isInboundDifferent || isOutboundDifferent;
161
+ if (isPeerJWSKeysDifferent) {
162
+ this.logger.debug('Peer JWS Keys config is different', {
163
+ oldPeerJWSKeys: this.conf.peerJWSKeys,
164
+ newPeerJWSKeys: newConf.peerJWSKeys
165
+ });
166
+ }
167
+
168
+ if (isJwsSigningKeyDifferent) {
169
+ this.logger.debug('JWS Signing Key config is different', {
170
+ oldJwsSigningKey: this.conf.jwsSigningKey,
171
+ newJwsSigningKey: newConf.jwsSigningKey
172
+ });
173
+ }
174
+
175
+ return isInboundDifferent || isOutboundDifferent || isPeerJWSKeysDifferent || isJwsSigningKeyDifferent;
160
176
  }
161
177
 
162
178
  _shouldUpdateOutboundServer(newConf) {
163
179
  const isOutboundDifferent = !_.isEqual(this.conf.outbound, newConf.outbound);
180
+ const isJwsSigningKeyDifferent = !_.isEqual(this.conf.jwsSigningKey, newConf.jwsSigningKey);
164
181
 
165
182
  if (isOutboundDifferent) {
166
183
  this.logger.debug('Outbound config is different', {
@@ -169,29 +186,14 @@ class Server extends EventEmitter {
169
186
  });
170
187
  }
171
188
 
172
- return isOutboundDifferent;
173
- }
174
-
175
- _shouldUpdatePeerJWSKeys(newConf) {
176
- const isPeerJWSKeysDifferent = !_.isEqual(this.conf.peerJWSKeys, newConf.peerJWSKeys);
177
- if (isPeerJWSKeysDifferent) {
178
- this.logger.debug('Peer JWS Keys config is different', {
179
- oldPeerJWSKeys: this.conf.peerJWSKeys,
180
- newPeerJWSKeys: newConf.peerJWSKeys
181
- });
182
- }
183
- return isPeerJWSKeysDifferent;
184
- }
185
-
186
- _shouldUpdateJwsSigningKey(newConf) {
187
- const isJwsSigningKeyDifferent = !_.isEqual(this.conf.jwsSigningKey, newConf.jwsSigningKey);
188
189
  if (isJwsSigningKeyDifferent) {
189
190
  this.logger.debug('JWS Signing Key config is different', {
190
191
  oldJwsSigningKey: this.conf.jwsSigningKey,
191
192
  newJwsSigningKey: newConf.jwsSigningKey
192
193
  });
193
194
  }
194
- return isJwsSigningKeyDifferent;
195
+
196
+ return isOutboundDifferent || isJwsSigningKeyDifferent;
195
197
  }
196
198
 
197
199
  async start() {
@@ -281,6 +283,9 @@ class Server extends EventEmitter {
281
283
  this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.inbound, newConf: newConf.inbound }).debug('Inbound server configuration');
282
284
  const updateInboundServer = this._shouldUpdateInboundServer(newConf);
283
285
  if (updateInboundServer) {
286
+ const stopStartLabel = 'InboundServer stop/start duration';
287
+ // eslint-disable-next-line no-console
288
+ console.time(stopStartLabel);
284
289
  await this.inboundServer.stop();
285
290
  this.inboundServer = new InboundServer(
286
291
  newConf,
@@ -294,12 +299,17 @@ class Server extends EventEmitter {
294
299
  this.emit('error', errMessage);
295
300
  });
296
301
  await this.inboundServer.start();
302
+ // eslint-disable-next-line no-console
303
+ console.timeEnd(stopStartLabel);
297
304
  restartActionsTaken.updateInboundServer = true;
298
305
  }
299
306
 
300
307
  this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.outbound, newConf: newConf.outbound }).debug('Outbound server configuration');
301
308
  const updateOutboundServer = this._shouldUpdateOutboundServer(newConf);
302
309
  if (updateOutboundServer) {
310
+ const stopStartLabel = 'OutboundServer stop/start duration';
311
+ // eslint-disable-next-line no-console
312
+ console.time(stopStartLabel);
303
313
  await this.outboundServer.stop();
304
314
  this.outboundServer = new OutboundServer(
305
315
  newConf,
@@ -314,22 +324,11 @@ class Server extends EventEmitter {
314
324
  this.emit('error', errMessage);
315
325
  });
316
326
  await this.outboundServer.start();
327
+ // eslint-disable-next-line no-console
328
+ console.timeEnd(stopStartLabel);
317
329
  restartActionsTaken.updateOutboundServer = true;
318
330
  }
319
331
 
320
- const updatePeerJWSKeys = this._shouldUpdatePeerJWSKeys(newConf);
321
- if (updatePeerJWSKeys) {
322
- Object.keys(this.conf.peerJWSKeys).forEach(key => { delete this.conf.peerJWSKeys[key]; });
323
- Object.assign(this.conf.peerJWSKeys, _.cloneDeep(newConf.peerJWSKeys));
324
- restartActionsTaken.updatePeerJWSKeys = true;
325
- }
326
-
327
- const updateJwsSigningKey = this._shouldUpdateJwsSigningKey(newConf);
328
- if (updateJwsSigningKey) {
329
- this.conf.jwsSigningKey = newConf.jwsSigningKey;
330
- restartActionsTaken.updateJwsSigningKey = true;
331
- }
332
-
333
332
  const updateFspiopEventHandler = !_.isEqual(this.conf.outbound, newConf.outbound)
334
333
  && this.conf.fspiopEventHandler.enabled;
335
334
  if (updateFspiopEventHandler) {
@@ -123,37 +123,5 @@ describe('Server', () => {
123
123
  await new Promise((wait) => setTimeout(wait, 1000));
124
124
  expect(server.restart).toHaveBeenCalledWith(newConfOutbound);
125
125
  });
126
-
127
- it('restarts when peerJWSKeys is different', async () => {
128
- const newConfPeerJWSKeys = JSON.parse(JSON.stringify(conf));
129
- newConfPeerJWSKeys.peerJWSKeys = { ...conf.peerJWSKeys, newKey: 'newValue' };
130
-
131
- expect(server._shouldUpdatePeerJWSKeys(newConfPeerJWSKeys)).toBe(true);
132
-
133
- controlServer.broadcastConfigChange(newConfPeerJWSKeys);
134
- await new Promise((wait) => setTimeout(wait, 1000));
135
- expect(server.restart).toHaveBeenCalledWith(newConfPeerJWSKeys);
136
- });
137
-
138
- it('does not update when peerJWSKeys is the same', async () => {
139
- const newConfPeerJWSKeys = JSON.parse(JSON.stringify(conf));
140
- expect(server._shouldUpdatePeerJWSKeys(newConfPeerJWSKeys)).toBe(false);
141
- });
142
-
143
- it('restarts when jwsSigningKey is different', async () => {
144
- const newConfJwsSigningKey = JSON.parse(JSON.stringify(conf));
145
- newConfJwsSigningKey.jwsSigningKey = { ...conf.jwsSigningKey, key: 'differentKey' };
146
-
147
- expect(server._shouldUpdateJwsSigningKey(newConfJwsSigningKey)).toBe(true);
148
-
149
- controlServer.broadcastConfigChange(newConfJwsSigningKey);
150
- await new Promise((wait) => setTimeout(wait, 1000));
151
- expect(server.restart).toHaveBeenCalledWith(newConfJwsSigningKey);
152
- });
153
-
154
- it('does not update when jwsSigningKey is the same', async () => {
155
- const newConfJwsSigningKey = JSON.parse(JSON.stringify(conf));
156
- expect(server._shouldUpdateJwsSigningKey(newConfJwsSigningKey)).toBe(false);
157
- });
158
126
  });
159
127
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
3
- "version": "0.3.0-snapshot.47",
3
+ "version": "0.3.0-snapshot.46",
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/",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
3
- "version": "0.3.0-snapshot.47",
3
+ "version": "0.3.0-snapshot.46",
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/",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
3
- "version": "0.4.0-snapshot.47",
3
+ "version": "0.4.0-snapshot.46",
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "24.10.0-snapshot.0",
3
+ "version": "24.10.1",
4
4
  "description": "mojaloop sdk-scheme-adapter",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter",