@devrev/ts-adaas 1.20.2-beta.4 → 1.20.2-beta.5

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,CA8KjE;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,CAqLjE;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"}
@@ -126,10 +126,14 @@ async function createAdapterState({ event, initialState, initialDomainMapping, o
126
126
  }
127
127
  else {
128
128
  // Non-StartExtractingMetadata events: reuse pending values from state
129
- if (eventContext.extract_from === undefined &&
130
- as.state.pendingWorkersOldest) {
131
- overrideExtractFrom(as.state.pendingWorkersOldest);
132
- console.log(`Reusing pendingWorkersOldest as extract_from: ${as.state.pendingWorkersOldest}.`);
129
+ const pendingExtractFrom = as.state.pendingWorkersOldest || as.state.lastSuccessfulSyncStarted;
130
+ if (pendingExtractFrom &&
131
+ (eventContext.extract_from === undefined ||
132
+ eventContext.extract_from !== pendingExtractFrom)) {
133
+ overrideExtractFrom(pendingExtractFrom);
134
+ console.log(`Using ${as.state.pendingWorkersOldest
135
+ ? 'pendingWorkersOldest'
136
+ : 'lastSuccessfulSyncStarted'} as extract_from: ${pendingExtractFrom}.`);
133
137
  }
134
138
  else {
135
139
  console.log('pendingWorkersOldest is not set in state. extract_from will not be populated for this invocation.');
@@ -228,6 +228,35 @@ describe('State — TimeValue resolution', () => {
228
228
  expect(event.payload.event_context.extract_from).toBe(lastSuccessfulSyncStarted);
229
229
  expect(state.state.pendingWorkersOldest).toBe(lastSuccessfulSyncStarted);
230
230
  });
231
+ it('should override platform extract_from on StartExtractingData and preserve its original value', async () => {
232
+ const platformExtractFrom = '2026-08-24T13:26:15.388Z';
233
+ const lastSuccessfulSyncStarted = '2026-08-25T13:26:15.388Z';
234
+ const event = (0, test_utils_1.createMockEvent)(jest_setup_1.mockServer.baseUrl, {
235
+ context: {
236
+ snap_in_version_id: 'test_snap_in_version_id',
237
+ },
238
+ payload: {
239
+ event_type: extraction_1.EventType.StartExtractingData,
240
+ event_context: {
241
+ extract_from: platformExtractFrom,
242
+ extraction_start_time: {},
243
+ },
244
+ },
245
+ });
246
+ fetchStateSpy.mockResolvedValue({
247
+ state: JSON.stringify({
248
+ snapInVersionId: 'test_snap_in_version_id',
249
+ lastSuccessfulSyncStarted,
250
+ }),
251
+ });
252
+ await (0, state_1.createAdapterState)({
253
+ event,
254
+ initialState: {},
255
+ initialDomainMapping: {},
256
+ });
257
+ expect(event.payload.event_context.extract_from).toBe(lastSuccessfulSyncStarted);
258
+ expect(event.payload.event_context.platform_extract_from).toBe(platformExtractFrom);
259
+ });
231
260
  it('should skip resolution when extraction_end_time has no type', async () => {
232
261
  // Arrange: platform sends extraction_end_time without a type field
233
262
  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.4",
3
+ "version": "1.20.2-beta.5",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",