@devrev/ts-adaas 1.18.1-beta.0 → 1.18.1-beta.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.
@@ -5,8 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const axios_1 = __importDefault(require("axios"));
7
7
  const axios_client_internal_1 = require("../http/axios-client-internal");
8
- const jest_setup_1 = require("../tests/jest.setup");
9
- const test_utils_1 = require("./test-utils");
8
+ const test_helpers_1 = require("../tests/test-helpers");
10
9
  const extraction_1 = require("../types/extraction");
11
10
  const install_initial_domain_mapping_1 = require("./install-initial-domain-mapping");
12
11
  // Mock dependencies
@@ -23,9 +22,7 @@ const mockAxiosClient = axios_client_internal_1.axiosClient;
23
22
  const mockIsAxiosError = axios_1.default.isAxiosError;
24
23
  describe(install_initial_domain_mapping_1.installInitialDomainMapping.name, () => {
25
24
  // Create mock objects
26
- const mockEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
27
- payload: { event_type: extraction_1.EventType.ExtractionDataStart },
28
- });
25
+ const mockEvent = (0, test_helpers_1.createEvent)({ eventType: extraction_1.EventType.ExtractionDataStart });
29
26
  const mockInitialDomainMapping = {
30
27
  starting_recipe_blueprint: {
31
28
  name: 'Test Recipe Blueprint',
package/dist/index.d.ts CHANGED
@@ -1,19 +1,17 @@
1
- export { AirSyncDefaultItemTypes } from './common/constants';
2
- export { ExtractionCommonError } from './common/errors';
3
- export * from './common/install-initial-domain-mapping';
4
1
  export * from './deprecated/adapter';
5
2
  export * from './deprecated/demo-extractor';
6
3
  export * from './deprecated/http/client';
7
4
  export * from './deprecated/uploader';
8
5
  export * from './http';
9
- export { formatAxiosError, serializeAxiosError } from './logger/logger';
10
- export { MockServer } from './mock-server/mock-server';
11
- export type { RequestInfo, RetryConfig, RouteConfig, } from './mock-server/mock-server.interfaces';
6
+ export * from './types';
7
+ export * from './common/install-initial-domain-mapping';
8
+ export { ExtractionCommonError } from './common/errors';
9
+ export { AirSyncDefaultItemTypes } from './common/constants';
12
10
  export { processTask } from './multithreading/process-task';
13
11
  export { spawn } from './multithreading/spawn/spawn';
14
12
  export { WorkerAdapter } from './multithreading/worker-adapter/worker-adapter';
15
- export { createMockEvent, MOCK_SERVER_DEFAULT_URL } from './common/test-utils';
16
- export type { DeepPartial } from './common/test-utils';
17
- export * from './types';
18
13
  export * from './types/workers';
14
+ export { formatAxiosError, serializeAxiosError } from './logger/logger';
15
+ export { MockServer } from './mock-server/mock-server';
16
+ export type { RequestInfo, RetryConfig, RouteConfig, } from './mock-server/mock-server.interfaces';
19
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,YAAY,EACV,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,cAAc,yCAAyC,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE/E,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,YAAY,EACV,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,sCAAsC,CAAC"}
package/dist/index.js CHANGED
@@ -14,28 +14,25 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.MOCK_SERVER_DEFAULT_URL = exports.createMockEvent = exports.WorkerAdapter = exports.spawn = exports.processTask = exports.MockServer = exports.serializeAxiosError = exports.formatAxiosError = exports.AirSyncDefaultItemTypes = void 0;
18
- var constants_1 = require("./common/constants");
19
- Object.defineProperty(exports, "AirSyncDefaultItemTypes", { enumerable: true, get: function () { return constants_1.AirSyncDefaultItemTypes; } });
20
- __exportStar(require("./common/install-initial-domain-mapping"), exports);
17
+ exports.MockServer = exports.serializeAxiosError = exports.formatAxiosError = exports.WorkerAdapter = exports.spawn = exports.processTask = exports.AirSyncDefaultItemTypes = void 0;
21
18
  __exportStar(require("./deprecated/adapter"), exports);
22
19
  __exportStar(require("./deprecated/demo-extractor"), exports);
23
20
  __exportStar(require("./deprecated/http/client"), exports);
24
21
  __exportStar(require("./deprecated/uploader"), exports);
25
22
  __exportStar(require("./http"), exports);
26
- var logger_1 = require("./logger/logger");
27
- Object.defineProperty(exports, "formatAxiosError", { enumerable: true, get: function () { return logger_1.formatAxiosError; } });
28
- Object.defineProperty(exports, "serializeAxiosError", { enumerable: true, get: function () { return logger_1.serializeAxiosError; } });
29
- var mock_server_1 = require("./mock-server/mock-server");
30
- Object.defineProperty(exports, "MockServer", { enumerable: true, get: function () { return mock_server_1.MockServer; } });
23
+ __exportStar(require("./types"), exports);
24
+ __exportStar(require("./common/install-initial-domain-mapping"), exports);
25
+ var constants_1 = require("./common/constants");
26
+ Object.defineProperty(exports, "AirSyncDefaultItemTypes", { enumerable: true, get: function () { return constants_1.AirSyncDefaultItemTypes; } });
31
27
  var process_task_1 = require("./multithreading/process-task");
32
28
  Object.defineProperty(exports, "processTask", { enumerable: true, get: function () { return process_task_1.processTask; } });
33
29
  var spawn_1 = require("./multithreading/spawn/spawn");
34
30
  Object.defineProperty(exports, "spawn", { enumerable: true, get: function () { return spawn_1.spawn; } });
35
31
  var worker_adapter_1 = require("./multithreading/worker-adapter/worker-adapter");
36
32
  Object.defineProperty(exports, "WorkerAdapter", { enumerable: true, get: function () { return worker_adapter_1.WorkerAdapter; } });
37
- var test_utils_1 = require("./common/test-utils");
38
- Object.defineProperty(exports, "createMockEvent", { enumerable: true, get: function () { return test_utils_1.createMockEvent; } });
39
- Object.defineProperty(exports, "MOCK_SERVER_DEFAULT_URL", { enumerable: true, get: function () { return test_utils_1.MOCK_SERVER_DEFAULT_URL; } });
40
- __exportStar(require("./types"), exports);
41
33
  __exportStar(require("./types/workers"), exports);
34
+ var logger_1 = require("./logger/logger");
35
+ Object.defineProperty(exports, "formatAxiosError", { enumerable: true, get: function () { return logger_1.formatAxiosError; } });
36
+ Object.defineProperty(exports, "serializeAxiosError", { enumerable: true, get: function () { return logger_1.serializeAxiosError; } });
37
+ var mock_server_1 = require("./mock-server/mock-server");
38
+ Object.defineProperty(exports, "MockServer", { enumerable: true, get: function () { return mock_server_1.MockServer; } });
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const node_util_1 = require("node:util");
4
4
  const constants_1 = require("../common/constants");
5
- const jest_setup_1 = require("../tests/jest.setup");
6
- const test_utils_1 = require("../common/test-utils");
5
+ const test_helpers_1 = require("../tests/test-helpers");
7
6
  const extraction_1 = require("../types/extraction");
8
7
  const logger_1 = require("./logger");
9
8
  const logger_constants_1 = require("./logger.constants");
@@ -21,8 +20,24 @@ describe(logger_1.Logger.name, () => {
21
20
  let mockOptions;
22
21
  beforeEach(() => {
23
22
  jest.clearAllMocks();
24
- mockEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
25
- payload: { event_type: extraction_1.EventType.StartExtractingData },
23
+ mockEvent = (0, test_helpers_1.createEvent)({
24
+ eventType: extraction_1.EventType.StartExtractingData,
25
+ eventContextOverrides: {
26
+ dev_org: 'DEV-test',
27
+ dev_org_id: 'DEV-test-id',
28
+ dev_user: 'DEVU-test',
29
+ dev_user_id: 'DEVU-test-id',
30
+ external_sync_unit: 'test-unit',
31
+ external_sync_unit_id: 'test-unit-id',
32
+ external_sync_unit_name: 'test-unit-name',
33
+ external_system: 'test-system',
34
+ external_system_type: 'test-type',
35
+ import_slug: 'test-import',
36
+ request_id: 'test-request-id',
37
+ snap_in_slug: 'test-snap-slug',
38
+ sync_run: 'test-sync-run',
39
+ sync_run_id: 'test-sync-run-id',
40
+ },
26
41
  });
27
42
  mockOptions = {
28
43
  isLocalDevelopment: false,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const test_utils_1 = require("../common/test-utils");
4
3
  const axios_client_internal_1 = require("../http/axios-client-internal");
4
+ const test_helpers_1 = require("../tests/test-helpers");
5
5
  const extraction_1 = require("../types/extraction");
6
6
  const mappers_1 = require("./mappers");
7
7
  const mappers_interface_1 = require("./mappers.interface");
@@ -9,6 +9,7 @@ const mappers_interface_1 = require("./mappers.interface");
9
9
  jest.mock('../http/axios-client-internal');
10
10
  const mockAxiosClient = axios_client_internal_1.axiosClient;
11
11
  describe(mappers_1.Mappers.name, () => {
12
+ const apiEndpoint = 'test_devrev_endpoint';
12
13
  const apiToken = 'test_service_token';
13
14
  const syncUnit = 'test_sync_unit';
14
15
  const targetId = 'test_target_id';
@@ -16,11 +17,12 @@ describe(mappers_1.Mappers.name, () => {
16
17
  const id = 'test_id';
17
18
  const externalIds = ['test_external_id'];
18
19
  const targets = ['test_target_id'];
19
- const mockEvent = (0, test_utils_1.createMockEvent)(test_utils_1.MOCK_SERVER_DEFAULT_URL, {
20
- context: {
20
+ const mockEvent = (0, test_helpers_1.createEvent)({
21
+ eventType: extraction_1.EventType.ExtractionDataStart,
22
+ executionMetadataOverrides: { devrev_endpoint: apiEndpoint },
23
+ contextOverrides: {
21
24
  secrets: { service_account_token: apiToken },
22
25
  },
23
- payload: { event_type: extraction_1.EventType.StartExtractingData },
24
26
  });
25
27
  const mappers = new mappers_1.Mappers({ event: mockEvent });
26
28
  beforeEach(() => {
@@ -36,7 +38,7 @@ describe(mappers_1.Mappers.name, () => {
36
38
  // Act
37
39
  await mappers.getByTargetId(params);
38
40
  // Assert
39
- expect(mockAxiosClient.get).toHaveBeenCalledWith(`${test_utils_1.MOCK_SERVER_DEFAULT_URL}/internal/airdrop.sync-mapper-record.get-by-target`, {
41
+ expect(mockAxiosClient.get).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.get-by-target`, {
40
42
  headers: {
41
43
  Authorization: apiToken,
42
44
  },
@@ -54,7 +56,7 @@ describe(mappers_1.Mappers.name, () => {
54
56
  // Act
55
57
  await mappers.getByExternalId(params);
56
58
  // Assert
57
- expect(mockAxiosClient.get).toHaveBeenCalledWith(`${test_utils_1.MOCK_SERVER_DEFAULT_URL}/internal/airdrop.sync-mapper-record.get-by-external-id`, {
59
+ expect(mockAxiosClient.get).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.get-by-external-id`, {
58
60
  headers: {
59
61
  Authorization: apiToken,
60
62
  },
@@ -77,7 +79,7 @@ describe(mappers_1.Mappers.name, () => {
77
79
  // Act
78
80
  await mappers.create(params);
79
81
  // Assert
80
- expect(mockAxiosClient.post).toHaveBeenCalledWith(`${test_utils_1.MOCK_SERVER_DEFAULT_URL}/internal/airdrop.sync-mapper-record.create`, params, {
82
+ expect(mockAxiosClient.post).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.create`, params, {
81
83
  headers: {
82
84
  Authorization: apiToken,
83
85
  },
@@ -96,7 +98,7 @@ describe(mappers_1.Mappers.name, () => {
96
98
  // Act
97
99
  await mappers.update(params);
98
100
  // Assert
99
- expect(mockAxiosClient.post).toHaveBeenCalledWith(`${test_utils_1.MOCK_SERVER_DEFAULT_URL}/internal/airdrop.sync-mapper-record.update`, params, {
101
+ expect(mockAxiosClient.post).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.update`, params, {
100
102
  headers: {
101
103
  Authorization: apiToken,
102
104
  },
@@ -7,7 +7,7 @@ const MAX_BODY_SIZE = 10 * 1024 * 1024; // 10mb
7
7
  /**
8
8
  * Parses the JSON body from an incoming request.
9
9
  */
10
- async function parseJsonBody(req) {
10
+ function parseJsonBody(req) {
11
11
  return new Promise((resolve, reject) => {
12
12
  const chunks = [];
13
13
  let size = 0;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const worker_threads_1 = require("worker_threads");
4
- const jest_setup_1 = require("../tests/jest.setup");
5
- const test_utils_1 = require("../common/test-utils");
4
+ const test_helpers_1 = require("../tests/test-helpers");
6
5
  const extraction_1 = require("../types/extraction");
7
6
  const create_worker_1 = require("./create-worker");
8
7
  describe(create_worker_1.createWorker.name, () => {
@@ -10,8 +9,8 @@ describe(create_worker_1.createWorker.name, () => {
10
9
  const workerPath = __dirname + '../tests/dummy-worker.ts';
11
10
  const worker = worker_threads_1.isMainThread
12
11
  ? await (0, create_worker_1.createWorker)({
13
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
14
- payload: { event_type: extraction_1.EventType.ExtractionExternalSyncUnitsStart },
12
+ event: (0, test_helpers_1.createEvent)({
13
+ eventType: extraction_1.EventType.ExtractionExternalSyncUnitsStart,
15
14
  }),
16
15
  initialState: {},
17
16
  workerPath,
@@ -29,8 +28,8 @@ describe(create_worker_1.createWorker.name, () => {
29
28
  worker_threads_1.isMainThread = false;
30
29
  const workerPath = __dirname + '../tests/dummy-worker.ts';
31
30
  await expect((0, create_worker_1.createWorker)({
32
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
33
- payload: { event_type: extraction_1.EventType.ExtractionExternalSyncUnitsStart },
31
+ event: (0, test_helpers_1.createEvent)({
32
+ eventType: extraction_1.EventType.ExtractionExternalSyncUnitsStart,
34
33
  }),
35
34
  initialState: {},
36
35
  workerPath,
@@ -43,8 +42,8 @@ describe(create_worker_1.createWorker.name, () => {
43
42
  const workerPath = __dirname + '../tests/dummy-worker.ts';
44
43
  if (worker_threads_1.isMainThread) {
45
44
  const worker = await (0, create_worker_1.createWorker)({
46
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
47
- payload: { event_type: extraction_1.EventType.ExtractionExternalSyncUnitsStart },
45
+ event: (0, test_helpers_1.createEvent)({
46
+ eventType: extraction_1.EventType.ExtractionExternalSyncUnitsStart,
48
47
  }),
49
48
  initialState: {},
50
49
  workerPath,
@@ -63,8 +62,8 @@ describe(create_worker_1.createWorker.name, () => {
63
62
  };
64
63
  if (worker_threads_1.isMainThread) {
65
64
  const worker = await (0, create_worker_1.createWorker)({
66
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
67
- payload: { event_type: extraction_1.EventType.ExtractionDataStart },
65
+ event: (0, test_helpers_1.createEvent)({
66
+ eventType: extraction_1.EventType.ExtractionDataStart,
68
67
  }),
69
68
  initialState: complexState,
70
69
  workerPath,
@@ -77,8 +76,8 @@ describe(create_worker_1.createWorker.name, () => {
77
76
  const workerPath = __dirname + '../tests/dummy-worker.ts';
78
77
  if (worker_threads_1.isMainThread) {
79
78
  const worker = await (0, create_worker_1.createWorker)({
80
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
81
- payload: { event_type: extraction_1.EventType.ExtractionMetadataStart },
79
+ event: (0, test_helpers_1.createEvent)({
80
+ eventType: extraction_1.EventType.ExtractionMetadataStart,
82
81
  }),
83
82
  initialState: {},
84
83
  workerPath,
@@ -2,9 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const constants_1 = require("../../common/constants");
4
4
  const state_1 = require("../../state/state");
5
- const jest_setup_1 = require("../../tests/jest.setup");
6
5
  const test_helpers_1 = require("../../tests/test-helpers");
7
- const test_utils_1 = require("../../common/test-utils");
8
6
  const types_1 = require("../../types");
9
7
  const worker_adapter_1 = require("./worker-adapter");
10
8
  // 1. Create a mock function for the method you want to override.
@@ -52,9 +50,7 @@ describe('Artifact ordering when artifacts overflow batch sizes in repositories'
52
50
  let testAdapter;
53
51
  beforeEach(() => {
54
52
  // Create a fresh adapter instance for this test to avoid mocking conflicts
55
- const mockEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
56
- payload: { event_type: types_1.EventType.StartExtractingData },
57
- });
53
+ const mockEvent = (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.StartExtractingData });
58
54
  const mockAdapterState = new state_1.State({
59
55
  event: mockEvent,
60
56
  initialState: { attachments: { completed: false } },
@@ -133,8 +129,8 @@ describe('Artifact ordering when artifacts overflow batch sizes in repositories'
133
129
  describe('External sync units splitting into artifacts', () => {
134
130
  let testAdapter;
135
131
  beforeEach(() => {
136
- const mockEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
137
- payload: { event_type: types_1.EventType.StartExtractingExternalSyncUnits },
132
+ const mockEvent = (0, test_helpers_1.createEvent)({
133
+ eventType: types_1.EventType.StartExtractingExternalSyncUnits,
138
134
  });
139
135
  const mockAdapterState = new state_1.State({
140
136
  event: mockEvent,
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const attachments_streaming_pool_1 = require("../../attachments-streaming/attachments-streaming-pool");
4
4
  const constants_1 = require("../../common/constants");
5
5
  const state_1 = require("../../state/state");
6
- const jest_setup_1 = require("../../tests/jest.setup");
7
- const test_utils_1 = require("../../common/test-utils");
6
+ const test_helpers_1 = require("../../tests/test-helpers");
8
7
  const types_1 = require("../../types");
9
8
  const loading_1 = require("../../types/loading");
10
9
  const worker_adapter_1 = require("./worker-adapter");
@@ -41,9 +40,7 @@ describe(worker_adapter_1.WorkerAdapter.name, () => {
41
40
  // Reset all mocks
42
41
  jest.clearAllMocks();
43
42
  // Create mock objects
44
- mockEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
45
- payload: { event_type: types_1.EventType.StartExtractingData },
46
- });
43
+ mockEvent = (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.StartExtractingData });
47
44
  const initialState = {
48
45
  attachments: { completed: false },
49
46
  lastSyncStarted: '',
@@ -388,7 +385,8 @@ describe(worker_adapter_1.WorkerAdapter.name, () => {
388
385
  // Mock the pool to simulate timeout happening during the first artifact
389
386
  attachments_streaming_pool_1.AttachmentsStreamingPool.mockImplementationOnce(() => {
390
387
  return {
391
- streamAll: jest.fn().mockImplementation(() => {
388
+ // eslint-disable-next-line @typescript-eslint/require-await
389
+ streamAll: jest.fn().mockImplementation(async () => {
392
390
  adapter.isTimeout = true;
393
391
  return {};
394
392
  }),
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const constants_1 = require("../common/constants");
4
4
  const test_helpers_1 = require("../tests/test-helpers");
5
- const jest_setup_1 = require("../tests/jest.setup");
6
- const test_utils_1 = require("../common/test-utils");
7
5
  const types_1 = require("../types");
8
6
  const repo_1 = require("./repo");
9
7
  jest.mock('../tests/test-helpers', () => (Object.assign(Object.assign({}, jest.requireActual('../tests/test-helpers')), { normalizeItem: jest.fn() })));
@@ -13,9 +11,7 @@ describe(repo_1.Repo.name, () => {
13
11
  beforeEach(() => {
14
12
  normalize = jest.fn();
15
13
  repo = new repo_1.Repo({
16
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
17
- payload: { event_type: types_1.EventType.ExtractionDataStart },
18
- }),
14
+ event: (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.ExtractionDataStart }),
19
15
  itemType: 'test_item_type',
20
16
  normalize,
21
17
  onUpload: jest.fn(),
@@ -33,9 +29,7 @@ describe(repo_1.Repo.name, () => {
33
29
  });
34
30
  it('should not normalize items when normalize function is not provided', async () => {
35
31
  repo = new repo_1.Repo({
36
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
37
- payload: { event_type: types_1.EventType.ExtractionDataStart },
38
- }),
32
+ event: (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.ExtractionDataStart }),
39
33
  itemType: 'test_item_type',
40
34
  onUpload: jest.fn(),
41
35
  options: {},
@@ -50,9 +44,7 @@ describe(repo_1.Repo.name, () => {
50
44
  });
51
45
  it('should not normalize items when item type is external_domain_metadata', async () => {
52
46
  repo = new repo_1.Repo({
53
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
54
- payload: { event_type: types_1.EventType.ExtractionDataStart },
55
- }),
47
+ event: (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.ExtractionDataStart }),
56
48
  itemType: constants_1.AirSyncDefaultItemTypes.EXTERNAL_DOMAIN_METADATA,
57
49
  normalize,
58
50
  onUpload: jest.fn(),
@@ -64,9 +56,7 @@ describe(repo_1.Repo.name, () => {
64
56
  });
65
57
  it('should not normalize items when item type is ssor_attachment', async () => {
66
58
  repo = new repo_1.Repo({
67
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
68
- payload: { event_type: types_1.EventType.ExtractionDataStart },
69
- }),
59
+ event: (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.ExtractionDataStart }),
70
60
  itemType: constants_1.SSOR_ATTACHMENT,
71
61
  normalize,
72
62
  onUpload: jest.fn(),
@@ -101,9 +91,7 @@ describe(repo_1.Repo.name, () => {
101
91
  describe('should take batch size into account', () => {
102
92
  beforeEach(() => {
103
93
  repo = new repo_1.Repo({
104
- event: (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
105
- payload: { event_type: types_1.EventType.ExtractionDataStart },
106
- }),
94
+ event: (0, test_helpers_1.createEvent)({ eventType: types_1.EventType.ExtractionDataStart }),
107
95
  itemType: 'test_item_type',
108
96
  normalize,
109
97
  onUpload: jest.fn(),
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const constants_1 = require("../common/constants");
4
- const jest_setup_1 = require("../tests/jest.setup");
5
- const test_utils_1 = require("../common/test-utils");
4
+ const test_helpers_1 = require("../tests/test-helpers");
6
5
  const extraction_1 = require("../types/extraction");
7
6
  const state_1 = require("./state");
8
7
  const state_interfaces_1 = require("./state.interfaces");
@@ -26,8 +25,8 @@ describe(state_1.State.name, () => {
26
25
  });
27
26
  it.each(constants_1.STATELESS_EVENT_TYPES)('should not init, fetch, post or install IDM for stateless event type %s', async (eventType) => {
28
27
  // Arrange
29
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
30
- payload: { event_type: eventType },
28
+ const event = (0, test_helpers_1.createEvent)({
29
+ eventType: eventType,
31
30
  });
32
31
  // Act
33
32
  await (0, state_1.createAdapterState)({
@@ -43,8 +42,8 @@ describe(state_1.State.name, () => {
43
42
  });
44
43
  it.each(constants_1.STATEFUL_EVENT_TYPES)('should exit the process if fetching the state fails', async (eventType) => {
45
44
  // Arrange
46
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
47
- payload: { event_type: eventType },
45
+ const event = (0, test_helpers_1.createEvent)({
46
+ eventType: eventType,
48
47
  });
49
48
  fetchStateSpy.mockRejectedValue({
50
49
  isAxiosError: true,
@@ -61,8 +60,8 @@ describe(state_1.State.name, () => {
61
60
  });
62
61
  it.each(constants_1.STATEFUL_EVENT_TYPES)('should exit the process if parsing the state fails', async (eventType) => {
63
62
  // Arrange
64
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
65
- payload: { event_type: eventType },
63
+ const event = (0, test_helpers_1.createEvent)({
64
+ eventType: eventType,
66
65
  });
67
66
  fetchStateSpy.mockResolvedValue({ state: 'invalid-json' });
68
67
  jest.spyOn(console, 'error').mockImplementation(() => { });
@@ -76,8 +75,8 @@ describe(state_1.State.name, () => {
76
75
  });
77
76
  it.each(constants_1.STATEFUL_EVENT_TYPES)('should exit the process if fetching is successful but there is no state in the response', async (eventType) => {
78
77
  // Arrange
79
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
80
- payload: { event_type: eventType },
78
+ const event = (0, test_helpers_1.createEvent)({
79
+ eventType: eventType,
81
80
  });
82
81
  fetchStateSpy.mockResolvedValue({ state: null });
83
82
  jest.spyOn(console, 'error').mockImplementation(() => { });
@@ -94,11 +93,11 @@ describe(state_1.State.name, () => {
94
93
  const initialState = {
95
94
  test: 'test',
96
95
  };
97
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
98
- context: {
96
+ const event = (0, test_helpers_1.createEvent)({
97
+ eventType: eventType,
98
+ contextOverrides: {
99
99
  snap_in_version_id: '',
100
100
  },
101
- payload: { event_type: eventType },
102
101
  });
103
102
  fetchStateSpy.mockRejectedValue({
104
103
  isAxiosError: true,
@@ -125,11 +124,11 @@ describe(state_1.State.name, () => {
125
124
  const initialState = {
126
125
  test: 'test',
127
126
  };
128
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
129
- context: {
127
+ const event = (0, test_helpers_1.createEvent)({
128
+ eventType: extraction_1.EventType.StartExtractingData,
129
+ contextOverrides: {
130
130
  snap_in_version_id: '',
131
131
  },
132
- payload: { event_type: extraction_1.EventType.StartExtractingData },
133
132
  });
134
133
  fetchStateSpy.mockRejectedValue({
135
134
  isAxiosError: true,
@@ -157,8 +156,8 @@ describe(state_1.State.name, () => {
157
156
  });
158
157
  it.each(constants_1.STATEFUL_EVENT_TYPES)('should exit the process if initialDomainMapping is not provided for event type %s', async (eventType) => {
159
158
  // Arrange
160
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
161
- payload: { event_type: eventType },
159
+ const event = (0, test_helpers_1.createEvent)({
160
+ eventType: eventType,
162
161
  });
163
162
  fetchStateSpy.mockResolvedValue({
164
163
  state: JSON.stringify({
@@ -177,11 +176,11 @@ describe(state_1.State.name, () => {
177
176
  });
178
177
  it.each(constants_1.STATEFUL_EVENT_TYPES)('should not install IDM if version matches for event type %s', async (eventType) => {
179
178
  // Arrange
180
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
181
- context: {
179
+ const event = (0, test_helpers_1.createEvent)({
180
+ eventType: eventType,
181
+ contextOverrides: {
182
182
  snap_in_version_id: '1.0.0',
183
183
  },
184
- payload: { event_type: eventType },
185
184
  });
186
185
  const stringifiedState = JSON.stringify({
187
186
  test: 'test',
@@ -200,11 +199,11 @@ describe(state_1.State.name, () => {
200
199
  });
201
200
  it.each(constants_1.STATEFUL_EVENT_TYPES)('should install IDM if version does not match for event type %s', async (eventType) => {
202
201
  // Arrange
203
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
204
- context: {
202
+ const event = (0, test_helpers_1.createEvent)({
203
+ eventType: eventType,
204
+ contextOverrides: {
205
205
  snap_in_version_id: '2.0.0',
206
206
  },
207
- payload: { event_type: eventType },
208
207
  });
209
208
  const stringifiedState = JSON.stringify({
210
209
  test: 'test',
@@ -227,13 +226,11 @@ describe(state_1.State.name, () => {
227
226
  describe('Enhanced Control Protocol - TimeValue resolution failures', () => {
228
227
  it('should exit the process if extraction_start_time resolution fails', async () => {
229
228
  // Arrange: WORKERS_NEWEST type but state has no workersNewest
230
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
231
- payload: {
232
- event_type: extraction_1.EventType.StartExtractingData,
233
- event_context: {
234
- extraction_start_time: {
235
- type: extraction_1.TimeValueType.WORKERS_NEWEST,
236
- },
229
+ const event = (0, test_helpers_1.createEvent)({
230
+ eventType: extraction_1.EventType.StartExtractingData,
231
+ eventContextOverrides: {
232
+ extraction_start_time: {
233
+ type: extraction_1.TimeValueType.WORKERS_NEWEST,
237
234
  },
238
235
  },
239
236
  });
@@ -255,16 +252,14 @@ describe(state_1.State.name, () => {
255
252
  });
256
253
  it('should exit the process if extraction_end_time resolution fails', async () => {
257
254
  // Arrange: WORKERS_NEWEST type but state has no workersNewest
258
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
259
- payload: {
260
- event_type: extraction_1.EventType.StartExtractingData,
261
- event_context: {
262
- extraction_start_time: {
263
- type: extraction_1.TimeValueType.UNBOUNDED,
264
- },
265
- extraction_end_time: {
266
- type: extraction_1.TimeValueType.WORKERS_NEWEST,
267
- },
255
+ const event = (0, test_helpers_1.createEvent)({
256
+ eventType: extraction_1.EventType.StartExtractingData,
257
+ eventContextOverrides: {
258
+ extraction_start_time: {
259
+ type: extraction_1.TimeValueType.UNBOUNDED,
260
+ },
261
+ extraction_end_time: {
262
+ type: extraction_1.TimeValueType.WORKERS_NEWEST,
268
263
  },
269
264
  },
270
265
  });
@@ -288,20 +283,18 @@ describe(state_1.State.name, () => {
288
283
  describe('Backwards compatibility - missing TimeValue type', () => {
289
284
  it('should skip resolution when extraction_start_time has no type', async () => {
290
285
  // Arrange: platform sends extraction_start_time without a type field (old platform version)
291
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
292
- context: {
293
- snap_in_version_id: 'test_snap_in_version_id',
294
- },
295
- payload: {
296
- event_type: extraction_1.EventType.StartExtractingData,
297
- event_context: {
298
- extraction_start_time: {},
299
- extraction_end_time: {
300
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
301
- value: '2025-06-01T00:00:00Z',
302
- },
286
+ const event = (0, test_helpers_1.createEvent)({
287
+ eventType: extraction_1.EventType.StartExtractingData,
288
+ eventContextOverrides: {
289
+ extraction_start_time: {},
290
+ extraction_end_time: {
291
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
292
+ value: '2025-06-01T00:00:00Z',
303
293
  },
304
294
  },
295
+ contextOverrides: {
296
+ snap_in_version_id: 'test_snap_in_version_id',
297
+ },
305
298
  });
306
299
  const stringifiedState = JSON.stringify({
307
300
  snapInVersionId: 'test_snap_in_version_id',
@@ -322,19 +315,17 @@ describe(state_1.State.name, () => {
322
315
  });
323
316
  it('should skip resolution when extraction_end_time has no type', async () => {
324
317
  // Arrange: platform sends extraction_end_time without a type field
325
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
326
- context: {
327
- snap_in_version_id: 'test_snap_in_version_id',
328
- },
329
- payload: {
330
- event_type: extraction_1.EventType.StartExtractingData,
331
- event_context: {
332
- extraction_start_time: {
333
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
334
- value: '2024-01-01T00:00:00Z',
335
- },
336
- extraction_end_time: {},
318
+ const event = (0, test_helpers_1.createEvent)({
319
+ eventType: extraction_1.EventType.StartExtractingData,
320
+ eventContextOverrides: {
321
+ extraction_start_time: {
322
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
323
+ value: '2024-01-01T00:00:00Z',
337
324
  },
325
+ extraction_end_time: {},
326
+ },
327
+ contextOverrides: {
328
+ snap_in_version_id: 'test_snap_in_version_id',
338
329
  },
339
330
  });
340
331
  const stringifiedState = JSON.stringify({
@@ -355,20 +346,14 @@ describe(state_1.State.name, () => {
355
346
  });
356
347
  it('should skip resolution when both extraction times have no type', async () => {
357
348
  // Arrange: platform sends both time values without type fields
358
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
359
- context: {
360
- snap_in_version_id: 'test_snap_in_version_id',
349
+ const event = (0, test_helpers_1.createEvent)({
350
+ eventType: extraction_1.EventType.StartExtractingData,
351
+ eventContextOverrides: {
352
+ extraction_start_time: { value: 'some-value' },
353
+ extraction_end_time: { value: 'some-value' },
361
354
  },
362
- payload: {
363
- event_type: extraction_1.EventType.StartExtractingData,
364
- event_context: {
365
- extraction_start_time: {
366
- value: 'some-value',
367
- },
368
- extraction_end_time: {
369
- value: 'some-value',
370
- },
371
- },
355
+ contextOverrides: {
356
+ snap_in_version_id: 'test_snap_in_version_id',
372
357
  },
373
358
  });
374
359
  const stringifiedState = JSON.stringify({
@@ -391,18 +376,16 @@ describe(state_1.State.name, () => {
391
376
  describe('Enhanced Control Protocol - extraction window validation', () => {
392
377
  it('should exit the process if extract_from >= extract_to', async () => {
393
378
  // Arrange: start is after end (inverted window)
394
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
395
- payload: {
396
- event_type: extraction_1.EventType.StartExtractingData,
397
- event_context: {
398
- extraction_start_time: {
399
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
400
- value: '2025-06-01T00:00:00Z',
401
- },
402
- extraction_end_time: {
403
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
404
- value: '2024-01-01T00:00:00Z',
405
- },
379
+ const event = (0, test_helpers_1.createEvent)({
380
+ eventType: extraction_1.EventType.StartExtractingData,
381
+ eventContextOverrides: {
382
+ extraction_start_time: {
383
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
384
+ value: '2025-06-01T00:00:00Z',
385
+ },
386
+ extraction_end_time: {
387
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
388
+ value: '2024-01-01T00:00:00Z',
406
389
  },
407
390
  },
408
391
  });
@@ -422,18 +405,16 @@ describe(state_1.State.name, () => {
422
405
  });
423
406
  it('should exit the process if extract_from equals extract_to', async () => {
424
407
  // Arrange: start equals end (zero-width window)
425
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
426
- payload: {
427
- event_type: extraction_1.EventType.StartExtractingData,
428
- event_context: {
429
- extraction_start_time: {
430
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
431
- value: '2024-06-01T00:00:00Z',
432
- },
433
- extraction_end_time: {
434
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
435
- value: '2024-06-01T00:00:00Z',
436
- },
408
+ const event = (0, test_helpers_1.createEvent)({
409
+ eventType: extraction_1.EventType.StartExtractingData,
410
+ eventContextOverrides: {
411
+ extraction_start_time: {
412
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
413
+ value: '2024-06-01T00:00:00Z',
414
+ },
415
+ extraction_end_time: {
416
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
417
+ value: '2024-06-01T00:00:00Z',
437
418
  },
438
419
  },
439
420
  });
@@ -453,18 +434,16 @@ describe(state_1.State.name, () => {
453
434
  });
454
435
  it('should not exit when extract_from < extract_to', async () => {
455
436
  // Arrange: valid window
456
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
457
- payload: {
458
- event_type: extraction_1.EventType.StartExtractingData,
459
- event_context: {
460
- extraction_start_time: {
461
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
462
- value: '2024-01-01T00:00:00Z',
463
- },
464
- extraction_end_time: {
465
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
466
- value: '2025-06-01T00:00:00Z',
467
- },
437
+ const event = (0, test_helpers_1.createEvent)({
438
+ eventType: extraction_1.EventType.StartExtractingData,
439
+ eventContextOverrides: {
440
+ extraction_start_time: {
441
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
442
+ value: '2024-01-01T00:00:00Z',
443
+ },
444
+ extraction_end_time: {
445
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
446
+ value: '2025-06-01T00:00:00Z',
468
447
  },
469
448
  },
470
449
  });
@@ -484,14 +463,12 @@ describe(state_1.State.name, () => {
484
463
  });
485
464
  it('should not validate when only extract_from is set', async () => {
486
465
  // Arrange: only start, no end
487
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
488
- payload: {
489
- event_type: extraction_1.EventType.StartExtractingData,
490
- event_context: {
491
- extraction_start_time: {
492
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
493
- value: '2024-01-01T00:00:00Z',
494
- },
466
+ const event = (0, test_helpers_1.createEvent)({
467
+ eventType: extraction_1.EventType.StartExtractingData,
468
+ eventContextOverrides: {
469
+ extraction_start_time: {
470
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
471
+ value: '2024-01-01T00:00:00Z',
495
472
  },
496
473
  },
497
474
  });
@@ -511,17 +488,15 @@ describe(state_1.State.name, () => {
511
488
  });
512
489
  it('should not exit when extract_from is UNBOUNDED and extract_to is a real timestamp', async () => {
513
490
  // Arrange: UNBOUNDED start (epoch) with a real ABSOLUTE end timestamp
514
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
515
- payload: {
516
- event_type: extraction_1.EventType.StartExtractingData,
517
- event_context: {
518
- extraction_start_time: {
519
- type: extraction_1.TimeValueType.UNBOUNDED,
520
- },
521
- extraction_end_time: {
522
- type: extraction_1.TimeValueType.ABSOLUTE_TIME,
523
- value: '2025-06-01T00:00:00Z',
524
- },
491
+ const event = (0, test_helpers_1.createEvent)({
492
+ eventType: extraction_1.EventType.StartExtractingData,
493
+ eventContextOverrides: {
494
+ extraction_start_time: {
495
+ type: extraction_1.TimeValueType.UNBOUNDED,
496
+ },
497
+ extraction_end_time: {
498
+ type: extraction_1.TimeValueType.ABSOLUTE_TIME,
499
+ value: '2025-06-01T00:00:00Z',
525
500
  },
526
501
  },
527
502
  });
@@ -551,20 +526,18 @@ describe(state_1.State.name, () => {
551
526
  });
552
527
  it('should store resolved values in pendingWorkersOldest/pendingWorkersNewest on StartExtractingData', async () => {
553
528
  // Arrange
554
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
555
- context: {
556
- snap_in_version_id: '',
557
- },
558
- payload: {
559
- event_type: extraction_1.EventType.StartExtractingData,
560
- event_context: {
561
- extraction_start_time: {
562
- type: extraction_1.TimeValueType.UNBOUNDED,
563
- },
564
- extraction_end_time: {
565
- type: extraction_1.TimeValueType.CURRENT_TIME,
566
- },
529
+ const event = (0, test_helpers_1.createEvent)({
530
+ eventType: extraction_1.EventType.StartExtractingData,
531
+ eventContextOverrides: {
532
+ extraction_start_time: {
533
+ type: extraction_1.TimeValueType.UNBOUNDED,
567
534
  },
535
+ extraction_end_time: {
536
+ type: extraction_1.TimeValueType.CURRENT_TIME,
537
+ },
538
+ },
539
+ contextOverrides: {
540
+ snap_in_version_id: '',
568
541
  },
569
542
  });
570
543
  fetchStateSpy.mockRejectedValue({
@@ -590,21 +563,19 @@ describe(state_1.State.name, () => {
590
563
  // Arrange: state has stale pending values from a previous failed attempt
591
564
  const staleOldest = '2026-03-25T08:00:00.000Z';
592
565
  const staleNewest = '2026-03-25T09:00:00.000Z';
593
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
594
- context: {
595
- snap_in_version_id: 'test_snap_in_version_id',
596
- },
597
- payload: {
598
- event_type: extraction_1.EventType.StartExtractingData,
599
- event_context: {
600
- extraction_start_time: {
601
- type: extraction_1.TimeValueType.UNBOUNDED,
602
- },
603
- extraction_end_time: {
604
- type: extraction_1.TimeValueType.CURRENT_TIME,
605
- },
566
+ const event = (0, test_helpers_1.createEvent)({
567
+ eventType: extraction_1.EventType.StartExtractingData,
568
+ eventContextOverrides: {
569
+ extraction_start_time: {
570
+ type: extraction_1.TimeValueType.UNBOUNDED,
571
+ },
572
+ extraction_end_time: {
573
+ type: extraction_1.TimeValueType.CURRENT_TIME,
606
574
  },
607
575
  },
576
+ contextOverrides: {
577
+ snap_in_version_id: 'test_snap_in_version_id',
578
+ },
608
579
  });
609
580
  const stringifiedState = JSON.stringify({
610
581
  snapInVersionId: 'test_snap_in_version_id',
@@ -628,21 +599,19 @@ describe(state_1.State.name, () => {
628
599
  // Arrange: state has pending values from a prior StartExtractingData phase
629
600
  const pendingOldest = '1970-01-01T00:00:00.000Z';
630
601
  const pendingNewest = '2026-03-26T08:00:00.000Z'; // Earlier than FIXED_NOW
631
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
632
- context: {
633
- snap_in_version_id: 'test_snap_in_version_id',
634
- },
635
- payload: {
636
- event_type: extraction_1.EventType.ContinueExtractingData,
637
- event_context: {
638
- // Platform still sends TimeValue objects, but they should be ignored
639
- extraction_start_time: {
640
- type: extraction_1.TimeValueType.CURRENT_TIME,
641
- },
642
- extraction_end_time: {
643
- type: extraction_1.TimeValueType.CURRENT_TIME,
644
- },
602
+ const event = (0, test_helpers_1.createEvent)({
603
+ eventType: extraction_1.EventType.ContinueExtractingData,
604
+ eventContextOverrides: {
605
+ // Platform still sends TimeValue objects, but they should be ignored
606
+ extraction_start_time: {
607
+ type: extraction_1.TimeValueType.CURRENT_TIME,
645
608
  },
609
+ extraction_end_time: {
610
+ type: extraction_1.TimeValueType.CURRENT_TIME,
611
+ },
612
+ },
613
+ contextOverrides: {
614
+ snap_in_version_id: 'test_snap_in_version_id',
646
615
  },
647
616
  });
648
617
  const stringifiedState = JSON.stringify({
@@ -667,11 +636,11 @@ describe(state_1.State.name, () => {
667
636
  });
668
637
  it('should not set extract_from/extract_to on ContinueExtractingData if no pending values exist', async () => {
669
638
  // Arrange: state has no pending values (e.g. old state from before this feature)
670
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
671
- context: {
639
+ const event = (0, test_helpers_1.createEvent)({
640
+ eventType: extraction_1.EventType.ContinueExtractingData,
641
+ contextOverrides: {
672
642
  snap_in_version_id: 'test_snap_in_version_id',
673
643
  },
674
- payload: { event_type: extraction_1.EventType.ContinueExtractingData },
675
644
  });
676
645
  const stringifiedState = JSON.stringify({
677
646
  snapInVersionId: 'test_snap_in_version_id',
@@ -692,11 +661,11 @@ describe(state_1.State.name, () => {
692
661
  // Arrange: state has pending values from the StartExtractingData phase
693
662
  const pendingOldest = '1970-01-01T00:00:00.000Z';
694
663
  const pendingNewest = '2026-03-26T08:00:00.000Z';
695
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
696
- context: {
664
+ const event = (0, test_helpers_1.createEvent)({
665
+ eventType: extraction_1.EventType.StartExtractingAttachments,
666
+ contextOverrides: {
697
667
  snap_in_version_id: 'test_snap_in_version_id',
698
668
  },
699
- payload: { event_type: extraction_1.EventType.StartExtractingAttachments },
700
669
  });
701
670
  const stringifiedState = JSON.stringify({
702
671
  snapInVersionId: 'test_snap_in_version_id',
@@ -718,11 +687,11 @@ describe(state_1.State.name, () => {
718
687
  });
719
688
  it('should populate extractionScope from API response', async () => {
720
689
  // Arrange
721
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
722
- context: {
690
+ const event = (0, test_helpers_1.createEvent)({
691
+ eventType: extraction_1.EventType.StartExtractingData,
692
+ contextOverrides: {
723
693
  snap_in_version_id: '1.0.0',
724
694
  },
725
- payload: { event_type: extraction_1.EventType.StartExtractingData },
726
695
  });
727
696
  fetchStateSpy.mockResolvedValue({
728
697
  state: JSON.stringify({ snapInVersionId: '1.0.0' }),
@@ -746,11 +715,11 @@ describe(state_1.State.name, () => {
746
715
  });
747
716
  it('should have empty extractionScope on 404', async () => {
748
717
  // Arrange
749
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
750
- context: {
718
+ const event = (0, test_helpers_1.createEvent)({
719
+ eventType: extraction_1.EventType.StartExtractingMetadata,
720
+ contextOverrides: {
751
721
  snap_in_version_id: '',
752
722
  },
753
- payload: { event_type: extraction_1.EventType.StartExtractingMetadata },
754
723
  });
755
724
  fetchStateSpy.mockRejectedValue({
756
725
  isAxiosError: true,
@@ -770,8 +739,8 @@ describe(state_1.State.name, () => {
770
739
  });
771
740
  it('should have empty extractionScope for stateless events', async () => {
772
741
  // Arrange
773
- const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
774
- payload: { event_type: extraction_1.EventType.StartExtractingExternalSyncUnits },
742
+ const event = (0, test_helpers_1.createEvent)({
743
+ eventType: extraction_1.EventType.StartExtractingExternalSyncUnits,
775
744
  });
776
745
  // Act
777
746
  const result = await (0, state_1.createAdapterState)({
@@ -19,7 +19,7 @@ export type StageKey = string;
19
19
  /**
20
20
  * Field type discriminator.
21
21
  */
22
- export type FieldType = 'bool' | 'int' | 'float' | 'text' | 'rich_text' | 'reference' | 'typed_reference' | 'enum' | 'date' | 'timestamp' | 'struct' | 'permission' | 'record_type_privilege' | 'field_privilege' | 'conditional_privilege' | 'participation';
22
+ export type FieldType = 'bool' | 'int' | 'float' | 'text' | 'rich_text' | 'reference' | 'typed_reference' | 'enum' | 'date' | 'timestamp' | 'struct' | 'permission' | 'record_type_privilege' | 'field_privilege' | 'conditional_privilege';
23
23
  /**
24
24
  * Reference type indicating parent-child relationship.
25
25
  */
@@ -113,13 +113,6 @@ export interface TypedReferenceData {
113
113
  export interface StructData {
114
114
  key?: StructTypeKey;
115
115
  }
116
- /**
117
- * Participation field data specifying target record types.
118
- */
119
- export interface ParticipationData {
120
- /** The record types that this participation reference can refer to */
121
- refers_to: Record<RecordTypeKey, ReferenceDetail>;
122
- }
123
116
  /**
124
117
  * Permission data associating a reference with a role.
125
118
  */
@@ -197,7 +190,6 @@ export interface Field {
197
190
  record_type_privilege?: RecordTypePrivilegeData;
198
191
  field_privilege?: FieldPrivilegeData;
199
192
  conditional_privilege?: ConditionalPrivilegeData;
200
- participation?: ParticipationData;
201
193
  }
202
194
  /**
203
195
  * Field condition definition.
@@ -277,15 +269,6 @@ export interface RecordTypeCategory {
277
269
  /** Indicates whether a record can move between the record types of this category while preserving its identity */
278
270
  are_record_type_conversions_possible?: boolean;
279
271
  }
280
- /**
281
- * Attachments configuration for a record type.
282
- */
283
- export interface Attachments {
284
- /** Whether attachments can be extracted */
285
- is_extractable?: boolean;
286
- /** Whether attachments can be loaded: that is, whether the connector supports creating it in the system */
287
- is_loadable?: boolean;
288
- }
289
272
  /**
290
273
  * Record type definition.
291
274
  */
@@ -310,8 +293,6 @@ export interface RecordType {
310
293
  stage_diagram?: StageDiagram;
311
294
  /** Link naming data for custom links */
312
295
  link_naming_data?: CustomLinkData;
313
- /** Attachments configuration */
314
- attachments?: Attachments;
315
296
  }
316
297
  /**
317
298
  * Struct type definition for reusable field structures.
@@ -1 +1 @@
1
- {"version":3,"file":"external-domain-metadata.d.ts","sourceRoot":"","sources":["../../src/types/external-domain-metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC,kGAAkG;AAClG,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,uFAAuF;AACvF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CA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AiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IAChD,6BAA6B;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;IAC3E,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACjD,wDAAwD;IACxD,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC"}
1
+ {"version":3,"file":"external-domain-metadata.d.ts","sourceRoot":"","sources":["../../src/types/external-domain-metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC,kGAAkG;AAClG,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,uFAAuF;AACvF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,KAAK,GACL,OAAO,GACP,MAAM,GACN,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,MAAM,GACN,MAAM,GACN,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,uBAAuB,GACvB,iBAAiB,GACjB,uBAAuB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;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E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,iCAAiC;IACjC,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChC,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IAChD,6BAA6B;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;IAC3E,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACjD,wDAAwD;IACxD,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC"}
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const test_utils_1 = require("../common/test-utils");
4
- const jest_setup_1 = require("../tests/jest.setup");
3
+ const test_helpers_1 = require("../tests/test-helpers");
5
4
  const extraction_1 = require("./extraction");
6
5
  // Test the EventContext interface and related extraction types
7
6
  describe('ExtractionTypes', () => {
8
- const baseEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
9
- payload: { event_type: extraction_1.EventType.StartExtractingData },
10
- });
7
+ const baseEvent = (0, test_helpers_1.createEvent)({ eventType: extraction_1.EventType.StartExtractingData });
11
8
  it('should create event context without optional fields', () => {
12
9
  const event = Object.assign({}, baseEvent);
13
10
  // If this compiles, the test passes
@@ -49,20 +46,16 @@ describe('ExtractionTypes', () => {
49
46
  expect(event.payload.event_context.reset_extract_from).toBeUndefined();
50
47
  });
51
48
  it('[edge] should handle explicit boolean values for reset_extract_from', () => {
52
- const eventWithTrue = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
53
- payload: {
54
- event_type: extraction_1.EventType.StartExtractingData,
55
- event_context: {
56
- reset_extract_from: true,
57
- },
49
+ const eventWithTrue = (0, test_helpers_1.createEvent)({
50
+ eventType: extraction_1.EventType.StartExtractingData,
51
+ eventContextOverrides: {
52
+ reset_extract_from: true,
58
53
  },
59
54
  });
60
- const eventWithFalse = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
61
- payload: {
62
- event_type: extraction_1.EventType.StartExtractingData,
63
- event_context: {
64
- reset_extract_from: false,
65
- },
55
+ const eventWithFalse = (0, test_helpers_1.createEvent)({
56
+ eventType: extraction_1.EventType.StartExtractingData,
57
+ eventContextOverrides: {
58
+ reset_extract_from: false,
66
59
  },
67
60
  });
68
61
  expect(eventWithTrue.payload.event_context.reset_extract_from).toBe(true);
@@ -8,8 +8,6 @@ const js_jsonl_1 = require("js-jsonl");
8
8
  const zlib_1 = __importDefault(require("zlib"));
9
9
  const axios_client_internal_1 = require("../http/axios-client-internal");
10
10
  const test_helpers_1 = require("../tests/test-helpers");
11
- const jest_setup_1 = require("../tests/jest.setup");
12
- const test_utils_1 = require("../common/test-utils");
13
11
  const uploader_helpers_1 = require("./uploader.helpers");
14
12
  const uploader_1 = require("./uploader");
15
13
  jest.mock('../http/axios-client-internal');
@@ -18,7 +16,7 @@ const mockedAxiosClient = jest.mocked(axios_client_internal_1.axiosClient);
18
16
  const mockedDownloadToLocal = jest.mocked(uploader_helpers_1.downloadToLocal);
19
17
  const mockedCompressGzip = jest.mocked(uploader_helpers_1.compressGzip);
20
18
  describe(uploader_1.Uploader.name, () => {
21
- const mockEvent = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl);
19
+ const mockEvent = (0, test_helpers_1.createEvent)();
22
20
  let uploader;
23
21
  beforeEach(() => {
24
22
  uploader = new uploader_1.Uploader({ event: mockEvent });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.18.1-beta.0",
3
+ "version": "1.18.1-beta.1",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -1,19 +0,0 @@
1
- import { AirdropEvent } from '../types/extraction';
2
- export declare const MOCK_SERVER_DEFAULT_URL = "http://localhost:0";
3
- /**
4
- * Recursively makes all properties of T optional.
5
- */
6
- export type DeepPartial<T> = {
7
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
8
- };
9
- /**
10
- * Creates a mock AirdropEvent for testing.
11
- *
12
- * @param mockServerUrl - Base URL for the mock server. Defaults to {@link MOCK_SERVER_DEFAULT_URL}.
13
- * The `callback_url`, `worker_data_url`, and `devrev_endpoint` fields are
14
- * derived from this value unless explicitly overridden.
15
- * @param overrides - Deep partial of AirdropEvent. Any provided fields are
16
- * deep-merged on top of the defaults.
17
- */
18
- export declare function createMockEvent(mockServerUrl?: string, overrides?: DeepPartial<AirdropEvent>): AirdropEvent;
19
- //# sourceMappingURL=test-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/common/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,qBAAqB,CAAC;AAE9D,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAoCF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,aAAa,GAAE,MAAgC,EAC/C,SAAS,GAAE,WAAW,CAAC,YAAY,CAAM,GACxC,YAAY,CA2Ed"}
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MOCK_SERVER_DEFAULT_URL = void 0;
4
- exports.createMockEvent = createMockEvent;
5
- const extraction_1 = require("../types/extraction");
6
- exports.MOCK_SERVER_DEFAULT_URL = 'http://localhost:0';
7
- /**
8
- * Deep merges source into target. Arrays and primitives from source replace
9
- * those in target; plain objects are merged recursively.
10
- */
11
- function deepMerge(target, source) {
12
- const result = Object.assign({}, target);
13
- for (const key of Object.keys(source)) {
14
- const sourceVal = source[key];
15
- const targetVal = target[key];
16
- if (sourceVal !== null &&
17
- typeof sourceVal === 'object' &&
18
- !Array.isArray(sourceVal) &&
19
- targetVal !== null &&
20
- typeof targetVal === 'object' &&
21
- !Array.isArray(targetVal)) {
22
- result[key] = deepMerge(targetVal, sourceVal);
23
- }
24
- else {
25
- result[key] = sourceVal;
26
- }
27
- }
28
- return result;
29
- }
30
- /**
31
- * Creates a mock AirdropEvent for testing.
32
- *
33
- * @param mockServerUrl - Base URL for the mock server. Defaults to {@link MOCK_SERVER_DEFAULT_URL}.
34
- * The `callback_url`, `worker_data_url`, and `devrev_endpoint` fields are
35
- * derived from this value unless explicitly overridden.
36
- * @param overrides - Deep partial of AirdropEvent. Any provided fields are
37
- * deep-merged on top of the defaults.
38
- */
39
- function createMockEvent(mockServerUrl = exports.MOCK_SERVER_DEFAULT_URL, overrides = {}) {
40
- var _a, _b, _c, _d;
41
- const base = {
42
- context: {
43
- secrets: {
44
- service_account_token: 'test_token',
45
- },
46
- snap_in_version_id: 'test_snap_in_version_id',
47
- snap_in_id: 'test_snap_in_id',
48
- },
49
- payload: {
50
- connection_data: {
51
- org_id: 'test_org_id',
52
- org_name: 'test_org_name',
53
- key: 'test_key',
54
- key_type: 'test_key_type',
55
- },
56
- event_context: {
57
- callback_url: `${mockServerUrl}/callback_url`,
58
- dev_org: 'test_dev_org',
59
- dev_oid: 'test_dev_oid',
60
- dev_org_id: 'test_dev_org_id',
61
- dev_user: 'test_dev_user',
62
- dev_user_id: 'test_dev_user_id',
63
- dev_uid: 'test_dev_uid',
64
- event_type_adaas: 'test_event_type_adaas',
65
- external_sync_unit: 'test_external_sync_unit',
66
- external_sync_unit_id: 'test_external_sync_unit_id',
67
- external_sync_unit_name: 'test_external_sync_unit_name',
68
- external_system: 'test_external_system',
69
- external_system_id: 'test_external_system_id',
70
- external_system_name: 'test_external_system_name',
71
- external_system_type: 'test_external_system_type',
72
- import_slug: 'test_import_slug',
73
- mode: 'INITIAL',
74
- request_id: 'test_request_id',
75
- request_id_adaas: 'test_request_id_adaas',
76
- run_id: 'test_run_id',
77
- sequence_version: 'test_sequence_version',
78
- snap_in_slug: 'test_snap_in_slug',
79
- snap_in_version_id: 'test_snap_in_version_id',
80
- sync_run: 'test_sync_run',
81
- sync_run_id: 'test_sync_run_id',
82
- sync_tier: 'test_sync_tier',
83
- sync_unit: 'test_sync_unit',
84
- sync_unit_id: 'test_sync_unit_id',
85
- uuid: 'test_uuid',
86
- worker_data_url: `${mockServerUrl}/worker_data_url`,
87
- },
88
- event_type: extraction_1.EventType.StartExtractingData,
89
- event_data: {},
90
- },
91
- execution_metadata: {
92
- devrev_endpoint: mockServerUrl,
93
- },
94
- input_data: {
95
- global_values: {},
96
- event_sources: {},
97
- },
98
- };
99
- const merged = deepMerge(base, overrides);
100
- // Ensure mock server URLs always win over overrides, unless the caller
101
- // explicitly provided them.
102
- if (!((_b = (_a = overrides.payload) === null || _a === void 0 ? void 0 : _a.event_context) === null || _b === void 0 ? void 0 : _b.callback_url)) {
103
- merged.payload.event_context.callback_url = `${mockServerUrl}/callback_url`;
104
- }
105
- if (!((_d = (_c = overrides.payload) === null || _c === void 0 ? void 0 : _c.event_context) === null || _d === void 0 ? void 0 : _d.worker_data_url)) {
106
- merged.payload.event_context.worker_data_url = `${mockServerUrl}/worker_data_url`;
107
- }
108
- return merged;
109
- }