@devrev/airsync-sdk 2.0.0-beta.11 → 2.0.0-beta.12
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.
- package/README.md +1 -0
- package/dist/attachments-streaming/attachments-streaming-pool.js +2 -2
- package/dist/multithreading/adapters/loading-adapter.d.ts +1 -0
- package/dist/multithreading/adapters/loading-adapter.d.ts.map +1 -1
- package/dist/multithreading/adapters/loading-adapter.js +31 -9
- package/dist/state/base-state.d.ts +2 -2
- package/dist/state/base-state.d.ts.map +1 -1
- package/dist/state/base-state.js +5 -8
- package/dist/types/errors.d.ts +3 -3
- package/dist/types/errors.js +3 -3
- package/dist/types/extraction.d.ts +0 -4
- package/dist/types/extraction.d.ts.map +1 -1
- package/docs/MIGRATION.md +51 -21
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,3 +15,4 @@ npm install @devrev/airsync-sdk
|
|
|
15
15
|
- [Architecture](docs/ARCHITECTURE.md): how the SDK works and how it talks to the AirSync platform.
|
|
16
16
|
- [Migration from v1](docs/MIGRATION.md): moving from `@devrev/ts-adaas` to `@devrev/airsync-sdk`.
|
|
17
17
|
- [Contributing](docs/CONTRIBUTING.md): workflow, versioning and testing conventions.
|
|
18
|
+
- [Release strategy](docs/RELEASE_STRATEGY.md): branch model, workflow choices and release safeguards.
|
|
@@ -73,7 +73,7 @@ class AttachmentsStreamingPool {
|
|
|
73
73
|
Promise.all(initialPromises),
|
|
74
74
|
this.adapter.timeoutSignal,
|
|
75
75
|
]);
|
|
76
|
-
if (this.delay) {
|
|
76
|
+
if (this.delay !== undefined) {
|
|
77
77
|
return { status: 'delay', delaySeconds: this.delay };
|
|
78
78
|
}
|
|
79
79
|
return { status: 'success' };
|
|
@@ -81,7 +81,7 @@ class AttachmentsStreamingPool {
|
|
|
81
81
|
async startPoolStreaming() {
|
|
82
82
|
var _a;
|
|
83
83
|
while (this.attachments.length > 0) {
|
|
84
|
-
if (this.delay) {
|
|
84
|
+
if (this.delay !== undefined) {
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
if (this.adapter.isTimeout) {
|
|
@@ -17,6 +17,7 @@ export declare class LoadingAdapter<ConnectorState> extends BaseAdapter<Connecto
|
|
|
17
17
|
* an item type the connector can't load, which fails the phase.
|
|
18
18
|
*/
|
|
19
19
|
private loadFiles;
|
|
20
|
+
private initializeFilesToLoad;
|
|
20
21
|
private getLoaderBatches;
|
|
21
22
|
private loadItem;
|
|
22
23
|
/** Maps a non-success connector response to a delay or a failed report. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading-adapter.d.ts","sourceRoot":"","sources":["../../../src/multithreading/adapters/loading-adapter.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,wBAAwB,EAGxB,6BAA6B,EAE7B,qBAAqB,EAGrB,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C,yFAAyF;AACzF,qBAAa,cAAc,CACzB,cAAc,CACd,SAAQ,WAAW,CAAC,cAAc,CAAC;IACnC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,eAAe,CAAW;IAalC,IAAI,OAAO,IAAI,YAAY,EAAE,CAE5B;IAED,IAAI,cAAc,IAAI,MAAM,EAAE,CAE7B;IA2BK,aAAa,CAAC,EAClB,eAAe,GAChB,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"loading-adapter.d.ts","sourceRoot":"","sources":["../../../src/multithreading/adapters/loading-adapter.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,wBAAwB,EAGxB,6BAA6B,EAE7B,qBAAqB,EAGrB,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C,yFAAyF;AACzF,qBAAa,cAAc,CACzB,cAAc,CACd,SAAQ,WAAW,CAAC,cAAc,CAAC;IACnC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,eAAe,CAAW;IAalC,IAAI,OAAO,IAAI,YAAY,EAAE,CAE5B;IAED,IAAI,cAAc,IAAI,MAAM,EAAE,CAE7B;IA2BK,aAAa,CAAC,EAClB,eAAe,GAChB,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;IA6BxC,eAAe,CAAC,EACpB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,6BAA6B,CAAC,wBAAwB,CAAC,CAAC;KACjE,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvB;;;;OAIG;YACW,SAAS;YAqFT,qBAAqB;YAarB,gBAAgB;YA+BhB,QAAQ;IA+HtB,2EAA2E;IAC3E,OAAO,CAAC,YAAY;YAwBN,cAAc;CAiD7B"}
|
|
@@ -46,9 +46,9 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
46
46
|
console.warn('No item types to load, returning.');
|
|
47
47
|
return { status: 'success' };
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const failure = await this.initializeFilesToLoad(itemTypes);
|
|
50
|
+
if (failure)
|
|
51
|
+
return failure;
|
|
52
52
|
}
|
|
53
53
|
return this.loadFiles('data', (fileToLoad) => {
|
|
54
54
|
const itemTypeToLoad = itemTypesToLoad.find((itemTypeToLoad) => itemTypeToLoad.itemType === fileToLoad.itemType);
|
|
@@ -60,9 +60,9 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
60
60
|
}
|
|
61
61
|
async loadAttachments({ create, }) {
|
|
62
62
|
if (this.event.payload.event_type === extraction_1.EventType.StartLoadingAttachments) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const failure = await this.initializeFilesToLoad(['attachment']);
|
|
64
|
+
if (failure)
|
|
65
|
+
return failure;
|
|
66
66
|
}
|
|
67
67
|
return this.loadFiles('attachment', () => async (item) => this.loadAttachment({ item, create }));
|
|
68
68
|
}
|
|
@@ -105,8 +105,11 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
105
105
|
console.log(`Timeout detected during ${kind} loading. Returning progress to allow continuation.`);
|
|
106
106
|
return { status: 'progress' };
|
|
107
107
|
}
|
|
108
|
-
const { report, rateLimit } = await load(transformerFile[i]);
|
|
109
|
-
if (
|
|
108
|
+
const { report, rateLimit, error } = await load(transformerFile[i]);
|
|
109
|
+
if (error) {
|
|
110
|
+
return { status: 'error', error };
|
|
111
|
+
}
|
|
112
|
+
if (rateLimit) {
|
|
110
113
|
return { status: 'delay', delaySeconds: rateLimit.delay };
|
|
111
114
|
}
|
|
112
115
|
if (report) {
|
|
@@ -132,6 +135,17 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
132
135
|
}
|
|
133
136
|
return { status: 'success' };
|
|
134
137
|
}
|
|
138
|
+
async initializeFilesToLoad(supportedItemTypes) {
|
|
139
|
+
try {
|
|
140
|
+
this.adapterState.sdkState.fromDevRev = {
|
|
141
|
+
filesToLoad: await this.getLoaderBatches(supportedItemTypes),
|
|
142
|
+
};
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
return { status: 'error', error: { message: (0, logger_1.serializeError)(error) } };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
135
149
|
async getLoaderBatches(supportedItemTypes) {
|
|
136
150
|
var _a;
|
|
137
151
|
const statsFileArtifactId = (_a = this.event.payload.event_data) === null || _a === void 0 ? void 0 : _a.stats_file;
|
|
@@ -142,7 +156,10 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
142
156
|
artifactId: statsFileArtifactId,
|
|
143
157
|
});
|
|
144
158
|
const statsFile = response;
|
|
145
|
-
if (statsFileError
|
|
159
|
+
if (statsFileError) {
|
|
160
|
+
throw new Error(`Failed to download loader stats file ${statsFileArtifactId}. ${(0, logger_1.serializeError)(statsFileError)}`);
|
|
161
|
+
}
|
|
162
|
+
if (statsFile.length === 0) {
|
|
146
163
|
return [];
|
|
147
164
|
}
|
|
148
165
|
return (0, loading_adapter_helpers_1.getFilesToLoad)({ supportedItemTypes, statsFile });
|
|
@@ -267,6 +284,11 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
267
284
|
}
|
|
268
285
|
catch (error) {
|
|
269
286
|
console.warn('Failed to create sync mapper record.', (0, logger_1.serializeError)(error));
|
|
287
|
+
return {
|
|
288
|
+
error: {
|
|
289
|
+
message: 'Failed to create sync mapper record. ' + (0, logger_1.serializeError)(error),
|
|
290
|
+
},
|
|
291
|
+
};
|
|
270
292
|
}
|
|
271
293
|
return {
|
|
272
294
|
report: {
|
|
@@ -39,8 +39,8 @@ export declare abstract class BaseState<ConnectorState> {
|
|
|
39
39
|
init(initialState: ConnectorState): Promise<void>;
|
|
40
40
|
/**
|
|
41
41
|
* Normalizes fetched state into the `{ connectorState, sdkState }` envelope.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* Envelopes are recognized by their keys and validate `stateVersion` when
|
|
43
|
+
* present; anything else is a flat v1 blob split by
|
|
44
44
|
* `V1_SDK_STATE_KEYS`.
|
|
45
45
|
*/
|
|
46
46
|
private normalizeFetchedState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-state.d.ts","sourceRoot":"","sources":["../../src/state/base-state.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAEL,QAAQ,EAER,cAAc,EAEf,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,8BAAsB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 @@ class BaseState {
|
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Normalizes fetched state into the `{ connectorState, sdkState }` envelope.
|
|
140
|
-
*
|
|
141
|
-
*
|
|
140
|
+
* Envelopes are recognized by their keys and validate `stateVersion` when
|
|
141
|
+
* present; anything else is a flat v1 blob split by
|
|
142
142
|
* `V1_SDK_STATE_KEYS`.
|
|
143
143
|
*/
|
|
144
144
|
normalizeFetchedState(parsed) {
|
|
@@ -146,16 +146,13 @@ class BaseState {
|
|
|
146
146
|
throw new Error('Fetched state is not a JSON object.');
|
|
147
147
|
}
|
|
148
148
|
const record = parsed;
|
|
149
|
-
if (record
|
|
150
|
-
if (record.stateVersion !==
|
|
149
|
+
if ('connectorState' in record || 'sdkState' in record) {
|
|
150
|
+
if (record.stateVersion !== undefined &&
|
|
151
|
+
record.stateVersion !== state_interfaces_1.STATE_VERSION) {
|
|
151
152
|
throw new Error(`Unsupported state version ${String(record.stateVersion)}; this SDK reads version ${state_interfaces_1.STATE_VERSION}.`);
|
|
152
153
|
}
|
|
153
154
|
return this.readEnvelope(record);
|
|
154
155
|
}
|
|
155
|
-
// Envelopes written by 2.0.0 betas carry no version marker.
|
|
156
|
-
if ('connectorState' in record || 'sdkState' in record) {
|
|
157
|
-
return this.readEnvelope(record);
|
|
158
|
-
}
|
|
159
156
|
// Legacy flat v1 blob: split known SDK keys out of the connector state.
|
|
160
157
|
const connectorState = {};
|
|
161
158
|
const sdkState = {};
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* sends
|
|
2
|
+
* Platform-recognized error codes (CommonError), mapped by the snap-in manager
|
|
3
|
+
* in `internal/common/errors_snapin.go`. Set them on `ErrorRecord.code`; the SDK
|
|
4
|
+
* sends exactly `ERROR_CODE=<code>` as the wire message.
|
|
5
5
|
*/
|
|
6
6
|
export declare enum AirSyncErrorCode {
|
|
7
7
|
EXTERNAL_SYNC_UNIT_DELETED = "EXTERNAL_SYNC_UNIT_DELETED",
|
package/dist/types/errors.js
CHANGED
|
@@ -5,9 +5,9 @@ exports.formatErrorCode = formatErrorCode;
|
|
|
5
5
|
const ERROR_PREFIX = 'ERROR_CODE';
|
|
6
6
|
const ERROR_DELIMITER = '=';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* sends
|
|
8
|
+
* Platform-recognized error codes (CommonError), mapped by the snap-in manager
|
|
9
|
+
* in `internal/common/errors_snapin.go`. Set them on `ErrorRecord.code`; the SDK
|
|
10
|
+
* sends exactly `ERROR_CODE=<code>` as the wire message.
|
|
11
11
|
*/
|
|
12
12
|
var AirSyncErrorCode;
|
|
13
13
|
(function (AirSyncErrorCode) {
|
|
@@ -109,10 +109,6 @@ export interface EventContext {
|
|
|
109
109
|
mode: string;
|
|
110
110
|
request_id: string;
|
|
111
111
|
request_id_adaas: string;
|
|
112
|
-
/** @deprecated Never read by the SDK; kept because connectors still branch on it. */
|
|
113
|
-
reset_extraction?: boolean;
|
|
114
|
-
/** @deprecated Use extraction_start_time/extraction_end_time (resolved into extract_from/extract_to). */
|
|
115
|
-
reset_extract_from?: boolean;
|
|
116
112
|
run_id: string;
|
|
117
113
|
sequence_version: string;
|
|
118
114
|
snap_in_slug: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../src/types/extraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEhD,iDAAiD;AACjD,oBAAY,SAAS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AAM,MAAM,wCAAwC,CAAC,QAAQ,EAAE,cAAc,IAC3E,CAAC,EACC,kBAAkB,EAClB,OAAO,EACP,MAAM,GACP,EAAE;IACD,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,OAAO,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,EAAE,yCAAyC,CAAC;CACnD,KAAK,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAE7C,MAAM,WAAW,kCAAkC,CACjD,cAAc,EACd,KAAK,EACL,QAAQ;IAER,OAAO,EAAE,uCAAuC,CAC9C,KAAK,EACL,QAAQ,EACR,cAAc,CACf,CAAC;IACF,QAAQ,EAAE,wCAAwC,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;CAC9E"}
|
package/docs/MIGRATION.md
CHANGED
|
@@ -9,11 +9,14 @@ own:
|
|
|
9
9
|
It ships in the package at `node_modules/@devrev/airsync-sdk/docs/MIGRATION.md`
|
|
10
10
|
(read it from disk; the `exports` map only blocks `import`/`require`). Before
|
|
11
11
|
v2 is installed, use
|
|
12
|
-
`https://raw.githubusercontent.com/devrev/adaas-sdk/v2/docs/MIGRATION.md
|
|
12
|
+
`https://raw.githubusercontent.com/devrev/adaas-sdk/v2/docs/MIGRATION.md`
|
|
13
|
+
(use `main` after GA). The installed guide always takes precedence.
|
|
13
14
|
|
|
14
|
-
**The wire protocol is unchanged.** Event
|
|
15
|
-
artifact
|
|
16
|
-
|
|
15
|
+
**The modern wire protocol is unchanged.** Event names, routes, headers,
|
|
16
|
+
artifact formats and `ERROR_CODE=…` strings remain compatible with platforms
|
|
17
|
+
that send modern events. Legacy `EXTRACTION_*` event names are intentionally
|
|
18
|
+
unsupported. The public TypeScript API changes all at once, without deprecated
|
|
19
|
+
aliases; runtime differences are described below.
|
|
17
20
|
|
|
18
21
|
---
|
|
19
22
|
|
|
@@ -21,7 +24,8 @@ v1. Only the TypeScript API changed, all at once, with no compatibility shims.
|
|
|
21
24
|
|
|
22
25
|
**Rules.** Work autonomously; when a rewrite is ambiguous, pick the option
|
|
23
26
|
that preserves runtime behavior and note it in `MIGRATION_REVIEW.md`. Migrate
|
|
24
|
-
source **and** tests.
|
|
27
|
+
source **and** tests. Preserve runtime string values except the documented
|
|
28
|
+
legacy event-string replacements in §3 and §11. Don't add comments
|
|
25
29
|
about the migration; the `// v1` / `// v2` labels here are reading aids. Leave
|
|
26
30
|
no compile errors or orphaned imports. A section with no hits is a no-op.
|
|
27
31
|
Existing comments and commented-out code that describe v1 behavior (`emit`,
|
|
@@ -30,8 +34,11 @@ v2; templates are copied into new connectors, so stale comments spread.
|
|
|
30
34
|
|
|
31
35
|
1. **Locate the package.** Find the `package.json` that depends on
|
|
32
36
|
`@devrev/ts-adaas` (generated connectors keep it in `code/`). Run everything
|
|
33
|
-
from there. If it already depends on `@devrev/airsync-sdk
|
|
34
|
-
|
|
37
|
+
from there. If it already depends on `@devrev/airsync-sdk`, inspect its
|
|
38
|
+
installed version and migration review. Early betas still need the
|
|
39
|
+
changes under **Rare cases** below; upgrade to the selected v2 version
|
|
40
|
+
and verify source, tests and local runners against this guide. Stop only
|
|
41
|
+
when the current-contract migration and verification are complete.
|
|
35
42
|
2. **Start from green latest v1.** If behind the latest stable 1.x, upgrade and
|
|
36
43
|
apply the release notes of every release in between that mentions a
|
|
37
44
|
migration (the last ones were 1.16.0–1.18.0), then get tsc/lint/build/test
|
|
@@ -65,7 +72,7 @@ v2; templates are copied into new connectors, so stale comments spread.
|
|
|
65
72
|
legacy event names in fields the SDK doesn't read, such as
|
|
66
73
|
`event_type_adaas`):
|
|
67
74
|
```bash
|
|
68
|
-
grep -rnE "@devrev/ts-adaas|airsync-sdk/dist|\bprocessTask\b|\bWorkerAdapter\b|\.emit\(|hasWorkerEmitted|\bAirdrop(Event|Message)\b|axiosClient|(format|serialize)AxiosError|workerPath:|overridenOptions|skipConfirmation|isLocalDevelopment|--local|-- local\b|@devrev/typescript-sdk|(Extractor|Loader)EventType|ExtractionCommonError|ERROR_CODE=|sdkState|onUpload|uploadedArtifacts|currentEventDataLength|EXTRACTION_(DATA|METADATA|ATTACHMENTS|EXTERNAL_SYNC_UNITS)_" \
|
|
75
|
+
grep -rnE "@devrev/ts-adaas|airsync-sdk/dist|\bprocessTask\b|\bWorkerAdapter\b|\.emit\(|hasWorkerEmitted|\bAirdrop(Event|Message)\b|axiosClient|(format|serialize)AxiosError|workerPath:|overridenOptions|skipConfirmation|isLocalDevelopment|--local|-- local\b|@devrev/typescript-sdk|(Extractor|Loader)EventType|ExtractionCommonError|ERROR_CODE=|reset_(extraction|extract_from)|sdkState|onUpload|uploadedArtifacts|currentEventDataLength|EXTRACTION_(DATA|METADATA|ATTACHMENTS|EXTERNAL_SYNC_UNITS)_" \
|
|
69
76
|
--include='*.ts' --include='*.js' --include='*.json' --include='*.yml' --include='*.yaml' --include='*.md' --include='*.mdc' --include='*.sh' . \
|
|
70
77
|
| grep -vE 'node_modules|/dist/|/coverage/|package-lock.json|MIGRATION_REVIEW.md'
|
|
71
78
|
```
|
|
@@ -163,8 +170,11 @@ first old one, and drop the rest. Untyped
|
|
|
163
170
|
JSON still compiles, but the SDK reads only the current names (e.g. state
|
|
164
171
|
requests carry `request_id_adaas`).
|
|
165
172
|
|
|
166
|
-
`reset_extraction` and `reset_extract_from`
|
|
167
|
-
|
|
173
|
+
`reset_extraction` and `reset_extract_from` are removed. Delete these keys
|
|
174
|
+
from fixtures and remove connector branches that read them. The SDK never
|
|
175
|
+
interpreted either flag. Configure backfills through the platform's
|
|
176
|
+
`extraction_start_time` / `extraction_end_time`; connectors read the
|
|
177
|
+
SDK-resolved `extract_from` / `extract_to` for the sync window (§8).
|
|
168
178
|
|
|
169
179
|
## 3. `spawn`
|
|
170
180
|
|
|
@@ -344,8 +354,9 @@ helpers, assert on the return value.
|
|
|
344
354
|
deleted; v1 never ran it.
|
|
345
355
|
- `onTimeout` runs only after the task has returned, in v1 and v2, so
|
|
346
356
|
cleanup there (cancelling a rate limiter, aborting requests) never
|
|
347
|
-
interrupted a stuck task.
|
|
348
|
-
|
|
357
|
+
interrupted a stuck task. Check the public `adapter.isTimeout` between
|
|
358
|
+
batches and perform any needed cancellation inside the task.
|
|
359
|
+
`timeoutSignal` is internal and unavailable to connector code.
|
|
349
360
|
- Don't call `process.exit()` or `postState()` in `onTimeout`; the SDK saves
|
|
350
361
|
state and exits.
|
|
351
362
|
|
|
@@ -356,10 +367,16 @@ now wrong**, and `Boolean(await repo.push(x))` or `if (!(await …push(x)))`
|
|
|
356
367
|
compiles but is always falsy. Make wrappers `await repo.push(x)` and return
|
|
357
368
|
`true` (or `void`). Keep a top-level `try/catch` that maps an error to `delay`
|
|
358
369
|
(e.g. a thrown 429); otherwise it's only needed for a custom message.
|
|
370
|
+
Find every unawaited `repo.push()` / `repo.upload()`, including calls in
|
|
371
|
+
helpers and loops, and await it before advancing the cursor or returning.
|
|
372
|
+
An unhandled upload rejection can bypass the task's error handling.
|
|
359
373
|
`loadItemTypes` and `loadAttachments` don't throw: a `create` / `update` that
|
|
360
374
|
throws becomes their `error` result, so a 429 must be returned as
|
|
361
375
|
`{ status: 'delay', delaySeconds }` from the callback (§6). A `catch` around
|
|
362
376
|
them that checks `isAxiosError(e) && status === 429` is dead; delete it.
|
|
377
|
+
Failures fetching loader stats or reading/writing sync mapper records fail
|
|
378
|
+
the phase and retain the current cursor. A connector callback returning
|
|
379
|
+
`status: 'error'` still counts that item as failed and continues.
|
|
363
380
|
|
|
364
381
|
`ProcessTaskInterface<T>` and `TaskAdapterInterface<T>` now take the
|
|
365
382
|
**adapter** type: `ProcessTaskInterface<ExtractionAdapter<State>>`, not
|
|
@@ -503,9 +520,14 @@ the emit.
|
|
|
503
520
|
- **Persisted state** becomes `{ stateVersion: 2, connectorState, sdkState }`.
|
|
504
521
|
A v1 blob is migrated automatically on first read: known SDK keys move to
|
|
505
522
|
`sdkState` and everything else becomes connector state. **Rolling back to v1
|
|
506
|
-
after a v2 worker has
|
|
523
|
+
after a v2 worker has persisted state is not supported**. A drained sync
|
|
524
|
+
still has a v2 envelope: recovery needs a verified saved v1 state together
|
|
525
|
+
with the v1 connector, or an explicit reset/reinitialization and reimport.
|
|
526
|
+
Upgrade between runs, after v1 workers have finished. A
|
|
507
527
|
v1 state with a top-level key named `connectorState` or `sdkState` is
|
|
508
|
-
misread
|
|
528
|
+
misread. Rename it in a staged v1 deployment and migrate its persisted
|
|
529
|
+
value before upgrading, or explicitly reset/reimport. A top-level
|
|
530
|
+
connector-owned `stateVersion` in a flat v1 blob is preserved.
|
|
509
531
|
- **Sync window**: read
|
|
510
532
|
`adapter.event.payload.event_context.extract_from` / `extract_to`. The SDK
|
|
511
533
|
resolves them from the platform's time values, or from the last successful
|
|
@@ -525,8 +547,12 @@ is connector-owned: leave it alone.
|
|
|
525
547
|
`extract_from`.
|
|
526
548
|
- **Declared and used as the connector's own cursor** (derived from data, or
|
|
527
549
|
read alongside `extract_from`): **rename** it (e.g. →
|
|
528
|
-
`lastSuccessfulWindowStart`) everywhere, including fixtures.
|
|
529
|
-
|
|
550
|
+
`lastSuccessfulWindowStart`) everywhere, including fixtures. Before
|
|
551
|
+
deploying v2, use a staged v1 deployment to copy the persisted value into
|
|
552
|
+
the new connector key, retaining the legacy key for v1 SDK bookkeeping.
|
|
553
|
+
Alternatively, explicitly reset/reimport. A source-only rename does not
|
|
554
|
+
migrate persisted data: the v1 auto-migration moves the old key into SDK
|
|
555
|
+
state and leaves the new connector key unset.
|
|
530
556
|
- **Declared but only mirrors the SDK**: its only writes are "now" when data
|
|
531
557
|
extraction starts and a copy on finish. Treat it as not declared, **even if
|
|
532
558
|
it is read next to `extract_from`**. Renaming would leave it empty after the
|
|
@@ -676,8 +702,10 @@ in minor versions, so give `switch` statements over it a `default`.
|
|
|
676
702
|
|
|
677
703
|
## 12. Error codes
|
|
678
704
|
|
|
679
|
-
`ExtractionCommonError` is now `AirSyncErrorCode`.
|
|
680
|
-
|
|
705
|
+
`ExtractionCommonError` is now `AirSyncErrorCode`. These remain the platform's
|
|
706
|
+
known common error codes (`CommonError`), mapped by the snap-in manager in
|
|
707
|
+
`internal/common/errors_snapin.go`. Their values are bare codes, and you set
|
|
708
|
+
them on `error.code`:
|
|
681
709
|
|
|
682
710
|
```ts
|
|
683
711
|
// v1
|
|
@@ -689,9 +717,11 @@ return {
|
|
|
689
717
|
};
|
|
690
718
|
```
|
|
691
719
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
720
|
+
`error.code` is an SDK input field. Before sending the callback, the SDK
|
|
721
|
+
converts it into `event_data.error.message = 'ERROR_CODE=<code>'` and omits
|
|
722
|
+
the `code` property. The backend continues reading the common error from
|
|
723
|
+
`error.message`; your human-readable `message` goes to the logs. Write a
|
|
724
|
+
useful `message`. Raw `'ERROR_CODE=…'` strings and connector helpers that
|
|
695
725
|
return them (`HISTORICAL_DONE`, `authErrorCode(e)`) still work at runtime but
|
|
696
726
|
are migrated too: make the helper return `AirSyncErrorCode | undefined`, set it
|
|
697
727
|
as `code`, and update tests that pin the literal. The wire string doesn't
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devrev/airsync-sdk",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.12",
|
|
4
4
|
"description": "Typescript SDK for building AirSync snap-ins on the DevRev platform.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/devrev/
|
|
29
|
+
"url": "git+https://github.com/devrev/airsync-sdk.git"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"registry": "https://registry.npmjs.org"
|