@devrev/airsync-sdk 2.0.0-beta.4 → 2.0.0-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.
Files changed (112) hide show
  1. package/MIGRATION.md +1028 -0
  2. package/dist/attachments-streaming/attachments-streaming-pool.d.ts +6 -0
  3. package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
  4. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts +2 -2
  5. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts.map +1 -1
  6. package/dist/attachments-streaming/attachments-streaming-pool.js +47 -21
  7. package/dist/common/constants.d.ts +3 -5
  8. package/dist/common/constants.d.ts.map +1 -1
  9. package/dist/common/constants.js +4 -6
  10. package/dist/common/helpers.d.ts +3 -21
  11. package/dist/common/helpers.d.ts.map +1 -1
  12. package/dist/common/helpers.js +6 -15
  13. package/dist/http/client.d.ts.map +1 -1
  14. package/dist/http/client.js +4 -8
  15. package/dist/index.d.ts +11 -11
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +11 -18
  18. package/dist/logger/logger.d.ts +8 -63
  19. package/dist/logger/logger.d.ts.map +1 -1
  20. package/dist/logger/logger.interfaces.d.ts +0 -1
  21. package/dist/logger/logger.interfaces.d.ts.map +1 -1
  22. package/dist/logger/logger.js +14 -93
  23. package/dist/mappers/mappers.d.ts +2 -40
  24. package/dist/mappers/mappers.d.ts.map +1 -1
  25. package/dist/mappers/mappers.interfaces.d.ts +35 -154
  26. package/dist/mappers/mappers.interfaces.d.ts.map +1 -1
  27. package/dist/mappers/mappers.interfaces.js +1 -10
  28. package/dist/mappers/mappers.js +2 -40
  29. package/dist/multithreading/adapters/base-adapter.d.ts +19 -36
  30. package/dist/multithreading/adapters/base-adapter.d.ts.map +1 -1
  31. package/dist/multithreading/adapters/base-adapter.js +73 -71
  32. package/dist/multithreading/adapters/extraction-adapter.d.ts +12 -24
  33. package/dist/multithreading/adapters/extraction-adapter.d.ts.map +1 -1
  34. package/dist/multithreading/adapters/extraction-adapter.js +199 -200
  35. package/dist/multithreading/adapters/loading-adapter.d.ts +1 -6
  36. package/dist/multithreading/adapters/loading-adapter.d.ts.map +1 -1
  37. package/dist/multithreading/adapters/loading-adapter.helpers.d.ts +2 -12
  38. package/dist/multithreading/adapters/loading-adapter.helpers.d.ts.map +1 -1
  39. package/dist/multithreading/adapters/loading-adapter.helpers.js +2 -12
  40. package/dist/multithreading/adapters/loading-adapter.js +292 -314
  41. package/dist/multithreading/emit.d.ts +3 -2
  42. package/dist/multithreading/emit.d.ts.map +1 -1
  43. package/dist/multithreading/emit.js +3 -5
  44. package/dist/multithreading/process-task.d.ts +2 -12
  45. package/dist/multithreading/process-task.d.ts.map +1 -1
  46. package/dist/multithreading/process-task.js +45 -59
  47. package/dist/multithreading/spawn/spawn.d.ts +3 -9
  48. package/dist/multithreading/spawn/spawn.d.ts.map +1 -1
  49. package/dist/multithreading/spawn/spawn.helpers.d.ts +6 -25
  50. package/dist/multithreading/spawn/spawn.helpers.d.ts.map +1 -1
  51. package/dist/multithreading/spawn/spawn.helpers.js +7 -49
  52. package/dist/multithreading/spawn/spawn.js +18 -33
  53. package/dist/multithreading/worker.js +2 -4
  54. package/dist/repo/repo.d.ts +10 -0
  55. package/dist/repo/repo.d.ts.map +1 -1
  56. package/dist/repo/repo.helpers.d.ts +6 -0
  57. package/dist/repo/repo.helpers.d.ts.map +1 -0
  58. package/dist/repo/repo.helpers.js +16 -0
  59. package/dist/repo/repo.interfaces.d.ts +4 -16
  60. package/dist/repo/repo.interfaces.d.ts.map +1 -1
  61. package/dist/repo/repo.js +23 -8
  62. package/dist/state/base-state.d.ts +14 -36
  63. package/dist/state/base-state.d.ts.map +1 -1
  64. package/dist/state/base-state.js +16 -38
  65. package/dist/state/extraction-state.d.ts +4 -19
  66. package/dist/state/extraction-state.d.ts.map +1 -1
  67. package/dist/state/extraction-state.js +6 -23
  68. package/dist/state/install-initial-domain-mapping.d.ts +1 -1
  69. package/dist/state/install-initial-domain-mapping.d.ts.map +1 -1
  70. package/dist/state/install-initial-domain-mapping.js +1 -3
  71. package/dist/state/loading-state.d.ts +1 -11
  72. package/dist/state/loading-state.d.ts.map +1 -1
  73. package/dist/state/loading-state.js +2 -12
  74. package/dist/state/state.d.ts +2 -2
  75. package/dist/state/state.d.ts.map +1 -1
  76. package/dist/state/state.interfaces.d.ts +10 -24
  77. package/dist/state/state.interfaces.d.ts.map +1 -1
  78. package/dist/state/state.interfaces.js +9 -11
  79. package/dist/state/state.js +3 -3
  80. package/dist/state/time-value-resolver.d.ts +7 -36
  81. package/dist/state/time-value-resolver.d.ts.map +1 -1
  82. package/dist/state/time-value-resolver.js +7 -40
  83. package/dist/testing/mock-event.d.ts +2 -10
  84. package/dist/testing/mock-event.d.ts.map +1 -1
  85. package/dist/testing/mock-event.js +3 -11
  86. package/dist/testing/mock-server.d.ts +4 -27
  87. package/dist/testing/mock-server.d.ts.map +1 -1
  88. package/dist/testing/mock-server.interfaces.d.ts +10 -35
  89. package/dist/testing/mock-server.interfaces.d.ts.map +1 -1
  90. package/dist/testing/mock-server.js +19 -36
  91. package/dist/types/common.d.ts +1 -12
  92. package/dist/types/common.d.ts.map +1 -1
  93. package/dist/types/common.js +1 -6
  94. package/dist/types/external-domain-metadata.d.ts +30 -171
  95. package/dist/types/external-domain-metadata.d.ts.map +1 -1
  96. package/dist/types/extraction.d.ts +35 -120
  97. package/dist/types/extraction.d.ts.map +1 -1
  98. package/dist/types/extraction.js +5 -31
  99. package/dist/types/loading.d.ts.map +1 -1
  100. package/dist/types/workers.d.ts +18 -116
  101. package/dist/types/workers.d.ts.map +1 -1
  102. package/dist/types/workers.js +0 -6
  103. package/dist/uploader/uploader.d.ts +6 -58
  104. package/dist/uploader/uploader.d.ts.map +1 -1
  105. package/dist/uploader/uploader.helpers.d.ts +4 -27
  106. package/dist/uploader/uploader.helpers.d.ts.map +1 -1
  107. package/dist/uploader/uploader.helpers.js +64 -30
  108. package/dist/uploader/uploader.interfaces.d.ts +15 -25
  109. package/dist/uploader/uploader.interfaces.d.ts.map +1 -1
  110. package/dist/uploader/uploader.interfaces.js +8 -0
  111. package/dist/uploader/uploader.js +18 -84
  112. package/package.json +6 -4
@@ -1,10 +1,11 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { AirSyncEvent, EventData, ExtractorEventType } from '../types/extraction';
2
+ import { AirSyncEvent, EventData, ExtractorEventType, WorkerMetadata } from '../types/extraction';
3
3
  import { LoaderEventType } from '../types/loading';
4
4
  export interface EmitInterface {
5
5
  event: AirSyncEvent;
6
6
  eventType: ExtractorEventType | LoaderEventType;
7
7
  data?: EventData;
8
+ worker_metadata?: WorkerMetadata;
8
9
  }
9
- export declare const emit: ({ event, eventType, data, }: EmitInterface) => Promise<AxiosResponse>;
10
+ export declare const emit: ({ event, eventType, data, worker_metadata, }: EmitInterface) => Promise<AxiosResponse>;
10
11
  //# sourceMappingURL=emit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/multithreading/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,SAAS,EAET,kBAAkB,EAEnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAChD,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,IAAI,GAAU,6BAIxB,aAAa,KAAG,OAAO,CAAC,aAAa,CA4BvC,CAAC"}
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/multithreading/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,EACL,YAAY,EACZ,SAAS,EAET,kBAAkB,EAElB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAChD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,cAAc,CAAC;CAClC;AAED,eAAO,MAAM,IAAI,GAAU,8CAKxB,aAAa,KAAG,OAAO,CAAC,aAAa,CA+BvC,CAAC"}
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.emit = void 0;
4
- const client_1 = require("../http/client");
5
4
  const constants_1 = require("../common/constants");
6
- const emit = async ({ event, eventType, data, }) => {
5
+ const client_1 = require("../http/client");
6
+ const emit = async ({ event, eventType, data, worker_metadata, }) => {
7
7
  const newEvent = {
8
8
  event_type: eventType,
9
9
  event_context: event.payload.event_context,
10
10
  event_data: Object.assign({}, data),
11
- worker_metadata: {
12
- adaas_library_version: constants_1.LIBRARY_VERSION,
13
- },
11
+ worker_metadata: Object.assign(Object.assign({}, worker_metadata), { newest_state_date: event.payload.event_context.extract_to, oldest_state_date: event.payload.event_context.extract_from, adaas_library_version: constants_1.LIBRARY_VERSION }),
14
12
  };
15
13
  console.info('Emitting event', newEvent);
16
14
  return client_1.axiosClient.post(event.payload.event_context.callback_url, Object.assign({}, newEvent), {
@@ -1,18 +1,8 @@
1
1
  import { ProcessTaskInterface } from '../types/workers';
2
2
  import { ExtractionAdapter } from './adapters/extraction-adapter';
3
3
  import { LoadingAdapter } from './adapters/loading-adapter';
4
- /**
5
- * Entry point for an extraction worker. Builds an {@link ExtractionAdapter} and
6
- * runs the provided task against it.
7
- *
8
- * @public
9
- */
4
+ /** Entry point for an extraction worker. @public */
10
5
  export declare function processExtractionTask<ConnectorState>({ task, onTimeout, }: ProcessTaskInterface<ExtractionAdapter<ConnectorState>>): void;
11
- /**
12
- * Entry point for a loading worker. Builds a {@link LoadingAdapter} and runs the
13
- * provided task against it.
14
- *
15
- * @public
16
- */
6
+ /** Entry point for a loading worker. @public */
17
7
  export declare function processLoadingTask<ConnectorState>({ task, onTimeout, }: ProcessTaskInterface<LoadingAdapter<ConnectorState>>): void;
18
8
  //# sourceMappingURL=process-task.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,oBAAoB,EAIrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAoE5D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,EACpD,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,QA6BzD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,EACjD,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,QA6BtD"}
1
+ {"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,oBAAoB,EAIrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA6D5D,oDAAoD;AACpD,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,EACpD,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,QA6BzD;AAED,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,EACjD,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,QA6BtD"}
@@ -9,66 +9,57 @@ const loading_state_1 = require("../state/loading-state");
9
9
  const workers_1 = require("../types/workers");
10
10
  const extraction_adapter_1 = require("./adapters/extraction-adapter");
11
11
  const loading_adapter_1 = require("./adapters/loading-adapter");
12
+ const spawn_helpers_1 = require("./spawn/spawn.helpers");
12
13
  /**
13
- * Shared worker-thread driver. Builds the logger context, runs the task and
14
- * (on timeout) the onTimeout callback against the provided adapter, maps the
15
- * returned {@link TaskResult} to a platform event and emits it exactly once,
16
- * and wires the error/exit plumbing.
17
- *
18
- * The adapter is constructed by the caller so each entry point can build its
19
- * own typed adapter.
20
- *
21
- * If `onTimeout` is omitted, the SDK emits a phase-appropriate default on
22
- * timeout: `progress` (resumable phases) or `error` (non-resumable phases) is
23
- * handled by the status->event mapping when we emit a `progress` result.
24
- *
25
- * On timeout the timeout outcome always wins: once the soft timeout has fired,
26
- * the SDK emits the `onTimeout` result (or the default `progress`) and ignores
27
- * whatever the task returned, because a phase that ran out of time must hand off
28
- * for continuation rather than report itself complete.
14
+ * Shared worker-thread driver: builds the adapter, runs the task, maps the
15
+ * returned {@link TaskResult} to a platform event and emits it exactly once.
16
+ * On soft timeout the timeout outcome always wins: the `onTimeout` result (or
17
+ * a phase-appropriate default) is emitted and the task's return value is
18
+ * ignored.
29
19
  */
30
20
  async function runWorkerTask(buildAdapter, { task, onTimeout }) {
31
- await (0, logger_1.runWithSdkLogContext)(async () => {
32
- try {
33
- const adapter = await buildAdapter();
34
- node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
35
- if (message.subject !== workers_1.WorkerMessageSubject.WorkerMessageExit) {
36
- return;
37
- }
38
- console.log('Timeout received. Waiting for the task to finish.');
39
- adapter.isTimeout = true;
40
- });
41
- let result = await (0, logger_1.runWithUserLogContext)(async () => task({ adapter }));
42
- // If the soft timeout fired, the timeout outcome wins regardless of what
43
- // the task returned: hand off via onTimeout (or the default progress
44
- // result) so the phase continues in a fresh invocation.
45
- if (adapter.isTimeout) {
46
- result = onTimeout
47
- ? await (0, logger_1.runWithUserLogContext)(async () => onTimeout({ adapter }))
21
+ try {
22
+ const adapter = await buildAdapter();
23
+ node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
24
+ if (message.subject !== workers_1.WorkerMessageSubject.WorkerMessageExit) {
25
+ return;
26
+ }
27
+ console.log('Timeout received. Waiting for the task to finish.');
28
+ adapter.isTimeout = true;
29
+ });
30
+ let result = await task({ adapter });
31
+ if (adapter.isTimeout) {
32
+ if (onTimeout) {
33
+ result = await onTimeout({ adapter });
34
+ }
35
+ else {
36
+ // Non-resumable phases can't hand off with `progress`; report a timeout error.
37
+ const eventType = adapter.event.payload.event_type;
38
+ const { illegal } = (0, spawn_helpers_1.getEventTypeForResult)(eventType, 'progress');
39
+ result = illegal
40
+ ? {
41
+ status: 'error',
42
+ error: {
43
+ message: `Worker timed out during a non-resumable phase (${eventType}), which cannot be continued.`,
44
+ },
45
+ }
48
46
  : { status: 'progress' };
49
47
  }
50
- await adapter.emitFromResult(result);
51
- process.exit(0);
52
48
  }
53
- catch (error) {
54
- (0, logger_1.runWithUserLogContext)(() => {
55
- const errorMessage = `Error while processing task. ${(0, logger_1.serializeError)(error)}`;
56
- console.error(errorMessage);
57
- node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.postMessage({
58
- subject: workers_1.WorkerMessageSubject.WorkerMessageFailed,
59
- payload: { message: errorMessage },
60
- });
61
- process.exit(1);
62
- });
63
- }
64
- });
49
+ await adapter.emitFromResult(result);
50
+ process.exit(0);
51
+ }
52
+ catch (error) {
53
+ const errorMessage = `Error while processing task. ${(0, logger_1.serializeError)(error)}`;
54
+ console.error(errorMessage);
55
+ node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.postMessage({
56
+ subject: workers_1.WorkerMessageSubject.WorkerMessageFailed,
57
+ payload: { message: errorMessage },
58
+ });
59
+ process.exit(1);
60
+ }
65
61
  }
66
- /**
67
- * Entry point for an extraction worker. Builds an {@link ExtractionAdapter} and
68
- * runs the provided task against it.
69
- *
70
- * @public
71
- */
62
+ /** Entry point for an extraction worker. @public */
72
63
  function processExtractionTask({ task, onTimeout, }) {
73
64
  if (node_worker_threads_1.isMainThread) {
74
65
  return;
@@ -93,12 +84,7 @@ function processExtractionTask({ task, onTimeout, }) {
93
84
  });
94
85
  }, { task, onTimeout });
95
86
  }
96
- /**
97
- * Entry point for a loading worker. Builds a {@link LoadingAdapter} and runs the
98
- * provided task against it.
99
- *
100
- * @public
101
- */
87
+ /** Entry point for a loading worker. @public */
102
88
  function processLoadingTask({ task, onTimeout, }) {
103
89
  if (node_worker_threads_1.isMainThread) {
104
90
  return;
@@ -1,14 +1,8 @@
1
1
  import { SpawnFactoryInterface, SpawnInterface } from '../../types/workers';
2
2
  /**
3
- * Creates a new instance of Spawn class.
4
- * Spawn class is responsible for spawning a new worker thread and managing the lifecycle of the worker.
5
- * The class provides utilities to emit control events to the platform and exit the worker gracefully.
6
- * In case of lambda timeout, the class emits a lambda timeout event to the platform.
7
- * @param {SpawnFactoryInterface} options - The options to create a new instance of Spawn class
8
- * @param {AirSyncEvent} options.event - The event object received from the platform
9
- * @param {object} options.initialState - The initial state of the adapter
10
- * @param {string} [options.baseWorkerPath] - The base path for the worker files, usually `__dirname`
11
- * @returns {Promise<Spawn>} - A new instance of Spawn class
3
+ * Spawns a worker thread for the event and manages its lifecycle (control
4
+ * events, graceful exit, lambda timeout handling). Resolves when the worker
5
+ * run is fully finished.
12
6
  */
13
7
  export declare function spawn<ConnectorState>({ event, initialState, initialDomainMapping, options, baseWorkerPath, }: SpawnFactoryInterface<ConnectorState>): Promise<void>;
14
8
  export declare class Spawn {
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AA+C7B;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,mBAAmB,CAAqB;gBACpC,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IAiHjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAoCjC"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AA0C7B;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,mBAAmB,CAAqB;gBACpC,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IA0GjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAoCjC"}
@@ -2,39 +2,20 @@ import { EventType, ExtractorEventType } from '../../types/extraction';
2
2
  import { LoaderEventType } from '../../types/loading';
3
3
  import { TaskStatus } from '../../types/workers';
4
4
  /**
5
- * Resolves the outgoing event type the SDK should emit for a given incoming
6
- * event type and the {@link TaskResult} status a worker returned.
7
- *
8
- * The mapping follows the per-phase contract documented on `TaskResult`:
9
- * resumable phases (data/attachment extraction, data/attachment loading) honor
10
- * every status (success -> *_DONE, progress -> *_PROGRESS, delay -> *_DELAYED,
11
- * error -> *_ERROR); non-resumable phases (external sync units, metadata, state
12
- * deletion) only have a done and an error event, so a `progress`/`delay` status
13
- * there is illegal and is mapped to the phase's error event.
14
- *
15
- * @param eventType - The incoming event type that started this worker.
16
- * @param status - The status the worker's task/onTimeout returned.
17
- * @returns The outgoing extractor/loader event type to emit, plus whether the
18
- * status was illegal for the phase (so the caller can attach a descriptive
19
- * error message).
5
+ * Resolves the outgoing event type to emit for an incoming event type and a
6
+ * {@link TaskResult} status. Resumable phases honor every status
7
+ * (success/progress/delay/error -> *_DONE/*_PROGRESS/*_DELAYED/*_ERROR);
8
+ * non-resumable phases only have done/error, so `progress`/`delay` there is
9
+ * illegal and maps to the phase's error event.
20
10
  */
21
11
  export declare function getEventTypeForResult(eventType: EventType, status: TaskStatus): {
22
12
  eventType: ExtractorEventType | LoaderEventType;
23
13
  illegal: boolean;
24
14
  };
25
- /**
26
- * Gets the event type for the timeout error.
27
- * @param {EventType} eventType - The event type to get the timeout error event type for
28
- * @returns {ExtractorEventType | LoaderEventType} The event type for the timeout error
29
- */
30
15
  export declare function getTimeoutErrorEventType(eventType: EventType): {
31
16
  eventType: ExtractorEventType | LoaderEventType;
32
17
  };
33
- /**
34
- * Gets the event type for the no script error.
35
- * @param {EventType} eventType - The event type to get the no script error event type for
36
- * @returns {ExtractorEventType | LoaderEventType} The event type for the no script error
37
- */
18
+ /** Event type to emit when no worker script exists for the incoming event. */
38
19
  export declare function getNoScriptEventType(eventType: EventType): {
39
20
  eventType: ExtractorEventType | LoaderEventType;
40
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.helpers.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,UAAU,GACjB;IACD,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB,CAiCA;AAoHD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,GAAG;IAC9D,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;CACjD,CA2EA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS;eAwBhB,kBAAkB,GAAG,eAAe;EAG5E"}
1
+ {"version":3,"file":"spawn.helpers.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,UAAU,GACjB;IACD,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB,CAiCA;AAuGD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,GAAG;IAC9D,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;CACjD,CAiEA;AAED,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS;eAwBhB,kBAAkB,GAAG,eAAe;EAG5E"}
@@ -7,21 +7,11 @@ const constants_1 = require("../../common/constants");
7
7
  const extraction_1 = require("../../types/extraction");
8
8
  const loading_1 = require("../../types/loading");
9
9
  /**
10
- * Resolves the outgoing event type the SDK should emit for a given incoming
11
- * event type and the {@link TaskResult} status a worker returned.
12
- *
13
- * The mapping follows the per-phase contract documented on `TaskResult`:
14
- * resumable phases (data/attachment extraction, data/attachment loading) honor
15
- * every status (success -> *_DONE, progress -> *_PROGRESS, delay -> *_DELAYED,
16
- * error -> *_ERROR); non-resumable phases (external sync units, metadata, state
17
- * deletion) only have a done and an error event, so a `progress`/`delay` status
18
- * there is illegal and is mapped to the phase's error event.
19
- *
20
- * @param eventType - The incoming event type that started this worker.
21
- * @param status - The status the worker's task/onTimeout returned.
22
- * @returns The outgoing extractor/loader event type to emit, plus whether the
23
- * status was illegal for the phase (so the caller can attach a descriptive
24
- * error message).
10
+ * Resolves the outgoing event type to emit for an incoming event type and a
11
+ * {@link TaskResult} status. Resumable phases honor every status
12
+ * (success/progress/delay/error -> *_DONE/*_PROGRESS/*_DELAYED/*_ERROR);
13
+ * non-resumable phases only have done/error, so `progress`/`delay` there is
14
+ * illegal and maps to the phase's error event.
25
15
  */
26
16
  function getEventTypeForResult(eventType, status) {
27
17
  const phase = EVENT_PHASE_MAP[eventType];
@@ -52,24 +42,18 @@ function getEventTypeForResult(eventType, status) {
52
42
  return { eventType: phase.error, illegal: false };
53
43
  }
54
44
  }
55
- /**
56
- * Per-phase outgoing event types, keyed by the incoming {@link EventType}.
57
- * `resumable` phases define progress/delayed events; non-resumable ones do not.
58
- */
45
+ /** Per-phase outgoing event types, keyed by the incoming {@link EventType}. */
59
46
  const EVENT_PHASE_MAP = {
60
- // External sync units (non-resumable)
61
47
  [extraction_1.EventType.StartExtractingExternalSyncUnits]: {
62
48
  resumable: false,
63
49
  done: extraction_1.ExtractorEventType.ExternalSyncUnitExtractionDone,
64
50
  error: extraction_1.ExtractorEventType.ExternalSyncUnitExtractionError,
65
51
  },
66
- // Metadata (non-resumable)
67
52
  [extraction_1.EventType.StartExtractingMetadata]: {
68
53
  resumable: false,
69
54
  done: extraction_1.ExtractorEventType.MetadataExtractionDone,
70
55
  error: extraction_1.ExtractorEventType.MetadataExtractionError,
71
56
  },
72
- // Data extraction (resumable)
73
57
  [extraction_1.EventType.StartExtractingData]: {
74
58
  resumable: true,
75
59
  done: extraction_1.ExtractorEventType.DataExtractionDone,
@@ -84,13 +68,11 @@ const EVENT_PHASE_MAP = {
84
68
  progress: extraction_1.ExtractorEventType.DataExtractionProgress,
85
69
  delayed: extraction_1.ExtractorEventType.DataExtractionDelayed,
86
70
  },
87
- // Extractor state deletion (non-resumable)
88
71
  [extraction_1.EventType.StartDeletingExtractorState]: {
89
72
  resumable: false,
90
73
  done: extraction_1.ExtractorEventType.ExtractorStateDeletionDone,
91
74
  error: extraction_1.ExtractorEventType.ExtractorStateDeletionError,
92
75
  },
93
- // Attachment extraction (resumable)
94
76
  [extraction_1.EventType.StartExtractingAttachments]: {
95
77
  resumable: true,
96
78
  done: extraction_1.ExtractorEventType.AttachmentExtractionDone,
@@ -105,13 +87,11 @@ const EVENT_PHASE_MAP = {
105
87
  progress: extraction_1.ExtractorEventType.AttachmentExtractionProgress,
106
88
  delayed: extraction_1.ExtractorEventType.AttachmentExtractionDelayed,
107
89
  },
108
- // Extractor attachments state deletion (non-resumable)
109
90
  [extraction_1.EventType.StartDeletingExtractorAttachmentsState]: {
110
91
  resumable: false,
111
92
  done: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionDone,
112
93
  error: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionError,
113
94
  },
114
- // Data loading (resumable)
115
95
  [extraction_1.EventType.StartLoadingData]: {
116
96
  resumable: true,
117
97
  done: loading_1.LoaderEventType.DataLoadingDone,
@@ -126,7 +106,6 @@ const EVENT_PHASE_MAP = {
126
106
  progress: loading_1.LoaderEventType.DataLoadingProgress,
127
107
  delayed: loading_1.LoaderEventType.DataLoadingDelayed,
128
108
  },
129
- // Attachment loading (resumable)
130
109
  [extraction_1.EventType.StartLoadingAttachments]: {
131
110
  resumable: true,
132
111
  done: loading_1.LoaderEventType.AttachmentLoadingDone,
@@ -141,76 +120,59 @@ const EVENT_PHASE_MAP = {
141
120
  progress: loading_1.LoaderEventType.AttachmentLoadingProgress,
142
121
  delayed: loading_1.LoaderEventType.AttachmentLoadingDelayed,
143
122
  },
144
- // Loader state deletion (non-resumable)
145
123
  [extraction_1.EventType.StartDeletingLoaderState]: {
146
124
  resumable: false,
147
125
  done: loading_1.LoaderEventType.LoaderStateDeletionDone,
148
126
  error: loading_1.LoaderEventType.LoaderStateDeletionError,
149
127
  },
150
- // Loader attachment state deletion (non-resumable)
151
128
  [extraction_1.EventType.StartDeletingLoaderAttachmentState]: {
152
129
  resumable: false,
153
130
  done: loading_1.LoaderEventType.LoaderAttachmentStateDeletionDone,
154
131
  error: loading_1.LoaderEventType.LoaderAttachmentStateDeletionError,
155
132
  },
156
133
  };
157
- /**
158
- * Gets the event type for the timeout error.
159
- * @param {EventType} eventType - The event type to get the timeout error event type for
160
- * @returns {ExtractorEventType | LoaderEventType} The event type for the timeout error
161
- */
162
134
  function getTimeoutErrorEventType(eventType) {
163
135
  switch (eventType) {
164
- // Metadata extraction
165
136
  case extraction_1.EventType.StartExtractingMetadata:
166
137
  return {
167
138
  eventType: extraction_1.ExtractorEventType.MetadataExtractionError,
168
139
  };
169
- // Data extraction
170
140
  case extraction_1.EventType.StartExtractingData:
171
141
  case extraction_1.EventType.ContinueExtractingData:
172
142
  return {
173
143
  eventType: extraction_1.ExtractorEventType.DataExtractionError,
174
144
  };
175
- // Data deletion
176
145
  case extraction_1.EventType.StartDeletingExtractorState:
177
146
  return {
178
147
  eventType: extraction_1.ExtractorEventType.ExtractorStateDeletionError,
179
148
  };
180
- // Attachments extraction
181
149
  case extraction_1.EventType.StartExtractingAttachments:
182
150
  case extraction_1.EventType.ContinueExtractingAttachments:
183
151
  return {
184
152
  eventType: extraction_1.ExtractorEventType.AttachmentExtractionError,
185
153
  };
186
- // Attachments deletion
187
154
  case extraction_1.EventType.StartDeletingExtractorAttachmentsState:
188
155
  return {
189
156
  eventType: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionError,
190
157
  };
191
- // External sync units
192
158
  case extraction_1.EventType.StartExtractingExternalSyncUnits:
193
159
  return {
194
160
  eventType: extraction_1.ExtractorEventType.ExternalSyncUnitExtractionError,
195
161
  };
196
- // Loading data
197
162
  case extraction_1.EventType.StartLoadingData:
198
163
  case extraction_1.EventType.ContinueLoadingData:
199
164
  return {
200
165
  eventType: loading_1.LoaderEventType.DataLoadingError,
201
166
  };
202
- // Deleting loader state
203
167
  case extraction_1.EventType.StartDeletingLoaderState:
204
168
  return {
205
169
  eventType: loading_1.LoaderEventType.LoaderStateDeletionError,
206
170
  };
207
- // Loading attachments
208
171
  case extraction_1.EventType.StartLoadingAttachments:
209
172
  case extraction_1.EventType.ContinueLoadingAttachments:
210
173
  return {
211
174
  eventType: loading_1.LoaderEventType.AttachmentLoadingError,
212
175
  };
213
- // Deleting loader attachment state
214
176
  case extraction_1.EventType.StartDeletingLoaderAttachmentState:
215
177
  return {
216
178
  eventType: loading_1.LoaderEventType.LoaderAttachmentStateDeletionError,
@@ -223,11 +185,7 @@ function getTimeoutErrorEventType(eventType) {
223
185
  };
224
186
  }
225
187
  }
226
- /**
227
- * Gets the event type for the no script error.
228
- * @param {EventType} eventType - The event type to get the no script error event type for
229
- * @returns {ExtractorEventType | LoaderEventType} The event type for the no script error
230
- */
188
+ /** Event type to emit when no worker script exists for the incoming event. */
231
189
  function getNoScriptEventType(eventType) {
232
190
  switch (eventType) {
233
191
  case extraction_1.EventType.StartDeletingExtractorState:
@@ -7,13 +7,13 @@ exports.Spawn = void 0;
7
7
  exports.spawn = spawn;
8
8
  const yargs_1 = __importDefault(require("yargs"));
9
9
  const helpers_1 = require("yargs/helpers");
10
- const emit_1 = require("../emit");
10
+ const constants_1 = require("../../common/constants");
11
11
  const helpers_2 = require("../../common/helpers");
12
12
  const logger_1 = require("../../logger/logger");
13
13
  const extraction_1 = require("../../types/extraction");
14
14
  const workers_1 = require("../../types/workers");
15
- const constants_1 = require("../../common/constants");
16
15
  const create_worker_1 = require("../create-worker");
16
+ const emit_1 = require("../emit");
17
17
  const spawn_helpers_1 = require("./spawn.helpers");
18
18
  function getWorkerPath({ event, workerBasePath, }) {
19
19
  let path = null;
@@ -44,18 +44,11 @@ function getWorkerPath({ event, workerBasePath, }) {
44
44
  return path ? workerBasePath + path : null;
45
45
  }
46
46
  /**
47
- * Creates a new instance of Spawn class.
48
- * Spawn class is responsible for spawning a new worker thread and managing the lifecycle of the worker.
49
- * The class provides utilities to emit control events to the platform and exit the worker gracefully.
50
- * In case of lambda timeout, the class emits a lambda timeout event to the platform.
51
- * @param {SpawnFactoryInterface} options - The options to create a new instance of Spawn class
52
- * @param {AirSyncEvent} options.event - The event object received from the platform
53
- * @param {object} options.initialState - The initial state of the adapter
54
- * @param {string} [options.baseWorkerPath] - The base path for the worker files, usually `__dirname`
55
- * @returns {Promise<Spawn>} - A new instance of Spawn class
47
+ * Spawns a worker thread for the event and manages its lifecycle (control
48
+ * events, graceful exit, lambda timeout handling). Resolves when the worker
49
+ * run is fully finished.
56
50
  */
57
51
  async function spawn({ event, initialState, initialDomainMapping, options, baseWorkerPath, }) {
58
- // Read the command line arguments to check if the local flag is passed.
59
52
  const argv = await (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).argv;
60
53
  if (argv._.includes('local') || argv.local) {
61
54
  options = Object.assign(Object.assign({}, (options || {})), { isLocalDevelopment: true });
@@ -80,7 +73,6 @@ async function spawn({ event, initialState, initialDomainMapping, options, baseW
80
73
  workerBasePath: baseWorkerPath !== null && baseWorkerPath !== void 0 ? baseWorkerPath : __dirname,
81
74
  });
82
75
  }
83
- // If a script is found for the event type, spawn a new worker.
84
76
  if (script) {
85
77
  try {
86
78
  const worker = await (0, create_worker_1.createWorker)({
@@ -130,7 +122,7 @@ class Spawn {
130
122
  ? Math.min(options.timeout, this.defaultLambdaTimeout)
131
123
  : this.defaultLambdaTimeout;
132
124
  this.resolve = resolve;
133
- // If soft timeout is reached, send a message to the worker to gracefully exit.
125
+ // Soft timeout: ask the worker to gracefully exit.
134
126
  this.softTimeoutTimer = setTimeout(() => void (async () => {
135
127
  console.log('SOFT TIMEOUT: Sending a message to the worker to gracefully exit.');
136
128
  this.softTimeoutSent = true;
@@ -144,7 +136,7 @@ class Spawn {
144
136
  await this.exitFromMainThread();
145
137
  }
146
138
  })(), this.lambdaTimeout);
147
- // If hard timeout is reached, that means the worker did not exit in time. Terminate the worker.
139
+ // Hard timeout: the worker did not exit in time, terminate it.
148
140
  this.hardTimeoutTimer = setTimeout(() => void (async () => {
149
141
  console.error('HARD TIMEOUT: Worker did not exit in time. Terminating the worker.');
150
142
  if (worker) {
@@ -155,13 +147,10 @@ class Spawn {
155
147
  await this.exitFromMainThread();
156
148
  }
157
149
  })(), this.lambdaTimeout * constants_1.HARD_TIMEOUT_MULTIPLIER);
158
- // If worker exits with process.exit(code), clear the timeouts and exit from
159
- // main thread. When a soft timeout was sent, we use setImmediate to defer
160
- // processing so that any pending WorkerMessage events (e.g.
161
- // WorkerMessageEmitted from onTimeout) already queued in the event loop are
162
- // handled first, preventing a race condition where exitFromMainThread sees
163
- // alreadyEmitted=false and emits an error even though the worker
164
- // successfully emitted an event.
150
+ // After a soft timeout, defer exit handling via setImmediate so pending
151
+ // WorkerMessage events (e.g. WorkerMessageEmitted from onTimeout) are
152
+ // handled first; otherwise exitFromMainThread could see
153
+ // alreadyEmitted=false and emit a spurious error.
165
154
  worker.on(workers_1.WorkerEvent.WorkerExit, (code) => {
166
155
  const handler = async () => {
167
156
  console.info('Worker exited with exit code: ' + code + '.');
@@ -176,27 +165,23 @@ class Spawn {
176
165
  }
177
166
  });
178
167
  worker.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
179
- var _a, _b, _c, _d, _e;
180
- // Since logs from the worker thread are handled differently in snap-in
181
- // platform, we need to catch the log messages from worker thread and log
182
- // them in main thread.
168
+ var _a, _b, _c;
169
+ // The snap-in platform handles worker-thread logs differently, so worker
170
+ // log messages are re-logged in the main thread.
183
171
  if ((message === null || message === void 0 ? void 0 : message.subject) === workers_1.WorkerMessageSubject.WorkerMessageLog) {
184
172
  const stringifiedArgs = (_a = message.payload) === null || _a === void 0 ? void 0 : _a.stringifiedArgs;
185
173
  const level = (_b = message.payload) === null || _b === void 0 ? void 0 : _b.level;
186
- const isSdkLog = (_d = (_c = message.payload) === null || _c === void 0 ? void 0 : _c.isSdkLog) !== null && _d !== void 0 ? _d : true;
187
- this.logger.logFn(stringifiedArgs, level, isSdkLog);
174
+ this.logger.logFn(stringifiedArgs, level);
188
175
  }
189
- // If worker sends a message that it has emitted an event, then set alreadyEmitted to true.
190
176
  if ((message === null || message === void 0 ? void 0 : message.subject) === workers_1.WorkerMessageSubject.WorkerMessageEmitted) {
191
177
  console.info('Worker has emitted message to AirSync.');
192
178
  this.alreadyEmitted = true;
193
179
  }
194
- // If worker sends a failure message before exiting, capture it for use in the error event.
180
+ // Capture the worker's failure reason for use in the error event.
195
181
  if ((message === null || message === void 0 ? void 0 : message.subject) === workers_1.WorkerMessageSubject.WorkerMessageFailed) {
196
- this.workerFailedMessage = (_e = message.payload) === null || _e === void 0 ? void 0 : _e.message;
182
+ this.workerFailedMessage = (_c = message.payload) === null || _c === void 0 ? void 0 : _c.message;
197
183
  }
198
184
  });
199
- // Log memory usage every 30 seconds
200
185
  this.memoryMonitoringInterval = setInterval(() => {
201
186
  try {
202
187
  const memoryInfo = (0, helpers_2.getMemoryUsage)();
@@ -205,7 +190,7 @@ class Spawn {
205
190
  }
206
191
  }
207
192
  catch (error) {
208
- // If memory monitoring fails, log the warning and clear the interval to prevent further issues
193
+ // Stop monitoring on failure to prevent repeated crashes
209
194
  console.warn('Memory monitoring failed, stopping logging of memory usage interval', error);
210
195
  if (this.memoryMonitoringInterval) {
211
196
  clearInterval(this.memoryMonitoringInterval);
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  const { workerData } = require('node:worker_threads');
3
3
  require('ts-node').register();
4
- const { Logger, runWithUserLogContext } = require('../logger/logger');
4
+ const { Logger } = require('../logger/logger');
5
5
  console = new Logger({ event: workerData.event, options: workerData.options });
6
- runWithUserLogContext(() => {
7
- require(workerData.workerPath);
8
- });
6
+ require(workerData.workerPath);
@@ -10,6 +10,16 @@ export declare class Repo {
10
10
  private onUpload;
11
11
  private options?;
12
12
  uploadedArtifacts: Artifact[];
13
+ dateRanges: {
14
+ creationDate: {
15
+ oldest?: number;
16
+ newest?: number;
17
+ };
18
+ modifiedDate: {
19
+ oldest?: number;
20
+ newest?: number;
21
+ };
22
+ };
13
23
  constructor({ event, itemType, normalize, onUpload, options, }: RepoFactoryInterface);
14
24
  getItems(): (NormalizedItem | NormalizedAttachment | Item)[];
15
25
  upload(batch?: (NormalizedItem | NormalizedAttachment | Item)[]): Promise<void | ErrorRecord>;
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/repo/repo.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAI3D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,IAAI;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAmD;IAChE,OAAO,CAAC,SAAS,CAAC,CAAwD;IAC1E,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,OAAO,CAAC,CAAuB;IAChC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;gBAEzB,EACV,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAE,oBAAoB;IAUvB,QAAQ,IAAI,CAAC,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAAC,EAAE;IAItD,MAAM,CACV,KAAK,CAAC,EAAE,CAAC,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAAC,EAAE,GACvD,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;IAqCxB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAyC5C"}
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/repo/repo.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,IAAI;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAmD;IAChE,OAAO,CAAC,SAAS,CAAC,CAAwD;IAC1E,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,OAAO,CAAC,CAAuB;IAChC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IAC9B,UAAU,EAAE;QACjB,YAAY,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACnD,YAAY,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACpD,CAGC;gBAEU,EACV,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAE,oBAAoB;IAUvB,QAAQ,IAAI,CAAC,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAAC,EAAE;IAItD,MAAM,CACV,KAAK,CAAC,EAAE,CAAC,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAAC,EAAE,GACvD,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;IAsDxB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAkC5C"}
@@ -0,0 +1,6 @@
1
+ export declare function updateRange(range: {
2
+ oldest?: number;
3
+ newest?: number;
4
+ }, ms: number): void;
5
+ export declare function toValidTimestamp(value: string): number | undefined;
6
+ //# sourceMappingURL=repo.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.helpers.d.ts","sourceRoot":"","sources":["../../src/repo/repo.helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CACzB,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3C,EAAE,EAAE,MAAM,GACT,IAAI,CAON;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGlE"}