@fitzzero/quickdraw-core 5.0.0-rc.1 → 5.0.0-rc.2

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.
Files changed (35) hide show
  1. package/README.md +8 -1
  2. package/dist/{admin-DufEkep0.d.ts → admin-Bl71J4IG.d.ts} +1 -1
  3. package/dist/{auth-5yi_rUSM.d.ts → auth-DyCIKmTQ.d.ts} +2 -2
  4. package/dist/{caller-JNTbbD37.d.ts → caller-Cx5wuao-.d.ts} +3 -3
  5. package/dist/{chunk-ONVWF4IM.js → chunk-DXTJNJM5.js} +2 -2
  6. package/dist/{chunk-EQ2LW5C5.js → chunk-I2OMV4AD.js} +2 -2
  7. package/dist/{chunk-4QNDKNDK.js → chunk-SSDLYYQV.js} +2 -2
  8. package/dist/{chunk-4QNDKNDK.js.map → chunk-SSDLYYQV.js.map} +1 -1
  9. package/dist/client/index.d.ts +4 -4
  10. package/dist/client/index.js +2 -2
  11. package/dist/{clientTypes-B9eYqDO1.d.ts → clientTypes-B62bWHua.d.ts} +2 -2
  12. package/dist/{createServer-301BCb6c.d.ts → createServer-P61KBWro.d.ts} +6 -6
  13. package/dist/{createTestApp-BPi72usy.d.ts → createTestApp-BBm3TakW.d.ts} +5 -5
  14. package/dist/{envelope-CR2A9lrd.d.ts → envelope-CoiZY9KU.d.ts} +1 -1
  15. package/dist/{http-DC1RmIgu.d.ts → http-89lENH2D.d.ts} +6 -6
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.js +1 -1
  18. package/dist/{infer-CEfvP0_I.d.ts → infer-Cwq49ME5.d.ts} +46 -8
  19. package/dist/{metrics-B1dXpOQc.d.ts → metrics-Ny1dFbyY.d.ts} +2 -2
  20. package/dist/prisma/index.d.ts +4 -4
  21. package/dist/server/auth/index.d.ts +3 -3
  22. package/dist/server/index.d.ts +39 -21
  23. package/dist/server/index.js +2 -2
  24. package/dist/server/mcp/index.d.ts +7 -7
  25. package/dist/server/otel.d.ts +3 -3
  26. package/dist/{sharing-B5-5Q_wT.d.ts → sharing-BHyufgVl.d.ts} +2 -2
  27. package/dist/testing/client.d.ts +11 -11
  28. package/dist/testing/client.js +2 -2
  29. package/dist/testing/index.d.ts +11 -11
  30. package/dist/testing/index.js +2 -2
  31. package/dist/{types-CIq6xwng.d.ts → types-BDmssndG.d.ts} +1 -1
  32. package/dist/utils/index.d.ts +1 -1
  33. package/package.json +2 -2
  34. /package/dist/{chunk-ONVWF4IM.js.map → chunk-DXTJNJM5.js.map} +0 -0
  35. /package/dist/{chunk-EQ2LW5C5.js.map → chunk-I2OMV4AD.js.map} +0 -0
package/README.md CHANGED
@@ -1153,6 +1153,7 @@ export function TaskDetail({ id }: { readonly id: string }) {
1153
1153
  if (isRemoved) {
1154
1154
  return <p>This task was deleted.</p>;
1155
1155
  }
1156
+ // notes reach Admins only (the contract's fields), so its type is optional: guard it
1156
1157
  return (
1157
1158
  <div>
1158
1159
  <h1>{task?.title}</h1>
@@ -1166,6 +1167,10 @@ export function TaskDetail({ id }: { readonly id: string }) {
1166
1167
  }
1167
1168
  ```
1168
1169
 
1170
+ - A field the contract's `fields` map tiers (`notes` here) is optional in
1171
+ every row type a reader gets (`useEntity`, collection items, `"entity"`
1172
+ outputs, `EntityOf`, `ItemOf`), because a reader below its level receives
1173
+ the row without it. Handlers still return the full row.
1169
1174
  - A mutation whose input has `id` and whose output is `"entity"` is
1170
1175
  optimistic by default: its input's fields show over the cached row and its
1171
1176
  collection items from the moment it is sent, are dropped if it fails, and
@@ -2514,7 +2519,9 @@ contracts from the method maps, `defineService` from the service classes,
2514
2519
  the typed client for the hooks, and a report of everything left to decide.
2515
2520
  [`MIGRATION.md`](../../MIGRATION.md) explains each step, the access mapping and
2516
2521
  the defaults that changed; [`UPGRADE-PROMPT.md`](../../UPGRADE-PROMPT.md) is the
2517
- procedure for an agent.
2522
+ procedure for an agent. Both ship with the codemod, at
2523
+ `node_modules/@fitzzero/quickdraw-codemod/MIGRATION.md` and
2524
+ `node_modules/@fitzzero/quickdraw-codemod/UPGRADE-PROMPT.md`.
2518
2525
 
2519
2526
  ```bash
2520
2527
  bunx @fitzzero/quickdraw-codemod@next v5 .
@@ -1,4 +1,4 @@
1
- import { e as StandardSchemaWithJSON, x as SortDirection, d as StandardSchemaV1, I as InferInput, c as InferOutput, L as RowSchema, Q as QueryDef, P as ProjectionList, p as MutationDef, A as AccessLevel, G as AnyContract, ak as MethodName } from './infer-CEfvP0_I.js';
1
+ import { e as StandardSchemaWithJSON, x as SortDirection, d as StandardSchemaV1, I as InferInput, c as InferOutput, L as RowSchema, Q as QueryDef, P as ProjectionList, p as MutationDef, A as AccessLevel, G as AnyContract, al as MethodName } from './infer-Cwq49ME5.js';
2
2
 
3
3
  /** A schema a kit generates: validation, and its JSON Schema. */
4
4
  type KitSchema<Input, Output = Input> = StandardSchemaWithJSON<Input, Output>;
@@ -1,7 +1,7 @@
1
1
  import { IncomingHttpHeaders, IncomingMessage } from 'node:http';
2
2
  import { Socket } from 'socket.io';
3
- import { A as AccessLevel } from './infer-CEfvP0_I.js';
4
- import { P as Principal, M as MaybePromise } from './types-CIq6xwng.js';
3
+ import { A as AccessLevel } from './infer-Cwq49ME5.js';
4
+ import { P as Principal, M as MaybePromise } from './types-BDmssndG.js';
5
5
 
6
6
  /** A principal's service-wide grants by service name: `{ taskService: "Admin" }`. */
7
7
  type ServiceGrants = Readonly<Record<string, AccessLevel>>;
@@ -1,7 +1,7 @@
1
- import { ad as Version, a5 as Revision } from './envelope-CR2A9lrd.js';
1
+ import { ad as Version, a5 as Revision } from './envelope-CoiZY9KU.js';
2
2
  import { L as Logger } from './logger-BY28acW-.js';
3
- import { A as AccessLevel, G as AnyContract, w as CollectionWhere, O as OrderBy, k as MethodKind, d as StandardSchemaV1, ac as EventName, ad as EventPayloadOf, a6 as ChannelName, a7 as ChannelPayloadOf, at as StreamName, ah as IsScopedStream, as as StreamItemOf, aa as ContractMap, ak as MethodName, ag as InputOf, am as OutputOf } from './infer-CEfvP0_I.js';
4
- import { P as Principal, Q as QuickdrawTypes, M as MaybePromise, c as PrincipalOf, a as McpContext, T as Transport, C as ContextExtensionOf, b as McpContextOf, D as DbOf } from './types-CIq6xwng.js';
3
+ import { A as AccessLevel, G as AnyContract, w as CollectionWhere, O as OrderBy, k as MethodKind, d as StandardSchemaV1, ac as EventName, ad as EventPayloadOf, a6 as ChannelName, a7 as ChannelPayloadOf, av as StreamName, ai as IsScopedStream, au as StreamItemOf, aa as ContractMap, al as MethodName, ah as InputOf, an as OutputOf } from './infer-Cwq49ME5.js';
4
+ import { P as Principal, Q as QuickdrawTypes, M as MaybePromise, c as PrincipalOf, a as McpContext, T as Transport, C as ContextExtensionOf, b as McpContextOf, D as DbOf } from './types-BDmssndG.js';
5
5
 
6
6
  /** What a development warning is about. */
7
7
  type DevWarningKind = "n-plus-one" | "unbounded-read" | "oversized-response" | "nested-write" | "ambient-write" | "batch-read" | "batch-create-many" | "repeated-call";
@@ -11,7 +11,7 @@ import {
11
11
  collectionTopic,
12
12
  isAuthenticationRefused,
13
13
  isProtocolMismatch
14
- } from "./chunk-4QNDKNDK.js";
14
+ } from "./chunk-SSDLYYQV.js";
15
15
  import {
16
16
  DEFAULT_COLLECTION_MAX_LIMIT,
17
17
  isScopedStream
@@ -4847,4 +4847,4 @@ export {
4847
4847
  QuickdrawProvider,
4848
4848
  useQuickdraw
4849
4849
  };
4850
- //# sourceMappingURL=chunk-ONVWF4IM.js.map
4850
+ //# sourceMappingURL=chunk-DXTJNJM5.js.map
@@ -74,7 +74,7 @@ import {
74
74
  streamRoom,
75
75
  topicRoom,
76
76
  userRoom
77
- } from "./chunk-4QNDKNDK.js";
77
+ } from "./chunk-SSDLYYQV.js";
78
78
  import {
79
79
  hasJsonSchema
80
80
  } from "./chunk-47AEXVDM.js";
@@ -8293,4 +8293,4 @@ export {
8293
8293
  watchAdapterClients,
8294
8294
  createServer
8295
8295
  };
8296
- //# sourceMappingURL=chunk-EQ2LW5C5.js.map
8296
+ //# sourceMappingURL=chunk-I2OMV4AD.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-V3KNCTXJ.js";
4
4
 
5
5
  // src/version.ts
6
- var QUICKDRAW_VERSION = "5.0.0-rc.1";
6
+ var QUICKDRAW_VERSION = "5.0.0-rc.2";
7
7
 
8
8
  // src/contract/names.ts
9
9
  function entityRoom(service, id, level) {
@@ -114,4 +114,4 @@ export {
114
114
  MAX_SUBSCRIBE_IDS,
115
115
  MAX_SCOPE_LENGTH
116
116
  };
117
- //# sourceMappingURL=chunk-4QNDKNDK.js.map
117
+ //# sourceMappingURL=chunk-SSDLYYQV.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts","../src/contract/names.ts","../src/protocol/version.ts"],"sourcesContent":["/** The published version of `@fitzzero/quickdraw-core`. Kept in step with package.json. */\nexport const QUICKDRAW_VERSION = \"5.0.0-rc.1\";\n","// Room and event names for protocol v5 (RFC 0003 sections 6, 7 and 8). Ported\n// from the 4.1 room helpers (`legacy-src/shared/types.ts:364-405`), which were\n// plain template strings so shared code could name a room without holding a\n// service instance. The 5.0 rooms live under a `qd:` prefix so they never\n// collide with an app's own rooms; the per-user room keeps its 4.1 name.\n\nimport type { AccessLevel } from \"./access\";\n\n/**\n * The room for one entity at one access tier: `qd:e:{service}:{id}@{level}`.\n * A subscriber joins the room for its own level, so a frame is built once and\n * stripped once per occupied tier.\n */\nexport function entityRoom(service: string, id: string, level: AccessLevel): string {\n return `qd:e:${service}:${id}@${level}`;\n}\n\n/** The room for one scope of a collection: `qd:c:{service}:{collection}:{scope}`. */\nexport function collectionRoom(service: string, collection: string, scope: string): string {\n return `qd:c:${service}:${collection}:${scope}`;\n}\n\n/** The room for a watched topic of a service: `qd:t:{service}:{topic}`. */\nexport function topicRoom(service: string, topic: string): string {\n return `qd:t:${service}:${topic}`;\n}\n\n/**\n * The change topic of a whole service (RFC 0003 section 11.3): every flush\n * that changes one of its rows or collection scopes signals it.\n */\nexport const SERVICE_TOPIC = \"service\";\n\n/** The change topic of one scope of a collection: `{collection}:{scope}` (RFC 0003 section 11.3). */\nexport function collectionTopic(collection: string, scope: string): string {\n return `${collection}:${scope}`;\n}\n\n/**\n * The room of a stream's feed (RFC 0003 section 12.5):\n * `qd:s:{service}:{stream}:{scope}` for one scope of a scoped stream, and\n * `qd:s:{service}:{stream}` for a global stream. Stream names hold no colon.\n */\nexport function streamRoom(service: string, stream: string, scope?: string): string {\n return scope === undefined ? `qd:s:${service}:${stream}` : `qd:s:${service}:${stream}:${scope}`;\n}\n\n/** The room every authenticated socket of a user joins: `user:{userId}`, as in 4.1. */\nexport function userRoom(userId: string): string {\n return `user:${userId}`;\n}\n\n/**\n * The prefixes of the rooms the framework manages: entity, collection, topic\n * and stream rooms (`qd:`) and user rooms (`user:`). `ctx.rooms.join` refuses\n * them; a socket enters those rooms only through their authorized paths.\n */\nexport const RESERVED_ROOM_PREFIXES: readonly string[] = Object.freeze([\"qd:\", \"user:\"]);\n\n/**\n * The reserved prefix `room` starts with (`qd:` or `user:`), or `undefined`\n * when an app room may have that name.\n */\nexport function reservedRoomPrefix(room: string): string | undefined {\n return RESERVED_ROOM_PREFIXES.find((prefix) => room.startsWith(prefix));\n}\n\n/** Events a client sends to the server (RFC 0003 section 8.2). */\nexport const CLIENT_EVENTS = Object.freeze({\n /** A method call: `{ id, s, m, i, v? }`, answered by ack. */\n call: \"qd:call\",\n /** Cancels an in-flight call: `{ id }`. */\n cancel: \"qd:cancel\",\n /** Subscribes to entities by id, with the revisions held. */\n sub: \"qd:sub\",\n /** Unsubscribes from entities. */\n unsub: \"qd:unsub\",\n /** Subscribes to a collection scope, or resumes it from a revision. */\n collectionSub: \"qd:col:sub\",\n /** Unsubscribes from a collection scope. */\n collectionUnsub: \"qd:col:unsub\",\n /** Loads collection items by id. */\n collectionItems: \"qd:col:items\",\n /** Joins a watched topic: `{ s, topic }`. */\n watch: \"qd:watch\",\n /** Leaves a watched topic. */\n unwatch: \"qd:unwatch\",\n /** Subscribes to a stream and receives its seed. */\n streamSub: \"qd:stream:sub\",\n /** Unsubscribes from a stream. */\n streamUnsub: \"qd:stream:unsub\",\n /** A fire-and-forget channel message, sent volatile: `[s, channel, payload]`. */\n channel: \"qd:ch\",\n} as const);\n\n/** Events the server sends to a client (RFC 0003 section 8.3). */\nexport const SERVER_EVENTS = Object.freeze({\n /** The handshake reply: `{ protocol, server, limits, features, userId, serviceAccess }`. */\n hello: \"qd:hello\",\n /** Entity frames: full update, patch or removal. */\n entity: \"qd:e\",\n /** Collection deltas, batched per flush. */\n collection: \"qd:c\",\n /** A watched topic changed; the client invalidates its queries. */\n changed: \"qd:changed\",\n /** Access to a subscription was revoked. */\n revoked: \"qd:revoked\",\n /** Stream items. */\n stream: \"qd:stream\",\n /** Typed custom room events declared in a contract's `events`. */\n event: \"qd:event\",\n /** Who is in an app room the socket is in: the list on joining, then each user who joins or leaves. */\n presence: \"qd:presence\",\n /** Reconnect within a jitter window. */\n rotate: \"qd:rotate\",\n /** The user's service grants changed. */\n access: \"qd:access\",\n} as const);\n\n/** The name of an event a client sends. */\nexport type ClientEventName = (typeof CLIENT_EVENTS)[keyof typeof CLIENT_EVENTS];\n\n/** The name of an event the server sends. */\nexport type ServerEventName = (typeof SERVER_EVENTS)[keyof typeof SERVER_EVENTS];\n","// The protocol version and the connection handshake (RFC 0003 section 8.1).\n// A v5 client connects with `auth: { token, qd: { protocol: 5, client } }`.\n// The server answers with `qd:hello`, or refuses a client that names another\n// protocol with `PROTOCOL_MISMATCH` in the `connect_error` data, and one whose\n// authentication failed with `UNAUTHENTICATED` there. A client that sends no\n// `auth.qd` is a 4.x client, which only the legacy shim serves (section 8.5).\n// There is no capability negotiation: the version decides.\n\nimport type { AccessLevel } from \"../contract/access\";\nimport { isRecord } from \"./guards\";\n\n/** The wire protocol this package speaks. */\nexport const PROTOCOL_VERSION = 5;\n\n/** `auth.qd`: what a v5 client sends when it connects. */\nexport interface QdHandshake {\n /** The protocol the client speaks. The server refuses any but its own. */\n readonly protocol: number;\n /** The client package's version, for logs. */\n readonly client: string;\n}\n\n/** The Socket.IO `auth` a v5 client connects with. */\nexport interface HandshakeAuth {\n /** The session token the server's `authenticate` reads. */\n readonly token?: string;\n /** The protocol the client speaks. A client without it is a 4.x client (RFC 0003 section 8.5). */\n readonly qd: QdHandshake;\n}\n\n/**\n * True when `value` has the shape of `auth.qd`, whatever protocol it names.\n * Compare `protocol` with {@link PROTOCOL_VERSION} to decide whether to serve it.\n */\nexport function isQdHandshake(value: unknown): value is QdHandshake {\n return isRecord(value) && Number.isInteger(value.protocol) && typeof value.client === \"string\";\n}\n\n/** The code in the `connect_error` data of a connection refused for its protocol. */\nexport const PROTOCOL_MISMATCH = \"PROTOCOL_MISMATCH\";\n\n/**\n * The `data` of the error a server refuses a connection with when the client\n * speaks another protocol, or none. It is not an `ErrorCode`: no call failed.\n */\nexport interface ProtocolMismatch {\n readonly code: typeof PROTOCOL_MISMATCH;\n /** The protocol the server speaks. */\n readonly expected: number;\n}\n\n/** True when a `connect_error`'s `data` says the server speaks another protocol. */\nexport function isProtocolMismatch(value: unknown): value is ProtocolMismatch {\n return isRecord(value) && value.code === PROTOCOL_MISMATCH && Number.isInteger(value.expected);\n}\n\n/**\n * The `data` of the error a server refuses a connection with when\n * authenticating it failed: the app's `authenticate` threw, so the\n * credentials are bad or could not be checked. A client tells it apart from\n * {@link ProtocolMismatch} by `code`; reconnecting needs other credentials.\n */\nexport interface AuthenticationRefused {\n readonly code: \"UNAUTHENTICATED\";\n}\n\n/** True when a `connect_error`'s `data` says authenticating the connection failed. */\nexport function isAuthenticationRefused(value: unknown): value is AuthenticationRefused {\n return isRecord(value) && value.code === \"UNAUTHENTICATED\";\n}\n\n/** The most ids one `qd:sub` may name (RFC 0003 section 6), as `qd:hello` announces it. */\nexport const MAX_SUBSCRIBE_IDS = 500;\n\n/** The longest collection scope value or change topic a frame may name, in characters. */\nexport const MAX_SCOPE_LENGTH = 256;\n\n/**\n * Each socket's lane of subscription events (`qd:sub`, `qd:col:sub`,\n * `qd:col:items`, `qd:watch`; RFC 0003 section 8.2), as `qd:hello` announces it.\n */\nexport interface HelloSubscriptionLimits {\n /** Subscription events one socket may have running at once. */\n readonly maxInFlight: number;\n /** Subscription events one socket may have waiting; past that one fails with `RATE_LIMITED`. */\n readonly maxQueued: number;\n}\n\n/** The limits a server announces in `qd:hello`, so a client can stay inside them. */\nexport interface HelloLimits {\n /** Queries one socket may have running at once; more wait in a queue (RFC 0003 section 9). */\n readonly maxInFlightQueries: number;\n /** Queries one socket may have waiting; past that a query fails with `RATE_LIMITED`. */\n readonly maxQueuedQueries: number;\n /** Ids one `qd:sub` may name (RFC 0003 section 6). */\n readonly maxSubscribeIds: number;\n /**\n * A call's default time limit in milliseconds, after which it fails with\n * `TIMEOUT`. A v5 client waits this long plus 2 s for an answer, so a slow\n * call ends with the server's `TIMEOUT` rather than its own.\n */\n readonly callTimeoutMs: number;\n /** The socket's lane of subscription events. */\n readonly subscriptions: HelloSubscriptionLimits;\n}\n\n/**\n * `qd:hello`: the server's answer to a v5 handshake, sent once per\n * connection, after the socket's listeners are in place. It says who the\n * socket acts for, so a client knows its user without another call.\n */\nexport interface HelloFrame {\n /** The protocol the server speaks. */\n readonly protocol: typeof PROTOCOL_VERSION;\n /** The server package's version. */\n readonly server: string;\n /** What a client must stay within. */\n readonly limits: HelloLimits;\n /** Names of optional server features that are on. Informational only. */\n readonly features: readonly string[];\n /** The user the socket acts for, or `null` when it is anonymous. */\n readonly userId: string | null;\n /**\n * The principal's service-wide grants when the socket connected, by\n * service name: `{ taskService: \"Admin\" }`. Empty for an anonymous socket\n * or a principal without grants. Later changes arrive as `qd:access`.\n */\n readonly serviceAccess: Readonly<Record<string, AccessLevel>>;\n}\n"],"mappings":";;;;;AACO,IAAM,oBAAoB;;;ACY1B,SAAS,WAAW,SAAiB,IAAY,OAA4B;AAClF,SAAO,QAAQ,OAAO,IAAI,EAAE,IAAI,KAAK;AACvC;AAGO,SAAS,eAAe,SAAiB,YAAoB,OAAuB;AACzF,SAAO,QAAQ,OAAO,IAAI,UAAU,IAAI,KAAK;AAC/C;AAGO,SAAS,UAAU,SAAiB,OAAuB;AAChE,SAAO,QAAQ,OAAO,IAAI,KAAK;AACjC;AAMO,IAAM,gBAAgB;AAGtB,SAAS,gBAAgB,YAAoB,OAAuB;AACzE,SAAO,GAAG,UAAU,IAAI,KAAK;AAC/B;AAOO,SAAS,WAAW,SAAiB,QAAgB,OAAwB;AAClF,SAAO,UAAU,SAAY,QAAQ,OAAO,IAAI,MAAM,KAAK,QAAQ,OAAO,IAAI,MAAM,IAAI,KAAK;AAC/F;AAGO,SAAS,SAAS,QAAwB;AAC/C,SAAO,QAAQ,MAAM;AACvB;AAOO,IAAM,yBAA4C,OAAO,OAAO,CAAC,OAAO,OAAO,CAAC;AAMhF,SAAS,mBAAmB,MAAkC;AACnE,SAAO,uBAAuB,KAAK,CAAC,WAAW,KAAK,WAAW,MAAM,CAAC;AACxE;AAGO,IAAM,gBAAgB,OAAO,OAAO;AAAA;AAAA,EAEzC,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,KAAK;AAAA;AAAA,EAEL,OAAO;AAAA;AAAA,EAEP,eAAe;AAAA;AAAA,EAEf,iBAAiB;AAAA;AAAA,EAEjB,iBAAiB;AAAA;AAAA,EAEjB,OAAO;AAAA;AAAA,EAEP,SAAS;AAAA;AAAA,EAET,WAAW;AAAA;AAAA,EAEX,aAAa;AAAA;AAAA,EAEb,SAAS;AACX,CAAU;AAGH,IAAM,gBAAgB,OAAO,OAAO;AAAA;AAAA,EAEzC,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,YAAY;AAAA;AAAA,EAEZ,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA;AAAA,EAEP,UAAU;AAAA;AAAA,EAEV,QAAQ;AAAA;AAAA,EAER,QAAQ;AACV,CAAU;;;ACzGH,IAAM,mBAAmB;AAsBzB,SAAS,cAAc,OAAsC;AAClE,SAAO,SAAS,KAAK,KAAK,OAAO,UAAU,MAAM,QAAQ,KAAK,OAAO,MAAM,WAAW;AACxF;AAGO,IAAM,oBAAoB;AAa1B,SAAS,mBAAmB,OAA2C;AAC5E,SAAO,SAAS,KAAK,KAAK,MAAM,SAAS,qBAAqB,OAAO,UAAU,MAAM,QAAQ;AAC/F;AAaO,SAAS,wBAAwB,OAAgD;AACtF,SAAO,SAAS,KAAK,KAAK,MAAM,SAAS;AAC3C;AAGO,IAAM,oBAAoB;AAG1B,IAAM,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../src/version.ts","../src/contract/names.ts","../src/protocol/version.ts"],"sourcesContent":["/** The published version of `@fitzzero/quickdraw-core`. Kept in step with package.json. */\nexport const QUICKDRAW_VERSION = \"5.0.0-rc.2\";\n","// Room and event names for protocol v5 (RFC 0003 sections 6, 7 and 8). Ported\n// from the 4.1 room helpers (`legacy-src/shared/types.ts:364-405`), which were\n// plain template strings so shared code could name a room without holding a\n// service instance. The 5.0 rooms live under a `qd:` prefix so they never\n// collide with an app's own rooms; the per-user room keeps its 4.1 name.\n\nimport type { AccessLevel } from \"./access\";\n\n/**\n * The room for one entity at one access tier: `qd:e:{service}:{id}@{level}`.\n * A subscriber joins the room for its own level, so a frame is built once and\n * stripped once per occupied tier.\n */\nexport function entityRoom(service: string, id: string, level: AccessLevel): string {\n return `qd:e:${service}:${id}@${level}`;\n}\n\n/** The room for one scope of a collection: `qd:c:{service}:{collection}:{scope}`. */\nexport function collectionRoom(service: string, collection: string, scope: string): string {\n return `qd:c:${service}:${collection}:${scope}`;\n}\n\n/** The room for a watched topic of a service: `qd:t:{service}:{topic}`. */\nexport function topicRoom(service: string, topic: string): string {\n return `qd:t:${service}:${topic}`;\n}\n\n/**\n * The change topic of a whole service (RFC 0003 section 11.3): every flush\n * that changes one of its rows or collection scopes signals it.\n */\nexport const SERVICE_TOPIC = \"service\";\n\n/** The change topic of one scope of a collection: `{collection}:{scope}` (RFC 0003 section 11.3). */\nexport function collectionTopic(collection: string, scope: string): string {\n return `${collection}:${scope}`;\n}\n\n/**\n * The room of a stream's feed (RFC 0003 section 12.5):\n * `qd:s:{service}:{stream}:{scope}` for one scope of a scoped stream, and\n * `qd:s:{service}:{stream}` for a global stream. Stream names hold no colon.\n */\nexport function streamRoom(service: string, stream: string, scope?: string): string {\n return scope === undefined ? `qd:s:${service}:${stream}` : `qd:s:${service}:${stream}:${scope}`;\n}\n\n/** The room every authenticated socket of a user joins: `user:{userId}`, as in 4.1. */\nexport function userRoom(userId: string): string {\n return `user:${userId}`;\n}\n\n/**\n * The prefixes of the rooms the framework manages: entity, collection, topic\n * and stream rooms (`qd:`) and user rooms (`user:`). `ctx.rooms.join` refuses\n * them; a socket enters those rooms only through their authorized paths.\n */\nexport const RESERVED_ROOM_PREFIXES: readonly string[] = Object.freeze([\"qd:\", \"user:\"]);\n\n/**\n * The reserved prefix `room` starts with (`qd:` or `user:`), or `undefined`\n * when an app room may have that name.\n */\nexport function reservedRoomPrefix(room: string): string | undefined {\n return RESERVED_ROOM_PREFIXES.find((prefix) => room.startsWith(prefix));\n}\n\n/** Events a client sends to the server (RFC 0003 section 8.2). */\nexport const CLIENT_EVENTS = Object.freeze({\n /** A method call: `{ id, s, m, i, v? }`, answered by ack. */\n call: \"qd:call\",\n /** Cancels an in-flight call: `{ id }`. */\n cancel: \"qd:cancel\",\n /** Subscribes to entities by id, with the revisions held. */\n sub: \"qd:sub\",\n /** Unsubscribes from entities. */\n unsub: \"qd:unsub\",\n /** Subscribes to a collection scope, or resumes it from a revision. */\n collectionSub: \"qd:col:sub\",\n /** Unsubscribes from a collection scope. */\n collectionUnsub: \"qd:col:unsub\",\n /** Loads collection items by id. */\n collectionItems: \"qd:col:items\",\n /** Joins a watched topic: `{ s, topic }`. */\n watch: \"qd:watch\",\n /** Leaves a watched topic. */\n unwatch: \"qd:unwatch\",\n /** Subscribes to a stream and receives its seed. */\n streamSub: \"qd:stream:sub\",\n /** Unsubscribes from a stream. */\n streamUnsub: \"qd:stream:unsub\",\n /** A fire-and-forget channel message, sent volatile: `[s, channel, payload]`. */\n channel: \"qd:ch\",\n} as const);\n\n/** Events the server sends to a client (RFC 0003 section 8.3). */\nexport const SERVER_EVENTS = Object.freeze({\n /** The handshake reply: `{ protocol, server, limits, features, userId, serviceAccess }`. */\n hello: \"qd:hello\",\n /** Entity frames: full update, patch or removal. */\n entity: \"qd:e\",\n /** Collection deltas, batched per flush. */\n collection: \"qd:c\",\n /** A watched topic changed; the client invalidates its queries. */\n changed: \"qd:changed\",\n /** Access to a subscription was revoked. */\n revoked: \"qd:revoked\",\n /** Stream items. */\n stream: \"qd:stream\",\n /** Typed custom room events declared in a contract's `events`. */\n event: \"qd:event\",\n /** Who is in an app room the socket is in: the list on joining, then each user who joins or leaves. */\n presence: \"qd:presence\",\n /** Reconnect within a jitter window. */\n rotate: \"qd:rotate\",\n /** The user's service grants changed. */\n access: \"qd:access\",\n} as const);\n\n/** The name of an event a client sends. */\nexport type ClientEventName = (typeof CLIENT_EVENTS)[keyof typeof CLIENT_EVENTS];\n\n/** The name of an event the server sends. */\nexport type ServerEventName = (typeof SERVER_EVENTS)[keyof typeof SERVER_EVENTS];\n","// The protocol version and the connection handshake (RFC 0003 section 8.1).\n// A v5 client connects with `auth: { token, qd: { protocol: 5, client } }`.\n// The server answers with `qd:hello`, or refuses a client that names another\n// protocol with `PROTOCOL_MISMATCH` in the `connect_error` data, and one whose\n// authentication failed with `UNAUTHENTICATED` there. A client that sends no\n// `auth.qd` is a 4.x client, which only the legacy shim serves (section 8.5).\n// There is no capability negotiation: the version decides.\n\nimport type { AccessLevel } from \"../contract/access\";\nimport { isRecord } from \"./guards\";\n\n/** The wire protocol this package speaks. */\nexport const PROTOCOL_VERSION = 5;\n\n/** `auth.qd`: what a v5 client sends when it connects. */\nexport interface QdHandshake {\n /** The protocol the client speaks. The server refuses any but its own. */\n readonly protocol: number;\n /** The client package's version, for logs. */\n readonly client: string;\n}\n\n/** The Socket.IO `auth` a v5 client connects with. */\nexport interface HandshakeAuth {\n /** The session token the server's `authenticate` reads. */\n readonly token?: string;\n /** The protocol the client speaks. A client without it is a 4.x client (RFC 0003 section 8.5). */\n readonly qd: QdHandshake;\n}\n\n/**\n * True when `value` has the shape of `auth.qd`, whatever protocol it names.\n * Compare `protocol` with {@link PROTOCOL_VERSION} to decide whether to serve it.\n */\nexport function isQdHandshake(value: unknown): value is QdHandshake {\n return isRecord(value) && Number.isInteger(value.protocol) && typeof value.client === \"string\";\n}\n\n/** The code in the `connect_error` data of a connection refused for its protocol. */\nexport const PROTOCOL_MISMATCH = \"PROTOCOL_MISMATCH\";\n\n/**\n * The `data` of the error a server refuses a connection with when the client\n * speaks another protocol, or none. It is not an `ErrorCode`: no call failed.\n */\nexport interface ProtocolMismatch {\n readonly code: typeof PROTOCOL_MISMATCH;\n /** The protocol the server speaks. */\n readonly expected: number;\n}\n\n/** True when a `connect_error`'s `data` says the server speaks another protocol. */\nexport function isProtocolMismatch(value: unknown): value is ProtocolMismatch {\n return isRecord(value) && value.code === PROTOCOL_MISMATCH && Number.isInteger(value.expected);\n}\n\n/**\n * The `data` of the error a server refuses a connection with when\n * authenticating it failed: the app's `authenticate` threw, so the\n * credentials are bad or could not be checked. A client tells it apart from\n * {@link ProtocolMismatch} by `code`; reconnecting needs other credentials.\n */\nexport interface AuthenticationRefused {\n readonly code: \"UNAUTHENTICATED\";\n}\n\n/** True when a `connect_error`'s `data` says authenticating the connection failed. */\nexport function isAuthenticationRefused(value: unknown): value is AuthenticationRefused {\n return isRecord(value) && value.code === \"UNAUTHENTICATED\";\n}\n\n/** The most ids one `qd:sub` may name (RFC 0003 section 6), as `qd:hello` announces it. */\nexport const MAX_SUBSCRIBE_IDS = 500;\n\n/** The longest collection scope value or change topic a frame may name, in characters. */\nexport const MAX_SCOPE_LENGTH = 256;\n\n/**\n * Each socket's lane of subscription events (`qd:sub`, `qd:col:sub`,\n * `qd:col:items`, `qd:watch`; RFC 0003 section 8.2), as `qd:hello` announces it.\n */\nexport interface HelloSubscriptionLimits {\n /** Subscription events one socket may have running at once. */\n readonly maxInFlight: number;\n /** Subscription events one socket may have waiting; past that one fails with `RATE_LIMITED`. */\n readonly maxQueued: number;\n}\n\n/** The limits a server announces in `qd:hello`, so a client can stay inside them. */\nexport interface HelloLimits {\n /** Queries one socket may have running at once; more wait in a queue (RFC 0003 section 9). */\n readonly maxInFlightQueries: number;\n /** Queries one socket may have waiting; past that a query fails with `RATE_LIMITED`. */\n readonly maxQueuedQueries: number;\n /** Ids one `qd:sub` may name (RFC 0003 section 6). */\n readonly maxSubscribeIds: number;\n /**\n * A call's default time limit in milliseconds, after which it fails with\n * `TIMEOUT`. A v5 client waits this long plus 2 s for an answer, so a slow\n * call ends with the server's `TIMEOUT` rather than its own.\n */\n readonly callTimeoutMs: number;\n /** The socket's lane of subscription events. */\n readonly subscriptions: HelloSubscriptionLimits;\n}\n\n/**\n * `qd:hello`: the server's answer to a v5 handshake, sent once per\n * connection, after the socket's listeners are in place. It says who the\n * socket acts for, so a client knows its user without another call.\n */\nexport interface HelloFrame {\n /** The protocol the server speaks. */\n readonly protocol: typeof PROTOCOL_VERSION;\n /** The server package's version. */\n readonly server: string;\n /** What a client must stay within. */\n readonly limits: HelloLimits;\n /** Names of optional server features that are on. Informational only. */\n readonly features: readonly string[];\n /** The user the socket acts for, or `null` when it is anonymous. */\n readonly userId: string | null;\n /**\n * The principal's service-wide grants when the socket connected, by\n * service name: `{ taskService: \"Admin\" }`. Empty for an anonymous socket\n * or a principal without grants. Later changes arrive as `qd:access`.\n */\n readonly serviceAccess: Readonly<Record<string, AccessLevel>>;\n}\n"],"mappings":";;;;;AACO,IAAM,oBAAoB;;;ACY1B,SAAS,WAAW,SAAiB,IAAY,OAA4B;AAClF,SAAO,QAAQ,OAAO,IAAI,EAAE,IAAI,KAAK;AACvC;AAGO,SAAS,eAAe,SAAiB,YAAoB,OAAuB;AACzF,SAAO,QAAQ,OAAO,IAAI,UAAU,IAAI,KAAK;AAC/C;AAGO,SAAS,UAAU,SAAiB,OAAuB;AAChE,SAAO,QAAQ,OAAO,IAAI,KAAK;AACjC;AAMO,IAAM,gBAAgB;AAGtB,SAAS,gBAAgB,YAAoB,OAAuB;AACzE,SAAO,GAAG,UAAU,IAAI,KAAK;AAC/B;AAOO,SAAS,WAAW,SAAiB,QAAgB,OAAwB;AAClF,SAAO,UAAU,SAAY,QAAQ,OAAO,IAAI,MAAM,KAAK,QAAQ,OAAO,IAAI,MAAM,IAAI,KAAK;AAC/F;AAGO,SAAS,SAAS,QAAwB;AAC/C,SAAO,QAAQ,MAAM;AACvB;AAOO,IAAM,yBAA4C,OAAO,OAAO,CAAC,OAAO,OAAO,CAAC;AAMhF,SAAS,mBAAmB,MAAkC;AACnE,SAAO,uBAAuB,KAAK,CAAC,WAAW,KAAK,WAAW,MAAM,CAAC;AACxE;AAGO,IAAM,gBAAgB,OAAO,OAAO;AAAA;AAAA,EAEzC,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,KAAK;AAAA;AAAA,EAEL,OAAO;AAAA;AAAA,EAEP,eAAe;AAAA;AAAA,EAEf,iBAAiB;AAAA;AAAA,EAEjB,iBAAiB;AAAA;AAAA,EAEjB,OAAO;AAAA;AAAA,EAEP,SAAS;AAAA;AAAA,EAET,WAAW;AAAA;AAAA,EAEX,aAAa;AAAA;AAAA,EAEb,SAAS;AACX,CAAU;AAGH,IAAM,gBAAgB,OAAO,OAAO;AAAA;AAAA,EAEzC,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,YAAY;AAAA;AAAA,EAEZ,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA;AAAA,EAEP,UAAU;AAAA;AAAA,EAEV,QAAQ;AAAA;AAAA,EAER,QAAQ;AACV,CAAU;;;ACzGH,IAAM,mBAAmB;AAsBzB,SAAS,cAAc,OAAsC;AAClE,SAAO,SAAS,KAAK,KAAK,OAAO,UAAU,MAAM,QAAQ,KAAK,OAAO,MAAM,WAAW;AACxF;AAGO,IAAM,oBAAoB;AAa1B,SAAS,mBAAmB,OAA2C;AAC5E,SAAO,SAAS,KAAK,KAAK,MAAM,SAAS,qBAAqB,OAAO,UAAU,MAAM,QAAQ;AAC/F;AAaO,SAAS,wBAAwB,OAAgD;AACtF,SAAO,SAAS,KAAK,KAAK,MAAM,SAAS;AAC3C;AAGO,IAAM,oBAAoB;AAG1B,IAAM,mBAAmB;","names":[]}
@@ -1,10 +1,10 @@
1
1
  export { BreadcrumbItem, JWTPayload, NavItem, ServerCallOptions, ServerCaller, ServerCallerHeaders, ServerCallerOptions, ServerMethod, ServerMutation, ServerQuery, buildBreadcrumbs, createServerCaller, findNavItemByHref, findParentNavItem, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, parseJWTPayload, routeRequiresAuth, truncate } from '../utils/index.js';
2
2
  import { C as CollectionQueryKey } from '../keys-CqKkljVN.js';
3
3
  export { E as EntityQueryKey, K as KEY_ROOT, b as MethodKeyPrefix, M as MethodQueryKey, S as ServiceKeyPrefix, c as collectionKey, e as entityKey, m as methodKey, a as methodKeyPrefix, s as serviceKeyPrefix } from '../keys-CqKkljVN.js';
4
- import { d as QuickdrawConnection, c as QuickdrawClient, e as QuickdrawConnectionOptions, f as ConnectionAuth, g as ConnectionStatus, h as ConnectionRefusal } from '../clientTypes-B9eYqDO1.js';
5
- export { A as AdminMembers, B as BackoffKind, m as BackoffWindows, a as ChannelMember, C as CollectionMember, j as ConnectionState, D as DEFAULT_BACKOFF_MS, n as DEFAULT_SUBSCRIPTION_LANE, E as EntityMembers, b as EventMember, P as GlobalStreamMember, J as JoinWait, L as LaneCallback, u as LiveMembers, M as MethodMember, a2 as MethodMutationOptions, a3 as MethodQueryOptions, v as MutationCallOptions, w as MutationMember, x as MutationVariables, O as OptimisticCache, y as OptimisticCacheOf, r as OptimisticUpdate, s as OverlayStore, t as OverlayView, z as QueryCallOptions, F as QueryMember, Q as QuickdrawInvalidate, k as QuickdrawSocket, R as RealtimeMembers, V as ScopedStreamMember, _ as SearchMember, $ as SearchMemberOf, G as ServiceClient, l as SocketClientOptions, S as StreamMember, o as SubscriptionEvent, p as SubscriptionLane, T as TopicWatch, W as UseChannelResult, U as UseCollectionOptions, H as UseCollectionResult, I as UseEntitiesResult, K as UseEntityOptions, N as UseEntityResult, X as UseEventOptions, a0 as UseSearchOptions, a1 as UseSearchResult, Y as UseStreamOptions, Z as UseStreamResult, i as createQuickdrawConnection, q as overlaysOf } from '../clientTypes-B9eYqDO1.js';
6
- import { k as MethodKind, O as OrderBy, C as CollectionDef, aa as ContractMap, A as AccessLevel } from '../infer-CEfvP0_I.js';
7
- import { ad as Version, y as CallSuccess, w as CallNotModified, n as ProtocolMismatch, a5 as Revision, F as CollectionDelta, G as CollectionFrame, a7 as RevokeReason, k as HelloFrame } from '../envelope-CR2A9lrd.js';
4
+ import { d as QuickdrawConnection, c as QuickdrawClient, e as QuickdrawConnectionOptions, f as ConnectionAuth, g as ConnectionStatus, h as ConnectionRefusal } from '../clientTypes-B62bWHua.js';
5
+ export { A as AdminMembers, B as BackoffKind, m as BackoffWindows, a as ChannelMember, C as CollectionMember, j as ConnectionState, D as DEFAULT_BACKOFF_MS, n as DEFAULT_SUBSCRIPTION_LANE, E as EntityMembers, b as EventMember, P as GlobalStreamMember, J as JoinWait, L as LaneCallback, u as LiveMembers, M as MethodMember, a2 as MethodMutationOptions, a3 as MethodQueryOptions, v as MutationCallOptions, w as MutationMember, x as MutationVariables, O as OptimisticCache, y as OptimisticCacheOf, r as OptimisticUpdate, s as OverlayStore, t as OverlayView, z as QueryCallOptions, F as QueryMember, Q as QuickdrawInvalidate, k as QuickdrawSocket, R as RealtimeMembers, V as ScopedStreamMember, _ as SearchMember, $ as SearchMemberOf, G as ServiceClient, l as SocketClientOptions, S as StreamMember, o as SubscriptionEvent, p as SubscriptionLane, T as TopicWatch, W as UseChannelResult, U as UseCollectionOptions, H as UseCollectionResult, I as UseEntitiesResult, K as UseEntityOptions, N as UseEntityResult, X as UseEventOptions, a0 as UseSearchOptions, a1 as UseSearchResult, Y as UseStreamOptions, Z as UseStreamResult, i as createQuickdrawConnection, q as overlaysOf } from '../clientTypes-B62bWHua.js';
6
+ import { k as MethodKind, O as OrderBy, C as CollectionDef, aa as ContractMap, A as AccessLevel } from '../infer-Cwq49ME5.js';
7
+ import { ad as Version, y as CallSuccess, w as CallNotModified, n as ProtocolMismatch, a5 as Revision, F as CollectionDelta, G as CollectionFrame, a7 as RevokeReason, k as HelloFrame } from '../envelope-CoiZY9KU.js';
8
8
  import { QueryClient, QueryKey, Query } from '@tanstack/react-query';
9
9
  import { Q as QuickdrawError } from '../errors-S-bxEIBC.js';
10
10
  import * as React from 'react';
@@ -32,9 +32,9 @@ import {
32
32
  useAdminServices,
33
33
  useLiveData,
34
34
  useQuickdraw
35
- } from "../chunk-ONVWF4IM.js";
35
+ } from "../chunk-DXTJNJM5.js";
36
36
  import "../chunk-K35VD4CQ.js";
37
- import "../chunk-4QNDKNDK.js";
37
+ import "../chunk-SSDLYYQV.js";
38
38
  import "../chunk-UJQJM7EG.js";
39
39
  import "../chunk-47AEXVDM.js";
40
40
  import "../chunk-Z2LZ7IZ7.js";
@@ -1,5 +1,5 @@
1
- import { C as CLIENT_EVENTS, a9 as ServerToClientEvents, E as ClientToServerEvents, B as ChangedFrame, n as ProtocolMismatch, k as HelloFrame, A as AuthenticationRefused, a5 as Revision } from './envelope-CR2A9lrd.js';
2
- import { k as MethodKind, G as AnyContract, at as StreamName, ah as IsScopedStream, as as StreamItemOf, a6 as ChannelName, a5 as ChannelInputOf, ac as EventName, ad as EventPayloadOf, ak as MethodName, al as MethodOf, am as OutputOf, ag as InputOf, aa as ContractMap, aj as KindOf, ab as EntityOf, a8 as CollectionName, ai as ItemOf, aq as ScopeOf, au as ViewName, af as IndexRowOf } from './infer-CEfvP0_I.js';
1
+ import { C as CLIENT_EVENTS, a9 as ServerToClientEvents, E as ClientToServerEvents, B as ChangedFrame, n as ProtocolMismatch, k as HelloFrame, A as AuthenticationRefused, a5 as Revision } from './envelope-CoiZY9KU.js';
2
+ import { k as MethodKind, G as AnyContract, av as StreamName, ai as IsScopedStream, au as StreamItemOf, a6 as ChannelName, a5 as ChannelInputOf, ac as EventName, ad as EventPayloadOf, al as MethodName, am as MethodOf, an as OutputOf, ah as InputOf, aa as ContractMap, ak as KindOf, ab as EntityOf, a8 as CollectionName, aj as ItemOf, as as ScopeOf, aw as ViewName, ag as IndexRowOf } from './infer-Cwq49ME5.js';
3
3
  import { ManagerOptions, SocketOptions, Socket } from 'socket.io-client';
4
4
  import { QueryClient, UseMutationOptions, UseQueryOptions, UseQueryResult, UseMutationResult, QueryKey } from '@tanstack/react-query';
5
5
  import { Q as QuickdrawError } from './errors-S-bxEIBC.js';
@@ -1,12 +1,12 @@
1
1
  import { IncomingMessage, ServerResponse, Server as Server$1 } from 'node:http';
2
- import { a as DispatcherOptions, H as HttpRouter, b as HttpTransportOptions, P as PrincipalOfServices, D as Dispatcher } from './http-DC1RmIgu.js';
3
- import { P as Principal } from './types-CIq6xwng.js';
4
- import { p as AppRooms, q as StreamSubscriptions, A as AnyService } from './caller-JNTbbD37.js';
2
+ import { a as DispatcherOptions, H as HttpRouter, b as HttpTransportOptions, P as PrincipalOfServices, D as Dispatcher } from './http-89lENH2D.js';
3
+ import { P as Principal } from './types-BDmssndG.js';
4
+ import { p as AppRooms, q as StreamSubscriptions, A as AnyService } from './caller-Cx5wuao-.js';
5
5
  import { Server, DefaultEventsMap, Socket, ServerOptions as ServerOptions$1 } from 'socket.io';
6
- import { S as ServerAuth, a as ServiceGrants } from './auth-5yi_rUSM.js';
6
+ import { S as ServerAuth, a as ServiceGrants } from './auth-DyCIKmTQ.js';
7
7
  import { L as Logger } from './logger-BY28acW-.js';
8
- import { g as PROTOCOL_VERSION } from './envelope-CR2A9lrd.js';
9
- import { A as AccessLevel } from './infer-CEfvP0_I.js';
8
+ import { g as PROTOCOL_VERSION } from './envelope-CoiZY9KU.js';
9
+ import { A as AccessLevel } from './infer-Cwq49ME5.js';
10
10
 
11
11
  /** One live collection subscription, as `socket.data.collections[room]` records it. */
12
12
  interface ScopeSubscription {
@@ -1,8 +1,8 @@
1
- import { f as ServerEventName, a9 as ServerToClientEvents, k as HelloFrame } from './envelope-CR2A9lrd.js';
2
- import { A as AnyService, i as Caller } from './caller-JNTbbD37.js';
3
- import { S as ServerOptions, Q as QuickdrawServer } from './createServer-301BCb6c.js';
4
- import { P as PrincipalOfServices, C as ContractOfServices } from './http-DC1RmIgu.js';
5
- import { C as CallRecord } from './metrics-B1dXpOQc.js';
1
+ import { f as ServerEventName, a9 as ServerToClientEvents, k as HelloFrame } from './envelope-CoiZY9KU.js';
2
+ import { A as AnyService, i as Caller } from './caller-Cx5wuao-.js';
3
+ import { S as ServerOptions, Q as QuickdrawServer } from './createServer-P61KBWro.js';
4
+ import { P as PrincipalOfServices, C as ContractOfServices } from './http-89lENH2D.js';
5
+ import { C as CallRecord } from './metrics-Ny1dFbyY.js';
6
6
  import { Socket } from 'socket.io-client';
7
7
 
8
8
  /** The payload of a v5 server event, by its name. */
@@ -1,4 +1,4 @@
1
- import { A as AccessLevel } from './infer-CEfvP0_I.js';
1
+ import { A as AccessLevel } from './infer-Cwq49ME5.js';
2
2
  import { W as WireError } from './errors-S-bxEIBC.js';
3
3
 
4
4
  /**
@@ -1,12 +1,12 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import { L as Logger } from './logger-BY28acW-.js';
3
- import { G as AnyContract, A as AccessLevel } from './infer-CEfvP0_I.js';
4
- import { P as Principal, T as Transport, a as McpContext, D as DbOf, c as PrincipalOf, M as MaybePromise } from './types-CIq6xwng.js';
5
- import { A as AnyService, j as ServiceMethod, R as RowLevels, k as AccessFilter, i as Caller, l as RunContext, P as Presence, m as StreamHandle, n as AnyContext, S as StorageAdapter, U as UnitOfWorkFactory, d as FlushSink, o as AccessEngine } from './caller-JNTbbD37.js';
6
- import { ad as Version, x as CallReply } from './envelope-CR2A9lrd.js';
3
+ import { G as AnyContract, A as AccessLevel } from './infer-Cwq49ME5.js';
4
+ import { P as Principal, T as Transport, a as McpContext, D as DbOf, c as PrincipalOf, M as MaybePromise } from './types-BDmssndG.js';
5
+ import { A as AnyService, j as ServiceMethod, R as RowLevels, k as AccessFilter, i as Caller, l as RunContext, P as Presence, m as StreamHandle, n as AnyContext, S as StorageAdapter, U as UnitOfWorkFactory, d as FlushSink, o as AccessEngine } from './caller-Cx5wuao-.js';
6
+ import { ad as Version, x as CallReply } from './envelope-CoiZY9KU.js';
7
7
  import { Q as QuickdrawError } from './errors-S-bxEIBC.js';
8
- import { C as CallRecord } from './metrics-B1dXpOQc.js';
9
- import { S as ServerAuth } from './auth-5yi_rUSM.js';
8
+ import { C as CallRecord } from './metrics-Ny1dFbyY.js';
9
+ import { S as ServerAuth } from './auth-DyCIKmTQ.js';
10
10
 
11
11
  /** How one call ended. The dispatcher's `call` resolves with it and never rejects. */
12
12
  type DispatchResult = {
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { a as ACE, b as ACL, A as AccessLevel, G as AnyContract, U as CHANNEL_DEFAULT_RATE, _ as ChannelDef, a5 as ChannelInputOf, a6 as ChannelName, a7 as ChannelPayloadOf, $ as ChannelRequires, C as CollectionDef, a8 as CollectionName, a9 as CollectionOf, w as CollectionWhere, H as Contract, J as ContractDefinition, aa as ContractMap, D as DEFAULT_COLLECTION_LIMIT, s as DEFAULT_COLLECTION_MAX_LIMIT, ab as EntityOf, E as EntityProjection, a0 as EventDef, ac as EventName, ad as EventPayloadOf, X as GLOBAL_STREAM, ae as IndexFieldOf, K as IndexRow, af as IndexRowOf, I as InferInput, c as InferOutput, ag as InputOf, ah as IsScopedStream, ai as ItemOf, aj as KindOf, M as MethodDef, k as MethodKind, ak as MethodName, al as MethodOf, o as MethodOutput, p as MutationDef, N as NullableProjection, O as OrderBy, am as OutputOf, an as ParsedInputOf, a1 as PayloadSelector, P as ProjectionList, ao as ProjectionName, ap as ProjectionOf, r as ProjectionRef, Q as QueryDef, R as ReservedMethodName, a2 as RoomSelector, L as RowSchema, Y as STREAM_MAX_SEED, aq as ScopeOf, ar as ServiceNameOf, x as SortDirection, S as StandardJSONSchemaV1, d as StandardSchemaV1, e as StandardSchemaWithJSON, f as StandardTypedV1, a3 as StreamAccess, a4 as StreamDef, as as StreamItemOf, at as StreamName, T as TODO_SCHEMA_VENDOR, g as TodoSchemaOptions, V as ValidationIssue, j as ValidationResult, y as ViaScope, au as ViewName, B as ViewPredicate, z as Viewer, W as Watch, F as defineContract, h as hasJsonSchema, Z as isScopedStream, i as isStandardSchema, l as listOf, m as mutation, n as nullable, q as query, t as todoSchema, v as validate, u as via } from './infer-CEfvP0_I.js';
1
+ export { a as ACE, b as ACL, A as AccessLevel, G as AnyContract, U as CHANNEL_DEFAULT_RATE, _ as ChannelDef, a5 as ChannelInputOf, a6 as ChannelName, a7 as ChannelPayloadOf, $ as ChannelRequires, C as CollectionDef, a8 as CollectionName, a9 as CollectionOf, w as CollectionWhere, H as Contract, J as ContractDefinition, aa as ContractMap, D as DEFAULT_COLLECTION_LIMIT, s as DEFAULT_COLLECTION_MAX_LIMIT, ab as EntityOf, E as EntityProjection, a0 as EventDef, ac as EventName, ad as EventPayloadOf, ae as FullProjectionOf, X as GLOBAL_STREAM, af as IndexFieldOf, K as IndexRow, ag as IndexRowOf, I as InferInput, c as InferOutput, ah as InputOf, ai as IsScopedStream, aj as ItemOf, ak as KindOf, M as MethodDef, k as MethodKind, al as MethodName, am as MethodOf, o as MethodOutput, p as MutationDef, N as NullableProjection, O as OrderBy, an as OutputOf, ao as ParsedInputOf, a1 as PayloadSelector, P as ProjectionList, ap as ProjectionName, aq as ProjectionOf, r as ProjectionRef, Q as QueryDef, ar as ReceivedRow, R as ReservedMethodName, a2 as RoomSelector, L as RowSchema, Y as STREAM_MAX_SEED, as as ScopeOf, at as ServiceNameOf, x as SortDirection, S as StandardJSONSchemaV1, d as StandardSchemaV1, e as StandardSchemaWithJSON, f as StandardTypedV1, a3 as StreamAccess, a4 as StreamDef, au as StreamItemOf, av as StreamName, T as TODO_SCHEMA_VENDOR, g as TodoSchemaOptions, V as ValidationIssue, j as ValidationResult, y as ViaScope, aw as ViewName, B as ViewPredicate, z as Viewer, W as Watch, F as defineContract, h as hasJsonSchema, Z as isScopedStream, i as isStandardSchema, l as listOf, m as mutation, n as nullable, q as query, t as todoSchema, v as validate, u as via } from './infer-Cwq49ME5.js';
2
2
  export { L as Logger, c as consoleLogger } from './logger-BY28acW-.js';
3
- export { a1 as ADMIN_DEFAULT_PAGE_SIZE, Y as ADMIN_FIELD_TYPES, a2 as ADMIN_MAX_PAGE, a3 as ADMIN_MAX_PAGE_SIZE, A as ADMIN_METHODS, Z as ADMIN_NEVER_WRITABLE, E as AdminContractOptions, G as AdminCreateDef, a4 as AdminCreateInput, a5 as AdminCreateQuery, a6 as AdminData, H as AdminDeleteDef, _ as AdminFieldConfig, $ as AdminFieldType, J as AdminGetDef, K as AdminListDef, a7 as AdminListInput, a8 as AdminListQuery, M as AdminMetaDef, a9 as AdminMetaInput, O as AdminMethodName, P as AdminMethods, Q as AdminMethodsOf, aa as AdminNeverWritable, ab as AdminPage, T as AdminReemitDef, a0 as AdminServiceMeta, ac as AdminSubscribers, U as AdminSubscribersDef, V as AdminTag, X as AdminUpdateDef, ad as AdminUpdateInput, ae as AdminUpdateQuery, B as BulkPatch, t as BulkResult, s as CRUD_MAX_IDS, C as CRUD_METHODS, a as CrudBulkDelete, b as CrudBulkUpdate, d as CrudContractOptions, e as CrudCreate, f as CrudDelete, g as CrudGet, h as CrudGetMany, i as CrudInputOptions, j as CrudList, k as CrudListOptions, l as CrudMethodName, m as CrudMethods, n as CrudReorder, o as CrudReorderOptions, p as CrudTag, q as CrudToggle, r as CrudUpdate, F as FilterValue, I as IdInput, u as IdsInput, ag as KitSchema, v as LIST_DEFAULT_LIMIT, w as LIST_MAX_LIMIT, L as ListInput, x as ListPage, y as ListQuery, z as ListSort, N as NumberFieldOf, R as ReorderInput, S as ScalarFieldOf, af as SubscriberLevel, W as WithId, D as admin, c as crud } from './admin-DufEkep0.js';
4
- export { A as AclMethodName, I as InviteByNameInput, z as InviteByNameQuery, B as InviteInput, C as InviteQuery, L as LeaveInput, D as ListMembersInput, E as ListMembersQuery, F as Member, G as MemberInput, M as MembersMethodName, H as MembersPage, y as SHARE_LEVELS, d as SHARING_METHODS, S as SearchContractOptions, a as SearchDef, b as SearchMethods, c as SearchTag, J as SetRoleInput, K as ShareByNameInput, N as ShareByNameQuery, O as ShareInput, P as ShareLevel, f as SharingByNameMethod, g as SharingContractOptions, h as SharingDefOf, i as SharingInvite, j as SharingInviteByName, k as SharingLeave, l as SharingListMembers, m as SharingListShares, n as SharingMethodName, o as SharingMethods, p as SharingMode, q as SharingRemove, r as SharingSetLevel, t as SharingSetRole, u as SharingShare, v as SharingShareByName, w as SharingTag, x as SharingUnshare, T as TextFieldOf, U as UnshareInput, Q as UserLookupInput, s as search, e as sharing } from './sharing-B5-5Q_wT.js';
3
+ export { a1 as ADMIN_DEFAULT_PAGE_SIZE, Y as ADMIN_FIELD_TYPES, a2 as ADMIN_MAX_PAGE, a3 as ADMIN_MAX_PAGE_SIZE, A as ADMIN_METHODS, Z as ADMIN_NEVER_WRITABLE, E as AdminContractOptions, G as AdminCreateDef, a4 as AdminCreateInput, a5 as AdminCreateQuery, a6 as AdminData, H as AdminDeleteDef, _ as AdminFieldConfig, $ as AdminFieldType, J as AdminGetDef, K as AdminListDef, a7 as AdminListInput, a8 as AdminListQuery, M as AdminMetaDef, a9 as AdminMetaInput, O as AdminMethodName, P as AdminMethods, Q as AdminMethodsOf, aa as AdminNeverWritable, ab as AdminPage, T as AdminReemitDef, a0 as AdminServiceMeta, ac as AdminSubscribers, U as AdminSubscribersDef, V as AdminTag, X as AdminUpdateDef, ad as AdminUpdateInput, ae as AdminUpdateQuery, B as BulkPatch, t as BulkResult, s as CRUD_MAX_IDS, C as CRUD_METHODS, a as CrudBulkDelete, b as CrudBulkUpdate, d as CrudContractOptions, e as CrudCreate, f as CrudDelete, g as CrudGet, h as CrudGetMany, i as CrudInputOptions, j as CrudList, k as CrudListOptions, l as CrudMethodName, m as CrudMethods, n as CrudReorder, o as CrudReorderOptions, p as CrudTag, q as CrudToggle, r as CrudUpdate, F as FilterValue, I as IdInput, u as IdsInput, ag as KitSchema, v as LIST_DEFAULT_LIMIT, w as LIST_MAX_LIMIT, L as ListInput, x as ListPage, y as ListQuery, z as ListSort, N as NumberFieldOf, R as ReorderInput, S as ScalarFieldOf, af as SubscriberLevel, W as WithId, D as admin, c as crud } from './admin-Bl71J4IG.js';
4
+ export { A as AclMethodName, I as InviteByNameInput, z as InviteByNameQuery, B as InviteInput, C as InviteQuery, L as LeaveInput, D as ListMembersInput, E as ListMembersQuery, F as Member, G as MemberInput, M as MembersMethodName, H as MembersPage, y as SHARE_LEVELS, d as SHARING_METHODS, S as SearchContractOptions, a as SearchDef, b as SearchMethods, c as SearchTag, J as SetRoleInput, K as ShareByNameInput, N as ShareByNameQuery, O as ShareInput, P as ShareLevel, f as SharingByNameMethod, g as SharingContractOptions, h as SharingDefOf, i as SharingInvite, j as SharingInviteByName, k as SharingLeave, l as SharingListMembers, m as SharingListShares, n as SharingMethodName, o as SharingMethods, p as SharingMode, q as SharingRemove, r as SharingSetLevel, t as SharingSetRole, u as SharingShare, v as SharingShareByName, w as SharingTag, x as SharingUnshare, T as TextFieldOf, U as UnshareInput, Q as UserLookupInput, s as search, e as sharing } from './sharing-BHyufgVl.js';
5
5
  export { S as SEARCH_DEFAULT_LIMIT, a as SEARCH_DEFAULT_MIN_LENGTH, b as SEARCH_MAX_LIMIT, c as SEARCH_MAX_QUERY_LENGTH, d as SearchInput, e as SearchPage, f as SearchQuery } from './searchSchemas-CBgKRa1b.js';
6
- export { q as AccessFrame, A as AuthenticationRefused, C as CLIENT_EVENTS, r as CallEnvelope, v as CallId, w as CallNotModified, x as CallReply, y as CallSuccess, z as CancelFrame, B as ChangedFrame, D as ChannelFrame, d as ClientEventName, E as ClientToServerEvents, F as CollectionDelta, G as CollectionFrame, I as CollectionItemsReply, J as CollectionItemsRequest, K as CollectionResumed, L as CollectionScopeRef, M as CollectionSnapshot, N as CollectionSubscribe, O as CollectionSubscribeReply, T as EntityFrame, U as EntityNotModified, V as EntityPatch, W as EntityRemove, X as EntityResult, Y as EntityRow, Z as EntitySubscribe, _ as EntitySubscribeReply, $ as EntityUnsubscribe, a0 as EntityUpdate, a1 as EventFrame, a2 as Failure, H as HandshakeAuth, k as HelloFrame, l as HelloLimits, m as HelloSubscriptionLimits, a3 as Ok, P as PROTOCOL_MISMATCH, g as PROTOCOL_VERSION, a4 as PresenceFrame, n as ProtocolMismatch, Q as QdHandshake, R as RESERVED_ROOM_PREFIXES, a5 as Revision, a7 as RevokeReason, a6 as RevokedFrame, a8 as RotateFrame, S as SERVER_EVENTS, a as SERVICE_TOPIC, f as ServerEventName, a9 as ServerToClientEvents, aa as StreamFrame, ab as StreamSubscribe, ac as StreamSubscribeReply, ad as Version, ae as WatchFrame, af as WireIndexRow, c as collectionRoom, b as collectionTopic, e as entityRoom, i as isAuthenticationRefused, o as isCallEnvelope, p as isCancel, h as isProtocolMismatch, j as isQdHandshake, s as streamRoom, t as topicRoom, u as userRoom } from './envelope-CR2A9lrd.js';
6
+ export { q as AccessFrame, A as AuthenticationRefused, C as CLIENT_EVENTS, r as CallEnvelope, v as CallId, w as CallNotModified, x as CallReply, y as CallSuccess, z as CancelFrame, B as ChangedFrame, D as ChannelFrame, d as ClientEventName, E as ClientToServerEvents, F as CollectionDelta, G as CollectionFrame, I as CollectionItemsReply, J as CollectionItemsRequest, K as CollectionResumed, L as CollectionScopeRef, M as CollectionSnapshot, N as CollectionSubscribe, O as CollectionSubscribeReply, T as EntityFrame, U as EntityNotModified, V as EntityPatch, W as EntityRemove, X as EntityResult, Y as EntityRow, Z as EntitySubscribe, _ as EntitySubscribeReply, $ as EntityUnsubscribe, a0 as EntityUpdate, a1 as EventFrame, a2 as Failure, H as HandshakeAuth, k as HelloFrame, l as HelloLimits, m as HelloSubscriptionLimits, a3 as Ok, P as PROTOCOL_MISMATCH, g as PROTOCOL_VERSION, a4 as PresenceFrame, n as ProtocolMismatch, Q as QdHandshake, R as RESERVED_ROOM_PREFIXES, a5 as Revision, a7 as RevokeReason, a6 as RevokedFrame, a8 as RotateFrame, S as SERVER_EVENTS, a as SERVICE_TOPIC, f as ServerEventName, a9 as ServerToClientEvents, aa as StreamFrame, ab as StreamSubscribe, ac as StreamSubscribeReply, ad as Version, ae as WatchFrame, af as WireIndexRow, c as collectionRoom, b as collectionTopic, e as entityRoom, i as isAuthenticationRefused, o as isCallEnvelope, p as isCancel, h as isProtocolMismatch, j as isQdHandshake, s as streamRoom, t as topicRoom, u as userRoom } from './envelope-CoiZY9KU.js';
7
7
  export { E as ERROR_CODES, a as ErrorCode, Q as QuickdrawError, R as RateLimitedErrorData, V as ValidationErrorData, W as WireError, b as WireIssue, f as fromWire, h as httpStatus, i as isErrorCode, t as toWire } from './errors-S-bxEIBC.js';
8
8
 
9
9
  /** The published version of `@fitzzero/quickdraw-core`. Kept in step with package.json. */
10
- declare const QUICKDRAW_VERSION = "5.0.0-rc.1";
10
+ declare const QUICKDRAW_VERSION = "5.0.0-rc.2";
11
11
 
12
12
  export { QUICKDRAW_VERSION };
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  streamRoom,
51
51
  topicRoom,
52
52
  userRoom
53
- } from "./chunk-4QNDKNDK.js";
53
+ } from "./chunk-SSDLYYQV.js";
54
54
  import {
55
55
  CHANNEL_DEFAULT_RATE,
56
56
  DEFAULT_COLLECTION_LIMIT,
@@ -742,12 +742,42 @@ type ContractMap = {
742
742
  };
743
743
  /** The service name of a contract. */
744
744
  type ServiceNameOf<C extends AnyContract> = C["name"];
745
- /** The full entity row of a contract, or `never` for a contract without an entity. */
746
- type EntityOf<C extends AnyContract> = C["entity"] extends StandardSchemaV1 ? InferOutput<C["entity"]> : never;
747
745
  /** `"entity"` (when the contract has one) plus the names of its projections. */
748
746
  type ProjectionName<C extends AnyContract> = (C["entity"] extends StandardSchemaV1 ? "entity" : never) | (keyof C["projections"] & string);
749
- /** The row type of a projection; `"entity"` is the full entity. */
750
- type ProjectionOf<C extends AnyContract, P extends ProjectionName<C>> = P extends "entity" ? EntityOf<C> : P extends keyof C["projections"] ? InferOutput<C["projections"][P]> : never;
747
+ /**
748
+ * The full row of a projection, every key present: its schema's output
749
+ * (`"entity"` is the entity's). The server builds this row and strips each
750
+ * reader's tiers from it; a handler returns it (`HandlerOutputOf`).
751
+ */
752
+ type FullProjectionOf<C extends AnyContract, P extends ProjectionName<C>> = P extends "entity" ? C["entity"] extends StandardSchemaV1 ? InferOutput<C["entity"]> : never : P extends keyof C["projections"] ? InferOutput<C["projections"][P]> : never;
753
+ /** `T` with its properties listed in one object type, for readable hovers and errors. */
754
+ type Flatten<T> = {
755
+ [K in keyof T]: T[K];
756
+ };
757
+ /** `Row` with the keys in `Tiered` optional; any other key, and a row with none of them, unchanged. */
758
+ type OptionalKeys<Row, Tiered extends PropertyKey> = Row extends object ? [Extract<keyof Row, Tiered>] extends [never] ? Row : Flatten<{
759
+ [K in keyof Row as K extends Tiered ? never : K]: Row[K];
760
+ } & {
761
+ [K in keyof Row as K extends Tiered ? K : never]?: Row[K];
762
+ }> : Row;
763
+ /**
764
+ * `Row`, a row of contract `C`, as a reader receives it: each key the
765
+ * contract's `fields` map tiers is optional, since a reader below its level
766
+ * receives the row without it.
767
+ */
768
+ type ReceivedRow<C extends AnyContract, Row> = OptionalKeys<Row, keyof C["fields"]>;
769
+ /**
770
+ * The entity row of a contract as a reader receives it (`useEntity`,
771
+ * `"entity"` outputs): a field the contract's `fields` map tiers is
772
+ * optional. `never` for a contract without an entity.
773
+ */
774
+ type EntityOf<C extends AnyContract> = C["entity"] extends StandardSchemaV1 ? ReceivedRow<C, InferOutput<C["entity"]>> : never;
775
+ /**
776
+ * The row type of a projection as a reader receives it; `"entity"` is the
777
+ * entity. A field the contract's `fields` map tiers is optional
778
+ * (`FullProjectionOf` has it).
779
+ */
780
+ type ProjectionOf<C extends AnyContract, P extends ProjectionName<C>> = ReceivedRow<C, FullProjectionOf<C, P>>;
751
781
  /** The names of a contract's methods. */
752
782
  type MethodName<C extends AnyContract> = keyof C["methods"] & string;
753
783
  /** One method's declaration: `kind`, `input`, `output` and `watch`. */
@@ -765,7 +795,10 @@ type OutputOf<C extends AnyContract, M extends MethodName<C>> = ResolveOutput<C,
765
795
  type CollectionName<C extends AnyContract> = keyof C["collections"] & string;
766
796
  /** One collection's declaration. */
767
797
  type CollectionOf<C extends AnyContract, K extends CollectionName<C>> = C["collections"][K];
768
- /** The item type of a collection: the row of the projection it declares as `item`. */
798
+ /**
799
+ * The item type of a collection: the row of the projection it declares as
800
+ * `item`, as a reader receives it (a tiered field is optional).
801
+ */
769
802
  type ItemOf<C extends AnyContract, K extends CollectionName<C>> = CollectionOf<C, K>["item"] extends ProjectionName<C> ? ProjectionOf<C, CollectionOf<C, K>["item"]> : never;
770
803
  /**
771
804
  * The value that identifies one scope of a collection: the type of its scope
@@ -774,8 +807,13 @@ type ItemOf<C extends AnyContract, K extends CollectionName<C>> = CollectionOf<C
774
807
  type ScopeOf<C extends AnyContract, K extends CollectionName<C>> = CollectionOf<C, K>["scope"] extends keyof EntityOf<C> ? NonNullable<EntityOf<C>[CollectionOf<C, K>["scope"]]> : string;
775
808
  /** The index fields of a collection, or `never` when it declares no index. */
776
809
  type IndexFieldOf<C extends AnyContract, K extends CollectionName<C>> = CollectionOf<C, K>["index"] extends readonly (infer Field extends string)[] ? Field : never;
777
- /** One index row of a collection: `id` plus its index fields. What a view predicate reads. */
778
- type IndexRowOf<C extends AnyContract, K extends CollectionName<C>> = IndexRow<ItemOf<C, K>, IndexFieldOf<C, K>>;
810
+ /**
811
+ * One index row of a collection: `id` plus its index fields. What a view
812
+ * predicate reads. Every subscriber receives every index field (a collection
813
+ * refuses one its `fields` tier hides at the collection's access), so a
814
+ * tiered index field is not optional here.
815
+ */
816
+ type IndexRowOf<C extends AnyContract, K extends CollectionName<C>> = IndexRow<CollectionOf<C, K>["item"] extends ProjectionName<C> ? FullProjectionOf<C, CollectionOf<C, K>["item"]> : never, IndexFieldOf<C, K>>;
779
817
  /** The names of a collection's views. */
780
818
  type ViewName<C extends AnyContract, K extends CollectionName<C>> = keyof NonNullable<CollectionOf<C, K>["views"]> & string;
781
819
  /** The names of a contract's streams. */
@@ -800,4 +838,4 @@ type ChannelInputOf<C extends AnyContract, K extends ChannelName<C>> = InferInpu
800
838
  /** The payload type of a custom event: what `ctx.rooms.emit` takes and `useEvent` receives. */
801
839
  type EventPayloadOf<C extends AnyContract, K extends EventName<C>> = InferOutput<C["events"][K]["payload"]>;
802
840
 
803
- export { type ChannelRequires as $, type AccessLevel as A, type ViewPredicate as B, type CollectionDef as C, DEFAULT_COLLECTION_LIMIT as D, type EntityProjection as E, defineContract as F, type AnyContract as G, type Contract as H, type InferInput as I, type ContractDefinition as J, type IndexRow as K, type RowSchema as L, type MethodDef as M, type NullableProjection as N, type OrderBy as O, type ProjectionList as P, type QueryDef as Q, type ReservedMethodName as R, StandardJSONSchemaV1 as S, TODO_SCHEMA_VENDOR as T, CHANNEL_DEFAULT_RATE as U, type ValidationIssue as V, type Watch as W, GLOBAL_STREAM as X, STREAM_MAX_SEED as Y, isScopedStream as Z, type ChannelDef as _, type ACE as a, type EventDef as a0, type PayloadSelector as a1, type RoomSelector as a2, type StreamAccess as a3, type StreamDef as a4, type ChannelInputOf as a5, type ChannelName as a6, type ChannelPayloadOf as a7, type CollectionName as a8, type CollectionOf as a9, type ContractMap as aa, type EntityOf as ab, type EventName as ac, type EventPayloadOf as ad, type IndexFieldOf as ae, type IndexRowOf as af, type InputOf as ag, type IsScopedStream as ah, type ItemOf as ai, type KindOf as aj, type MethodName as ak, type MethodOf as al, type OutputOf as am, type ParsedInputOf as an, type ProjectionName as ao, type ProjectionOf as ap, type ScopeOf as aq, type ServiceNameOf as ar, type StreamItemOf as as, type StreamName as at, type ViewName as au, type ACL as b, type InferOutput as c, StandardSchemaV1 as d, type StandardSchemaWithJSON as e, StandardTypedV1 as f, type TodoSchemaOptions as g, hasJsonSchema as h, isStandardSchema as i, type ValidationResult as j, type MethodKind as k, listOf as l, mutation as m, nullable as n, type MethodOutput as o, type MutationDef as p, query as q, type ProjectionRef as r, DEFAULT_COLLECTION_MAX_LIMIT as s, todoSchema as t, via as u, validate as v, type CollectionWhere as w, type SortDirection as x, type ViaScope as y, type Viewer as z };
841
+ export { type ChannelRequires as $, type AccessLevel as A, type ViewPredicate as B, type CollectionDef as C, DEFAULT_COLLECTION_LIMIT as D, type EntityProjection as E, defineContract as F, type AnyContract as G, type Contract as H, type InferInput as I, type ContractDefinition as J, type IndexRow as K, type RowSchema as L, type MethodDef as M, type NullableProjection as N, type OrderBy as O, type ProjectionList as P, type QueryDef as Q, type ReservedMethodName as R, StandardJSONSchemaV1 as S, TODO_SCHEMA_VENDOR as T, CHANNEL_DEFAULT_RATE as U, type ValidationIssue as V, type Watch as W, GLOBAL_STREAM as X, STREAM_MAX_SEED as Y, isScopedStream as Z, type ChannelDef as _, type ACE as a, type EventDef as a0, type PayloadSelector as a1, type RoomSelector as a2, type StreamAccess as a3, type StreamDef as a4, type ChannelInputOf as a5, type ChannelName as a6, type ChannelPayloadOf as a7, type CollectionName as a8, type CollectionOf as a9, type ContractMap as aa, type EntityOf as ab, type EventName as ac, type EventPayloadOf as ad, type FullProjectionOf as ae, type IndexFieldOf as af, type IndexRowOf as ag, type InputOf as ah, type IsScopedStream as ai, type ItemOf as aj, type KindOf as ak, type MethodName as al, type MethodOf as am, type OutputOf as an, type ParsedInputOf as ao, type ProjectionName as ap, type ProjectionOf as aq, type ReceivedRow as ar, type ScopeOf as as, type ServiceNameOf as at, type StreamItemOf as au, type StreamName as av, type ViewName as aw, type ACL as b, type InferOutput as c, StandardSchemaV1 as d, type StandardSchemaWithJSON as e, StandardTypedV1 as f, type TodoSchemaOptions as g, hasJsonSchema as h, isStandardSchema as i, type ValidationResult as j, type MethodKind as k, listOf as l, mutation as m, nullable as n, type MethodOutput as o, type MutationDef as p, query as q, type ProjectionRef as r, DEFAULT_COLLECTION_MAX_LIMIT as s, todoSchema as t, via as u, validate as v, type CollectionWhere as w, type SortDirection as x, type ViaScope as y, type Viewer as z };
@@ -1,6 +1,6 @@
1
- import { k as MethodKind } from './infer-CEfvP0_I.js';
1
+ import { k as MethodKind } from './infer-Cwq49ME5.js';
2
2
  import { a as ErrorCode } from './errors-S-bxEIBC.js';
3
- import { T as Transport } from './types-CIq6xwng.js';
3
+ import { T as Transport } from './types-BDmssndG.js';
4
4
 
5
5
  /** How a call ended: `"ok"`, `"not-modified"`, or the error code it failed with. */
6
6
  type CallOutcome = "ok" | "not-modified" | ErrorCode;
@@ -1,9 +1,9 @@
1
1
  import { L as Logger } from '../logger-BY28acW-.js';
2
- export { C as CountArgs, F as FindManyArgs, c as StatementCount, S as StorageAdapter, a as StorageRow, b as StorageWhere, s as storageOf } from '../caller-JNTbbD37.js';
3
- import '../envelope-CR2A9lrd.js';
4
- import '../infer-CEfvP0_I.js';
2
+ export { C as CountArgs, F as FindManyArgs, c as StatementCount, S as StorageAdapter, a as StorageRow, b as StorageWhere, s as storageOf } from '../caller-Cx5wuao-.js';
3
+ import '../envelope-CoiZY9KU.js';
4
+ import '../infer-Cwq49ME5.js';
5
5
  import '../errors-S-bxEIBC.js';
6
- import '../types-CIq6xwng.js';
6
+ import '../types-BDmssndG.js';
7
7
 
8
8
  /** Options of {@link trackPrisma}. */
9
9
  interface TrackPrismaOptions {
@@ -1,8 +1,8 @@
1
1
  import { L as Logger } from '../../logger-BY28acW-.js';
2
2
  import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
3
- import { M as MaybePromise, P as Principal } from '../../types-CIq6xwng.js';
4
- import { b as AuthenticateRequest } from '../../auth-5yi_rUSM.js';
5
- import '../../infer-CEfvP0_I.js';
3
+ import { M as MaybePromise, P as Principal } from '../../types-BDmssndG.js';
4
+ import { b as AuthenticateRequest } from '../../auth-DyCIKmTQ.js';
5
+ import '../../infer-Cwq49ME5.js';
6
6
  import 'socket.io';
7
7
 
8
8
  /**
@@ -1,17 +1,17 @@
1
- import { G as AnyContract, ao as ProjectionName, ap as ProjectionOf, a8 as CollectionName, ak as MethodName, d as StandardSchemaV1, c as InferOutput, N as NullableProjection, P as ProjectionList, al as MethodOf, an as ParsedInputOf, aj as KindOf, A as AccessLevel, ab as EntityOf } from '../infer-CEfvP0_I.js';
2
- import { M as ModelName, r as PolicyFor, t as RowForms, u as AccessFor, H as HandlerContext, v as ModelColumn, w as WatchAccess, x as PublicAccess, y as HandlerArgs, z as CustomAccess, B as ShareMode, E as ChannelOptions, G as ChannelsRequired, f as Service, I as BaseContext, J as CallerFor, l as RunContext, m as StreamHandle, P as Presence, K as AccessPolicy, L as AnyAccessPolicy, N as PolicyColumns, O as PolicyForeign, Q as PolicyTools, k as AccessFilter, T as RowAccess, o as AccessEngine, b as StorageWhere } from '../caller-JNTbbD37.js';
3
- export { av as ANY_FIELD, an as AccessForm, ao as AccessRequest, V as AffectsLink, n as AnyContext, A as AnyService, p as AppRooms, ap as AuthenticatedAccess, ad as CallOptions, i as Caller, a5 as ChannelAccess, a6 as ChannelContext, a7 as ChannelHandler, a8 as ChannelImplementation, a0 as CollectionScope, a2 as ContextRooms, a3 as ContextServices, C as CountArgs, $ as DEFAULT_BULK_THRESHOLD, g as DevWarning, D as DevWarningError, h as DevWarningKind, aq as EntryAccess, F as FindManyArgs, e as FlushInfo, d as FlushSink, ag as ForeignColumns, ah as ForeignColumnsOf, ar as IdKeyOf, as as IdSelector, ai as MembershipRead, ae as MethodCaller, az as N_PLUS_ONE_STATEMENTS, aj as ParentLink, ak as PolicyKind, al as PolicyReads, X as ProjectedOutput, Y as Projection, am as RowLevel, R as RowLevels, at as ScopeAccess, au as ServiceAccess, af as ServiceCaller, a9 as ServiceChannel, a1 as ServiceCollection, j as ServiceMethod, aa as ServiceStream, c as StatementCount, S as StorageAdapter, a as StorageRow, ab as StreamPushArgs, ac as StreamPushManyArgs, q as StreamSubscriptions, Z as TierGroup, _ as Tiers, a4 as TouchOptions, aw as UnitOfWork, U as UnitOfWorkFactory, ax as UnitOfWorkScope, W as WriteRecord, ay as formatDevWarning, s as storageOf } from '../caller-JNTbbD37.js';
4
- import { S as ServerOptions, Q as QuickdrawServer } from '../createServer-301BCb6c.js';
5
- export { C as ClusterClient, t as ClusterOptions, D as DEFAULT_STALL_INTERVAL_MS, e as DEFAULT_STALL_MAX_MS, f as DEFAULT_STALL_THRESHOLD_MS, p as DisconnectUserOptions, E as EntitySubscription, a as EntitySubscriptions, H as HttpApp, I as IoRedisLike, M as MIN_STALL_INTERVAL_MS, m as QuickdrawIo, n as QuickdrawServerSocket, o as QuickdrawSocketData, x as RateLimitOptions, y as RateLimiter, R as RotateOptions, g as STALL_RESOLUTION_MS, b as ScopeSubscription, c as ScopeSubscriptions, l as ServerOnlyOptions, h as SlowMethod, q as SocketCors, r as SocketOptions, s as SocketRateLimitOptions, i as StallReport, j as StallWatchdogOptions, T as TopicWatch, d as TopicWatches, v as applyRateLimitMiddleware, u as createRateLimiter, k as createServer, w as createTieredRateLimiter } from '../createServer-301BCb6c.js';
6
- import { ad as Version } from '../envelope-CR2A9lrd.js';
7
- import { Q as QuickdrawTypes, D as DbOf, c as PrincipalOf, M as MaybePromise, b as McpContextOf, C as ContextExtensionOf, P as Principal } from '../types-CIq6xwng.js';
8
- export { a as McpContext, T as Transport } from '../types-CIq6xwng.js';
9
- import { a as DispatcherOptions, D as Dispatcher, c as DispatcherCollections } from '../http-DC1RmIgu.js';
10
- export { o as AccessChange, p as AccessChangeListener, A as AccessOptions, d as ChangeLogOptions, C as ContractOfServices, j as DEFAULT_LIMITS, f as DbOfServices, h as DispatchRequest, i as DispatchResult, n as DispatcherAccess, k as DispatcherLimits, s as HttpMiddleware, H as HttpRouter, u as HttpRouterOptions, b as HttpTransportOptions, L as LimitsOptions, l as PipelineOptions, P as PrincipalOfServices, R as RegisteredMethod, g as Registry, S as SharedData, m as SubscriptionLimits, T as TrackingOptions, V as VersionRequest, q as VersionSource, e as createDispatcher, r as createHttpRouter, t as toCallReply } from '../http-DC1RmIgu.js';
11
- import { l as CrudMethodName, d as CrudContractOptions, S as ScalarFieldOf, N as NumberFieldOf, m as CrudMethods, Q as AdminMethodsOf, _ as AdminFieldConfig, E as AdminContractOptions, P as AdminMethods } from '../admin-DufEkep0.js';
12
- import { S as SearchContractOptions, T as TextFieldOf, b as SearchMethods, n as SharingMethodName, f as SharingByNameMethod, g as SharingContractOptions, o as SharingMethods } from '../sharing-B5-5Q_wT.js';
13
- export { a as CallOutcome, C as CallRecord } from '../metrics-B1dXpOQc.js';
14
- export { b as AuthenticateRequest, A as AuthenticateResult, H as HttpAuthenticateRequest, S as ServerAuth, c as ServiceAccessSource, a as ServiceGrants, d as SocketAuthenticateRequest, r as recordSocketSession } from '../auth-5yi_rUSM.js';
1
+ import { G as AnyContract, ap as ProjectionName, ae as FullProjectionOf, a8 as CollectionName, al as MethodName, d as StandardSchemaV1, c as InferOutput, N as NullableProjection, P as ProjectionList, am as MethodOf, ao as ParsedInputOf, ak as KindOf, A as AccessLevel, ab as EntityOf } from '../infer-Cwq49ME5.js';
2
+ import { M as ModelName, r as PolicyFor, t as RowForms, u as AccessFor, H as HandlerContext, v as ModelColumn, w as WatchAccess, x as PublicAccess, y as HandlerArgs, z as CustomAccess, B as ShareMode, E as ChannelOptions, G as ChannelsRequired, f as Service, I as BaseContext, J as CallerFor, l as RunContext, m as StreamHandle, P as Presence, K as AccessPolicy, L as AnyAccessPolicy, N as PolicyColumns, O as PolicyForeign, Q as PolicyTools, k as AccessFilter, T as RowAccess, o as AccessEngine, b as StorageWhere } from '../caller-Cx5wuao-.js';
3
+ export { av as ANY_FIELD, an as AccessForm, ao as AccessRequest, V as AffectsLink, n as AnyContext, A as AnyService, p as AppRooms, ap as AuthenticatedAccess, ad as CallOptions, i as Caller, a5 as ChannelAccess, a6 as ChannelContext, a7 as ChannelHandler, a8 as ChannelImplementation, a0 as CollectionScope, a2 as ContextRooms, a3 as ContextServices, C as CountArgs, $ as DEFAULT_BULK_THRESHOLD, g as DevWarning, D as DevWarningError, h as DevWarningKind, aq as EntryAccess, F as FindManyArgs, e as FlushInfo, d as FlushSink, ag as ForeignColumns, ah as ForeignColumnsOf, ar as IdKeyOf, as as IdSelector, ai as MembershipRead, ae as MethodCaller, az as N_PLUS_ONE_STATEMENTS, aj as ParentLink, ak as PolicyKind, al as PolicyReads, X as ProjectedOutput, Y as Projection, am as RowLevel, R as RowLevels, at as ScopeAccess, au as ServiceAccess, af as ServiceCaller, a9 as ServiceChannel, a1 as ServiceCollection, j as ServiceMethod, aa as ServiceStream, c as StatementCount, S as StorageAdapter, a as StorageRow, ab as StreamPushArgs, ac as StreamPushManyArgs, q as StreamSubscriptions, Z as TierGroup, _ as Tiers, a4 as TouchOptions, aw as UnitOfWork, U as UnitOfWorkFactory, ax as UnitOfWorkScope, W as WriteRecord, ay as formatDevWarning, s as storageOf } from '../caller-Cx5wuao-.js';
4
+ import { S as ServerOptions, Q as QuickdrawServer } from '../createServer-P61KBWro.js';
5
+ export { C as ClusterClient, t as ClusterOptions, D as DEFAULT_STALL_INTERVAL_MS, e as DEFAULT_STALL_MAX_MS, f as DEFAULT_STALL_THRESHOLD_MS, p as DisconnectUserOptions, E as EntitySubscription, a as EntitySubscriptions, H as HttpApp, I as IoRedisLike, M as MIN_STALL_INTERVAL_MS, m as QuickdrawIo, n as QuickdrawServerSocket, o as QuickdrawSocketData, x as RateLimitOptions, y as RateLimiter, R as RotateOptions, g as STALL_RESOLUTION_MS, b as ScopeSubscription, c as ScopeSubscriptions, l as ServerOnlyOptions, h as SlowMethod, q as SocketCors, r as SocketOptions, s as SocketRateLimitOptions, i as StallReport, j as StallWatchdogOptions, T as TopicWatch, d as TopicWatches, v as applyRateLimitMiddleware, u as createRateLimiter, k as createServer, w as createTieredRateLimiter } from '../createServer-P61KBWro.js';
6
+ import { ad as Version } from '../envelope-CoiZY9KU.js';
7
+ import { Q as QuickdrawTypes, D as DbOf, c as PrincipalOf, M as MaybePromise, b as McpContextOf, C as ContextExtensionOf, P as Principal } from '../types-BDmssndG.js';
8
+ export { a as McpContext, T as Transport } from '../types-BDmssndG.js';
9
+ import { a as DispatcherOptions, D as Dispatcher, c as DispatcherCollections } from '../http-89lENH2D.js';
10
+ export { o as AccessChange, p as AccessChangeListener, A as AccessOptions, d as ChangeLogOptions, C as ContractOfServices, j as DEFAULT_LIMITS, f as DbOfServices, h as DispatchRequest, i as DispatchResult, n as DispatcherAccess, k as DispatcherLimits, s as HttpMiddleware, H as HttpRouter, u as HttpRouterOptions, b as HttpTransportOptions, L as LimitsOptions, l as PipelineOptions, P as PrincipalOfServices, R as RegisteredMethod, g as Registry, S as SharedData, m as SubscriptionLimits, T as TrackingOptions, V as VersionRequest, q as VersionSource, e as createDispatcher, r as createHttpRouter, t as toCallReply } from '../http-89lENH2D.js';
11
+ import { l as CrudMethodName, d as CrudContractOptions, S as ScalarFieldOf, N as NumberFieldOf, m as CrudMethods, Q as AdminMethodsOf, _ as AdminFieldConfig, E as AdminContractOptions, P as AdminMethods } from '../admin-Bl71J4IG.js';
12
+ import { S as SearchContractOptions, T as TextFieldOf, b as SearchMethods, n as SharingMethodName, f as SharingByNameMethod, g as SharingContractOptions, o as SharingMethods } from '../sharing-BHyufgVl.js';
13
+ export { a as CallOutcome, C as CallRecord } from '../metrics-Ny1dFbyY.js';
14
+ export { b as AuthenticateRequest, A as AuthenticateResult, H as HttpAuthenticateRequest, S as ServerAuth, c as ServiceAccessSource, a as ServiceGrants, d as SocketAuthenticateRequest, r as recordSocketSession } from '../auth-DyCIKmTQ.js';
15
15
  import { Server } from 'socket.io';
16
16
  import { L as Logger } from '../logger-BY28acW-.js';
17
17
  import 'node:http';
@@ -39,15 +39,29 @@ type LegacyReply = {
39
39
  readonly code: number;
40
40
  };
41
41
 
42
+ /**
43
+ * A JSON column's value as a database client types it: structurally
44
+ * Prisma's `JsonValue` (and its `InputJsonValue` objects and arrays). A row
45
+ * may hold one wherever the wire has an object or an array (`RowFor`); the
46
+ * method's output schema checks its shape outside production.
47
+ */
48
+ type JsonColumnValue = string | number | boolean | null | {
49
+ readonly [key: string]: JsonColumnValue | undefined;
50
+ } | readonly JsonColumnValue[];
42
51
  /**
43
52
  * A row of a projection as a handler may return it: the database row. Where
44
53
  * the projection has a string, a `Date` is accepted too, at any depth (the
45
- * framework sends its ISO string); and the row may carry more columns than
46
- * the projection names (the framework sends only the projection's keys).
54
+ * framework sends its ISO string); where it has an object or an array, a
55
+ * JSON column's value (`JsonColumnValue`: a Prisma `Json` column is typed
56
+ * `JsonValue` whatever it holds); and the row may carry more columns than the
57
+ * projection names (the framework sends only the projection's keys). A
58
+ * string, number or boolean column is checked as the wire types it.
47
59
  */
48
60
  type RowFor<Wire> = Wire extends string ? Wire | Date : Wire extends readonly (infer Item)[] ? readonly RowFor<Item>[] : Wire extends object ? {
49
- readonly [Key in keyof Wire]: RowFor<Wire[Key]>;
61
+ readonly [Key in keyof Wire]: ColumnFor<Wire[Key]>;
50
62
  } : Wire;
63
+ /** One column of a row (`RowFor`): an object or an array may also be a JSON column's value. */
64
+ type ColumnFor<Wire> = Wire extends string ? Wire | Date : Wire extends object ? RowFor<Wire> | JsonColumnValue : Wire;
51
65
  /**
52
66
  * One projection's entry in `defineService`'s `project` option (RFC 0003
53
67
  * section 6).
@@ -75,14 +89,18 @@ interface ProjectionOption<Wire = unknown> {
75
89
  }
76
90
  /** The `project` option checked against the contract: a name that is not a projection becomes an error message. */
77
91
  type ProjectCheck<C extends AnyContract, Proj> = {
78
- readonly [Name in keyof Proj]: Name extends ProjectionName<C> ? ProjectionOption<ProjectionOf<C, Name>> : `defineService: "${Name & string}" is not a projection of ${C["name"]}`;
92
+ readonly [Name in keyof Proj]: Name extends ProjectionName<C> ? ProjectionOption<FullProjectionOf<C, Name>> : `defineService: "${Name & string}" is not a projection of ${C["name"]}`;
79
93
  };
80
94
  /** `[row]` when projection `Name` has a `map` taking `row`, otherwise `[]`. */
81
95
  type MappedRow<Proj, Name> = Name extends keyof Proj ? Proj[Name] extends {
82
96
  readonly map: (row: infer Row) => unknown;
83
97
  } ? [[Row] extends [never] ? unknown : Row] : [] : [];
84
- /** What a handler returns for one row of projection `Name`: what its `map` takes, or the database row. */
85
- type HandlerRow<C extends AnyContract, Name extends ProjectionName<C>, Proj> = MappedRow<Proj, Name> extends [infer Row] ? Row : RowFor<ProjectionOf<C, Name>>;
98
+ /**
99
+ * What a handler returns for one row of projection `Name`: what its `map`
100
+ * takes, or the database row of the full projection (tiered fields too: the
101
+ * framework strips them per reader).
102
+ */
103
+ type HandlerRow<C extends AnyContract, Name extends ProjectionName<C>, Proj> = MappedRow<Proj, Name> extends [infer Row] ? Row : RowFor<FullProjectionOf<C, Name>>;
86
104
  type HandlerResult<C extends AnyContract, Output, Proj> = Output extends StandardSchemaV1 ? InferOutput<Output> : Output extends NullableProjection<infer Name extends ProjectionName<C>> ? HandlerRow<C, Name, Proj> | null : Output extends ProjectionList<infer Name extends ProjectionName<C>> ? readonly HandlerRow<C, Name, Proj>[] : Output extends ProjectionName<C> ? HandlerRow<C, Output, Proj> : never;
87
105
  /**
88
106
  * What method `M`'s handler returns: its output schema's type, or, for a
@@ -1308,4 +1326,4 @@ declare function decryptIfEncrypted(value: string): string;
1308
1326
  /** Safe wrapper that returns `null` instead of throwing on invalid/stale ciphertext. */
1309
1327
  declare function tryDecrypt(ciphertext: string, logger?: Logger): string | null;
1310
1328
 
1311
- export { ADMIN_HIDDEN_FIELDS, AccessEngine, AccessFilter, AccessFor, type AccessMap, AccessPolicy, type AdminAccess, type AdminContract, type AdminDefaultAccess, type AdminFieldOf, type AdminFieldOverride, type AdminHandlersOptions, type AdminImplementations, type AffectsOption, AnyAccessPolicy, BaseContext, type BasicAccessEngineOptions, CHANNEL_ABUSE_MULTIPLIER, CHANNEL_ABUSE_WINDOW_MS, CallerFor, ChannelOptions, ChannelsRequired, type CollectionOption, type CollectionOptions, type CollectionsRequired, ContextExtensionOf, type ContextFactory, type CrudAccess, type CrudCreateOf, type CrudHandlersOptions, type CrudImplementations, type CrudKindOf, type CrudMethodsOf, type CrudPrepare, CustomAccess, DbOf, type DefineService, Dispatcher, DispatcherCollections, DispatcherOptions, type EnvValidationResult, HandlerArgs, HandlerContext, type HandlerOutputOf, type HandlerRow, INDEX_MAX_ROWS, type InheritOptions, type InitArgs, type InitOptions, type JsonAclOptions, type KitContext, type KitHandler, type KitHandlerArgs, type LegacyReply, MAX_APP_ROOMS, MAX_ITEM_IDS, MAX_STREAMS_PER_SOCKET, MaybePromise, McpContextOf, type MembersOptions, type MethodAccess, type MethodImplementation, ModelColumn, ModelName, type NextOrdinalOptions, ORDINAL_STEP, PRESENCE_MAX_LAST_SEEN, PolicyFor, PolicyTools, Presence, Principal, type PrincipalFor, PrincipalOf, type ProjectCheck, type ProjectionOption, PublicAccess, type Quickdraw, QuickdrawServer, QuickdrawTypes, RESUME_MAX_AGE_MS, RESUME_MAX_DELTAS, type RedisAdapterOptions, type RedisAdapterResult, type ResolverOptions, RowAccess, type RowFor, RowForms, type RowFormsOf, RunContext, STREAM_MAX_SCOPES, type SearchAccess, type SearchContract, type SearchHandlersOptions, type SearchIdsOptions, type SearchImplementations, type SearchMethodsOf, type SearchStrategy, type SearchStrategyContext, ServerOptions, Service, type ServiceDefinition, ShareMode, type SharingAccess, type SharingByNameOf, type SharingChange, type SharingChangeKind, type SharingContract, type SharingDefaultAccess, type SharingHandlersOptions, type SharingImplementations, type SharingKindOf, type SharingMethodsOf, type SharingOnChange, type SharingOptionsArgs, type SharingResolveUser, type SharingUserLookup, StorageWhere, StreamHandle, type ValidateEnvOptions, WatchAccess, admin, anyOf, checkEnv, createBasicAccessEngine, crud, custom, decrypt, decryptIfEncrypted, displayNameOf, encrypt, inherit, initQuickdraw, isEncrypted, isRedisAdapterAvailable, jsonAcl, labelOf, meetsLevel, members, nextOrdinal, owner, requireEnv, requireRow, resolver, search, serviceGrant, setupRedisAdapter, sharing, tryDecrypt, validateEnv };
1329
+ export { ADMIN_HIDDEN_FIELDS, AccessEngine, AccessFilter, AccessFor, type AccessMap, AccessPolicy, type AdminAccess, type AdminContract, type AdminDefaultAccess, type AdminFieldOf, type AdminFieldOverride, type AdminHandlersOptions, type AdminImplementations, type AffectsOption, AnyAccessPolicy, BaseContext, type BasicAccessEngineOptions, CHANNEL_ABUSE_MULTIPLIER, CHANNEL_ABUSE_WINDOW_MS, CallerFor, ChannelOptions, ChannelsRequired, type CollectionOption, type CollectionOptions, type CollectionsRequired, ContextExtensionOf, type ContextFactory, type CrudAccess, type CrudCreateOf, type CrudHandlersOptions, type CrudImplementations, type CrudKindOf, type CrudMethodsOf, type CrudPrepare, CustomAccess, DbOf, type DefineService, Dispatcher, DispatcherCollections, DispatcherOptions, type EnvValidationResult, HandlerArgs, HandlerContext, type HandlerOutputOf, type HandlerRow, INDEX_MAX_ROWS, type InheritOptions, type InitArgs, type InitOptions, type JsonAclOptions, type JsonColumnValue, type KitContext, type KitHandler, type KitHandlerArgs, type LegacyReply, MAX_APP_ROOMS, MAX_ITEM_IDS, MAX_STREAMS_PER_SOCKET, MaybePromise, McpContextOf, type MembersOptions, type MethodAccess, type MethodImplementation, ModelColumn, ModelName, type NextOrdinalOptions, ORDINAL_STEP, PRESENCE_MAX_LAST_SEEN, PolicyFor, PolicyTools, Presence, Principal, type PrincipalFor, PrincipalOf, type ProjectCheck, type ProjectionOption, PublicAccess, type Quickdraw, QuickdrawServer, QuickdrawTypes, RESUME_MAX_AGE_MS, RESUME_MAX_DELTAS, type RedisAdapterOptions, type RedisAdapterResult, type ResolverOptions, RowAccess, type RowFor, RowForms, type RowFormsOf, RunContext, STREAM_MAX_SCOPES, type SearchAccess, type SearchContract, type SearchHandlersOptions, type SearchIdsOptions, type SearchImplementations, type SearchMethodsOf, type SearchStrategy, type SearchStrategyContext, ServerOptions, Service, type ServiceDefinition, ShareMode, type SharingAccess, type SharingByNameOf, type SharingChange, type SharingChangeKind, type SharingContract, type SharingDefaultAccess, type SharingHandlersOptions, type SharingImplementations, type SharingKindOf, type SharingMethodsOf, type SharingOnChange, type SharingOptionsArgs, type SharingResolveUser, type SharingUserLookup, StorageWhere, StreamHandle, type ValidateEnvOptions, WatchAccess, admin, anyOf, checkEnv, createBasicAccessEngine, crud, custom, decrypt, decryptIfEncrypted, displayNameOf, encrypt, inherit, initQuickdraw, isEncrypted, isRedisAdapterAvailable, jsonAcl, labelOf, meetsLevel, members, nextOrdinal, owner, requireEnv, requireRow, resolver, search, serviceGrant, setupRedisAdapter, sharing, tryDecrypt, validateEnv };
@@ -55,7 +55,7 @@ import {
55
55
  serviceGrant,
56
56
  strip,
57
57
  watchAdapterClients
58
- } from "../chunk-EQ2LW5C5.js";
58
+ } from "../chunk-I2OMV4AD.js";
59
59
  import {
60
60
  DevWarningError,
61
61
  N_PLUS_ONE_STATEMENTS,
@@ -101,7 +101,7 @@ import {
101
101
  import {
102
102
  entityRoom,
103
103
  reservedRoomPrefix
104
- } from "../chunk-4QNDKNDK.js";
104
+ } from "../chunk-SSDLYYQV.js";
105
105
  import {
106
106
  CHANNEL_DEFAULT_RATE,
107
107
  DEFAULT_COLLECTION_LIMIT,
@@ -1,14 +1,14 @@
1
- import { A as AnyService, i as Caller } from '../../caller-JNTbbD37.js';
1
+ import { A as AnyService, i as Caller } from '../../caller-Cx5wuao-.js';
2
2
  import { IncomingHttpHeaders, IncomingMessage } from 'node:http';
3
- import { ak as MethodName, d as StandardSchemaV1, c as InferOutput } from '../../infer-CEfvP0_I.js';
3
+ import { al as MethodName, d as StandardSchemaV1, c as InferOutput } from '../../infer-Cwq49ME5.js';
4
4
  import { Q as QuickdrawError, a as ErrorCode } from '../../errors-S-bxEIBC.js';
5
- import { P as PrincipalOfServices, C as ContractOfServices, D as Dispatcher, H as HttpRouter } from '../../http-DC1RmIgu.js';
6
- import { a as McpContext, b as McpContextOf, M as MaybePromise } from '../../types-CIq6xwng.js';
5
+ import { P as PrincipalOfServices, C as ContractOfServices, D as Dispatcher, H as HttpRouter } from '../../http-89lENH2D.js';
6
+ import { a as McpContext, b as McpContextOf, M as MaybePromise } from '../../types-BDmssndG.js';
7
7
  import { L as Logger } from '../../logger-BY28acW-.js';
8
- import { A as AuthenticateResult } from '../../auth-5yi_rUSM.js';
8
+ import { A as AuthenticateResult } from '../../auth-DyCIKmTQ.js';
9
9
  import { Readable, Writable } from 'node:stream';
10
- import '../../envelope-CR2A9lrd.js';
11
- import '../../metrics-B1dXpOQc.js';
10
+ import '../../envelope-CoiZY9KU.js';
11
+ import '../../metrics-Ny1dFbyY.js';
12
12
  import 'socket.io';
13
13
 
14
14
  /** The JSON Schema of a tool's arguments. MCP requires an object schema. */
@@ -1,8 +1,8 @@
1
1
  import { Meter, Tracer } from '@opentelemetry/api';
2
- import { C as CallRecord } from '../metrics-B1dXpOQc.js';
3
- import '../infer-CEfvP0_I.js';
2
+ import { C as CallRecord } from '../metrics-Ny1dFbyY.js';
3
+ import '../infer-Cwq49ME5.js';
4
4
  import '../errors-S-bxEIBC.js';
5
- import '../types-CIq6xwng.js';
5
+ import '../types-BDmssndG.js';
6
6
 
7
7
  /** Options of {@link otelOnCall}: a meter, a tracer, or both. */
8
8
  interface OtelOnCallOptions {
@@ -1,5 +1,5 @@
1
- import { L as RowSchema, d as StandardSchemaV1, c as InferOutput, Q as QueryDef, A as AccessLevel, p as MutationDef, b as ACL } from './infer-CEfvP0_I.js';
2
- import { ag as KitSchema, I as IdInput } from './admin-DufEkep0.js';
1
+ import { L as RowSchema, d as StandardSchemaV1, c as InferOutput, Q as QueryDef, A as AccessLevel, p as MutationDef, b as ACL } from './infer-Cwq49ME5.js';
2
+ import { ag as KitSchema, I as IdInput } from './admin-Bl71J4IG.js';
3
3
  import { d as SearchInput, f as SearchQuery, e as SearchPage } from './searchSchemas-CBgKRa1b.js';
4
4
 
5
5
  /** Type-only: marks a method the search kit made. Never set. */
@@ -1,24 +1,24 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  import { RenderResult } from '@testing-library/react';
3
3
  import * as React from 'react';
4
- import { M as MethodMember, E as EntityMembers, C as CollectionMember, S as StreamMember, a as ChannelMember, b as EventMember, Q as QuickdrawInvalidate, c as QuickdrawClient, d as QuickdrawConnection } from '../clientTypes-B9eYqDO1.js';
5
- import { aa as ContractMap, G as AnyContract, ak as MethodName, ag as InputOf, am as OutputOf, ab as EntityOf, a8 as CollectionName, aq as ScopeOf, ai as ItemOf, at as StreamName, ah as IsScopedStream, as as StreamItemOf, a6 as ChannelName, a5 as ChannelInputOf, ac as EventName, ad as EventPayloadOf } from '../infer-CEfvP0_I.js';
6
- import { P as PrincipalOfServices } from '../http-DC1RmIgu.js';
7
- import { A as AnyService } from '../caller-JNTbbD37.js';
8
- import { T as TestApp } from '../createTestApp-BPi72usy.js';
9
- import { Q as AdminMethodsOf } from '../admin-DufEkep0.js';
4
+ import { M as MethodMember, E as EntityMembers, C as CollectionMember, S as StreamMember, a as ChannelMember, b as EventMember, Q as QuickdrawInvalidate, c as QuickdrawClient, d as QuickdrawConnection } from '../clientTypes-B62bWHua.js';
5
+ import { aa as ContractMap, G as AnyContract, al as MethodName, ah as InputOf, an as OutputOf, ab as EntityOf, a8 as CollectionName, as as ScopeOf, aj as ItemOf, av as StreamName, ai as IsScopedStream, au as StreamItemOf, a6 as ChannelName, a5 as ChannelInputOf, ac as EventName, ad as EventPayloadOf } from '../infer-Cwq49ME5.js';
6
+ import { P as PrincipalOfServices } from '../http-89lENH2D.js';
7
+ import { A as AnyService } from '../caller-Cx5wuao-.js';
8
+ import { T as TestApp } from '../createTestApp-BBm3TakW.js';
9
+ import { Q as AdminMethodsOf } from '../admin-Bl71J4IG.js';
10
10
  import { Q as QuickdrawError } from '../errors-S-bxEIBC.js';
11
- import '../envelope-CR2A9lrd.js';
11
+ import '../envelope-CoiZY9KU.js';
12
12
  import 'socket.io-client';
13
13
  import '../keys-CqKkljVN.js';
14
14
  import '../searchSchemas-CBgKRa1b.js';
15
15
  import 'node:http';
16
16
  import '../logger-BY28acW-.js';
17
- import '../types-CIq6xwng.js';
18
- import '../metrics-B1dXpOQc.js';
19
- import '../auth-5yi_rUSM.js';
17
+ import '../types-BDmssndG.js';
18
+ import '../metrics-Ny1dFbyY.js';
19
+ import '../auth-DyCIKmTQ.js';
20
20
  import 'socket.io';
21
- import '../createServer-301BCb6c.js';
21
+ import '../createServer-P61KBWro.js';
22
22
 
23
23
  /**
24
24
  * How a mocked method answers. Until one of the `mock*` setters runs, every
@@ -11,9 +11,9 @@ import {
11
11
  searchTargetOf,
12
12
  streamMaxOf,
13
13
  viewPredicate
14
- } from "../chunk-ONVWF4IM.js";
14
+ } from "../chunk-DXTJNJM5.js";
15
15
  import "../chunk-K35VD4CQ.js";
16
- import "../chunk-4QNDKNDK.js";
16
+ import "../chunk-SSDLYYQV.js";
17
17
  import {
18
18
  isScopedStream
19
19
  } from "../chunk-UJQJM7EG.js";
@@ -1,18 +1,18 @@
1
- import { T as TestApp } from '../createTestApp-BPi72usy.js';
2
- export { F as FrameMatch, d as FrameQuery, e as FrameRecorder, R as RecordedFrame, S as ServerFrameOf, a as TestAppOptions, b as TestConnection, c as createTestApp, f as emitWithAck, w as waitForEvent } from '../createTestApp-BPi72usy.js';
3
- import { d as FlushSink, W as WriteRecord, e as FlushInfo, A as AnyService, f as Service } from '../caller-JNTbbD37.js';
4
- export { g as DevWarning, D as DevWarningError, h as DevWarningKind } from '../caller-JNTbbD37.js';
5
- import { G as AnyContract, ak as MethodName, ag as InputOf } from '../infer-CEfvP0_I.js';
1
+ import { T as TestApp } from '../createTestApp-BBm3TakW.js';
2
+ export { F as FrameMatch, d as FrameQuery, e as FrameRecorder, R as RecordedFrame, S as ServerFrameOf, a as TestAppOptions, b as TestConnection, c as createTestApp, f as emitWithAck, w as waitForEvent } from '../createTestApp-BBm3TakW.js';
3
+ import { d as FlushSink, W as WriteRecord, e as FlushInfo, A as AnyService, f as Service } from '../caller-Cx5wuao-.js';
4
+ export { g as DevWarning, D as DevWarningError, h as DevWarningKind } from '../caller-Cx5wuao-.js';
5
+ import { G as AnyContract, al as MethodName, ah as InputOf } from '../infer-Cwq49ME5.js';
6
6
  import { a as ErrorCode } from '../errors-S-bxEIBC.js';
7
- import { P as PrincipalOfServices } from '../http-DC1RmIgu.js';
8
- import { Q as QuickdrawTypes } from '../types-CIq6xwng.js';
9
- import '../envelope-CR2A9lrd.js';
10
- import '../createServer-301BCb6c.js';
7
+ import { P as PrincipalOfServices } from '../http-89lENH2D.js';
8
+ import { Q as QuickdrawTypes } from '../types-BDmssndG.js';
9
+ import '../envelope-CoiZY9KU.js';
10
+ import '../createServer-P61KBWro.js';
11
11
  import 'node:http';
12
12
  import 'socket.io';
13
- import '../auth-5yi_rUSM.js';
13
+ import '../auth-DyCIKmTQ.js';
14
14
  import '../logger-BY28acW-.js';
15
- import '../metrics-B1dXpOQc.js';
15
+ import '../metrics-Ny1dFbyY.js';
16
16
  import 'socket.io-client';
17
17
 
18
18
  /** One flush a recording sink received. */
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createServer,
6
6
  runtimeOf
7
- } from "../chunk-EQ2LW5C5.js";
7
+ } from "../chunk-I2OMV4AD.js";
8
8
  import {
9
9
  DevWarningError,
10
10
  STRICT_WARNINGS
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  PROTOCOL_VERSION,
27
27
  QUICKDRAW_VERSION
28
- } from "../chunk-4QNDKNDK.js";
28
+ } from "../chunk-SSDLYYQV.js";
29
29
  import "../chunk-47AEXVDM.js";
30
30
  import {
31
31
  utf8ByteLength
@@ -1,4 +1,4 @@
1
- import { A as AccessLevel, aa as ContractMap } from './infer-CEfvP0_I.js';
1
+ import { A as AccessLevel, aa as ContractMap } from './infer-Cwq49ME5.js';
2
2
 
3
3
  /**
4
4
  * Who is calling. A transport authenticates the connection or request and
@@ -1,7 +1,7 @@
1
1
  import { M as MethodQueryKey } from '../keys-CqKkljVN.js';
2
2
  export { C as CollectionQueryKey, E as EntityQueryKey, K as KEY_ROOT, b as MethodKeyPrefix, S as ServiceKeyPrefix, c as collectionKey, e as entityKey, m as methodKey, a as methodKeyPrefix, s as serviceKeyPrefix } from '../keys-CqKkljVN.js';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { aa as ContractMap, ak as MethodName, G as AnyContract, aj as KindOf, ag as InputOf, am as OutputOf } from '../infer-CEfvP0_I.js';
4
+ import { aa as ContractMap, al as MethodName, G as AnyContract, ak as KindOf, ah as InputOf, an as OutputOf } from '../infer-Cwq49ME5.js';
5
5
 
6
6
  /**
7
7
  * Format a currency value for display.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitzzero/quickdraw-core",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0-rc.2",
4
4
  "description": "Fast fullstack patterns for real-time applications with Socket.io and TanStack Query",
5
5
  "keywords": [
6
6
  "fullstack",
@@ -17,7 +17,7 @@
17
17
  "directory": "packages/core"
18
18
  },
19
19
  "bin": {
20
- "quickdraw-docs": "./dist/cli/quickdraw-docs.js"
20
+ "quickdraw-docs": "dist/cli/quickdraw-docs.js"
21
21
  },
22
22
  "files": [
23
23
  "dist"