@firtoz/websocket-do 7.0.0 → 7.0.1
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/README.md +2 -0
- package/package.json +9 -9
- package/src/BaseSession.ts +27 -24
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
Type-safe WebSocket session management for Cloudflare Durable Objects with Hono integration.
|
|
8
8
|
|
|
9
|
+
> **⚠️ Early WIP Notice:** This package is in very early development and is **not production-ready**. It is TypeScript-only and may have breaking changes. While I (the maintainer) have limited time, I'm open to PRs for features, bug fixes, or additional support (like JS builds). Please feel free to try it out and contribute! See [CONTRIBUTING.md](../../CONTRIBUTING.md) for details.
|
|
10
|
+
|
|
9
11
|
## Features
|
|
10
12
|
|
|
11
13
|
- 🔒 **Type-safe** - Full TypeScript support with generic types for messages and session data
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firtoz/websocket-do",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Type-safe WebSocket session management for Cloudflare Durable Objects with Hono integration",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"module": "./src/index.ts",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"url": "https://github.com/firtoz/fullstack-toolkit/issues"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@cloudflare/workers-types": "^4.
|
|
49
|
-
"@firtoz/hono-fetcher": "^2.3.
|
|
50
|
-
"hono": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20251228.0",
|
|
49
|
+
"@firtoz/hono-fetcher": "^2.3.2",
|
|
50
|
+
"hono": "^4.11.4"
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"msgpackr": "^1.11.
|
|
54
|
-
"react": "^19.2.
|
|
55
|
-
"zod": "^4.
|
|
53
|
+
"msgpackr": "^1.11.8",
|
|
54
|
+
"react": "^19.2.3",
|
|
55
|
+
"zod": "^4.3.5"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=18.0.0"
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@types/react": "^19.2.
|
|
65
|
-
"bun-types": "^1.3.
|
|
64
|
+
"@types/react": "^19.2.8",
|
|
65
|
+
"bun-types": "^1.3.6",
|
|
66
66
|
"typescript": "^5.9.3"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/src/BaseSession.ts
CHANGED
|
@@ -15,38 +15,41 @@ export type SessionData<TSession extends BaseSession<any, any, any, any>> =
|
|
|
15
15
|
export type SessionClientMessage<
|
|
16
16
|
// biome-ignore lint/suspicious/noExplicitAny: We are using any on purpose to allow any type of session.
|
|
17
17
|
TSession extends BaseSession<any, any, any, any>,
|
|
18
|
-
> =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
> =
|
|
19
|
+
TSession extends BaseSession<
|
|
20
|
+
infer _TData,
|
|
21
|
+
infer _TServerMessage,
|
|
22
|
+
infer TClientMessage,
|
|
23
|
+
infer _TEnv
|
|
24
|
+
>
|
|
25
|
+
? TClientMessage
|
|
26
|
+
: never;
|
|
26
27
|
|
|
27
28
|
export type SessionServerMessage<
|
|
28
29
|
// biome-ignore lint/suspicious/noExplicitAny: We are using any on purpose to allow any type of session.
|
|
29
30
|
TSession extends BaseSession<any, any, any, any>,
|
|
30
|
-
> =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
> =
|
|
32
|
+
TSession extends BaseSession<
|
|
33
|
+
infer _TData,
|
|
34
|
+
infer TServerMessage,
|
|
35
|
+
infer _TClientMessage,
|
|
36
|
+
infer _TEnv
|
|
37
|
+
>
|
|
38
|
+
? TServerMessage
|
|
39
|
+
: never;
|
|
38
40
|
|
|
39
41
|
export type SessionEnv<
|
|
40
42
|
// biome-ignore lint/suspicious/noExplicitAny: We are using any on purpose to allow any type of session.
|
|
41
43
|
TSession extends BaseSession<any, any, any, any>,
|
|
42
|
-
> =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
> =
|
|
45
|
+
TSession extends BaseSession<
|
|
46
|
+
infer _TData,
|
|
47
|
+
infer _TServerMessage,
|
|
48
|
+
infer _TClientMessage,
|
|
49
|
+
infer TEnv extends Cloudflare.Env
|
|
50
|
+
>
|
|
51
|
+
? TEnv
|
|
52
|
+
: never;
|
|
50
53
|
|
|
51
54
|
export type BaseSessionHandlers<
|
|
52
55
|
TData,
|