@super-line/transport-cloudflare 0.1.0 → 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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.js +3 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Generated from conventional commits by [git-cliff](https://git-cliff.org) —
|
|
4
4
|
run `pnpm changelog` rather than editing by hand.
|
|
5
5
|
|
|
6
|
+
## [transport-cloudflare-v0.2.0] — 2026-10-18
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- A refused credential closes 4401, and the client stops retrying it ([35c6e25])
|
|
11
|
+
|
|
6
12
|
## [transport-cloudflare-v0.1.0] — 2026-10-15
|
|
7
13
|
|
|
8
14
|
### Features
|
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ For durable state in the same object, pair it with [`@super-line/collections-clo
|
|
|
71
71
|
|
|
72
72
|
## Behavior notes
|
|
73
73
|
|
|
74
|
-
- **Handshake** — `transport: 'cloudflare'`, `query` from the URL, `headers` from the request, `raw` is the `Request`.
|
|
74
|
+
- **Handshake** — `transport: 'cloudflare'`, `query` from the URL, `headers` from the request, `raw` is the `Request`. An `authenticate` that throws `SuperLineError('UNAUTHORIZED')`, and a refused Control Center connection, are closed `4401` after the upgrade, so the client can tell them from an outage; any other throw gets a plain `401` and no socket.
|
|
75
75
|
- **What a wake loses** — everything in memory: `conn.data` (`onConnection` runs again for each resumed socket), memory collection backends, module state. Keep `ctx` and `env` JSON-serializable; the snapshot is stored as JSON.
|
|
76
76
|
- **A subscription can end with the socket open** — a wake runs each subscription's policy again, and one it now refuses reaches the client's `onError` with `kind: 'resubscribe'`.
|
|
77
77
|
- **Timers keep the node awake** — your own, `plugin-queue`'s polling (always), `plugin-inspector`'s keepalive (while a Control Center watches). A plugin's `ctx.hold()` keeps it awake on purpose.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/transport.ts
|
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
|
3
|
+
import { SuperLineError } from "@super-line/core";
|
|
3
4
|
var log = getLogger(["super-line", "transport-cloudflare"]);
|
|
4
5
|
var CLOSE_NOT_RESUMABLE = 4409;
|
|
5
6
|
var SNAPSHOTS = "_sl_conn";
|
|
@@ -37,7 +38,8 @@ function cloudflareServerTransport(ctx) {
|
|
|
37
38
|
try {
|
|
38
39
|
auth = await hooks.authenticate(handshake);
|
|
39
40
|
} catch (err) {
|
|
40
|
-
log.warn("authenticate threw \u2014
|
|
41
|
+
log.warn("authenticate threw \u2014 refusing the connection {error}", { error: err });
|
|
42
|
+
if (err instanceof SuperLineError && err.code === "UNAUTHORIZED") return refuseAfterUpgrade(void 0, err);
|
|
41
43
|
return new Response("Unauthorized", { status: 401 });
|
|
42
44
|
}
|
|
43
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-line/transport-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cloudflare Durable Object transport for super-line: one Durable Object is one node, with hibernatable WebSockets that resume transparently on wake.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@cloudflare/workers-types": "^5.20261013.1",
|
|
49
|
-
"@super-line/core": "^0.
|
|
50
|
-
"@super-line/server": "^0.
|
|
49
|
+
"@super-line/core": "^0.22.0",
|
|
50
|
+
"@super-line/server": "^0.23.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsup"
|