@devrev/ts-adaas 1.20.2-beta.0 → 1.20.2-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.
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAYA,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,CA6IjE;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,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;gBAEd,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"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAYA,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,CAsJjE;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,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;gBAEd,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"}
@@ -97,6 +97,12 @@ async function createAdapterState({ event, initialState, initialDomainMapping, o
97
97
  process.exit(1);
98
98
  }
99
99
  }
100
+ else if (target === 'extract_from' &&
101
+ as.state.lastSuccessfulSyncStarted) {
102
+ eventContext.extract_from = as.state.lastSuccessfulSyncStarted;
103
+ as.state.pendingWorkersOldest = as.state.lastSuccessfulSyncStarted;
104
+ console.log(`Using lastSuccessfulSyncStarted as extract_from: ${as.state.lastSuccessfulSyncStarted}.`);
105
+ }
100
106
  }
101
107
  }
102
108
  else {
@@ -106,6 +106,36 @@ describe('State — TimeValue resolution', () => {
106
106
  expect(event.payload.event_context.extract_to).toBe('2025-06-01T00:00:00.000Z');
107
107
  expect(state.state.pendingWorkersNewest).toBe('2025-06-01T00:00:00.000Z');
108
108
  });
109
+ it('should use lastSuccessfulSyncStarted for extract_from when extraction_start_time has no type', async () => {
110
+ // Arrange: platform sends an empty extraction_start_time on a subsequent sync
111
+ const lastSuccessfulSyncStarted = '2025-05-01T00:00:00.000Z';
112
+ const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
113
+ context: {
114
+ snap_in_version_id: 'test_snap_in_version_id',
115
+ },
116
+ payload: {
117
+ event_type: extraction_1.EventType.StartExtractingMetadata,
118
+ event_context: {
119
+ extraction_start_time: {},
120
+ },
121
+ },
122
+ });
123
+ fetchStateSpy.mockResolvedValue({
124
+ state: JSON.stringify({
125
+ snapInVersionId: 'test_snap_in_version_id',
126
+ lastSuccessfulSyncStarted,
127
+ }),
128
+ });
129
+ // Act
130
+ const state = await (0, state_1.createAdapterState)({
131
+ event,
132
+ initialState: {},
133
+ initialDomainMapping: {},
134
+ });
135
+ // Assert: the fallback is also stored for the following data phase
136
+ expect(event.payload.event_context.extract_from).toBe(lastSuccessfulSyncStarted);
137
+ expect(state.state.pendingWorkersOldest).toBe(lastSuccessfulSyncStarted);
138
+ });
109
139
  it('should skip resolution when extraction_end_time has no type', async () => {
110
140
  // Arrange: platform sends extraction_end_time without a type field
111
141
  const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.20.2-beta.0",
3
+ "version": "1.20.2-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",