@devrev/ts-adaas 1.19.2 → 1.19.4-beta.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.
@@ -470,4 +470,50 @@ describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
470
470
  expect(endTime - startTime).toBeLessThan(250);
471
471
  });
472
472
  });
473
+ describe('log context attribution', () => {
474
+ it('should emit SDK-generated logs from pool (Starting download message)', async () => {
475
+ const logSpy = jest.spyOn(console, 'log');
476
+ mockAdapter.processAttachment.mockResolvedValue({});
477
+ const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
478
+ adapter: mockAdapter,
479
+ attachments: mockAttachments.slice(0, 1),
480
+ stream: mockStream,
481
+ });
482
+ // Call streamAll - it should log "Starting download of N attachments..."
483
+ await pool.streamAll();
484
+ // Verify the SDK-generated "Starting download" message was logged
485
+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Starting download of 1 attachments'));
486
+ });
487
+ it('should process user stream callback correctly while maintaining context isolation', async () => {
488
+ let userCallbackExecuted = false;
489
+ // Mock stream to capture context info
490
+ const mockStreamFn = jest
491
+ .fn()
492
+ .mockImplementation(async () => {
493
+ userCallbackExecuted = true;
494
+ // Record that the callback executed
495
+ return Promise.resolve({
496
+ httpStream: undefined,
497
+ error: undefined,
498
+ });
499
+ });
500
+ mockAdapter.processAttachment.mockImplementation(async (attachment, stream) => {
501
+ // processAttachment should be called with the user's stream function
502
+ const result = await stream({
503
+ item: attachment,
504
+ event: {},
505
+ });
506
+ return result;
507
+ });
508
+ const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
509
+ adapter: mockAdapter,
510
+ attachments: mockAttachments.slice(0, 1),
511
+ stream: mockStreamFn,
512
+ });
513
+ await pool.streamAll();
514
+ // Verify the user callback was executed
515
+ expect(userCallbackExecuted).toBe(true);
516
+ expect(mockStreamFn).toHaveBeenCalled();
517
+ });
518
+ });
473
519
  });
@@ -1 +1 @@
1
- {"version":3,"file":"axios-client.d.ts","sourceRoot":"","sources":["../../src/http/axios-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,QAAA,MAAM,WAAW,+BAAiB,CAAC;AAiCnC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"axios-client.d.ts","sourceRoot":"","sources":["../../src/http/axios-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,QAAA,MAAM,WAAW,+BAAiB,CAAC;AAuCnC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC"}
@@ -30,15 +30,18 @@ exports.axiosClient = exports.axios = void 0;
30
30
  const axios_1 = __importDefault(require("axios"));
31
31
  exports.axios = axios_1.default;
32
32
  const axios_retry_1 = __importDefault(require("axios-retry"));
33
+ const logger_context_1 = require("../logger/logger.context");
33
34
  const axiosClient = axios_1.default.create();
34
35
  exports.axiosClient = axiosClient;
35
36
  (0, axios_retry_1.default)(axiosClient, {
36
37
  retries: 5,
37
38
  retryDelay: (retryCount, error) => {
38
- var _a, _b, _c;
39
39
  // exponential backoff algorithm: 1 * 2 ^ retryCount * 1000ms
40
40
  const delay = axios_retry_1.default.exponentialDelay(retryCount, error, 1000);
41
- console.warn(`Request to ${(_a = error.config) === null || _a === void 0 ? void 0 : _a.url} failed with response status code ${(_b = error.response) === null || _b === void 0 ? void 0 : _b.status}. Method ${(_c = error.config) === null || _c === void 0 ? void 0 : _c.method}. Retry count: ${retryCount}. Retrying in ${Math.round(delay / 1000)}s.`);
41
+ (0, logger_context_1.runWithUserLogContext)(() => {
42
+ var _a, _b, _c;
43
+ return console.warn(`Request to ${(_a = error.config) === null || _a === void 0 ? void 0 : _a.url} failed with response status code ${(_b = error.response) === null || _b === void 0 ? void 0 : _b.status}. Method ${(_c = error.config) === null || _c === void 0 ? void 0 : _c.method}. Retry count: ${retryCount}. Retrying in ${Math.round(delay / 1000)}s.`);
44
+ });
42
45
  return delay;
43
46
  },
44
47
  retryCondition: (error) => {
@@ -52,6 +55,6 @@ exports.axiosClient = axiosClient;
52
55
  (_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? true : delete _b.authorization;
53
56
  (_d = (_c = error.config) === null || _c === void 0 ? void 0 : _c.headers) === null || _d === void 0 ? true : delete _d.Authorization;
54
57
  delete error.request._header;
55
- console.warn('Max retry times exceeded. Error', error);
58
+ (0, logger_context_1.runWithUserLogContext)(() => console.warn('Max retry times exceeded. Error', error));
56
59
  },
57
60
  });
@@ -1 +1 @@
1
- {"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,WAAW,CAAC,cAAc,EAAE,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,QA4DtC"}
1
+ {"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,WAAW,CAAC,cAAc,EAAE,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,QA8DtC"}
@@ -48,13 +48,15 @@ function processTask({ task, onTimeout, }) {
48
48
  process.exit(0);
49
49
  }
50
50
  catch (error) {
51
- const errorMessage = `Error while processing task. ${(0, logger_1.serializeError)(error)}`;
52
- console.error(errorMessage);
53
- node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.postMessage({
54
- subject: workers_1.WorkerMessageSubject.WorkerMessageFailed,
55
- payload: { message: errorMessage },
51
+ (0, logger_context_1.runWithUserLogContext)(() => {
52
+ const errorMessage = `Error while processing task. ${(0, logger_1.serializeError)(error)}`;
53
+ console.error(errorMessage);
54
+ node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.postMessage({
55
+ subject: workers_1.WorkerMessageSubject.WorkerMessageFailed,
56
+ payload: { message: errorMessage },
57
+ });
58
+ process.exit(1);
56
59
  });
57
- process.exit(1);
58
60
  }
59
61
  });
60
62
  })();
@@ -196,7 +196,7 @@ class Spawn {
196
196
  if ((message === null || message === void 0 ? void 0 : message.subject) === workers_1.WorkerMessageSubject.WorkerMessageLog) {
197
197
  const stringifiedArgs = (_a = message.payload) === null || _a === void 0 ? void 0 : _a.stringifiedArgs;
198
198
  const level = (_b = message.payload) === null || _b === void 0 ? void 0 : _b.level;
199
- const isSdkLog = (_d = (_c = message.payload) === null || _c === void 0 ? void 0 : _c.isSdkLog) !== null && _d !== void 0 ? _d : false;
199
+ const isSdkLog = (_d = (_c = message.payload) === null || _c === void 0 ? void 0 : _c.isSdkLog) !== null && _d !== void 0 ? _d : true;
200
200
  this.logger.logFn(stringifiedArgs, level, isSdkLog);
201
201
  }
202
202
  // If worker sends a message that it has emitted an event, then set alreadyEmitted to true.
@@ -1 +1 @@
1
- {"version":3,"file":"worker-adapter.d.ts","sourceRoot":"","sources":["../../../src/multithreading/worker-adapter/worker-adapter.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,SAAS,EAET,kCAAkC,EAClC,yCAAyC,EACzC,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,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CAAC;KACjE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqD7B;;;;;;OAMG;IACG,iBAAiB,CAAC,QAAQ,EAAE,EAChC,MAAM,EACN,UAAU,EACV,SAAa,GACd,EAAE;QACD,MAAM,EAAE,yCAAyC,CAAC;QAClD,UAAU,CAAC,EAAE,kCAAkC,CAC7C,cAAc,EACd,oBAAoB,EAAE,EACtB,QAAQ,CACT,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAmIzC"}
1
+ {"version":3,"file":"worker-adapter.d.ts","sourceRoot":"","sources":["../../../src/multithreading/worker-adapter/worker-adapter.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,SAAS,EAET,kCAAkC,EAClC,yCAAyC,EACzC,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,EAC7B,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EAGrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAkB,MAAM,oCAAoC,CAAC;AAI9E,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,EAClD,KAAK,EACL,YAAY,EACZ,OAAO,GACR,EAAE,sBAAsB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC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,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B,aAAa,CAAC,EAClB,eAAe,GAChB,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAwInD,gBAAgB,CAAC,EACrB,kBAAkB,GACnB,EAAE;QACD,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B;IA4BK,eAAe,CAAC,EACpB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,6BAA6B,CAAC,wBAAwB,CAAC,CAAC;KACjE,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAyG5B,QAAQ,CAAC,EACb,IAAI,EACJ,cAAc,GACf,EAAE;QACD,IAAI,EAAE,kBAAkB,CAAC;QACzB,cAAc,EAAE,cAAc,CAAC;KAChC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwMvB,iBAAiB,CACrB,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,2BAA2B,CAAC;IA+GvC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAcnB,cAAc,CAAC,EACnB,IAAI,EACJ,MAAM,GACP,EAAE;QACD,IAAI,EAAE,wBAAwB,CAAC;QAC/B,MAAM,EAAE,6BAA6B,CAAC,wBAAwB,CAAC,CAAC;KACjE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuD7B;;;;;;OAMG;IACG,iBAAiB,CAAC,QAAQ,EAAE,EAChC,MAAM,EACN,UAAU,EACV,SAAa,GACd,EAAE;QACD,MAAM,EAAE,yCAAyC,CAAC;QAClD,UAAU,CAAC,EAAE,kCAAkC,CAC7C,cAAc,EACd,oBAAoB,EAAE,EACtB,QAAQ,CACT,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAuIzC"}
@@ -482,10 +482,12 @@ class WorkerAdapter {
482
482
  };
483
483
  }
484
484
  // Update item in external system
485
- const { id, modifiedDate, delay, error } = await itemTypeToLoad.update({
486
- item,
487
- mappers: this._mappers,
488
- event: this.event,
485
+ const { id, modifiedDate, delay, error } = await (0, logger_context_1.runWithUserLogContext)(async () => {
486
+ return await itemTypeToLoad.update({
487
+ item,
488
+ mappers: this._mappers,
489
+ event: this.event,
490
+ });
489
491
  });
490
492
  if (id) {
491
493
  try {
@@ -543,10 +545,12 @@ class WorkerAdapter {
543
545
  if (axios_1.default.isAxiosError(error)) {
544
546
  if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
545
547
  // Create item in external system if mapper record not found
546
- const { id, modifiedDate, delay, error } = await itemTypeToLoad.create({
547
- item,
548
- mappers: this._mappers,
549
- event: this.event,
548
+ const { id, modifiedDate, delay, error } = await (0, logger_context_1.runWithUserLogContext)(async () => {
549
+ return await itemTypeToLoad.create({
550
+ item,
551
+ mappers: this._mappers,
552
+ event: this.event,
553
+ });
550
554
  });
551
555
  if (id) {
552
556
  // Create mapper
@@ -614,11 +618,11 @@ class WorkerAdapter {
614
618
  }
615
619
  async processAttachment(attachment, stream) {
616
620
  return (0, logger_context_1.runWithSdkLogContext)(async () => {
617
- var _a;
618
- const { httpStream, delay, error } = await stream({
621
+ var _a, _b, _c;
622
+ const { httpStream, delay, error } = await (0, logger_context_1.runWithUserLogContext)(async () => stream({
619
623
  item: attachment,
620
624
  event: this.event,
621
- });
625
+ }));
622
626
  if (error) {
623
627
  return { error };
624
628
  }
@@ -627,11 +631,10 @@ class WorkerAdapter {
627
631
  }
628
632
  if (httpStream) {
629
633
  const fileType = attachment.content_type ||
630
- httpStream.headers['content-type'] ||
634
+ ((_a = httpStream.headers['content-type']) === null || _a === void 0 ? void 0 : _a.toString()) ||
631
635
  'application/octet-stream';
632
- const fileSize = httpStream.headers['content-length']
633
- ? parseInt(httpStream.headers['content-length'])
634
- : undefined;
636
+ const contentLength = (_b = httpStream.headers['content-length']) === null || _b === void 0 ? void 0 : _b.toString();
637
+ const fileSize = contentLength ? parseInt(contentLength) : undefined;
635
638
  // Get upload URL
636
639
  const { error: artifactUrlError, response: artifactUrlResponse } = await this.uploader.getArtifactUploadUrl(attachment.file_name, fileType, fileSize);
637
640
  if (artifactUrlError) {
@@ -688,7 +691,7 @@ class WorkerAdapter {
688
691
  else if (attachment.inline === false) {
689
692
  ssorAttachment.inline = false;
690
693
  }
691
- await ((_a = this.getRepo('ssor_attachment')) === null || _a === void 0 ? void 0 : _a.push([ssorAttachment]));
694
+ await ((_c = this.getRepo('ssor_attachment')) === null || _c === void 0 ? void 0 : _c.push([ssorAttachment]));
692
695
  return;
693
696
  }
694
697
  return {
@@ -720,11 +723,11 @@ class WorkerAdapter {
720
723
  async loadAttachment({ item, create, }) {
721
724
  return (0, logger_context_1.runWithSdkLogContext)(async () => {
722
725
  // Create item
723
- const { id, delay, error } = await create({
726
+ const { id, delay, error } = await (0, logger_context_1.runWithUserLogContext)(async () => create({
724
727
  item,
725
728
  mappers: this._mappers,
726
729
  event: this.event,
727
- });
730
+ }));
728
731
  if (delay) {
729
732
  return {
730
733
  rateLimit: {
@@ -821,15 +824,17 @@ class WorkerAdapter {
821
824
  console.log(`Using custom processors for attachments.`);
822
825
  const reducer = processors.reducer;
823
826
  const iterator = processors.iterator;
824
- const reducedAttachments = reducer({
827
+ const reducedAttachments = (0, logger_context_1.runWithUserLogContext)(() => reducer({
825
828
  attachments,
826
829
  adapter: this,
827
830
  batchSize,
828
- });
829
- response = await iterator({
830
- reducedAttachments,
831
- adapter: this,
832
- stream,
831
+ }));
832
+ response = await (0, logger_context_1.runWithUserLogContext)(async () => {
833
+ return await iterator({
834
+ reducedAttachments,
835
+ adapter: this,
836
+ stream,
837
+ });
833
838
  });
834
839
  }
835
840
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/repo/repo.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO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AAW;IAC3B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,OAAO,CAAC,CAAuB;IAChC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;gBAEzB,EACV,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAE,oBAAoB;IAUvB,QAAQ,IAAI,CAAC,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAAC,EAAE;IAItD,MAAM,CACV,KAAK,CAAC,EAAE,CAAC,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAAC,EAAE,GACvD,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;IAqCxB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAyC5C"}
package/dist/repo/repo.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Repo = void 0;
4
4
  const constants_1 = require("../common/constants");
5
5
  const uploader_1 = require("../uploader/uploader");
6
+ const logger_context_1 = require("../logger/logger.context");
6
7
  class Repo {
7
8
  constructor({ event, itemType, normalize, onUpload, options, }) {
8
9
  this.items = [];
@@ -48,7 +49,7 @@ class Repo {
48
49
  if (this.normalize &&
49
50
  this.itemType != constants_1.AirSyncDefaultItemTypes.EXTERNAL_DOMAIN_METADATA &&
50
51
  this.itemType != constants_1.SSOR_ATTACHMENT) {
51
- recordsToPush = items.map((item) => this.normalize(item));
52
+ recordsToPush = (0, logger_context_1.runWithUserLogContext)(() => items.map((item) => this.normalize(item)));
52
53
  }
53
54
  else {
54
55
  recordsToPush = items;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.19.2",
3
+ "version": "1.19.4-beta.0",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@devrev/typescript-sdk": "^1.1.59",
49
- "axios": "^1.15.0",
49
+ "axios": "^1.15.2",
50
50
  "axios-retry": "^4.5.0",
51
51
  "form-data": "^4.0.4",
52
52
  "js-jsonl": "^1.1.1",