@iflyrpa/playwright 1.0.15-beta.0 → 1.0.15-beta.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 +170 -472
- package/dist/index.d.cts +39 -89
- package/dist/index.d.mts +39 -89
- package/dist/index.d.ts +39 -89
- package/dist/index.mjs +167 -468
- package/package.json +37 -30
package/dist/index.d.cts
CHANGED
|
@@ -1,86 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XiaohongshuPublishParams } from '@iflyrpa/actions';
|
|
2
|
+
export { XiaohongshuPublishParams } from '@iflyrpa/actions';
|
|
3
|
+
import * as playwright_core from 'playwright-core';
|
|
4
|
+
import { LoggerImplement, AutomateTask, ElectronApplication, PageParams } from '@iflyrpa/share';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The value of the cookie. Empty by default if omitted.
|
|
15
|
-
*/
|
|
16
|
-
value?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The domain of the cookie; this will be normalized with a preceding dot so that
|
|
19
|
-
* it's also valid for subdomains. Empty by default if omitted.
|
|
20
|
-
*/
|
|
21
|
-
domain?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The path of the cookie. Empty by default if omitted.
|
|
24
|
-
*/
|
|
25
|
-
path?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Whether the cookie should be marked as Secure. Defaults to false unless Same
|
|
28
|
-
* Site=None attribute is used.
|
|
29
|
-
*/
|
|
30
|
-
secure?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the cookie should be marked as HTTP only. Defaults to false.
|
|
33
|
-
*/
|
|
34
|
-
httpOnly?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
|
37
|
-
* If omitted then the cookie becomes a session cookie and will not be retained
|
|
38
|
-
* between sessions.
|
|
39
|
-
*/
|
|
40
|
-
expirationDate?: number;
|
|
41
|
-
/**
|
|
42
|
-
* The Same Site policy to apply to this cookie. Can be `unspecified`,
|
|
43
|
-
* `no_restriction`, `lax` or `strict`. Default is `lax`.
|
|
44
|
-
*/
|
|
45
|
-
sameSite?: "unspecified" | "no_restriction" | "lax" | "strict";
|
|
6
|
+
declare class Logger implements LoggerImplement {
|
|
7
|
+
static instance: Logger | null;
|
|
8
|
+
private stream;
|
|
9
|
+
constructor(cachePath: string);
|
|
10
|
+
static getInstance(cachePath: string): Logger;
|
|
11
|
+
debug(...msg: any[]): void;
|
|
12
|
+
info(...msg: any[]): void;
|
|
13
|
+
warn(...msg: any[]): void;
|
|
14
|
+
error(prefix: string, err?: unknown): void;
|
|
15
|
+
close(): void;
|
|
46
16
|
}
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface SourceStatement {
|
|
59
|
-
type: "source-statement"; // 内容来源声明
|
|
60
|
-
childType: "self-labeling" | "self-shooting" | "transshipment"; // 已自主标注 / 自助拍摄 / 转载
|
|
61
|
-
shootingLocation?: string; // 拍摄地点
|
|
62
|
-
shootingDate?: string; // 拍摄日期
|
|
63
|
-
sourceMedia?: string; // 来源媒体
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
type SelfDeclaration = FictionalRendition | AIGenerated | SourceStatement;
|
|
67
|
-
|
|
68
|
-
interface ActiomCommonParams {
|
|
69
|
-
url?: string;
|
|
70
|
-
cookies?: CookieMap;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface XiaohonshuPublishParams
|
|
74
|
-
extends Omit<ActiomCommonParams, "cookies"> {
|
|
75
|
-
cookies: Partial<CookiesSetDetails>[];
|
|
76
|
-
banners: string[]; // 图片
|
|
77
|
-
title: string; // 标题
|
|
78
|
-
content: string; // 正文
|
|
79
|
-
address?: string; // 地点
|
|
80
|
-
selfDeclaration?: SelfDeclaration; // 自主声明
|
|
81
|
-
visibleRange: "public" | "private"; // 可见范围
|
|
82
|
-
isImmediatelyPublish?: boolean; // 是否立即发布
|
|
83
|
-
scheduledPublish?: string; // 定时发布时间
|
|
18
|
+
declare class PackageManager {
|
|
19
|
+
private task;
|
|
20
|
+
constructor(task: Task);
|
|
21
|
+
private getManifest;
|
|
22
|
+
private extract;
|
|
23
|
+
require(module: string): any;
|
|
24
|
+
install(name: string, version: string): Promise<void>;
|
|
25
|
+
update(name: string): Promise<string>;
|
|
84
26
|
}
|
|
85
27
|
|
|
86
28
|
interface TaskParams {
|
|
@@ -88,13 +30,19 @@ interface TaskParams {
|
|
|
88
30
|
cachePath: string;
|
|
89
31
|
forceUpdate?: boolean;
|
|
90
32
|
}
|
|
91
|
-
declare class
|
|
92
|
-
|
|
33
|
+
declare class Task implements AutomateTask {
|
|
34
|
+
logger: Logger;
|
|
93
35
|
cachePath: string;
|
|
94
36
|
debug: boolean;
|
|
37
|
+
packagesDir: string;
|
|
38
|
+
packageManager: PackageManager;
|
|
95
39
|
private playwrightPackage;
|
|
96
40
|
private electronPackage;
|
|
97
41
|
private _electronApp;
|
|
42
|
+
/**
|
|
43
|
+
* 应用是否已关闭
|
|
44
|
+
*/
|
|
45
|
+
isClosed: boolean;
|
|
98
46
|
constructor({ cachePath, debug }: TaskParams);
|
|
99
47
|
/**
|
|
100
48
|
* 安装 playwright
|
|
@@ -115,7 +63,7 @@ declare class LocalAutomateTask implements TaskParams {
|
|
|
115
63
|
* 临时文件目录
|
|
116
64
|
* @returns
|
|
117
65
|
*/
|
|
118
|
-
|
|
66
|
+
getTmpPath(): string;
|
|
119
67
|
/**
|
|
120
68
|
* 清空临时文件
|
|
121
69
|
*/
|
|
@@ -125,13 +73,15 @@ declare class LocalAutomateTask implements TaskParams {
|
|
|
125
73
|
* @returns
|
|
126
74
|
*/
|
|
127
75
|
close(): Promise<void>;
|
|
128
|
-
|
|
129
|
-
* 小红书自动化发布
|
|
130
|
-
*/
|
|
131
|
-
xiaohongshuPublish(params: XiaohonshuPublishParams): Promise<string>;
|
|
76
|
+
createPage(pageParams: PageParams): Promise<playwright_core.Page>;
|
|
132
77
|
}
|
|
133
|
-
declare const RpaTask: (params: TaskParams) => LocalAutomateTask;
|
|
134
78
|
|
|
79
|
+
declare class RpaTask extends Task {
|
|
80
|
+
private actions;
|
|
81
|
+
constructor(params: TaskParams);
|
|
82
|
+
private update;
|
|
83
|
+
xiaohongshuPublish(params: XiaohongshuPublishParams): Promise<string>;
|
|
84
|
+
}
|
|
135
85
|
declare const version: string;
|
|
136
86
|
|
|
137
|
-
export {
|
|
87
|
+
export { RpaTask, version };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,86 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XiaohongshuPublishParams } from '@iflyrpa/actions';
|
|
2
|
+
export { XiaohongshuPublishParams } from '@iflyrpa/actions';
|
|
3
|
+
import * as playwright_core from 'playwright-core';
|
|
4
|
+
import { LoggerImplement, AutomateTask, ElectronApplication, PageParams } from '@iflyrpa/share';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The value of the cookie. Empty by default if omitted.
|
|
15
|
-
*/
|
|
16
|
-
value?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The domain of the cookie; this will be normalized with a preceding dot so that
|
|
19
|
-
* it's also valid for subdomains. Empty by default if omitted.
|
|
20
|
-
*/
|
|
21
|
-
domain?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The path of the cookie. Empty by default if omitted.
|
|
24
|
-
*/
|
|
25
|
-
path?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Whether the cookie should be marked as Secure. Defaults to false unless Same
|
|
28
|
-
* Site=None attribute is used.
|
|
29
|
-
*/
|
|
30
|
-
secure?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the cookie should be marked as HTTP only. Defaults to false.
|
|
33
|
-
*/
|
|
34
|
-
httpOnly?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
|
37
|
-
* If omitted then the cookie becomes a session cookie and will not be retained
|
|
38
|
-
* between sessions.
|
|
39
|
-
*/
|
|
40
|
-
expirationDate?: number;
|
|
41
|
-
/**
|
|
42
|
-
* The Same Site policy to apply to this cookie. Can be `unspecified`,
|
|
43
|
-
* `no_restriction`, `lax` or `strict`. Default is `lax`.
|
|
44
|
-
*/
|
|
45
|
-
sameSite?: "unspecified" | "no_restriction" | "lax" | "strict";
|
|
6
|
+
declare class Logger implements LoggerImplement {
|
|
7
|
+
static instance: Logger | null;
|
|
8
|
+
private stream;
|
|
9
|
+
constructor(cachePath: string);
|
|
10
|
+
static getInstance(cachePath: string): Logger;
|
|
11
|
+
debug(...msg: any[]): void;
|
|
12
|
+
info(...msg: any[]): void;
|
|
13
|
+
warn(...msg: any[]): void;
|
|
14
|
+
error(prefix: string, err?: unknown): void;
|
|
15
|
+
close(): void;
|
|
46
16
|
}
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface SourceStatement {
|
|
59
|
-
type: "source-statement"; // 内容来源声明
|
|
60
|
-
childType: "self-labeling" | "self-shooting" | "transshipment"; // 已自主标注 / 自助拍摄 / 转载
|
|
61
|
-
shootingLocation?: string; // 拍摄地点
|
|
62
|
-
shootingDate?: string; // 拍摄日期
|
|
63
|
-
sourceMedia?: string; // 来源媒体
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
type SelfDeclaration = FictionalRendition | AIGenerated | SourceStatement;
|
|
67
|
-
|
|
68
|
-
interface ActiomCommonParams {
|
|
69
|
-
url?: string;
|
|
70
|
-
cookies?: CookieMap;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface XiaohonshuPublishParams
|
|
74
|
-
extends Omit<ActiomCommonParams, "cookies"> {
|
|
75
|
-
cookies: Partial<CookiesSetDetails>[];
|
|
76
|
-
banners: string[]; // 图片
|
|
77
|
-
title: string; // 标题
|
|
78
|
-
content: string; // 正文
|
|
79
|
-
address?: string; // 地点
|
|
80
|
-
selfDeclaration?: SelfDeclaration; // 自主声明
|
|
81
|
-
visibleRange: "public" | "private"; // 可见范围
|
|
82
|
-
isImmediatelyPublish?: boolean; // 是否立即发布
|
|
83
|
-
scheduledPublish?: string; // 定时发布时间
|
|
18
|
+
declare class PackageManager {
|
|
19
|
+
private task;
|
|
20
|
+
constructor(task: Task);
|
|
21
|
+
private getManifest;
|
|
22
|
+
private extract;
|
|
23
|
+
require(module: string): any;
|
|
24
|
+
install(name: string, version: string): Promise<void>;
|
|
25
|
+
update(name: string): Promise<string>;
|
|
84
26
|
}
|
|
85
27
|
|
|
86
28
|
interface TaskParams {
|
|
@@ -88,13 +30,19 @@ interface TaskParams {
|
|
|
88
30
|
cachePath: string;
|
|
89
31
|
forceUpdate?: boolean;
|
|
90
32
|
}
|
|
91
|
-
declare class
|
|
92
|
-
|
|
33
|
+
declare class Task implements AutomateTask {
|
|
34
|
+
logger: Logger;
|
|
93
35
|
cachePath: string;
|
|
94
36
|
debug: boolean;
|
|
37
|
+
packagesDir: string;
|
|
38
|
+
packageManager: PackageManager;
|
|
95
39
|
private playwrightPackage;
|
|
96
40
|
private electronPackage;
|
|
97
41
|
private _electronApp;
|
|
42
|
+
/**
|
|
43
|
+
* 应用是否已关闭
|
|
44
|
+
*/
|
|
45
|
+
isClosed: boolean;
|
|
98
46
|
constructor({ cachePath, debug }: TaskParams);
|
|
99
47
|
/**
|
|
100
48
|
* 安装 playwright
|
|
@@ -115,7 +63,7 @@ declare class LocalAutomateTask implements TaskParams {
|
|
|
115
63
|
* 临时文件目录
|
|
116
64
|
* @returns
|
|
117
65
|
*/
|
|
118
|
-
|
|
66
|
+
getTmpPath(): string;
|
|
119
67
|
/**
|
|
120
68
|
* 清空临时文件
|
|
121
69
|
*/
|
|
@@ -125,13 +73,15 @@ declare class LocalAutomateTask implements TaskParams {
|
|
|
125
73
|
* @returns
|
|
126
74
|
*/
|
|
127
75
|
close(): Promise<void>;
|
|
128
|
-
|
|
129
|
-
* 小红书自动化发布
|
|
130
|
-
*/
|
|
131
|
-
xiaohongshuPublish(params: XiaohonshuPublishParams): Promise<string>;
|
|
76
|
+
createPage(pageParams: PageParams): Promise<playwright_core.Page>;
|
|
132
77
|
}
|
|
133
|
-
declare const RpaTask: (params: TaskParams) => LocalAutomateTask;
|
|
134
78
|
|
|
79
|
+
declare class RpaTask extends Task {
|
|
80
|
+
private actions;
|
|
81
|
+
constructor(params: TaskParams);
|
|
82
|
+
private update;
|
|
83
|
+
xiaohongshuPublish(params: XiaohongshuPublishParams): Promise<string>;
|
|
84
|
+
}
|
|
135
85
|
declare const version: string;
|
|
136
86
|
|
|
137
|
-
export {
|
|
87
|
+
export { RpaTask, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,86 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XiaohongshuPublishParams } from '@iflyrpa/actions';
|
|
2
|
+
export { XiaohongshuPublishParams } from '@iflyrpa/actions';
|
|
3
|
+
import * as playwright_core from 'playwright-core';
|
|
4
|
+
import { LoggerImplement, AutomateTask, ElectronApplication, PageParams } from '@iflyrpa/share';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The value of the cookie. Empty by default if omitted.
|
|
15
|
-
*/
|
|
16
|
-
value?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The domain of the cookie; this will be normalized with a preceding dot so that
|
|
19
|
-
* it's also valid for subdomains. Empty by default if omitted.
|
|
20
|
-
*/
|
|
21
|
-
domain?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The path of the cookie. Empty by default if omitted.
|
|
24
|
-
*/
|
|
25
|
-
path?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Whether the cookie should be marked as Secure. Defaults to false unless Same
|
|
28
|
-
* Site=None attribute is used.
|
|
29
|
-
*/
|
|
30
|
-
secure?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the cookie should be marked as HTTP only. Defaults to false.
|
|
33
|
-
*/
|
|
34
|
-
httpOnly?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
|
37
|
-
* If omitted then the cookie becomes a session cookie and will not be retained
|
|
38
|
-
* between sessions.
|
|
39
|
-
*/
|
|
40
|
-
expirationDate?: number;
|
|
41
|
-
/**
|
|
42
|
-
* The Same Site policy to apply to this cookie. Can be `unspecified`,
|
|
43
|
-
* `no_restriction`, `lax` or `strict`. Default is `lax`.
|
|
44
|
-
*/
|
|
45
|
-
sameSite?: "unspecified" | "no_restriction" | "lax" | "strict";
|
|
6
|
+
declare class Logger implements LoggerImplement {
|
|
7
|
+
static instance: Logger | null;
|
|
8
|
+
private stream;
|
|
9
|
+
constructor(cachePath: string);
|
|
10
|
+
static getInstance(cachePath: string): Logger;
|
|
11
|
+
debug(...msg: any[]): void;
|
|
12
|
+
info(...msg: any[]): void;
|
|
13
|
+
warn(...msg: any[]): void;
|
|
14
|
+
error(prefix: string, err?: unknown): void;
|
|
15
|
+
close(): void;
|
|
46
16
|
}
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface SourceStatement {
|
|
59
|
-
type: "source-statement"; // 内容来源声明
|
|
60
|
-
childType: "self-labeling" | "self-shooting" | "transshipment"; // 已自主标注 / 自助拍摄 / 转载
|
|
61
|
-
shootingLocation?: string; // 拍摄地点
|
|
62
|
-
shootingDate?: string; // 拍摄日期
|
|
63
|
-
sourceMedia?: string; // 来源媒体
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
type SelfDeclaration = FictionalRendition | AIGenerated | SourceStatement;
|
|
67
|
-
|
|
68
|
-
interface ActiomCommonParams {
|
|
69
|
-
url?: string;
|
|
70
|
-
cookies?: CookieMap;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface XiaohonshuPublishParams
|
|
74
|
-
extends Omit<ActiomCommonParams, "cookies"> {
|
|
75
|
-
cookies: Partial<CookiesSetDetails>[];
|
|
76
|
-
banners: string[]; // 图片
|
|
77
|
-
title: string; // 标题
|
|
78
|
-
content: string; // 正文
|
|
79
|
-
address?: string; // 地点
|
|
80
|
-
selfDeclaration?: SelfDeclaration; // 自主声明
|
|
81
|
-
visibleRange: "public" | "private"; // 可见范围
|
|
82
|
-
isImmediatelyPublish?: boolean; // 是否立即发布
|
|
83
|
-
scheduledPublish?: string; // 定时发布时间
|
|
18
|
+
declare class PackageManager {
|
|
19
|
+
private task;
|
|
20
|
+
constructor(task: Task);
|
|
21
|
+
private getManifest;
|
|
22
|
+
private extract;
|
|
23
|
+
require(module: string): any;
|
|
24
|
+
install(name: string, version: string): Promise<void>;
|
|
25
|
+
update(name: string): Promise<string>;
|
|
84
26
|
}
|
|
85
27
|
|
|
86
28
|
interface TaskParams {
|
|
@@ -88,13 +30,19 @@ interface TaskParams {
|
|
|
88
30
|
cachePath: string;
|
|
89
31
|
forceUpdate?: boolean;
|
|
90
32
|
}
|
|
91
|
-
declare class
|
|
92
|
-
|
|
33
|
+
declare class Task implements AutomateTask {
|
|
34
|
+
logger: Logger;
|
|
93
35
|
cachePath: string;
|
|
94
36
|
debug: boolean;
|
|
37
|
+
packagesDir: string;
|
|
38
|
+
packageManager: PackageManager;
|
|
95
39
|
private playwrightPackage;
|
|
96
40
|
private electronPackage;
|
|
97
41
|
private _electronApp;
|
|
42
|
+
/**
|
|
43
|
+
* 应用是否已关闭
|
|
44
|
+
*/
|
|
45
|
+
isClosed: boolean;
|
|
98
46
|
constructor({ cachePath, debug }: TaskParams);
|
|
99
47
|
/**
|
|
100
48
|
* 安装 playwright
|
|
@@ -115,7 +63,7 @@ declare class LocalAutomateTask implements TaskParams {
|
|
|
115
63
|
* 临时文件目录
|
|
116
64
|
* @returns
|
|
117
65
|
*/
|
|
118
|
-
|
|
66
|
+
getTmpPath(): string;
|
|
119
67
|
/**
|
|
120
68
|
* 清空临时文件
|
|
121
69
|
*/
|
|
@@ -125,13 +73,15 @@ declare class LocalAutomateTask implements TaskParams {
|
|
|
125
73
|
* @returns
|
|
126
74
|
*/
|
|
127
75
|
close(): Promise<void>;
|
|
128
|
-
|
|
129
|
-
* 小红书自动化发布
|
|
130
|
-
*/
|
|
131
|
-
xiaohongshuPublish(params: XiaohonshuPublishParams): Promise<string>;
|
|
76
|
+
createPage(pageParams: PageParams): Promise<playwright_core.Page>;
|
|
132
77
|
}
|
|
133
|
-
declare const RpaTask: (params: TaskParams) => LocalAutomateTask;
|
|
134
78
|
|
|
79
|
+
declare class RpaTask extends Task {
|
|
80
|
+
private actions;
|
|
81
|
+
constructor(params: TaskParams);
|
|
82
|
+
private update;
|
|
83
|
+
xiaohongshuPublish(params: XiaohongshuPublishParams): Promise<string>;
|
|
84
|
+
}
|
|
135
85
|
declare const version: string;
|
|
136
86
|
|
|
137
|
-
export {
|
|
87
|
+
export { RpaTask, version };
|