@firtoz/socka 2.0.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/README.md +120 -0
- package/assets/banner.png +0 -0
- package/dist/SockaWebSocketSession-Bru8yFcK.d.ts +107 -0
- package/dist/bun/index.d.ts +38 -0
- package/dist/bun/index.js +121 -0
- package/dist/bun/index.js.map +1 -0
- package/dist/chunk-45D4T232.js +236 -0
- package/dist/chunk-45D4T232.js.map +1 -0
- package/dist/chunk-5WQTYLIC.js +46 -0
- package/dist/chunk-5WQTYLIC.js.map +1 -0
- package/dist/chunk-AM7PB26G.js +421 -0
- package/dist/chunk-AM7PB26G.js.map +1 -0
- package/dist/chunk-MZCQHJXY.js +158 -0
- package/dist/chunk-MZCQHJXY.js.map +1 -0
- package/dist/chunk-YMT4HAH7.js +20 -0
- package/dist/chunk-YMT4HAH7.js.map +1 -0
- package/dist/client/index.d.ts +119 -0
- package/dist/client/index.js +5 -0
- package/dist/client/index.js.map +1 -0
- package/dist/core/index.d.ts +29 -0
- package/dist/core/index.js +14 -0
- package/dist/core/index.js.map +1 -0
- package/dist/do/index.d.ts +80 -0
- package/dist/do/index.js +110 -0
- package/dist/do/index.js.map +1 -0
- package/dist/hono/cloudflare-workers.d.ts +21 -0
- package/dist/hono/cloudflare-workers.js +68 -0
- package/dist/hono/cloudflare-workers.js.map +1 -0
- package/dist/hono/index.d.ts +30 -0
- package/dist/hono/index.js +74 -0
- package/dist/hono/index.js.map +1 -0
- package/dist/react/index.d.ts +72 -0
- package/dist/react/index.js +126 -0
- package/dist/react/index.js.map +1 -0
- package/dist/server/index.d.ts +27 -0
- package/dist/server/index.js +63 -0
- package/dist/server/index.js.map +1 -0
- package/dist/socka-report-error-DzFI2Tr7.d.ts +206 -0
- package/docs/README.md +18 -0
- package/docs/client.md +85 -0
- package/docs/comparison.md +36 -0
- package/docs/durable-objects.md +74 -0
- package/docs/events.md +48 -0
- package/docs/getting-started.md +138 -0
- package/docs/lifecycle.md +31 -0
- package/docs/multi-room.md +31 -0
- package/docs/peers.md +85 -0
- package/docs/reference.md +123 -0
- package/docs/server.md +124 -0
- package/examples/minimal-socka.ts +31 -0
- package/package.json +148 -0
- package/roadmap.md +8 -0
- package/skills/socka/core-rpc/SKILL.md +36 -0
- package/skills/socka/do-session/SKILL.md +33 -0
- package/skills/socka/standard-schema/SKILL.md +26 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: socka/standard-schema
|
|
3
|
+
description: Standard Schema v1 for socka contracts and wire validation—Zod, Valibot, or any compatible library; no Zod-only public surface.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Socka: Standard Schema wire validation
|
|
7
|
+
|
|
8
|
+
## When to use
|
|
9
|
+
|
|
10
|
+
You define **call** `input` / `output` (and optional **push** payloads) for **`@firtoz/socka/core`**, **`@firtoz/socka/client`**, **`@firtoz/socka/react`**, and **`@firtoz/socka/do`**. Every schema slot expects **`StandardSchemaV1`** from **`@standard-schema/spec`** so callers can use **Zod**, **Valibot**, **ArkType**, etc., without socka-specific adapters.
|
|
11
|
+
|
|
12
|
+
## Rules
|
|
13
|
+
|
|
14
|
+
- Pass **`StandardSchemaV1`** instances into **`defineSocka`** call/push definitions. **`SockaWebSocketClient`**, **`SockaSession`**, **`useSocka`**, **`useSockaSession`**, **`SockaSessionProvider`**, and **`SockaDoSession`** all consume the resulting **`SockaContract`**—not raw library types on socka’s public API.
|
|
15
|
+
- **Zod v4** and **Valibot** expose Standard Schema natively; you typically pass schemas **directly** into **`defineSocka`** (no `fromZod` / `fromValibot` helpers required—see package README).
|
|
16
|
+
- For correlated RPC, use **`defineSocka`** + **`useSockaSession`** / **`SockaSession`** / **`SockaDoSession`**.
|
|
17
|
+
- For **your own** discriminated unions in domain types, use **`exhaustiveGuard`** from **`@firtoz/maybe-error`** in **`switch`** defaults so new variants fail at compile time.
|
|
18
|
+
|
|
19
|
+
## Tiers
|
|
20
|
+
|
|
21
|
+
- **Typical**: **`defineSocka`** → **`SockaSession`** or **`useSockaSession`** (or **`SockaSessionProvider`** + **`useSockaSessionContext`**) on the client; **`SockaDoSession`** with the same contract on the DO.
|
|
22
|
+
- **Lower level**: **`SockaWebSocketClient`** with callbacks, or **`@firtoz/socka/core`** encode/decode helpers if you implement custom glue.
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Re-export symbols from **`@firtoz/websocket-do`** through socka; import transport primitives from **websocket-do** directly when needed.
|