mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
* refactor(realtime): type the socket event-handler boundary with @sim/realtime-protocol
Replace the (data: any) event-handler types in socket-provider.tsx with
precise broadcast types that mirror the exact payloads emitted by the
realtime Socket.IO server (apps/realtime/src/handlers/** and rooms/**).
Add @sim/realtime-protocol/events with the canonical wire types for the
broadcast/confirmation events the server emits: WorkflowOperationBroadcast,
SubblockUpdateBroadcast, VariableUpdateBroadcast, CursorUpdateBroadcast,
SelectionUpdateBroadcast, the four workflow-lifecycle broadcasts, and
OperationConfirmed/Failed. Typing change only; zero runtime/logic changes.
Store-internal any (rehydrate state, subblock map, emit payloads) is left
untouched as out of scope.
* fix(realtime): type cursor-update broadcast cursor as nullable
The client emits 'cursor-update' with { cursor: null } when a remote user's
cursor leaves the canvas, and the server re-broadcasts it verbatim, so receivers
genuinely get cursor: null. Type CursorUpdateBroadcast.cursor as
CursorPosition | null to match the wire. (selection stays non-null — it signals
absence via type: 'none', never null.)
41 lines
877 B
JSON
41 lines
877 B
JSON
{
|
|
"name": "@sim/realtime-protocol",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"sideEffects": false,
|
|
"type": "module",
|
|
"license": "Apache-2.0",
|
|
"engines": {
|
|
"bun": ">=1.2.13",
|
|
"node": ">=20.0.0"
|
|
},
|
|
"exports": {
|
|
"./constants": {
|
|
"types": "./src/constants.ts",
|
|
"default": "./src/constants.ts"
|
|
},
|
|
"./events": {
|
|
"types": "./src/events.ts",
|
|
"default": "./src/events.ts"
|
|
},
|
|
"./schemas": {
|
|
"types": "./src/schemas.ts",
|
|
"default": "./src/schemas.ts"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"type-check": "tsc --noEmit",
|
|
"lint": "biome check --write --unsafe .",
|
|
"lint:check": "biome check .",
|
|
"format": "biome format --write .",
|
|
"format:check": "biome format ."
|
|
},
|
|
"dependencies": {
|
|
"zod": "4.3.6"
|
|
},
|
|
"devDependencies": {
|
|
"@sim/tsconfig": "workspace:*",
|
|
"typescript": "^5.7.3"
|
|
}
|
|
}
|