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