@devrev/ts-adaas 1.19.1-beta.0 → 1.19.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,10 +14,10 @@ export interface SdkState {
|
|
|
14
14
|
*/
|
|
15
15
|
lastSuccessfulSyncStarted?: string;
|
|
16
16
|
/** The pending (not yet committed) oldest extraction boundary (ISO 8601 timestamp).
|
|
17
|
-
* Set on
|
|
17
|
+
* Set on StartExtractingMetadata, reused across subsequent phases, cleared on AttachmentExtractionDone. */
|
|
18
18
|
pendingWorkersOldest?: string;
|
|
19
19
|
/** The pending (not yet committed) newest extraction boundary (ISO 8601 timestamp).
|
|
20
|
-
* Set on
|
|
20
|
+
* Set on StartExtractingMetadata, reused across subsequent phases, cleared on AttachmentExtractionDone. */
|
|
21
21
|
pendingWorkersNewest?: string;
|
|
22
22
|
/** The oldest point of extraction (ISO 8601 timestamp). */
|
|
23
23
|
workersOldest?: string;
|
|
@@ -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;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;
|
|
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,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;CAe9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;CAK3B,CAAC"}
|
package/dist/state/state.js
CHANGED
|
@@ -62,10 +62,10 @@ async function createAdapterState({ event, initialState, initialDomainMapping, o
|
|
|
62
62
|
console.log(`Setting lastSyncStarted to ${as.state.lastSyncStarted}.`);
|
|
63
63
|
}
|
|
64
64
|
// Resolve extraction timestamps from TimeValue objects, or reuse pending values from a prior invocation.
|
|
65
|
-
// On
|
|
66
|
-
// On all other events: reuse the pending values cached during
|
|
65
|
+
// On StartExtractingMetadata: resolve fresh from TimeValue objects and store in pending state (always overwrite).
|
|
66
|
+
// On all other events: reuse the pending values cached during StartExtractingMetadata.
|
|
67
67
|
const eventContext = event.payload.event_context;
|
|
68
|
-
if (event.payload.event_type === extraction_1.EventType.
|
|
68
|
+
if (event.payload.event_type === extraction_1.EventType.StartExtractingMetadata) {
|
|
69
69
|
const timeFields = [
|
|
70
70
|
{
|
|
71
71
|
source: 'extraction_start_time',
|
|
@@ -100,7 +100,7 @@ async function createAdapterState({ event, initialState, initialDomainMapping, o
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
// Non-
|
|
103
|
+
// Non-StartExtractingMetadata events: reuse pending values from state
|
|
104
104
|
if (as.state.pendingWorkersOldest) {
|
|
105
105
|
eventContext.extract_from = as.state.pendingWorkersOldest;
|
|
106
106
|
console.log(`Reusing pendingWorkersOldest as extract_from: ${as.state.pendingWorkersOldest}.`);
|
package/dist/state/state.test.js
CHANGED
|
@@ -229,7 +229,7 @@ describe(state_1.State.name, () => {
|
|
|
229
229
|
// Arrange: WORKERS_NEWEST type but state has no workersNewest
|
|
230
230
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
231
231
|
payload: {
|
|
232
|
-
event_type: extraction_1.EventType.
|
|
232
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
233
233
|
event_context: {
|
|
234
234
|
extraction_start_time: {
|
|
235
235
|
type: extraction_1.TimeValueType.WORKERS_NEWEST,
|
|
@@ -257,7 +257,7 @@ describe(state_1.State.name, () => {
|
|
|
257
257
|
// Arrange: WORKERS_NEWEST type but state has no workersNewest
|
|
258
258
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
259
259
|
payload: {
|
|
260
|
-
event_type: extraction_1.EventType.
|
|
260
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
261
261
|
event_context: {
|
|
262
262
|
extraction_start_time: {
|
|
263
263
|
type: extraction_1.TimeValueType.UNBOUNDED,
|
|
@@ -293,7 +293,7 @@ describe(state_1.State.name, () => {
|
|
|
293
293
|
snap_in_version_id: 'test_snap_in_version_id',
|
|
294
294
|
},
|
|
295
295
|
payload: {
|
|
296
|
-
event_type: extraction_1.EventType.
|
|
296
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
297
297
|
event_context: {
|
|
298
298
|
extraction_start_time: {},
|
|
299
299
|
extraction_end_time: {
|
|
@@ -327,7 +327,7 @@ describe(state_1.State.name, () => {
|
|
|
327
327
|
snap_in_version_id: 'test_snap_in_version_id',
|
|
328
328
|
},
|
|
329
329
|
payload: {
|
|
330
|
-
event_type: extraction_1.EventType.
|
|
330
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
331
331
|
event_context: {
|
|
332
332
|
extraction_start_time: {
|
|
333
333
|
type: extraction_1.TimeValueType.ABSOLUTE_TIME,
|
|
@@ -360,7 +360,7 @@ describe(state_1.State.name, () => {
|
|
|
360
360
|
snap_in_version_id: 'test_snap_in_version_id',
|
|
361
361
|
},
|
|
362
362
|
payload: {
|
|
363
|
-
event_type: extraction_1.EventType.
|
|
363
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
364
364
|
event_context: {
|
|
365
365
|
extraction_start_time: {
|
|
366
366
|
value: 'some-value',
|
|
@@ -393,7 +393,7 @@ describe(state_1.State.name, () => {
|
|
|
393
393
|
// Arrange: start is after end (inverted window)
|
|
394
394
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
395
395
|
payload: {
|
|
396
|
-
event_type: extraction_1.EventType.
|
|
396
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
397
397
|
event_context: {
|
|
398
398
|
extraction_start_time: {
|
|
399
399
|
type: extraction_1.TimeValueType.ABSOLUTE_TIME,
|
|
@@ -424,7 +424,7 @@ describe(state_1.State.name, () => {
|
|
|
424
424
|
// Arrange: start equals end (zero-width window)
|
|
425
425
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
426
426
|
payload: {
|
|
427
|
-
event_type: extraction_1.EventType.
|
|
427
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
428
428
|
event_context: {
|
|
429
429
|
extraction_start_time: {
|
|
430
430
|
type: extraction_1.TimeValueType.ABSOLUTE_TIME,
|
|
@@ -455,7 +455,7 @@ describe(state_1.State.name, () => {
|
|
|
455
455
|
// Arrange: valid window
|
|
456
456
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
457
457
|
payload: {
|
|
458
|
-
event_type: extraction_1.EventType.
|
|
458
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
459
459
|
event_context: {
|
|
460
460
|
extraction_start_time: {
|
|
461
461
|
type: extraction_1.TimeValueType.ABSOLUTE_TIME,
|
|
@@ -486,7 +486,7 @@ describe(state_1.State.name, () => {
|
|
|
486
486
|
// Arrange: only start, no end
|
|
487
487
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
488
488
|
payload: {
|
|
489
|
-
event_type: extraction_1.EventType.
|
|
489
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
490
490
|
event_context: {
|
|
491
491
|
extraction_start_time: {
|
|
492
492
|
type: extraction_1.TimeValueType.ABSOLUTE_TIME,
|
|
@@ -513,7 +513,7 @@ describe(state_1.State.name, () => {
|
|
|
513
513
|
// Arrange: UNBOUNDED start (epoch) with a real ABSOLUTE end timestamp
|
|
514
514
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
515
515
|
payload: {
|
|
516
|
-
event_type: extraction_1.EventType.
|
|
516
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
517
517
|
event_context: {
|
|
518
518
|
extraction_start_time: {
|
|
519
519
|
type: extraction_1.TimeValueType.UNBOUNDED,
|
|
@@ -549,14 +549,14 @@ describe(state_1.State.name, () => {
|
|
|
549
549
|
afterEach(() => {
|
|
550
550
|
jest.useRealTimers();
|
|
551
551
|
});
|
|
552
|
-
it('should store resolved values in pendingWorkersOldest/pendingWorkersNewest on
|
|
552
|
+
it('should store resolved values in pendingWorkersOldest/pendingWorkersNewest on StartExtractingMetadata', async () => {
|
|
553
553
|
// Arrange
|
|
554
554
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
555
555
|
context: {
|
|
556
556
|
snap_in_version_id: '',
|
|
557
557
|
},
|
|
558
558
|
payload: {
|
|
559
|
-
event_type: extraction_1.EventType.
|
|
559
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
560
560
|
event_context: {
|
|
561
561
|
extraction_start_time: {
|
|
562
562
|
type: extraction_1.TimeValueType.UNBOUNDED,
|
|
@@ -586,7 +586,7 @@ describe(state_1.State.name, () => {
|
|
|
586
586
|
expect(event.payload.event_context.extract_from).toBe('1970-01-01T00:00:00.000Z');
|
|
587
587
|
expect(event.payload.event_context.extract_to).toBe(FIXED_NOW);
|
|
588
588
|
});
|
|
589
|
-
it('should overwrite pending values on a retry (new
|
|
589
|
+
it('should overwrite pending values on a retry (new StartExtractingMetadata after failure)', async () => {
|
|
590
590
|
// Arrange: state has stale pending values from a previous failed attempt
|
|
591
591
|
const staleOldest = '2026-03-25T08:00:00.000Z';
|
|
592
592
|
const staleNewest = '2026-03-25T09:00:00.000Z';
|
|
@@ -595,7 +595,7 @@ describe(state_1.State.name, () => {
|
|
|
595
595
|
snap_in_version_id: 'test_snap_in_version_id',
|
|
596
596
|
},
|
|
597
597
|
payload: {
|
|
598
|
-
event_type: extraction_1.EventType.
|
|
598
|
+
event_type: extraction_1.EventType.StartExtractingMetadata,
|
|
599
599
|
event_context: {
|
|
600
600
|
extraction_start_time: {
|
|
601
601
|
type: extraction_1.TimeValueType.UNBOUNDED,
|
|
@@ -625,7 +625,7 @@ describe(state_1.State.name, () => {
|
|
|
625
625
|
expect(state.state.pendingWorkersNewest).not.toBe(staleNewest);
|
|
626
626
|
});
|
|
627
627
|
it('should reuse pending values from state on ContinueExtractingData instead of re-resolving', async () => {
|
|
628
|
-
// Arrange: state has pending values from a prior
|
|
628
|
+
// Arrange: state has pending values from a prior StartExtractingMetadata phase
|
|
629
629
|
const pendingOldest = '1970-01-01T00:00:00.000Z';
|
|
630
630
|
const pendingNewest = '2026-03-26T08:00:00.000Z'; // Earlier than FIXED_NOW
|
|
631
631
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
|
@@ -689,7 +689,7 @@ describe(state_1.State.name, () => {
|
|
|
689
689
|
expect(event.payload.event_context.extract_to).toBeUndefined();
|
|
690
690
|
});
|
|
691
691
|
it('should reuse pending values on StartExtractingAttachments', async () => {
|
|
692
|
-
// Arrange: state has pending values from the
|
|
692
|
+
// Arrange: state has pending values from the StartExtractingMetadata phase
|
|
693
693
|
const pendingOldest = '1970-01-01T00:00:00.000Z';
|
|
694
694
|
const pendingNewest = '2026-03-26T08:00:00.000Z';
|
|
695
695
|
const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
|
package/package.json
CHANGED