epii-types-rpa 1.2.6 → 1.2.8

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 +41 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epii-types-rpa",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "rpa-types",
5
5
  "author": "MrRen",
6
6
  "license": "ISC",
package/rpa.d.ts CHANGED
@@ -5,9 +5,10 @@ interface UploadFile {
5
5
  }
6
6
  interface RequestHandler {
7
7
  reg: String,
8
- type: "file" | "content" | "abort",
8
+ type: "file" | "content" | "abort" | "redirect",
9
9
  file?: String,
10
- content?: String
10
+ content?: String,
11
+ getLocation?: (url: string) => string
11
12
  }
12
13
 
13
14
  interface FormItem {
@@ -16,8 +17,13 @@ interface FormItem {
16
17
  value?: any
17
18
  }
18
19
  type RunInPage = "activated" | "incognito" | "newPage" | "opened" | "";
19
-
20
+ type ExtObject = {
21
+ getProperty:(key:string)=>Promise<any>,
22
+ keys:()=>Promise<Array<string>>,
23
+ [any:string]:(...params:any[])=>Promise<any>
24
+ }
20
25
  namespace rpa {
26
+ function ext(mName: string):ExtObject;
21
27
  function ready(isReady = 1);
22
28
 
23
29
  function args(key, dvalue);
@@ -27,8 +33,8 @@ namespace rpa {
27
33
  function mergeArgs(map: Object): Promise;
28
34
  function require(path: String): Promise;
29
35
  function success(data: any, exit: boolean);
30
- function exec(script: String, params: Object = {},runInPage:RunInPage="");
31
- function execScript(script: String, params: Object = {},runInPage:RunInPage="");
36
+ function exec(script: String, params: Object = {}, runInPage: RunInPage = "");
37
+ function execScript(script: String, params: Object = {}, runInPage: RunInPage = "");
32
38
 
33
39
  function execPuppeteer(script: String, params: Object = {});
34
40
  function error(msg: String, code: number = - 1);
@@ -37,8 +43,8 @@ namespace rpa {
37
43
  function restartRpa();
38
44
 
39
45
  function onDialog(callback: Function);
40
- function waitForRpaReady():Promise;
41
- function run(func:Function,data:Object = {}):Promise;
46
+ function waitForRpaReady(): Promise;
47
+ function run(func: Function, data: Object = {}): Promise;
42
48
  namespace http {
43
49
  function uploadFile(url: String, file: UploadFile, params: Object = {}): Promise;
44
50
  function get(url: String): Promise;
@@ -54,8 +60,8 @@ namespace rpa {
54
60
  function get(url: String, headers: Object = {}): Promise;
55
61
  function getBase64(url: String, headers: Object = {}): Promise;
56
62
  function download(url: String, path: String): Promise;
57
- function setApiBase(_url_pre:String);
58
- function setBaseData(data:Object);
63
+ function setApiBase(_url_pre: String);
64
+ function setBaseData(data: Object);
59
65
  }
60
66
 
61
67
  namespace console {
@@ -64,16 +70,16 @@ namespace rpa {
64
70
  function readline(tip: String = "", dvalue = ""): Promise;
65
71
  }
66
72
  namespace thread {
67
- function lockThread(tag:String):Promise;
68
- function lock(tag:String = 'main'):Promise;
69
- function unlock(tag:String = 'main');
70
- function singleThread(tag:String):Promise;
71
- function singleTask(func:Function,waitTimeout:Number=10,tag:String='main'):Promise;
72
- function clearTask(tag:String = 'main');
73
+ function lockThread(tag: String): Promise;
74
+ function lock(tag: String = 'main'): Promise;
75
+ function unlock(tag: String = 'main');
76
+ function singleThread(tag: String): Promise;
77
+ function singleTask(func: Function, waitTimeout: Number = 10, tag: String = 'main'): Promise;
78
+ function clearTask(tag: String = 'main');
73
79
  }
74
80
  namespace tools {
75
- function keep(maxTime:Number, promise:Promise, errorMsg:String = null):Promise<any>
76
- function getUrlHost(url:String):String;
81
+ function keep(maxTime: Number, promise: Promise, errorMsg: String = null): Promise<any>
82
+ function getUrlHost(url: String): String;
77
83
  function addRequestHandler(r: RequestHandler): Promise
78
84
  function uploadFile(domOrSelector: | String | Element, path: String | Array<String>): Promise
79
85
  function log(object: any): Promise;
@@ -92,19 +98,19 @@ namespace rpa {
92
98
  function forEach(list: Array, callback: Function): Promise;
93
99
  function mkdir(path: String): Promise;
94
100
  function randomString(len: Number): Promise;
95
- function function2string(func:Function, data:Object):String;
101
+ function function2string(func: Function, data: Object): String;
96
102
  function waitForTrue(func: Function, interval = 500): Promise;
97
103
  function encodeURI(str: String, charset: String = "utf-8"): Promise;
98
104
  function decodeURI(str: String, charset: String = "utf-8"): Promise;
99
105
  function replace(str: String, regex: RegExp, asyncFn: Function): Promise;
100
- function arrayBufferToBase64(buffer:String):String;
101
- function waitForSelector(selectorOrFunction:String | Function):Promise<Element>;
102
- function waitForSelectors(selectorOrFunction:String | Function):Promise<Array<Element>>
106
+ function arrayBufferToBase64(buffer: String): String;
107
+ function waitForSelector(selectorOrFunction: String | Function): Promise<Element>;
108
+ function waitForSelectors(selectorOrFunction: String | Function): Promise<Array<Element>>
103
109
  }
104
110
  namespace page {
105
111
 
106
112
  function screenshot(options: Object): Promise;
107
- function pdf(options):Promise;
113
+ function pdf(options): Promise;
108
114
 
109
115
  function waitForNavigation(options = {});
110
116
  function waitForSelector(selector, timeout = 30000);
@@ -115,21 +121,23 @@ namespace rpa {
115
121
  function newIframeAndEvaluate(iframeHandler: Function, func: Function): Promise;
116
122
 
117
123
  function download(url: String, path: String): Promise;
118
- function closeActivated():Promise;
124
+ function closeActivated(): Promise;
119
125
  namespace stracing {
120
- function start(filePath:String):Promise;
121
- function stop():Promise;
126
+ function start(filePath: String): Promise;
127
+ function stop(): Promise;
122
128
  }
129
+
123
130
  }
124
131
  namespace browser {
125
- function newPageAndDownLoad(url: String,path: String):Promise;
126
- function newPageAndGetBase64(url: String):Promise;
132
+ function newPageAndDownLoad(url: String, path: String): Promise;
133
+ function newPageAndGetBase64(url: String): Promise;
127
134
  function newPageAndEvaluate(url: String, func: Function, data: Object = {}): Promise;
128
135
  function waitOpenedPageAndEvaluate(invokeFun: Function, func: Function, data: Object = {}): Promise;
129
136
  function waitOpenedPageAndExec(invokeFun: Function, script: String, params: Object = {}): Promise;
130
137
 
131
138
  function getNextWindowOpenUrl(beforFunc: Function, cancel: boolean): Promise;
132
- function getNextWindowOpenUrl(beforFunc: Function): Promise
139
+ function getNextWindowOpenUrl(beforFunc: Function): Promise;
140
+ function newIncognitoPageAndEvaluate(url: String, func: Function, data: Object = {}): Promise;
133
141
 
134
142
  }
135
143
  namespace runtime {
@@ -137,13 +145,13 @@ namespace rpa {
137
145
  function set(map: Object): Promise;
138
146
  }
139
147
  namespace frame {
140
- function newCrossIframeContext(host:String, func: Function, data:Object={}, removeOnFinish:Boolean = true):Promise;
148
+ function newCrossIframeContext(host: String, func: Function, data: Object = {}, removeOnFinish: Boolean = true): Promise;
141
149
  function newIframeAndevaluateCross(urlOrFunction, func: Function, data = {}, removeOnFinish: Boolean = true): Promise;
142
150
  function evaluateCross(name: String, func: Function, data = {}): Promise;
143
151
  function evaluate(name: String, func: Function): Promise;
144
152
  function evaluateOnNextFrame(invokeFun: Function, func: Function, remove: boolean): Promise;
145
153
  function evaluateOnNextFrame(invokeFun: Function, func: Function): Promise;
146
- function evaluateOnNextFrameCross(invokeFun: Function, func: Function, data:Object={}, remove:Boolean = false)
154
+ function evaluateOnNextFrameCross(invokeFun: Function, func: Function, data: Object = {}, remove: Boolean = false)
147
155
 
148
156
  }
149
157
  namespace localStorage {
@@ -155,8 +163,8 @@ namespace rpa {
155
163
  namespace view {
156
164
  function alert(message?: any): Promise;
157
165
  function confirm(message?: string): Promise;
158
- function getCustomValue(keysOrOptions: Array<String> | Array<FormItem>,autoNextCount:Number=5, title = ""): Promise<Object>;
159
- function showConsoleView(title: String = null,clearTime:Number=600000,zIndex:Number=10000,clearKeepNum:Number=50): Promise;
166
+ function getCustomValue(keysOrOptions: Array<String> | Array<FormItem>, autoNextCount: Number = 5, title = ""): Promise<Object>;
167
+ function showConsoleView(title: String = null, clearTime: Number = 600000, zIndex: Number = 10000, clearKeepNum: Number = 50): Promise;
160
168
  function hideConsoleView();
161
169
  function console(msg: String, color: String = "#ffffff");
162
170
  function consoleClear();
@@ -180,7 +188,7 @@ namespace rpa {
180
188
  }
181
189
  }
182
190
 
183
- declare function require(path: String,readCache:Boolean = true): Promise;
191
+ declare function require(path: String, readCache: Boolean = true): Promise;
184
192
  // declare let args: Object;
185
193
  namespace args {
186
194
  function get(key: String, dvalue: any = null): any;