@kepoai/provider 1.0.5 → 1.0.6
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/api/index.d.ts +17 -4
- package/package.json +6 -6
package/api/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Page} from 'puppeteer-core'
|
|
2
|
-
import {size} from "@kepoai/types";
|
|
1
|
+
import { Page } from 'puppeteer-core'
|
|
2
|
+
import { size } from "@kepoai/types";
|
|
3
3
|
|
|
4
4
|
// 本地存储操作类
|
|
5
5
|
export class Storage {
|
|
@@ -14,10 +14,23 @@ export class Storage {
|
|
|
14
14
|
}
|
|
15
15
|
//平台封装的puppeteer对象用于操作无头浏览器
|
|
16
16
|
declare module 'puppeteer-core' {
|
|
17
|
+
// Cookie 结构
|
|
18
|
+
interface Cookie {
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
domain?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
expires?: number;
|
|
24
|
+
httpOnly?: boolean;
|
|
25
|
+
secure?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
interface Page {
|
|
18
29
|
show(): Promise<void>; // 显示浏览器
|
|
19
30
|
hide(): Promise<void>; // 隐藏浏览器
|
|
20
31
|
setDevice(deviceType: 'desktop' | 'mobile'): Promise<void>; // 设置设备类型
|
|
32
|
+
getCookies(url?: string): Promise<Cookie[]>; // 获取 cookie(用于需要登录的组件)
|
|
33
|
+
isVisible(): Promise<boolean>; // 判断窗口是否可见(用于轮询等待登录完成)
|
|
21
34
|
}
|
|
22
35
|
}
|
|
23
36
|
|
|
@@ -39,7 +52,7 @@ interface OptionBase<T> {
|
|
|
39
52
|
disable?: boolean
|
|
40
53
|
error?: string
|
|
41
54
|
value?: T
|
|
42
|
-
defaultValue?:T
|
|
55
|
+
defaultValue?: T
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
// 输入选项结构
|
|
@@ -81,7 +94,7 @@ export interface SwitchOption extends OptionBase<boolean> {
|
|
|
81
94
|
// 按钮选项结构
|
|
82
95
|
export interface ButtonOption extends OptionBase<string> {
|
|
83
96
|
type: 'button';
|
|
84
|
-
event
|
|
97
|
+
event: ?{
|
|
85
98
|
onLoad?: (e: OptionEvent) => void;
|
|
86
99
|
onClick: (e: OptionEvent) => void;
|
|
87
100
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kepoai/provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./api": {
|
|
7
7
|
"import": "./api/index.d.ts"
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"watch": "tsc --watch"
|
|
13
|
+
},
|
|
10
14
|
"author": "",
|
|
11
15
|
"license": "ISC",
|
|
12
16
|
"dependencies": {
|
|
@@ -15,9 +19,5 @@
|
|
|
15
19
|
"puppeteer-core": "^22.4.1",
|
|
16
20
|
"typescript": "^5.3.3",
|
|
17
21
|
"@kepoai/types": "^0.0.3"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"watch": "tsc --watch"
|
|
22
22
|
}
|
|
23
|
-
}
|
|
23
|
+
}
|