@skrillex1224/playwright-toolkit 2.1.171 → 2.1.180
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/browser.js +15 -15
- package/dist/browser.js.map +2 -2
- package/dist/index.cjs +885 -338
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +885 -338
- package/dist/index.js.map +4 -4
- package/index.d.ts +52 -39
- package/package.json +3 -1
package/index.d.ts
CHANGED
|
@@ -186,8 +186,8 @@ export interface RunStepOptions {
|
|
|
186
186
|
export interface ApifyKitInstance {
|
|
187
187
|
runStep<T>(step: string, page: Page | null, actionFn: () => Promise<T>, options?: RunStepOptions): Promise<T>;
|
|
188
188
|
runStepLoose<T>(step: string, page: Page | null, fn: () => Promise<T>, options?: RunStepOptions): Promise<T>;
|
|
189
|
-
pushSuccess(data: Record<string, any
|
|
190
|
-
pushFailed(error: Error | CrawlerError, meta?: Record<string, any
|
|
189
|
+
pushSuccess(data: Record<string, any>, options?: { page?: Page | null }): Promise<void>;
|
|
190
|
+
pushFailed(error: Error | CrawlerError, meta?: Record<string, any>, options?: { page?: Page | null }): Promise<void>;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
export interface ApifyKitModule {
|
|
@@ -306,6 +306,7 @@ export interface GetPlaywrightCrawlerOptionsInput {
|
|
|
306
306
|
debugMode?: boolean;
|
|
307
307
|
isRunningOnApify?: boolean;
|
|
308
308
|
launcher?: any;
|
|
309
|
+
runtimeState?: RuntimeEnvState | null;
|
|
309
310
|
preNavigationHooks?: CrawlerNavigationHook[];
|
|
310
311
|
postNavigationHooks?: CrawlerNavigationHook[];
|
|
311
312
|
}
|
|
@@ -344,36 +345,6 @@ export interface CaptchaModule {
|
|
|
344
345
|
useCaptchaMonitor(page: Page, options: CaptchaMonitorOptions): { stop: () => Promise<void> };
|
|
345
346
|
}
|
|
346
347
|
|
|
347
|
-
// =============================================================================
|
|
348
|
-
// Sse
|
|
349
|
-
// =============================================================================
|
|
350
|
-
export interface SseInterceptOnDataCallback {
|
|
351
|
-
(textChunk: string, resolve: (value: any) => void, accumulatedText: string): void;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
export interface SseInterceptOnEndCallback {
|
|
355
|
-
(fullText: string, resolve: (value: any) => void): void;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export interface SseInterceptOnTimeoutCallback {
|
|
359
|
-
(error: Error, reject: (reason?: any) => void): void;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export interface SseInterceptOptions {
|
|
363
|
-
onData?: SseInterceptOnDataCallback;
|
|
364
|
-
onEnd?: SseInterceptOnEndCallback;
|
|
365
|
-
onTimeout?: SseInterceptOnTimeoutCallback;
|
|
366
|
-
initialTimeout?: number;
|
|
367
|
-
overallTimeout?: number;
|
|
368
|
-
autoUnroute?: boolean;
|
|
369
|
-
firstMatchOnly?: boolean;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export interface SseModule {
|
|
373
|
-
parseSseStream(sseText: string): any[];
|
|
374
|
-
intercept(page: Page, urlPattern: string | RegExp, options?: SseInterceptOptions): Promise<any>;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
348
|
// =============================================================================
|
|
378
349
|
// Utils
|
|
379
350
|
// =============================================================================
|
|
@@ -389,6 +360,48 @@ export interface UtilsModule {
|
|
|
389
360
|
parseLinks(text: string, options?: { prefix?: string }): string[];
|
|
390
361
|
}
|
|
391
362
|
|
|
363
|
+
export interface RuntimeEnvState {
|
|
364
|
+
actor: string;
|
|
365
|
+
runtime: Record<string, any>;
|
|
366
|
+
envId: string;
|
|
367
|
+
auth: Record<string, string>;
|
|
368
|
+
cookies: ParsedCookie[];
|
|
369
|
+
cookieMap: Record<string, string>;
|
|
370
|
+
localStorage: Record<string, string>;
|
|
371
|
+
sessionStorage: Record<string, string>;
|
|
372
|
+
browserProfile: {
|
|
373
|
+
core?: Record<string, any>;
|
|
374
|
+
observed?: Record<string, any>;
|
|
375
|
+
};
|
|
376
|
+
browserProfileCore: Record<string, any>;
|
|
377
|
+
browserProfileObserved: Record<string, any>;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface RuntimeEnvApplyOptions {
|
|
381
|
+
actor?: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface RuntimeEnvModule {
|
|
385
|
+
parseInput(input?: Record<string, any>, actor?: string): RuntimeEnvState;
|
|
386
|
+
buildEnvPatch(source?: Record<string, any>, actor?: string): Record<string, any> | null;
|
|
387
|
+
mergeEnvPatches(...patches: Array<Record<string, any> | null | undefined>): Record<string, any> | null;
|
|
388
|
+
hasLoginState(source?: Record<string, any>, actor?: string): boolean;
|
|
389
|
+
getAuthValue(source?: Record<string, any>, key?: string, actor?: string): string;
|
|
390
|
+
rememberState(source?: Record<string, any>): RuntimeEnvState | null;
|
|
391
|
+
peekRememberedState(): RuntimeEnvState | null;
|
|
392
|
+
getBrowserProfileCore(source?: Record<string, any>, actor?: string): Record<string, any>;
|
|
393
|
+
setBrowserProfileCore(source?: Record<string, any>, core?: Record<string, any>, actor?: string): RuntimeEnvState;
|
|
394
|
+
applyToPage(page: Page, source?: Record<string, any>, options?: RuntimeEnvApplyOptions): Promise<void>;
|
|
395
|
+
captureEnvPatch(page: Page | null, source?: Record<string, any>, options?: RuntimeEnvApplyOptions): Promise<Record<string, any> | null>;
|
|
396
|
+
tryParseJSON(value: any): any;
|
|
397
|
+
normalizeCookies(value: any): ParsedCookie[];
|
|
398
|
+
normalizeLocalStorage(value: any): Record<string, string>;
|
|
399
|
+
normalizeSessionStorage(value: any): Record<string, string>;
|
|
400
|
+
normalizeAuth(value: any): Record<string, string>;
|
|
401
|
+
normalizeBrowserProfileCore(value: any): Record<string, any>;
|
|
402
|
+
normalizeObservedBrowserProfile(value: any): Record<string, any>;
|
|
403
|
+
}
|
|
404
|
+
|
|
392
405
|
// =============================================================================
|
|
393
406
|
// Share
|
|
394
407
|
// =============================================================================
|
|
@@ -431,18 +444,18 @@ export interface ShareModule {
|
|
|
431
444
|
// Display
|
|
432
445
|
// =============================================================================
|
|
433
446
|
export interface DisplayModule {
|
|
434
|
-
parseTokenDisplayName(value?: string): { owner: string;
|
|
435
|
-
|
|
436
|
-
buildTokenDisplayName(input: { owner: string;
|
|
447
|
+
parseTokenDisplayName(value?: string): { owner: string; envType: string; note: string };
|
|
448
|
+
parseEnvDisplayName(value?: string): { env: string; owner: string; envType: string; note: string };
|
|
449
|
+
buildTokenDisplayName(input: { owner: string; envType: string; note?: string }): string;
|
|
437
450
|
shortId(value?: string, max?: number): string;
|
|
438
451
|
resolveTokenIdentity(
|
|
439
452
|
displayName?: string,
|
|
440
453
|
tokenId?: string
|
|
441
454
|
): { primary: string; secondary: string; fullId: string; shortId: string };
|
|
442
|
-
|
|
455
|
+
resolveEnvIdentity(
|
|
443
456
|
displayName?: string,
|
|
444
|
-
|
|
445
|
-
): { primary: string; secondary: string; fullId: string; shortId: string; parts: {
|
|
457
|
+
envId?: string
|
|
458
|
+
): { primary: string; secondary: string; fullId: string; shortId: string; parts: { env: string; owner: string; envType: string; note: string } };
|
|
446
459
|
}
|
|
447
460
|
|
|
448
461
|
// =============================================================================
|
|
@@ -570,9 +583,9 @@ export interface PlaywrightToolKit {
|
|
|
570
583
|
LiveView: LiveViewModule;
|
|
571
584
|
Constants: ConstantsModule;
|
|
572
585
|
Utils: UtilsModule;
|
|
586
|
+
RuntimeEnv: RuntimeEnvModule;
|
|
573
587
|
Display: DisplayModule;
|
|
574
588
|
Captcha: CaptchaModule;
|
|
575
|
-
Sse: SseModule;
|
|
576
589
|
Errors: ErrorsModule;
|
|
577
590
|
Mutation: MutationModule;
|
|
578
591
|
ByPass: ByPassModule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skrillex1224/playwright-toolkit",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.180",
|
|
4
4
|
"description": "一个在 Apify/Crawlee Actor 中启用实时截图视图的实用工具库。",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"license": "ISC",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"express": "^4.18.2",
|
|
46
|
+
"fingerprint-generator": "^2.1.79",
|
|
47
|
+
"fingerprint-injector": "^2.1.79",
|
|
46
48
|
"got-scraping": "^4.1.3",
|
|
47
49
|
"picomatch": "^4.0.3",
|
|
48
50
|
"serialize-error": "^12.0.0",
|