@mojaloop/sdk-scheme-adapter 13.0.2 → 14.0.0

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.
@@ -64,7 +64,7 @@ executors:
64
64
  default-docker:
65
65
  working_directory: /home/circleci/project
66
66
  docker:
67
- - image: node:16-alpine
67
+ - image: node:16.15.0-alpine
68
68
 
69
69
  default-machine:
70
70
  machine:
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v16.14
1
+ v16.15.0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,29 @@
1
1
  # Changelog: [mojaloop/thirdparty-api-svc](https://github.com/mojaloop/thirdparty-api-svc)
2
+ ## [14.0.0](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.4...v14.0.0) (2022-05-19)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * bump nodejs version and update central services (#319)
8
+
9
+ ### Features
10
+
11
+ * bump nodejs version and update central services ([#319](https://github.com/mojaloop/sdk-scheme-adapter/issues/319)) ([ee5a6da](https://github.com/mojaloop/sdk-scheme-adapter/commit/ee5a6da0650aa186114755c88889c441da6dfe8a))
12
+
13
+ ### [13.0.4](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.3...v13.0.4) (2022-05-13)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * reformat error information response ([#318](https://github.com/mojaloop/sdk-scheme-adapter/issues/318)) ([ed844b1](https://github.com/mojaloop/sdk-scheme-adapter/commit/ed844b1d2da6c58d3c61622c07c326bda3ca3b86))
19
+
20
+ ### [13.0.3](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.2...v13.0.3) (2022-05-12)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * correct party outbound response ([#317](https://github.com/mojaloop/sdk-scheme-adapter/issues/317)) ([752e8b4](https://github.com/mojaloop/sdk-scheme-adapter/commit/752e8b4d315a6e9c3b8ad4ff1b65761c41e3d721))
26
+
2
27
  ### [13.0.2](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.1...v13.0.2) (2022-05-12)
3
28
 
4
29
 
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM node:16-alpine as builder
1
+ FROM node:16.15.0-alpine as builder
2
2
 
3
3
  RUN apk add --no-cache git python3 build-base
4
4
 
@@ -12,7 +12,7 @@ WORKDIR /src
12
12
  COPY ./package.json .
13
13
  COPY ./package-lock.json .
14
14
  RUN npm ci --only=production
15
- FROM node:16-alpine
15
+ FROM node:16.15.0-alpine
16
16
 
17
17
  ARG BUILD_DATE
18
18
  ARG VCS_URL
@@ -417,8 +417,8 @@
417
417
  },
418
418
  "1070030|@mojaloop/central-services-shared>widdershins>markdown-it": {
419
419
  "decision": "ignore",
420
- "madeAt": 1650460940438,
421
- "expiresAt": 1653052932045
420
+ "madeAt": 1652982823332,
421
+ "expiresAt": 1655574816261
422
422
  },
423
423
  "1070030|@mojaloop/central-services-shared>shins>markdown-it": {
424
424
  "decision": "ignore",
@@ -504,8 +504,38 @@
504
504
  "decision": "ignore",
505
505
  "madeAt": 1651249549067,
506
506
  "expiresAt": 1653841542147
507
+ },
508
+ "1068155|@mojaloop/central-services-shared>shins>markdown-it>sanitize-html": {
509
+ "decision": "ignore",
510
+ "madeAt": 1652981366297,
511
+ "expiresAt": 1655573359219
512
+ },
513
+ "1070260|@mojaloop/central-services-shared>shins>markdown-it>sanitize-html": {
514
+ "decision": "ignore",
515
+ "madeAt": 1652981367363,
516
+ "expiresAt": 1655573359219
517
+ },
518
+ "1070030|shins>markdown-it": {
519
+ "decision": "ignore",
520
+ "madeAt": 1652982823332,
521
+ "expiresAt": 1655574816261
522
+ },
523
+ "1068310|@mojaloop/central-services-shared>widdershins>markdown-it>yargs>yargs-parser": {
524
+ "decision": "ignore",
525
+ "madeAt": 1652982824567,
526
+ "expiresAt": 1655574816261
527
+ },
528
+ "1068155|shins>markdown-it>sanitize-html": {
529
+ "decision": "ignore",
530
+ "madeAt": 1652982826025,
531
+ "expiresAt": 1655574816261
532
+ },
533
+ "1070260|shins>markdown-it>sanitize-html": {
534
+ "decision": "ignore",
535
+ "madeAt": 1652982827137,
536
+ "expiresAt": 1655574816261
507
537
  }
508
538
  },
509
539
  "rules": {},
510
540
  "version": 1
511
- }
541
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "13.0.2",
3
+ "version": "14.0.0",
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",
@@ -54,15 +54,9 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@koa/cors": "^3.1.0",
57
- "@mojaloop/central-services-error-handling": "11.3.0",
58
- "@mojaloop/central-services-health": "13.0.0",
59
- "@mojaloop/central-services-logger": "10.6.1",
60
- "@mojaloop/central-services-metrics": "11.0.0",
61
- "@mojaloop/central-services-shared": "14.0.0",
62
- "@mojaloop/event-sdk": "10.7.1",
63
- "@mojaloop/sdk-standard-components": "^16.0.0",
64
- "ajv": "8.6.3",
65
- "ajv-keywords": "5.0.0",
57
+ "@mojaloop/central-services-shared": "17.0.2",
58
+ "@mojaloop/sdk-standard-components": "^17.0.1",
59
+ "ajv": "8.11.0",
66
60
  "axios": "^0.21.4",
67
61
  "co-body": "^6.1.0",
68
62
  "dotenv": "^10.0.0",
@@ -162,8 +162,8 @@ class OutboundBulkQuotesModel {
162
162
  }
163
163
  }
164
164
  } else if (message.type === 'bulkQuoteResponseError') {
165
- error = new BackendError(`Got an error response requesting bulk quote: ${util.inspect(message.data, { depth: Infinity })}`, 500);
166
- error.mojaloopError = message.data;
165
+ error = new BackendError(`Got an error response requesting bulk quote: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
166
+ error.mojaloopError = message.data.body;
167
167
  }
168
168
  else {
169
169
  this._logger.push({ message }).log(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Unknown message type ${message.type}.`);
@@ -297,8 +297,8 @@ class OutboundBulkQuotesModel {
297
297
  let message = JSON.parse(msg);
298
298
 
299
299
  if (message.type === 'bulkQuoteError') {
300
- error = new BackendError(`Got an error response retrieving bulk quote: ${util.inspect(message.data, { depth: Infinity })}`, 500);
301
- error.mojaloopError = message.data;
300
+ error = new BackendError(`Got an error response retrieving bulk quote: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
301
+ error.mojaloopError = message.data.body;
302
302
  } else if (message.type !== 'bulkQuoteResponse') {
303
303
  this._logger.push({ message }).log(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Uknokwn message type ${message.type}.`);
304
304
  return;
@@ -161,8 +161,8 @@ class OutboundBulkTransfersModel {
161
161
  }
162
162
  }
163
163
  } else if (message.type === 'bulkTransferError') {
164
- error = new BackendError(`Got an error response preparing bulk transfer: ${util.inspect(message.data, { depth: Infinity })}`, 500);
165
- error.mojaloopError = message.data;
164
+ error = new BackendError(`Got an error response preparing bulk transfer: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
165
+ error.mojaloopError = message.data.body;
166
166
  }
167
167
  else {
168
168
  this._logger.push({ message }).log(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Unknown message type ${message.type}.`);
@@ -289,8 +289,8 @@ class OutboundBulkTransfersModel {
289
289
  let message = JSON.parse(msg);
290
290
 
291
291
  if (message.type === 'bulkTransferError') {
292
- error = new BackendError(`Got an error response retrieving bulk transfer: ${util.inspect(message.data, { depth: Infinity })}`, 500);
293
- error.mojaloopError = message.data;
292
+ error = new BackendError(`Got an error response retrieving bulk transfer: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
293
+ error.mojaloopError = message.data.body;
294
294
  } else if (message.type !== 'bulkTransferFulfil') {
295
295
  this._logger.push({ message }).log(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Uknokwn message type ${message.type}.`);
296
296
  return;
@@ -267,11 +267,10 @@ class OutboundRequestToPayTransferModel {
267
267
  const subId = await this._cache.subscribe(payeeKey, (cn, msg, subId) => {
268
268
  try {
269
269
  let payee = JSON.parse(msg);
270
-
271
- if(payee.errorInformation) {
270
+ if(payee.body && payee.body.errorInformation) {
272
271
  // this is an error response to our GET /parties request
273
- const err = new BackendError(`Got an error response resolving party: ${util.inspect(payee)}`, 500);
274
- err.mojaloopError = payee;
272
+ const err = new BackendError(`Got an error response resolving party: ${util.inspect(payee.body)}`, 500);
273
+ err.mojaloopError = payee.body;
275
274
 
276
275
  // cancel the timeout handler
277
276
  clearTimeout(timeout);
@@ -405,8 +404,8 @@ class OutboundRequestToPayTransferModel {
405
404
  }
406
405
  }
407
406
  } else if (message.type === 'quoteResponseError') {
408
- error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data)}`, 500);
409
- error.mojaloopError = message.data;
407
+ error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data.body)}`, 500);
408
+ error.mojaloopError = message.data.body;
410
409
  }
411
410
  else {
412
411
  this._logger.push({ message }).log(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`);
@@ -620,8 +619,8 @@ class OutboundRequestToPayTransferModel {
620
619
  }
621
620
  }
622
621
  } else if (message.type === 'transferError') {
623
- error = new BackendError(`Got an error response preparing transfer: ${util.inspect(message.data)}`, 500);
624
- error.mojaloopError = message.data;
622
+ error = new BackendError(`Got an error response preparing transfer: ${util.inspect(message.data.body)}`, 500);
623
+ error.mojaloopError = message.data.body;
625
624
  } else {
626
625
  this._logger.push({ message }).log(`Ignoring cache notification for transfer ${transferKey}. Uknokwn message type ${message.type}.`);
627
626
  return;
@@ -701,8 +700,8 @@ class OutboundRequestToPayTransferModel {
701
700
  let message = JSON.parse(msg);
702
701
 
703
702
  if (message.type === 'transferError') {
704
- error = new BackendError(`Got an error response retrieving transfer: ${util.inspect(message.data)}`, 500);
705
- error.mojaloopError = message.data;
703
+ error = new BackendError(`Got an error response retrieving transfer: ${util.inspect(message.data.body)}`, 500);
704
+ error.mojaloopError = message.data.body;
706
705
  } else if (message.type !== 'transferFulfil') {
707
706
  this._logger.push({ message }).log(`Ignoring cache notification for transfer ${transferKey}. Uknokwn message type ${message.type}.`);
708
707
  return;
@@ -497,8 +497,8 @@ class OutboundTransfersModel {
497
497
  }
498
498
  }
499
499
  } else if (message.type === 'quoteResponseError') {
500
- error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data, { depth: Infinity })}`, 500);
501
- error.mojaloopError = message.data;
500
+ error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
501
+ error.mojaloopError = message.data.body;
502
502
  }
503
503
  else {
504
504
  this._logger.push({ message }).log(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`);
@@ -66,7 +66,10 @@ function argsValidation({ type, id, subId }) {
66
66
  */
67
67
  function reformatMessage(message) {
68
68
  return {
69
- party: { ...message }
69
+ party: {
70
+ body: { ...message.body.party },
71
+ headers: { ...message.headers }
72
+ }
70
73
  };
71
74
  }
72
75
 
@@ -207,10 +207,13 @@ describe('OutboundBulkQuotesModel', () => {
207
207
  const expectError = {
208
208
  type: 'bulkQuoteResponseError',
209
209
  data: {
210
- errorInformation: {
211
- errorCode: '3205',
212
- errorDescription: 'Bulk quote ID not found'
213
- }
210
+ body: {
211
+ errorInformation: {
212
+ errorCode: '3205',
213
+ errorDescription: 'Bulk quote ID not found'
214
+ }
215
+ },
216
+ headers: {}
214
217
  }
215
218
  };
216
219
 
@@ -239,7 +242,7 @@ describe('OutboundBulkQuotesModel', () => {
239
242
  expect(err.message.replace(/[ \n]/g,'')).toEqual(errMsg.replace(/[ \n]/g,''));
240
243
  expect(err.bulkQuoteState).toBeTruthy();
241
244
  expect(err.bulkQuoteState.lastError).toBeTruthy();
242
- expect(err.bulkQuoteState.lastError.mojaloopError).toEqual(expectError.data);
245
+ expect(err.bulkQuoteState.lastError.mojaloopError).toEqual(expectError.data.body);
243
246
  expect(err.bulkQuoteState.lastError.bulkQuoteState).toBe(undefined);
244
247
  return;
245
248
  }
@@ -202,10 +202,13 @@ describe('outboundBulkTransferModel', () => {
202
202
  const expectError = {
203
203
  type: 'bulkTransferError',
204
204
  data: {
205
- errorInformation: {
206
- errorCode: '4001',
207
- errorDescription: 'Payer FSP insufficient liquidity'
208
- }
205
+ body: {
206
+ errorInformation: {
207
+ errorCode: '4001',
208
+ errorDescription: 'Payer FSP insufficient liquidity'
209
+ }
210
+ },
211
+ headers: {}
209
212
  }
210
213
  };
211
214
 
@@ -234,7 +237,7 @@ describe('outboundBulkTransferModel', () => {
234
237
  expect(err.message.replace(/[ \n]/g,'')).toEqual(errMsg.replace(/[ \n]/g,''));
235
238
  expect(err.bulkTransferState).toBeTruthy();
236
239
  expect(err.bulkTransferState.lastError).toBeTruthy();
237
- expect(err.bulkTransferState.lastError.mojaloopError).toEqual(expectError.data);
240
+ expect(err.bulkTransferState.lastError.mojaloopError).toEqual(expectError.data.body);
238
241
  expect(err.bulkTransferState.lastError.bulkTransferState).toBe(undefined);
239
242
  return;
240
243
  }
@@ -1390,10 +1390,13 @@ describe('outboundModel', () => {
1390
1390
  const expectError = {
1391
1391
  type: 'quoteResponseError',
1392
1392
  data: {
1393
- errorInformation: {
1394
- errorCode: '3205',
1395
- errorDescription: 'Quote ID not found'
1396
- }
1393
+ body: {
1394
+ errorInformation: {
1395
+ errorCode: '3205',
1396
+ errorDescription: 'Quote ID not found'
1397
+ }
1398
+ },
1399
+ headers: {}
1397
1400
  }
1398
1401
  };
1399
1402
 
@@ -1430,7 +1433,7 @@ describe('outboundModel', () => {
1430
1433
  expect(err.message.replace(/[ \n]/g,'')).toEqual(errMsg.replace(/[ \n]/g,''));
1431
1434
  expect(err.transferState).toBeTruthy();
1432
1435
  expect(err.transferState.lastError).toBeTruthy();
1433
- expect(err.transferState.lastError.mojaloopError).toEqual(expectError.data);
1436
+ expect(err.transferState.lastError.mojaloopError).toEqual(expectError.data.body);
1434
1437
  expect(err.transferState.lastError.transferState).toBe(undefined);
1435
1438
  return;
1436
1439
  }
@@ -178,7 +178,10 @@ describe('PartiesModel', () => {
178
178
 
179
179
  // check that this.context.data is updated
180
180
  expect(model.context.data).toEqual({
181
- party: { ...message },
181
+ party: {
182
+ body: { ...message.body.party },
183
+ headers: { ...message.headers }
184
+ },
182
185
  // current state will be updated by onAfterTransition which isn't called
183
186
  // when manual invocation of transition handler happens
184
187
  currentState: 'start'