@letsscrapedata/controller 0.0.8 → 0.0.10

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 CHANGED
@@ -58,6 +58,7 @@ __export(src_exports, {
58
58
  PuppeteerBrowserContext: () => PuppeteerBrowserContext,
59
59
  PuppeteerElement: () => PuppeteerElement,
60
60
  PuppeteerPage: () => PuppeteerPage,
61
+ controller: () => controller,
61
62
  defaultProxy: () => defaultProxy
62
63
  });
63
64
  module.exports = __toCommonJS(src_exports);
@@ -1100,7 +1101,25 @@ var PlaywrightPage = class extends import_node_events.default {
1100
1101
  retObj = retObj[key];
1101
1102
  }
1102
1103
  }
1103
- return JSON.stringify(retObj);
1104
+ if (typeof retObj === "string") {
1105
+ return retObj;
1106
+ } else if (typeof retObj === "number") {
1107
+ return String(retObj);
1108
+ } else if (typeof retObj === "boolean") {
1109
+ return String(Number(retObj));
1110
+ } else if (!retObj) {
1111
+ return "";
1112
+ } else if (typeof retObj === "object") {
1113
+ try {
1114
+ return JSON.stringify(retObj);
1115
+ } catch (err) {
1116
+ return "";
1117
+ }
1118
+ } else if (typeof retObj === "bigint") {
1119
+ return String(retObj);
1120
+ } else {
1121
+ return "";
1122
+ }
1104
1123
  },
1105
1124
  keys
1106
1125
  );
@@ -2532,7 +2551,25 @@ var PuppeteerPage = class extends import_node_events4.default {
2532
2551
  retObj = retObj[key];
2533
2552
  }
2534
2553
  }
2535
- return JSON.stringify(retObj);
2554
+ if (typeof retObj === "string") {
2555
+ return retObj;
2556
+ } else if (typeof retObj === "number") {
2557
+ return String(retObj);
2558
+ } else if (typeof retObj === "boolean") {
2559
+ return String(Number(retObj));
2560
+ } else if (!retObj) {
2561
+ return "";
2562
+ } else if (typeof retObj === "object") {
2563
+ try {
2564
+ return JSON.stringify(retObj);
2565
+ } catch (err) {
2566
+ return "";
2567
+ }
2568
+ } else if (typeof retObj === "bigint") {
2569
+ return String(retObj);
2570
+ } else {
2571
+ return "";
2572
+ }
2536
2573
  },
2537
2574
  keys
2538
2575
  );
@@ -17272,5 +17309,6 @@ var controller = new LsdBrowserController();
17272
17309
  PuppeteerBrowserContext,
17273
17310
  PuppeteerElement,
17274
17311
  PuppeteerPage,
17312
+ controller,
17275
17313
  defaultProxy
17276
17314
  });
package/dist/index.d.cts CHANGED
@@ -813,7 +813,7 @@ interface LsdPage extends EventEmitter {
813
813
  * @param params default null(ignored), method parameters
814
814
  * @param detach default true, whether to detach the CDPSession from target
815
815
  */
816
- sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<object>;
816
+ sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
817
817
  setCookies(cookies: CookieItem[]): Promise<boolean>;
818
818
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
819
819
  /**
@@ -907,7 +907,7 @@ interface LsdBrowser extends EventEmitter {
907
907
  version(): Promise<string>;
908
908
  _origBrowserContexts(): AllBrowserContext[];
909
909
  }
910
- interface LsdBrowserController {
910
+ interface LsdBrowserController$1 {
911
911
  launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdLaunchOptions): Promise<LsdBrowser>;
912
912
  connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdConnectOptions): Promise<LsdBrowser>;
913
913
  }
@@ -1005,7 +1005,7 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
1005
1005
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1006
1006
  scrollBy(x: number, y: number): Promise<boolean>;
1007
1007
  scrollTo(x: number, y: number): Promise<boolean>;
1008
- sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<object>;
1008
+ sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
1009
1009
  setCookies(cookies: CookieItem[]): Promise<boolean>;
1010
1010
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1011
1011
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -1113,7 +1113,7 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1113
1113
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1114
1114
  scrollBy(x: number, y: number): Promise<boolean>;
1115
1115
  scrollTo(x: number, y: number): Promise<boolean>;
1116
- sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<object>;
1116
+ sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
1117
1117
  setCookies(cookies: CookieItem[]): Promise<boolean>;
1118
1118
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1119
1119
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -1185,7 +1185,7 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
1185
1185
  screenshot(): Promise<Buffer>;
1186
1186
  scrollBy(): Promise<boolean>;
1187
1187
  scrollTo(): Promise<boolean>;
1188
- sendCDPMessage(): Promise<object>;
1188
+ sendCDPMessage(): Promise<any>;
1189
1189
  setCookies(): Promise<boolean>;
1190
1190
  setExtraHTTPHeaders(): Promise<boolean>;
1191
1191
  setLocalStroage(): Promise<boolean>;
@@ -1227,4 +1227,12 @@ declare class CheerioElement implements LsdElement {
1227
1227
  scrollIntoView(): Promise<boolean>;
1228
1228
  }
1229
1229
 
1230
- export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, 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 ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, defaultProxy };
1230
+ declare class LsdBrowserController implements LsdBrowserController$1 {
1231
+ #private;
1232
+ constructor();
1233
+ launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdLaunchOptions): Promise<LsdBrowser>;
1234
+ connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdConnectOptions): Promise<LsdBrowser>;
1235
+ }
1236
+ declare const controller: LsdBrowserController;
1237
+
1238
+ export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, 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 ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, defaultProxy };
package/dist/index.d.ts CHANGED
@@ -813,7 +813,7 @@ interface LsdPage extends EventEmitter {
813
813
  * @param params default null(ignored), method parameters
814
814
  * @param detach default true, whether to detach the CDPSession from target
815
815
  */
816
- sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<object>;
816
+ sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
817
817
  setCookies(cookies: CookieItem[]): Promise<boolean>;
818
818
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
819
819
  /**
@@ -907,7 +907,7 @@ interface LsdBrowser extends EventEmitter {
907
907
  version(): Promise<string>;
908
908
  _origBrowserContexts(): AllBrowserContext[];
909
909
  }
910
- interface LsdBrowserController {
910
+ interface LsdBrowserController$1 {
911
911
  launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdLaunchOptions): Promise<LsdBrowser>;
912
912
  connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdConnectOptions): Promise<LsdBrowser>;
913
913
  }
@@ -1005,7 +1005,7 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
1005
1005
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1006
1006
  scrollBy(x: number, y: number): Promise<boolean>;
1007
1007
  scrollTo(x: number, y: number): Promise<boolean>;
1008
- sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<object>;
1008
+ sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
1009
1009
  setCookies(cookies: CookieItem[]): Promise<boolean>;
1010
1010
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1011
1011
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -1113,7 +1113,7 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1113
1113
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1114
1114
  scrollBy(x: number, y: number): Promise<boolean>;
1115
1115
  scrollTo(x: number, y: number): Promise<boolean>;
1116
- sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<object>;
1116
+ sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
1117
1117
  setCookies(cookies: CookieItem[]): Promise<boolean>;
1118
1118
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1119
1119
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -1185,7 +1185,7 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
1185
1185
  screenshot(): Promise<Buffer>;
1186
1186
  scrollBy(): Promise<boolean>;
1187
1187
  scrollTo(): Promise<boolean>;
1188
- sendCDPMessage(): Promise<object>;
1188
+ sendCDPMessage(): Promise<any>;
1189
1189
  setCookies(): Promise<boolean>;
1190
1190
  setExtraHTTPHeaders(): Promise<boolean>;
1191
1191
  setLocalStroage(): Promise<boolean>;
@@ -1227,4 +1227,12 @@ declare class CheerioElement implements LsdElement {
1227
1227
  scrollIntoView(): Promise<boolean>;
1228
1228
  }
1229
1229
 
1230
- export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, 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 ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, defaultProxy };
1230
+ declare class LsdBrowserController implements LsdBrowserController$1 {
1231
+ #private;
1232
+ constructor();
1233
+ launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdLaunchOptions): Promise<LsdBrowser>;
1234
+ connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdConnectOptions): Promise<LsdBrowser>;
1235
+ }
1236
+ declare const controller: LsdBrowserController;
1237
+
1238
+ export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, 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 ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, defaultProxy };
package/dist/index.js CHANGED
@@ -1081,7 +1081,25 @@ var PlaywrightPage = class extends EventEmitter {
1081
1081
  retObj = retObj[key];
1082
1082
  }
1083
1083
  }
1084
- return JSON.stringify(retObj);
1084
+ if (typeof retObj === "string") {
1085
+ return retObj;
1086
+ } else if (typeof retObj === "number") {
1087
+ return String(retObj);
1088
+ } else if (typeof retObj === "boolean") {
1089
+ return String(Number(retObj));
1090
+ } else if (!retObj) {
1091
+ return "";
1092
+ } else if (typeof retObj === "object") {
1093
+ try {
1094
+ return JSON.stringify(retObj);
1095
+ } catch (err) {
1096
+ return "";
1097
+ }
1098
+ } else if (typeof retObj === "bigint") {
1099
+ return String(retObj);
1100
+ } else {
1101
+ return "";
1102
+ }
1085
1103
  },
1086
1104
  keys
1087
1105
  );
@@ -2513,7 +2531,25 @@ var PuppeteerPage = class extends EventEmitter4 {
2513
2531
  retObj = retObj[key];
2514
2532
  }
2515
2533
  }
2516
- return JSON.stringify(retObj);
2534
+ if (typeof retObj === "string") {
2535
+ return retObj;
2536
+ } else if (typeof retObj === "number") {
2537
+ return String(retObj);
2538
+ } else if (typeof retObj === "boolean") {
2539
+ return String(Number(retObj));
2540
+ } else if (!retObj) {
2541
+ return "";
2542
+ } else if (typeof retObj === "object") {
2543
+ try {
2544
+ return JSON.stringify(retObj);
2545
+ } catch (err) {
2546
+ return "";
2547
+ }
2548
+ } else if (typeof retObj === "bigint") {
2549
+ return String(retObj);
2550
+ } else {
2551
+ return "";
2552
+ }
2517
2553
  },
2518
2554
  keys
2519
2555
  );
@@ -17252,5 +17288,6 @@ export {
17252
17288
  PuppeteerBrowserContext,
17253
17289
  PuppeteerElement,
17254
17290
  PuppeteerPage,
17291
+ controller,
17255
17292
  defaultProxy
17256
17293
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsscrapedata/controller",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Unified browser / HTML controller interfaces that support playwright, puppeteer and cheerio",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",