@wdio/shared-store-service 10.0.0-alpha.150 → 10.0.0-alpha.18
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/index.js +21 -8
- package/build/server.d.ts +6 -0
- package/build/server.d.ts.map +1 -1
- package/package.json +8 -8
- package/AGENTS.md +0 -20
package/build/index.js
CHANGED
|
@@ -16,20 +16,33 @@ var __export = (target, all) => {
|
|
|
16
16
|
// src/server.ts
|
|
17
17
|
var server_exports = {};
|
|
18
18
|
__export(server_exports, {
|
|
19
|
+
__resourcePoolStore: () => __resourcePoolStore,
|
|
20
|
+
__store: () => __store,
|
|
19
21
|
startServer: () => startServer
|
|
20
22
|
});
|
|
21
23
|
import polka from "polka";
|
|
22
24
|
import { json } from "@polka/parse";
|
|
23
|
-
var MAX_TIMEOUT, DEFAULT_TIMEOUT, startServer;
|
|
25
|
+
var store, resourcePoolStore, __store, __resourcePoolStore, validateBody, MAX_TIMEOUT, DEFAULT_TIMEOUT, startServer;
|
|
24
26
|
var init_server = __esm({
|
|
25
27
|
"src/server.ts"() {
|
|
26
28
|
"use strict";
|
|
29
|
+
store = {};
|
|
30
|
+
resourcePoolStore = /* @__PURE__ */ new Map();
|
|
31
|
+
__store = store;
|
|
32
|
+
__resourcePoolStore = resourcePoolStore;
|
|
33
|
+
validateBody = (req, res, next) => {
|
|
34
|
+
if (!req.path.endsWith("/get") && !req.path.endsWith("/set")) {
|
|
35
|
+
return next();
|
|
36
|
+
}
|
|
37
|
+
if (req.method === "POST" && typeof req.body.key !== "string") {
|
|
38
|
+
res.end(JSON.stringify({ error: "Invalid payload, key is required." }));
|
|
39
|
+
}
|
|
40
|
+
next();
|
|
41
|
+
};
|
|
27
42
|
MAX_TIMEOUT = 15e3;
|
|
28
43
|
DEFAULT_TIMEOUT = 1e3;
|
|
29
44
|
startServer = () => new Promise((resolve, reject) => {
|
|
30
|
-
const
|
|
31
|
-
const resourcePoolStore = /* @__PURE__ */ new Map();
|
|
32
|
-
const app = polka().use(json()).post("/", (req, res) => {
|
|
45
|
+
const app = polka().use(json(), validateBody).post("/", (req, res) => {
|
|
33
46
|
const key = req.body.key;
|
|
34
47
|
if (key === "*") {
|
|
35
48
|
throw new Error(`You can't set a value with key "*" as this is a reserved key`);
|
|
@@ -181,11 +194,11 @@ var SharedStoreLauncher = class {
|
|
|
181
194
|
const { port, app } = await server.startServer();
|
|
182
195
|
this._app = app;
|
|
183
196
|
setPort(port);
|
|
184
|
-
const capsList = Array.isArray(capabilities) ? capabilities : Object.values(capabilities).map((
|
|
197
|
+
const capsList = Array.isArray(capabilities) ? capabilities : Object.values(capabilities).map((multiremoteOption) => multiremoteOption.capabilities);
|
|
185
198
|
const caps = capsList.flatMap((c) => {
|
|
186
|
-
const
|
|
187
|
-
if (!
|
|
188
|
-
return Object.values(
|
|
199
|
+
const multiremote = c;
|
|
200
|
+
if (!multiremote.browserName && multiremote[Object.keys(multiremote)[0]].capabilities) {
|
|
201
|
+
return Object.values(multiremote).map(
|
|
189
202
|
(options) => options.capabilities?.alwaysMatch || options.capabilities
|
|
190
203
|
);
|
|
191
204
|
}
|
package/build/server.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { JsonObject, JsonArray } from '@wdio/types';
|
|
2
|
+
/**
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
export declare const __store: JsonObject;
|
|
6
|
+
export declare const __resourcePoolStore: Map<string, JsonArray>;
|
|
1
7
|
export declare const startServer: () => Promise<{
|
|
2
8
|
port: number;
|
|
3
9
|
app: PolkaInstance;
|
package/build/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiC,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvF;;GAEG;AACH,eAAO,MAAM,OAAO,YAAQ,CAAA;AAC5B,eAAO,MAAM,mBAAmB,wBAAoB,CAAA;AAepD,eAAO,MAAM,WAAW;UAA6B,MAAM;SAAO,aAAa;EA8F7E,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/shared-store-service",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.18+dbf0f4971",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">=18.20.0"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"types": "./build/index.d.ts",
|
|
37
|
-
"typeScriptVersion": "
|
|
37
|
+
"typeScriptVersion": "3.8.3",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@polka/parse": "^1.0.0-next.0",
|
|
40
|
-
"@wdio/logger": "
|
|
41
|
-
"@wdio/types": "
|
|
40
|
+
"@wdio/logger": "9.29.1",
|
|
41
|
+
"@wdio/types": "9.32.0",
|
|
42
42
|
"polka": "^0.5.2",
|
|
43
|
-
"webdriverio": "
|
|
43
|
+
"webdriverio": "9.32.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@wdio/globals": "10.0.0-alpha.
|
|
46
|
+
"@wdio/globals": "10.0.0-alpha.18+dbf0f4971"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "dbf0f497130676040ce4212d9cf6459adfe16c42"
|
|
52
52
|
}
|
package/AGENTS.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# @wdio/shared-store-service
|
|
2
|
-
|
|
3
|
-
Read [packages/AGENTS.md](../AGENTS.md) first.
|
|
4
|
-
|
|
5
|
-
## Test ownership
|
|
6
|
-
|
|
7
|
-
The HTTP server is the store contract. Assert sets, gets, and resource-pool
|
|
8
|
-
changes with requests against `startServer()`. Do not export the in-memory
|
|
9
|
-
maps, and do not seed them from tests.
|
|
10
|
-
|
|
11
|
-
Keep these boundaries separate:
|
|
12
|
-
|
|
13
|
-
- `launcher.test.ts` stamps the port onto standard, W3C, and multi-remote capabilities, then closes the server
|
|
14
|
-
- `service.test.ts` reads that port in the worker and attaches `browser.sharedStore`
|
|
15
|
-
- `client.test.ts` covers request shape, the pre-init queue, and error wrapping
|
|
16
|
-
- `server.test.ts` covers store and resource-pool behavior on the wire
|
|
17
|
-
- `index.test.ts` covers the public service, launcher, and client re-exports
|
|
18
|
-
|
|
19
|
-
`validateBody` used to guard `POST /get` and `POST /set`. Those routes are gone.
|
|
20
|
-
Do not bring that middleware back for the current `/`, `/:key`, and `/pool` API.
|