@pothos/plugin-drizzle 0.18.1 → 0.19.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/CHANGELOG.md +357 -0
- package/README.md +1199 -563
- package/dts/connection-helpers.d.ts +18 -8
- package/dts/connection-helpers.d.ts.map +1 -1
- package/dts/drizzle-field-builder.d.ts +4 -11
- package/dts/drizzle-field-builder.d.ts.map +1 -1
- package/dts/global-types.d.ts.map +1 -1
- package/dts/index.d.ts.map +1 -1
- package/dts/model-loader.d.ts +18 -17
- package/dts/model-loader.d.ts.map +1 -1
- package/dts/types.d.ts +82 -22
- package/dts/types.d.ts.map +1 -1
- package/dts/utils/adapter.d.ts +39 -0
- package/dts/utils/adapter.d.ts.map +1 -0
- package/dts/utils/await-selections.d.ts +12 -0
- package/dts/utils/await-selections.d.ts.map +1 -0
- package/dts/utils/config.d.ts +23 -3
- package/dts/utils/config.d.ts.map +1 -1
- package/dts/utils/cursors.d.ts +6 -6
- package/dts/utils/cursors.d.ts.map +1 -1
- package/dts/utils/map-query.d.ts +22 -21
- package/dts/utils/map-query.d.ts.map +1 -1
- package/dts/utils/path-info.d.ts +13 -0
- package/dts/utils/path-info.d.ts.map +1 -0
- package/dts/utils/relation-filter.d.ts +48 -0
- package/dts/utils/relation-filter.d.ts.map +1 -0
- package/dts/utils/selections.d.ts +2 -21
- package/dts/utils/selections.d.ts.map +1 -1
- package/esm/connection-helpers.d.ts +18 -8
- package/esm/connection-helpers.d.ts.map +1 -1
- package/esm/connection-helpers.js +52 -19
- package/esm/connection-helpers.js.map +1 -1
- package/esm/drizzle-field-builder.d.ts +4 -11
- package/esm/drizzle-field-builder.d.ts.map +1 -1
- package/esm/drizzle-field-builder.js +138 -96
- package/esm/drizzle-field-builder.js.map +1 -1
- package/esm/field-builder.js +61 -47
- package/esm/field-builder.js.map +1 -1
- package/esm/global-types.d.ts.map +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +37 -61
- package/esm/index.js.map +1 -1
- package/esm/model-loader.d.ts +18 -17
- package/esm/model-loader.d.ts.map +1 -1
- package/esm/model-loader.js +76 -45
- package/esm/model-loader.js.map +1 -1
- package/esm/schema-builder.js +40 -149
- package/esm/schema-builder.js.map +1 -1
- package/esm/types.d.ts +82 -22
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js.map +1 -1
- package/esm/utils/adapter.d.ts +39 -0
- package/esm/utils/adapter.d.ts.map +1 -0
- package/esm/utils/adapter.js +137 -0
- package/esm/utils/adapter.js.map +1 -0
- package/esm/utils/await-selections.d.ts +12 -0
- package/esm/utils/await-selections.d.ts.map +1 -0
- package/esm/utils/await-selections.js +19 -0
- package/esm/utils/await-selections.js.map +1 -0
- package/esm/utils/config.d.ts +23 -3
- package/esm/utils/config.d.ts.map +1 -1
- package/esm/utils/config.js +1 -4
- package/esm/utils/config.js.map +1 -1
- package/esm/utils/cursors.d.ts +6 -6
- package/esm/utils/cursors.d.ts.map +1 -1
- package/esm/utils/cursors.js +75 -92
- package/esm/utils/cursors.js.map +1 -1
- package/esm/utils/map-query.d.ts +22 -21
- package/esm/utils/map-query.d.ts.map +1 -1
- package/esm/utils/map-query.js +40 -354
- package/esm/utils/map-query.js.map +1 -1
- package/esm/utils/path-info.d.ts +13 -0
- package/esm/utils/path-info.d.ts.map +1 -0
- package/esm/utils/path-info.js +37 -0
- package/esm/utils/path-info.js.map +1 -0
- package/esm/utils/relation-filter.d.ts +48 -0
- package/esm/utils/relation-filter.d.ts.map +1 -0
- package/esm/utils/relation-filter.js +92 -0
- package/esm/utils/relation-filter.js.map +1 -0
- package/esm/utils/selections.d.ts +2 -21
- package/esm/utils/selections.d.ts.map +1 -1
- package/esm/utils/selections.js +1 -133
- package/esm/utils/selections.js.map +1 -1
- package/lib/connection-helpers.js +51 -18
- package/lib/connection-helpers.js.map +1 -1
- package/lib/drizzle-field-builder.js +136 -94
- package/lib/drizzle-field-builder.js.map +1 -1
- package/lib/field-builder.js +58 -44
- package/lib/field-builder.js.map +1 -1
- package/lib/index.js +36 -60
- package/lib/index.js.map +1 -1
- package/lib/model-loader.js +76 -45
- package/lib/model-loader.js.map +1 -1
- package/lib/schema-builder.js +40 -149
- package/lib/schema-builder.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/adapter.js +147 -0
- package/lib/utils/adapter.js.map +1 -0
- package/lib/utils/await-selections.js +20 -0
- package/lib/utils/await-selections.js.map +1 -0
- package/lib/utils/config.js +1 -4
- package/lib/utils/config.js.map +1 -1
- package/lib/utils/cursors.js +67 -90
- package/lib/utils/cursors.js.map +1 -1
- package/lib/utils/map-query.js +28 -359
- package/lib/utils/map-query.js.map +1 -1
- package/lib/utils/path-info.js +39 -0
- package/lib/utils/path-info.js.map +1 -0
- package/lib/utils/relation-filter.js +91 -0
- package/lib/utils/relation-filter.js.map +1 -0
- package/lib/utils/selections.js +3 -158
- package/lib/utils/selections.js.map +1 -1
- package/package.json +10 -8
- package/src/connection-helpers.ts +168 -54
- package/src/drizzle-field-builder.ts +296 -176
- package/src/field-builder.ts +110 -77
- package/src/global-types.ts +0 -32
- package/src/index.ts +42 -68
- package/src/model-loader.ts +110 -71
- package/src/schema-builder.ts +76 -169
- package/src/types.ts +178 -46
- package/src/utils/adapter.ts +197 -0
- package/src/utils/await-selections.ts +31 -0
- package/src/utils/config.ts +1 -5
- package/src/utils/cursors.ts +84 -83
- package/src/utils/map-query.ts +51 -734
- package/src/utils/path-info.ts +40 -0
- package/src/utils/relation-filter.ts +185 -0
- package/src/utils/selections.ts +2 -207
- package/dts/utils/deep-equal.d.ts +0 -2
- package/dts/utils/deep-equal.d.ts.map +0 -1
- package/dts/utils/drizzle-graphql.d.ts +0 -2
- package/dts/utils/drizzle-graphql.d.ts.map +0 -1
- package/dts/utils/loader-map.d.ts +0 -11
- package/dts/utils/loader-map.d.ts.map +0 -1
- package/dts/utils/usage.d.ts +0 -5
- package/dts/utils/usage.d.ts.map +0 -1
- package/esm/utils/deep-equal.d.ts +0 -2
- package/esm/utils/deep-equal.d.ts.map +0 -1
- package/esm/utils/deep-equal.js +0 -45
- package/esm/utils/deep-equal.js.map +0 -1
- package/esm/utils/drizzle-graphql.d.ts +0 -2
- package/esm/utils/drizzle-graphql.d.ts.map +0 -1
- package/esm/utils/drizzle-graphql.js +0 -232
- package/esm/utils/drizzle-graphql.js.map +0 -1
- package/esm/utils/loader-map.d.ts +0 -11
- package/esm/utils/loader-map.d.ts.map +0 -1
- package/esm/utils/loader-map.js +0 -35
- package/esm/utils/loader-map.js.map +0 -1
- package/esm/utils/usage.d.ts +0 -5
- package/esm/utils/usage.d.ts.map +0 -1
- package/esm/utils/usage.js +0 -59
- package/esm/utils/usage.js.map +0 -1
- package/lib/utils/deep-equal.js +0 -55
- package/lib/utils/deep-equal.js.map +0 -1
- package/lib/utils/drizzle-graphql.js +0 -236
- package/lib/utils/drizzle-graphql.js.map +0 -1
- package/lib/utils/loader-map.js +0 -56
- package/lib/utils/loader-map.js.map +0 -1
- package/lib/utils/usage.js +0 -83
- package/lib/utils/usage.js.map +0 -1
- package/src/utils/deep-equal.ts +0 -57
- package/src/utils/drizzle-graphql.ts +0 -274
- package/src/utils/loader-map.ts +0 -49
- package/src/utils/usage.ts +0 -62
package/src/utils/cursors.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeBase64,
|
|
3
|
+
decodeCursorChunk,
|
|
3
4
|
encodeBase64,
|
|
5
|
+
encodeCursorChunk,
|
|
6
|
+
encodeCursorTuple,
|
|
7
|
+
getConnectionPageSize,
|
|
4
8
|
type MaybePromise,
|
|
5
9
|
PothosValidationError,
|
|
6
10
|
type SchemaTypes,
|
|
11
|
+
validateConnectionArguments,
|
|
7
12
|
} from '@pothos/core';
|
|
8
13
|
import {
|
|
9
14
|
asc,
|
|
@@ -20,35 +25,17 @@ import {
|
|
|
20
25
|
type Table,
|
|
21
26
|
type TableRelationalConfig,
|
|
22
27
|
} from 'drizzle-orm';
|
|
23
|
-
import type { GraphQLResolveInfo } from 'graphql';
|
|
24
28
|
import type { ConnectionOrderBy, QueryForDrizzleConnection } from '../types.js';
|
|
29
|
+
import type { DrizzlePlan } from './adapter.js';
|
|
25
30
|
import type { PothosDrizzleSchemaConfig } from './config.js';
|
|
26
|
-
import {
|
|
31
|
+
import { queryFromPlan } from './map-query.js';
|
|
27
32
|
import { omitUndefinedKeys, type SelectionMap } from './selections.js';
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (value instanceof Date) {
|
|
38
|
-
return `D:${String(Number(value))}`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
switch (typeof value) {
|
|
42
|
-
case 'number':
|
|
43
|
-
return `N:${value}`;
|
|
44
|
-
case 'string':
|
|
45
|
-
return `S:${value}`;
|
|
46
|
-
case 'bigint':
|
|
47
|
-
return `I:${value}`;
|
|
48
|
-
default:
|
|
49
|
-
throw new PothosValidationError(`Unsupported cursor type ${typeof value}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
34
|
+
// The tagging is `@pothos/core`'s `encodeCursorChunk`, shared with the prisma plugins so the
|
|
35
|
+
// three can't drift apart again. A nullish ordering value is a position this plugin compares
|
|
36
|
+
// against with `is null`, and it now writes as a `Z:` chunk: it used to interpolate as the string
|
|
37
|
+
// `null`, which is not a chunk, so the cursor came back out as "Invalid cursor" on the next page.
|
|
38
|
+
export const formatCursorChunk = encodeCursorChunk;
|
|
52
39
|
|
|
53
40
|
export function formatDrizzleCursor(
|
|
54
41
|
record: Record<string, unknown>,
|
|
@@ -73,6 +60,33 @@ export function formatIDChunk(value: unknown) {
|
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
62
|
|
|
63
|
+
function formatCompoundIDValue(value: unknown) {
|
|
64
|
+
if (typeof value === 'bigint') {
|
|
65
|
+
return value.toString();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (value instanceof Date) {
|
|
69
|
+
return Number(value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function parseCompoundIDValue(value: unknown, field: Column) {
|
|
76
|
+
if (
|
|
77
|
+
field.dataType.startsWith('bigint') &&
|
|
78
|
+
(typeof value === 'string' || typeof value === 'number')
|
|
79
|
+
) {
|
|
80
|
+
return BigInt(value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (field.dataType === 'object date' && typeof value === 'number') {
|
|
84
|
+
return new Date(value);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
|
|
76
90
|
export function getIDSerializer(fields: Column[], config: PothosDrizzleSchemaConfig) {
|
|
77
91
|
if (fields.length === 0) {
|
|
78
92
|
throw new PothosValidationError('Column serializer must have at least one field');
|
|
@@ -80,8 +94,9 @@ export function getIDSerializer(fields: Column[], config: PothosDrizzleSchemaCon
|
|
|
80
94
|
|
|
81
95
|
return (value: Record<string, unknown>) => {
|
|
82
96
|
if (fields.length > 1) {
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
return `${JSON.stringify(
|
|
98
|
+
fields.map((col) => formatCompoundIDValue(value[config.columnToTsName(col)])),
|
|
99
|
+
)}`;
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
return `${formatIDChunk(value[config.columnToTsName(fields[0])])}`;
|
|
@@ -109,9 +124,7 @@ export function getColumnSerializer(
|
|
|
109
124
|
if (fields.length > 1) {
|
|
110
125
|
// each value carries its own type tag, the same ones a single value gets.
|
|
111
126
|
// Plain JSON would turn a Date into a string and refuse a bigint outright.
|
|
112
|
-
return
|
|
113
|
-
fields.map((field) => formatCursorChunk(value[cursorFieldKey(field, config)])),
|
|
114
|
-
)}`;
|
|
127
|
+
return encodeCursorTuple(fields.map((field) => value[cursorFieldKey(field, config)]));
|
|
115
128
|
}
|
|
116
129
|
|
|
117
130
|
return formatCursorChunk(value[cursorFieldKey(fields[0], config)]);
|
|
@@ -156,28 +169,9 @@ export function parseSerializedDrizzleColumn(value: unknown): unknown {
|
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
try {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case 'S':
|
|
163
|
-
return rawValue;
|
|
164
|
-
case 'N':
|
|
165
|
-
return Number.parseInt(rawValue, 10);
|
|
166
|
-
case 'D':
|
|
167
|
-
return new Date(Number.parseInt(rawValue, 10));
|
|
168
|
-
case 'J':
|
|
169
|
-
// compound values from before each one carried a tag: whatever JSON
|
|
170
|
-
// preserved is the best that can be recovered
|
|
171
|
-
return JSON.parse(rawValue) as unknown;
|
|
172
|
-
case 'T':
|
|
173
|
-
return (JSON.parse(rawValue) as (string | null)[]).map((chunk) =>
|
|
174
|
-
chunk === null ? null : parseSerializedDrizzleColumn(chunk),
|
|
175
|
-
);
|
|
176
|
-
case 'I':
|
|
177
|
-
return BigInt(rawValue);
|
|
178
|
-
default:
|
|
179
|
-
throw new PothosValidationError(`Invalid cursor type ${type}`);
|
|
180
|
-
}
|
|
172
|
+
// `@pothos/core`'s `decodeCursorChunk` reads every tag, including the `J:` a compound cursor
|
|
173
|
+
// used before each part carried one -- see `getCursorParser` for what happens to that array.
|
|
174
|
+
return decodeCursorChunk(value);
|
|
181
175
|
} catch {
|
|
182
176
|
throw new PothosValidationError(`Invalid serialized data: ${value}`);
|
|
183
177
|
}
|
|
@@ -190,7 +184,7 @@ export function parseSerializedIDColumn(id: string, field: Column): unknown {
|
|
|
190
184
|
|
|
191
185
|
try {
|
|
192
186
|
if (field.dataType.startsWith('number')) {
|
|
193
|
-
return Number
|
|
187
|
+
return Number(id);
|
|
194
188
|
}
|
|
195
189
|
|
|
196
190
|
if (field.dataType.startsWith('bigint')) {
|
|
@@ -202,7 +196,9 @@ export function parseSerializedIDColumn(id: string, field: Column): unknown {
|
|
|
202
196
|
}
|
|
203
197
|
|
|
204
198
|
if (field.dataType === 'object date') {
|
|
205
|
-
|
|
199
|
+
// `formatIDChunk` writes the epoch milliseconds; `new Date` of that string is an Invalid
|
|
200
|
+
// Date, since it is not a date format `Date` parses.
|
|
201
|
+
return new Date(Number(id));
|
|
206
202
|
}
|
|
207
203
|
|
|
208
204
|
throw new PothosValidationError(`Unsupported ID type ${field.dataType}`);
|
|
@@ -215,14 +211,16 @@ export function parseSerializedIDColumn(id: string, field: Column): unknown {
|
|
|
215
211
|
}
|
|
216
212
|
}
|
|
217
213
|
|
|
218
|
-
|
|
214
|
+
// Keyed by the typescript name, as `getIDSerializer` reads by: the record is a row of the table,
|
|
215
|
+
// and every consumer (the node ref's `parseId`, the model loader) looks columns up that way.
|
|
216
|
+
export function getIDParser(fields: readonly Column[], config: PothosDrizzleSchemaConfig) {
|
|
219
217
|
if (fields.length === 0) {
|
|
220
218
|
throw new PothosValidationError('Column parser must have at least one field');
|
|
221
219
|
}
|
|
222
220
|
|
|
223
221
|
return (value: string) => {
|
|
224
222
|
if (fields.length === 1) {
|
|
225
|
-
return { [fields[0]
|
|
223
|
+
return { [config.columnToTsName(fields[0])]: parseSerializedIDColumn(value, fields[0]) };
|
|
226
224
|
}
|
|
227
225
|
|
|
228
226
|
try {
|
|
@@ -243,7 +241,7 @@ export function getIDParser(fields: readonly Column[]) {
|
|
|
243
241
|
const record: Record<string, unknown> = {};
|
|
244
242
|
|
|
245
243
|
fields.forEach((field, i) => {
|
|
246
|
-
record[field
|
|
244
|
+
record[config.columnToTsName(field)] = parseCompoundIDValue(parsed[i], field);
|
|
247
245
|
});
|
|
248
246
|
|
|
249
247
|
return record;
|
|
@@ -307,6 +305,10 @@ export function getCursorParser(keys: readonly string[]) {
|
|
|
307
305
|
// the columns that came before it. Those still describe a position, just a
|
|
308
306
|
// less precise one, so the page is keyed off the prefix the cursor covers
|
|
309
307
|
// rather than rejected. Cursors returned by that page carry every column.
|
|
308
|
+
//
|
|
309
|
+
// The array is a `T:` chunk's values, each still its own type. A cursor issued before this
|
|
310
|
+
// release decodes from a `J:` chunk instead, whose parts arrive as whatever plain JSON
|
|
311
|
+
// preserved -- see the deprecated `J:` case in `@pothos/core`'s `decodeCursorChunk`.
|
|
310
312
|
const values = Array.isArray(parsed) ? parsed : [parsed];
|
|
311
313
|
|
|
312
314
|
if (values.length === 0) {
|
|
@@ -553,8 +555,8 @@ function keysetFilter(entries: OrderByEntry[], cursor: string, paging: 'after' |
|
|
|
553
555
|
export function drizzleCursorConnectionQuery({
|
|
554
556
|
args,
|
|
555
557
|
ctx,
|
|
556
|
-
maxSize
|
|
557
|
-
defaultSize
|
|
558
|
+
maxSize,
|
|
559
|
+
defaultSize,
|
|
558
560
|
orderBy,
|
|
559
561
|
extras,
|
|
560
562
|
where,
|
|
@@ -562,13 +564,7 @@ export function drizzleCursorConnectionQuery({
|
|
|
562
564
|
table,
|
|
563
565
|
}: DrizzleCursorConnectionQueryOptions) {
|
|
564
566
|
const { before, after, first, last } = args;
|
|
565
|
-
|
|
566
|
-
throw new PothosValidationError('Argument "first" must be a non-negative integer');
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (last != null && last < 0) {
|
|
570
|
-
throw new PothosValidationError('Argument "last" must be a non-negative integer');
|
|
571
|
-
}
|
|
567
|
+
validateConnectionArguments(args);
|
|
572
568
|
|
|
573
569
|
if (first != null && last != null) {
|
|
574
570
|
throw new PothosValidationError(
|
|
@@ -580,8 +576,13 @@ export function drizzleCursorConnectionQuery({
|
|
|
580
576
|
const defaultSizeForConnection =
|
|
581
577
|
typeof defaultSize === 'function' ? defaultSize(args, ctx) : defaultSize;
|
|
582
578
|
|
|
583
|
-
const limit =
|
|
584
|
-
|
|
579
|
+
const { limit } = getConnectionPageSize({
|
|
580
|
+
args,
|
|
581
|
+
defaultSize: defaultSizeForConnection,
|
|
582
|
+
maxSize: maxSizeForConnection,
|
|
583
|
+
});
|
|
584
|
+
// `last: 0` asks for the last zero rows, so it pages backwards like any other `last`.
|
|
585
|
+
const inverted = first == null && last != null;
|
|
585
586
|
|
|
586
587
|
const parsedOrderBy = parseOrderBy(config, table, orderBy, inverted, extras);
|
|
587
588
|
|
|
@@ -624,8 +625,11 @@ export function wrapConnectionResult<T extends {}>(
|
|
|
624
625
|
totalCount?: number | (() => MaybePromise<number>) | null,
|
|
625
626
|
) {
|
|
626
627
|
const gotFullResults = results.length === Math.abs(limit);
|
|
627
|
-
|
|
628
|
-
|
|
628
|
+
// `first`/`last` are compared against null rather than by truthiness, so `last: 0` reports the
|
|
629
|
+
// `pageInfo` of a backward page of zero rows rather than of a forward one.
|
|
630
|
+
const backward = args.first == null && args.last != null;
|
|
631
|
+
const hasNextPage = args.before ? true : args.last != null ? false : gotFullResults;
|
|
632
|
+
const hasPreviousPage = args.after ? true : backward ? gotFullResults : false;
|
|
629
633
|
const nodes = gotFullResults ? results.slice(0, -1) : results;
|
|
630
634
|
|
|
631
635
|
const connection = {
|
|
@@ -658,7 +662,7 @@ export function wrapConnectionResult<T extends {}>(
|
|
|
658
662
|
},
|
|
659
663
|
);
|
|
660
664
|
|
|
661
|
-
if (
|
|
665
|
+
if (backward) {
|
|
662
666
|
edges.reverse();
|
|
663
667
|
}
|
|
664
668
|
|
|
@@ -671,8 +675,8 @@ export function wrapConnectionResult<T extends {}>(
|
|
|
671
675
|
|
|
672
676
|
export async function resolveDrizzleCursorConnection<T extends {}>(
|
|
673
677
|
tableName: string,
|
|
674
|
-
|
|
675
|
-
|
|
678
|
+
// The settled plan of the connection's rows; the builder handed to `resolve` merges into it.
|
|
679
|
+
plan: DrizzlePlan | undefined,
|
|
676
680
|
config: PothosDrizzleSchemaConfig,
|
|
677
681
|
options: Omit<DrizzleCursorConnectionQueryOptions, 'orderBy' | 'config' | 'table'> & {
|
|
678
682
|
totalCount?: () => MaybePromise<number>;
|
|
@@ -697,10 +701,9 @@ export async function resolveDrizzleCursorConnection<T extends {}>(
|
|
|
697
701
|
});
|
|
698
702
|
formatter = getCursorFormatter(cursorFields, config);
|
|
699
703
|
|
|
700
|
-
query =
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
select: omitUndefinedKeys({
|
|
704
|
+
query = queryFromPlan(
|
|
705
|
+
plan,
|
|
706
|
+
omitUndefinedKeys({
|
|
704
707
|
...connectionQuery,
|
|
705
708
|
extras: q.extras,
|
|
706
709
|
columns: {
|
|
@@ -714,11 +717,7 @@ export async function resolveDrizzleCursorConnection<T extends {}>(
|
|
|
714
717
|
}
|
|
715
718
|
: q.where || connectionQuery.where,
|
|
716
719
|
}) as never,
|
|
717
|
-
|
|
718
|
-
typeName,
|
|
719
|
-
config,
|
|
720
|
-
// withUsageCheck: !!this.builder.options.prisma?.onUnusedQuery,
|
|
721
|
-
});
|
|
720
|
+
);
|
|
722
721
|
|
|
723
722
|
return query;
|
|
724
723
|
});
|
|
@@ -743,10 +742,12 @@ export async function resolveDrizzleCursorConnection<T extends {}>(
|
|
|
743
742
|
};
|
|
744
743
|
}
|
|
745
744
|
|
|
745
|
+
const { limit } = query;
|
|
746
|
+
|
|
746
747
|
return wrapConnectionResult(
|
|
747
748
|
results,
|
|
748
749
|
options.args,
|
|
749
|
-
|
|
750
|
+
limit as number,
|
|
750
751
|
formatter!,
|
|
751
752
|
undefined,
|
|
752
753
|
parent,
|