mx-cloud 0.0.7 → 0.0.9
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/build/interpret.d.ts +1 -0
- package/build/interpret.js +13 -5
- package/package.json +1 -1
package/build/interpret.d.ts
CHANGED
package/build/interpret.js
CHANGED
|
@@ -318,6 +318,7 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
318
318
|
*/
|
|
319
319
|
carryOutSteps(page, steps) {
|
|
320
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
+
var _a;
|
|
321
322
|
/**
|
|
322
323
|
* Defines overloaded (or added) methods/actions usable in the workflow.
|
|
323
324
|
* If a method overloads any existing method of the Page class, it accepts the same set
|
|
@@ -401,7 +402,7 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
401
402
|
yield this.options.serializableCallback([mergedResult]);
|
|
402
403
|
}),
|
|
403
404
|
scrapeList: (config) => __awaiter(this, void 0, void 0, function* () {
|
|
404
|
-
var _a;
|
|
405
|
+
var _a, _b;
|
|
405
406
|
if ((_a = this.options.debugChannel) === null || _a === void 0 ? void 0 : _a.setActionType) {
|
|
406
407
|
this.options.debugChannel.setActionType('scrapeList');
|
|
407
408
|
}
|
|
@@ -410,14 +411,17 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
410
411
|
return;
|
|
411
412
|
}
|
|
412
413
|
yield this.ensureScriptsLoaded(page);
|
|
413
|
-
|
|
414
|
+
if ((_b = this.options.debugChannel) === null || _b === void 0 ? void 0 : _b.incrementScrapeListIndex) {
|
|
415
|
+
this.options.debugChannel.incrementScrapeListIndex();
|
|
416
|
+
}
|
|
414
417
|
if (!config.pagination) {
|
|
415
|
-
scrapeResults = yield page.evaluate((cfg) => window.scrapeList(cfg), config);
|
|
418
|
+
const scrapeResults = yield page.evaluate((cfg) => window.scrapeList(cfg), config);
|
|
419
|
+
yield this.options.serializableCallback(scrapeResults);
|
|
416
420
|
}
|
|
417
421
|
else {
|
|
418
|
-
scrapeResults = yield this.handlePagination(page, config);
|
|
422
|
+
const scrapeResults = yield this.handlePagination(page, config);
|
|
423
|
+
yield this.options.serializableCallback(scrapeResults);
|
|
419
424
|
}
|
|
420
|
-
yield this.options.serializableCallback(scrapeResults);
|
|
421
425
|
}),
|
|
422
426
|
scrapeListAuto: (config) => __awaiter(this, void 0, void 0, function* () {
|
|
423
427
|
var _a;
|
|
@@ -484,6 +488,9 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
484
488
|
yield wawActions[step.action](...(params !== null && params !== void 0 ? params : []));
|
|
485
489
|
}
|
|
486
490
|
else {
|
|
491
|
+
if ((_a = this.options.debugChannel) === null || _a === void 0 ? void 0 : _a.setActionType) {
|
|
492
|
+
this.options.debugChannel.setActionType(String(step.action));
|
|
493
|
+
}
|
|
487
494
|
// Implements the dot notation for the "method name" in the workflow
|
|
488
495
|
const levels = String(step.action).split('.');
|
|
489
496
|
const methodName = levels[levels.length - 1];
|
|
@@ -543,6 +550,7 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
543
550
|
});
|
|
544
551
|
allResults = allResults.concat(newResults);
|
|
545
552
|
debugLog("Results collected:", allResults.length);
|
|
553
|
+
yield this.options.serializableCallback(allResults);
|
|
546
554
|
});
|
|
547
555
|
const checkLimit = () => {
|
|
548
556
|
if (config.limit && allResults.length >= config.limit) {
|