@pothos/plugin-prisma 0.0.0-preview-20220211212258

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 (155) hide show
  1. package/.turbo/turbo-build.log +17 -0
  2. package/.turbo/turbo-test.log +18 -0
  3. package/.turbo/turbo-type.log +5 -0
  4. package/CHANGELOG.md +355 -0
  5. package/LICENSE +6 -0
  6. package/README.md +808 -0
  7. package/babel.config.js +3 -0
  8. package/bin/generator.js +2 -0
  9. package/esm/cursors.d.ts +55 -0
  10. package/esm/cursors.d.ts.map +1 -0
  11. package/esm/cursors.js +106 -0
  12. package/esm/cursors.js.map +1 -0
  13. package/esm/field-builder.d.ts +2 -0
  14. package/esm/field-builder.d.ts.map +1 -0
  15. package/esm/field-builder.js +53 -0
  16. package/esm/field-builder.js.map +1 -0
  17. package/esm/generator.d.ts +2 -0
  18. package/esm/generator.d.ts.map +1 -0
  19. package/esm/generator.js +83 -0
  20. package/esm/generator.js.map +1 -0
  21. package/esm/global-types.d.ts +52 -0
  22. package/esm/global-types.d.ts.map +1 -0
  23. package/esm/global-types.js +2 -0
  24. package/esm/global-types.js.map +1 -0
  25. package/esm/index.d.ts +11 -0
  26. package/esm/index.d.ts.map +1 -0
  27. package/esm/index.js +14 -0
  28. package/esm/index.js.map +1 -0
  29. package/esm/loader-map.d.ts +6 -0
  30. package/esm/loader-map.d.ts.map +1 -0
  31. package/esm/loader-map.js +35 -0
  32. package/esm/loader-map.js.map +1 -0
  33. package/esm/model-loader.d.ts +18 -0
  34. package/esm/model-loader.d.ts.map +1 -0
  35. package/esm/model-loader.js +101 -0
  36. package/esm/model-loader.js.map +1 -0
  37. package/esm/node-ref.d.ts +12 -0
  38. package/esm/node-ref.d.ts.map +1 -0
  39. package/esm/node-ref.js +19 -0
  40. package/esm/node-ref.js.map +1 -0
  41. package/esm/object-ref.d.ts +7 -0
  42. package/esm/object-ref.d.ts.map +1 -0
  43. package/esm/object-ref.js +5 -0
  44. package/esm/object-ref.js.map +1 -0
  45. package/esm/package.json +3 -0
  46. package/esm/prisma-field-builder.d.ts +28 -0
  47. package/esm/prisma-field-builder.d.ts.map +1 -0
  48. package/esm/prisma-field-builder.js +204 -0
  49. package/esm/prisma-field-builder.js.map +1 -0
  50. package/esm/refs.d.ts +15 -0
  51. package/esm/refs.d.ts.map +1 -0
  52. package/esm/refs.js +64 -0
  53. package/esm/refs.js.map +1 -0
  54. package/esm/schema-builder.d.ts +2 -0
  55. package/esm/schema-builder.d.ts.map +1 -0
  56. package/esm/schema-builder.js +65 -0
  57. package/esm/schema-builder.js.map +1 -0
  58. package/esm/types.d.ts +177 -0
  59. package/esm/types.d.ts.map +1 -0
  60. package/esm/types.js +2 -0
  61. package/esm/types.js.map +1 -0
  62. package/esm/util/index.d.ts +5 -0
  63. package/esm/util/index.d.ts.map +1 -0
  64. package/esm/util/index.js +16 -0
  65. package/esm/util/index.js.map +1 -0
  66. package/esm/util/map-includes.d.ts +6 -0
  67. package/esm/util/map-includes.d.ts.map +1 -0
  68. package/esm/util/map-includes.js +184 -0
  69. package/esm/util/map-includes.js.map +1 -0
  70. package/esm/util/merge-includes.d.ts +3 -0
  71. package/esm/util/merge-includes.d.ts.map +1 -0
  72. package/esm/util/merge-includes.js +91 -0
  73. package/esm/util/merge-includes.js.map +1 -0
  74. package/lib/cursors.d.ts +55 -0
  75. package/lib/cursors.d.ts.map +1 -0
  76. package/lib/cursors.js +112 -0
  77. package/lib/cursors.js.map +1 -0
  78. package/lib/field-builder.d.ts +2 -0
  79. package/lib/field-builder.d.ts.map +1 -0
  80. package/lib/field-builder.js +65 -0
  81. package/lib/field-builder.js.map +1 -0
  82. package/lib/generator.d.ts +2 -0
  83. package/lib/generator.d.ts.map +1 -0
  84. package/lib/generator.js +104 -0
  85. package/lib/generator.js.map +1 -0
  86. package/lib/global-types.d.ts +52 -0
  87. package/lib/global-types.d.ts.map +1 -0
  88. package/lib/global-types.js +3 -0
  89. package/lib/global-types.js.map +1 -0
  90. package/lib/index.d.ts +11 -0
  91. package/lib/index.d.ts.map +1 -0
  92. package/lib/index.js +40 -0
  93. package/lib/index.js.map +1 -0
  94. package/lib/loader-map.d.ts +6 -0
  95. package/lib/loader-map.d.ts.map +1 -0
  96. package/lib/loader-map.js +41 -0
  97. package/lib/loader-map.js.map +1 -0
  98. package/lib/model-loader.d.ts +18 -0
  99. package/lib/model-loader.d.ts.map +1 -0
  100. package/lib/model-loader.js +105 -0
  101. package/lib/model-loader.js.map +1 -0
  102. package/lib/node-ref.d.ts +12 -0
  103. package/lib/node-ref.d.ts.map +1 -0
  104. package/lib/node-ref.js +22 -0
  105. package/lib/node-ref.js.map +1 -0
  106. package/lib/object-ref.d.ts +7 -0
  107. package/lib/object-ref.d.ts.map +1 -0
  108. package/lib/object-ref.js +9 -0
  109. package/lib/object-ref.js.map +1 -0
  110. package/lib/prisma-field-builder.d.ts +28 -0
  111. package/lib/prisma-field-builder.d.ts.map +1 -0
  112. package/lib/prisma-field-builder.js +208 -0
  113. package/lib/prisma-field-builder.js.map +1 -0
  114. package/lib/refs.d.ts +15 -0
  115. package/lib/refs.d.ts.map +1 -0
  116. package/lib/refs.js +73 -0
  117. package/lib/refs.js.map +1 -0
  118. package/lib/schema-builder.d.ts +2 -0
  119. package/lib/schema-builder.d.ts.map +1 -0
  120. package/lib/schema-builder.js +89 -0
  121. package/lib/schema-builder.js.map +1 -0
  122. package/lib/types.d.ts +177 -0
  123. package/lib/types.d.ts.map +1 -0
  124. package/lib/types.js +4 -0
  125. package/lib/types.js.map +1 -0
  126. package/lib/util/index.d.ts +5 -0
  127. package/lib/util/index.d.ts.map +1 -0
  128. package/lib/util/index.js +30 -0
  129. package/lib/util/index.js.map +1 -0
  130. package/lib/util/map-includes.d.ts +6 -0
  131. package/lib/util/map-includes.d.ts.map +1 -0
  132. package/lib/util/map-includes.js +189 -0
  133. package/lib/util/map-includes.js.map +1 -0
  134. package/lib/util/merge-includes.d.ts +3 -0
  135. package/lib/util/merge-includes.d.ts.map +1 -0
  136. package/lib/util/merge-includes.js +96 -0
  137. package/lib/util/merge-includes.js.map +1 -0
  138. package/package.json +71 -0
  139. package/src/cursors.ts +159 -0
  140. package/src/field-builder.ts +117 -0
  141. package/src/generator.ts +191 -0
  142. package/src/global-types.ts +196 -0
  143. package/src/index.ts +18 -0
  144. package/src/loader-map.ts +48 -0
  145. package/src/model-loader.ts +152 -0
  146. package/src/node-ref.ts +34 -0
  147. package/src/object-ref.ts +8 -0
  148. package/src/prisma-field-builder.ts +375 -0
  149. package/src/refs.ts +112 -0
  150. package/src/schema-builder.ts +121 -0
  151. package/src/types.ts +502 -0
  152. package/src/util/index.ts +26 -0
  153. package/src/util/map-includes.ts +329 -0
  154. package/src/util/merge-includes.ts +121 -0
  155. package/tsconfig.json +21 -0
@@ -0,0 +1,17 @@
1
+ @pothos/plugin-prisma:build: cache hit, replaying output 0ffefbcd555208c4
2
+ @pothos/plugin-prisma:build: 
3
+ @pothos/plugin-prisma:build: > @pothos/plugin-prisma@0.16.3 build /Users/mhayes/code/pothos/packages/plugin-prisma
4
+ @pothos/plugin-prisma:build: > pnpm build:cjs && pnpm build:esm
5
+ @pothos/plugin-prisma:build: 
6
+ @pothos/plugin-prisma:build: 
7
+ @pothos/plugin-prisma:build: > @pothos/plugin-prisma@0.16.3 build:cjs /Users/mhayes/code/pothos/packages/plugin-prisma
8
+ @pothos/plugin-prisma:build: > tsc --module commonjs --outDir lib
9
+ @pothos/plugin-prisma:build: 
10
+ @pothos/plugin-prisma:build: 
11
+ @pothos/plugin-prisma:build: > @pothos/plugin-prisma@0.16.3 build:esm /Users/mhayes/code/pothos/packages/plugin-prisma
12
+ @pothos/plugin-prisma:build: > tsc --module es2020 --outDir esm && pnpm esm:extensions
13
+ @pothos/plugin-prisma:build: 
14
+ @pothos/plugin-prisma:build: 
15
+ @pothos/plugin-prisma:build: > @pothos/plugin-prisma@0.16.3 esm:extensions /Users/mhayes/code/pothos/packages/plugin-prisma
16
+ @pothos/plugin-prisma:build: > ts-node --compiler-options "{\"module\":\"commonjs\"}" ../../.config/esm-transformer.ts
17
+ @pothos/plugin-prisma:build: 
@@ -0,0 +1,18 @@
1
+ @pothos/plugin-prisma:test: cache hit, replaying output 84ec88aa149808d3
2
+ @pothos/plugin-prisma:test: 
3
+ @pothos/plugin-prisma:test: > @pothos/plugin-prisma@0.16.3 test /Users/mhayes/code/pothos/packages/plugin-prisma
4
+ @pothos/plugin-prisma:test: > pnpm jest --runInBand
5
+ @pothos/plugin-prisma:test: 
6
+ @pothos/plugin-prisma:test: PASS tests/counts.test.ts
7
+ @pothos/plugin-prisma:test: PASS tests/connections.test.ts
8
+ @pothos/plugin-prisma:test: PASS tests/index.test.ts
9
+ @pothos/plugin-prisma:test: PASS tests/nodes.test.ts
10
+ @pothos/plugin-prisma:test: PASS tests/relation-query.test.ts
11
+ @pothos/plugin-prisma:test: PASS tests/type-include.test.ts
12
+ @pothos/plugin-prisma:test: PASS tests/variants.test.ts
13
+ @pothos/plugin-prisma:test: 
14
+ @pothos/plugin-prisma:test: Test Suites: 7 passed, 7 total
15
+ @pothos/plugin-prisma:test: Tests: 35 passed, 35 total
16
+ @pothos/plugin-prisma:test: Snapshots: 69 passed, 69 total
17
+ @pothos/plugin-prisma:test: Time: 13.424 s, estimated 17 s
18
+ @pothos/plugin-prisma:test: Ran all test suites.
@@ -0,0 +1,5 @@
1
+ @pothos/plugin-prisma:type: cache hit, replaying output 6d712a949ee28f2b
2
+ @pothos/plugin-prisma:type: 
3
+ @pothos/plugin-prisma:type: > @pothos/plugin-prisma@0.16.3 type /Users/mhayes/code/pothos/packages/plugin-prisma
4
+ @pothos/plugin-prisma:type: > tsc --noEmit && tsc --project tests/tsconfig.json
5
+ @pothos/plugin-prisma:type: 
package/CHANGELOG.md ADDED
@@ -0,0 +1,355 @@
1
+ # Change Log
2
+
3
+ ## 0.0.0-preview-20220211212258
4
+
5
+ ### Minor Changes
6
+
7
+ - 4ad5f4ff: Normalize resloveType and isTypeOf behavior to match graphql spec behavir and allow both
8
+ to be optional
9
+
10
+ ## 0.16.3
11
+
12
+ ### Patch Changes
13
+
14
+ - ab4a9ae4: Fix some type compatibility issues when skipLibCheck is false
15
+
16
+ ## 0.16.2
17
+
18
+ ### Patch Changes
19
+
20
+ - 2d9b21cd: Use workspace:\* for dev dependencies on pothos packages
21
+
22
+ ## 0.16.1
23
+
24
+ ### Patch Changes
25
+
26
+ - b58ee414: Fix primaNode variants
27
+
28
+ ## 0.16.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 044396ea: Add support for multiple variants of the same prisma model
33
+
34
+ ## 0.15.2
35
+
36
+ ### Patch Changes
37
+
38
+ - a01abb7f: Fix compatability between prisma and auth plugins
39
+
40
+ ## 0.15.1
41
+
42
+ ### Patch Changes
43
+
44
+ - ce585cca: fix Prisma object parent shape when combined with other plugins
45
+
46
+ ## 0.15.0
47
+
48
+ ### Minor Changes
49
+
50
+ - 4caad5e4: Rename GiraphQL to Pothos
51
+
52
+ ## 0.14.0
53
+
54
+ ### Minor Changes
55
+
56
+ - 9307635a: Migrate build process to use turborepo
57
+
58
+ ## 0.13.3
59
+
60
+ ### Patch Changes
61
+
62
+ - 2b08f852: Fix syntax highlighting in docs and update npm README.md files"
63
+
64
+ ## 0.13.2
65
+
66
+ ### Patch Changes
67
+
68
+ - c6aa732: graphql@15 type compatibility fix
69
+
70
+ ## 0.13.1
71
+
72
+ ### Patch Changes
73
+
74
+ - 5619aca: Standardize context caches across all plugins to correctly take advantage of
75
+ `initContextCache`
76
+
77
+ ## 0.13.0
78
+
79
+ ### Minor Changes
80
+
81
+ - 6d2a6d9: Update to support typescript 4.5. typescript@>4.5.2 is now required for code generation
82
+ in the prisma plugin
83
+
84
+ ## 0.12.1
85
+
86
+ ### Patch Changes
87
+
88
+ - c85dc33: Add types entry in package.json
89
+
90
+ ## 0.12.0
91
+
92
+ ### Minor Changes
93
+
94
+ - aeef5e5: Update dependencies
95
+
96
+ ## 0.11.1
97
+
98
+ ### Patch Changes
99
+
100
+ - 8e7cb89: remove some debug code
101
+
102
+ ## 0.11.0
103
+
104
+ ### Minor Changes
105
+
106
+ - 9107f29: Update dependencies (includes graphql 16)
107
+
108
+ ### Patch Changes
109
+
110
+ - 53e7905: Correctly pass context to query option of relations and connectedRelations
111
+
112
+ ## 0.10.0
113
+
114
+ ### Minor Changes
115
+
116
+ - 17db3bd: Make type refs extendable by plugins
117
+
118
+ ## 0.9.2
119
+
120
+ ### Patch Changes
121
+
122
+ - c976bfe: Update dependencies
123
+
124
+ ## 0.9.1
125
+
126
+ ### Patch Changes
127
+
128
+ - 4150f92: Fixed esm transformer for path-imports from dependencies
129
+
130
+ ## 0.9.0
131
+
132
+ ### Minor Changes
133
+
134
+ - dc87e68: update esm build process so extensions are added during build rather than in source
135
+
136
+ ## 0.8.2
137
+
138
+ ### Patch Changes
139
+
140
+ - b4b8381: Updrade deps (typescript 4.4)
141
+
142
+ ## 0.8.1
143
+
144
+ ### Patch Changes
145
+
146
+ - 0d655cd: Update README.md
147
+
148
+ ## 0.8.0
149
+
150
+ ### Minor Changes
151
+
152
+ - f04be64: #### Breaking
153
+
154
+ - The Prisma plugin had been re-designed to use a prisma-generator to generate more efficient
155
+ types. This requires new additional setup
156
+ - Restored the original API that used model names as strings rather than passing in prisma
157
+ delegates.
158
+
159
+ #### New
160
+
161
+ - Added support for `include` options on `prismaObject` and `prismaNode` types that are
162
+ automatically loaded. This allows fields defined directly on those types to use nested relations
163
+ without making additional requests.
164
+ - Added `relationCount` method to prisma field builder and `totalCount` option to
165
+ `relatedConnection` for more loading of counts.
166
+
167
+ ### Fixed
168
+
169
+ - Fixed some bugs related to field nullability
170
+ - Improved include merging to further reduce the number of queries required to resolve a request
171
+
172
+ ### Patch Changes
173
+
174
+ - f04be64: Update dependencies
175
+
176
+ ## 0.7.2
177
+
178
+ ### Patch Changes
179
+
180
+ - cbb4960: Fix priama-connections without relations
181
+
182
+ ## 0.7.1
183
+
184
+ ### Patch Changes
185
+
186
+ - 2cf9279: fix for models that do not have any relations
187
+
188
+ ## 0.7.0
189
+
190
+ ### Minor Changes
191
+
192
+ - ea4d456: Add interoperability between prisma and errors plugins
193
+
194
+ ## 0.6.0
195
+
196
+ ### Minor Changes
197
+
198
+ - 5cdd001: Re-designed how types are propagated in the prisma plugin to improve performance. This
199
+ requires a few breaking changes to how this plugin is used.
200
+
201
+ This change was required because of performance issue in typescript which has been reported here:
202
+ https://github.com/microsoft/TypeScript/issues/45405
203
+
204
+ If this is fixed, the API may be changed back to the slightly nicer string/name based version.
205
+
206
+ You will need to remove PrismaClient from the builder types, so your builder setup now looks like:
207
+
208
+ ```typescript
209
+ import PrismaPlugin, { PrismaTypes } from '@giraphql/plugin-prisma';
210
+
211
+ export default new SchemaBuilder<{}>({
212
+ prisma: {
213
+ client: prisma,
214
+ },
215
+ });
216
+ ```
217
+
218
+ You will also need to replace model names with the prisma delegates from your prisma client like
219
+ the following:
220
+
221
+ ```typescript
222
+ builder.prismaObject(prisma.post, {
223
+ findUnique: (post) => ({ id: post.id }),
224
+ fields: (t) => ({
225
+ id: t.exposeID('id'),
226
+ title: t.exposeString('title'),
227
+ author: t.relation('author'),
228
+ }),
229
+ });
230
+
231
+ builder.queryType({
232
+ fields: (t) => ({
233
+ me: t.prismaField({
234
+ type: prisma.user,
235
+ resolve: async (query, root, args, ctx, info) =>
236
+ prisma.user.findUnique({
237
+ ...query,
238
+ rejectOnNotFound: true,
239
+ where: { id: ctx.userId },
240
+ }),
241
+ }),
242
+ }),
243
+ });
244
+ ```
245
+
246
+ See updated docs for more detailed usage.
247
+
248
+ ## 0.5.0
249
+
250
+ ### Minor Changes
251
+
252
+ - a4c87cf: Use ".js" extensions everywhere and add module and exports to package.json to better
253
+ support ems in node
254
+
255
+ ## 0.4.0
256
+
257
+ ### Minor Changes
258
+
259
+ - 06e11f9: Pass context to query option of relation and relatedConnection fields
260
+
261
+ ### Patch Changes
262
+
263
+ - 0d51dcf: Fix nullability of prismaField
264
+
265
+ ## 0.3.2
266
+
267
+ ### Patch Changes
268
+
269
+ - ee16577: Fix prisma plugin for multi-word model names.
270
+ - f13208c: bump to fix latest tag
271
+
272
+ ## 0.3.1
273
+
274
+ ### Patch Changes
275
+
276
+ - 9ab8fbc: re-release previous version due to build-process issue
277
+
278
+ ## 0.3.0
279
+
280
+ ### Minor Changes
281
+
282
+ - 3dd3ff14: Updated dev dependencies, switched to pnpm, and added changesets for releases
283
+
284
+ All notable changes to this project will be documented in this file. See
285
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
286
+
287
+ ### 0.2.1 - 2021-08-05
288
+
289
+ #### 📘 Docs
290
+
291
+ - fix typo ([ef5cff9](https://github.com/hayes/giraphql/commit/ef5cff9))
292
+ - fix typo ([dbe3e0e](https://github.com/hayes/giraphql/commit/dbe3e0e))
293
+ - fix typo ([eaec7b9](https://github.com/hayes/giraphql/commit/eaec7b9))
294
+ - fix typo ([2c366f0](https://github.com/hayes/giraphql/commit/2c366f0))
295
+ - improve description of supported connection arguments
296
+ ([e697727](https://github.com/hayes/giraphql/commit/e697727))
297
+ - update disclaimer section of prisma docs
298
+ ([4c375cd](https://github.com/hayes/giraphql/commit/4c375cd))
299
+
300
+ **Note:** Version bump only for package @giraphql/plugin-prisma
301
+
302
+ ## 0.2.0 - 2021-08-03
303
+
304
+ #### 🚀 Updates
305
+
306
+ - add relay integration for prisma plugin
307
+ ([e714e54](https://github.com/hayes/giraphql/commit/e714e54))
308
+
309
+ #### 🐞 Fixes
310
+
311
+ - merge connection args into relatedConnection queries
312
+ ([762c06f](https://github.com/hayes/giraphql/commit/762c06f))
313
+ - update db seeding to give unique createdAt
314
+ ([279349d](https://github.com/hayes/giraphql/commit/279349d))
315
+
316
+ #### 📘 Docs
317
+
318
+ - add docs for prisma relay integration
319
+ ([6c6cbd5](https://github.com/hayes/giraphql/commit/6c6cbd5))
320
+
321
+ #### 🛠 Internals
322
+
323
+ - update tests with seed data ([f3b053a](https://github.com/hayes/giraphql/commit/f3b053a))
324
+
325
+ **Note:** Version bump only for package @giraphql/plugin-prisma
326
+
327
+ ### 0.2.0-alpha.1 - 2021-08-02
328
+
329
+ #### 🐞 Fixes
330
+
331
+ - merge connection args into relatedConnection queries
332
+ ([cd72880](https://github.com/hayes/giraphql/commit/cd72880))
333
+
334
+ #### 🛠 Internals
335
+
336
+ - update tests with seed data ([56fbb7b](https://github.com/hayes/giraphql/commit/56fbb7b))
337
+
338
+ **Note:** Version bump only for package @giraphql/plugin-prisma
339
+
340
+ ## 0.2.0-alpha.0 - 2021-08-02
341
+
342
+ #### 🚀 Updates
343
+
344
+ - add relay integration for prisma plugin
345
+ ([0b1d378](https://github.com/hayes/giraphql/commit/0b1d378))
346
+
347
+ **Note:** Version bump only for package @giraphql/plugin-prisma
348
+
349
+ ## 0.1.0 - 2021-07-30
350
+
351
+ #### 🚀 Updates
352
+
353
+ - add prisma plugin ([d427c82](https://github.com/hayes/giraphql/commit/d427c82))
354
+
355
+ **Note:** Version bump only for package @giraphql/plugin-prisma
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.