@pothos/plugin-drizzle 0.0.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +6 -0
  3. package/README.md +437 -0
  4. package/TODO.md +21 -0
  5. package/drizzle/meta/_journal.json +1 -0
  6. package/drizzle.config.ts +10 -0
  7. package/dts/drizzle-field-builder.d.ts +124 -0
  8. package/dts/drizzle-field-builder.d.ts.map +1 -0
  9. package/dts/field-builder.d.ts +2 -0
  10. package/dts/field-builder.d.ts.map +1 -0
  11. package/dts/global-types.d.ts +92 -0
  12. package/dts/global-types.d.ts.map +1 -0
  13. package/dts/index.d.ts +13 -0
  14. package/dts/index.d.ts.map +1 -0
  15. package/dts/interface-ref.d.ts +9 -0
  16. package/dts/interface-ref.d.ts.map +1 -0
  17. package/dts/model-loader.d.ts +44 -0
  18. package/dts/model-loader.d.ts.map +1 -0
  19. package/dts/node-ref.d.ts +5 -0
  20. package/dts/node-ref.d.ts.map +1 -0
  21. package/dts/object-ref.d.ts +14 -0
  22. package/dts/object-ref.d.ts.map +1 -0
  23. package/dts/schema-builder.d.ts +2 -0
  24. package/dts/schema-builder.d.ts.map +1 -0
  25. package/dts/types.d.ts +147 -0
  26. package/dts/types.d.ts.map +1 -0
  27. package/dts/utils/config.d.ts +7 -0
  28. package/dts/utils/config.d.ts.map +1 -0
  29. package/dts/utils/cursors.d.ts +58 -0
  30. package/dts/utils/cursors.d.ts.map +1 -0
  31. package/dts/utils/deep-equal.d.ts +2 -0
  32. package/dts/utils/deep-equal.d.ts.map +1 -0
  33. package/dts/utils/drizzle-graphql.d.ts +18 -0
  34. package/dts/utils/drizzle-graphql.d.ts.map +1 -0
  35. package/dts/utils/loader-map.d.ts +11 -0
  36. package/dts/utils/loader-map.d.ts.map +1 -0
  37. package/dts/utils/map-query.d.ts +30 -0
  38. package/dts/utils/map-query.d.ts.map +1 -0
  39. package/dts/utils/refs.d.ts +5 -0
  40. package/dts/utils/refs.d.ts.map +1 -0
  41. package/dts/utils/selections.d.ts +22 -0
  42. package/dts/utils/selections.d.ts.map +1 -0
  43. package/dts/utils/usage.d.ts +5 -0
  44. package/dts/utils/usage.d.ts.map +1 -0
  45. package/esm/drizzle-field-builder.d.ts +216 -0
  46. package/esm/drizzle-field-builder.d.ts.map +1 -0
  47. package/esm/field-builder.d.ts +2 -0
  48. package/esm/field-builder.d.ts.map +1 -0
  49. package/esm/global-types.d.ts +124 -0
  50. package/esm/global-types.d.ts.map +1 -0
  51. package/esm/index.d.ts +13 -0
  52. package/esm/index.d.ts.map +1 -0
  53. package/esm/interface-ref.d.ts +9 -0
  54. package/esm/interface-ref.d.ts.map +1 -0
  55. package/esm/model-loader.d.ts +45 -0
  56. package/esm/model-loader.d.ts.map +1 -0
  57. package/esm/node-ref.d.ts +5 -0
  58. package/esm/node-ref.d.ts.map +1 -0
  59. package/esm/object-ref.d.ts +14 -0
  60. package/esm/object-ref.d.ts.map +1 -0
  61. package/esm/package.json +3 -0
  62. package/esm/schema-builder.d.ts +2 -0
  63. package/esm/schema-builder.d.ts.map +1 -0
  64. package/esm/src/drizzle-field-builder.js +215 -0
  65. package/esm/src/drizzle-field-builder.js.map +1 -0
  66. package/esm/src/field-builder.js +77 -0
  67. package/esm/src/field-builder.js.map +1 -0
  68. package/esm/src/global-types.js +2 -0
  69. package/esm/src/global-types.js.map +1 -0
  70. package/esm/src/index.js +107 -0
  71. package/esm/src/index.js.map +1 -0
  72. package/esm/src/interface-ref.js +26 -0
  73. package/esm/src/interface-ref.js.map +1 -0
  74. package/esm/src/model-loader.js +168 -0
  75. package/esm/src/model-loader.js.map +1 -0
  76. package/esm/src/node-ref.js +4 -0
  77. package/esm/src/node-ref.js.map +1 -0
  78. package/esm/src/object-ref.js +38 -0
  79. package/esm/src/object-ref.js.map +1 -0
  80. package/esm/src/schema-builder.js +190 -0
  81. package/esm/src/schema-builder.js.map +1 -0
  82. package/esm/src/types.js +2 -0
  83. package/esm/src/types.js.map +1 -0
  84. package/esm/src/utils/config.js +15 -0
  85. package/esm/src/utils/config.js.map +1 -0
  86. package/esm/src/utils/cursors.js +316 -0
  87. package/esm/src/utils/cursors.js.map +1 -0
  88. package/esm/src/utils/deep-equal.js +44 -0
  89. package/esm/src/utils/deep-equal.js.map +1 -0
  90. package/esm/src/utils/drizzle-graphql.js +176 -0
  91. package/esm/src/utils/drizzle-graphql.js.map +1 -0
  92. package/esm/src/utils/loader-map.js +35 -0
  93. package/esm/src/utils/loader-map.js.map +1 -0
  94. package/esm/src/utils/map-query.js +284 -0
  95. package/esm/src/utils/map-query.js.map +1 -0
  96. package/esm/src/utils/refs.js +14 -0
  97. package/esm/src/utils/refs.js.map +1 -0
  98. package/esm/src/utils/selections.js +136 -0
  99. package/esm/src/utils/selections.js.map +1 -0
  100. package/esm/src/utils/usage.js +59 -0
  101. package/esm/src/utils/usage.js.map +1 -0
  102. package/esm/types.d.ts +161 -0
  103. package/esm/types.d.ts.map +1 -0
  104. package/esm/utils/config.d.ts +7 -0
  105. package/esm/utils/config.d.ts.map +1 -0
  106. package/esm/utils/cursors.d.ts +58 -0
  107. package/esm/utils/cursors.d.ts.map +1 -0
  108. package/esm/utils/deep-equal.d.ts +2 -0
  109. package/esm/utils/deep-equal.d.ts.map +1 -0
  110. package/esm/utils/drizzle-graphql.d.ts +18 -0
  111. package/esm/utils/drizzle-graphql.d.ts.map +1 -0
  112. package/esm/utils/loader-map.d.ts +11 -0
  113. package/esm/utils/loader-map.d.ts.map +1 -0
  114. package/esm/utils/map-query.d.ts +30 -0
  115. package/esm/utils/map-query.d.ts.map +1 -0
  116. package/esm/utils/refs.d.ts +5 -0
  117. package/esm/utils/refs.d.ts.map +1 -0
  118. package/esm/utils/selections.d.ts +22 -0
  119. package/esm/utils/selections.d.ts.map +1 -0
  120. package/esm/utils/usage.d.ts +5 -0
  121. package/esm/utils/usage.d.ts.map +1 -0
  122. package/lib/src/drizzle-field-builder.js +225 -0
  123. package/lib/src/drizzle-field-builder.js.map +1 -0
  124. package/lib/src/field-builder.js +82 -0
  125. package/lib/src/field-builder.js.map +1 -0
  126. package/lib/src/global-types.js +6 -0
  127. package/lib/src/global-types.js.map +1 -0
  128. package/lib/src/index.js +180 -0
  129. package/lib/src/index.js.map +1 -0
  130. package/lib/src/interface-ref.js +36 -0
  131. package/lib/src/interface-ref.js.map +1 -0
  132. package/lib/src/model-loader.js +176 -0
  133. package/lib/src/model-loader.js.map +1 -0
  134. package/lib/src/node-ref.js +15 -0
  135. package/lib/src/node-ref.js.map +1 -0
  136. package/lib/src/object-ref.js +56 -0
  137. package/lib/src/object-ref.js.map +1 -0
  138. package/lib/src/schema-builder.js +236 -0
  139. package/lib/src/schema-builder.js.map +1 -0
  140. package/lib/src/types.js +13 -0
  141. package/lib/src/types.js.map +1 -0
  142. package/lib/src/utils/config.js +26 -0
  143. package/lib/src/utils/config.js.map +1 -0
  144. package/lib/src/utils/cursors.js +362 -0
  145. package/lib/src/utils/cursors.js.map +1 -0
  146. package/lib/src/utils/deep-equal.js +55 -0
  147. package/lib/src/utils/deep-equal.js.map +1 -0
  148. package/lib/src/utils/drizzle-graphql.js +192 -0
  149. package/lib/src/utils/drizzle-graphql.js.map +1 -0
  150. package/lib/src/utils/loader-map.js +57 -0
  151. package/lib/src/utils/loader-map.js.map +1 -0
  152. package/lib/src/utils/map-query.js +308 -0
  153. package/lib/src/utils/map-query.js.map +1 -0
  154. package/lib/src/utils/refs.js +33 -0
  155. package/lib/src/utils/refs.js.map +1 -0
  156. package/lib/src/utils/selections.js +163 -0
  157. package/lib/src/utils/selections.js.map +1 -0
  158. package/lib/src/utils/usage.js +84 -0
  159. package/lib/src/utils/usage.js.map +1 -0
  160. package/package.json +66 -0
  161. package/src/drizzle-field-builder.ts +500 -0
  162. package/src/field-builder.ts +168 -0
  163. package/src/global-types.ts +481 -0
  164. package/src/index.ts +175 -0
  165. package/src/interface-ref.ts +24 -0
  166. package/src/model-loader.ts +235 -0
  167. package/src/node-ref.ts +8 -0
  168. package/src/object-ref.ts +51 -0
  169. package/src/schema-builder.ts +299 -0
  170. package/src/types.ts +640 -0
  171. package/src/utils/config.ts +28 -0
  172. package/src/utils/cursors.ts +446 -0
  173. package/src/utils/deep-equal.ts +58 -0
  174. package/src/utils/drizzle-graphql.ts +235 -0
  175. package/src/utils/loader-map.ts +51 -0
  176. package/src/utils/map-query.ts +582 -0
  177. package/src/utils/refs.ts +25 -0
  178. package/src/utils/selections.ts +209 -0
  179. package/src/utils/usage.ts +64 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @pothos/plugin-drizzle
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - dd2e758: Initial preview release
package/LICENSE ADDED
@@ -0,0 +1,6 @@
1
+ ISC License (ISC)
2
+ Copyright 2021 Michael Hayes
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,437 @@
1
+ # Drizzle Plugin
2
+
3
+ ## Installing
4
+
5
+ ```package-install
6
+ npm install --save @pothos/plugin-drizzle
7
+ ```
8
+
9
+ The drizzle plugin is built on top of drizzles relational query builder, and requires that you
10
+ define and configure all the relevant relations in your drizzle schema. See
11
+ https://orm.drizzle.team/docs/rqb for detailed documentation on the relations API.
12
+
13
+ In addition to defining relations, the Pothos drizzle plugin also requires defining a `primaryKey`
14
+ for every table used as a `drizzleObject`, `drizzleNode`, or `drizzleInterface`.
15
+
16
+ Once you have configured you have configured you drizzle schema, you can initialize your Pothos
17
+ SchemaBuilder with the drizzle plugin:
18
+
19
+ ```ts
20
+ import * as schema from './schema';
21
+ import { drizzle } from 'drizzle-orm/...';
22
+ import SchemaBuilder from '@pothos/core';
23
+ import DrizzlePlugin from '@pothos/plugin-drizzle';
24
+
25
+ const db = drizzle(client, { schema });
26
+
27
+ export interface PothosTypes {
28
+ DrizzleSchema: typeof schema;
29
+ }
30
+
31
+ const builder = new SchemaBuilder<PothosTypes>({
32
+ plugins: [DrizzlePlugin],
33
+ drizzle: {
34
+ client: db,
35
+ },
36
+ });
37
+ ```
38
+
39
+ ### Integration with other plugins
40
+
41
+ The drizzle plugin has integrations with several other plugins. While the `with-input` and `relay`
42
+ plugins are not required, many examples will assume these plugins have been installed:
43
+
44
+ ```ts
45
+ import * as schema from './schema';
46
+ import { drizzle } from 'drizzle-orm/...';
47
+ import SchemaBuilder from '@pothos/core';
48
+ import DrizzlePlugin from '@pothos/plugin-drizzle';
49
+ import RelayPlugin from '@pothos/plugin-scope-auth';
50
+ import WithInputPlugin from '@pothos/plugin-with-input';
51
+
52
+ const db = drizzle(client, { schema });
53
+
54
+ export interface PothosTypes {
55
+ DrizzleSchema: typeof schema;
56
+ }
57
+
58
+ const builder = new SchemaBuilder<PothosTypes>({
59
+ plugins: [RelayPlugin, WithInputPlugin, DrizzlePlugin],
60
+ drizzle: {
61
+ client: db,
62
+ },
63
+ });
64
+ ```
65
+
66
+ ## Defining Objects
67
+
68
+ The `builder.drizzleObject` method can be used to define GraphQL Object types based on a drizzle
69
+ table:
70
+
71
+ ```ts
72
+ const UserRef = builder.drizzleObject('users', {
73
+ name: 'User',
74
+ fields: (t) => ({
75
+ firstName: t.exposeString('first_name'),
76
+ lastName: t.exposeString('last_name'),
77
+ }),
78
+ });
79
+ ```
80
+
81
+ You will be able to "expose" any column in the table, and GraphQL fields do not need to match the
82
+ names of the columns in your database. The returned `UserRef` can be used like any other `ObjectRef`
83
+ in Pothos.
84
+
85
+ ## Custom fields
86
+
87
+ You will often want to define fields in your API that do not correspond to a specific database
88
+ column. To do this, you can define fields with a resolver like any other Pothos object type:
89
+
90
+ ```ts
91
+ const UserRef = builder.drizzleObject('users', {
92
+ name: 'User',
93
+ fields: (t) => ({
94
+ fullName: t.string({
95
+ resolve: (user, args, ctx, info) => `${user.first_name} ${user.last_name}`,
96
+ }),
97
+ }),
98
+ });
99
+ ```
100
+
101
+ ## Type selections
102
+
103
+ In the above example, you can see that by default we have access to all columns of our table. For
104
+ tables with many columns, it can be more efficient to only select the needed columns. You can
105
+ configure the selected columns, and relations by passing a `select` option when defining the type:
106
+
107
+ ```ts
108
+ const UserRef = builder.drizzleObject('users', {
109
+ name: 'User',
110
+ select: {
111
+ columns: {
112
+ first_name: true,
113
+ last_name: true,
114
+ },
115
+ with: {
116
+ profile: true,
117
+ },
118
+ extras: {
119
+ lowercaseName: sql<string>`lower(${users.firstName})`.as('lowercaseName'),
120
+ },
121
+ },
122
+ fields: (t) => ({
123
+ fullName: t.string({
124
+ resolve: (user, args, ctx, info) => `${user.first_name} ${user.last_name}`,
125
+ }),
126
+ bio: t.string({
127
+ resolve: (user) => user.profile.bio,
128
+ }),
129
+ email: t.string({
130
+ resolve: (user) => `${user.lowercaseName}@example.com`,
131
+ }),
132
+ }),
133
+ });
134
+ ```
135
+
136
+ Any selections added to the type will be available to consume in all resolvers. Columns that are not
137
+ selected can still be exposed as before.
138
+
139
+ ## Field selections
140
+
141
+ The previous example allows you to control what gets selected by default, but you often want to only
142
+ select the columns that are required to fulfill a specific field. You can do this by adding the
143
+ appropriate selections on each field:
144
+
145
+ ```ts
146
+ const UserRef = builder.drizzleObject('users', {
147
+ name: 'User',
148
+ select: {
149
+ // By default all columns are selected, so this is required to default to an empty selection
150
+ columns: {},
151
+ },
152
+ fields: (t) => ({
153
+ fullName: t.string({
154
+ select: {
155
+ columns: { first_name: true, last_name: true },
156
+ },
157
+ resolve: (user, args, ctx, info) => `${user.first_name} ${user.last_name}`,
158
+ }),
159
+ bio: t.string({
160
+ select: {
161
+ // Currently, adding a selection without explicitly defining columns will cause all columns to be selected
162
+ columns: {},
163
+ with: { profile: true },
164
+ },
165
+ resolve: (user) => user.profile.bio,
166
+ }),
167
+ email: t.string({
168
+ select: {
169
+ columns: {},
170
+ extras: {
171
+ lowercaseName: sql<string>`lower(${users.firstName})`.as('lowercaseName'),
172
+ },
173
+ },
174
+ resolve: (user) => `${user.lowercaseName}@example.com`,
175
+ }),
176
+ }),
177
+ });
178
+ ```
179
+
180
+ ## Relations
181
+
182
+ Drizzles relational query builder allows you to define the relationships between your tables. The
183
+ `builder.relation` method makes it easy to add fields to your GraphQL API that implement those
184
+ relations:
185
+
186
+ ```ts
187
+ builder.drizzleObject('profiles', {
188
+ name: 'Profile',
189
+ fields: (t) => ({
190
+ bio: t.exposeString('bio'),
191
+ }),
192
+ });
193
+
194
+ builder.drizzleObject('posts', {
195
+ name: 'Post',
196
+ fields: (t) => ({
197
+ title: t.exposeString('title'),
198
+ author: t.relation('author'),
199
+ }),
200
+ });
201
+
202
+ builder.drizzleObject('users', {
203
+ name: 'User',
204
+ fields: (t) => ({
205
+ firstName: t.exposeString('first_name'),
206
+ profile: t.relation('profile'),
207
+ posts: t.relation('posts'),
208
+ }),
209
+ });
210
+ ```
211
+
212
+ The relation will automatically define GraphQL fields of the appropriate type based on the relation
213
+ defined in your drizzle schema.
214
+
215
+ ## Relation queries
216
+
217
+ For some cases, exposing relations as fields without any customization works great, but in some
218
+ cases you may want to apply some filtering or ordering to your relations. This can be done by
219
+ specifying a `query` option on the relation:
220
+
221
+ ```ts
222
+ builder.drizzleObject('users', {
223
+ name: 'User',
224
+ fields: (t) => ({
225
+ firstName: t.exposeString('first_name'),
226
+ posts: t.relation('posts', {
227
+ args: {
228
+ limit: t.arg.int(),
229
+ offset: t.arg.int(),
230
+ },
231
+ query: (args) => ({
232
+ limit: args.limit ?? 10,
233
+ offset: args.offset ?? 0,
234
+ where: (post, { eq }) => eq(post.published, true),
235
+ orderBy: (post, { desc }) => desc(post.updatedAt),
236
+ }),
237
+ }),
238
+ drafts: t.relation('posts', {
239
+ query: {
240
+ where: (post, { eq }) => eq(post.published, false),
241
+ },
242
+ }),
243
+ }),
244
+ });
245
+ ```
246
+
247
+ The query API enables you to define args and convert them into parameters that will be passed into
248
+ the relational query builder. You can read more about the relation query builder api
249
+ [here](https://orm.drizzle.team/docs/rqb#querying)
250
+
251
+ ## Drizzle Fields
252
+
253
+ Drizzle objects and relations allow you to define parts of your schema backed by your drizzle
254
+ schema, but don't provide a clear entry point into this Graph of data. To make your drizzle objects
255
+ queryable, we will need to add fields that return our drizzle objects. This can be done using the
256
+ `t.drizzleField` method. This can be used to define fields on the root `Query` type, or any other
257
+ object type in your schema:
258
+
259
+ ```ts
260
+ builder.queryType({
261
+ fields: (t) => ({
262
+ post: t.drizzleField({
263
+ type: 'posts',
264
+ args: {
265
+ id: t.arg.id({ required: true }),
266
+ },
267
+ resolve: (query, root, args, ctx) =>
268
+ db.query.posts.findFirst(
269
+ query({
270
+ where: eq(posts.id, Number.parseInt(args.id, 10)),
271
+ }),
272
+ ),
273
+ }),
274
+ posts: t.drizzleField({
275
+ type: ['posts'],
276
+ resolve: (query, root, args, ctx) => db.query.posts.findMany(query()),
277
+ }),
278
+ }),
279
+ });
280
+ ```
281
+
282
+ The `resolve` function of a `drizzleField` will be passed a `query` function that MUST be called and
283
+ passed to a drizzle `findOne` or `findMany` query. The `query` function optionally accepts any
284
+ arguments that are normally passed into the query, and will merge these options with the selection
285
+ used to resolve data for the nested GraphQL selections.
286
+
287
+ ## Variants
288
+
289
+ It is often useful to be able to define multiple object types based on the same table. This can be
290
+ done using a feature called `variants`. The `variants` API consists of 3 parts:
291
+
292
+ - A `variant` option that can be passed instead of a name on `drizzleObjects`
293
+ - The ability to pass an `ObjectRef` to the `type` option of `t.relation` and other similar fields
294
+ - A `t.field` method that works similar to `t.relation, but is used to define a GraphQL field that
295
+ references a variant of the same record.
296
+
297
+ ```ts
298
+ // Viewer type representing the current user
299
+ export const Viewer = builder.drizzleObject('users', {
300
+ variant: 'Viewer',
301
+ select: {
302
+ columns: {},
303
+ },
304
+ fields: (t) => ({
305
+ id: t.exposeID('id'),
306
+ // A reference to the normal user type so normal user fields can be queried
307
+ user: t.variant('users'),
308
+ // Adding drafts to View allows a user to fetch their own drafts without exposing it for Other Users in the API
309
+ drafts: t.relation('posts', {
310
+ query: {
311
+ where: (post, { eq }) => eq(post.published, false),
312
+ orderBy: (post, ops) => ops.desc(post.updatedAt),
313
+ },
314
+ }),
315
+ }),
316
+ });
317
+
318
+ builder.queryType({
319
+ fields: (t) => ({
320
+ me: t.drizzleField({
321
+ // We can use the ref returned by builder.drizzleObject to define our `drizzleField`
322
+ type: Viewer,
323
+ resolve: (query, root, args, ctx) =>
324
+ db.query.users.findFirst(
325
+ query({
326
+ where: (user, { eq }) => eq(user.id, ctx.user.id),
327
+ }),
328
+ ),
329
+ }),
330
+ }),
331
+ });
332
+
333
+ builder.drizzleNode('users', {
334
+ name: 'User',
335
+ fields: (t) => ({
336
+ firstName: t.exposeString('firstName'),
337
+ // This field will resolve to the Viewer type, but be set to null if the user is not the current user
338
+ viewer: t.variant(Viewer, {
339
+ isNull: (user, args, ctx) => user.id !== ctx.user?.id,
340
+ }),
341
+ }),
342
+ });
343
+ ```
344
+
345
+ ## Relay integration
346
+
347
+ Relay provides some very useful best practices that are useful for most GraphQL APIs. To make it
348
+ easy to comply with these best practices, the drizzle plugin has built in support for defining relay
349
+ `nodes` and `connections`.
350
+
351
+ ## Relay Nodes
352
+
353
+ Defining relay nodes works just like defining normal `drizzleObject`s, but requires specifying a
354
+ colum to use as the nodes `id` field.
355
+
356
+ ```ts
357
+ builder.drizzleNode('users', {
358
+ name: 'User',
359
+ id: {
360
+ column: (user) => user.id,
361
+ // other options for the ID field can be passed here
362
+ },
363
+ fields: (t) => ({
364
+ firstName: t.exposeString('firstName'),
365
+ lastName: t.exposeString('lastName'),
366
+ }),
367
+ });
368
+ ```
369
+
370
+ The id column can also be set to a list of columns for types with a composite primary key.
371
+
372
+ ## Related connections
373
+
374
+ To implement a relation as a connection, you can use `t.relatedConnection` instead of `t.relation`:
375
+
376
+ ```ts
377
+ builder.drizzleNode('users', {
378
+ name: 'User',
379
+ fields: (t) => ({
380
+ posts: t.relatedConnection('posts'),
381
+ }),
382
+ });
383
+ ```
384
+
385
+ This will automatically define the `Connection`, and `Edge` types, and their respective fields. To
386
+ customize the Connection and Edge types, options for these types can be passed as additional
387
+ arguments to `t.relatedConnection`, just like `t.connection` from the relay plugin. See the
388
+ [relay plugin docs](https://pothos-graphql.dev/docs/plugins/relay) for more details.
389
+
390
+ You can also define a `query` like with `t.relation`. The only difference with `t.relatedConnection`
391
+ is that the `orderBy` format is slightly changed.
392
+
393
+ To comply with the relay spec and efficiently support backwards pagination, some queries need to be
394
+ performed in reverse order, which requires inverting the orderBy clause. To do this automatically,
395
+ the `t.relatedConnection` method accepts orderBy as an object like `{ asc: column }` or
396
+ `{ desc: column }` rather than using the `asc(column)` and `desc(column)` helpers from drizzle.
397
+ orderBy can still be returned as either a single column or array when ordering by multiple columns.
398
+
399
+ Ordering defaults to using the table `primaryKey`, and the orderBy columns will also be used to
400
+ derive the connections cursor.
401
+
402
+ ```ts
403
+ builder.drizzleNode('users', {
404
+ name: 'User',
405
+ fields: (t) => ({
406
+ posts: t.relatedConnection('posts', {
407
+ query: () => ({
408
+ where: (post, { eq }) => eq(post.published, 1),
409
+ orderBy: (post) => ({
410
+ desc: post.id,
411
+ }),
412
+ }),
413
+ }),
414
+ }),
415
+ });
416
+ ```
417
+
418
+ ## Drizzle connections
419
+
420
+ Similar to `t.drizzleField`, `t.drizzleConnection` allows you to define a connection field that acts
421
+ as an entry point to your drizzle query. The `orderBy` in `t.drizzleConnection` works the same way
422
+ as it does for `t.relatedConnection`
423
+
424
+ ```ts
425
+ builder.queryFields((t) => ({
426
+ posts: t.drizzleConnection({
427
+ type: 'posts',
428
+ resolve: (query, root, args, ctx) =>
429
+ db.query.posts.findMany(
430
+ query({
431
+ where: (post, { eq }) => eq(post.published, true),
432
+ orderBy: (post) => ({ desc: post.id }),
433
+ }),
434
+ ),
435
+ }),
436
+ }));
437
+ ```
package/TODO.md ADDED
@@ -0,0 +1,21 @@
1
+ ## TODO
2
+
3
+ - [x] connections
4
+ - [ ] connection helpers
5
+ - [ ] query usage checks
6
+ - [x] normalize extras callback functions before merging
7
+ - [x] with input integration
8
+ - [x] errors integration
9
+ - [x] drizzle field methods on builder
10
+ - [x] drizzle refs
11
+ - [x] drizzle interface types
12
+ - [x] relay nodes
13
+ - [ ] tests
14
+ - [x] docs
15
+ - [x] variants
16
+ - [x] fallback dataloader
17
+ - [ ] custom dataloader override
18
+ - [x] default selections for id/data-loading
19
+ - [ ] interface check for compatibility of implementors
20
+ - [ ] totalCount API
21
+ - [ ] Indirect many to many connections (requires v2 relational API)
@@ -0,0 +1 @@
1
+ {"version":"7","dialect":"postgresql","entries":[]}
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'drizzle-kit';
2
+
3
+ export default defineConfig({
4
+ schema: './tests/example/db/schema.ts',
5
+ out: './tests/drizzle',
6
+ dialect: 'sqlite',
7
+ dbCredentials: {
8
+ url: './tests/example/db/dev.db',
9
+ },
10
+ });
@@ -0,0 +1,124 @@
1
+ import { InferModelFromColumns, TableRelationalConfig } from 'drizzle-orm';
2
+ import { CompatibleTypes, ExposeNullability, FieldKind, FieldRef, InputFieldMap, InterfaceParam, NormalizeArgs, ObjectRef, PluginName, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core';
3
+ import { DrizzleConnectionShape, ListRelation, RelatedConnectionOptions, RelatedFieldOptions, ShapeFromConnection, TypesForRelation, VariantFieldOptions } from './types';
4
+ import { DrizzleRef } from './interface-ref';
5
+ declare const RootBuilder: {
6
+ new <Types extends SchemaTypes, Shape, Kind extends FieldKind>(builder: PothosSchemaTypes.SchemaBuilder<Types>, kind: FieldKind, graphqlKind: PothosSchemaTypes.PothosKindToGraphQLType[FieldKind]): PothosSchemaTypes.RootFieldBuilder<Types, Shape, Kind>;
7
+ };
8
+ export declare class DrizzleObjectFieldBuilder<Types extends SchemaTypes, TableConfig extends TableRelationalConfig, Shape, ExposableShape = InferModelFromColumns<TableConfig['columns']>> extends RootBuilder<Types, Shape, 'DrizzleObject'> {
9
+ exposeBoolean: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, "Boolean", true>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, "Boolean", ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, "Boolean", Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
10
+ description?: string | false;
11
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, "Boolean", Nullable>, "DrizzleObject">;
12
+ exposeFloat: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, "Float", true>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, "Float", ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, "Float", Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
13
+ description?: string | false;
14
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, "Float", Nullable>, "DrizzleObject">;
15
+ exposeInt: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, "Int", true>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, "Int", ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, "Int", Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
16
+ description?: string | false;
17
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, "Int", Nullable>, "DrizzleObject">;
18
+ exposeID: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, "ID", true>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, "ID", ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, "ID", Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
19
+ description?: string | false;
20
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, "ID", Nullable>, "DrizzleObject">;
21
+ exposeString: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, "String", true>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, "String", ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, "String", Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
22
+ description?: string | false;
23
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, "String", Nullable>, "DrizzleObject">;
24
+ exposeBooleanList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, ["Boolean"], {
25
+ list: true;
26
+ items: true;
27
+ }>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, ["Boolean"], ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, ["Boolean"], Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
28
+ description?: string | false;
29
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, ["Boolean"], Nullable>, "DrizzleObject">;
30
+ exposeFloatList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, ["Float"], {
31
+ list: true;
32
+ items: true;
33
+ }>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, ["Float"], ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, ["Float"], Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
34
+ description?: string | false;
35
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, ["Float"], Nullable>, "DrizzleObject">;
36
+ exposeIntList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, ["Int"], {
37
+ list: true;
38
+ items: true;
39
+ }>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, ["Int"], ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, ["Int"], Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
40
+ description?: string | false;
41
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, ["Int"], Nullable>, "DrizzleObject">;
42
+ exposeIDList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, ["ID"], {
43
+ list: true;
44
+ items: true;
45
+ }>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, ["ID"], ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, ["ID"], Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
46
+ description?: string | false;
47
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, ["ID"], Nullable>, "DrizzleObject">;
48
+ exposeStringList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, ["String"], {
49
+ list: true;
50
+ items: true;
51
+ }>>(...args: NormalizeArgs<[name: Name, options: ExposeNullability<Types, ["String"], ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, ExposableShape, ["String"], Nullable, {}, ResolveReturnShape>, "select" | "resolve" | "nullable" | "type"> & {
52
+ description?: string | false;
53
+ }], 1>) => FieldRef<Types, ShapeFromTypeParam<Types, ["String"], Nullable>, "DrizzleObject">;
54
+ table: string;
55
+ typename: string;
56
+ relatedConnection: 'relay' extends PluginName ? <Field extends ListRelation<TableConfig>, Nullable extends boolean, Args extends InputFieldMap, ConnectionInterfaces extends InterfaceParam<Types>[] = [], EdgeInterfaces extends InterfaceParam<Types>[] = []>(field: Field, options: RelatedConnectionOptions<Types, Shape, TableConfig, Field, Nullable, Args>, ...args: NormalizeArgs<[
57
+ connectionOptions: ObjectRef<Types, ShapeFromConnection<PothosSchemaTypes.ConnectionShapeHelper<Types, TypesForRelation<Types, TableConfig['relations'][Field]>, false>>> | PothosSchemaTypes.ConnectionObjectOptions<Types, ObjectRef<Types, ShapeFromTypeParam<Types, [
58
+ ObjectRef<Types, TypesForRelation<Types, TableConfig['relations'][Field]>>
59
+ ], Nullable>>, false, false, DrizzleConnectionShape<Types, ShapeFromTypeParam<Types, [
60
+ ObjectRef<Types, TypesForRelation<Types, TableConfig['relations'][Field]>>
61
+ ], Nullable>, Shape, Args>, ConnectionInterfaces>,
62
+ edgeOptions: ObjectRef<Types, {
63
+ cursor: string;
64
+ node?: TypesForRelation<Types, TableConfig['relations'][Field]>;
65
+ }> | PothosSchemaTypes.ConnectionEdgeObjectOptions<Types, ObjectRef<Types, ShapeFromTypeParam<Types, [
66
+ ObjectRef<Types, TypesForRelation<Types, TableConfig['relations'][Field]>>
67
+ ], Nullable>>, false, DrizzleConnectionShape<Types, ShapeFromTypeParam<Types, [
68
+ ObjectRef<Types, TypesForRelation<Types, TableConfig['relations'][Field]>>
69
+ ], Nullable>, Shape, Args>, EdgeInterfaces>
70
+ ], 0>) => FieldRef<Types, ShapeFromConnection<PothosSchemaTypes.ConnectionShapeHelper<Types, Shape, Nullable>>> : '@pothos/plugin-relay is required to use this method';
71
+ constructor(typename: string, builder: PothosSchemaTypes.SchemaBuilder<Types>, table: string, graphqlKind?: PothosSchemaTypes.PothosKindToGraphQLType[FieldKind]);
72
+ variant<Variant extends DrizzleRef<Types, TableConfig['tsName']> | TableConfig['tsName'], Args extends InputFieldMap, Nullable, ResolveShape, ResolveReturn>(variant: Variant, ...allArgs: NormalizeArgs<[
73
+ options: VariantFieldOptions<Types, TableConfig['tsName'] & keyof Types['DrizzleRelationSchema'], Variant, Args, Nullable, Shape, ResolveShape, ResolveReturn>
74
+ ]>): FieldRef<Types, ResolveReturn, 'Object'>;
75
+ relation<Field extends keyof TableConfig['relations'], Nullable extends boolean, Args extends InputFieldMap, ResolveReturnShape>(name: Field, ...allArgs: NormalizeArgs<[
76
+ options: RelatedFieldOptions<Types, TableConfig, Field, Nullable, Args, ResolveReturnShape, Shape>
77
+ ]>): FieldRef<Types, TypesForRelation<Types, TableConfig['relations'][Field]>, 'Object'>;
78
+ expose<Type extends TypeParam<Types>, Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, ExposableShape, Type, Nullable>>(...args: NormalizeArgs<[
79
+ name: Name,
80
+ options: ExposeNullability<Types, Type, ExposableShape, Name, Nullable> & Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Type, Nullable, {}, ResolveReturnShape>, 'nullable' | 'resolve' | 'select'>
81
+ ]>): FieldRef<Types, ShapeFromTypeParam<Types, Type, (false & (Type extends [unknown] ? Awaited<ExposableShape[Name]> extends readonly (infer T)[] | null | undefined ? [T] extends [NonNullable<T>] ? (readonly T[] | null | undefined) & Awaited<ExposableShape[Name]> extends readonly T[] & Awaited<ExposableShape[Name]> ? boolean | {
82
+ items: boolean;
83
+ list: boolean;
84
+ } : true | {
85
+ items: boolean;
86
+ list: true;
87
+ } : (readonly T[] | null | undefined) & Awaited<ExposableShape[Name]> extends readonly T[] & Awaited<ExposableShape[Name]> ? {
88
+ items: true;
89
+ list: boolean;
90
+ } : {
91
+ items: true;
92
+ list: true;
93
+ } : never : Awaited<ExposableShape[Name]> extends NonNullable<Awaited<ExposableShape[Name]>> ? boolean : true) & Nullable) | (true & (Type extends [unknown] ? Awaited<ExposableShape[Name]> extends readonly (infer T)[] | null | undefined ? [T] extends [NonNullable<T>] ? (readonly T[] | null | undefined) & Awaited<ExposableShape[Name]> extends readonly T[] & Awaited<ExposableShape[Name]> ? boolean | {
94
+ items: boolean;
95
+ list: boolean;
96
+ } : true | {
97
+ items: boolean;
98
+ list: true;
99
+ } : (readonly T[] | null | undefined) & Awaited<ExposableShape[Name]> extends readonly T[] & Awaited<ExposableShape[Name]> ? {
100
+ items: true;
101
+ list: boolean;
102
+ } : {
103
+ items: true;
104
+ list: true;
105
+ } : never : Awaited<ExposableShape[Name]> extends NonNullable<Awaited<ExposableShape[Name]>> ? boolean : true) & Nullable) | ((Type extends [unknown] ? boolean | {
106
+ items: boolean;
107
+ list: boolean;
108
+ } : boolean) & (Type extends [unknown] ? Awaited<ExposableShape[Name]> extends readonly (infer T)[] | null | undefined ? [T] extends [NonNullable<T>] ? (readonly T[] | null | undefined) & Awaited<ExposableShape[Name]> extends readonly T[] & Awaited<ExposableShape[Name]> ? boolean | {
109
+ items: boolean;
110
+ list: boolean;
111
+ } : true | {
112
+ items: boolean;
113
+ list: true;
114
+ } : (readonly T[] | null | undefined) & Awaited<ExposableShape[Name]> extends readonly T[] & Awaited<ExposableShape[Name]> ? {
115
+ items: true;
116
+ list: boolean;
117
+ } : {
118
+ items: true;
119
+ list: true;
120
+ } : never : Awaited<ExposableShape[Name]> extends NonNullable<Awaited<ExposableShape[Name]>> ? boolean : true) & Nullable)>, "DrizzleObject">;
121
+ private createExpose;
122
+ }
123
+ export {};
124
+ //# sourceMappingURL=drizzle-field-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drizzle-field-builder.d.ts","sourceRoot":"","sources":["../src/drizzle-field-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,qBAAqB,EAAQ,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,cAAc,EAGd,aAAa,EAC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,IAAI,CACF,iBAAiB,CAAC,kBAAkB,CAClC,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,kBAAkB,CACnB,EACD,UAAU,GAAG,SAAS,GAAG,QAAQ,CAClC;KACJ,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmBH,OAAO,CAAC,YAAY;CA0CrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=field-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-builder.d.ts","sourceRoot":"","sources":["../src/field-builder.ts"],"names":[],"mappings":""}