@m1212e/rumble 0.24.2 → 0.25.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/out/client.cjs +54 -50
- package/out/client.cjs.map +1 -1
- package/out/client.d.cts.map +1 -1
- package/out/client.d.mts.map +1 -1
- package/out/client.mjs +54 -50
- package/out/client.mjs.map +1 -1
- package/out/index.cjs +803 -473
- package/out/index.cjs.map +1 -1
- package/out/index.d.cts +272 -284
- package/out/index.d.cts.map +1 -1
- package/out/index.d.mts +268 -280
- package/out/index.d.mts.map +1 -1
- package/out/index.mjs +808 -478
- package/out/index.mjs.map +1 -1
- package/package.json +9 -8
package/out/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { GraphQLError, 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";
|
|
@@ -171,6 +171,25 @@ type DrizzleQueryFunctionInput<DB extends DrizzleInstance, QueryField extends ke
|
|
|
171
171
|
*/
|
|
172
172
|
type DrizzleTableValueType<DB extends DrizzleInstance, QueryField extends keyof DrizzleQueryFunction<DB>> = NonNullable<Awaited<ReturnType<DrizzleQueryFunction<DB>[QueryField]["findFirst"]>>>;
|
|
173
173
|
//#endregion
|
|
174
|
+
//#region lib/abilityBuilder/queryFilter.d.ts
|
|
175
|
+
/**
|
|
176
|
+
* Static, non changing query filter input type for a specific table
|
|
177
|
+
*/
|
|
178
|
+
type StaticQueryFilter<DB extends DrizzleInstance, Table extends keyof DrizzleQueryFunction<DB>, Filter extends DrizzleQueryFunctionInput<DB, Table>> = Filter;
|
|
179
|
+
/**
|
|
180
|
+
* Dynamic, context based query filter input type for a specific table
|
|
181
|
+
*/
|
|
182
|
+
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">;
|
|
183
|
+
/**
|
|
184
|
+
* Combined query filter type for a specific table. May be static or dynamic.
|
|
185
|
+
*/
|
|
186
|
+
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>;
|
|
187
|
+
/**
|
|
188
|
+
* The query filters registered per action. "unrestricted" when a bare allow()
|
|
189
|
+
* granted the action without conditions.
|
|
190
|
+
*/
|
|
191
|
+
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">;
|
|
192
|
+
//#endregion
|
|
174
193
|
//#region lib/runtimeFiltersPlugin/filterTypes.d.ts
|
|
175
194
|
type Prefetch<Context, ReturnType> = (params: {
|
|
176
195
|
context: Context;
|
|
@@ -185,6 +204,240 @@ type FilterPrefetchCombo<Context, FilteredEntityType, PrefetchReturnType = never
|
|
|
185
204
|
prefetch?: Prefetch<Context, PrefetchReturnType>;
|
|
186
205
|
};
|
|
187
206
|
//#endregion
|
|
207
|
+
//#region lib/types/rumbleInput.d.ts
|
|
208
|
+
interface RumbleLogger {
|
|
209
|
+
info(obj: Record<string, unknown>, msg: string): void;
|
|
210
|
+
warn(obj: Record<string, unknown>, msg: string): void;
|
|
211
|
+
error(obj: Record<string, unknown>, msg: string): void;
|
|
212
|
+
debug(obj: Record<string, unknown>, msg: string): void;
|
|
213
|
+
child(bindings: Record<string, unknown>): RumbleLogger;
|
|
214
|
+
}
|
|
215
|
+
type CustomRumblePothosConfig = Omit<ConstructorParameters<typeof SchemaBuilder>[0], "smartSubscriptions" | "drizzle" | "validation">;
|
|
216
|
+
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>> = {
|
|
217
|
+
/**
|
|
218
|
+
* Your drizzle database instance
|
|
219
|
+
*/
|
|
220
|
+
db: DB;
|
|
221
|
+
/**
|
|
222
|
+
* The drizzle schema object (the same one passed to `defineRelations`).
|
|
223
|
+
*/
|
|
224
|
+
schema: Schema;
|
|
225
|
+
/**
|
|
226
|
+
* A function for providing context for each request based on the incoming HTTP Request.
|
|
227
|
+
* The type of the parameter equals the HTTPRequest type of your chosen server.
|
|
228
|
+
*/
|
|
229
|
+
context?: ((event: RequestEvent) => Promise<UserContext> | UserContext) | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* The actions that are available
|
|
232
|
+
*/
|
|
233
|
+
actions?: Action[];
|
|
234
|
+
/**
|
|
235
|
+
* Customization for subscriptions. See https://the-guild.dev/graphql/yoga-server/docs/features/subscriptions#distributed-pubsub-for-production
|
|
236
|
+
*/
|
|
237
|
+
subscriptions?: Parameters<typeof createPubSub>;
|
|
238
|
+
/**
|
|
239
|
+
* Options passed along to the pothos schema builder.
|
|
240
|
+
*/
|
|
241
|
+
pothosConfig?: PothosConfig;
|
|
242
|
+
/**
|
|
243
|
+
* Limits the returned amount when querying lists. Set to null to disable.
|
|
244
|
+
* @default 100
|
|
245
|
+
*/
|
|
246
|
+
defaultLimit?: number | undefined | null;
|
|
247
|
+
/**
|
|
248
|
+
* rumble supports fuzzy search for the query helpers. This enables the users of your API to search for entities via fuzzy search inputs.
|
|
249
|
+
* This currently only is supported by postgres databases and will fail if enabled on other dialects.
|
|
250
|
+
*
|
|
251
|
+
* Please note that this will install the pg_trgm extension on startup if your database does not have it already installed.
|
|
252
|
+
* https://www.postgresql.org/docs/current/pgtrgm.html
|
|
253
|
+
*/
|
|
254
|
+
search?: {
|
|
255
|
+
/**
|
|
256
|
+
* Whether search is enabled
|
|
257
|
+
*/
|
|
258
|
+
enabled?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The cuttoff factor to reduce the amount of returned results.
|
|
261
|
+
* Defaults to 0.3. Lower values will return more results.
|
|
262
|
+
*/
|
|
263
|
+
threshold?: number;
|
|
264
|
+
/**
|
|
265
|
+
* Will perform a local
|
|
266
|
+
* SET cpu_operator_cost = x;
|
|
267
|
+
* for search queries. This can help to make the planner
|
|
268
|
+
* use a potential index scan instead of a sequential scan.
|
|
269
|
+
* This will not affect queries that are not using the search feature.
|
|
270
|
+
*/
|
|
271
|
+
cpu_operator_cost?: number;
|
|
272
|
+
} | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* 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.
|
|
275
|
+
*
|
|
276
|
+
* The emitted spans and attributes are identical for every transport, so an
|
|
277
|
+
* operation served via GraphQL, the SOFA REST adapter or WebSockets produces
|
|
278
|
+
* the same trace shape (see `rumble.transport` to tell them apart).
|
|
279
|
+
*/
|
|
280
|
+
otel?: {
|
|
281
|
+
/**
|
|
282
|
+
* Whether otel tracing should be enabled. This will create a tracer if none is provided.
|
|
283
|
+
*/
|
|
284
|
+
enabled?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* The tracer to use. If enabled is true and no tracer is provided, a tracer will be created.
|
|
287
|
+
*/
|
|
288
|
+
tracer?: Tracer;
|
|
289
|
+
/**
|
|
290
|
+
* You can pass options to the tracing wrapper
|
|
291
|
+
*/
|
|
292
|
+
options?: TracingWrapperOptions<unknown>;
|
|
293
|
+
/**
|
|
294
|
+
* Whether the operation source is attached to operation spans as
|
|
295
|
+
* `graphql.document`.
|
|
296
|
+
*
|
|
297
|
+
* Keep in mind that a document can carry inline argument literals, so this
|
|
298
|
+
* may contain user data.
|
|
299
|
+
* @default true
|
|
300
|
+
*/
|
|
301
|
+
includeDocument?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Whether the incoming operation variables are attached to operation spans
|
|
304
|
+
* as `graphql.variables.<name>` attributes.
|
|
305
|
+
*
|
|
306
|
+
* Variables regularly carry personal data, so you can turn this off
|
|
307
|
+
* entirely (`false`) or pass a function to redact or drop single entries
|
|
308
|
+
* before they leave the process.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* otel: {
|
|
313
|
+
* enabled: true,
|
|
314
|
+
* includeVariables: ({ password, ...rest }) => rest,
|
|
315
|
+
* }
|
|
316
|
+
* ```
|
|
317
|
+
* @default true
|
|
318
|
+
*/
|
|
319
|
+
includeVariables?: boolean | ((variables: Record<string, unknown>) => Record<string, unknown> | undefined);
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Structured logging for rumble internals. Pass a pino (or compatible) logger instance.
|
|
323
|
+
* When enabled, rumble emits structured log entries for GraphQL operations, ability checks,
|
|
324
|
+
* and runtime filter applications — queryable by level and field in Loki or similar.
|
|
325
|
+
*/
|
|
326
|
+
logger?: {
|
|
327
|
+
/**
|
|
328
|
+
* Whether structured logging should be enabled.
|
|
329
|
+
*/
|
|
330
|
+
enabled?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* The logger instance to use. Must satisfy the RumbleLogger interface (pino satisfies this).
|
|
333
|
+
*/
|
|
334
|
+
logger: RumbleLogger;
|
|
335
|
+
/**
|
|
336
|
+
* When both logger and otel are enabled, inject `trace_id`, `span_id` and `trace_flags`
|
|
337
|
+
* fields into every log entry emitted during a GraphQL operation. Useful for correlating
|
|
338
|
+
* log lines with traces in backends like Jaeger or Grafana Tempo.
|
|
339
|
+
* @default true
|
|
340
|
+
*/
|
|
341
|
+
injectTraceId?: boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Whether the incoming operation variables are attached to the operation
|
|
344
|
+
* start log entry as a `graphql.variables` object.
|
|
345
|
+
*
|
|
346
|
+
* Variables regularly carry personal data, so you can turn this off
|
|
347
|
+
* entirely (`false`) or pass a function to redact or drop single entries
|
|
348
|
+
* before they are logged.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* logger: {
|
|
353
|
+
* enabled: true,
|
|
354
|
+
* logger: pino(),
|
|
355
|
+
* includeVariables: ({ password, ...rest }) => rest,
|
|
356
|
+
* }
|
|
357
|
+
* ```
|
|
358
|
+
* @default true
|
|
359
|
+
*/
|
|
360
|
+
includeVariables?: boolean | ((variables: Record<string, unknown>) => Record<string, unknown> | undefined);
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* Configures `@pothos/plugin-validation`, which rumble installs by default to power
|
|
364
|
+
* `Address`/`AddressInput`'s country-aware validation (see `implementDefaultAddressTypes`).
|
|
365
|
+
*/
|
|
366
|
+
validation?: NonNullable<ConstructorParameters<typeof SchemaBuilder>[0]>["validation"];
|
|
367
|
+
};
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region lib/abilityBuilder/columnMask.d.ts
|
|
370
|
+
type MaskColumnsInput<DB extends DrizzleInstance, Action extends string> = {
|
|
371
|
+
table: TableRelationNames<DB>;
|
|
372
|
+
action: Action;
|
|
373
|
+
abilities: Record<string, any>;
|
|
374
|
+
entities: unknown[];
|
|
375
|
+
};
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region lib/abilityBuilder/filterResponse.d.ts
|
|
378
|
+
type FindFirstConfig<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = NonNullable<Parameters<DB["query"][TableName]["findFirst"]>[0]>;
|
|
379
|
+
type FindManyConfig<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = NonNullable<Parameters<DB["query"][TableName]["findMany"]>[0]>;
|
|
380
|
+
/**
|
|
381
|
+
* The query filters of an ability, as handed out by
|
|
382
|
+
* `abilities.<table>.filter(...)`.
|
|
383
|
+
*
|
|
384
|
+
* `columns` and `extras` are set at runtime but left out of the types on
|
|
385
|
+
* purpose: a visible, loosely typed extras makes drizzle infer `{}` as the row
|
|
386
|
+
* type of findFirst/findMany, and the column flag is an internal detail anyway.
|
|
387
|
+
*/
|
|
388
|
+
type AbilityFilter<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = {
|
|
389
|
+
/**
|
|
390
|
+
* Query filters for the drizzle query API.
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* author: t.relation("author", {
|
|
394
|
+
* query: async (_args, ctx) => (await ctx.abilities.users.filter("read")).query.single,
|
|
395
|
+
* }),
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
query: {
|
|
399
|
+
/**
|
|
400
|
+
* For find first calls
|
|
401
|
+
*/
|
|
402
|
+
single: Pick<FindFirstConfig<DB, TableName>, "where">;
|
|
403
|
+
/**
|
|
404
|
+
* For find many calls
|
|
405
|
+
*/
|
|
406
|
+
many: Pick<FindManyConfig<DB, TableName>, "where" | "limit">;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Query filters for the drizzle SQL API as used in e.g. updates.
|
|
410
|
+
* @example
|
|
411
|
+
*
|
|
412
|
+
* ```ts
|
|
413
|
+
* await db
|
|
414
|
+
* .update(schema.users)
|
|
415
|
+
* .set({
|
|
416
|
+
* name: args.newName,
|
|
417
|
+
* })
|
|
418
|
+
* .where(
|
|
419
|
+
* and(
|
|
420
|
+
* eq(schema.users.id, args.userId),
|
|
421
|
+
* (await ctx.abilities.users.filter("update")).sql.where,
|
|
422
|
+
* ),
|
|
423
|
+
* );
|
|
424
|
+
* ```
|
|
425
|
+
*
|
|
426
|
+
*/
|
|
427
|
+
sql: {
|
|
428
|
+
readonly where: SQL | undefined;
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* What `abilities.<table>.filter(...)` resolves to.
|
|
433
|
+
*/
|
|
434
|
+
type AbilityFilterResponse<DB extends DrizzleInstance, TableName extends TableRelationNames<DB>> = AbilityFilter<DB, TableName> & {
|
|
435
|
+
/**
|
|
436
|
+
* Merges the current query filters with the provided filters for this call only
|
|
437
|
+
*/
|
|
438
|
+
merge: (filters: NonNullable<DrizzleQueryFunctionInput<DB, TableName>>) => AbilityFilter<DB, TableName>;
|
|
439
|
+
};
|
|
440
|
+
//#endregion
|
|
188
441
|
//#region lib/scalars/address.d.ts
|
|
189
442
|
/**
|
|
190
443
|
* The shape of a postal address, modeled after the OIDC `address` claim
|
|
@@ -4402,168 +4655,6 @@ type RouteWithTypesOpts<TServerContext, TMethod extends HTTPMethod, TPath extend
|
|
|
4402
4655
|
};
|
|
4403
4656
|
type ExtractPathParamsWithPattern<TPath extends string> = Pipe<TPath, [Strings.Split<'/'>, Tuples.Filter<Strings.StartsWith<':'>>, Tuples.Map<Strings.Trim<':'>>, Tuples.ToUnion]>;
|
|
4404
4657
|
//#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
4658
|
//#region lib/rumble.d.ts
|
|
4568
4659
|
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
4660
|
schema: Schema;
|
|
@@ -4586,44 +4677,31 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
|
|
|
4586
4677
|
*/
|
|
4587
4678
|
abilityBuilder: { [key in TableRelationNames<DB>]: {
|
|
4588
4679
|
allow: (action: Action | Action[]) => {
|
|
4589
|
-
when: (queryFilter:
|
|
4680
|
+
when: (queryFilter: QueryFilter<DB, key, DrizzleQueryFunctionInput<DB, key>, UserContext>) => void;
|
|
4590
4681
|
};
|
|
4591
4682
|
filter: (action: Action | Action[]) => {
|
|
4683
|
+
by: (explicitFilter: Filter<UserContext, DrizzleTableValueType<DB, key>, never>) => void;
|
|
4592
4684
|
prefetch: <PrefetchReturnType>(prefetch: Prefetch<UserContext, PrefetchReturnType>) => {
|
|
4593
4685
|
by: (explicitFilter: Filter<UserContext, DrizzleTableValueType<DB, key>, PrefetchReturnType>) => void;
|
|
4594
4686
|
};
|
|
4595
|
-
by: (explicitFilter: Filter<UserContext, DrizzleTableValueType<DB, key>>) => void;
|
|
4596
4687
|
};
|
|
4597
4688
|
_: {
|
|
4598
4689
|
runtimeFilters: Map<Action, FilterPrefetchCombo<UserContext, any, any>[]>;
|
|
4599
|
-
queryFilters:
|
|
4690
|
+
queryFilters: QueryFilterRegistry<UserContext, DB, Action, key>;
|
|
4600
4691
|
};
|
|
4601
4692
|
}; } & {
|
|
4602
4693
|
_: {
|
|
4694
|
+
maskColumns: (input: MaskColumnsInput<DB, Action>) => void | Promise<void>;
|
|
4695
|
+
maskedActions: (abilities: object, table: TableRelationNames<DB>) => Set<Action>;
|
|
4696
|
+
primaryKeyHidden: (abilities: object, row: object) => boolean;
|
|
4697
|
+
registerReadAction(table: TableRelationNames<DB>, action: Action): void;
|
|
4698
|
+
readActionOf(table: TableRelationNames<DB>): Action;
|
|
4603
4699
|
registeredFilters({ action, table }: {
|
|
4604
4700
|
table: TableRelationNames<DB>;
|
|
4605
4701
|
action: Action;
|
|
4606
4702
|
}): Filter<UserContext, DrizzleTableValueType<DB, TableRelationNames<DB>>>[];
|
|
4607
4703
|
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
|
-
}>;
|
|
4704
|
+
filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
|
|
4627
4705
|
}; };
|
|
4628
4706
|
};
|
|
4629
4707
|
};
|
|
@@ -4633,25 +4711,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
|
|
|
4633
4711
|
schemaBuilder: PothosSchemaTypes.SchemaBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
4634
4712
|
Context: Awaited<UserContext & {
|
|
4635
4713
|
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
|
-
}>;
|
|
4714
|
+
filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
|
|
4655
4715
|
}; };
|
|
4656
4716
|
}>;
|
|
4657
4717
|
DrizzleRelations: DB["_"]["relations"];
|
|
@@ -4791,25 +4851,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
|
|
|
4791
4851
|
adjust?: ((t: import("@pothos/plugin-drizzle").DrizzleObjectFieldBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
4792
4852
|
Context: Awaited<UserContext & {
|
|
4793
4853
|
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
|
-
}>;
|
|
4854
|
+
filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
|
|
4813
4855
|
}; };
|
|
4814
4856
|
}>;
|
|
4815
4857
|
DrizzleRelations: DB["_"]["relations"];
|
|
@@ -4888,25 +4930,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
|
|
|
4888
4930
|
}) => import("@pothos/plugin-drizzle").DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
4889
4931
|
Context: Awaited<UserContext & {
|
|
4890
4932
|
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
|
-
}>;
|
|
4933
|
+
filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
|
|
4910
4934
|
}; };
|
|
4911
4935
|
}>;
|
|
4912
4936
|
DrizzleRelations: DB["_"]["relations"];
|
|
@@ -4996,25 +5020,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
|
|
|
4996
5020
|
})) => PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
4997
5021
|
Context: Awaited<UserContext & {
|
|
4998
5022
|
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
|
-
}>;
|
|
5023
|
+
filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
|
|
5018
5024
|
}; };
|
|
5019
5025
|
}>;
|
|
5020
5026
|
DrizzleRelations: DB["_"]["relations"];
|
|
@@ -5134,25 +5140,7 @@ export declare const rumble: <UserContext extends Record<string, any>, DB extend
|
|
|
5134
5140
|
})) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
5135
5141
|
Context: Awaited<UserContext & {
|
|
5136
5142
|
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
|
-
}>;
|
|
5143
|
+
filter: (action: Action) => Promise<AbilityFilterResponse<DB, key>>;
|
|
5156
5144
|
}; };
|
|
5157
5145
|
}>;
|
|
5158
5146
|
DrizzleRelations: DB["_"]["relations"];
|