@fitzzero/quickdraw-core 5.0.0 → 5.0.1
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.
- package/README.md +40 -17
- package/dist/{admin-BiU4LRZS.d.ts → admin-CBlTY0do.d.ts} +24 -9
- package/dist/{adminSchemas-k5a1Ov7b.d.ts → adminSchemas-zji11V74.d.ts} +14 -8
- package/dist/{caller-DHzK3oiI.d.ts → caller-BqCYnpmC.d.ts} +1 -1
- package/dist/{chunk-5IC5VZ7T.js → chunk-3JNMVB2V.js} +3 -3
- package/dist/{chunk-DNCAI3KY.js → chunk-4DIQHASK.js} +1 -1
- package/dist/chunk-4DIQHASK.js.map +1 -0
- package/dist/{chunk-B2UQ27GH.js → chunk-CDKG4TFA.js} +25 -5
- package/dist/{chunk-B2UQ27GH.js.map → chunk-CDKG4TFA.js.map} +1 -1
- package/dist/{chunk-XFDOGTMC.js → chunk-HQ6WIRE2.js} +3 -3
- package/dist/{chunk-LLLYILEP.js → chunk-NS5PUHIZ.js} +283 -22
- package/dist/chunk-NS5PUHIZ.js.map +1 -0
- package/dist/{chunk-XUSN5WKU.js → chunk-O2PWC2YW.js} +3 -3
- package/dist/{chunk-7QIY2DDX.js → chunk-WVIRXYI4.js} +2 -2
- package/dist/{chunk-7QIY2DDX.js.map → chunk-WVIRXYI4.js.map} +1 -1
- package/dist/{chunk-IRGAGRVG.js → chunk-ZACRRYWL.js} +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +4 -4
- package/dist/{clientTypes-B3o_99Xq.d.ts → clientTypes-DuZW_8mb.d.ts} +1 -1
- package/dist/{createServer-DUacdfKl.d.ts → createServer-CGsJlxM8.d.ts} +2 -2
- package/dist/{createTestApp-DFLXoTKm.d.ts → createTestApp-Cg2CZa1g.d.ts} +3 -3
- package/dist/{http--uoooIH5.d.ts → http-D3fSFQ57.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/prisma/index.d.ts +1 -1
- package/dist/prisma/index.js +1 -1
- package/dist/server/auth/index.d.ts +11 -2
- package/dist/server/auth/index.js +0 -5
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/index.d.ts +83 -17
- package/dist/server/index.js +87 -160
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp/index.d.ts +2 -2
- package/dist/{sharing-n4ss-ONM.d.ts → sharing-CoreezAq.d.ts} +2 -2
- package/dist/testing/client.d.ts +7 -7
- package/dist/testing/client.js +5 -5
- package/dist/testing/index.d.ts +6 -6
- package/dist/testing/index.js +3 -3
- package/dist/testing/mock.d.ts +3 -3
- package/dist/testing/mock.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-DNCAI3KY.js.map +0 -1
- package/dist/chunk-LLLYILEP.js.map +0 -1
- /package/dist/{chunk-5IC5VZ7T.js.map → chunk-3JNMVB2V.js.map} +0 -0
- /package/dist/{chunk-XFDOGTMC.js.map → chunk-HQ6WIRE2.js.map} +0 -0
- /package/dist/{chunk-XUSN5WKU.js.map → chunk-O2PWC2YW.js.map} +0 -0
- /package/dist/{chunk-IRGAGRVG.js.map → chunk-ZACRRYWL.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
adminSpecOf,
|
|
3
3
|
searchSpecOf
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CDKG4TFA.js";
|
|
5
5
|
import {
|
|
6
6
|
ACCESS_LEVELS,
|
|
7
7
|
CLIENT_EVENTS,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
SERVER_EVENTS,
|
|
12
12
|
isAuthenticationRefused,
|
|
13
13
|
isProtocolMismatch
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WVIRXYI4.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_COLLECTION_MAX_LIMIT
|
|
17
17
|
} from "./chunk-5YRQ26LF.js";
|
|
@@ -4284,4 +4284,4 @@ export {
|
|
|
4284
4284
|
viewPredicate,
|
|
4285
4285
|
showCollection
|
|
4286
4286
|
};
|
|
4287
|
-
//# sourceMappingURL=chunk-
|
|
4287
|
+
//# sourceMappingURL=chunk-O2PWC2YW.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-4YO5H5ON.js";
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
|
-
var QUICKDRAW_VERSION = "5.0.
|
|
6
|
+
var QUICKDRAW_VERSION = "5.0.1";
|
|
7
7
|
|
|
8
8
|
// src/contract/names.ts
|
|
9
9
|
function entityRoom(service, id, level) {
|
|
@@ -127,4 +127,4 @@ export {
|
|
|
127
127
|
MAX_SUBSCRIBE_IDS,
|
|
128
128
|
MAX_SCOPE_LENGTH
|
|
129
129
|
};
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-WVIRXYI4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts","../src/contract/names.ts","../src/protocol/version.ts","../src/contract/access.ts"],"sourcesContent":["/** The published version of `@fitzzero/quickdraw-core`. Kept in step with package.json. */\nexport const QUICKDRAW_VERSION = \"5.0.0\";\n","// Room and event names for protocol v5 (RFC 0003 sections 6, 7 and 8). Ported\n// from the 4.1 room helpers (4.1 `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 /**\n * This server's id: random, new each time a server starts. A client that\n * reconnects to the same id came back after a blip, to another id to a\n * restarted server (a game's world and clock start over) or, behind a\n * cluster, to another node, each of which has its own.\n */\n readonly serverId: 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","// Access levels and access-control lists, unchanged from 4.1\n// (4.1 `src/shared/types.ts:7-14`). The level names are stored in app data\n// (`User.serviceAccess`, JSON access lists), so they never change.\n\nexport type AccessLevel = \"Public\" | \"Read\" | \"Moderate\" | \"Admin\";\n\n/** Every access level, lowest first. */\nexport const ACCESS_LEVELS: readonly AccessLevel[] = Object.freeze([\n \"Public\",\n \"Read\",\n \"Moderate\",\n \"Admin\",\n]);\n\n/** True when `value` is one of the four access level names. */\nexport function isAccessLevel(value: unknown): value is AccessLevel {\n return typeof value === \"string\" && (ACCESS_LEVELS as readonly string[]).includes(value);\n}\n\nexport type ACE = {\n userId: string;\n level: AccessLevel;\n};\n\nexport type ACL = ACE[];\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;;;ACpEzB,IAAM,gBAAwC,OAAO,OAAO;AAAA,EACjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,SAAS,cAAc,OAAsC;AAClE,SAAO,OAAO,UAAU,YAAa,cAAoC,SAAS,KAAK;AACzF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../src/contract/names.ts","../src/protocol/version.ts","../src/contract/access.ts"],"sourcesContent":["/** The published version of `@fitzzero/quickdraw-core`. Kept in step with package.json. */\nexport const QUICKDRAW_VERSION = \"5.0.1\";\n","// Room and event names for protocol v5 (RFC 0003 sections 6, 7 and 8). Ported\n// from the 4.1 room helpers (4.1 `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 /**\n * This server's id: random, new each time a server starts. A client that\n * reconnects to the same id came back after a blip, to another id to a\n * restarted server (a game's world and clock start over) or, behind a\n * cluster, to another node, each of which has its own.\n */\n readonly serverId: 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","// Access levels and access-control lists, unchanged from 4.1\n// (4.1 `src/shared/types.ts:7-14`). The level names are stored in app data\n// (`User.serviceAccess`, JSON access lists), so they never change.\n\nexport type AccessLevel = \"Public\" | \"Read\" | \"Moderate\" | \"Admin\";\n\n/** Every access level, lowest first. */\nexport const ACCESS_LEVELS: readonly AccessLevel[] = Object.freeze([\n \"Public\",\n \"Read\",\n \"Moderate\",\n \"Admin\",\n]);\n\n/** True when `value` is one of the four access level names. */\nexport function isAccessLevel(value: unknown): value is AccessLevel {\n return typeof value === \"string\" && (ACCESS_LEVELS as readonly string[]).includes(value);\n}\n\nexport type ACE = {\n userId: string;\n level: AccessLevel;\n};\n\nexport type ACL = ACE[];\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;;;ACpEzB,IAAM,gBAAwC,OAAO,OAAO;AAAA,EACjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,SAAS,cAAc,OAAsC;AAClE,SAAO,OAAO,UAAU,YAAa,cAAoC,SAAS,KAAK;AACzF;","names":[]}
|
|
@@ -43,12 +43,12 @@ import {
|
|
|
43
43
|
useQuickdrawContext,
|
|
44
44
|
userOf,
|
|
45
45
|
viewPredicate
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-O2PWC2YW.js";
|
|
47
47
|
import {
|
|
48
48
|
CLIENT_EVENTS,
|
|
49
49
|
SERVICE_TOPIC,
|
|
50
50
|
collectionTopic
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-WVIRXYI4.js";
|
|
52
52
|
import {
|
|
53
53
|
isScopedStream
|
|
54
54
|
} from "./chunk-5YRQ26LF.js";
|
|
@@ -1410,4 +1410,4 @@ export {
|
|
|
1410
1410
|
QuickdrawProvider,
|
|
1411
1411
|
useQuickdraw
|
|
1412
1412
|
};
|
|
1413
|
-
//# sourceMappingURL=chunk-
|
|
1413
|
+
//# sourceMappingURL=chunk-ZACRRYWL.js.map
|
package/dist/client/index.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ export { B as BackoffKind, g as BackoffWindows, e as ConnectionState, D as DEFAU
|
|
|
6
6
|
import { k as MethodKind, O as OrderBy, C as CollectionDef, ae as ContractMap, A as AccessLevel, z as SortDirection } from '../infer-Dw21kmLw.js';
|
|
7
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-nf5eGB-a.js';
|
|
8
8
|
import { QueryClient, QueryKey, Query, UseQueryResult, UseMutationResult } from '@tanstack/react-query';
|
|
9
|
-
import { Q as QuickdrawClient, M as MethodQueryOptions, a as QueryCallOptions, b as MethodMutationOptions, c as MutationCallOptions } from '../clientTypes-
|
|
10
|
-
export { A as AddItemOptions, h as AdminMembers, u as ChannelMember, C as CollectionMember, E as EntityMembers, v as EventMember, G as GlobalStreamMember, L as LiveMembers, i as MethodMember, j as MutationMember, k as MutationVariables, O as OnRefused, d as OptimisticCache, l as OptimisticCacheOf, e as OptimisticUpdate, f as OverlayStore, g as OverlayView, m as QueryMember, n as QuickdrawInvalidate, w as RealtimeMembers, R as RefusedAddition, p as RefusedItem, x as ScopedStreamMember, H as SearchMember, I as SearchMemberOf, S as ServiceClient, y as StreamMember, z as UseChannelResult, U as UseCollectionOptions, q as UseCollectionResult, r as UseEntitiesResult, s as UseEntityOptions, t as UseEntityResult, B as UseEventOptions, J as UseSearchOptions, K as UseSearchResult, D as UseStreamOptions, F as UseStreamResult, o as overlaysOf } from '../clientTypes-
|
|
9
|
+
import { Q as QuickdrawClient, M as MethodQueryOptions, a as QueryCallOptions, b as MethodMutationOptions, c as MutationCallOptions } from '../clientTypes-DuZW_8mb.js';
|
|
10
|
+
export { A as AddItemOptions, h as AdminMembers, u as ChannelMember, C as CollectionMember, E as EntityMembers, v as EventMember, G as GlobalStreamMember, L as LiveMembers, i as MethodMember, j as MutationMember, k as MutationVariables, O as OnRefused, d as OptimisticCache, l as OptimisticCacheOf, e as OptimisticUpdate, f as OverlayStore, g as OverlayView, m as QueryMember, n as QuickdrawInvalidate, w as RealtimeMembers, R as RefusedAddition, p as RefusedItem, x as ScopedStreamMember, H as SearchMember, I as SearchMemberOf, S as ServiceClient, y as StreamMember, z as UseChannelResult, U as UseCollectionOptions, q as UseCollectionResult, r as UseEntitiesResult, s as UseEntityOptions, t as UseEntityResult, B as UseEventOptions, J as UseSearchOptions, K as UseSearchResult, D as UseStreamOptions, F as UseStreamResult, o as overlaysOf } from '../clientTypes-DuZW_8mb.js';
|
|
11
11
|
import { Q as QuickdrawError } from '../errors-S-bxEIBC.js';
|
|
12
|
-
import { n as AdminServiceMeta, F as FilterValue, y as AdminPage, z as AdminSubscribers } from '../adminSchemas-
|
|
12
|
+
import { n as AdminServiceMeta, F as FilterValue, y as AdminPage, z as AdminSubscribers } from '../adminSchemas-zji11V74.js';
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import 'socket.io-client';
|
|
15
15
|
|
package/dist/client/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
shouldRetry,
|
|
11
11
|
useLiveData,
|
|
12
12
|
useQuickdraw
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-ZACRRYWL.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_BACKOFF_MS,
|
|
16
16
|
DEFAULT_INVALIDATION_WINDOW_MS,
|
|
@@ -40,9 +40,9 @@ import {
|
|
|
40
40
|
useAdminServices,
|
|
41
41
|
useConnectionState,
|
|
42
42
|
useQuickdrawContext
|
|
43
|
-
} from "../chunk-
|
|
44
|
-
import "../chunk-
|
|
45
|
-
import "../chunk-
|
|
43
|
+
} from "../chunk-O2PWC2YW.js";
|
|
44
|
+
import "../chunk-CDKG4TFA.js";
|
|
45
|
+
import "../chunk-WVIRXYI4.js";
|
|
46
46
|
import "../chunk-5YRQ26LF.js";
|
|
47
47
|
import "../chunk-47AEXVDM.js";
|
|
48
48
|
import "../chunk-Z2LZ7IZ7.js";
|
|
@@ -2,7 +2,7 @@ import { QueryClient, UseMutationOptions, UseQueryOptions, UseQueryResult, Updat
|
|
|
2
2
|
import { J as AnyContract, az as StreamName, am as IsScopedStream, ay as StreamItemOf, aa as ChannelName, a9 as ChannelInputOf, ag as EventName, ah as EventPayloadOf, ap as MethodName, aq as MethodOf, ar as OutputOf, al as InputOf, ae as ContractMap, ao as KindOf, af as EntityOf, ac as CollectionName, an as ItemOf, aw as ScopeOf, aA as ViewName, ak as IndexRowOf } from './infer-Dw21kmLw.js';
|
|
3
3
|
import { Q as QuickdrawError } from './errors-S-bxEIBC.js';
|
|
4
4
|
import { M as MethodQueryKey } from './keys-CqKkljVN.js';
|
|
5
|
-
import { i as SearchPage } from './adminSchemas-
|
|
5
|
+
import { i as SearchPage } from './adminSchemas-zji11V74.js';
|
|
6
6
|
import { a5 as Revision } from './envelope-nf5eGB-a.js';
|
|
7
7
|
|
|
8
8
|
/** A row as additions keep it: any object with a string `id`. */
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
2
|
+
import { a as DispatcherOptions, H as HttpRouter, b as HttpTransportOptions, P as PrincipalOfServices, D as Dispatcher } from './http-D3fSFQ57.js';
|
|
3
3
|
import { P as Principal } from './types-Bwg3kIEc.js';
|
|
4
|
-
import { r as AppRooms, t as StreamSubscriptions, A as AnyService, u as RoomLeaveHandler } from './caller-
|
|
4
|
+
import { r as AppRooms, t as StreamSubscriptions, A as AnyService, u as RoomLeaveHandler } from './caller-BqCYnpmC.js';
|
|
5
5
|
import { S as ServerAuth, a as ServiceGrants } from './auth-CMyRkfjZ.js';
|
|
6
6
|
import { Server, DefaultEventsMap, Socket, ServerOptions as ServerOptions$1 } from 'socket.io';
|
|
7
7
|
import { g as PROTOCOL_VERSION } from './envelope-nf5eGB-a.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as ServerEventName, a9 as ServerToClientEvents, a1 as EventFrame, S as SERVER_EVENTS, aa as StreamFrame, k as HelloFrame } from './envelope-nf5eGB-a.js';
|
|
2
|
-
import { A as AnyService, i as Caller } from './caller-
|
|
3
|
-
import { S as ServerOptions, Q as QuickdrawServer } from './createServer-
|
|
4
|
-
import { P as PrincipalOfServices, C as ContractOfServices } from './http
|
|
2
|
+
import { A as AnyService, i as Caller } from './caller-BqCYnpmC.js';
|
|
3
|
+
import { S as ServerOptions, Q as QuickdrawServer } from './createServer-CGsJlxM8.js';
|
|
4
|
+
import { P as PrincipalOfServices, C as ContractOfServices } from './http-D3fSFQ57.js';
|
|
5
5
|
import { J as AnyContract, ag as EventName, ah as EventPayloadOf, az as StreamName, ay as StreamItemOf } from './infer-Dw21kmLw.js';
|
|
6
6
|
import { C as CallRecord } from './metrics-C0WvB7-I.js';
|
|
7
7
|
import { Socket } from 'socket.io-client';
|
|
@@ -2,7 +2,7 @@ import { IncomingMessage, ServerResponse } from 'node:http';
|
|
|
2
2
|
import { L as Logger } from './logger-BY28acW-.js';
|
|
3
3
|
import { J as AnyContract, A as AccessLevel } from './infer-Dw21kmLw.js';
|
|
4
4
|
import { P as Principal, T as Transport, a as McpContext, D as DbOf, c as PrincipalOf, M as MaybePromise } from './types-Bwg3kIEc.js';
|
|
5
|
-
import { A as AnyService, j as ServiceMethod, R as RowLevels, k as AccessFilter, i as Caller, l as RunContext, m as RunOptions, P as Presence, n as ServerRooms, o as StreamHandle, p as AnyContext, S as StorageAdapter, U as UnitOfWorkFactory, d as FlushSink, q as AccessEngine } from './caller-
|
|
5
|
+
import { A as AnyService, j as ServiceMethod, R as RowLevels, k as AccessFilter, i as Caller, l as RunContext, m as RunOptions, P as Presence, n as ServerRooms, o as StreamHandle, p as AnyContext, S as StorageAdapter, U as UnitOfWorkFactory, d as FlushSink, q as AccessEngine } from './caller-BqCYnpmC.js';
|
|
6
6
|
import { ad as Version, x as CallReply } from './envelope-nf5eGB-a.js';
|
|
7
7
|
import { Q as QuickdrawError } from './errors-S-bxEIBC.js';
|
|
8
8
|
import { C as CallRecord } from './metrics-C0WvB7-I.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { a as ACE, b as ACL, A as AccessLevel, J as AnyContract, Y as CHANNEL_DEFAULT_RATE, a0 as ChannelDef, a9 as ChannelInputOf, aa as ChannelName, ab as ChannelPayloadOf, a1 as ChannelRequires, C as CollectionDef, ac as CollectionName, ad as CollectionOf, y as CollectionWhere, K as Contract, L as ContractDefinition, ae as ContractMap, D as DEFAULT_COLLECTION_LIMIT, w as DEFAULT_COLLECTION_MAX_LIMIT, af as EntityOf, E as EntityProjection, a2 as EventDef, ag as EventName, ah as EventPayloadOf, ai as FullProjectionOf, Z as GLOBAL_STREAM, aj as IndexFieldOf, R as IndexRow, ak as IndexRowOf, I as InferInput, c as InferOutput, al as InputOf, am as IsScopedStream, an as ItemOf, ao as KindOf, M as MethodDef, k as MethodKind, ap as MethodName, aq as MethodOf, o as MethodOutput, p as MutationDef, N as NullableProjection, O as OrderBy, ar as OutputOf, as as ParsedInputOf, a3 as PayloadSelector, P as ProjectionList, at as ProjectionName, au as ProjectionOf, r as ProjectionRef, Q as QueryDef, av as ReceivedRow, U as ReservedMethodName, a4 as RoomPrefix, a5 as RoomSelector, X as RowSchema, _ as STREAM_MAX_SEED, aw as ScopeOf, s as ServiceModelsWatch, ax as ServiceNameOf, u as ServiceWatch, z as SortDirection, S as StandardJSONSchemaV1, d as StandardSchemaV1, e as StandardSchemaWithJSON, f as StandardTypedV1, a6 as StreamAccess, a7 as StreamDef, ay as StreamItemOf, az as StreamName, a8 as StreamRoom, T as TODO_SCHEMA_VENDOR, g as TodoSchemaOptions, V as ValidationIssue, j as ValidationResult, B as ViaScope, aA as ViewName, G as ViewPredicate, F as Viewer, W as Watch, H as defineContract, h as hasJsonSchema, $ as isScopedStream, i as isStandardSchema, l as listOf, m as mutation, n as nullable, q as query, t as todoSchema, v as validate, x as via } from './infer-Dw21kmLw.js';
|
|
2
2
|
export { L as Logger, c as consoleLogger } from './logger-BY28acW-.js';
|
|
3
|
-
export { A as ADMIN_METHODS, w as AdminContractOptions, x as AdminCreateDef, y as AdminDeleteDef, z as AdminGetDef, D as AdminListDef, E as AdminMetaDef, F as AdminMethodName, G as AdminMethods, H as AdminMethodsOf, J as AdminReemitDef, K as AdminSubscribersDef, M as AdminTag, O as AdminUpdateDef, 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, I as IdInput, u as IdsInput, P as KitSchema, L as ListInput, N as NumberFieldOf, R as ReorderInput, S as ScalarFieldOf, W as WithId, v as admin, c as crud } from './admin-
|
|
4
|
-
export { o as ADMIN_DEFAULT_PAGE_SIZE, A as ADMIN_FIELD_TYPES, p as ADMIN_MAX_PAGE, q as ADMIN_MAX_PAGE_SIZE, k as ADMIN_NEVER_WRITABLE, r as AdminCreateInput, s as AdminCreateQuery, t as AdminData, l as AdminFieldConfig, m as AdminFieldType, u as AdminListInput, v as AdminListQuery, w as AdminMetaInput, x as AdminNeverWritable, y as AdminPage, n as AdminServiceMeta, z as AdminSubscribers, B as AdminUpdateInput, C as AdminUpdateQuery, F as FilterValue, L as LIST_DEFAULT_LIMIT, a as LIST_MAX_LIMIT, b as ListPage, c as ListQuery, d as ListSort, S as SEARCH_DEFAULT_LIMIT, e as SEARCH_DEFAULT_MIN_LENGTH, f as SEARCH_MAX_LIMIT, g as SEARCH_MAX_QUERY_LENGTH, h as SearchInput, i as SearchPage, j as SearchQuery,
|
|
5
|
-
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-
|
|
3
|
+
export { A as ADMIN_METHODS, w as AdminContractOptions, x as AdminCreateDef, y as AdminDeleteDef, z as AdminGetDef, D as AdminListDef, E as AdminMetaDef, F as AdminMethodName, G as AdminMethods, H as AdminMethodsOf, J as AdminReemitDef, K as AdminSubscribersDef, M as AdminTag, O as AdminUpdateDef, 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, I as IdInput, u as IdsInput, P as KitSchema, L as ListInput, N as NumberFieldOf, R as ReorderInput, S as ScalarFieldOf, W as WithId, v as admin, c as crud } from './admin-CBlTY0do.js';
|
|
4
|
+
export { o as ADMIN_DEFAULT_PAGE_SIZE, A as ADMIN_FIELD_TYPES, p as ADMIN_MAX_PAGE, q as ADMIN_MAX_PAGE_SIZE, k as ADMIN_NEVER_WRITABLE, r as AdminCreateInput, s as AdminCreateQuery, t as AdminData, l as AdminFieldConfig, m as AdminFieldType, u as AdminListInput, v as AdminListQuery, w as AdminMetaInput, x as AdminNeverWritable, y as AdminPage, n as AdminServiceMeta, z as AdminSubscribers, B as AdminUpdateInput, C as AdminUpdateQuery, D as AdminWritable, F as FilterValue, L as LIST_DEFAULT_LIMIT, a as LIST_MAX_LIMIT, b as ListPage, c as ListQuery, d as ListSort, S as SEARCH_DEFAULT_LIMIT, e as SEARCH_DEFAULT_MIN_LENGTH, f as SEARCH_MAX_LIMIT, g as SEARCH_MAX_QUERY_LENGTH, h as SearchInput, i as SearchPage, j as SearchQuery, E as SubscriberLevel } from './adminSchemas-zji11V74.js';
|
|
5
|
+
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-CoreezAq.js';
|
|
6
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-nf5eGB-a.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.
|
|
10
|
+
declare const QUICKDRAW_VERSION = "5.0.1";
|
|
11
11
|
|
|
12
12
|
export { QUICKDRAW_VERSION };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
SHARING_METHODS,
|
|
5
5
|
crud,
|
|
6
6
|
sharing
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3JNMVB2V.js";
|
|
8
8
|
import {
|
|
9
9
|
isCallEnvelope,
|
|
10
10
|
isCancel
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
nullable,
|
|
30
30
|
query,
|
|
31
31
|
search
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-CDKG4TFA.js";
|
|
33
33
|
import {
|
|
34
34
|
ACCESS_LEVELS,
|
|
35
35
|
CLIENT_EVENTS,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
streamRoom,
|
|
51
51
|
topicRoom,
|
|
52
52
|
userRoom
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-WVIRXYI4.js";
|
|
54
54
|
import {
|
|
55
55
|
CHANNEL_DEFAULT_RATE,
|
|
56
56
|
DEFAULT_COLLECTION_LIMIT,
|
package/dist/prisma/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-BqCYnpmC.js';
|
|
3
3
|
import '../envelope-nf5eGB-a.js';
|
|
4
4
|
import '../infer-Dw21kmLw.js';
|
|
5
5
|
import '../errors-S-bxEIBC.js';
|
package/dist/prisma/index.js
CHANGED
|
@@ -266,6 +266,14 @@ declare function registerMockOAuthProvider(router: MockOAuthRouter, options: Reg
|
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
268
|
* Origin validation utility for OAuth redirect and CORS security.
|
|
269
|
+
*
|
|
270
|
+
* An origin is allowed when it is the client URL, one of the extra origins
|
|
271
|
+
* or matches an app's pattern, or, outside production, is localhost. GitHub
|
|
272
|
+
* Codespaces origins (`*.app.github.dev`) are never allowed by default since
|
|
273
|
+
* 5.0.1 (finding R1.2 of the 5.0.0 review): anyone can open a Codespace, so
|
|
274
|
+
* the allowance let any such page open a socket or finish a sign-in as a
|
|
275
|
+
* signed-in user in production, wherever an app used this helper for CORS or
|
|
276
|
+
* a cookie check. An app that wants one lists a pattern in `allowedPatterns`.
|
|
269
277
|
*/
|
|
270
278
|
declare const OAUTH_RETURN_ORIGIN_COOKIE = "oauth_return_origin";
|
|
271
279
|
interface ValidateOriginOptions {
|
|
@@ -284,8 +292,9 @@ interface ValidateOriginOptions {
|
|
|
284
292
|
*/
|
|
285
293
|
allowedPatterns?: RegExp[];
|
|
286
294
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
295
|
+
* Ignored: kept so 5.0.0 code that passes it still compiles.
|
|
296
|
+
*
|
|
297
|
+
* @deprecated Codespaces origins are never allowed since 5.0.1; list a pattern in allowedPatterns if one is wanted.
|
|
289
298
|
*/
|
|
290
299
|
allowCodespaces?: boolean;
|
|
291
300
|
/**
|
|
@@ -130,7 +130,6 @@ import { randomBytes } from "crypto";
|
|
|
130
130
|
|
|
131
131
|
// src/server/auth/validateOrigin.ts
|
|
132
132
|
var OAUTH_RETURN_ORIGIN_COOKIE = "oauth_return_origin";
|
|
133
|
-
var CODESPACE_REGEX = /^https:\/\/[a-z0-9-]+-[a-z0-9-]+-\d+\.app\.github\.dev$/;
|
|
134
133
|
var LOCALHOST_REGEX = /^http:\/\/localhost:\d+$/;
|
|
135
134
|
function envExtraOrigins() {
|
|
136
135
|
const raw = process.env.EXTRA_ALLOWED_ORIGINS;
|
|
@@ -157,9 +156,6 @@ function validateRedirectOrigin(origin, options = {}) {
|
|
|
157
156
|
if (options.allowedPatterns?.some((pattern) => pattern.test(cleanOrigin))) {
|
|
158
157
|
return cleanOrigin;
|
|
159
158
|
}
|
|
160
|
-
if ((options.allowCodespaces ?? true) && CODESPACE_REGEX.test(cleanOrigin)) {
|
|
161
|
-
return cleanOrigin;
|
|
162
|
-
}
|
|
163
159
|
if ((options.allowLocalhostInDev ?? true) && process.env.NODE_ENV !== "production" && LOCALHOST_REGEX.test(cleanOrigin)) {
|
|
164
160
|
return cleanOrigin;
|
|
165
161
|
}
|
|
@@ -459,7 +455,6 @@ function originAllowlist(allowedOrigins, owner, allowEmpty = false) {
|
|
|
459
455
|
clientUrl: "",
|
|
460
456
|
extraAllowedOrigins: exact,
|
|
461
457
|
allowedPatterns: patterns,
|
|
462
|
-
allowCodespaces: false,
|
|
463
458
|
allowLocalhostInDev: false
|
|
464
459
|
};
|
|
465
460
|
return Object.freeze({
|