@wdio/shared-store-service 7.17.4 → 7.18.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.
- package/build/client.d.ts +2 -1
- package/build/client.d.ts.map +1 -1
- package/build/client.js +19 -19
- package/package.json +4 -4
package/build/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Response } from 'got';
|
|
1
2
|
import type { JsonCompatible, JsonPrimitive, JsonObject, JsonArray } from '@wdio/types';
|
|
2
3
|
export declare const setPort: (port: string) => void;
|
|
3
4
|
/**
|
|
@@ -11,5 +12,5 @@ export declare const getValue: (key: string) => Promise<string | number | boolea
|
|
|
11
12
|
* @param {string} key
|
|
12
13
|
* @param {*} value `store[key]` value (plain object)
|
|
13
14
|
*/
|
|
14
|
-
export declare const setValue: (key: string, value: JsonCompatible | JsonPrimitive) => Promise<void
|
|
15
|
+
export declare const setValue: (key: string, value: JsonCompatible | JsonPrimitive) => Promise<void | Response<string>>;
|
|
15
16
|
//# sourceMappingURL=client.d.ts.map
|
package/build/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAGnC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AASvF,eAAO,MAAM,OAAO,SAAU,MAAM,SAA6C,CAAA;AAEjF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAe,MAAM,KAAG,QAAQ,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAGzH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAe,MAAM,SAAS,cAAc,GAAG,aAAa,qCAiChF,CAAA"}
|
package/build/client.js
CHANGED
|
@@ -20,7 +20,7 @@ exports.setPort = setPort;
|
|
|
20
20
|
*/
|
|
21
21
|
const getValue = async (key) => {
|
|
22
22
|
const res = await got_1.default.post(`${baseUrl}/get`, { json: { key }, responseType: 'json' }).catch(errHandler);
|
|
23
|
-
return (res
|
|
23
|
+
return (res === null || res === void 0 ? void 0 : res.body) ? res.body.value : undefined;
|
|
24
24
|
};
|
|
25
25
|
exports.getValue = getValue;
|
|
26
26
|
/**
|
|
@@ -34,26 +34,26 @@ const setValue = async (key, value) => {
|
|
|
34
34
|
* set as the launcher is called after user hooks. In this case we need
|
|
35
35
|
* to wait until it is set and flush all messages.
|
|
36
36
|
*/
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (!baseUrl) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
log.info(`Shared store server started, flushing ${pendingValues.size} values`);
|
|
47
|
-
clearInterval(waitTimeout);
|
|
48
|
-
await Promise.all([...pendingValues.entries()].map(async ([key, value]) => {
|
|
49
|
-
await got_1.default.post(`${baseUrl}/set`, { json: { key, value } }).catch(errHandler);
|
|
50
|
-
pendingValues.delete(key);
|
|
51
|
-
})).then(() => log.info('All pending values were successfully stored'), (err) => log.error(`Failed to store all values: ${err.stack}`));
|
|
52
|
-
}, WAIT_INTERVAL);
|
|
53
|
-
}
|
|
37
|
+
if (baseUrl) {
|
|
38
|
+
return got_1.default.post(`${baseUrl}/set`, { json: { key, value } }).catch(errHandler);
|
|
39
|
+
}
|
|
40
|
+
log.info('Shared store server not yet started, collecting value');
|
|
41
|
+
pendingValues.set(key, value);
|
|
42
|
+
if (waitTimeout) {
|
|
54
43
|
return;
|
|
55
44
|
}
|
|
56
|
-
|
|
45
|
+
log.info('Check shared store server to start');
|
|
46
|
+
waitTimeout = setInterval(async () => {
|
|
47
|
+
if (!baseUrl) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
log.info(`Shared store server started, flushing ${pendingValues.size} values`);
|
|
51
|
+
clearInterval(waitTimeout);
|
|
52
|
+
await Promise.all([...pendingValues.entries()].map(async ([key, value]) => {
|
|
53
|
+
await got_1.default.post(`${baseUrl}/set`, { json: { key, value } }).catch(errHandler);
|
|
54
|
+
pendingValues.delete(key);
|
|
55
|
+
})).then(() => log.info('All pending values were successfully stored'), (err) => log.error(`Failed to store all values: ${err.stack}`));
|
|
56
|
+
}, WAIT_INTERVAL);
|
|
57
57
|
};
|
|
58
58
|
exports.setValue = setValue;
|
|
59
59
|
const errHandler = (err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/shared-store-service",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.18.0",
|
|
4
4
|
"description": "A WebdriverIO service to exchange data across processes",
|
|
5
5
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-shared-store-service",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@polka/parse": "^1.0.0-next.0",
|
|
27
27
|
"@wdio/logger": "7.17.3",
|
|
28
|
-
"@wdio/types": "7.
|
|
28
|
+
"@wdio/types": "7.18.0",
|
|
29
29
|
"got": "^11.0.2",
|
|
30
30
|
"polka": "^0.5.2",
|
|
31
|
-
"webdriverio": "7.
|
|
31
|
+
"webdriverio": "7.18.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"types": "./build/index.d.ts",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "44729cdd585af3ad69f2093f32377f297f5ac344"
|
|
38
38
|
}
|