chore(demo): add server-side client requests UI v15 - #3263
Conversation
…lect Two optional props, both additive — existing callers are unaffected: - `allowCustomValue` offers the raw search query as a selectable option, so a caller can target something the option list does not know about (a channel the client has never loaded, for instance). Only surfaced when the query matches nothing or already looks fully qualified (`type:id`), so it does not clutter searches that do match. - `emptyLabel` gives the trigger something to show when `value` matches no option. The first-option fallback is kept for callers that pass neither prop, so nothing changes for the WS event dialog. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds an Actions-menu dialog that builds a server-side StreamChat client in the
browser and invokes a registered method against it. Motivating case: writing
another member's channel data, which a browser client cannot do.
Local debugging aid only. Gated behind `?server_side_client=1` so it never
appears unless asked for; the secret is held in component state for the
lifetime of the dialog and is never persisted to localStorage, the URL, or
anywhere else. An API secret grants full admin access — this must not ship in
a real client bundle.
Three v10 constraints shape the implementation:
- `new StreamChat(key, secret)` does not exist — the constructor takes
`(key, options)` — and `jsonwebtoken` is mapped to false in
`package.json#browser`, so no server token can be minted in a browser bundle.
The `{"server":true}` HS256 token is signed with Web Crypto and injected into
`tokenManager`, which is what `_getToken()` reads for the Authorization
header.
- `client.channel(...)` throws without a connected user, and the generated
`updateMemberPartial` sends no `user_id`, so it can only write the caller's
own membership. Both are avoided by issuing requests through
`client.api.sendRequest` — the same primitive the generated APIs use, which
accepts the query params the generated wrappers drop.
- No connection is opened; a server-side client is stateless, so there is no
connect step. "Check secret" is an optional `getAppSettings` probe that
surfaces a bad credential before a payload is composed.
Entities, methods, payload templates and invocation live in a registry, so
adding a method needs no dialog changes. A member picker writes `user_id` into
the payload, reading its value back out of the JSON so the two cannot drift.
The secret field is a `type="text"` input masked with `-webkit-text-security`
rather than `type="password"`: 1Password decorates password fields and its
injected UI steals focus, which closes undocked Chrome DevTools on the first
keystroke.
Run outcomes are reported through a NotificationList rendered inside the
dialog, scoped by emitter. Emitting with `targetPanels: ['modal']` keeps them
out of the channel's own notification list.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-v15 #3263 +/- ##
==============================================
Coverage ? 84.08%
==============================================
Files ? 523
Lines ? 15900
Branches ? 5047
==============================================
Hits ? 13370
Misses ? 2530
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎯 Goal
Start building UI for server-side requests to make development and testing faster.
AMtH.webm