You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): support custom WebSocket query params in collaboration config (SD-2543) (#2799)
* feat(cli): support custom WebSocket query params in collaboration config
SD-2543: Adds an optional `params` field to the CLI collaboration config,
forwarded as query parameters on the y-websocket URL and as `parameters`
on the Hocuspocus provider. Validates that values are strings and rejects
the reserved `token` key (set automatically from `tokenEnv`). The field
is omitted from the public collaboration summary since it may contain
identifying metadata.
* fix(cli): preserve params on session rehydration and fingerprint nested fields
Follow-up to SD-2543 addressing two correctness bugs surfaced in review:
1. normalizeWebSocketProfile in context.ts dropped params when rehydrating
persisted collab metadata from disk, so the reconnect reopened without
the user-supplied query params.
2. profileToFingerprint in session-pool.ts used JSON.stringify's array
replacer as a sort helper, but that filter applies at every depth and
silently stripped nested objects. Two profiles differing only in params
hashed identically, causing the pool to reuse the wrong session.
Replaces the fingerprint helper with a recursive stable-stringify and adds
params validation/preservation to the context normalizer. Adds mocked
runtime tests covering the y-websocket and hocuspocus provider handoffs,
the params+token merge order, and fingerprint key-order independence.
* docs(document-engine): document collaboration params field
Adds a "Forward custom WebSocket query parameters" section to the SDK guide
covering the new `params` field: scope (y-websocket and Hocuspocus only,
not Liveblocks), the string-only shape, and the reserved `token` key.
* fix(cli): handle object schemas without explicit properties
The CLI's JSON schema validator crashed on `type: 'object'` schemas that
omitted the `properties` map (e.g. schemas that only declare
`additionalProperties`). `Object.entries(schema.properties)` threw
`Cannot convert undefined or null to object` before reaching the
downstream parser.
Default `schema.properties` to `{}` in both the request and response
validators so these schemas pass through to the layer that can actually
validate their contents. Exposed by SD-2543's collaboration.params
schema, which is the first schema in the repo to use this shape.
0 commit comments