@midscene/webdriver 1.17.2-beta-20261027033907.0 → 1.17.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/es/index.mjs +4 -10
- package/dist/lib/index.js +3 -12
- package/dist/types/index.d.ts +0 -8
- package/package.json +2 -2
package/dist/es/index.mjs
CHANGED
|
@@ -157,12 +157,6 @@ class WebDriverRequestError extends Error {
|
|
|
157
157
|
this.name = 'WebDriverRequestError';
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
class WebDriverRequestTimeoutError extends WebDriverRequestError {
|
|
161
|
-
constructor(timeout){
|
|
162
|
-
super(`Request timeout after ${timeout}ms`);
|
|
163
|
-
this.name = 'WebDriverRequestTimeoutError';
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
160
|
async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 30000) {
|
|
167
161
|
const url = `${baseUrl}${endpoint}`;
|
|
168
162
|
debugRequest(`${method} ${endpoint}${data ? ` with data: ${JSON.stringify(data)}` : ''}`);
|
|
@@ -178,6 +172,7 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
178
172
|
body: data ? JSON.stringify(data) : void 0,
|
|
179
173
|
signal: controller.signal
|
|
180
174
|
});
|
|
175
|
+
clearTimeout(timeoutId);
|
|
181
176
|
let responseData;
|
|
182
177
|
const contentType = response.headers.get('content-type');
|
|
183
178
|
if (contentType?.includes('application/json')) responseData = await response.json();
|
|
@@ -191,12 +186,11 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
191
186
|
}
|
|
192
187
|
return responseData;
|
|
193
188
|
} catch (error) {
|
|
189
|
+
clearTimeout(timeoutId);
|
|
194
190
|
if (error instanceof WebDriverRequestError) throw error;
|
|
195
|
-
if (error instanceof Error && 'AbortError' === error.name) throw new
|
|
191
|
+
if (error instanceof Error && 'AbortError' === error.name) throw new WebDriverRequestError(`Request timeout after ${timeout}ms`);
|
|
196
192
|
debugRequest(`Request failed: ${error}`);
|
|
197
193
|
throw new WebDriverRequestError(`Request failed: ${error}`);
|
|
198
|
-
} finally{
|
|
199
|
-
clearTimeout(timeoutId);
|
|
200
194
|
}
|
|
201
195
|
}
|
|
202
196
|
function WebDriverClient_define_property(obj, key, value) {
|
|
@@ -326,4 +320,4 @@ class WebDriverClient {
|
|
|
326
320
|
debugClient('Initialized WebDriver client');
|
|
327
321
|
}
|
|
328
322
|
}
|
|
329
|
-
export { BaseServiceManager, WDAManager, WebDriverClient, WebDriverRequestError,
|
|
323
|
+
export { BaseServiceManager, WDAManager, WebDriverClient, WebDriverRequestError, makeWebDriverRequest, normalizeWebDriverBaseUrl };
|
package/dist/lib/index.js
CHANGED
|
@@ -24,7 +24,6 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
WebDriverRequestTimeoutError: ()=>WebDriverRequestTimeoutError,
|
|
28
27
|
normalizeWebDriverBaseUrl: ()=>normalizeWebDriverBaseUrl,
|
|
29
28
|
WDAManager: ()=>WDAManager,
|
|
30
29
|
makeWebDriverRequest: ()=>makeWebDriverRequest,
|
|
@@ -191,12 +190,6 @@ class WebDriverRequestError extends Error {
|
|
|
191
190
|
this.name = 'WebDriverRequestError';
|
|
192
191
|
}
|
|
193
192
|
}
|
|
194
|
-
class WebDriverRequestTimeoutError extends WebDriverRequestError {
|
|
195
|
-
constructor(timeout){
|
|
196
|
-
super(`Request timeout after ${timeout}ms`);
|
|
197
|
-
this.name = 'WebDriverRequestTimeoutError';
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
193
|
async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 30000) {
|
|
201
194
|
const url = `${baseUrl}${endpoint}`;
|
|
202
195
|
debugRequest(`${method} ${endpoint}${data ? ` with data: ${JSON.stringify(data)}` : ''}`);
|
|
@@ -212,6 +205,7 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
212
205
|
body: data ? JSON.stringify(data) : void 0,
|
|
213
206
|
signal: controller.signal
|
|
214
207
|
});
|
|
208
|
+
clearTimeout(timeoutId);
|
|
215
209
|
let responseData;
|
|
216
210
|
const contentType = response.headers.get('content-type');
|
|
217
211
|
if (contentType?.includes('application/json')) responseData = await response.json();
|
|
@@ -225,12 +219,11 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
225
219
|
}
|
|
226
220
|
return responseData;
|
|
227
221
|
} catch (error) {
|
|
222
|
+
clearTimeout(timeoutId);
|
|
228
223
|
if (error instanceof WebDriverRequestError) throw error;
|
|
229
|
-
if (error instanceof Error && 'AbortError' === error.name) throw new
|
|
224
|
+
if (error instanceof Error && 'AbortError' === error.name) throw new WebDriverRequestError(`Request timeout after ${timeout}ms`);
|
|
230
225
|
debugRequest(`Request failed: ${error}`);
|
|
231
226
|
throw new WebDriverRequestError(`Request failed: ${error}`);
|
|
232
|
-
} finally{
|
|
233
|
-
clearTimeout(timeoutId);
|
|
234
227
|
}
|
|
235
228
|
}
|
|
236
229
|
function WebDriverClient_define_property(obj, key, value) {
|
|
@@ -364,7 +357,6 @@ exports.BaseServiceManager = __webpack_exports__.BaseServiceManager;
|
|
|
364
357
|
exports.WDAManager = __webpack_exports__.WDAManager;
|
|
365
358
|
exports.WebDriverClient = __webpack_exports__.WebDriverClient;
|
|
366
359
|
exports.WebDriverRequestError = __webpack_exports__.WebDriverRequestError;
|
|
367
|
-
exports.WebDriverRequestTimeoutError = __webpack_exports__.WebDriverRequestTimeoutError;
|
|
368
360
|
exports.makeWebDriverRequest = __webpack_exports__.makeWebDriverRequest;
|
|
369
361
|
exports.normalizeWebDriverBaseUrl = __webpack_exports__.normalizeWebDriverBaseUrl;
|
|
370
362
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -372,7 +364,6 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
372
364
|
"WDAManager",
|
|
373
365
|
"WebDriverClient",
|
|
374
366
|
"WebDriverRequestError",
|
|
375
|
-
"WebDriverRequestTimeoutError",
|
|
376
367
|
"makeWebDriverRequest",
|
|
377
368
|
"normalizeWebDriverBaseUrl"
|
|
378
369
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -134,14 +134,6 @@ export declare interface WebDriverRequestOptions {
|
|
|
134
134
|
timeout?: number;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
/**
|
|
138
|
-
* The HTTP request exceeded its timeout, including reading the response body.
|
|
139
|
-
* Remains a WebDriverRequestError for callers that catch transport failures.
|
|
140
|
-
*/
|
|
141
|
-
export declare class WebDriverRequestTimeoutError extends WebDriverRequestError {
|
|
142
|
-
constructor(timeout: number);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
137
|
export declare interface WebDriverServiceManager {
|
|
146
138
|
start(): Promise<void>;
|
|
147
139
|
stop(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/webdriver",
|
|
3
|
-
"version": "1.17.2
|
|
3
|
+
"version": "1.17.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/midscene.git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"types": "dist/types/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"node-fetch": "^3.3.2",
|
|
15
|
-
"@midscene/shared": "1.17.2
|
|
15
|
+
"@midscene/shared": "1.17.2"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@rslib/core": "^0.18.3",
|