@devrev/airsync-sdk 2.2.0-alpha.4 → 2.2.0-alpha.6
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":"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,EAAa,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGtE,OAAO,EAEL,QAAQ,EAER,cAAc,EAEf,MAAM,oBAAoB,CAAC;
|
|
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,EAAa,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGtE,OAAO,EAEL,QAAQ,EAER,cAAc,EAEf,MAAM,oBAAoB,CAAC;AAiC5B;;;;GAIG;AACH,8BAAsB,SAAS,CAAC,cAAc;IAC5C,SAAS,CAAC,eAAe,EAAE,cAAc,CAAC;IAC1C,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC9B,SAAS,CAAC,gBAAgB,EAAE,eAAe,CAAM;IACjD,SAAS,CAAC,kBAAkB,EAAE,iBAAiB,CAAM;IACrD,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IACvC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;gBAGxB,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,EACvD,eAAe,EAAE,QAAQ;IAY3B,2EAA2E;IAC3E,IAAI,KAAK,IAAI,cAAc,CAE1B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,cAAc,EAE9B;IAED,uEAAuE;IACvE,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAE3B;IAED,IAAI,iBAAiB,IAAI,iBAAiB,CAEzC;IAED,IAAI,eAAe,IAAI,eAAe,CAErC;IAED;;;;OAIG;IACG,mCAAmC,CACvC,oBAAoB,CAAC,EAAE,oBAAoB,GAC1C,OAAO,CAAC,IAAI,CAAC;IAwChB;;;;OAIG;IACG,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkGvD;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IA4C7B,OAAO,CAAC,YAAY;IAkBpB;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C1B,UAAU,IAAI,OAAO,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CAsBH"}
|
package/dist/state/base-state.js
CHANGED
|
@@ -26,10 +26,16 @@ function parseExtractionScope(objects) {
|
|
|
26
26
|
Object.values(scope).some((value) => value === null ||
|
|
27
27
|
typeof value !== 'object' ||
|
|
28
28
|
Array.isArray(value) ||
|
|
29
|
-
typeof value.extract !== 'boolean')) {
|
|
29
|
+
(value.extract !== undefined && typeof value.extract !== 'boolean'))) {
|
|
30
30
|
throw new Error('Invalid extraction scope in worker response.');
|
|
31
31
|
}
|
|
32
|
-
return scope
|
|
32
|
+
return Object.fromEntries(Object.entries(scope).map(([itemType, requirement]) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return [
|
|
35
|
+
itemType,
|
|
36
|
+
Object.assign(Object.assign({}, requirement), { extract: (_a = requirement.extract) !== null && _a !== void 0 ? _a : false }),
|
|
37
|
+
];
|
|
38
|
+
}));
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* State lifecycle shared by all sync modes: connector/SDK state separation,
|
|
@@ -152,7 +158,9 @@ class BaseState {
|
|
|
152
158
|
extraction_1.EventType.StartExtractingData,
|
|
153
159
|
extraction_1.EventType.ContinueExtractingData,
|
|
154
160
|
].includes(this.event.payload.event_type);
|
|
155
|
-
if (objects === undefined ||
|
|
161
|
+
if (objects === undefined ||
|
|
162
|
+
objects === null ||
|
|
163
|
+
(objects === '' && !requiresScope)) {
|
|
156
164
|
if (requiresScope) {
|
|
157
165
|
throw new Error('Missing extraction scope in worker response.');
|
|
158
166
|
}
|
|
@@ -160,7 +168,8 @@ class BaseState {
|
|
|
160
168
|
else {
|
|
161
169
|
this._extractionScope = parseExtractionScope(objects);
|
|
162
170
|
if (requiresScope) {
|
|
163
|
-
console.log('Extraction requirements from worker response:',
|
|
171
|
+
console.log('Extraction requirements from worker response:', objects);
|
|
172
|
+
console.log('Effective extraction requirements:', JSON.stringify(this._extractionScope));
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
}
|