@pothos/plugin-drizzle 0.8.0 → 0.9.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/CHANGELOG.md +98 -0
- package/TODO.md +25 -4
- package/dts/connection-helpers.d.ts +32 -0
- package/dts/connection-helpers.d.ts.map +1 -0
- package/dts/drizzle-field-builder.d.ts +18 -53
- package/dts/drizzle-field-builder.d.ts.map +1 -1
- package/dts/global-types.d.ts +22 -41
- package/dts/global-types.d.ts.map +1 -1
- package/dts/index.d.ts +4 -2
- package/dts/index.d.ts.map +1 -1
- package/dts/interface-ref.d.ts +3 -2
- package/dts/interface-ref.d.ts.map +1 -1
- package/dts/model-loader.d.ts +3 -2
- package/dts/model-loader.d.ts.map +1 -1
- package/dts/node-ref.d.ts +1 -1
- package/dts/node-ref.d.ts.map +1 -1
- package/dts/object-ref.d.ts +2 -2
- package/dts/object-ref.d.ts.map +1 -1
- package/dts/types.d.ts +61 -41
- package/dts/types.d.ts.map +1 -1
- package/dts/utils/config.d.ts +4 -3
- package/dts/utils/config.d.ts.map +1 -1
- package/dts/utils/cursors.d.ts +13 -7
- package/dts/utils/cursors.d.ts.map +1 -1
- package/dts/utils/drizzle-graphql.d.ts +0 -17
- package/dts/utils/drizzle-graphql.d.ts.map +1 -1
- package/dts/utils/map-query.d.ts.map +1 -1
- package/dts/utils/selections.d.ts +5 -5
- package/dts/utils/selections.d.ts.map +1 -1
- package/esm/connection-helpers.d.ts +34 -0
- package/esm/connection-helpers.d.ts.map +1 -0
- package/esm/connection-helpers.js +74 -0
- package/esm/connection-helpers.js.map +1 -0
- package/esm/drizzle-field-builder.d.ts +18 -73
- package/esm/drizzle-field-builder.d.ts.map +1 -1
- package/esm/drizzle-field-builder.js +25 -14
- package/esm/drizzle-field-builder.js.map +1 -1
- package/esm/field-builder.js +2 -3
- package/esm/field-builder.js.map +1 -1
- package/esm/global-types.d.ts +35 -60
- package/esm/global-types.d.ts.map +1 -1
- package/esm/global-types.js.map +1 -1
- package/esm/index.d.ts +4 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +70 -61
- package/esm/index.js.map +1 -1
- package/esm/interface-ref.d.ts +3 -2
- package/esm/interface-ref.d.ts.map +1 -1
- package/esm/interface-ref.js.map +1 -1
- package/esm/model-loader.d.ts +3 -2
- package/esm/model-loader.d.ts.map +1 -1
- package/esm/model-loader.js +18 -10
- package/esm/model-loader.js.map +1 -1
- package/esm/node-ref.d.ts +1 -1
- package/esm/node-ref.d.ts.map +1 -1
- package/esm/object-ref.d.ts +2 -2
- package/esm/object-ref.d.ts.map +1 -1
- package/esm/schema-builder.js +111 -65
- package/esm/schema-builder.js.map +1 -1
- package/esm/types.d.ts +61 -41
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js.map +1 -1
- package/esm/utils/config.d.ts +4 -3
- package/esm/utils/config.d.ts.map +1 -1
- package/esm/utils/config.js +32 -15
- package/esm/utils/config.js.map +1 -1
- package/esm/utils/cursors.d.ts +13 -7
- package/esm/utils/cursors.d.ts.map +1 -1
- package/esm/utils/cursors.js +137 -63
- package/esm/utils/cursors.js.map +1 -1
- package/esm/utils/drizzle-graphql.d.ts +0 -17
- package/esm/utils/drizzle-graphql.d.ts.map +1 -1
- package/esm/utils/drizzle-graphql.js +230 -198
- package/esm/utils/drizzle-graphql.js.map +1 -1
- package/esm/utils/map-query.d.ts.map +1 -1
- package/esm/utils/map-query.js +9 -5
- package/esm/utils/map-query.js.map +1 -1
- package/esm/utils/selections.d.ts +5 -5
- package/esm/utils/selections.d.ts.map +1 -1
- package/esm/utils/selections.js +19 -18
- package/esm/utils/selections.js.map +1 -1
- package/lib/connection-helpers.js +85 -0
- package/lib/connection-helpers.js.map +1 -0
- package/lib/drizzle-field-builder.js +24 -13
- package/lib/drizzle-field-builder.js.map +1 -1
- package/lib/field-builder.js +2 -3
- package/lib/field-builder.js.map +1 -1
- package/lib/index.js +75 -60
- package/lib/index.js.map +1 -1
- package/lib/interface-ref.js.map +1 -1
- package/lib/model-loader.js +18 -10
- package/lib/model-loader.js.map +1 -1
- package/lib/schema-builder.js +111 -65
- package/lib/schema-builder.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/config.js +31 -14
- package/lib/utils/config.js.map +1 -1
- package/lib/utils/cursors.js +135 -63
- package/lib/utils/cursors.js.map +1 -1
- package/lib/utils/drizzle-graphql.js +230 -221
- package/lib/utils/drizzle-graphql.js.map +1 -1
- package/lib/utils/map-query.js +9 -5
- package/lib/utils/map-query.js.map +1 -1
- package/lib/utils/selections.js +18 -17
- package/lib/utils/selections.js.map +1 -1
- package/package.json +14 -14
- package/src/connection-helpers.ts +184 -0
- package/src/drizzle-field-builder.ts +30 -26
- package/src/field-builder.ts +4 -7
- package/src/global-types.ts +112 -119
- package/src/index.ts +90 -68
- package/src/interface-ref.ts +7 -3
- package/src/model-loader.ts +33 -17
- package/src/node-ref.ts +1 -1
- package/src/object-ref.ts +2 -2
- package/src/schema-builder.ts +114 -111
- package/src/types.ts +95 -62
- package/src/utils/config.ts +39 -30
- package/src/utils/cursors.ts +134 -101
- package/src/utils/drizzle-graphql.ts +273 -274
- package/src/utils/map-query.ts +19 -7
- package/src/utils/selections.ts +34 -28
package/src/interface-ref.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { InterfaceRef, type SchemaTypes } from '@pothos/core';
|
|
2
|
+
import type { DrizzleNodeRef } from './node-ref';
|
|
2
3
|
import { type DrizzleObjectRef, drizzleTableKey } from './object-ref';
|
|
3
4
|
|
|
4
5
|
export type DrizzleRef<
|
|
5
6
|
Types extends SchemaTypes,
|
|
6
|
-
Table extends keyof Types['
|
|
7
|
+
Table extends keyof Types['DrizzleRelationsConfig'] = keyof Types['DrizzleRelationsConfig'],
|
|
7
8
|
T = {},
|
|
8
|
-
> =
|
|
9
|
+
> =
|
|
10
|
+
| DrizzleInterfaceRef<Types, Table, T>
|
|
11
|
+
| DrizzleObjectRef<Types, Table, T>
|
|
12
|
+
| DrizzleNodeRef<Types, Table, T>;
|
|
9
13
|
|
|
10
14
|
export class DrizzleInterfaceRef<
|
|
11
15
|
Types extends SchemaTypes,
|
|
12
|
-
Table extends keyof Types['
|
|
16
|
+
Table extends keyof Types['DrizzleRelationsConfig'] = keyof Types['DrizzleRelationsConfig'],
|
|
13
17
|
T = {},
|
|
14
18
|
> extends InterfaceRef<Types, T> {
|
|
15
19
|
[drizzleTableKey]!: Table;
|
package/src/model-loader.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { type SchemaTypes, createContextCache } from '@pothos/core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type AnyTable,
|
|
4
|
+
type Column,
|
|
5
|
+
type SQL,
|
|
6
|
+
type TableRelationalConfig,
|
|
7
|
+
inArray,
|
|
8
|
+
sql,
|
|
9
|
+
} from 'drizzle-orm';
|
|
3
10
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
4
|
-
import type { DrizzleClient } from './types';
|
|
5
11
|
import { type PothosDrizzleSchemaConfig, getClient, getSchemaConfig } from './utils/config';
|
|
6
12
|
import { cacheKey, setLoaderMappings } from './utils/loader-map';
|
|
7
13
|
import { selectionStateFromInfo, stateFromInfo } from './utils/map-query';
|
|
@@ -35,7 +41,8 @@ export class ModelLoader {
|
|
|
35
41
|
config: PothosDrizzleSchemaConfig;
|
|
36
42
|
table: TableRelationalConfig;
|
|
37
43
|
columns: Column[];
|
|
38
|
-
|
|
44
|
+
primaryKey: Column[];
|
|
45
|
+
selectSQL: (table: AnyTable<{}>) => SQL;
|
|
39
46
|
|
|
40
47
|
constructor(
|
|
41
48
|
context: object,
|
|
@@ -47,12 +54,17 @@ export class ModelLoader {
|
|
|
47
54
|
this.builder = builder;
|
|
48
55
|
this.modelName = modelName;
|
|
49
56
|
this.config = getSchemaConfig(builder);
|
|
50
|
-
this.table = this.config.
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
this.table = this.config.relations.tablesConfig[modelName];
|
|
58
|
+
this.primaryKey = this.config.getPrimaryKey(modelName);
|
|
59
|
+
this.columns = columns ?? this.primaryKey;
|
|
60
|
+
this.selectSQL = (table) => {
|
|
61
|
+
const columns = this.columns.map((column) =>
|
|
62
|
+
Object.values(table).find(
|
|
63
|
+
(tblColumn) => 'columnType' in tblColumn && tblColumn.name === column.name,
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
return columns.length > 1 ? sql`(${sql.join(columns, sql`, `)})` : columns[0].getSQL();
|
|
67
|
+
};
|
|
56
68
|
}
|
|
57
69
|
|
|
58
70
|
static forModel<Types extends SchemaTypes>(
|
|
@@ -84,7 +96,7 @@ export class ModelLoader {
|
|
|
84
96
|
const selection = selectionStateFromInfo(this.config, this.context, info);
|
|
85
97
|
this.queryCache.set(key, {
|
|
86
98
|
selection,
|
|
87
|
-
query: selectionToQuery(selection),
|
|
99
|
+
query: selectionToQuery(this.config, selection),
|
|
88
100
|
});
|
|
89
101
|
}
|
|
90
102
|
|
|
@@ -103,7 +115,7 @@ export class ModelLoader {
|
|
|
103
115
|
|
|
104
116
|
this.queryCache.set(key, {
|
|
105
117
|
selection,
|
|
106
|
-
query: selectionToQuery(selection),
|
|
118
|
+
query: selectionToQuery(this.config, selection),
|
|
107
119
|
});
|
|
108
120
|
}
|
|
109
121
|
|
|
@@ -167,6 +179,7 @@ export class ModelLoader {
|
|
|
167
179
|
|
|
168
180
|
nextTick.promise
|
|
169
181
|
.then(() => {
|
|
182
|
+
this.staged.delete(entry);
|
|
170
183
|
const api = (
|
|
171
184
|
client.query as Record<
|
|
172
185
|
string,
|
|
@@ -175,18 +188,21 @@ export class ModelLoader {
|
|
|
175
188
|
)[this.modelName];
|
|
176
189
|
|
|
177
190
|
const query = api.findMany({
|
|
178
|
-
...selectionToQuery(selection),
|
|
179
|
-
where:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
191
|
+
...selectionToQuery(this.config, selection),
|
|
192
|
+
where: {
|
|
193
|
+
RAW: (table: AnyTable<{}>) =>
|
|
194
|
+
inArray(
|
|
195
|
+
this.selectSQL(table),
|
|
196
|
+
[...entry.models.keys()].map((model) => this.sqlForModel(model)),
|
|
197
|
+
),
|
|
198
|
+
},
|
|
183
199
|
});
|
|
184
200
|
|
|
185
201
|
query.then(
|
|
186
202
|
(results) => {
|
|
187
203
|
for (const [model, promise] of entry.models.entries()) {
|
|
188
204
|
const result = results.find((row) =>
|
|
189
|
-
this.
|
|
205
|
+
this.primaryKey.every(
|
|
190
206
|
(key) => row[key.name] === (model as Record<string, unknown>)[key.name],
|
|
191
207
|
),
|
|
192
208
|
);
|
package/src/node-ref.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const relayIDShapeKey = Symbol.for('Pothos.relayIDShapeKey');
|
|
|
5
5
|
|
|
6
6
|
export class DrizzleNodeRef<
|
|
7
7
|
Types extends SchemaTypes,
|
|
8
|
-
Table extends keyof Types['
|
|
8
|
+
Table extends keyof Types['DrizzleRelationsConfig'] = keyof Types['DrizzleRelationsConfig'],
|
|
9
9
|
T = {},
|
|
10
10
|
IDShape = string,
|
|
11
11
|
> extends DrizzleObjectRef<Types, Table, T> {
|
package/src/object-ref.ts
CHANGED
|
@@ -11,10 +11,10 @@ export const drizzleTableKey = Symbol.for('Pothos.drizzleTableKey');
|
|
|
11
11
|
|
|
12
12
|
export class DrizzleObjectRef<
|
|
13
13
|
Types extends SchemaTypes,
|
|
14
|
-
Table extends keyof Types['
|
|
14
|
+
Table extends keyof Types['DrizzleRelationsConfig'] = keyof Types['DrizzleRelationsConfig'],
|
|
15
15
|
T = {},
|
|
16
16
|
> extends ObjectRef<Types, T> {
|
|
17
|
-
[drizzleTableKey]!: Types['
|
|
17
|
+
[drizzleTableKey]!: Types['DrizzleRelationsConfig'][Table];
|
|
18
18
|
|
|
19
19
|
[abstractReturnShapeKey]!: WithBrand<T>;
|
|
20
20
|
|
package/src/schema-builder.ts
CHANGED
|
@@ -37,7 +37,7 @@ schemaBuilderProto.drizzleObject = function drizzleObject(table, { select, field
|
|
|
37
37
|
extensions: {
|
|
38
38
|
...options.extensions,
|
|
39
39
|
pothosDrizzleModel: table,
|
|
40
|
-
pothosDrizzleTable: getSchemaConfig(this).
|
|
40
|
+
pothosDrizzleTable: getSchemaConfig(this).relations.tablesConfig[table],
|
|
41
41
|
pothosDrizzleSelect: select ?? {},
|
|
42
42
|
pothosDrizzleLoader: ModelLoader.forModel(table, this),
|
|
43
43
|
},
|
|
@@ -54,18 +54,14 @@ schemaBuilderProto.drizzleInterface = function drizzleInterface(
|
|
|
54
54
|
) {
|
|
55
55
|
const name = options.name ?? table;
|
|
56
56
|
|
|
57
|
-
const ref =
|
|
58
|
-
? new DrizzleInterfaceRef(options.variant, name)
|
|
59
|
-
: (getRefFromModel(table, this, 'interface') as InterfaceRef<SchemaTypes, unknown>);
|
|
60
|
-
|
|
61
|
-
ref.name = name ?? table;
|
|
57
|
+
const ref = new DrizzleInterfaceRef(name, table);
|
|
62
58
|
|
|
63
59
|
this.interfaceType(ref, {
|
|
64
60
|
...(options as {}),
|
|
65
61
|
extensions: {
|
|
66
62
|
...options.extensions,
|
|
67
63
|
pothosDrizzleModel: table,
|
|
68
|
-
pothosDrizzleTable: getSchemaConfig(this).
|
|
64
|
+
pothosDrizzleTable: getSchemaConfig(this).relations.tablesConfig[table],
|
|
69
65
|
pothosDrizzleSelect: select ?? {},
|
|
70
66
|
pothosDrizzleLoader: ModelLoader.forModel(table, this),
|
|
71
67
|
},
|
|
@@ -82,7 +78,7 @@ schemaBuilderProto.drizzleNode = function drizzleNode(
|
|
|
82
78
|
this: PothosSchemaTypes.SchemaBuilder<SchemaTypes> & {
|
|
83
79
|
nodeInterfaceRef?: () => InterfaceRef<SchemaTypes, unknown>;
|
|
84
80
|
},
|
|
85
|
-
table: keyof SchemaTypes['
|
|
81
|
+
table: keyof SchemaTypes['DrizzleRelations']['config'],
|
|
86
82
|
{
|
|
87
83
|
id: { column, ...idOptions },
|
|
88
84
|
name,
|
|
@@ -90,7 +86,7 @@ schemaBuilderProto.drizzleNode = function drizzleNode(
|
|
|
90
86
|
...options
|
|
91
87
|
}: DrizzleNodeOptions<
|
|
92
88
|
SchemaTypes,
|
|
93
|
-
keyof SchemaTypes['
|
|
89
|
+
keyof SchemaTypes['DrizzleRelations']['config'],
|
|
94
90
|
{},
|
|
95
91
|
{},
|
|
96
92
|
[],
|
|
@@ -98,7 +94,7 @@ schemaBuilderProto.drizzleNode = function drizzleNode(
|
|
|
98
94
|
>,
|
|
99
95
|
) {
|
|
100
96
|
const schemaConfig = getSchemaConfig(this);
|
|
101
|
-
const tableConfig = schemaConfig.
|
|
97
|
+
const tableConfig = schemaConfig.relations.tablesConfig[table];
|
|
102
98
|
const idColumn = typeof column === 'function' ? column(tableConfig.columns) : column;
|
|
103
99
|
const idColumns = Array.isArray(idColumn) ? idColumn : [idColumn];
|
|
104
100
|
const interfaceRef = this.nodeInterfaceRef?.();
|
|
@@ -106,7 +102,14 @@ schemaBuilderProto.drizzleNode = function drizzleNode(
|
|
|
106
102
|
const idParser = getIDParser(idColumns);
|
|
107
103
|
const typeName = variant ?? name ?? table;
|
|
108
104
|
const nodeRef = new DrizzleNodeRef(typeName, table, {
|
|
109
|
-
parseId:
|
|
105
|
+
parseId: (id) => {
|
|
106
|
+
const parsed = idParser(id);
|
|
107
|
+
if (Array.isArray(idColumn)) {
|
|
108
|
+
return parsed;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return parsed[schemaConfig.columnToTsName(idColumn)];
|
|
112
|
+
},
|
|
110
113
|
});
|
|
111
114
|
const modelLoader = ModelLoader.forModel(table, this, idColumns);
|
|
112
115
|
|
|
@@ -206,106 +209,106 @@ schemaBuilderProto.drizzleInterfaceFields = function drizzleInterfaceFields(type
|
|
|
206
209
|
});
|
|
207
210
|
};
|
|
208
211
|
|
|
209
|
-
schemaBuilderProto.drizzleGraphQLOrderBy = function drizzleGraphQLOrderBy(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
} as never;
|
|
212
|
+
// schemaBuilderProto.drizzleGraphQLOrderBy = function drizzleGraphQLOrderBy(
|
|
213
|
+
// this: PothosSchemaTypes.SchemaBuilder<SchemaTypes>,
|
|
214
|
+
// table: string,
|
|
215
|
+
// type: GraphQLInputObjectType,
|
|
216
|
+
// options?: { extensions?: object },
|
|
217
|
+
// ) {
|
|
218
|
+
// return (
|
|
219
|
+
// this as typeof this & {
|
|
220
|
+
// addGraphQLInput: (
|
|
221
|
+
// type: GraphQLInputObjectType,
|
|
222
|
+
// options: Record<string, unknown>,
|
|
223
|
+
// ) => InputObjectRef<SchemaTypes, {}>;
|
|
224
|
+
// }
|
|
225
|
+
// ).addGraphQLInput(type, {
|
|
226
|
+
// ...options,
|
|
227
|
+
// extensions: {
|
|
228
|
+
// ...options?.extensions,
|
|
229
|
+
// drizzleGraphQL: {
|
|
230
|
+
// inputType: 'orderBy',
|
|
231
|
+
// table,
|
|
232
|
+
// tableConfig: getSchemaConfig(this).relations.tablesConfig[table],
|
|
233
|
+
// } satisfies DrizzleGraphQLInputExtensions,
|
|
234
|
+
// },
|
|
235
|
+
// });
|
|
236
|
+
// } as never;
|
|
234
237
|
|
|
235
|
-
schemaBuilderProto.drizzleGraphQLFilters = function drizzleGraphQLFilters(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
} as never;
|
|
238
|
+
// schemaBuilderProto.drizzleGraphQLFilters = function drizzleGraphQLFilters(
|
|
239
|
+
// this: PothosSchemaTypes.SchemaBuilder<SchemaTypes>,
|
|
240
|
+
// table: string,
|
|
241
|
+
// type: GraphQLInputObjectType,
|
|
242
|
+
// options?: { extensions?: object },
|
|
243
|
+
// ) {
|
|
244
|
+
// return (
|
|
245
|
+
// this as typeof this & {
|
|
246
|
+
// addGraphQLInput: (
|
|
247
|
+
// type: GraphQLInputObjectType,
|
|
248
|
+
// options: Record<string, unknown>,
|
|
249
|
+
// ) => InputObjectRef<SchemaTypes, {}>;
|
|
250
|
+
// }
|
|
251
|
+
// ).addGraphQLInput(type, {
|
|
252
|
+
// ...options,
|
|
253
|
+
// extensions: {
|
|
254
|
+
// ...options?.extensions,
|
|
255
|
+
// drizzleGraphQL: {
|
|
256
|
+
// inputType: 'filters',
|
|
257
|
+
// table,
|
|
258
|
+
// tableConfig: getSchemaConfig(this).relations.tablesConfig[table],
|
|
259
|
+
// } satisfies DrizzleGraphQLInputExtensions,
|
|
260
|
+
// },
|
|
261
|
+
// });
|
|
262
|
+
// } as never;
|
|
260
263
|
|
|
261
|
-
schemaBuilderProto.drizzleGraphQLInsert = function drizzleGraphQLInsert(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
} as never;
|
|
264
|
+
// schemaBuilderProto.drizzleGraphQLInsert = function drizzleGraphQLInsert(
|
|
265
|
+
// this: PothosSchemaTypes.SchemaBuilder<SchemaTypes>,
|
|
266
|
+
// table: string,
|
|
267
|
+
// type: GraphQLInputObjectType,
|
|
268
|
+
// options?: { extensions?: object },
|
|
269
|
+
// ) {
|
|
270
|
+
// return (
|
|
271
|
+
// this as typeof this & {
|
|
272
|
+
// addGraphQLInput: (
|
|
273
|
+
// type: GraphQLInputObjectType,
|
|
274
|
+
// options: Record<string, unknown>,
|
|
275
|
+
// ) => InputObjectRef<SchemaTypes, {}>;
|
|
276
|
+
// }
|
|
277
|
+
// ).addGraphQLInput(type, {
|
|
278
|
+
// ...options,
|
|
279
|
+
// extensions: {
|
|
280
|
+
// ...options?.extensions,
|
|
281
|
+
// drizzleGraphQL: {
|
|
282
|
+
// inputType: 'insert',
|
|
283
|
+
// table,
|
|
284
|
+
// tableConfig: getSchemaConfig(this).relations.tablesConfig[table],
|
|
285
|
+
// } satisfies DrizzleGraphQLInputExtensions,
|
|
286
|
+
// },
|
|
287
|
+
// });
|
|
288
|
+
// } as never;
|
|
286
289
|
|
|
287
|
-
schemaBuilderProto.drizzleGraphQLUpdate = function drizzleGraphQLUpdate(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
} as never;
|
|
290
|
+
// schemaBuilderProto.drizzleGraphQLUpdate = function drizzleGraphQLUpdate(
|
|
291
|
+
// this: PothosSchemaTypes.SchemaBuilder<SchemaTypes>,
|
|
292
|
+
// table: string,
|
|
293
|
+
// type: GraphQLInputObjectType,
|
|
294
|
+
// options?: { extensions?: object },
|
|
295
|
+
// ) {
|
|
296
|
+
// return (
|
|
297
|
+
// this as typeof this & {
|
|
298
|
+
// addGraphQLInput: (
|
|
299
|
+
// type: GraphQLInputObjectType,
|
|
300
|
+
// options: Record<string, unknown>,
|
|
301
|
+
// ) => InputObjectRef<SchemaTypes, {}>;
|
|
302
|
+
// }
|
|
303
|
+
// ).addGraphQLInput(type, {
|
|
304
|
+
// ...options,
|
|
305
|
+
// extensions: {
|
|
306
|
+
// ...options?.extensions,
|
|
307
|
+
// drizzleGraphQL: {
|
|
308
|
+
// inputType: 'update',
|
|
309
|
+
// table,
|
|
310
|
+
// tableConfig: getSchemaConfig(this).relations.tablesConfig[table],
|
|
311
|
+
// } satisfies DrizzleGraphQLInputExtensions,
|
|
312
|
+
// },
|
|
313
|
+
// });
|
|
314
|
+
// } as never;
|