@letsscrapedata/controller 0.5.0 → 0.6.2
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/dist/index.cjs +11 -8
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +10 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
LsdBrowserContextEvent: () => LsdBrowserContextEvent,
|
|
37
37
|
LsdBrowserEvent: () => LsdBrowserEvent,
|
|
38
38
|
LsdPageEvent: () => LsdPageEvent,
|
|
39
|
+
POPUP_TASK_ID: () => POPUP_TASK_ID,
|
|
39
40
|
PlaywrightBrowser: () => PlaywrightBrowser,
|
|
40
41
|
PlaywrightBrowserContext: () => PlaywrightBrowserContext,
|
|
41
42
|
PlaywrightElement: () => PlaywrightElement,
|
|
@@ -74,6 +75,7 @@ var LsdBrowserEvent = /* @__PURE__ */ ((LsdBrowserEvent2) => {
|
|
|
74
75
|
LsdBrowserEvent2["BROWSER_CONTEXT_CLOSE"] = "browserContextClose";
|
|
75
76
|
return LsdBrowserEvent2;
|
|
76
77
|
})(LsdBrowserEvent || {});
|
|
78
|
+
var POPUP_TASK_ID = 7;
|
|
77
79
|
|
|
78
80
|
// src/utils/log.ts
|
|
79
81
|
var import_utils = require("@letsscrapedata/utils");
|
|
@@ -677,8 +679,8 @@ var PlaywrightPage = class extends import_node_events.default {
|
|
|
677
679
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
678
680
|
pageInfo.openType = "popup";
|
|
679
681
|
evtData = this.browserContext().page(pageIdx);
|
|
680
|
-
if (evtData
|
|
681
|
-
|
|
682
|
+
if (evtData) {
|
|
683
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
682
684
|
}
|
|
683
685
|
} else {
|
|
684
686
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -2541,8 +2543,8 @@ var PuppeteerPage = class extends import_node_events4.default {
|
|
|
2541
2543
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
2542
2544
|
pageInfo.openType = "popup";
|
|
2543
2545
|
evtData = this.browserContext().page(pageIdx);
|
|
2544
|
-
if (evtData
|
|
2545
|
-
|
|
2546
|
+
if (evtData) {
|
|
2547
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
2546
2548
|
}
|
|
2547
2549
|
} else {
|
|
2548
2550
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -4796,8 +4798,8 @@ var PatchrightPage = class extends import_node_events8.default {
|
|
|
4796
4798
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
4797
4799
|
pageInfo.openType = "popup";
|
|
4798
4800
|
evtData = this.browserContext().page(pageIdx);
|
|
4799
|
-
if (evtData
|
|
4800
|
-
|
|
4801
|
+
if (evtData) {
|
|
4802
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
4801
4803
|
}
|
|
4802
4804
|
} else {
|
|
4803
4805
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -6702,8 +6704,8 @@ var CamoufoxPage = class extends import_node_events11.default {
|
|
|
6702
6704
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
6703
6705
|
pageInfo.openType = "popup";
|
|
6704
6706
|
evtData = this.browserContext().page(pageIdx);
|
|
6705
|
-
if (evtData
|
|
6706
|
-
|
|
6707
|
+
if (evtData) {
|
|
6708
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
6707
6709
|
}
|
|
6708
6710
|
} else {
|
|
6709
6711
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -8423,6 +8425,7 @@ var controller = new LsdBrowserController();
|
|
|
8423
8425
|
LsdBrowserContextEvent,
|
|
8424
8426
|
LsdBrowserEvent,
|
|
8425
8427
|
LsdPageEvent,
|
|
8428
|
+
POPUP_TASK_ID,
|
|
8426
8429
|
PlaywrightBrowser,
|
|
8427
8430
|
PlaywrightBrowserContext,
|
|
8428
8431
|
PlaywrightElement,
|
package/dist/index.d.cts
CHANGED
|
@@ -348,6 +348,8 @@ interface PageInfo {
|
|
|
348
348
|
*/
|
|
349
349
|
taskId: number;
|
|
350
350
|
/**
|
|
351
|
+
** popup page: parentTaskId
|
|
352
|
+
** normal page@scraper: templateId
|
|
351
353
|
* @default 0
|
|
352
354
|
*/
|
|
353
355
|
relatedId: number;
|
|
@@ -990,6 +992,7 @@ interface WaitNavigationOptions {
|
|
|
990
992
|
*/
|
|
991
993
|
waitUntil?: NavigationWaitUntil;
|
|
992
994
|
}
|
|
995
|
+
declare const POPUP_TASK_ID = 7;
|
|
993
996
|
interface LsdPage extends EventEmitter {
|
|
994
997
|
/**
|
|
995
998
|
* Adds a script which would be evaluated in one of the following scenarios:
|
|
@@ -1006,7 +1009,7 @@ interface LsdPage extends EventEmitter {
|
|
|
1006
1009
|
addScriptTag(options: FrameAddScriptTagOptions): Promise<AllElementHandle>;
|
|
1007
1010
|
/**
|
|
1008
1011
|
* Get the LsdApiContext associated with this page's LsdBrowserContext
|
|
1009
|
-
* * only vaild in playwright
|
|
1012
|
+
* * only vaild in camoufox, patchright and playwright
|
|
1010
1013
|
*/
|
|
1011
1014
|
apiContext(): LsdApiContext;
|
|
1012
1015
|
bringToFront(): Promise<boolean>;
|
|
@@ -1759,4 +1762,4 @@ declare class LsdBrowserController implements LsdBrowserController$1 {
|
|
|
1759
1762
|
}
|
|
1760
1763
|
declare const controller: LsdBrowserController;
|
|
1761
1764
|
|
|
1762
|
-
export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllElementHandle, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, ControllerEvent, type CookieItem, type FrameAddScriptTagOptions, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, LsdBrowserContextEvent, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, LsdBrowserEvent, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, LsdPageEvent, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageExtInPatchright, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageMouseClickOptions, type PageOpenType, type PageStatus, type PaperFormat, type PatchrightBrowserTypes, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserControllerType, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
|
|
1765
|
+
export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllElementHandle, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, ControllerEvent, type CookieItem, type FrameAddScriptTagOptions, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, LsdBrowserContextEvent, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, LsdBrowserEvent, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, LsdPageEvent, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, POPUP_TASK_ID, type PageExtInPatchright, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageMouseClickOptions, type PageOpenType, type PageStatus, type PaperFormat, type PatchrightBrowserTypes, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserControllerType, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
|
package/dist/index.d.ts
CHANGED
|
@@ -348,6 +348,8 @@ interface PageInfo {
|
|
|
348
348
|
*/
|
|
349
349
|
taskId: number;
|
|
350
350
|
/**
|
|
351
|
+
** popup page: parentTaskId
|
|
352
|
+
** normal page@scraper: templateId
|
|
351
353
|
* @default 0
|
|
352
354
|
*/
|
|
353
355
|
relatedId: number;
|
|
@@ -990,6 +992,7 @@ interface WaitNavigationOptions {
|
|
|
990
992
|
*/
|
|
991
993
|
waitUntil?: NavigationWaitUntil;
|
|
992
994
|
}
|
|
995
|
+
declare const POPUP_TASK_ID = 7;
|
|
993
996
|
interface LsdPage extends EventEmitter {
|
|
994
997
|
/**
|
|
995
998
|
* Adds a script which would be evaluated in one of the following scenarios:
|
|
@@ -1006,7 +1009,7 @@ interface LsdPage extends EventEmitter {
|
|
|
1006
1009
|
addScriptTag(options: FrameAddScriptTagOptions): Promise<AllElementHandle>;
|
|
1007
1010
|
/**
|
|
1008
1011
|
* Get the LsdApiContext associated with this page's LsdBrowserContext
|
|
1009
|
-
* * only vaild in playwright
|
|
1012
|
+
* * only vaild in camoufox, patchright and playwright
|
|
1010
1013
|
*/
|
|
1011
1014
|
apiContext(): LsdApiContext;
|
|
1012
1015
|
bringToFront(): Promise<boolean>;
|
|
@@ -1759,4 +1762,4 @@ declare class LsdBrowserController implements LsdBrowserController$1 {
|
|
|
1759
1762
|
}
|
|
1760
1763
|
declare const controller: LsdBrowserController;
|
|
1761
1764
|
|
|
1762
|
-
export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllElementHandle, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, ControllerEvent, type CookieItem, type FrameAddScriptTagOptions, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, LsdBrowserContextEvent, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, LsdBrowserEvent, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, LsdPageEvent, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageExtInPatchright, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageMouseClickOptions, type PageOpenType, type PageStatus, type PaperFormat, type PatchrightBrowserTypes, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserControllerType, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
|
|
1765
|
+
export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllElementHandle, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, ControllerEvent, type CookieItem, type FrameAddScriptTagOptions, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, LsdBrowserContextEvent, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, LsdBrowserEvent, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, LsdPageEvent, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, POPUP_TASK_ID, type PageExtInPatchright, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageMouseClickOptions, type PageOpenType, type PageStatus, type PaperFormat, type PatchrightBrowserTypes, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserControllerType, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var LsdBrowserEvent = /* @__PURE__ */ ((LsdBrowserEvent2) => {
|
|
|
23
23
|
LsdBrowserEvent2["BROWSER_CONTEXT_CLOSE"] = "browserContextClose";
|
|
24
24
|
return LsdBrowserEvent2;
|
|
25
25
|
})(LsdBrowserEvent || {});
|
|
26
|
+
var POPUP_TASK_ID = 7;
|
|
26
27
|
|
|
27
28
|
// src/utils/log.ts
|
|
28
29
|
import { log, LogLevel } from "@letsscrapedata/utils";
|
|
@@ -626,8 +627,8 @@ var PlaywrightPage = class extends EventEmitter {
|
|
|
626
627
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
627
628
|
pageInfo.openType = "popup";
|
|
628
629
|
evtData = this.browserContext().page(pageIdx);
|
|
629
|
-
if (evtData
|
|
630
|
-
|
|
630
|
+
if (evtData) {
|
|
631
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
631
632
|
}
|
|
632
633
|
} else {
|
|
633
634
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -2490,8 +2491,8 @@ var PuppeteerPage = class extends EventEmitter4 {
|
|
|
2490
2491
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
2491
2492
|
pageInfo.openType = "popup";
|
|
2492
2493
|
evtData = this.browserContext().page(pageIdx);
|
|
2493
|
-
if (evtData
|
|
2494
|
-
|
|
2494
|
+
if (evtData) {
|
|
2495
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
2495
2496
|
}
|
|
2496
2497
|
} else {
|
|
2497
2498
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -4745,8 +4746,8 @@ var PatchrightPage = class extends EventEmitter8 {
|
|
|
4745
4746
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
4746
4747
|
pageInfo.openType = "popup";
|
|
4747
4748
|
evtData = this.browserContext().page(pageIdx);
|
|
4748
|
-
if (evtData
|
|
4749
|
-
|
|
4749
|
+
if (evtData) {
|
|
4750
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
4750
4751
|
}
|
|
4751
4752
|
} else {
|
|
4752
4753
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -6651,8 +6652,8 @@ var CamoufoxPage = class extends EventEmitter11 {
|
|
|
6651
6652
|
popupPageId = `page-${browserIdx}-${browserContextIdx}-${pageIdx}`;
|
|
6652
6653
|
pageInfo.openType = "popup";
|
|
6653
6654
|
evtData = this.browserContext().page(pageIdx);
|
|
6654
|
-
if (evtData
|
|
6655
|
-
|
|
6655
|
+
if (evtData) {
|
|
6656
|
+
evtData.setPageInfo({ taskId: POPUP_TASK_ID, relatedId: page?.pageInfo?.taskId });
|
|
6656
6657
|
}
|
|
6657
6658
|
} else {
|
|
6658
6659
|
logerr(`##browser page ${pageId} has popup without page.pageInfo @LsdPage`);
|
|
@@ -8371,6 +8372,7 @@ export {
|
|
|
8371
8372
|
LsdBrowserContextEvent,
|
|
8372
8373
|
LsdBrowserEvent,
|
|
8373
8374
|
LsdPageEvent,
|
|
8375
|
+
POPUP_TASK_ID,
|
|
8374
8376
|
PlaywrightBrowser,
|
|
8375
8377
|
PlaywrightBrowserContext,
|
|
8376
8378
|
PlaywrightElement,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letsscrapedata/controller",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Unified browser / HTML controller interfaces that support patchright, camoufox, playwright, puppeteer and cheerio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|