@fitzzero/quickdraw-core 5.1.1 → 5.1.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.
- package/README.md +533 -180
- package/dist/{admin-DKwkIh5i.d.ts → admin-DWWrT1h6.d.ts} +2 -2
- package/dist/{adminSchemas-2DUA_hZ8.d.ts → adminSchemas-D4bFKsrb.d.ts} +6 -4
- package/dist/{auth-BhWqdyb-.d.ts → auth-DXiSJZaf.d.ts} +42 -16
- package/dist/{caller-CXTFswBO.d.ts → caller-BT-Mv4bD.d.ts} +117 -22
- package/dist/{chunk-RT6OILOI.js → chunk-4D2DOGAW.js} +2 -14
- package/dist/chunk-4D2DOGAW.js.map +1 -0
- package/dist/chunk-5CGO426C.js +15 -0
- package/dist/chunk-5CGO426C.js.map +1 -0
- package/dist/{chunk-RZTP4IEW.js → chunk-6K5BY47X.js} +4594 -3481
- package/dist/chunk-6K5BY47X.js.map +1 -0
- package/dist/{chunk-VSQBHPWH.js → chunk-753VJIUP.js} +13 -15
- package/dist/chunk-753VJIUP.js.map +1 -0
- package/dist/{chunk-ZIVPHYRG.js → chunk-7QCUX4TK.js} +4 -4
- package/dist/chunk-7QCUX4TK.js.map +1 -0
- package/dist/chunk-AK23XSWD.js +16 -0
- package/dist/chunk-AK23XSWD.js.map +1 -0
- package/dist/{chunk-SHEGLZEP.js → chunk-AONAFOYU.js} +14 -5
- package/dist/{chunk-SHEGLZEP.js.map → chunk-AONAFOYU.js.map} +1 -1
- package/dist/chunk-DKE6QO26.js +136 -0
- package/dist/chunk-DKE6QO26.js.map +1 -0
- package/dist/{chunk-H23KEFBA.js → chunk-DUBU3BB3.js} +30 -1
- package/dist/chunk-DUBU3BB3.js.map +1 -0
- package/dist/{chunk-CDKG4TFA.js → chunk-GKH3LJ7N.js} +1 -1
- package/dist/chunk-GKH3LJ7N.js.map +1 -0
- package/dist/{chunk-OECZPRPW.js → chunk-GSIPUNJL.js} +49 -9
- package/dist/chunk-GSIPUNJL.js.map +1 -0
- package/dist/{chunk-DD4SKCNO.js → chunk-LCC7HNFP.js} +12 -1
- package/dist/chunk-LCC7HNFP.js.map +1 -0
- package/dist/{chunk-2PWMUVC7.js → chunk-MBH6IDSM.js} +480 -12
- package/dist/chunk-MBH6IDSM.js.map +1 -0
- package/dist/{chunk-QCHKWIRS.js → chunk-NMXYENH4.js} +10 -10
- package/dist/{chunk-QCHKWIRS.js.map → chunk-NMXYENH4.js.map} +1 -1
- package/dist/chunk-NO4M6PO5.js +101 -0
- package/dist/chunk-NO4M6PO5.js.map +1 -0
- package/dist/{chunk-TBMKJ26R.js → chunk-NW6U45HX.js} +3 -1
- package/dist/chunk-NW6U45HX.js.map +1 -0
- package/dist/{chunk-REX5YPHX.js → chunk-RJ5I2VO3.js} +74 -19
- package/dist/chunk-RJ5I2VO3.js.map +1 -0
- package/dist/{chunk-QEKVYG5F.js → chunk-RL4VKLBX.js} +1 -1
- package/dist/{chunk-QEKVYG5F.js.map → chunk-RL4VKLBX.js.map} +1 -1
- package/dist/chunk-XH2IZVLT.js +62 -0
- package/dist/chunk-XH2IZVLT.js.map +1 -0
- package/dist/{chunk-4DIQHASK.js → chunk-Z5ILULF2.js} +26 -7
- package/dist/chunk-Z5ILULF2.js.map +1 -0
- package/dist/cli/quickdraw-docs.js +5 -3
- package/dist/cli/quickdraw-docs.js.map +1 -1
- package/dist/client/index.d.ts +30 -18
- package/dist/client/index.js +8 -6
- package/dist/client/index.js.map +1 -1
- package/dist/{clientTypes-Bc-G8n-U.d.ts → clientTypes-hWcPUVS9.d.ts} +3 -3
- package/dist/{connection-Cr1BU07W.d.ts → connection-CgijdGpT.d.ts} +8 -4
- package/dist/{createServer-CP9eDHZZ.d.ts → createServer-Cp-Wk500.d.ts} +36 -14
- package/dist/{createTestApp-UKVGEmOf.d.ts → createTestApp-BB_PkqQ7.d.ts} +16 -10
- package/dist/{envelope-Cp3YcVxC.d.ts → envelope-DzWyIXjj.d.ts} +18 -4
- package/dist/{http-Djj2Inuu.d.ts → http-DotQ5bj8.d.ts} +68 -17
- package/dist/index.d.ts +7 -7
- package/dist/index.js +37 -13
- package/dist/index.js.map +1 -1
- package/dist/{infer-Teo1xpsd.d.ts → infer-BmoZsL9a.d.ts} +43 -10
- package/dist/logger-Yz93KzdV.d.ts +30 -0
- package/dist/{metrics-BdBu5o8G.d.ts → metrics-DW80Exve.d.ts} +2 -2
- package/dist/origins-kvpxnVcW.d.ts +8 -0
- package/dist/prisma/index.d.ts +5 -5
- package/dist/prisma/index.js +130 -67
- package/dist/prisma/index.js.map +1 -1
- package/dist/{rateLimit-ZMIZJUZF.js → rateLimit-5RKBFLUR.js} +2 -2
- package/dist/server/auth/index.d.ts +82 -33
- package/dist/server/auth/index.js +273 -268
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/express/index.d.ts +9 -2
- package/dist/server/express/index.js +1 -1
- package/dist/server/index.d.ts +147 -67
- package/dist/server/index.js +520 -381
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp/index.d.ts +63 -17
- package/dist/server/mcp/index.js +256 -54
- package/dist/server/mcp/index.js.map +1 -1
- package/dist/server/otel.d.ts +3 -3
- package/dist/{sharing-DVa8W-yR.d.ts → sharing-UDLn1049.d.ts} +3 -3
- package/dist/testing/client.d.ts +14 -14
- package/dist/testing/client.js +9 -7
- package/dist/testing/client.js.map +1 -1
- package/dist/testing/index.d.ts +12 -12
- package/dist/testing/index.js +21 -12
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/mock.d.ts +5 -5
- package/dist/testing/mock.js +8 -6
- package/dist/{types-Cu0vmx7c.d.ts → types-CYliTP65.d.ts} +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-2PWMUVC7.js.map +0 -1
- package/dist/chunk-4DIQHASK.js.map +0 -1
- package/dist/chunk-CDKG4TFA.js.map +0 -1
- package/dist/chunk-DD4SKCNO.js.map +0 -1
- package/dist/chunk-H23KEFBA.js.map +0 -1
- package/dist/chunk-OECZPRPW.js.map +0 -1
- package/dist/chunk-REX5YPHX.js.map +0 -1
- package/dist/chunk-RT6OILOI.js.map +0 -1
- package/dist/chunk-RZTP4IEW.js.map +0 -1
- package/dist/chunk-TBMKJ26R.js.map +0 -1
- package/dist/chunk-VSQBHPWH.js.map +0 -1
- package/dist/chunk-YSWH776Y.js +0 -13
- package/dist/chunk-YSWH776Y.js.map +0 -1
- package/dist/chunk-ZIVPHYRG.js.map +0 -1
- package/dist/logger-BY28acW-.d.ts +0 -16
- /package/dist/{rateLimit-ZMIZJUZF.js.map → rateLimit-5RKBFLUR.js.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { L as Logger } from './logger-
|
|
3
|
-
import { J as AnyContract, A as AccessLevel } from './infer-
|
|
4
|
-
import { P as Principal, T as Transport, a as McpContext, D as DbOf, c as PrincipalOf, M as MaybePromise } from './types-
|
|
5
|
-
import { A as AnyService, g as ServiceMethod, R as RowLevels, k as AccessFilter, d 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, e as FlushSink, q as AccessEngine } from './caller-
|
|
6
|
-
import { ad as Version, x as CallReply } from './envelope-
|
|
2
|
+
import { L as Logger } from './logger-Yz93KzdV.js';
|
|
3
|
+
import { J as AnyContract, A as AccessLevel } from './infer-BmoZsL9a.js';
|
|
4
|
+
import { P as Principal, T as Transport, a as McpContext, D as DbOf, c as PrincipalOf, M as MaybePromise } from './types-CYliTP65.js';
|
|
5
|
+
import { A as AnyService, g as ServiceMethod, R as RowLevels, k as AccessFilter, d 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, e as FlushSink, q as AccessEngine } from './caller-BT-Mv4bD.js';
|
|
6
|
+
import { ad as Version, x as CallReply } from './envelope-DzWyIXjj.js';
|
|
7
7
|
import { Q as QuickdrawError } from './errors-S-bxEIBC.js';
|
|
8
|
-
import { C as CallRecord } from './metrics-
|
|
9
|
-
import { S as ServerAuth } from './auth-
|
|
8
|
+
import { C as CallRecord } from './metrics-DW80Exve.js';
|
|
9
|
+
import { S as ServerAuth } from './auth-DXiSJZaf.js';
|
|
10
10
|
|
|
11
11
|
/** How one call ended. The dispatcher's `call` resolves with it and never rejects. */
|
|
12
12
|
type DispatchResult = {
|
|
@@ -144,11 +144,12 @@ type PrincipalOfServices<S extends readonly AnyService[]> = [S[number]] extends
|
|
|
144
144
|
/** The contracts the services of `S` were defined from. */
|
|
145
145
|
type ContractOfServices<S extends readonly AnyService[]> = [S[number]] extends [never] ? AnyContract : S[number]["contract"];
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
148
|
-
* handlers receive, plus the pipeline's seams and
|
|
149
|
-
* out only when the services declared no database
|
|
147
|
+
* The options `createDispatcher` and `createServer` share: the services and
|
|
148
|
+
* the database client handlers receive, plus the pipeline's seams and
|
|
149
|
+
* limits. `db` may be left out only when the services declared no database
|
|
150
|
+
* type.
|
|
150
151
|
*/
|
|
151
|
-
type
|
|
152
|
+
type DispatcherBaseOptions<S extends readonly AnyService[]> = PipelineOptions & {
|
|
152
153
|
/** The services to serve. Two services with one name are an error. */
|
|
153
154
|
readonly services: S;
|
|
154
155
|
} & (unknown extends DbOfServices<S> ? {
|
|
@@ -156,6 +157,23 @@ type DispatcherOptions<S extends readonly AnyService[]> = PipelineOptions & {
|
|
|
156
157
|
} : {
|
|
157
158
|
readonly db: DbOfServices<S>;
|
|
158
159
|
});
|
|
160
|
+
/** Options of {@link createDispatcher}: the shared ones, and where users' grants are stored. */
|
|
161
|
+
type DispatcherOptions<S extends readonly AnyService[]> = DispatcherBaseOptions<S> & {
|
|
162
|
+
/**
|
|
163
|
+
* Where users' service-wide grants are stored, as `{ model: "user",
|
|
164
|
+
* column: "serviceAccess" }`: the admin kit on that model treats the
|
|
165
|
+
* column as the grants field, whatever its name (hidden unless
|
|
166
|
+
* `grants: true`, and then for service-wide Admins only). `createServer`
|
|
167
|
+
* takes it as `auth.serviceAccessSource`, which also refreshes the grants
|
|
168
|
+
* it stores; a dispatcher made without `createServer` (an app that serves
|
|
169
|
+
* HTTP with `createHttpRouter`, an MCP process) names it here, or the
|
|
170
|
+
* column is an ordinary field there.
|
|
171
|
+
*/
|
|
172
|
+
readonly serviceAccessSource?: {
|
|
173
|
+
readonly model: string;
|
|
174
|
+
readonly column: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
159
177
|
/** `dispatcher.collections` and `qd.collections`: the services' collections (RFC 0003 section 7). */
|
|
160
178
|
interface DispatcherCollections {
|
|
161
179
|
/**
|
|
@@ -226,6 +244,16 @@ interface Dispatcher<S extends readonly AnyService[] = readonly AnyService[]> {
|
|
|
226
244
|
readonly registry: Registry;
|
|
227
245
|
/** The resolved limits, for a server to announce in `qd:hello`. */
|
|
228
246
|
readonly limits: DispatcherLimits;
|
|
247
|
+
/**
|
|
248
|
+
* Where users' service-wide grants are stored, as the dispatcher was made
|
|
249
|
+
* with it (`serviceAccessSource`, which `createServer` takes from
|
|
250
|
+
* `auth.serviceAccessSource`): the admin kit on that model treats the
|
|
251
|
+
* column as the grants field. `undefined` without one.
|
|
252
|
+
*/
|
|
253
|
+
readonly serviceAccessSource: {
|
|
254
|
+
readonly model: string;
|
|
255
|
+
readonly column: string;
|
|
256
|
+
} | undefined;
|
|
229
257
|
}
|
|
230
258
|
/**
|
|
231
259
|
* Creates a dispatcher for `services`.
|
|
@@ -257,6 +285,12 @@ interface VersionRequest {
|
|
|
257
285
|
* checked, for queries that declare no `version` of their own. It must take
|
|
258
286
|
* the version before any row is read, so a reply is never older than the
|
|
259
287
|
* version it claims.
|
|
288
|
+
*
|
|
289
|
+
* A version is a one-bit oracle: "not modified" comes before the handler
|
|
290
|
+
* runs, and tells the caller that what the version stands for exists and
|
|
291
|
+
* has not changed. Answer only for rows the method's access form let the
|
|
292
|
+
* caller read; the default answers for an `entry` form on `id`, a `rowless`
|
|
293
|
+
* method and a caller the service's `Admin` bypass passes.
|
|
260
294
|
*/
|
|
261
295
|
interface VersionSource {
|
|
262
296
|
versionOf(request: VersionRequest): MaybePromise<Version | undefined>;
|
|
@@ -334,7 +368,13 @@ type LimitsOptions = Partial<Omit<DispatcherLimits, "subscriptions">> & {
|
|
|
334
368
|
declare const DEFAULT_LIMITS: DispatcherLimits;
|
|
335
369
|
/** The pipeline's options: every seam and limit has a default. */
|
|
336
370
|
interface PipelineOptions extends TrackingOptions {
|
|
337
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* Receives one entry per call, and the original error of every `INTERNAL`
|
|
373
|
+
* failure; a Prisma error is summarized (class, code, `meta`, frames),
|
|
374
|
+
* never its message, which renders the call's values. Default: the
|
|
375
|
+
* console (`consoleLogger`), which drops `debug` when `NODE_ENV` is
|
|
376
|
+
* "production"; `createConsoleLogger({ level })` names another level.
|
|
377
|
+
*/
|
|
338
378
|
readonly logger?: Logger;
|
|
339
379
|
/**
|
|
340
380
|
* The access options (`{ cacheMs }`), or an engine of the app's own that
|
|
@@ -346,7 +386,11 @@ interface PipelineOptions extends TrackingOptions {
|
|
|
346
386
|
* Answers query versions for "not modified" replies, for queries that
|
|
347
387
|
* declare no `version` of their own. Default: the version of the row a
|
|
348
388
|
* query returns, for a query whose output is one projection row and whose
|
|
349
|
-
* input has an `id`: the service's `versionColumn`, or the change log
|
|
389
|
+
* input has an `id`: the service's `versionColumn`, or the change log;
|
|
390
|
+
* only when the method's form checked that row (an `entry` form on `id`, a
|
|
391
|
+
* `rowless` method, or the service's `Admin` bypass). A source of the
|
|
392
|
+
* app's own must answer only for rows the form let the caller read: a
|
|
393
|
+
* version is a one-bit oracle, answered before the handler runs.
|
|
350
394
|
*/
|
|
351
395
|
readonly versions?: VersionSource;
|
|
352
396
|
/**
|
|
@@ -406,7 +450,8 @@ interface HttpTransportOptions {
|
|
|
406
450
|
* the cookie a domain; else `"__Host-session"` on a request over HTTPS
|
|
407
451
|
* (`req.secure`, `X-Forwarded-Proto: https` or an `https:` `Origin`),
|
|
408
452
|
* which never reads the plain name a sibling site could plant, and
|
|
409
|
-
* `"session"`
|
|
453
|
+
* `"session"` on a plain HTTP one, where `"__Host-session"` is read first
|
|
454
|
+
* all the same. A name given
|
|
410
455
|
* here is the only one read, on any request. A name the request repeats
|
|
411
456
|
* counts as no cookie.
|
|
412
457
|
*/
|
|
@@ -423,8 +468,14 @@ interface HttpTransportOptions {
|
|
|
423
468
|
/** Options of {@link createHttpRouter}. */
|
|
424
469
|
interface HttpRouterOptions<P extends Principal = Principal> extends HttpTransportOptions {
|
|
425
470
|
/** The dispatcher whose methods the router serves. */
|
|
426
|
-
readonly dispatcher: Pick<Dispatcher, "call"
|
|
427
|
-
/**
|
|
471
|
+
readonly dispatcher: Pick<Dispatcher, "call"> & Partial<Pick<Dispatcher, "serviceAccessSource">>;
|
|
472
|
+
/**
|
|
473
|
+
* Authenticates each request, with the same hooks as `createServer`'s
|
|
474
|
+
* `auth`. Its `serviceAccessSource` must be the dispatcher's own (made
|
|
475
|
+
* with `createDispatcher({ serviceAccessSource })`), or the router throws:
|
|
476
|
+
* the admin kit protects the grants column only where the dispatcher
|
|
477
|
+
* names it.
|
|
478
|
+
*/
|
|
428
479
|
readonly auth?: ServerAuth<P>;
|
|
429
480
|
/** Default: the console. */
|
|
430
481
|
readonly logger?: Logger;
|
|
@@ -439,4 +490,4 @@ interface HttpRouterOptions<P extends Principal = Principal> extends HttpTranspo
|
|
|
439
490
|
*/
|
|
440
491
|
declare function createHttpRouter<P extends Principal = Principal>(options: HttpRouterOptions<P>): HttpRouter;
|
|
441
492
|
|
|
442
|
-
export { type AccessOptions as A, type ContractOfServices as C, type Dispatcher as D, type HttpRouter as H, type LimitsOptions as L, type PrincipalOfServices as P, type RegisteredMethod as R, type SharedData as S, type TrackingOptions as T, type VersionRequest as V, type
|
|
493
|
+
export { type AccessOptions as A, type ContractOfServices as C, type Dispatcher as D, type HttpRouter as H, type LimitsOptions as L, type PrincipalOfServices as P, type RegisteredMethod as R, type SharedData as S, type TrackingOptions as T, type VersionRequest as V, type DispatcherBaseOptions as a, type HttpTransportOptions as b, type DispatcherOptions as c, type DispatcherCollections as d, type ChangeLogOptions as e, createDispatcher as f, type DbOfServices as g, type Registry as h, type DispatchRequest as i, type DispatchResult as j, DEFAULT_LIMITS as k, type DispatcherLimits as l, type PipelineOptions as m, type SubscriptionLimits as n, type DispatcherAccess as o, type AccessChange as p, type AccessChangeListener as q, type VersionSource as r, createHttpRouter as s, toCallReply as t, type HttpMiddleware as u, type HttpRouterOptions as v };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
2
|
-
export { L as Logger, c as consoleLogger } from './logger-
|
|
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, 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-
|
|
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-
|
|
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-
|
|
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-BmoZsL9a.js';
|
|
2
|
+
export { C as ConsoleLoggerOptions, b as LogLevel, L as Logger, c as consoleLogger, a as createConsoleLogger } from './logger-Yz93KzdV.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-DWWrT1h6.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-D4bFKsrb.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-UDLn1049.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-DzWyIXjj.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.1.
|
|
10
|
+
declare const QUICKDRAW_VERSION = "5.1.2";
|
|
11
11
|
|
|
12
12
|
export { QUICKDRAW_VERSION };
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
SHARING_METHODS,
|
|
5
5
|
crud,
|
|
6
6
|
sharing
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NMXYENH4.js";
|
|
8
8
|
import {
|
|
9
9
|
isCallEnvelope,
|
|
10
10
|
isCancel
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RL4VKLBX.js";
|
|
12
12
|
import {
|
|
13
13
|
ADMIN_DEFAULT_PAGE_SIZE,
|
|
14
14
|
ADMIN_FIELD_TYPES,
|
|
@@ -29,9 +29,8 @@ import {
|
|
|
29
29
|
nullable,
|
|
30
30
|
query,
|
|
31
31
|
search
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-GKH3LJ7N.js";
|
|
33
33
|
import {
|
|
34
|
-
ACCESS_LEVELS,
|
|
35
34
|
CLIENT_EVENTS,
|
|
36
35
|
PROTOCOL_MISMATCH,
|
|
37
36
|
PROTOCOL_VERSION,
|
|
@@ -42,24 +41,30 @@ import {
|
|
|
42
41
|
collectionRoom,
|
|
43
42
|
collectionTopic,
|
|
44
43
|
entityRoom,
|
|
45
|
-
isAccessLevel,
|
|
46
44
|
isAuthenticationRefused,
|
|
47
45
|
isProtocolMismatch,
|
|
48
46
|
isQdHandshake,
|
|
49
47
|
reservedRoomPrefix,
|
|
48
|
+
socketIdShaped,
|
|
50
49
|
streamRoom,
|
|
51
50
|
topicRoom,
|
|
52
51
|
userRoom
|
|
53
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-753VJIUP.js";
|
|
54
53
|
import {
|
|
55
54
|
CHANNEL_DEFAULT_RATE,
|
|
56
|
-
DEFAULT_COLLECTION_LIMIT,
|
|
57
|
-
DEFAULT_COLLECTION_MAX_LIMIT,
|
|
58
55
|
GLOBAL_STREAM,
|
|
59
56
|
STREAM_MAX_SEED,
|
|
60
|
-
isScopedStream
|
|
57
|
+
isScopedStream
|
|
58
|
+
} from "./chunk-5CGO426C.js";
|
|
59
|
+
import {
|
|
60
|
+
DEFAULT_COLLECTION_LIMIT,
|
|
61
|
+
DEFAULT_COLLECTION_MAX_LIMIT,
|
|
61
62
|
via
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-4D2DOGAW.js";
|
|
64
|
+
import {
|
|
65
|
+
ACCESS_LEVELS,
|
|
66
|
+
isAccessLevel
|
|
67
|
+
} from "./chunk-AK23XSWD.js";
|
|
63
68
|
import {
|
|
64
69
|
TODO_SCHEMA_VENDOR,
|
|
65
70
|
hasJsonSchema,
|
|
@@ -68,8 +73,9 @@ import {
|
|
|
68
73
|
validate
|
|
69
74
|
} from "./chunk-47AEXVDM.js";
|
|
70
75
|
import {
|
|
71
|
-
consoleLogger
|
|
72
|
-
|
|
76
|
+
consoleLogger,
|
|
77
|
+
createConsoleLogger
|
|
78
|
+
} from "./chunk-DKE6QO26.js";
|
|
73
79
|
import {
|
|
74
80
|
ERROR_CODES,
|
|
75
81
|
QuickdrawError,
|
|
@@ -143,6 +149,9 @@ function checkMember(kind, name, value, schemaKey, keys, fail) {
|
|
|
143
149
|
}
|
|
144
150
|
return value;
|
|
145
151
|
}
|
|
152
|
+
function socketIdProblem(room) {
|
|
153
|
+
return `room "${room}" has the shape of a Socket.IO socket id (20 letters, digits, "_" or "-"), which ctx.rooms.join refuses: no socket is in it as an app room`;
|
|
154
|
+
}
|
|
146
155
|
function streamRoomProblem(access, scoped) {
|
|
147
156
|
const { room } = access;
|
|
148
157
|
if (Object.keys(access).length !== 1) {
|
|
@@ -151,12 +160,18 @@ function streamRoomProblem(access, scoped) {
|
|
|
151
160
|
if (typeof room === "function") {
|
|
152
161
|
return scoped ? void 0 : "a room computed from the scope needs a scoped stream";
|
|
153
162
|
}
|
|
163
|
+
if (scoped) {
|
|
164
|
+
return "a room for a scoped stream is a function of its scope, (scope) => room: a name or { prefix } admits a socket in that room to every scope";
|
|
165
|
+
}
|
|
154
166
|
const name = isRecord(room) && Object.keys(room).length === 1 ? room.prefix : room;
|
|
155
167
|
if (!isName(name) || name.length > MAX_ROOM_LENGTH) {
|
|
156
168
|
return `room must be an app room's name, { prefix } or a function of the scope, of 1 to ${MAX_ROOM_LENGTH} characters`;
|
|
157
169
|
}
|
|
158
170
|
const reserved = reservedRoomPrefix(name);
|
|
159
|
-
|
|
171
|
+
if (reserved !== void 0) {
|
|
172
|
+
return `room "${name}" is no app room: names starting with "${reserved}" are the framework's own rooms`;
|
|
173
|
+
}
|
|
174
|
+
return typeof room === "string" && socketIdShaped(room) ? socketIdProblem(room) : void 0;
|
|
160
175
|
}
|
|
161
176
|
function streamAccessProblem(access, scoped) {
|
|
162
177
|
if (access === "public" || access === "authenticated") {
|
|
@@ -255,6 +270,9 @@ function checkRoomRequirement(owner, form, fail) {
|
|
|
255
270
|
`${owner}: requires.room "${room}" is not an app room: names starting with "${prefix}" are the framework's own rooms, which ctx.rooms.join refuses`
|
|
256
271
|
);
|
|
257
272
|
}
|
|
273
|
+
if (socketIdShaped(room)) {
|
|
274
|
+
fail(`${owner}: requires.${socketIdProblem(room)}`);
|
|
275
|
+
}
|
|
258
276
|
}
|
|
259
277
|
function checkRequires(owner, requires, scope, fail) {
|
|
260
278
|
if (requires === void 0) {
|
|
@@ -627,6 +645,11 @@ function assembleContract(name, def) {
|
|
|
627
645
|
if (!isName2(name)) {
|
|
628
646
|
throw new TypeError("defineContract: the service name must be a non-empty string");
|
|
629
647
|
}
|
|
648
|
+
if (/[:@]/u.test(name)) {
|
|
649
|
+
throw new TypeError(
|
|
650
|
+
`defineContract("${name}"): the service name may not contain ":" or "@": it is part of every room name of the service (qd:e:{service}:{id}@{level}, qd:c:{service}:{collection}:{scope}), which must split one way only`
|
|
651
|
+
);
|
|
652
|
+
}
|
|
630
653
|
const fail = (message) => {
|
|
631
654
|
throw new TypeError(`defineContract("${name}"): ${message}`);
|
|
632
655
|
};
|
|
@@ -717,6 +740,7 @@ export {
|
|
|
717
740
|
collectionRoom,
|
|
718
741
|
collectionTopic,
|
|
719
742
|
consoleLogger,
|
|
743
|
+
createConsoleLogger,
|
|
720
744
|
crud,
|
|
721
745
|
defineContract,
|
|
722
746
|
entityRoom,
|