@mojaloop/sdk-scheme-adapter 24.16.0 → 24.17.0-traceid.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.
Files changed (22) hide show
  1. package/.yarn/cache/{@typescript-eslint-eslint-plugin-npm-8.48.0-1ac1de2061-c9cd87c72d.zip → @typescript-eslint-eslint-plugin-npm-8.48.1-a09326c531-3ccf420805.zip} +0 -0
  2. package/.yarn/cache/{@typescript-eslint-parser-npm-8.48.0-d35c0e4145-5919642345.zip → @typescript-eslint-parser-npm-8.48.1-cf0a8b9c11-d8409c9ede.zip} +0 -0
  3. package/.yarn/cache/{@typescript-eslint-project-service-npm-8.48.0-5f7bff822d-5853a2f57b.zip → @typescript-eslint-project-service-npm-8.48.1-13c2e2d2dc-66ecc7ef95.zip} +0 -0
  4. package/.yarn/cache/{@typescript-eslint-scope-manager-npm-8.48.0-39d88ccf91-963af7af23.zip → @typescript-eslint-scope-manager-npm-8.48.1-7d633ba796-5040246220.zip} +0 -0
  5. package/.yarn/cache/{@typescript-eslint-tsconfig-utils-npm-8.48.0-7573843ebd-e480cd8049.zip → @typescript-eslint-tsconfig-utils-npm-8.48.1-702d6abc7f-830bcd0e76.zip} +0 -0
  6. package/.yarn/cache/{@typescript-eslint-type-utils-npm-8.48.0-544dc34636-dfda42624d.zip → @typescript-eslint-type-utils-npm-8.48.1-9718d9fe5e-6cf9370ac5.zip} +0 -0
  7. package/.yarn/cache/{@typescript-eslint-types-npm-8.48.0-f3b7599e59-cd14a7ecd1.zip → @typescript-eslint-types-npm-8.48.1-5e1312d710-1aa1e3f25b.zip} +0 -0
  8. package/.yarn/cache/{@typescript-eslint-typescript-estree-npm-8.48.0-2e1bfd8907-8ee6b9e98d.zip → @typescript-eslint-typescript-estree-npm-8.48.1-751b2295c1-485aa44d22.zip} +0 -0
  9. package/.yarn/cache/{@typescript-eslint-utils-npm-8.48.0-e33cb54739-980b9faeaa.zip → @typescript-eslint-utils-npm-8.48.1-aec1d5feca-34afe5cf78.zip} +0 -0
  10. package/.yarn/cache/{@typescript-eslint-visitor-keys-npm-8.48.0-2326c862a8-f9eaff8225.zip → @typescript-eslint-visitor-keys-npm-8.48.1-fb92338aa0-63aa165c57.zip} +0 -0
  11. package/.yarn/cache/{validator-npm-13.15.20-81be70a87b-498f9b201d.zip → validator-npm-13.15.23-617cdf95cc-03e4a37c04.zip} +0 -0
  12. package/.yarn/install-state.gz +0 -0
  13. package/.yarn/releases/{yarn-4.11.0.cjs → yarn-4.12.0.cjs} +191 -191
  14. package/.yarnrc.yml +1 -1
  15. package/modules/api-svc/src/OutboundServer/handlers.js +3 -3
  16. package/modules/api-svc/src/lib/model/OutboundTransfersModel.js +12 -4
  17. package/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js +1 -1
  18. package/modules/outbound-command-event-handler/package.json +2 -2
  19. package/modules/outbound-domain-event-handler/package.json +2 -2
  20. package/modules/private-shared-lib/package.json +2 -2
  21. package/package.json +4 -5
  22. package/{sbom-v24.15.3.csv → sbom-v24.16.0.csv} +101 -101
package/.yarnrc.yml CHANGED
@@ -4,4 +4,4 @@ enableGlobalCache: false
4
4
 
5
5
  nodeLinker: node-modules
6
6
 
7
- yarnPath: .yarn/releases/yarn-4.11.0.cjs
7
+ yarnPath: .yarn/releases/yarn-4.12.0.cjs
@@ -155,7 +155,7 @@ const postTransfers = async (ctx) => {
155
155
  const model = createOutboundTransfersModel(ctx);
156
156
 
157
157
  // initialize the transfer model and start it running
158
- await model.initialize(transferRequest);
158
+ await model.initialize(transferRequest, ctx.request.headers);
159
159
  const response = await model.run();
160
160
 
161
161
  // return the result
@@ -182,7 +182,7 @@ const getTransfers = async (ctx) => {
182
182
  const model = createOutboundTransfersModel(ctx);
183
183
 
184
184
  // initialize the transfer model and start it running
185
- await model.initialize(transferRequest);
185
+ await model.initialize(transferRequest, ctx.request.headers);
186
186
  const response = await model.run();
187
187
 
188
188
  // return the result
@@ -207,7 +207,7 @@ const putTransfers = async (ctx) => {
207
207
  // TODO: check the incoming body to reject party or quote when requested to do so
208
208
 
209
209
  // load the transfer model from cache and start it running again
210
- await model.load(ctx.state.path.params.transferId);
210
+ await model.load(ctx.state.path.params.transferId, ctx.request.headers);
211
211
 
212
212
  const response = await model.run(ctx.request.body);
213
213
 
@@ -253,9 +253,16 @@ class OutboundTransfersModel {
253
253
  *
254
254
  * @param data {object} - The inbound API POST /transfers request body
255
255
  */
256
- async initialize(data) {
256
+ async initialize(data, { traceparent, baggage} = {}) {
257
257
  this.data = data;
258
258
 
259
+ if (traceparent) {
260
+ this._traceFlags = traceparent.split('-').pop();
261
+ this.data.traceId = traceparent.split('-')[1];
262
+ }
263
+
264
+ this._baggage = baggage;
265
+
259
266
  // add a transferId if one is not present e.g. on first submission
260
267
  if(!this.data.hasOwnProperty('transferId')) {
261
268
  this.data.transferId = this._idGenerator();
@@ -1315,14 +1322,14 @@ class OutboundTransfersModel {
1315
1322
  *
1316
1323
  * @param transferId {string} - UUID transferId of the model to load from cache
1317
1324
  */
1318
- async load(transferId) {
1325
+ async load(transferId, headers) {
1319
1326
  try {
1320
1327
  const data = await this._cache.get(`transferModel_out_${transferId}`);
1321
1328
 
1322
1329
  if(!data) {
1323
1330
  throw new Error(`No cached data found for transferId: ${transferId}`);
1324
1331
  }
1325
- await this.initialize(data);
1332
+ await this.initialize(data, headers);
1326
1333
  this._logger.isDebugEnabled && this._logger.push({ cache: this.data }).debug('Transfer model loaded from cached state');
1327
1334
  }
1328
1335
  catch (err) {
@@ -1543,7 +1550,7 @@ class OutboundTransfersModel {
1543
1550
 
1544
1551
  #generateTraceId() {
1545
1552
  // todo: add possibility to generate traceId based on transferId
1546
- this.data.traceId = randomBytes(16).toString('hex');
1553
+ this.data.traceId ||= randomBytes(16).toString('hex');
1547
1554
  const { traceId, transferId } = this.data;
1548
1555
  this._logger.isInfoEnabled && this._logger.push({ traceId, transferId }).info('traceId is generated');
1549
1556
  return traceId;
@@ -1552,6 +1559,7 @@ class OutboundTransfersModel {
1552
1559
  #createOtelHeaders() {
1553
1560
  return Object.freeze({
1554
1561
  traceparent: generateTraceparent(this.data.traceId, this._traceFlags),
1562
+ ...this._baggage && { baggage: this._baggage },
1555
1563
  });
1556
1564
  }
1557
1565
  }
@@ -160,7 +160,7 @@ describe('OutboundTransfersModel Tests', () => {
160
160
  metricsClient,
161
161
  });
162
162
 
163
- await model.initialize(JSON.parse(JSON.stringify(transferRequest)));
163
+ await model.initialize(JSON.parse(JSON.stringify(transferRequest)), {traceparent: '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01', baggage: 'key1=val1,key2=val2'});
164
164
 
165
165
  let expectError;
166
166
  if (rejects.quoteResponse && delays.requestQuotes && expirySeconds < delays.requestQuotes) {
@@ -65,8 +65,8 @@
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.48.0",
69
- "@typescript-eslint/parser": "8.48.0",
68
+ "@typescript-eslint/eslint-plugin": "8.48.1",
69
+ "@typescript-eslint/parser": "8.48.1",
70
70
  "copyfiles": "2.4.1",
71
71
  "eslint": "9.15.0",
72
72
  "jest": "29.7.0",
@@ -62,8 +62,8 @@
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.48.0",
66
- "@typescript-eslint/parser": "8.48.0",
65
+ "@typescript-eslint/eslint-plugin": "8.48.1",
66
+ "@typescript-eslint/parser": "8.48.1",
67
67
  "copyfiles": "2.4.1",
68
68
  "eslint": "9.15.0",
69
69
  "jest": "29.7.0",
@@ -44,8 +44,8 @@
44
44
  "@eslint/compat": "2.0.0",
45
45
  "@types/node": "24.10.1",
46
46
  "@types/uuid": "10.0.0",
47
- "@typescript-eslint/eslint-plugin": "8.48.0",
48
- "@typescript-eslint/parser": "8.48.0",
47
+ "@typescript-eslint/eslint-plugin": "8.48.1",
48
+ "@typescript-eslint/parser": "8.48.1",
49
49
  "eslint": "9.15.0",
50
50
  "jest": "29.7.0",
51
51
  "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.16.0",
3
+ "version": "24.17.0-traceid.0",
4
4
  "description": "mojaloop sdk-scheme-adapter",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
@@ -18,7 +18,7 @@
18
18
  "Yevhen Kyriukha <yevhen.kyriukha@modusbox.com>",
19
19
  "Vijay Kumar Guthi <vijaya.guthi@modusbox.com>"
20
20
  ],
21
- "packageManager": "yarn@4.11.0",
21
+ "packageManager": "yarn@4.12.0",
22
22
  "engines": {
23
23
  "yarn": "3.2.0"
24
24
  },
@@ -85,8 +85,8 @@
85
85
  "@types/jest": "30.0.0",
86
86
  "@types/node": "24.10.1",
87
87
  "@types/node-cache": "4.2.5",
88
- "@typescript-eslint/eslint-plugin": "8.48.0",
89
- "@typescript-eslint/parser": "8.48.0",
88
+ "@typescript-eslint/eslint-plugin": "8.48.1",
89
+ "@typescript-eslint/parser": "8.48.1",
90
90
  "audit-ci": "7.1.0",
91
91
  "eslint": "9.15.0",
92
92
  "eslint-config-airbnb-typescript": "18.0.0",
@@ -140,7 +140,6 @@
140
140
  "shins/express": "4.19.2",
141
141
  "serve-static/send": "0.19.0",
142
142
  "tar": "7.5.2",
143
- "validator": "13.15.20",
144
143
  "widdershins/yargs-parser": "13.1.2",
145
144
  "widdershins/markdown-it": "12.3.2",
146
145
  "widdershins/swagger2openapi": "7.0.8",