epii-types-rpa 1.3.8 → 1.5.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rpa.d.ts +46 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epii-types-rpa",
3
- "version": "1.3.8",
3
+ "version": "1.5.0",
4
4
  "description": "rpa-types",
5
5
  "author": "MrRen",
6
6
  "license": "ISC",
package/rpa.d.ts CHANGED
@@ -9,7 +9,7 @@ interface RequestHandler {
9
9
  file?: String,
10
10
  content?: String,
11
11
  getLocation?: (url: string) => string,
12
- path?:string
12
+ path?: string
13
13
  }
14
14
 
15
15
  interface FormItem {
@@ -19,23 +19,34 @@ interface FormItem {
19
19
  }
20
20
  type RunInPage = "activated" | "incognito" | "newPage" | "opened" | "";
21
21
  type ExtObject = {
22
- getProperty:(key:string)=>Promise<any>,
23
- keys:()=>Promise<Array<string>>,
24
- [any:string]:(...params:any[])=>Promise<any>
22
+ getProperty: (key: string) => Promise<any>,
23
+ keys: () => Promise<Array<string>>,
24
+ [any: string]: (...params: any[]) => Promise<any>
25
25
  }
26
26
 
27
- type ReturnBoolFunc = ()=>boolean;
27
+ type ReturnBoolFunc = () => boolean;
28
28
  type ExcelSheetItem = {
29
- sheetName:string,
30
- list:Array<Record<string,any>>
29
+ sheetName: string,
30
+ list: Array<Record<string, any>>
31
31
  }
32
32
 
33
+ type PageHander = {
34
+ evaluateFunction: (func: Function, data?: Object) => Promise<any>;
35
+ waitForSelector: (selector: string) => Promise;
36
+ waitForTrue: (func: Function, data?: Object) => Promise;
37
+ waitForOnceLoad: () => Promise;
38
+ execScript: (script: String, params?: Object) => Promise,
39
+ getPageId: () => string;
40
+ goto(url: string): Promise;
41
+ setContent(html:string):Promise;
42
+ };
43
+
33
44
 
34
45
 
35
46
  declare namespace rpa {
36
- function ext(mName: string):ExtObject;
47
+ function ext(mName: string): ExtObject;
37
48
 
38
- function ready(isReady:number = 1);
49
+ function ready(isReady: number = 1);
39
50
  function args(key, dvalue);
40
51
  function args(key);
41
52
  function setArgs(key, value): Promise;
@@ -117,16 +128,16 @@ declare namespace rpa {
117
128
  function arrayBufferToBase64(buffer: String): String;
118
129
  function waitForSelector(selectorOrFunction: String | Function): Promise<Element>;
119
130
  function waitForSelectors(selectorOrFunction: String | Function): Promise<Array<Element>>
120
- function getAppDataDir(subDir:string):Promise<string>;
121
- function unlink(filepath:string):Promise<string>;
122
- function getChromeExePath():Promise<string>;
131
+ function getAppDataDir(subDir: string): Promise<string>;
132
+ function unlink(filepath: string): Promise<string>;
133
+ function getChromeExePath(): Promise<string>;
123
134
  }
124
135
  namespace page {
125
- function setViewport(viewport:Object):Promise
126
- function type(selector:string, text:string,options:Object): Promise;
136
+ function setViewport(viewport: Object): Promise
137
+ function type(selector: string, text: string, options: Object): Promise;
127
138
  function screenshot(options: Object): Promise;
128
- function elementScreenshot(selector:string,options: Object): Promise;
129
-
139
+ function elementScreenshot(selector: string, options: Object): Promise;
140
+
130
141
  function pdf(options): Promise;
131
142
 
132
143
  function waitForNavigation(options = {});
@@ -134,28 +145,36 @@ declare namespace rpa {
134
145
  function waitForXPath(xpath);
135
146
  function waitForTimeout(timeout);
136
147
  function script(func, data = {});
137
- function newIframeAndEvaluateOnWindow(win:Window,urlOrFunction:String | Function, func: Function,removeOnFinish:boolean = true, loadCountOrLoadCheckFunc:number | ReturnBoolFunc = 1): Promise;
138
- function newIframeAndEvaluate(urlOrFunction:String | Function, func: Function,removeOnFinish:boolean = true, loadCountOrLoadCheckFunc:number | ReturnBoolFunc = 1,win:Window|null = null): Promise;
139
-
148
+ function newIframeAndEvaluateOnWindow(win: Window, urlOrFunction: String | Function, func: Function, removeOnFinish: boolean = true, loadCountOrLoadCheckFunc: number | ReturnBoolFunc = 1): Promise;
149
+ function newIframeAndEvaluate(urlOrFunction: String | Function, func: Function, removeOnFinish: boolean = true, loadCountOrLoadCheckFunc: number | ReturnBoolFunc = 1, win: Window | null = null): Promise;
150
+
140
151
  function download(url: String, path: String): Promise;
141
152
  function closeActivated(): Promise;
142
153
  namespace stracing {
143
154
  function start(filePath: String): Promise;
144
155
  function stop(): Promise;
145
156
  }
157
+ function getHandler(): Promise<PageHander>
158
+ function getPageId(): Promise<string>;
146
159
 
147
160
  }
148
161
  namespace browser {
162
+ function newPageAndGetHandler(): Promise<PageHander>;
163
+ function getPageHandler(pageId: string): PageHander;
164
+
165
+ function evaluateInPage(ageId: String, func: Function, data?: Object): Promise;
166
+ function execScriptInPage(pageId: String, script: string, params?: Object): Promise;
149
167
  function newPageAndDownLoad(url: String, path: String): Promise;
150
168
  function newPageAndGetBase64(url: String): Promise;
151
169
  function newPageAndEvaluate(url: String, func: Function, data: Object = {}): Promise;
152
170
  function waitOpenedPageAndEvaluate(invokeFun: Function, func: Function, data: Object = {}): Promise;
153
171
  function waitOpenedPageAndExec(invokeFun: Function, script: String, params: Object = {}): Promise;
154
-
172
+ function waitOpenedPageAndGetHandler(invokeFun: Function):Promise<PageHander>;
173
+
155
174
  function getNextWindowOpenUrl(beforFunc: Function, cancel: boolean): Promise;
156
175
  function getNextWindowOpenUrl(beforFunc: Function): Promise;
157
176
  function newIncognitoPageAndEvaluate(url: String, func: Function, data: Object = {}): Promise;
158
- function download(invokeFun:Function, toFilePathOrExt:string|null = null,timeout:string=20000) : Promise;
177
+ function download(invokeFun: Function, toFilePathOrExt: string | null = null, timeout: string = 20000): Promise;
159
178
 
160
179
  }
161
180
  namespace runtime {
@@ -163,9 +182,9 @@ declare namespace rpa {
163
182
  function set(map: Object): Promise;
164
183
  }
165
184
  namespace frame {
166
- function newIframeAndEvaluate(urlOrFunction:String | Function, func: Function,removeOnFinish:boolean = true, loadCountOrLoadCheckFunc:number | ReturnBoolFunc = 1): Promise;
185
+ function newIframeAndEvaluate(urlOrFunction: String | Function, func: Function, removeOnFinish: boolean = true, loadCountOrLoadCheckFunc: number | ReturnBoolFunc = 1): Promise;
167
186
  function newCrossIframeContext(host: String, func: Function, data: Object = {}, removeOnFinish: Boolean = true): Promise;
168
- function newIframeAndevaluateCross(urlOrFunction:String | Function, func: Function, data = {}, removeOnFinish: Boolean = true): Promise;
187
+ function newIframeAndevaluateCross(urlOrFunction: String | Function, func: Function, data = {}, removeOnFinish: Boolean = true): Promise;
169
188
  function evaluateCross(name: String, func: Function, data = {}): Promise;
170
189
  function evaluate(name: String, func: Function): Promise;
171
190
  function evaluateOnNextFrame(invokeFun: Function, func: Function, remove: boolean): Promise;
@@ -204,10 +223,10 @@ declare namespace rpa {
204
223
  }
205
224
 
206
225
  }
207
- namespace xlsx{
208
- function parseExcel(filePath:string):Promise<Array<ExcelSheetItem>>;
209
- function parseExcelSheet(filePath:string, sheetIndex = 0):Promise<Array>;
210
- function writeExcel(filePath:string, sheets:Array<ExcelSheetItem>):Promise<any>;
226
+ namespace xlsx {
227
+ function parseExcel(filePath: string): Promise<Array<ExcelSheetItem>>;
228
+ function parseExcelSheet(filePath: string, sheetIndex = 0): Promise<Array>;
229
+ function writeExcel(filePath: string, sheets: Array<ExcelSheetItem>): Promise<any>;
211
230
 
212
231
  }
213
232
  }