Add support for Control Protocol V2#144
Conversation
Removed extraction time direction, as that's not needed because we get both times provided to us.
and fixed tests that were testing this. Also added multiple tests, that do different actions in order, to verify that the state stays as it should.
|
Is the I do have one more question about how and who defines the values that are the source of I would like to highlight the edge cases where
If the
It sounds complicated, but it could potentially be solved by saving both the window and work timestamps.
I know this complicated, but it might be good to first start storing |
# Conflicts: # src/multithreading/worker-adapter/worker-adapter.test.ts # src/state/state.test.ts
Description
This PR implements the Enhanced Control Protocol V2 for the ADaaS SDK. It introduces a time-value resolution system where the platform sends
TimeValueobjects describing extraction time boundaries, and the SDK resolves them into concrete ISO 8601 timestamps for the developer. The SDK also tracks extraction boundaries (workers_oldest/workers_newest) in persisted state, enabling windowed and incremental extraction scenarios.Old Code (Deprecated)
New Code (Recommended)
How It Works
extraction_start_timeandextraction_end_timeasTimeValueobjects (e.g.{ type: "workers_newest" }or{ type: "absolute", value: "2026-01-01T00:00:00Z" })workers_oldest,workers_newest) and writes concrete ISO 8601 timestamps toextraction_startandextraction_endextraction_start/extraction_end— no awareness ofTimeValueneededworkers_oldest/workers_newestboundaries on extraction completionSupported TimeValue Types
absolute_timecurrent_timeunboundedundefined— no bound, extract all availableworkers_oldestworkers_newestworkers_oldest_minus_window7d,2m) fromworkers_oldestworkers_newest_plus_windowworkers_newestScenario: Initial Import — periodic sync from last known point
Scenario: Normal Import — periodic sync from last known point
Scenario: POC Import — from a specific date to now
Scenario: Computer Import — historical with window
Scenario: Reconciliation — specific date range
What's New
TimeValueTypeenum +TimeValueinterface: New types for platform-to-SDK time communication (7 time value types)EventContext: Addedextraction_start_time/extraction_end_time(rawTimeValuefrom platform), andextraction_start/extraction_end(resolved ISO 8601 strings for developers). Deprecatedextract_from,reset_extract_from, and updatedreset_extractiondeprecation message.SdkState: Addedworkers_oldest,workers_newest— SDK manages these automaticallysrc/common/time-value-resolver.tswith duration parsing (7d,2m,1y) and time value resolution against worker stateworkers_oldest/workers_neweston extraction completion based on directionConnected Issues
Checklist
npm run testOR no tests needed.npm run test:backwards-compatibility.npm run lint.