@statewalker/httpeers-member 0.1.6 → 0.2.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.
@@ -42,6 +42,9 @@ export declare class UncontrolledPageError extends Error {
42
42
  * - `"activation-timeout"` / `"unresponsive"` -- the worker never activated,
43
43
  * or controls the page but did not answer -> an `Error` naming the worker
44
44
  * and the bound, and saying what to do;
45
+ * - `"incompatible"` -- the worker answered but runs an older
46
+ * webrun-http-browser, i.e. the page was updated before its worker -> an
47
+ * `Error` naming the worker and saying to reload. Not a timeout, so no bound;
45
48
  * - anything else is not a control failure and is returned unchanged.
46
49
  *
47
50
  * The library's own error is kept as `cause`, for DevTools.
@@ -1 +1 @@
1
- {"version":3,"file":"edge-control.d.ts","sourceRoot":"","sources":["../src/edge-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,6EAA6E;AAC7E,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAOxD;CACF;AAiBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAmBT"}
1
+ {"version":3,"file":"edge-control.d.ts","sourceRoot":"","sources":["../src/edge-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,6EAA6E;AAC7E,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAOxD;CACF;AAiBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CA2BT"}
@@ -49,6 +49,9 @@ function isControlError(error) {
49
49
  * - `"activation-timeout"` / `"unresponsive"` -- the worker never activated,
50
50
  * or controls the page but did not answer -> an `Error` naming the worker
51
51
  * and the bound, and saying what to do;
52
+ * - `"incompatible"` -- the worker answered but runs an older
53
+ * webrun-http-browser, i.e. the page was updated before its worker -> an
54
+ * `Error` naming the worker and saying to reload. Not a timeout, so no bound;
52
55
  * - anything else is not a control failure and is returned unchanged.
53
56
  *
54
57
  * The library's own error is kept as `cause`, for DevTools.
@@ -60,6 +63,11 @@ export function edgeStartError(error, serviceWorkerUrl, timeoutMs) {
60
63
  return new UncontrolledPageError("its ServiceWorker is active but did not take control when asked, and the page " +
61
64
  "has already been reloaded once to recover, or could not be", { cause: error });
62
65
  }
66
+ if (error.reason === "incompatible") {
67
+ return new Error(`mountEdge: the ServiceWorker ${serviceWorkerUrl} runs an older version than this page. ` +
68
+ "Reload the page once the updated ServiceWorker is active; if that does not help, " +
69
+ "close the tab and reopen it.", { cause: error });
70
+ }
63
71
  const what = error.reason === "activation-timeout"
64
72
  ? "did not activate"
65
73
  : "did not answer the page, although it controls it,";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statewalker/httpeers-member",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Everything a participant does: hold an identity, redeem or resume, connect, keep the link, advertise, discover, call, and serve.",
6
6
  "bugs": {
@@ -47,9 +47,9 @@
47
47
  "@libp2p/interface": "^3.3.0",
48
48
  "@libp2p/peer-id": "^6.0.15",
49
49
  "@multiformats/multiaddr": "^13.0.3",
50
+ "@statewalker/httpeers-libp2p": "^0.2.0",
50
51
  "@statewalker/httpeers-access": "^0.1.4",
51
- "@statewalker/httpeers-core": "^0.1.3",
52
- "@statewalker/httpeers-libp2p": "^0.1.5"
52
+ "@statewalker/httpeers-core": "^0.1.3"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@chainsafe/libp2p-noise": "^17.0.0",
@@ -59,7 +59,7 @@
59
59
  "@libp2p/tcp": "^11.0.28",
60
60
  "@libp2p/webrtc": "^6.0.33",
61
61
  "@libp2p/websockets": "^10.1.21",
62
- "@statewalker/webrun-http-browser": "^0.6.0",
62
+ "@statewalker/webrun-http-browser": "^0.7.0",
63
63
  "idb-keyval": "^6.3.0",
64
64
  "libp2p": "^3.3.11"
65
65
  },
@@ -104,7 +104,7 @@
104
104
  "@libp2p/tcp": "^11.0.28",
105
105
  "@libp2p/webrtc": "^6.0.33",
106
106
  "@libp2p/websockets": "^10.1.21",
107
- "@statewalker/webrun-http-browser": "^0.6.0",
107
+ "@statewalker/webrun-http-browser": "^0.7.0",
108
108
  "@types/node": "^26.6.4",
109
109
  "idb-keyval": "^6.3.0",
110
110
  "libp2p": "^3.3.11",
@@ -64,6 +64,9 @@ function isControlError(error: unknown): error is ControlErrorLike {
64
64
  * - `"activation-timeout"` / `"unresponsive"` -- the worker never activated,
65
65
  * or controls the page but did not answer -> an `Error` naming the worker
66
66
  * and the bound, and saying what to do;
67
+ * - `"incompatible"` -- the worker answered but runs an older
68
+ * webrun-http-browser, i.e. the page was updated before its worker -> an
69
+ * `Error` naming the worker and saying to reload. Not a timeout, so no bound;
67
70
  * - anything else is not a control failure and is returned unchanged.
68
71
  *
69
72
  * The library's own error is kept as `cause`, for DevTools.
@@ -81,6 +84,14 @@ export function edgeStartError(
81
84
  { cause: error },
82
85
  );
83
86
  }
87
+ if (error.reason === "incompatible") {
88
+ return new Error(
89
+ `mountEdge: the ServiceWorker ${serviceWorkerUrl} runs an older version than this page. ` +
90
+ "Reload the page once the updated ServiceWorker is active; if that does not help, " +
91
+ "close the tab and reopen it.",
92
+ { cause: error },
93
+ );
94
+ }
84
95
  const what =
85
96
  error.reason === "activation-timeout"
86
97
  ? "did not activate"