@m1212e/rumble 0.24.2 → 0.25.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/out/index.d.mts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { createRequire } from "node:module";
2
- import { GraphQLError, GraphQLSchema } from "graphql";
2
+ import { GraphQLError, GraphQLScalarType, GraphQLSchema } from "graphql";
3
3
  import { EnvelopArmorPlugin } from "@escape.tech/graphql-armor";
4
4
  import { Tracer } from "@opentelemetry/api";
5
5
  import { YogaServerOptions, createPubSub } from "graphql-yoga";
6
- import { Table } from "drizzle-orm";
6
+ import { One, SQL, Table } from "drizzle-orm";
7
7
  import { TracingWrapperOptions } from "@pothos/tracing-opentelemetry";
8
8
  import { PgAsyncDatabase } from "drizzle-orm/pg-core";
9
9
  import { MySqlAsyncDatabase } from "drizzle-orm/mysql-core";
10
10
  import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
11
11
  import SchemaBuilder from "@pothos/core";
12
+ import { PhoneNumber } from "libphonenumber-js";
12
13
  import { IncomingMessage, RequestListener, ServerResponse } from "node:http";
13
14
  import { Http2ServerRequest, Http2ServerResponse } from "node:http2";
14
15
  import { Socket } from "node:net";
@@ -171,6 +172,25 @@ type DrizzleQueryFunctionInput<DB extends DrizzleInstance, QueryField extends ke
171
172
  */
172
173
  type DrizzleTableValueType<DB extends DrizzleInstance, QueryField extends keyof DrizzleQueryFunction<DB>> = NonNullable<Awaited<ReturnType<DrizzleQueryFunction<DB>[QueryField]["findFirst"]>>>;
173
174
  //#endregion
175
+ //#region lib/abilityBuilder/queryFilter.d.ts
176
+ /**
177
+ * Static, non changing query filter input type for a specific table
178
+ */
179
+ type StaticQueryFilter<DB extends DrizzleInstance, Table extends keyof DrizzleQueryFunction<DB>, Filter extends DrizzleQueryFunctionInput<DB, Table>> = Filter;
180
+ /**
181
+ * Dynamic, context based query filter input type for a specific table
182
+ */
183
+ type DynamicQueryFilter<DB extends DrizzleInstance, Table extends keyof DrizzleQueryFunction<DB>, Filter extends DrizzleQueryFunctionInput<DB, Table>, Context> = (context: Context) => StaticQueryFilter<DB, Table, Filter> | undefined | "allow" | Promise<StaticQueryFilter<DB, Table, Filter> | undefined | "allow">;
184
+ /**
185
+ * Combined query filter type for a specific table. May be static or dynamic.
186
+ */
187
+ type QueryFilter<DB extends DrizzleInstance, Table extends keyof DrizzleQueryFunction<DB>, Filter extends DrizzleQueryFunctionInput<DB, Table>, Context> = StaticQueryFilter<DB, Table, Filter> | DynamicQueryFilter<DB, Table, Filter, Context>;
188
+ /**
189
+ * The query filters registered per action. "unrestricted" when a bare allow()
190
+ * granted the action without conditions.
191
+ */
192
+ type QueryFilterRegistry<UserContext extends Record<string, any>, DB extends DrizzleInstance, Action extends string, TableName extends keyof DrizzleQueryFunction<DB>> = Map<Action, QueryFilter<DB, TableName, DrizzleQueryFunctionInput<DB, TableName>, UserContext>[] | "unrestricted">;
193
+ //#endregion
174
194
  //#region lib/runtimeFiltersPlugin/filterTypes.d.ts
175
195
  type Prefetch<Context, ReturnType> = (params: {
176
196
  context: Context;
@@ -185,6 +205,240 @@ type FilterPrefetchCombo<Context, FilteredEntityType, PrefetchReturnType = never
185
205
  prefetch?: Prefetch<Context, PrefetchReturnType>;
186
206
  };
187
207
  //#endregion
208
+ //#region lib/types/rumbleInput.d.ts
209
+ interface RumbleLogger {
210
+ info(obj: Record<string, unknown>, msg: string): void;
211
+ warn(obj: Record<string, unknown>, msg: string): void;
212
+ error(obj: Record<string, unknown>, msg: string): void;
213
+ debug(obj: Record<string, unknown>, msg: string): void;
214
+ child(bindings: Record<string, unknown>): RumbleLogger;
215
+ }
216
+ type CustomRumblePothosConfig = Omit<ConstructorParameters<typeof SchemaBuilder>[0], "smartSubscriptions" | "drizzle" | "validation">;
217
+ type RumbleInput<UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, Action extends string, PothosConfig extends CustomRumblePothosConfig, Schema extends Record<string, any> = Record<string, any>> = {
218
+ /**
219
+ * Your drizzle database instance
220
+ */
221
+ db: DB;
222
+ /**
223
+ * The drizzle schema object (the same one passed to `defineRelations`).
224
+ */
225
+ schema: Schema;
226
+ /**
227
+ * A function for providing context for each request based on the incoming HTTP Request.
228
+ * The type of the parameter equals the HTTPRequest type of your chosen server.
229
+ */
230
+ context?: ((event: RequestEvent) => Promise<UserContext> | UserContext) | undefined;
231
+ /**
232
+ * The actions that are available
233
+ */
234
+ actions?: Action[];
235
+ /**
236
+ * Customization for subscriptions. See https://the-guild.dev/graphql/yoga-server/docs/features/subscriptions#distributed-pubsub-for-production
237
+ */
238
+ subscriptions?: Parameters<typeof createPubSub>;
239
+ /**
240
+ * Options passed along to the pothos schema builder.
241
+ */
242
+ pothosConfig?: PothosConfig;
243
+ /**
244
+ * Limits the returned amount when querying lists. Set to null to disable.
245
+ * @default 100
246
+ */
247
+ defaultLimit?: number | undefined | null;
248
+ /**
249
+ * rumble supports fuzzy search for the query helpers. This enables the users of your API to search for entities via fuzzy search inputs.
250
+ * This currently only is supported by postgres databases and will fail if enabled on other dialects.
251
+ *
252
+ * Please note that this will install the pg_trgm extension on startup if your database does not have it already installed.
253
+ * https://www.postgresql.org/docs/current/pgtrgm.html
254
+ */
255
+ search?: {
256
+ /**
257
+ * Whether search is enabled
258
+ */
259
+ enabled?: boolean;
260
+ /**
261
+ * The cuttoff factor to reduce the amount of returned results.
262
+ * Defaults to 0.3. Lower values will return more results.
263
+ */
264
+ threshold?: number;
265
+ /**
266
+ * Will perform a local
267
+ * SET cpu_operator_cost = x;
268
+ * for search queries. This can help to make the planner
269
+ * use a potential index scan instead of a sequential scan.
270
+ * This will not affect queries that are not using the search feature.
271
+ */
272
+ cpu_operator_cost?: number;
273
+ } | undefined;
274
+ /**
275
+ * rumble can set up otel tracing if you want to. This will provide details of execution time and outcome to the provided tracer. See https://pothos-graphql.dev/docs/plugins/tracing#install for more information.
276
+ *
277
+ * The emitted spans and attributes are identical for every transport, so an
278
+ * operation served via GraphQL, the SOFA REST adapter or WebSockets produces
279
+ * the same trace shape (see `rumble.transport` to tell them apart).
280
+ */
281
+ otel?: {
282
+ /**
283
+ * Whether otel tracing should be enabled. This will create a tracer if none is provided.
284
+ */
285
+ enabled?: boolean;
286
+ /**
287
+ * The tracer to use. If enabled is true and no tracer is provided, a tracer will be created.
288
+ */
289
+ tracer?: Tracer;
290
+ /**
291
+ * You can pass options to the tracing wrapper
292
+ */
293
+ options?: TracingWrapperOptions<unknown>;
294
+ /**
295
+ * Whether the operation source is attached to operation spans as
296
+ * `graphql.document`.
297
+ *
298
+ * Keep in mind that a document can carry inline argument literals, so this
299
+ * may contain user data.
300
+ * @default true
301
+ */
302
+ includeDocument?: boolean;
303
+ /**
304
+ * Whether the incoming operation variables are attached to operation spans
305
+ * as `graphql.variables.<name>` attributes.
306
+ *
307
+ * Variables regularly carry personal data, so you can turn this off
308
+ * entirely (`false`) or pass a function to redact or drop single entries
309
+ * before they leave the process.
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * otel: {
314
+ * enabled: true,
315
+ * includeVariables: ({ password, ...rest }) => rest,
316
+ * }
317
+ * ```
318
+ * @default true
319
+ */
320
+ includeVariables?: boolean | ((variables: Record<string, unknown>) => Record<string, unknown> | undefined);
321
+ };
322
+ /**
323
+ * Structured logging for rumble internals. Pass a pino (or compatible) logger instance.
324
+ * When enabled, rumble emits structured log entries for GraphQL operations, ability checks,
325
+ * and runtime filter applications — queryable by level and field in Loki or similar.
326
+ */
327
+ logger?: {
328
+ /**
329
+ * Whether structured logging should be enabled.
330
+ */
331
+ enabled?: boolean;
332
+ /**
333
+ * The logger instance to use. Must satisfy the RumbleLogger interface (pino satisfies this).
334
+ */
335
+ logger: RumbleLogger;
336
+ /**
337
+ * When both logger and otel are enabled, inject `trace_id`, `span_id` and `trace_flags`
338
+ * fields into every log entry emitted during a GraphQL operation. Useful for correlating
339
+ * log lines with traces in backends like Jaeger or Grafana Tempo.
340
+ * @default true
341
+ */
342
+ injectTraceId?: boolean;
343
+ /**
344
+ * Whether the incoming operation variables are attached to the operation
345
+ * start log entry as a `graphql.variables` object.
346
+ *
347
+ * Variables regularly carry personal data, so you can turn this off
348
+ * entirely (`false`) or pass a function to redact or drop single entries
349
+ * before they are logged.
350
+ *
351
+ * @example
352
+ * ```ts
353
+ * logger: {
354
+ * enabled: true,
355
+ * logger: pino(),
356
+ * includeVariables: ({ password, ...rest }) => rest,
357
+ * }
358
+ * ```
359
+ * @default true
360
+ */
361
+ includeVariables?: boolean | ((variables: Record<string, unknown>) => Record<string, unknown> | undefined);
362
+ };
363
+ /**
364
+ * Configures `@pothos/plugin-validation`, which rumble installs by default to power
365
+ * `Address`/`AddressInput`'s country-aware validation (see `implementDefaultAddressTypes`).
366
+ */
367
+ validation?: NonNullable<ConstructorParameters<typeof SchemaBuilder>[0]>["validation"];
368
+ };
369
+ //#endregion
370
+ //#region lib/abilityBuilder/columnMask.d.ts
371
+ type MaskColumnsInput<DB extends DrizzleInstance, Action extends string> = {
372
+ table: TableRelationNames<DB>;
373
+ action: Action;
374
+ abilities: Record<string, any>;
375
+ entities: unknown[];
376
+ };
377
+ //#endregion
378
+ //#region lib/abilityBuilder/filterResponse.d.ts
379
+ type FindFirstConfig<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = NonNullable<Parameters<DB["query"][TableName]["findFirst"]>[0]>;
380
+ type FindManyConfig<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = NonNullable<Parameters<DB["query"][TableName]["findMany"]>[0]>;
381
+ /**
382
+ * The query filters of an ability, as handed out by
383
+ * `abilities.<table>.filter(...)`.
384
+ *
385
+ * `columns` and `extras` are set at runtime but left out of the types on
386
+ * purpose: a visible, loosely typed extras makes drizzle infer `{}` as the row
387
+ * type of findFirst/findMany, and the column flag is an internal detail anyway.
388
+ */
389
+ type AbilityFilter<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = {
390
+ /**
391
+ * Query filters for the drizzle query API.
392
+ * @example
393
+ * ```ts
394
+ * author: t.relation("author", {
395
+ * query: async (_args, ctx) => (await ctx.abilities.users.filter("read")).query.single,
396
+ * }),
397
+ * ```
398
+ */
399
+ query: {
400
+ /**
401
+ * For find first calls
402
+ */
403
+ single: Pick<FindFirstConfig<DB, TableName>, "where">;
404
+ /**
405
+ * For find many calls
406
+ */
407
+ many: Pick<FindManyConfig<DB, TableName>, "where" | "limit">;
408
+ };
409
+ /**
410
+ * Query filters for the drizzle SQL API as used in e.g. updates.
411
+ * @example
412
+ *
413
+ * ```ts
414
+ * await db
415
+ * .update(schema.users)
416
+ * .set({
417
+ * name: args.newName,
418
+ * })
419
+ * .where(
420
+ * and(
421
+ * eq(schema.users.id, args.userId),
422
+ * (await ctx.abilities.users.filter("update")).sql.where,
423
+ * ),
424
+ * );
425
+ * ```
426
+ *
427
+ */
428
+ sql: {
429
+ readonly where: SQL | undefined;
430
+ };
431
+ };
432
+ /**
433
+ * What `abilities.<table>.filter(...)` resolves to.
434
+ */
435
+ type AbilityFilterResponse<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = AbilityFilter<DB, TableName> & {
436
+ /**
437
+ * Merges the current query filters with the provided filters for this call only
438
+ */
439
+ merge: (filters: NonNullable<DrizzleQueryFunctionInput<DB, TableName>>) => AbilityFilter<DB, TableName>;
440
+ };
441
+ //#endregion
188
442
  //#region lib/scalars/address.d.ts
189
443
  /**
190
444
  * The shape of a postal address, modeled after the OIDC `address` claim
@@ -4402,168 +4656,6 @@ type RouteWithTypesOpts<TServerContext, TMethod extends HTTPMethod, TPath extend
4402
4656
  };
4403
4657
  type ExtractPathParamsWithPattern<TPath extends string> = Pipe<TPath, [Strings.Split<'/'>, Tuples.Filter<Strings.StartsWith<':'>>, Tuples.Map<Strings.Trim<':'>>, Tuples.ToUnion]>;
4404
4658
  //#endregion
4405
- //#region lib/types/rumbleInput.d.ts
4406
- interface RumbleLogger {
4407
- info(obj: Record<string, unknown>, msg: string): void;
4408
- warn(obj: Record<string, unknown>, msg: string): void;
4409
- error(obj: Record<string, unknown>, msg: string): void;
4410
- debug(obj: Record<string, unknown>, msg: string): void;
4411
- child(bindings: Record<string, unknown>): RumbleLogger;
4412
- }
4413
- type CustomRumblePothosConfig = Omit<ConstructorParameters<typeof SchemaBuilder>[0], "smartSubscriptions" | "drizzle" | "validation">;
4414
- type RumbleInput<UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, Action extends string, PothosConfig extends CustomRumblePothosConfig, Schema extends Record<string, any> = Record<string, any>> = {
4415
- /**
4416
- * Your drizzle database instance
4417
- */
4418
- db: DB;
4419
- /**
4420
- * The drizzle schema object (the same one passed to `defineRelations`).
4421
- */
4422
- schema: Schema;
4423
- /**
4424
- * A function for providing context for each request based on the incoming HTTP Request.
4425
- * The type of the parameter equals the HTTPRequest type of your chosen server.
4426
- */
4427
- context?: ((event: RequestEvent) => Promise<UserContext> | UserContext) | undefined;
4428
- /**
4429
- * The actions that are available
4430
- */
4431
- actions?: Action[];
4432
- /**
4433
- * Customization for subscriptions. See https://the-guild.dev/graphql/yoga-server/docs/features/subscriptions#distributed-pubsub-for-production
4434
- */
4435
- subscriptions?: Parameters<typeof createPubSub>;
4436
- /**
4437
- * Options passed along to the pothos schema builder.
4438
- */
4439
- pothosConfig?: PothosConfig;
4440
- /**
4441
- * Limits the returned amount when querying lists. Set to null to disable.
4442
- * @default 100
4443
- */
4444
- defaultLimit?: number | undefined | null;
4445
- /**
4446
- * rumble supports fuzzy search for the query helpers. This enables the users of your API to search for entities via fuzzy search inputs.
4447
- * This currently only is supported by postgres databases and will fail if enabled on other dialects.
4448
- *
4449
- * Please note that this will install the pg_trgm extension on startup if your database does not have it already installed.
4450
- * https://www.postgresql.org/docs/current/pgtrgm.html
4451
- */
4452
- search?: {
4453
- /**
4454
- * Whether search is enabled
4455
- */
4456
- enabled?: boolean;
4457
- /**
4458
- * The cuttoff factor to reduce the amount of returned results.
4459
- * Defaults to 0.3. Lower values will return more results.
4460
- */
4461
- threshold?: number;
4462
- /**
4463
- * Will perform a local
4464
- * SET cpu_operator_cost = x;
4465
- * for search queries. This can help to make the planner
4466
- * use a potential index scan instead of a sequential scan.
4467
- * This will not affect queries that are not using the search feature.
4468
- */
4469
- cpu_operator_cost?: number;
4470
- } | undefined;
4471
- /**
4472
- * rumble can set up otel tracing if you want to. This will provide details of execution time and outcome to the provided tracer. See https://pothos-graphql.dev/docs/plugins/tracing#install for more information.
4473
- *
4474
- * The emitted spans and attributes are identical for every transport, so an
4475
- * operation served via GraphQL, the SOFA REST adapter or WebSockets produces
4476
- * the same trace shape (see `rumble.transport` to tell them apart).
4477
- */
4478
- otel?: {
4479
- /**
4480
- * Whether otel tracing should be enabled. This will create a tracer if none is provided.
4481
- */
4482
- enabled?: boolean;
4483
- /**
4484
- * The tracer to use. If enabled is true and no tracer is provided, a tracer will be created.
4485
- */
4486
- tracer?: Tracer;
4487
- /**
4488
- * You can pass options to the tracing wrapper
4489
- */
4490
- options?: TracingWrapperOptions<unknown>;
4491
- /**
4492
- * Whether the operation source is attached to operation spans as
4493
- * `graphql.document`.
4494
- *
4495
- * Keep in mind that a document can carry inline argument literals, so this
4496
- * may contain user data.
4497
- * @default true
4498
- */
4499
- includeDocument?: boolean;
4500
- /**
4501
- * Whether the incoming operation variables are attached to operation spans
4502
- * as `graphql.variables.<name>` attributes.
4503
- *
4504
- * Variables regularly carry personal data, so you can turn this off
4505
- * entirely (`false`) or pass a function to redact or drop single entries
4506
- * before they leave the process.
4507
- *
4508
- * @example
4509
- * ```ts
4510
- * otel: {
4511
- * enabled: true,
4512
- * includeVariables: ({ password, ...rest }) => rest,
4513
- * }
4514
- * ```
4515
- * @default true
4516
- */
4517
- includeVariables?: boolean | ((variables: Record<string, unknown>) => Record<string, unknown> | undefined);
4518
- };
4519
- /**
4520
- * Structured logging for rumble internals. Pass a pino (or compatible) logger instance.
4521
- * When enabled, rumble emits structured log entries for GraphQL operations, ability checks,
4522
- * and runtime filter applications — queryable by level and field in Loki or similar.
4523
- */
4524
- logger?: {
4525
- /**
4526
- * Whether structured logging should be enabled.
4527
- */
4528
- enabled?: boolean;
4529
- /**
4530
- * The logger instance to use. Must satisfy the RumbleLogger interface (pino satisfies this).
4531
- */
4532
- logger: RumbleLogger;
4533
- /**
4534
- * When both logger and otel are enabled, inject `trace_id`, `span_id` and `trace_flags`
4535
- * fields into every log entry emitted during a GraphQL operation. Useful for correlating
4536
- * log lines with traces in backends like Jaeger or Grafana Tempo.
4537
- * @default true
4538
- */
4539
- injectTraceId?: boolean;
4540
- /**
4541
- * Whether the incoming operation variables are attached to the operation
4542
- * start log entry as a `graphql.variables` object.
4543
- *
4544
- * Variables regularly carry personal data, so you can turn this off
4545
- * entirely (`false`) or pass a function to redact or drop single entries
4546
- * before they are logged.
4547
- *
4548
- * @example
4549
- * ```ts
4550
- * logger: {
4551
- * enabled: true,
4552
- * logger: pino(),
4553
- * includeVariables: ({ password, ...rest }) => rest,
4554
- * }
4555
- * ```
4556
- * @default true
4557
- */
4558
- includeVariables?: boolean | ((variables: Record<string, unknown>) => Record<string, unknown> | undefined);
4559
- };
4560
- /**
4561
- * Configures `@pothos/plugin-validation`, which rumble installs by default to power
4562
- * `Address`/`AddressInput`'s country-aware validation (see `implementDefaultAddressTypes`).
4563
- */
4564
- validation?: NonNullable<ConstructorParameters<typeof SchemaBuilder>[0]>["validation"];
4565
- };
4566
- //#endregion
4567
4659
  //#region lib/rumble.d.ts
4568
4660
  export declare const rumble: <UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, PothosConfig extends CustomRumblePothosConfig, Schema extends Record<string, any>, Action extends string = "delete" | "read" | "update">(rumbleInput: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {
4569
4661
  schema: Schema;
@@ -4586,44 +4678,31 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
4586
4678
  */
4587
4679
  abilityBuilder: { [key in TableRelationNames<DB>]: {
4588
4680
  allow: (action: Action | Action[]) => {
4589
- when: (queryFilter: ((context: UserContext) => "allow" | Promise<"allow" | DrizzleQueryFunctionInput<DB, key> | undefined> | DrizzleQueryFunctionInput<DB, key> | undefined) | DrizzleQueryFunctionInput<DB, key>) => void;
4681
+ when: (queryFilter: QueryFilter<DB, key, DrizzleQueryFunctionInput<DB, key>, UserContext>) => void;
4590
4682
  };
4591
4683
  filter: (action: Action | Action[]) => {
4684
+ by: (explicitFilter: Filter<UserContext, DrizzleTableValueType<DB, key>, never>) => void;
4592
4685
  prefetch: <PrefetchReturnType>(prefetch: Prefetch<UserContext, PrefetchReturnType>) => {
4593
4686
  by: (explicitFilter: Filter<UserContext, DrizzleTableValueType<DB, key>, PrefetchReturnType>) => void;
4594
4687
  };
4595
- by: (explicitFilter: Filter<UserContext, DrizzleTableValueType<DB, key>>) => void;
4596
4688
  };
4597
4689
  _: {
4598
4690
  runtimeFilters: Map<Action, FilterPrefetchCombo<UserContext, any, any>[]>;
4599
- queryFilters: Map<Action, "unrestricted" | (((context: UserContext) => "allow" | Promise<"allow" | DrizzleQueryFunctionInput<DB, key> | undefined> | DrizzleQueryFunctionInput<DB, key> | undefined) | DrizzleQueryFunctionInput<DB, key>)[]>;
4691
+ queryFilters: QueryFilterRegistry<UserContext, DB, Action, key>;
4600
4692
  };
4601
4693
  }; } & {
4602
4694
  _: {
4695
+ maskColumns: (input: MaskColumnsInput<DB, Action>) => void | Promise<void>;
4696
+ maskedActions: (abilities: object, table: TableRelationNames<DB>) => Set<Action>;
4697
+ primaryKeyHidden: (abilities: object, row: object) => boolean;
4698
+ registerReadAction(table: TableRelationNames<DB>, action: Action): void;
4699
+ readActionOf(table: TableRelationNames<DB>): Action;
4603
4700
  registeredFilters({ action, table }: {
4604
4701
  table: TableRelationNames<DB>;
4605
4702
  action: Action;
4606
4703
  }): Filter<UserContext, DrizzleTableValueType<DB, TableRelationNames<DB>>>[];
4607
4704
  build(): (ctx: UserContext) => { [key in TableRelationNames<DB>]: {
4608
- filter: (action: Action) => Promise<{
4609
- query: {
4610
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4611
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4612
- };
4613
- sql: {
4614
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4615
- };
4616
- } & {
4617
- merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key>>) => {
4618
- query: {
4619
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4620
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4621
- };
4622
- sql: {
4623
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4624
- };
4625
- };
4626
- }>;
4705
+ filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
4627
4706
  }; };
4628
4707
  };
4629
4708
  };
@@ -4633,25 +4712,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
4633
4712
  schemaBuilder: PothosSchemaTypes.SchemaBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
4634
4713
  Context: Awaited<UserContext & {
4635
4714
  abilities: { [key in TableRelationNames<DB>]: {
4636
- filter: (action: Action) => Promise<{
4637
- query: {
4638
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4639
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4640
- };
4641
- sql: {
4642
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4643
- };
4644
- } & {
4645
- merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key>>) => {
4646
- query: {
4647
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4648
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4649
- };
4650
- sql: {
4651
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4652
- };
4653
- };
4654
- }>;
4715
+ filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
4655
4716
  }; };
4656
4717
  }>;
4657
4718
  DrizzleRelations: DB["_"]["relations"];
@@ -4791,25 +4852,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
4791
4852
  adjust?: ((t: import("@pothos/plugin-drizzle").DrizzleObjectFieldBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
4792
4853
  Context: Awaited<UserContext & {
4793
4854
  abilities: { [key in TableRelationNames<DB>]: {
4794
- filter: (action: Action) => Promise<{
4795
- query: {
4796
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4797
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4798
- };
4799
- sql: {
4800
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4801
- };
4802
- } & {
4803
- merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key>>) => {
4804
- query: {
4805
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4806
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4807
- };
4808
- sql: {
4809
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4810
- };
4811
- };
4812
- }>;
4855
+ filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
4813
4856
  }; };
4814
4857
  }>;
4815
4858
  DrizzleRelations: DB["_"]["relations"];
@@ -4888,25 +4931,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
4888
4931
  }) => import("@pothos/plugin-drizzle").DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
4889
4932
  Context: Awaited<UserContext & {
4890
4933
  abilities: { [key in TableRelationNames<DB>]: {
4891
- filter: (action: Action) => Promise<{
4892
- query: {
4893
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4894
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4895
- };
4896
- sql: {
4897
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4898
- };
4899
- } & {
4900
- merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key>>) => {
4901
- query: {
4902
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
4903
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
4904
- };
4905
- sql: {
4906
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4907
- };
4908
- };
4909
- }>;
4934
+ filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
4910
4935
  }; };
4911
4936
  }>;
4912
4937
  DrizzleRelations: DB["_"]["relations"];
@@ -4996,25 +5021,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
4996
5021
  })) => PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
4997
5022
  Context: Awaited<UserContext & {
4998
5023
  abilities: { [key in TableRelationNames<DB>]: {
4999
- filter: (action: Action) => Promise<{
5000
- query: {
5001
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
5002
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
5003
- };
5004
- sql: {
5005
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
5006
- };
5007
- } & {
5008
- merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key>>) => {
5009
- query: {
5010
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
5011
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
5012
- };
5013
- sql: {
5014
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
5015
- };
5016
- };
5017
- }>;
5024
+ filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
5018
5025
  }; };
5019
5026
  }>;
5020
5027
  DrizzleRelations: DB["_"]["relations"];
@@ -5134,25 +5141,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
5134
5141
  })) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
5135
5142
  Context: Awaited<UserContext & {
5136
5143
  abilities: { [key in TableRelationNames<DB>]: {
5137
- filter: (action: Action) => Promise<{
5138
- query: {
5139
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
5140
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
5141
- };
5142
- sql: {
5143
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
5144
- };
5145
- } & {
5146
- merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key>>) => {
5147
- query: {
5148
- single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findFirst"]>[0]>>, "where">;
5149
- many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key]["findMany"]>[0]>>, "limit" | "where">;
5150
- };
5151
- sql: {
5152
- readonly where: import("drizzle-orm").SQL<unknown> | undefined;
5153
- };
5154
- };
5155
- }>;
5144
+ filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
5156
5145
  }; };
5157
5146
  }>;
5158
5147
  DrizzleRelations: DB["_"]["relations"];
@@ -5245,6 +5234,36 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
5245
5234
  buildSchema: () => GraphQLSchema;
5246
5235
  };
5247
5236
  //#endregion
5237
+ //#region lib/scalars/emailAddress.d.ts
5238
+ /**
5239
+ * Validates an email address using graphql-scalars' own format check, then lowercases it, exactly
5240
+ * as the `EmailAddress` scalar does. Exported for values that do not arrive as GraphQL input,
5241
+ * such as OIDC claims.
5242
+ *
5243
+ * @throws RumbleErrorSafe if the value is not a valid email address
5244
+ */
5245
+ export declare const normalizeEmailAddress: (value: unknown) => string;
5246
+ //#endregion
5247
+ //#region lib/scalars/personName.d.ts
5248
+ /**
5249
+ * Normalizes and validates a person's name, exactly as the `PersonName` scalar does. Exported
5250
+ * for values that do not arrive as GraphQL input, such as OIDC claims.
5251
+ *
5252
+ * @throws RumbleErrorSafe if the value is not a valid name
5253
+ */
5254
+ export declare const normalizePersonName: (value: unknown) => string;
5255
+ //#endregion
5256
+ //#region lib/scalars/phoneNumber.d.ts
5257
+ /**
5258
+ * Parses and validates a phone number using libphonenumber-js (Google's phone number metadata),
5259
+ * which checks real per-country validity (length, area code plausibility, ...) rather than just
5260
+ * the E.164 shape. This is what the `PhoneNumber` scalar does with its input; exported for values
5261
+ * that do not arrive as GraphQL input. `.number` of the result is the E.164 form.
5262
+ *
5263
+ * @throws RumbleErrorSafe if the value is not a valid phone number
5264
+ */
5265
+ export declare const parsePhoneNumber: (value: unknown) => PhoneNumber;
5266
+ //#endregion
5248
5267
  //#region lib/types/rumbleError.d.ts
5249
5268
  /**
5250
5269
  * An error that gets raised by rumble whenever something does not go according to plan.