maxun-core 0.0.17 → 0.0.18

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.
@@ -41,6 +41,7 @@ interface InterpreterOptions {
41
41
  activeId: (id: number) => void;
42
42
  debugMessage: (msg: string) => void;
43
43
  setActionType: (type: string) => void;
44
+ incrementScrapeListIndex: () => void;
44
45
  }>;
45
46
  }
46
47
  /**
@@ -385,7 +385,7 @@ class Interpreter extends events_1.EventEmitter {
385
385
  yield this.options.serializableCallback([mergedResult]);
386
386
  }),
387
387
  scrapeList: (config) => __awaiter(this, void 0, void 0, function* () {
388
- var _f;
388
+ var _f, _g;
389
389
  if ((_f = this.options.debugChannel) === null || _f === void 0 ? void 0 : _f.setActionType) {
390
390
  this.options.debugChannel.setActionType('scrapeList');
391
391
  }
@@ -394,6 +394,9 @@ class Interpreter extends events_1.EventEmitter {
394
394
  return;
395
395
  }
396
396
  yield this.ensureScriptsLoaded(page);
397
+ if ((_g = this.options.debugChannel) === null || _g === void 0 ? void 0 : _g.incrementScrapeListIndex) {
398
+ this.options.debugChannel.incrementScrapeListIndex();
399
+ }
397
400
  if (!config.pagination) {
398
401
  const scrapeResults = yield page.evaluate((cfg) => window.scrapeList(cfg), config);
399
402
  yield this.options.serializableCallback(scrapeResults);
@@ -404,8 +407,8 @@ class Interpreter extends events_1.EventEmitter {
404
407
  }
405
408
  }),
406
409
  scrapeListAuto: (config) => __awaiter(this, void 0, void 0, function* () {
407
- var _g;
408
- if ((_g = this.options.debugChannel) === null || _g === void 0 ? void 0 : _g.setActionType) {
410
+ var _h;
411
+ if ((_h = this.options.debugChannel) === null || _h === void 0 ? void 0 : _h.setActionType) {
409
412
  this.options.debugChannel.setActionType('scrapeListAuto');
410
413
  }
411
414
  yield this.ensureScriptsLoaded(page);
@@ -415,8 +418,8 @@ class Interpreter extends events_1.EventEmitter {
415
418
  yield this.options.serializableCallback(scrapeResults);
416
419
  }),
417
420
  scroll: (pages) => __awaiter(this, void 0, void 0, function* () {
418
- var _h;
419
- if ((_h = this.options.debugChannel) === null || _h === void 0 ? void 0 : _h.setActionType) {
421
+ var _j;
422
+ if ((_j = this.options.debugChannel) === null || _j === void 0 ? void 0 : _j.setActionType) {
420
423
  this.options.debugChannel.setActionType('scroll');
421
424
  }
422
425
  yield page.evaluate((pagesInternal) => __awaiter(this, void 0, void 0, function* () {
@@ -427,8 +430,8 @@ class Interpreter extends events_1.EventEmitter {
427
430
  }), pages !== null && pages !== void 0 ? pages : 1);
428
431
  }),
429
432
  script: (code) => __awaiter(this, void 0, void 0, function* () {
430
- var _j;
431
- if ((_j = this.options.debugChannel) === null || _j === void 0 ? void 0 : _j.setActionType) {
433
+ var _k;
434
+ if ((_k = this.options.debugChannel) === null || _k === void 0 ? void 0 : _k.setActionType) {
432
435
  this.options.debugChannel.setActionType('script');
433
436
  }
434
437
  const AsyncFunction = Object.getPrototypeOf(() => __awaiter(this, void 0, void 0, function* () { })).constructor;
@@ -530,6 +533,7 @@ class Interpreter extends events_1.EventEmitter {
530
533
  });
531
534
  allResults = allResults.concat(newResults);
532
535
  debugLog("Results collected:", allResults.length);
536
+ yield this.options.serializableCallback(allResults);
533
537
  });
534
538
  const checkLimit = () => {
535
539
  if (config.limit && allResults.length >= config.limit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxun-core",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Core package for Maxun, responsible for data extraction",
5
5
  "main": "build/index.js",
6
6
  "typings": "build/index.d.ts",