@devrev/ts-adaas 1.17.1-beta.5 → 1.17.1-beta.7

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 (32) hide show
  1. package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
  2. package/dist/common/constants.d.ts +8 -0
  3. package/dist/common/constants.d.ts.map +1 -1
  4. package/dist/common/constants.js +9 -1
  5. package/dist/common/time-value-resolver.d.ts +47 -0
  6. package/dist/common/time-value-resolver.d.ts.map +1 -0
  7. package/dist/common/time-value-resolver.js +149 -0
  8. package/dist/common/time-value-resolver.test.d.ts +2 -0
  9. package/dist/common/time-value-resolver.test.d.ts.map +1 -0
  10. package/dist/common/time-value-resolver.test.js +273 -0
  11. package/dist/mock-server/mock-server.d.ts +1 -34
  12. package/dist/mock-server/mock-server.d.ts.map +1 -1
  13. package/dist/mock-server/mock-server.interfaces.d.ts +18 -2
  14. package/dist/mock-server/mock-server.interfaces.d.ts.map +1 -1
  15. package/dist/mock-server/mock-server.js +87 -80
  16. package/dist/multithreading/worker-adapter/worker-adapter.d.ts.map +1 -1
  17. package/dist/multithreading/worker-adapter/worker-adapter.js +19 -0
  18. package/dist/multithreading/worker-adapter/worker-adapter.test.js +192 -6
  19. package/dist/state/state.d.ts.map +1 -1
  20. package/dist/state/state.interfaces.d.ts +22 -0
  21. package/dist/state/state.interfaces.d.ts.map +1 -1
  22. package/dist/state/state.interfaces.js +4 -0
  23. package/dist/state/state.js +68 -0
  24. package/dist/state/state.test.js +369 -0
  25. package/dist/types/extraction.d.ts +77 -1
  26. package/dist/types/extraction.d.ts.map +1 -1
  27. package/dist/types/extraction.js +43 -1
  28. package/dist/types/extraction.test.js +22 -11
  29. package/dist/types/index.d.ts +2 -1
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/index.js +6 -1
  32. package/package.json +1 -15
@@ -1 +1 @@
1
- {"version":3,"file":"mock-server.interfaces.d.ts","sourceRoot":"","sources":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MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -1,11 +1,67 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.MockServer = void 0;
7
- const express_1 = __importDefault(require("express"));
4
+ const http_1 = require("http");
8
5
  const mock_server_interfaces_1 = require("./mock-server.interfaces");
6
+ const MAX_BODY_SIZE = 10 * 1024 * 1024; // 10mb
7
+ /**
8
+ * Parses the JSON body from an incoming request.
9
+ */
10
+ function parseJsonBody(req) {
11
+ return new Promise((resolve, reject) => {
12
+ const chunks = [];
13
+ let size = 0;
14
+ req.on('data', (chunk) => {
15
+ size += chunk.length;
16
+ if (size > MAX_BODY_SIZE) {
17
+ reject(new Error('Request body too large'));
18
+ req.destroy();
19
+ return;
20
+ }
21
+ chunks.push(chunk);
22
+ });
23
+ req.on('end', () => {
24
+ if (chunks.length === 0) {
25
+ resolve(undefined);
26
+ return;
27
+ }
28
+ try {
29
+ const raw = Buffer.concat(chunks).toString('utf-8');
30
+ resolve(JSON.parse(raw));
31
+ }
32
+ catch (_a) {
33
+ resolve(undefined);
34
+ }
35
+ });
36
+ req.on('error', reject);
37
+ });
38
+ }
39
+ /**
40
+ * Wraps a ServerResponse with helper methods (status, json, set, send).
41
+ */
42
+ function wrapResponse(res) {
43
+ const mock = res;
44
+ let statusCode = 200;
45
+ mock.set = (headers) => {
46
+ for (const [key, value] of Object.entries(headers)) {
47
+ res.setHeader(key, value);
48
+ }
49
+ return mock;
50
+ };
51
+ mock.status = (code) => {
52
+ statusCode = code;
53
+ return mock;
54
+ };
55
+ mock.json = (data) => {
56
+ res.writeHead(statusCode, { 'Content-Type': 'application/json' });
57
+ res.end(JSON.stringify(data));
58
+ };
59
+ mock.send = () => {
60
+ res.writeHead(statusCode);
61
+ res.end();
62
+ };
63
+ return mock;
64
+ }
9
65
  /**
10
66
  * MockServer used in tests to mock internal AirSync endpoints.
11
67
  * This is a simple mock server that listens on a port and responds to requests.
@@ -20,16 +76,17 @@ class MockServer {
20
76
  this.internalPort = port;
21
77
  this.port = port;
22
78
  this.baseUrl = `http://localhost:${this.port}`;
23
- this.app = (0, express_1.default)();
24
- // Increase limit to handle size limit tests that send large artifact arrays
25
- this.app.use(express_1.default.json({ limit: '10mb' }));
26
- this.setupRoutes();
27
79
  }
28
80
  async start() {
29
81
  return new Promise((resolve) => {
30
- this.server = this.app.listen(this.internalPort, () => {
82
+ this.server = (0, http_1.createServer)((req, res) => {
83
+ this.handleRequest(req, res).catch(() => {
84
+ res.writeHead(500);
85
+ res.end();
86
+ });
87
+ });
88
+ this.server.listen(this.internalPort, () => {
31
89
  var _a, _b;
32
- // Get the actual port assigned by the OS (important for port 0 = dynamic allocation)
33
90
  const actualPort = (_b = (_a = this.server) === null || _a === void 0 ? void 0 : _a.address()) === null || _b === void 0 ? void 0 : _b.port;
34
91
  if (actualPort) {
35
92
  this.port = actualPort;
@@ -57,56 +114,29 @@ class MockServer {
57
114
  });
58
115
  });
59
116
  }
60
- /**
61
- * Sets up routes for the mock server.
62
- */
63
- setupRoutes() {
64
- // TEST ENDPOINT
65
- this.app.get('/test-endpoint', this.routeHandler('GET', '/test-endpoint'));
66
- // CALLBACK URL
67
- this.app.post('/callback_url', this.routeHandler('POST', '/callback_url'));
68
- // WORKER DATA URL
69
- this.app.post('/worker_data_url', this.routeHandler('POST', '/worker_data_url'));
70
- this.app.get('/worker_data_url.get', this.routeHandler('GET', '/worker_data_url.get'));
71
- this.app.post('/worker_data_url.update', this.routeHandler('POST', '/worker_data_url.update'));
72
- // SNAP-INS URL
73
- this.app.get('/internal/snap-ins.get', this.routeHandler('GET', '/internal/snap-ins.get'));
74
- // AIRDROP RECIPE INITIAL DOMAIN MAPPINGS INSTALL URL
75
- this.app.post('/internal/airdrop.recipe.initial-domain-mappings.install', this.routeHandler('POST', '/internal/airdrop.recipe.initial-domain-mappings.install'));
76
- // ARTIFACTS URL
77
- this.app.get('/internal/airdrop.artifacts.upload-url', this.routeHandler('GET', '/internal/airdrop.artifacts.upload-url'));
78
- this.app.post('/internal/airdrop.artifacts.confirm-upload', this.routeHandler('POST', '/internal/airdrop.artifacts.confirm-upload'));
79
- // FILE UPLOAD URL
80
- this.app.post('/file-upload-url', this.routeHandler('POST', '/file-upload-url'));
81
- }
82
- /**
83
- * Creates a route handler that checks for custom handlers before using the default.
84
- * @param method - The HTTP method
85
- * @param path - The route path
86
- * @returns A route handler function
87
- */
88
- routeHandler(method, path) {
89
- return (req, res) => {
90
- const requestInfo = Object.assign({ method: req.method, url: req.url || req.path }, (req.body !== undefined && req.body !== null
91
- ? { body: req.body }
92
- : {}));
93
- this.requests.push(requestInfo);
94
- const key = `${method}:${path}`;
95
- const customHandler = this.routeHandlers.get(key);
96
- if (customHandler) {
97
- customHandler(req, res);
98
- }
99
- else {
100
- this.defaultRouteHandler(req, res);
101
- }
102
- };
117
+ async handleRequest(raw, rawRes) {
118
+ const req = raw;
119
+ const res = wrapResponse(rawRes);
120
+ const urlPath = (req.url || '/').split('?')[0];
121
+ req.path = urlPath;
122
+ req.body = await parseJsonBody(req);
123
+ const requestInfo = Object.assign({ method: req.method || 'GET', url: req.url || urlPath }, (req.body !== undefined && req.body !== null
124
+ ? { body: req.body }
125
+ : {}));
126
+ this.requests.push(requestInfo);
127
+ const method = (req.method || 'GET').toUpperCase();
128
+ const key = `${method}:${urlPath}`;
129
+ const customHandler = this.routeHandlers.get(key);
130
+ if (customHandler) {
131
+ customHandler(req, res);
132
+ }
133
+ else {
134
+ this.defaultRouteHandler(req, res);
135
+ }
103
136
  }
104
137
  /**
105
138
  * Default route handler for the mock server. Returns { success: true } for
106
139
  * routes that are not explicitly set.
107
- * @param req - The request object
108
- * @param res - The response object
109
- * @returns void
110
140
  */
111
141
  defaultRouteHandler(req, res) {
112
142
  if (req.method === 'GET' && req.path === '/worker_data_url.get') {
@@ -124,43 +154,28 @@ class MockServer {
124
154
  }
125
155
  else if (req.method === 'GET' &&
126
156
  req.path === '/internal/airdrop.artifacts.upload-url') {
127
- // Generate a unique artifact ID for each request
128
157
  const artifactId = `artifact-${Date.now()}-${Math.random()
129
158
  .toString(36)
130
159
  .substr(2, 9)}`;
131
160
  res.status(200).json({
132
161
  upload_url: `${this.baseUrl}/file-upload-url`,
133
162
  artifact_id: artifactId,
134
- form_data: [], // Empty form_data for local development
163
+ form_data: [],
135
164
  });
136
165
  }
137
166
  else {
138
167
  res.status(200).json({ success: true });
139
168
  }
140
169
  }
141
- /**
142
- * Gets the route key for a given method and path.
143
- * @param method - The HTTP method
144
- * @param path - The route path
145
- * @returns The route key in the format 'METHOD:path'
146
- */
147
170
  getRouteKey(method, path) {
148
171
  return `${method.toUpperCase()}:${path}`;
149
172
  }
150
173
  /**
151
174
  * Configures a route to return a specific status code and optional response body.
152
- * @param config - The route configuration object
153
- * @param config.path - The path of the route (e.g., '/callback_url')
154
- * @param config.method - The HTTP method (e.g., 'GET', 'POST')
155
- * @param config.status - The HTTP status code to return (e.g., 200, 401, 500)
156
- * @param config.body - Optional response body to send as JSON
157
- * @param config.retry - Optional retry configuration for simulating failures before success
158
175
  */
159
176
  setRoute(config) {
160
177
  const { path, method, status, body, retry, headers, delay } = config;
161
178
  const key = this.getRouteKey(method, path);
162
- // Reset request count for this route if retry is configured
163
- // This ensures a clean state each time setRoute is called
164
179
  if (retry) {
165
180
  this.requestCounts.set(key, 0);
166
181
  }
@@ -238,7 +253,6 @@ class MockServer {
238
253
  }
239
254
  /**
240
255
  * Returns the most recent request or undefined if no requests exist.
241
- * @returns The last RequestInfo object or undefined
242
256
  */
243
257
  getLastRequest() {
244
258
  if (this.requests.length === 0) {
@@ -248,21 +262,14 @@ class MockServer {
248
262
  }
249
263
  /**
250
264
  * Gets the number of requests made to a specific endpoint.
251
- * @param method - The HTTP method (e.g., 'GET', 'POST')
252
- * @param path - The route path (e.g., '/test-endpoint', '/callback_url')
253
- * @returns The number of requests made to the endpoint
254
265
  */
255
266
  getRequestCount(method, path) {
256
267
  return this.getRequests(method, path).length;
257
268
  }
258
269
  /**
259
270
  * Gets all requests made to a specific endpoint.
260
- * @param method - The HTTP method (e.g., 'GET', 'POST')
261
- * @param path - The route path (e.g., '/test-endpoint', '/callback_url')
262
- * @returns An array of RequestInfo objects for the endpoint
263
271
  */
264
272
  getRequests(method, path) {
265
- // Remove query parameters for comparison
266
273
  const pathWithoutQuery = path.split('?')[0];
267
274
  return this.requests.filter((req) => req.method.toUpperCase() === method.toUpperCase() &&
268
275
  req.url.split('?')[0] === pathWithoutQuery);
@@ -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,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B,CACrB,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,2BAA2B,CAAC;IA6GvC;;;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;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":"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,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;AA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AC,EAAE,kCAAkC,CAC7C,cAAc,EACd,oBAAoB,EAAE,EACtB,QAAQ,CACT,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAmIzC"}
@@ -187,6 +187,25 @@ class WorkerAdapter {
187
187
  console.log(`Overwriting lastSuccessfulSyncStarted with lastSyncStarted (${this.state.lastSyncStarted}).`);
188
188
  this.state.lastSuccessfulSyncStarted = this.state.lastSyncStarted;
189
189
  this.state.lastSyncStarted = '';
190
+ // Clear pending extraction boundaries now that the cycle is complete
191
+ this.state.pendingWorkersOldest = '';
192
+ this.state.pendingWorkersNewest = '';
193
+ // Update workersOldest and workersNewest boundaries from resolved extraction timestamps.
194
+ // Expand boundaries: workersOldest gets the earliest timestamp, workersNewest gets the latest.
195
+ const extractionStart = this.event.payload.event_context.extract_from;
196
+ const extractionEnd = this.event.payload.event_context.extract_to;
197
+ if (extractionStart &&
198
+ (!this.state.workersOldest ||
199
+ extractionStart < this.state.workersOldest)) {
200
+ console.log(`Updating workersOldest from '${this.state.workersOldest}' to '${extractionStart}'.`);
201
+ this.state.workersOldest = extractionStart;
202
+ }
203
+ if (extractionEnd &&
204
+ (!this.state.workersNewest ||
205
+ extractionEnd > this.state.workersNewest)) {
206
+ console.log(`Updating workersNewest from '${this.state.workersNewest}' to '${extractionEnd}'.`);
207
+ this.state.workersNewest = extractionEnd;
208
+ }
190
209
  }
191
210
  // We want to save the state every time we emit an event, except for the start and delete events
192
211
  if (!constants_1.STATELESS_EVENT_TYPES.includes(this.event.payload.event_type)) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const attachments_streaming_pool_1 = require("../../attachments-streaming/attachments-streaming-pool");
4
+ const constants_1 = require("../../common/constants");
4
5
  const state_1 = require("../../state/state");
5
6
  const test_helpers_1 = require("../../tests/test-helpers");
6
7
  const types_1 = require("../../types");
@@ -660,9 +661,7 @@ describe(worker_adapter_1.WorkerAdapter.name, () => {
660
661
  .fn()
661
662
  .mockResolvedValue(undefined);
662
663
  adapter.uploadAllRepos = jest.fn().mockResolvedValue(undefined);
663
- adapter['loaderReports'] = [
664
- { item_type: 'tasks', [loading_1.ActionType.CREATED]: 5 },
665
- ];
664
+ adapter['loaderReports'] = [{ item_type: 'tasks', [loading_1.ActionType.CREATED]: 5 }];
666
665
  adapter['_processedFiles'] = ['file-1', 'file-2'];
667
666
  await adapter.emit(types_1.LoaderEventType.DataLoadingDone);
668
667
  expect(mockEmit).toHaveBeenCalledWith(expect.objectContaining({
@@ -686,9 +685,7 @@ describe(worker_adapter_1.WorkerAdapter.name, () => {
686
685
  adapter['_artifacts'] = [
687
686
  { id: 'art-1', item_count: 10, item_type: 'issues' },
688
687
  ];
689
- adapter['loaderReports'] = [
690
- { item_type: 'tasks', [loading_1.ActionType.CREATED]: 5 },
691
- ];
688
+ adapter['loaderReports'] = [{ item_type: 'tasks', [loading_1.ActionType.CREATED]: 5 }];
692
689
  adapter['_processedFiles'] = ['file-1'];
693
690
  await adapter.emit('SOME_UNKNOWN_EVENT');
694
691
  const callData = mockEmit.mock.calls[0][0].data;
@@ -744,6 +741,195 @@ describe(worker_adapter_1.WorkerAdapter.name, () => {
744
741
  }
745
742
  });
746
743
  });
744
+ describe('workersOldest / workersNewest boundary updates', () => {
745
+ let mockPostMessage;
746
+ beforeEach(() => {
747
+ const workerThreads = require('node:worker_threads');
748
+ mockPostMessage = jest.fn();
749
+ if (workerThreads.parentPort) {
750
+ jest
751
+ .spyOn(workerThreads.parentPort, 'postMessage')
752
+ .mockImplementation(mockPostMessage);
753
+ }
754
+ else {
755
+ workerThreads.parentPort = { postMessage: mockPostMessage };
756
+ }
757
+ adapter['adapterState'].postState = jest
758
+ .fn()
759
+ .mockResolvedValue(undefined);
760
+ adapter.uploadAllRepos = jest.fn().mockResolvedValue(undefined);
761
+ });
762
+ afterEach(() => {
763
+ jest.restoreAllMocks();
764
+ });
765
+ /**
766
+ * Helper: sets extract_from and extract_to on the event context,
767
+ * resets the emit guard so the adapter can emit again, then emits
768
+ * AttachmentExtractionDone.
769
+ */
770
+ async function emitDone(adapterInstance, extractionStart, extractionEnd) {
771
+ adapterInstance.event.payload.event_context.extract_from =
772
+ extractionStart;
773
+ adapterInstance.event.payload.event_context.extract_to =
774
+ extractionEnd;
775
+ // Reset the emit guard so we can emit multiple times in a single test
776
+ adapterInstance['hasWorkerEmitted'] = false;
777
+ await adapterInstance.emit(types_1.ExtractorEventType.AttachmentExtractionDone, {
778
+ reports: [],
779
+ processed_files: [],
780
+ });
781
+ }
782
+ describe('initial import with UNBOUNDED start', () => {
783
+ it('should set workersOldest to UNBOUNDED_DATE_TIME_VALUE and workersNewest to extraction end', async () => {
784
+ await emitDone(adapter, constants_1.UNBOUNDED_DATE_TIME_VALUE, '2025-06-01T00:00:00.000Z');
785
+ expect(adapter.state.workersOldest).toBe(constants_1.UNBOUNDED_DATE_TIME_VALUE);
786
+ expect(adapter.state.workersNewest).toBe('2025-06-01T00:00:00.000Z');
787
+ });
788
+ });
789
+ describe('reconciliation after UNBOUNDED initial import', () => {
790
+ it('should NOT overwrite workersOldest when reconciliation start is later than sentinel', async () => {
791
+ // Initial import: UNBOUNDED start, NOW end
792
+ await emitDone(adapter, constants_1.UNBOUNDED_DATE_TIME_VALUE, '2025-06-01T00:00:00.000Z');
793
+ // Reconciliation: absolute dates within the range
794
+ await emitDone(adapter, '2025-01-01T00:00:00.000Z', '2025-03-01T00:00:00.000Z');
795
+ expect(adapter.state.workersOldest).toBe(constants_1.UNBOUNDED_DATE_TIME_VALUE);
796
+ expect(adapter.state.workersNewest).toBe('2025-06-01T00:00:00.000Z');
797
+ });
798
+ it('should NOT overwrite workersOldest even when reconciliation start is very early', async () => {
799
+ // Initial import: UNBOUNDED start, NOW end
800
+ await emitDone(adapter, constants_1.UNBOUNDED_DATE_TIME_VALUE, '2025-06-01T00:00:00.000Z');
801
+ // Reconciliation with a very old start date — still later than epoch
802
+ await emitDone(adapter, '1980-01-01T00:00:00.000Z', '1990-01-01T00:00:00.000Z');
803
+ expect(adapter.state.workersOldest).toBe(constants_1.UNBOUNDED_DATE_TIME_VALUE);
804
+ expect(adapter.state.workersNewest).toBe('2025-06-01T00:00:00.000Z');
805
+ });
806
+ });
807
+ describe('forward sync after UNBOUNDED initial import', () => {
808
+ it('should expand workersNewest forward while preserving workersOldest', async () => {
809
+ // Initial import
810
+ await emitDone(adapter, constants_1.UNBOUNDED_DATE_TIME_VALUE, '2025-06-01T00:00:00.000Z');
811
+ // Forward sync: from workersNewest to now
812
+ await emitDone(adapter, '2025-06-01T00:00:00.000Z', '2025-07-01T00:00:00.000Z');
813
+ expect(adapter.state.workersOldest).toBe(constants_1.UNBOUNDED_DATE_TIME_VALUE);
814
+ expect(adapter.state.workersNewest).toBe('2025-07-01T00:00:00.000Z');
815
+ });
816
+ });
817
+ describe('reconciliation with end beyond current newest', () => {
818
+ it('should expand workersNewest when reconciliation end is later', async () => {
819
+ // Initial import
820
+ await emitDone(adapter, constants_1.UNBOUNDED_DATE_TIME_VALUE, '2025-06-01T00:00:00.000Z');
821
+ // Reconciliation with end beyond current newest
822
+ await emitDone(adapter, '2024-01-01T00:00:00.000Z', '2025-08-01T00:00:00.000Z');
823
+ expect(adapter.state.workersOldest).toBe(constants_1.UNBOUNDED_DATE_TIME_VALUE);
824
+ expect(adapter.state.workersNewest).toBe('2025-08-01T00:00:00.000Z');
825
+ });
826
+ });
827
+ describe('first sync with absolute dates (no UNBOUNDED)', () => {
828
+ it('should set both boundaries from the extraction range', async () => {
829
+ await emitDone(adapter, '2025-01-01T00:00:00.000Z', '2025-03-01T00:00:00.000Z');
830
+ expect(adapter.state.workersOldest).toBe('2025-01-01T00:00:00.000Z');
831
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
832
+ });
833
+ });
834
+ describe('reconciliation after absolute initial sync', () => {
835
+ it('should expand workersOldest backward when reconciliation start is earlier', async () => {
836
+ // Initial sync with absolute dates
837
+ await emitDone(adapter, '2025-01-01T00:00:00.000Z', '2025-03-01T00:00:00.000Z');
838
+ // Reconciliation with earlier start
839
+ await emitDone(adapter, '2024-06-01T00:00:00.000Z', '2025-02-01T00:00:00.000Z');
840
+ expect(adapter.state.workersOldest).toBe('2024-06-01T00:00:00.000Z');
841
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
842
+ });
843
+ it('should NOT change boundaries when reconciliation is within existing range', async () => {
844
+ // Initial sync
845
+ await emitDone(adapter, '2025-01-01T00:00:00.000Z', '2025-03-01T00:00:00.000Z');
846
+ // Reconciliation entirely within existing range
847
+ await emitDone(adapter, '2025-01-15T00:00:00.000Z', '2025-02-15T00:00:00.000Z');
848
+ expect(adapter.state.workersOldest).toBe('2025-01-01T00:00:00.000Z');
849
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
850
+ });
851
+ it('should expand both boundaries when reconciliation exceeds both', async () => {
852
+ // Initial sync
853
+ await emitDone(adapter, '2025-01-01T00:00:00.000Z', '2025-03-01T00:00:00.000Z');
854
+ // Reconciliation exceeding both ends
855
+ await emitDone(adapter, '2024-06-01T00:00:00.000Z', '2025-09-01T00:00:00.000Z');
856
+ expect(adapter.state.workersOldest).toBe('2024-06-01T00:00:00.000Z');
857
+ expect(adapter.state.workersNewest).toBe('2025-09-01T00:00:00.000Z');
858
+ });
859
+ });
860
+ describe('multiple forward syncs', () => {
861
+ it('should progressively expand workersNewest while preserving workersOldest', async () => {
862
+ // Initial import
863
+ await emitDone(adapter, constants_1.UNBOUNDED_DATE_TIME_VALUE, '2025-06-01T00:00:00.000Z');
864
+ // First forward sync
865
+ await emitDone(adapter, '2025-06-01T00:00:00.000Z', '2025-07-01T00:00:00.000Z');
866
+ expect(adapter.state.workersNewest).toBe('2025-07-01T00:00:00.000Z');
867
+ // Second forward sync
868
+ await emitDone(adapter, '2025-07-01T00:00:00.000Z', '2025-08-01T00:00:00.000Z');
869
+ expect(adapter.state.workersNewest).toBe('2025-08-01T00:00:00.000Z');
870
+ // workersOldest should remain the sentinel throughout
871
+ expect(adapter.state.workersOldest).toBe(constants_1.UNBOUNDED_DATE_TIME_VALUE);
872
+ });
873
+ });
874
+ describe('non-AttachmentExtractionDone events should NOT update boundaries', () => {
875
+ it('should not update boundaries on DataExtractionDone', async () => {
876
+ adapter.state.workersOldest = '2025-01-01T00:00:00.000Z';
877
+ adapter.state.workersNewest = '2025-03-01T00:00:00.000Z';
878
+ adapter.event.payload.event_context.extract_from =
879
+ '2024-01-01T00:00:00.000Z';
880
+ adapter.event.payload.event_context.extract_to =
881
+ '2025-12-01T00:00:00.000Z';
882
+ await adapter.emit(types_1.ExtractorEventType.DataExtractionDone, {
883
+ reports: [],
884
+ processed_files: [],
885
+ });
886
+ expect(adapter.state.workersOldest).toBe('2025-01-01T00:00:00.000Z');
887
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
888
+ });
889
+ it('should not update boundaries on DataExtractionProgress', async () => {
890
+ adapter.state.workersOldest = '2025-01-01T00:00:00.000Z';
891
+ adapter.state.workersNewest = '2025-03-01T00:00:00.000Z';
892
+ adapter.event.payload.event_context.extract_from =
893
+ '2024-01-01T00:00:00.000Z';
894
+ adapter.event.payload.event_context.extract_to =
895
+ '2025-12-01T00:00:00.000Z';
896
+ await adapter.emit(types_1.ExtractorEventType.DataExtractionProgress, {
897
+ reports: [],
898
+ processed_files: [],
899
+ });
900
+ expect(adapter.state.workersOldest).toBe('2025-01-01T00:00:00.000Z');
901
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
902
+ });
903
+ it('should not update boundaries on MetadataExtractionError', async () => {
904
+ adapter.state.workersOldest = '2025-01-01T00:00:00.000Z';
905
+ adapter.state.workersNewest = '2025-03-01T00:00:00.000Z';
906
+ adapter.event.payload.event_context.extract_from =
907
+ '2024-01-01T00:00:00.000Z';
908
+ adapter.event.payload.event_context.extract_to =
909
+ '2025-12-01T00:00:00.000Z';
910
+ await adapter.emit(types_1.ExtractorEventType.MetadataExtractionError, {
911
+ reports: [],
912
+ processed_files: [],
913
+ });
914
+ expect(adapter.state.workersOldest).toBe('2025-01-01T00:00:00.000Z');
915
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
916
+ });
917
+ it('should not update boundaries on AttachmentExtractionError', async () => {
918
+ adapter.state.workersOldest = '2025-01-01T00:00:00.000Z';
919
+ adapter.state.workersNewest = '2025-03-01T00:00:00.000Z';
920
+ adapter.event.payload.event_context.extract_from =
921
+ '2024-01-01T00:00:00.000Z';
922
+ adapter.event.payload.event_context.extract_to =
923
+ '2025-12-01T00:00:00.000Z';
924
+ await adapter.emit(types_1.ExtractorEventType.AttachmentExtractionError, {
925
+ reports: [],
926
+ processed_files: [],
927
+ });
928
+ expect(adapter.state.workersOldest).toBe('2025-01-01T00:00:00.000Z');
929
+ expect(adapter.state.workersNewest).toBe('2025-03-01T00:00:00.000Z');
930
+ });
931
+ });
932
+ });
747
933
  describe('extractionScope', () => {
748
934
  it('should return empty object by default', () => {
749
935
  expect(adapter.extractionScope).toEqual({});
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,YAAY,EAIZ,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,wBAAsB,kBAAkB,CAAC,cAAc,EAAE,EACvD,KAAK,EACL,YAAY,EACZ,oBAAoB,EACpB,OAAO,GACR,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CA8DjE;AAED,qBAAa,KAAK,CAAC,cAAc;IAC/B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,eAAe,CAAW;IAClC,OAAO,CAAC,SAAS,CA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d,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC;IAenE,IAAI,KAAK,IAAI,YAAY,CAAC,cAAc,CAAC,CAExC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,cAAc,CAAC,EAE5C;IAED,IAAI,eAAe,IAAI,eAAe,CAErC;IAED;;;;OAIG;IACG,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDvD;;;OAGG;IACG,SAAS,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC;IAqDpD;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAqBjE"}
@@ -3,8 +3,26 @@ import { AirdropEvent } from '../types/extraction';
3
3
  import { FileToLoad } from '../types/loading';
4
4
  import { WorkerAdapterOptions } from '../types/workers';
5
5
  export interface SdkState {
6
+ /**
7
+ * @deprecated Use extract_from and extract_to from the event context instead,
8
+ * which are automatically resolved by the SDK from extraction_start_time and extraction_end_time.
9
+ */
6
10
  lastSyncStarted?: string;
11
+ /**
12
+ * @deprecated Use extract_from and extract_to from the event context instead,
13
+ * which are automatically resolved by the SDK from extraction_start_time and extraction_end_time.
14
+ */
7
15
  lastSuccessfulSyncStarted?: string;
16
+ /** The pending (not yet committed) oldest extraction boundary (ISO 8601 timestamp).
17
+ * Set on StartExtractingData, reused across subsequent phases, cleared on AttachmentExtractionDone. */
18
+ pendingWorkersOldest?: string;
19
+ /** The pending (not yet committed) newest extraction boundary (ISO 8601 timestamp).
20
+ * Set on StartExtractingData, reused across subsequent phases, cleared on AttachmentExtractionDone. */
21
+ pendingWorkersNewest?: string;
22
+ /** The oldest point of extraction (ISO 8601 timestamp). */
23
+ workersOldest?: string;
24
+ /** The newest point of extraction (ISO 8601 timestamp). */
25
+ workersNewest?: string;
8
26
  toDevRev?: ToDevRev;
9
27
  fromDevRev?: FromDevRev;
10
28
  snapInVersionId?: string;
@@ -40,6 +58,10 @@ export interface StateInterface<ConnectorState> {
40
58
  export declare const extractionSdkState: {
41
59
  lastSyncStarted: string;
42
60
  lastSuccessfulSyncStarted: string;
61
+ pendingWorkersOldest: string;
62
+ pendingWorkersNewest: string;
63
+ workersOldest: string;
64
+ workersNewest: string;
43
65
  snapInVersionId: string;
44
66
  toDevRev: {
45
67
  attachmentsMetadata: {
@@ -1 +1 @@
1
- {"version":3,"file":"state.interfaces.d.ts","sourceRoot":"","sources":["../../src/state/state.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,QAAQ;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,cAAc,IAAI,cAAc,GAAG,QAAQ,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,mBAAmB,EAAE;QACnB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,+BAA+B,CAAC,EAAE,mBAAmB,EAAE,CAAC;KACzD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;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B,CAAC,EAAE,mBAAmB,EAAE,CAAC;KACzD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc,CAAC,cAAc;IAC5C,KAAK,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAe9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;CAK3B,CAAC"}
@@ -4,6 +4,10 @@ exports.loadingSdkState = exports.extractionSdkState = void 0;
4
4
  exports.extractionSdkState = {
5
5
  lastSyncStarted: '',
6
6
  lastSuccessfulSyncStarted: '',
7
+ pendingWorkersOldest: '',
8
+ pendingWorkersNewest: '',
9
+ workersOldest: '',
10
+ workersNewest: '',
7
11
  snapInVersionId: '',
8
12
  toDevRev: {
9
13
  attachmentsMetadata: {