@wdio/shared-store-service 9.32.0-alpha.6 → 10.0.0-alpha.148

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/AGENTS.md ADDED
@@ -0,0 +1,20 @@
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.
package/build/index.js CHANGED
@@ -16,33 +16,20 @@ 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,
21
19
  startServer: () => startServer
22
20
  });
23
21
  import polka from "polka";
24
22
  import { json } from "@polka/parse";
25
- var store, resourcePoolStore, __store, __resourcePoolStore, validateBody, MAX_TIMEOUT, DEFAULT_TIMEOUT, startServer;
23
+ var MAX_TIMEOUT, DEFAULT_TIMEOUT, startServer;
26
24
  var init_server = __esm({
27
25
  "src/server.ts"() {
28
26
  "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
- };
42
27
  MAX_TIMEOUT = 15e3;
43
28
  DEFAULT_TIMEOUT = 1e3;
44
29
  startServer = () => new Promise((resolve, reject) => {
45
- const app = polka().use(json(), validateBody).post("/", (req, res) => {
30
+ const store = {};
31
+ const resourcePoolStore = /* @__PURE__ */ new Map();
32
+ const app = polka().use(json()).post("/", (req, res) => {
46
33
  const key = req.body.key;
47
34
  if (key === "*") {
48
35
  throw new Error(`You can't set a value with key "*" as this is a reserved key`);
@@ -194,11 +181,11 @@ var SharedStoreLauncher = class {
194
181
  const { port, app } = await server.startServer();
195
182
  this._app = app;
196
183
  setPort(port);
197
- const capsList = Array.isArray(capabilities) ? capabilities : Object.values(capabilities).map((multiremoteOption) => multiremoteOption.capabilities);
184
+ const capsList = Array.isArray(capabilities) ? capabilities : Object.values(capabilities).map((multiRemoteOption) => multiRemoteOption.capabilities);
198
185
  const caps = capsList.flatMap((c) => {
199
- const multiremote = c;
200
- if (!multiremote.browserName && multiremote[Object.keys(multiremote)[0]].capabilities) {
201
- return Object.values(multiremote).map(
186
+ const multiRemote = c;
187
+ if (!multiRemote.browserName && multiRemote[Object.keys(multiRemote)[0]].capabilities) {
188
+ return Object.values(multiRemote).map(
202
189
  (options) => options.capabilities?.alwaysMatch || options.capabilities
203
190
  );
204
191
  }
package/build/server.d.ts CHANGED
@@ -1,9 +1,3 @@
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>;
7
1
  export declare const startServer: () => Promise<{
8
2
  port: number;
9
3
  app: PolkaInstance;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,WAAW;UAA6B,MAAM;SAAO,aAAa;EAgG7E,CAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@wdio/shared-store-service",
3
- "version": "9.32.0-alpha.6+3d8818a67",
3
+ "version": "10.0.0-alpha.148+3a926c3d0",
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": ">=18.20.0"
9
+ "node": ">=22.19.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": "3.8.3",
37
+ "typeScriptVersion": "6.0.3",
38
38
  "dependencies": {
39
39
  "@polka/parse": "^1.0.0-next.0",
40
- "@wdio/logger": "9.32.0-alpha.6+3d8818a67",
41
- "@wdio/types": "9.32.0-alpha.6+3d8818a67",
40
+ "@wdio/logger": "10.0.0-alpha.148+3a926c3d0",
41
+ "@wdio/types": "10.0.0-alpha.148+3a926c3d0",
42
42
  "polka": "^0.5.2",
43
- "webdriverio": "9.32.0-alpha.6+3d8818a67"
43
+ "webdriverio": "10.0.0-alpha.148+3a926c3d0"
44
44
  },
45
45
  "devDependencies": {
46
- "@wdio/globals": "9.32.0-alpha.6+3d8818a67"
46
+ "@wdio/globals": "10.0.0-alpha.148+3a926c3d0"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "3d8818a67404f0b5d4b81eda877ffad1f4d317c0"
51
+ "gitHead": "3a926c3d08dafa93c92021b2892341709d74968a"
52
52
  }