@vantreeseba/drizzle-graphql 6.0.0 → 7.1.0
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 +372 -10
- package/dist/README.md +372 -10
- package/dist/index.cjs +1029 -447
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -2
- package/dist/index.d.ts +132 -2
- package/dist/index.js +935 -343
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -232,8 +232,25 @@ declare const drizzleExecutorKey: unique symbol;
|
|
|
232
232
|
* 2. When limit/offset args are present, falls back to a direct per-item query.
|
|
233
233
|
* 3. Otherwise batches all sibling resolver calls within the same GraphQL execution tick
|
|
234
234
|
* into a single IN-clause query, eliminating N+1 database round-trips.
|
|
235
|
+
*
|
|
236
|
+
* `nullOrdering` is the dialect's native `ORDER BY` placement for `NULL` — the keyset
|
|
237
|
+
* predicate behind a relation's `after` argument has to match it, or rows with a `NULL` in an
|
|
238
|
+
* ordered column would be skipped instead of paged through. It has no sensible default, so
|
|
239
|
+
* each dialect builder states it: `'nulls-largest'` for PostgreSQL, `'nulls-smallest'` for
|
|
240
|
+
* MySQL and SQLite.
|
|
241
|
+
*/
|
|
242
|
+
declare const createRelationResolverFactory: (db: any, tables: Record<string, Table>, nullOrdering: NullOrdering, filterCtx?: RelationFilterBase, limits?: LimitPolicyFor) => RelationResolverFactory;
|
|
243
|
+
/** {@link BuildSchemaConfig.limits} resolved for one table. `undefined` means no policy. */
|
|
244
|
+
type ResolvedLimitPolicy = {
|
|
245
|
+
defaultLimit: number | undefined;
|
|
246
|
+
maxLimit: number | undefined;
|
|
247
|
+
clampToMax: boolean;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Looks up the limit policy for a table by its Drizzle schema key. Built once per schema by
|
|
251
|
+
* `buildSchema`; `undefined` for a table the caller left unbounded.
|
|
235
252
|
*/
|
|
236
|
-
|
|
253
|
+
type LimitPolicyFor = (tableName: string) => ResolvedLimitPolicy | undefined;
|
|
237
254
|
/**
|
|
238
255
|
* Compiles an `orderBy` argument into ORDER BY expressions, highest priority first.
|
|
239
256
|
*
|
|
@@ -275,6 +292,14 @@ interface RelationFilterContext {
|
|
|
275
292
|
*/
|
|
276
293
|
type RelationFilterBase = Pick<RelationFilterContext, 'tables' | 'relationMap'>;
|
|
277
294
|
declare const extractFilters: <TTable extends Table>(table: TTable, tableName: string, filters: Filters<TTable>, relationCtx?: RelationFilterContext) => SQL | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Where a dialect's default sort places NULLs relative to non-NULL values:
|
|
297
|
+
* - `nulls-largest` — PostgreSQL: NULLs sort as the largest values (last in ASC, first in DESC).
|
|
298
|
+
* - `nulls-smallest` — MySQL and SQLite: NULLs sort as the smallest values (first in ASC, last
|
|
299
|
+
* in DESC).
|
|
300
|
+
* The keyset predicate has to agree with the dialect's ORDER BY, so each builder passes its own.
|
|
301
|
+
*/
|
|
302
|
+
type NullOrdering = 'nulls-largest' | 'nulls-smallest';
|
|
278
303
|
/**
|
|
279
304
|
* Default for `config.onError`: keeps drizzle-graphql's own errors, which are written for
|
|
280
305
|
* the client, and replaces driver/database errors with a generic message. Their text names
|
|
@@ -669,6 +694,51 @@ type SchemaFeatures = {
|
|
|
669
694
|
* @default false
|
|
670
695
|
*/
|
|
671
696
|
nestedWrites?: boolean;
|
|
697
|
+
/**
|
|
698
|
+
* Operation inputs on the update `set`, so a column can be changed relative to its current
|
|
699
|
+
* value instead of only replaced.
|
|
700
|
+
*
|
|
701
|
+
* ```graphql
|
|
702
|
+
* updatePostsSingle(where: { id: { eq: "p1" } }, set: { views: { increment: 1 } }) { views }
|
|
703
|
+
* ```
|
|
704
|
+
*
|
|
705
|
+
* Every numeric column's field on `Update<Table>Input` becomes a `<Scalar>FieldUpdate`
|
|
706
|
+
* input carrying `set`, `increment`, `decrement`, `multiply` and `divide`; every array
|
|
707
|
+
* column's becomes a `<Scalar>ListFieldUpdate` carrying `set` and `push`. Exactly one
|
|
708
|
+
* operation per field, checked at resolve time. `set` is the explicit spelling of what the
|
|
709
|
+
* field did before, so `set: { views: 42 }` becomes `set: { views: { set: 42 } }`.
|
|
710
|
+
*
|
|
711
|
+
* The arithmetic happens in the database (`SET views = views + 1`), so a counter no longer
|
|
712
|
+
* needs a read-modify-write round trip and no longer loses concurrent updates. Rounding on
|
|
713
|
+
* an integer column, and division by zero, follow the database's own rules rather than
|
|
714
|
+
* being guarded here. Columns owned by a scalar override keep their plain type — an
|
|
715
|
+
* override owns what the column accepts.
|
|
716
|
+
*
|
|
717
|
+
* Off by default: it changes the type of every numeric and array field on every update
|
|
718
|
+
* input, which no existing document is written against.
|
|
719
|
+
*
|
|
720
|
+
* @default false
|
|
721
|
+
*/
|
|
722
|
+
fieldUpdateOperations?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* `update<Table>Count` / `delete<Table>Count` mutations — the same write as the plural
|
|
725
|
+
* `update<Table>` / `delete<Table>`, returning the number of rows affected instead of the
|
|
726
|
+
* rows themselves.
|
|
727
|
+
*
|
|
728
|
+
* ```graphql
|
|
729
|
+
* deletePostsCount(where: { published: { eq: false } }) # Int!
|
|
730
|
+
* ```
|
|
731
|
+
*
|
|
732
|
+
* A mass update or delete otherwise has to `RETURNING *` every row it touched purely so
|
|
733
|
+
* the caller can count them, which crosses the driver and is serialized through GraphQL
|
|
734
|
+
* for nothing. Each mutation is generated only when its plural counterpart is
|
|
735
|
+
* (`features.update` / `features.delete`), and honours `features.requireWhere`.
|
|
736
|
+
*
|
|
737
|
+
* Off unless asked for, so an existing schema does not grow new mutations on upgrade.
|
|
738
|
+
*
|
|
739
|
+
* @default false
|
|
740
|
+
*/
|
|
741
|
+
countMutations?: boolean;
|
|
672
742
|
/**
|
|
673
743
|
* Makes `where` non-null on the plural `update<Table>` / `delete<Table>` mutations, and
|
|
674
744
|
* rejects a `where` that collapses to no filters (e.g. `where: {}`), so a schema can rule
|
|
@@ -701,6 +771,29 @@ type ComplexityConfig = {
|
|
|
701
771
|
*/
|
|
702
772
|
aggregateCost?: number;
|
|
703
773
|
};
|
|
774
|
+
/**
|
|
775
|
+
* A limit policy: what a request without `limit` gets, and how large a `limit` may be.
|
|
776
|
+
* Every field is optional — an empty policy is the default unbounded behavior.
|
|
777
|
+
*/
|
|
778
|
+
type TableLimitPolicy = {
|
|
779
|
+
/** Applied when the client passes no `limit`. Capped by `maxLimit` when both are set. */
|
|
780
|
+
defaultLimit?: number;
|
|
781
|
+
/**
|
|
782
|
+
* The largest `limit` a client may ask for. Also bounds a request that passes no `limit` at
|
|
783
|
+
* all, since that means every row.
|
|
784
|
+
*/
|
|
785
|
+
maxLimit?: number;
|
|
786
|
+
/**
|
|
787
|
+
* `false` (default) rejects a `limit` above `maxLimit` with a GraphQL error; `true` reduces
|
|
788
|
+
* it to `maxLimit` instead.
|
|
789
|
+
*/
|
|
790
|
+
clampToMax?: boolean;
|
|
791
|
+
};
|
|
792
|
+
/** {@link BuildSchemaConfig.limits} — a global policy plus per-table overrides. */
|
|
793
|
+
type LimitsConfig = TableLimitPolicy & {
|
|
794
|
+
/** Per-table overrides, keyed by the table's key in the Drizzle schema. */
|
|
795
|
+
tables?: Record<string, TableLimitPolicy>;
|
|
796
|
+
};
|
|
704
797
|
type BuildSchemaConfig = {
|
|
705
798
|
/**
|
|
706
799
|
* Determines whether generated mutations will be passed to returned schema.
|
|
@@ -852,6 +945,43 @@ type BuildSchemaConfig = {
|
|
|
852
945
|
mode: 'auto';
|
|
853
946
|
timeoutMs?: number;
|
|
854
947
|
};
|
|
948
|
+
/**
|
|
949
|
+
* Bounds on the `limit` argument of list queries and to-many relation fields.
|
|
950
|
+
*
|
|
951
|
+
* Both knobs are off by default: without them a client can omit `limit` and pull a whole
|
|
952
|
+
* table, or pass `limit: 1000000` and do the same thing politely. Turning either on changes
|
|
953
|
+
* observable behavior for existing consumers, so nothing is applied unless asked for.
|
|
954
|
+
*
|
|
955
|
+
* ```ts
|
|
956
|
+
* buildSchema(db, {
|
|
957
|
+
* limits: {
|
|
958
|
+
* defaultLimit: 50, // used when the client passes no `limit`
|
|
959
|
+
* maxLimit: 500, // anything above is rejected
|
|
960
|
+
* tables: {
|
|
961
|
+
* auditLog: { defaultLimit: 20, maxLimit: 100 },
|
|
962
|
+
* },
|
|
963
|
+
* },
|
|
964
|
+
* });
|
|
965
|
+
* ```
|
|
966
|
+
*
|
|
967
|
+
* - Applies to root list queries **and** to to-many relation fields — an unbounded relation
|
|
968
|
+
* inside a bounded root is the same scan one level down. A relation field takes the policy
|
|
969
|
+
* of the table it *targets*, so a table is bounded wherever it is reached from. Single-row
|
|
970
|
+
* queries and aggregates take no `limit` and are unaffected.
|
|
971
|
+
* - A `limit` above `maxLimit` is rejected with a GraphQL error. Set `clampToMax: true` to
|
|
972
|
+
* silently reduce it instead — honest paginating clients prefer the error, since a clamped
|
|
973
|
+
* page looks like the end of the results.
|
|
974
|
+
* - `maxLimit` on its own also bounds the *omitted* case: no `limit` means every row, which
|
|
975
|
+
* is above any maximum. `defaultLimit` is what a request without `limit` gets, capped by
|
|
976
|
+
* `maxLimit` if both are set.
|
|
977
|
+
* - `tables` overrides per table, keyed by the Drizzle schema key. A table's entry replaces
|
|
978
|
+
* the top-level value for whichever keys it sets.
|
|
979
|
+
* - Cursor pagination inherits the same policy — a keyset page needs a limit to be
|
|
980
|
+
* meaningful, and `defaultLimit` is what makes `after`-only pagination well-formed.
|
|
981
|
+
* - The complexity hints price the *effective* limit, so cost estimation and enforcement
|
|
982
|
+
* agree.
|
|
983
|
+
*/
|
|
984
|
+
limits?: LimitsConfig;
|
|
855
985
|
/**
|
|
856
986
|
* Optional mapper from table key to singular/plural name pair.
|
|
857
987
|
* When provided for a table, overrides the default (table key) naming for GraphQL type names,
|
|
@@ -1080,4 +1210,4 @@ declare const GraphQLDecimalString: GraphQLScalarType<string, string>;
|
|
|
1080
1210
|
|
|
1081
1211
|
declare const buildSchema: <TDbClient extends AnyDrizzleDB<any>>(db: TDbClient, config?: BuildSchemaConfig) => GeneratedData<TDbClient>;
|
|
1082
1212
|
|
|
1083
|
-
export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableDescriber, type TableNamedRelations, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
|
|
1213
|
+
export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type LimitsConfig, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableDescriber, type TableLimitPolicy, type TableNamedRelations, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
|
package/dist/index.d.ts
CHANGED
|
@@ -232,8 +232,25 @@ declare const drizzleExecutorKey: unique symbol;
|
|
|
232
232
|
* 2. When limit/offset args are present, falls back to a direct per-item query.
|
|
233
233
|
* 3. Otherwise batches all sibling resolver calls within the same GraphQL execution tick
|
|
234
234
|
* into a single IN-clause query, eliminating N+1 database round-trips.
|
|
235
|
+
*
|
|
236
|
+
* `nullOrdering` is the dialect's native `ORDER BY` placement for `NULL` — the keyset
|
|
237
|
+
* predicate behind a relation's `after` argument has to match it, or rows with a `NULL` in an
|
|
238
|
+
* ordered column would be skipped instead of paged through. It has no sensible default, so
|
|
239
|
+
* each dialect builder states it: `'nulls-largest'` for PostgreSQL, `'nulls-smallest'` for
|
|
240
|
+
* MySQL and SQLite.
|
|
241
|
+
*/
|
|
242
|
+
declare const createRelationResolverFactory: (db: any, tables: Record<string, Table>, nullOrdering: NullOrdering, filterCtx?: RelationFilterBase, limits?: LimitPolicyFor) => RelationResolverFactory;
|
|
243
|
+
/** {@link BuildSchemaConfig.limits} resolved for one table. `undefined` means no policy. */
|
|
244
|
+
type ResolvedLimitPolicy = {
|
|
245
|
+
defaultLimit: number | undefined;
|
|
246
|
+
maxLimit: number | undefined;
|
|
247
|
+
clampToMax: boolean;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Looks up the limit policy for a table by its Drizzle schema key. Built once per schema by
|
|
251
|
+
* `buildSchema`; `undefined` for a table the caller left unbounded.
|
|
235
252
|
*/
|
|
236
|
-
|
|
253
|
+
type LimitPolicyFor = (tableName: string) => ResolvedLimitPolicy | undefined;
|
|
237
254
|
/**
|
|
238
255
|
* Compiles an `orderBy` argument into ORDER BY expressions, highest priority first.
|
|
239
256
|
*
|
|
@@ -275,6 +292,14 @@ interface RelationFilterContext {
|
|
|
275
292
|
*/
|
|
276
293
|
type RelationFilterBase = Pick<RelationFilterContext, 'tables' | 'relationMap'>;
|
|
277
294
|
declare const extractFilters: <TTable extends Table>(table: TTable, tableName: string, filters: Filters<TTable>, relationCtx?: RelationFilterContext) => SQL | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Where a dialect's default sort places NULLs relative to non-NULL values:
|
|
297
|
+
* - `nulls-largest` — PostgreSQL: NULLs sort as the largest values (last in ASC, first in DESC).
|
|
298
|
+
* - `nulls-smallest` — MySQL and SQLite: NULLs sort as the smallest values (first in ASC, last
|
|
299
|
+
* in DESC).
|
|
300
|
+
* The keyset predicate has to agree with the dialect's ORDER BY, so each builder passes its own.
|
|
301
|
+
*/
|
|
302
|
+
type NullOrdering = 'nulls-largest' | 'nulls-smallest';
|
|
278
303
|
/**
|
|
279
304
|
* Default for `config.onError`: keeps drizzle-graphql's own errors, which are written for
|
|
280
305
|
* the client, and replaces driver/database errors with a generic message. Their text names
|
|
@@ -669,6 +694,51 @@ type SchemaFeatures = {
|
|
|
669
694
|
* @default false
|
|
670
695
|
*/
|
|
671
696
|
nestedWrites?: boolean;
|
|
697
|
+
/**
|
|
698
|
+
* Operation inputs on the update `set`, so a column can be changed relative to its current
|
|
699
|
+
* value instead of only replaced.
|
|
700
|
+
*
|
|
701
|
+
* ```graphql
|
|
702
|
+
* updatePostsSingle(where: { id: { eq: "p1" } }, set: { views: { increment: 1 } }) { views }
|
|
703
|
+
* ```
|
|
704
|
+
*
|
|
705
|
+
* Every numeric column's field on `Update<Table>Input` becomes a `<Scalar>FieldUpdate`
|
|
706
|
+
* input carrying `set`, `increment`, `decrement`, `multiply` and `divide`; every array
|
|
707
|
+
* column's becomes a `<Scalar>ListFieldUpdate` carrying `set` and `push`. Exactly one
|
|
708
|
+
* operation per field, checked at resolve time. `set` is the explicit spelling of what the
|
|
709
|
+
* field did before, so `set: { views: 42 }` becomes `set: { views: { set: 42 } }`.
|
|
710
|
+
*
|
|
711
|
+
* The arithmetic happens in the database (`SET views = views + 1`), so a counter no longer
|
|
712
|
+
* needs a read-modify-write round trip and no longer loses concurrent updates. Rounding on
|
|
713
|
+
* an integer column, and division by zero, follow the database's own rules rather than
|
|
714
|
+
* being guarded here. Columns owned by a scalar override keep their plain type — an
|
|
715
|
+
* override owns what the column accepts.
|
|
716
|
+
*
|
|
717
|
+
* Off by default: it changes the type of every numeric and array field on every update
|
|
718
|
+
* input, which no existing document is written against.
|
|
719
|
+
*
|
|
720
|
+
* @default false
|
|
721
|
+
*/
|
|
722
|
+
fieldUpdateOperations?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* `update<Table>Count` / `delete<Table>Count` mutations — the same write as the plural
|
|
725
|
+
* `update<Table>` / `delete<Table>`, returning the number of rows affected instead of the
|
|
726
|
+
* rows themselves.
|
|
727
|
+
*
|
|
728
|
+
* ```graphql
|
|
729
|
+
* deletePostsCount(where: { published: { eq: false } }) # Int!
|
|
730
|
+
* ```
|
|
731
|
+
*
|
|
732
|
+
* A mass update or delete otherwise has to `RETURNING *` every row it touched purely so
|
|
733
|
+
* the caller can count them, which crosses the driver and is serialized through GraphQL
|
|
734
|
+
* for nothing. Each mutation is generated only when its plural counterpart is
|
|
735
|
+
* (`features.update` / `features.delete`), and honours `features.requireWhere`.
|
|
736
|
+
*
|
|
737
|
+
* Off unless asked for, so an existing schema does not grow new mutations on upgrade.
|
|
738
|
+
*
|
|
739
|
+
* @default false
|
|
740
|
+
*/
|
|
741
|
+
countMutations?: boolean;
|
|
672
742
|
/**
|
|
673
743
|
* Makes `where` non-null on the plural `update<Table>` / `delete<Table>` mutations, and
|
|
674
744
|
* rejects a `where` that collapses to no filters (e.g. `where: {}`), so a schema can rule
|
|
@@ -701,6 +771,29 @@ type ComplexityConfig = {
|
|
|
701
771
|
*/
|
|
702
772
|
aggregateCost?: number;
|
|
703
773
|
};
|
|
774
|
+
/**
|
|
775
|
+
* A limit policy: what a request without `limit` gets, and how large a `limit` may be.
|
|
776
|
+
* Every field is optional — an empty policy is the default unbounded behavior.
|
|
777
|
+
*/
|
|
778
|
+
type TableLimitPolicy = {
|
|
779
|
+
/** Applied when the client passes no `limit`. Capped by `maxLimit` when both are set. */
|
|
780
|
+
defaultLimit?: number;
|
|
781
|
+
/**
|
|
782
|
+
* The largest `limit` a client may ask for. Also bounds a request that passes no `limit` at
|
|
783
|
+
* all, since that means every row.
|
|
784
|
+
*/
|
|
785
|
+
maxLimit?: number;
|
|
786
|
+
/**
|
|
787
|
+
* `false` (default) rejects a `limit` above `maxLimit` with a GraphQL error; `true` reduces
|
|
788
|
+
* it to `maxLimit` instead.
|
|
789
|
+
*/
|
|
790
|
+
clampToMax?: boolean;
|
|
791
|
+
};
|
|
792
|
+
/** {@link BuildSchemaConfig.limits} — a global policy plus per-table overrides. */
|
|
793
|
+
type LimitsConfig = TableLimitPolicy & {
|
|
794
|
+
/** Per-table overrides, keyed by the table's key in the Drizzle schema. */
|
|
795
|
+
tables?: Record<string, TableLimitPolicy>;
|
|
796
|
+
};
|
|
704
797
|
type BuildSchemaConfig = {
|
|
705
798
|
/**
|
|
706
799
|
* Determines whether generated mutations will be passed to returned schema.
|
|
@@ -852,6 +945,43 @@ type BuildSchemaConfig = {
|
|
|
852
945
|
mode: 'auto';
|
|
853
946
|
timeoutMs?: number;
|
|
854
947
|
};
|
|
948
|
+
/**
|
|
949
|
+
* Bounds on the `limit` argument of list queries and to-many relation fields.
|
|
950
|
+
*
|
|
951
|
+
* Both knobs are off by default: without them a client can omit `limit` and pull a whole
|
|
952
|
+
* table, or pass `limit: 1000000` and do the same thing politely. Turning either on changes
|
|
953
|
+
* observable behavior for existing consumers, so nothing is applied unless asked for.
|
|
954
|
+
*
|
|
955
|
+
* ```ts
|
|
956
|
+
* buildSchema(db, {
|
|
957
|
+
* limits: {
|
|
958
|
+
* defaultLimit: 50, // used when the client passes no `limit`
|
|
959
|
+
* maxLimit: 500, // anything above is rejected
|
|
960
|
+
* tables: {
|
|
961
|
+
* auditLog: { defaultLimit: 20, maxLimit: 100 },
|
|
962
|
+
* },
|
|
963
|
+
* },
|
|
964
|
+
* });
|
|
965
|
+
* ```
|
|
966
|
+
*
|
|
967
|
+
* - Applies to root list queries **and** to to-many relation fields — an unbounded relation
|
|
968
|
+
* inside a bounded root is the same scan one level down. A relation field takes the policy
|
|
969
|
+
* of the table it *targets*, so a table is bounded wherever it is reached from. Single-row
|
|
970
|
+
* queries and aggregates take no `limit` and are unaffected.
|
|
971
|
+
* - A `limit` above `maxLimit` is rejected with a GraphQL error. Set `clampToMax: true` to
|
|
972
|
+
* silently reduce it instead — honest paginating clients prefer the error, since a clamped
|
|
973
|
+
* page looks like the end of the results.
|
|
974
|
+
* - `maxLimit` on its own also bounds the *omitted* case: no `limit` means every row, which
|
|
975
|
+
* is above any maximum. `defaultLimit` is what a request without `limit` gets, capped by
|
|
976
|
+
* `maxLimit` if both are set.
|
|
977
|
+
* - `tables` overrides per table, keyed by the Drizzle schema key. A table's entry replaces
|
|
978
|
+
* the top-level value for whichever keys it sets.
|
|
979
|
+
* - Cursor pagination inherits the same policy — a keyset page needs a limit to be
|
|
980
|
+
* meaningful, and `defaultLimit` is what makes `after`-only pagination well-formed.
|
|
981
|
+
* - The complexity hints price the *effective* limit, so cost estimation and enforcement
|
|
982
|
+
* agree.
|
|
983
|
+
*/
|
|
984
|
+
limits?: LimitsConfig;
|
|
855
985
|
/**
|
|
856
986
|
* Optional mapper from table key to singular/plural name pair.
|
|
857
987
|
* When provided for a table, overrides the default (table key) naming for GraphQL type names,
|
|
@@ -1080,4 +1210,4 @@ declare const GraphQLDecimalString: GraphQLScalarType<string, string>;
|
|
|
1080
1210
|
|
|
1081
1211
|
declare const buildSchema: <TDbClient extends AnyDrizzleDB<any>>(db: TDbClient, config?: BuildSchemaConfig) => GeneratedData<TDbClient>;
|
|
1082
1212
|
|
|
1083
|
-
export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableDescriber, type TableNamedRelations, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
|
|
1213
|
+
export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type LimitsConfig, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableDescriber, type TableLimitPolicy, type TableNamedRelations, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
|