mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
Full-SDK adapters: each resolves the authenticated caller onto the framework's
context AND wraps the handler in a request-linked span, so backend telemetry
nests under the caller's client session ($refresh-token/$session-replay/
$session-replay-segment) with ZERO per-route plumbing — consumers never pass
{ request } themselves (they can via the core primitive, but don't need to).
- integrations/adapter-core.ts: shared core — normalizeRequestLike, lazy
memoized per-request user resolution, runRequestSpan (withSpan({request}))
- trpc.ts: createHexclaveTRPC(t, app) → createContext + middleware({ required,
telemetry }); no @trpc/server dep (TRPCError-shaped UNAUTHORIZED rejection)
- orpc.ts: createHexclaveORPC(app, { unauthorized }) → middleware +
wrapFetchHandler (oRPC middleware can't see the Request otherwise); refuses
required:true without a real ORPCError factory (branded class, not faked)
- elysia.ts: createHexclaveElysia(app) → resolveUser (.resolve), requireUser
(beforeHandle 401 guard), handler (around-wrapper — the only honest way to
put an Elysia handler inside a span's async extent)
- convex.ts: hexclaveConvexFunction(app, handler, { required, kind, name }) —
identity-based attribution (Convex is WebSocket-transported; no Request, so
segment linking is a documented follow-up)
Span types stay low-cardinality (trpc.procedure/orpc.procedure/elysia.route/
convex.function) with path/type/kind in span data. New subpath exports ./trpc
./orpc ./elysia ./convex on all four SDK packages. 14 unit tests.
|
||
|---|---|---|
| .. | ||
| package.json | ||