@pothos/plugin-prisma 4.9.0 → 4.10.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 (94) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dts/global-types.d.ts +2 -2
  3. package/dts/global-types.d.ts.map +1 -1
  4. package/dts/index.d.ts +3 -3
  5. package/dts/index.d.ts.map +1 -1
  6. package/dts/model-loader.d.ts.map +1 -1
  7. package/dts/object-ref.d.ts +1 -1
  8. package/dts/object-ref.d.ts.map +1 -1
  9. package/dts/prisma-field-builder.d.ts.map +1 -1
  10. package/dts/types.d.ts +8 -8
  11. package/dts/types.d.ts.map +1 -1
  12. package/dts/util/cursors.d.ts.map +1 -1
  13. package/dts/util/get-client.d.ts.map +1 -1
  14. package/dts/util/map-query.d.ts.map +1 -1
  15. package/esm/field-builder.js +2 -2
  16. package/esm/field-builder.js.map +1 -1
  17. package/esm/generator.js +22 -8
  18. package/esm/generator.js.map +1 -1
  19. package/esm/global-types.d.ts +2 -2
  20. package/esm/global-types.d.ts.map +1 -1
  21. package/esm/global-types.js.map +1 -1
  22. package/esm/index.d.ts +3 -3
  23. package/esm/index.d.ts.map +1 -1
  24. package/esm/index.js +2 -2
  25. package/esm/index.js.map +1 -1
  26. package/esm/interface-ref.js.map +1 -1
  27. package/esm/model-loader.d.ts.map +1 -1
  28. package/esm/model-loader.js +2 -2
  29. package/esm/model-loader.js.map +1 -1
  30. package/esm/object-ref.d.ts +1 -1
  31. package/esm/object-ref.d.ts.map +1 -1
  32. package/esm/object-ref.js +1 -1
  33. package/esm/object-ref.js.map +1 -1
  34. package/esm/prisma-field-builder.d.ts.map +1 -1
  35. package/esm/prisma-field-builder.js +6 -7
  36. package/esm/prisma-field-builder.js.map +1 -1
  37. package/esm/schema-builder.js.map +1 -1
  38. package/esm/types.d.ts +8 -8
  39. package/esm/types.d.ts.map +1 -1
  40. package/esm/types.js.map +1 -1
  41. package/esm/util/cursors.d.ts.map +1 -1
  42. package/esm/util/cursors.js +1 -1
  43. package/esm/util/cursors.js.map +1 -1
  44. package/esm/util/get-client.d.ts.map +1 -1
  45. package/esm/util/get-client.js.map +1 -1
  46. package/esm/util/map-query.d.ts.map +1 -1
  47. package/esm/util/map-query.js +2 -2
  48. package/esm/util/map-query.js.map +1 -1
  49. package/lib/connection-helpers.js +3 -3
  50. package/lib/connection-helpers.js.map +1 -1
  51. package/lib/generator.js +21 -7
  52. package/lib/generator.js.map +1 -1
  53. package/lib/index.js +16 -16
  54. package/lib/index.js.map +1 -1
  55. package/lib/interface-ref.js.map +1 -1
  56. package/lib/model-loader.js +1 -1
  57. package/lib/model-loader.js.map +1 -1
  58. package/lib/object-ref.js +3 -3
  59. package/lib/object-ref.js.map +1 -1
  60. package/lib/prisma-field-builder.js +1 -2
  61. package/lib/prisma-field-builder.js.map +1 -1
  62. package/lib/schema-builder.js.map +1 -1
  63. package/lib/types.js.map +1 -1
  64. package/lib/util/cursors.js +15 -15
  65. package/lib/util/cursors.js.map +1 -1
  66. package/lib/util/datamodel.js +9 -9
  67. package/lib/util/datamodel.js.map +1 -1
  68. package/lib/util/description.js +3 -3
  69. package/lib/util/description.js.map +1 -1
  70. package/lib/util/get-client.js +4 -4
  71. package/lib/util/get-client.js.map +1 -1
  72. package/lib/util/loader-map.js +4 -4
  73. package/lib/util/loader-map.js.map +1 -1
  74. package/lib/util/map-query.js +4 -4
  75. package/lib/util/map-query.js.map +1 -1
  76. package/lib/util/relation-map.js +3 -3
  77. package/lib/util/relation-map.js.map +1 -1
  78. package/lib/util/selections.js +7 -7
  79. package/lib/util/selections.js.map +1 -1
  80. package/lib/util/usage.js +5 -5
  81. package/lib/util/usage.js.map +1 -1
  82. package/package.json +10 -10
  83. package/src/field-builder.ts +2 -2
  84. package/src/generator.ts +29 -10
  85. package/src/global-types.ts +13 -14
  86. package/src/index.ts +3 -4
  87. package/src/model-loader.ts +4 -4
  88. package/src/object-ref.ts +2 -2
  89. package/src/prisma-field-builder.ts +8 -11
  90. package/src/schema-builder.ts +0 -3
  91. package/src/types.ts +29 -20
  92. package/src/util/cursors.ts +2 -2
  93. package/src/util/get-client.ts +1 -1
  94. package/src/util/map-query.ts +5 -5
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- createState: function() {
12
+ get createState () {
13
13
  return createState;
14
14
  },
15
- mergeSelection: function() {
15
+ get mergeSelection () {
16
16
  return mergeSelection;
17
17
  },
18
- mergeState: function() {
18
+ get mergeState () {
19
19
  return mergeState;
20
20
  },
21
- selectionCompatible: function() {
21
+ get selectionCompatible () {
22
22
  return selectionCompatible;
23
23
  },
24
- selectionToQuery: function() {
24
+ get selectionToQuery () {
25
25
  return selectionToQuery;
26
26
  },
27
- stateCompatible: function() {
27
+ get stateCompatible () {
28
28
  return stateCompatible;
29
29
  }
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/selections.ts"],"names":["createState","mergeSelection","mergeState","selectionCompatible","selectionToQuery","stateCompatible","state","selectionMap","ignoreQuery","Object","keys","query","length","select","include","some","key","compare","deepEqual","value","selections","k","counts","has","get","fieldMap","relations","newState","name","relationState","mode","fields","add","skipDeferredFragments","parent","Set","Map","mappings","merge","count","set","selection","childMap","relatedState","nestedIncludes","hasSelection","forEach","sel","relation","nested","size","_count","field"],"mappings":";;;;;;;;;;;IA4FgBA,WAAW;eAAXA;;IAmBAC,cAAc;eAAdA;;IAnCAC,UAAU;eAAVA;;IA1DAC,mBAAmB;eAAnBA;;IAiJAC,gBAAgB;eAAhBA;;IArGAC,eAAe;eAAfA;;;2BA7DU;AAiBnB,SAASF,oBACdG,KAAqB,EACrBC,YAAoC,EACpCC,cAAc,KAAK;IAEnB,IAAI,OAAOD,iBAAiB,WAAW;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C,MAAMgB,MAAM,CAAC4B,IAAI,GAAG,GAAG;QACzBL,eAAe;QACf,KAAK,MAAM,CAACN,OAAOE,UAAU,IAAInC,MAAMgB,MAAM,CAAE;YAC7CA,MAAM,CAACiB,MAAM,GAAGE;QAClB;QAEAG,eAAeO,MAAM,GAAG;YACtBtC,QAAQS;QACV;IACF;IAEA,IAAIhB,MAAMwB,IAAI,KAAK,UAAU;QAC3B,KAAK,MAAMsB,SAAS9C,MAAMyB,MAAM,CAAE;YAChCc,eAAe;YACfD,cAAc,CAACQ,MAAM,GAAG;QAC1B;QAEA,OAAO;YACL,GAAI9C,MAAMK,KAAK;YACfE,QAAQ+B;QACV;IACF;IAEA,OAAOC,eACH;QACE,GAAGvC,MAAMK,KAAK;QACdG,SAAS8B;IACX,IACCtC,MAAMK,KAAK;AAClB"}
1
+ {"version":3,"sources":["../../src/util/selections.ts"],"names":["createState","mergeSelection","mergeState","selectionCompatible","selectionToQuery","stateCompatible","state","selectionMap","ignoreQuery","Object","keys","query","length","select","include","some","key","compare","deepEqual","value","selections","k","counts","has","get","fieldMap","relations","newState","name","relationState","mode","fields","add","skipDeferredFragments","parent","Set","Map","mappings","merge","count","set","selection","childMap","relatedState","nestedIncludes","hasSelection","forEach","sel","relation","nested","size","_count","field"],"mappings":";;;;;;;;;;;QA4FgBA;eAAAA;;QAmBAC;eAAAA;;QAnCAC;eAAAA;;QA1DAC;eAAAA;;QAiJAC;eAAAA;;QArGAC;eAAAA;;;2BA7DU;AAiBnB,SAASF,oBACdG,KAAqB,EACrBC,YAAoC,EACpCC,cAAc,KAAK;IAEnB,IAAI,OAAOD,iBAAiB,WAAW;QACrC,OAAOC,eAAe,CAACD,gBAAgBE,OAAOC,IAAI,CAACJ,MAAMK,KAAK,EAAEC,MAAM,KAAK;IAC7E;IAEA,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH,OAAO,GAAGJ;IAEtC,IAAIM,UAAUJ,OAAOC,IAAI,CAACG,QAAQE,IAAI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EA,IAAIhB,MAAMwB,IAAI,KAAK,UAAU;QAC3B,KAAK,MAAMsB,SAAS9C,MAAMyB,MAAM,CAAE;YAChCc,eAAe;YACfD,cAAc,CAACQ,MAAM,GAAG;QAC1B;QAEA,OAAO;YACL,GAAI9C,MAAMK,KAAK;YACfE,QAAQ+B;QACV;IACF;IAEA,OAAOC,eACH;QACE,GAAGvC,MAAMK,KAAK;QACdG,SAAS8B;IACX,IACCtC,MAAMK,KAAK;AAClB"}
package/lib/util/usage.js CHANGED
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- extendWithUsage: function() {
12
+ get extendWithUsage () {
13
13
  return extendWithUsage;
14
14
  },
15
- isUsed: function() {
15
+ get isUsed () {
16
16
  return isUsed;
17
17
  },
18
- usageSymbol: function() {
18
+ get usageSymbol () {
19
19
  return usageSymbol;
20
20
  },
21
- wrapWithUsageCheck: function() {
21
+ get wrapWithUsageCheck () {
22
22
  return wrapWithUsageCheck;
23
23
  }
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/usage.ts"],"names":["extendWithUsage","isUsed","usageSymbol","wrapWithUsageCheck","Symbol","for","obj","result","used","Object","defineProperty","get","set","value","enumerable","key","keys","configurable","original","extension"],"mappings":";;;;;;;;;;;IAoCgBA,eAAe;eAAfA;;IAJAC,MAAM;eAANA;;IAhCHC,WAAW;eAAXA;;IAEGC,kBAAkB;eAAlBA;;;AAFT,MAAMD,cAAcE,OAAOC,GAAG,CAAC;AAE/B,SAASF,mBAAqCG,GAAM;IACzD,MAAMC,SAAS,CAAC;IAChB,IAAIC,OAAO;IAEXC,OAAOC,cAAc,CAACH,QAAQL,aAAa;QACzCS;YACE,OAAOH;QACT;QACAI,KAAIC,KAAc;YAChBL,OAAOK;QACT;QACAC,YAAY;IACd;IAEA,KAAK,MAAMC,OAAON,OAAOO,IAAI,CAACV,KAAM;QAClC,2CAA2C;QAC3CE,OAAO;QACPC,OAAOC,cAAc,CAACH,QAAQQ,KAAK;YACjCD,YAAY;YACZG,cAAc;YACdN;gBACEH,OAAO;gBACP,OAAOF,GAAG,CAACS,IAAe;YAC5B;QACF;IACF;IAEA,OAAOR;AACT;AAEO,SAASN,OAAOK,GAAW;IAChC,OAAO,CAAEJ,CAAAA,eAAeI,GAAE,KAAM,AAACA,GAAkC,CAACJ,YAAY;AAClF;AAEO,SAASF,gBACdkB,QAAW,EACXC,SAAY;IAEZ,IAAI,CAAEjB,CAAAA,eAAegB,QAAO,GAAI;QAC9B,OAAO;YAAE,GAAGA,QAAQ;YAAE,GAAGC,SAAS;QAAC;IACrC;IAEA,MAAMZ,SAAS;QAAE,GAAGY,SAAS;IAAC;IAE9B,KAAK,MAAMJ,OAAO;QAACb;WAAgBO,OAAOO,IAAI,CAACE;KAAU,CAAE;QACzD,IAAIH,OAAOR,QAAQ;YACjB;QACF;QAEAE,OAAOC,cAAc,CAACH,QAAQQ,KAAK;YACjCD,YAAYC,QAAQb;YACpBe,cAAcF,QAAQb;YACtBS;gBACE,OAAOO,QAAQ,CAACH,IAAe;YACjC;QACF;IACF;IAEA,OAAOR;AACT"}
1
+ {"version":3,"sources":["../../src/util/usage.ts"],"names":["extendWithUsage","isUsed","usageSymbol","wrapWithUsageCheck","Symbol","for","obj","result","used","Object","defineProperty","get","set","value","enumerable","key","keys","configurable","original","extension"],"mappings":";;;;;;;;;;;QAoCgBA;eAAAA;;QAJAC;eAAAA;;QAhCHC;eAAAA;;QAEGC;eAAAA;;;AAFT,MAAMD,cAAcE,OAAOC,GAAG,CAAC;AAE/B,SAASF,mBAAqCG,GAAM;IACzD,MAAMC,SAAS,CAAC;IAChB,IAAIC,OAAO;IAEXC,OAAOC,cAAc,CAACH,QAAQL,aAAa;QACzCS;YACE,OAAOH;QACT;QACAI,KAAIC,KAAc;YAChBL,OAAOK;QACT;QACAC,YAAY;IACd;IAEA,KAAK,MAAMC,OAAON,OAAOO,IAAI,CAACV,KAAM;QAClC,2CAA2C;QAC3CE,OAAO;QACPC,OAAOC,cAAc,CAACH,QAAQQ,KAAK;YACjCD,YAAY;YACZG,cAAc;YACdN;gBACEH,OAAO;gBACP,OAAOF,GAAG,CAACS,IAAe;YAC5B;QACF;IACF;IAEA,OAAOR;AACT;AAEO,SAASN,OAAOK,GAAW;IAChC,OAAO,CAAEJ,CAAAA,eAAeI,GAAE,KAAM,AAACA,GAAkC,CAACJ,YAAY;AAClF;AAEO,SAASF,gBACdkB,QAAW,EACXC,SAAY;IAEZ,IAAI,CAAEjB,CAAAA,eAAegB,QAAO,GAAI;QAC9B,OAAO;YAAE,GAAGA,QAAQ;YAAE,GAAGC,SAAS;QAAC;IACrC;IAEA,MAAMZ,SAAS;QAAE,GAAGY,SAAS;IAAC;IAE9B,KAAK,MAAMJ,OAAO;QAACb;WAAgBO,OAAOO,IAAI,CAACE;KAAU,CAAE;QACzD,IAAIH,OAAOR,QAAQ;YACjB;QACF;QAEAE,OAAOC,cAAc,CAACH,QAAQQ,KAAK;YACjCD,YAAYC,QAAQb;YACpBe,cAAcF,QAAQb;YACtBS;gBACE,OAAOO,QAAQ,CAACH,IAAe;YACjC;QACF;IACF;IAEA,OAAOR;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pothos/plugin-prisma",
3
- "version": "4.9.0",
3
+ "version": "4.10.0",
4
4
  "description": "A Pothos plugin for more efficient integration with prisma",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./dts/index.d.ts",
@@ -66,17 +66,17 @@
66
66
  "typescript": ">=4.7.2"
67
67
  },
68
68
  "devDependencies": {
69
- "@prisma/client": "^6.6.0",
69
+ "@prisma/client": "^6.10.1",
70
70
  "graphql-scalars": "^1.24.2",
71
71
  "graphql-tag": "^2.12.6",
72
- "prisma": "^6.6.0",
73
- "vitest": "^3.0.9",
74
- "@pothos/core": "4.6.2",
75
- "@pothos/plugin-complexity": "4.1.1",
76
- "@pothos/plugin-errors": "4.4.0",
77
- "@pothos/plugin-relay": "4.4.2",
78
- "@pothos/plugin-simple-objects": "4.1.2",
79
- "@pothos/test-utils": "2.1.1"
72
+ "prisma": "^6.10.1",
73
+ "vitest": "^3.2.4",
74
+ "@pothos/core": "4.7.1",
75
+ "@pothos/plugin-complexity": "4.1.2",
76
+ "@pothos/plugin-errors": "4.4.1",
77
+ "@pothos/plugin-relay": "4.6.0",
78
+ "@pothos/plugin-simple-objects": "4.1.3",
79
+ "@pothos/test-utils": "2.1.2"
80
80
  },
81
81
  "scripts": {
82
82
  "generate": "prisma generate && prisma generate --schema=./tests/prisma-types-from-client/schema.prisma",
@@ -2,19 +2,19 @@ import {
2
2
  type FieldKind,
3
3
  type FieldRef,
4
4
  type InputFieldMap,
5
+ isThenable,
5
6
  type MaybePromise,
6
7
  ObjectRef,
7
8
  PothosError,
8
9
  RootFieldBuilder,
9
10
  type SchemaTypes,
10
- isThenable,
11
11
  } from '@pothos/core';
12
12
  import {
13
13
  type GraphQLResolveInfo,
14
- Kind,
15
14
  getNamedType,
16
15
  isInterfaceType,
17
16
  isObjectType,
17
+ Kind,
18
18
  } from 'graphql';
19
19
  import { ModelLoader } from './model-loader';
20
20
  import type { PrismaConnectionFieldOptions, PrismaModelTypes } from './types';
package/src/generator.ts CHANGED
@@ -4,24 +4,24 @@ import { type DMMF, generatorHandler } from '@prisma/generator-helper';
4
4
  import ts, { ListFormat, ScriptKind, ScriptTarget, SyntaxKind, version } from 'typescript';
5
5
  import type { PothosPrismaDatamodel } from './types';
6
6
 
7
- const MIN_TS_VERSION = [4, 5, 2];
7
+ const MIN_TS_VERSION = [4, 5, 2] as const;
8
8
 
9
9
  const versionParts = version.split(/[.-]/g).map((part) => Number.parseInt(part, 10));
10
10
  const modifiersArg = (versionParts[0] >= 5 ? [] : [[]]) as [];
11
11
 
12
- function checkTSVersion() {
12
+ function checkVersion(expected: readonly [number, number, number]) {
13
13
  for (let i = 0; i < 3; i += 1) {
14
14
  const part = versionParts[i];
15
- if (part < MIN_TS_VERSION[i]) {
16
- throw new Error(
17
- `@pothos/plugin-prisma requires typescript version >${MIN_TS_VERSION.join('.')}`,
18
- );
15
+ if (part < expected[i]) {
16
+ return false;
19
17
  }
20
18
 
21
- if (part > MIN_TS_VERSION[i]) {
22
- return;
19
+ if (part > expected[i]) {
20
+ return true;
23
21
  }
24
22
  }
23
+
24
+ return true;
25
25
  }
26
26
 
27
27
  const defaultOutput = resolvePath(__dirname, '../generated.d.ts');
@@ -40,15 +40,33 @@ generatorHandler({
40
40
  defaultOutput,
41
41
  }),
42
42
  onGenerate: async (options) => {
43
- checkTSVersion();
43
+ if (!checkVersion(MIN_TS_VERSION)) {
44
+ throw new Error(
45
+ `@pothos/plugin-prisma requires typescript version >${MIN_TS_VERSION.join('.')}`,
46
+ );
47
+ }
48
+
44
49
  const config = options.generator.config as GeneratorConfig;
45
- const prismaLocation =
50
+ const prismaOutputLocation =
46
51
  config.clientOutput ??
47
52
  options.otherGenerators.find((gen) => gen.provider.value === 'prisma-client')?.output
48
53
  ?.value ??
49
54
  options.otherGenerators.find((gen) => gen.provider.value === 'prisma-client-js')!.output!
50
55
  .value!;
51
56
 
57
+ const usingPureTsGenerator = !!options.otherGenerators.find(
58
+ (gen) => gen.provider.value === 'prisma-client',
59
+ );
60
+ const extensions = ['.js', '.ts', '.cjs', '.mjs', '.cts', '.mts'];
61
+
62
+ const prismaLocation =
63
+ prismaOutputLocation.startsWith('@') ||
64
+ extensions.some((ext) => prismaOutputLocation.endsWith(ext))
65
+ ? prismaOutputLocation
66
+ : prismaOutputLocation.startsWith('./')
67
+ ? `./${posix.join(prismaOutputLocation, usingPureTsGenerator ? 'client.js' : 'index.js')}`
68
+ : posix.join(prismaOutputLocation, usingPureTsGenerator ? 'client.js' : 'index.js');
69
+
52
70
  if (!prismaLocation) {
53
71
  throw new Error('Unable to find prisma client output when generating pothos types');
54
72
  }
@@ -115,6 +133,7 @@ function trimDmmf(dmmf: DMMF.Document, documentation = false): PothosPrismaDatam
115
133
  return trimmed;
116
134
  }
117
135
 
136
+ // biome-ignore lint/suspicious/useAwait: needs to be async
118
137
  async function generateOutput(
119
138
  dmmf: DMMF.Document,
120
139
  prismaTypes: ts.InterfaceDeclaration,
@@ -13,6 +13,7 @@ import type {
13
13
  TypeParam,
14
14
  } from '@pothos/core';
15
15
  import type { GraphQLResolveInfo } from 'graphql';
16
+ import type { PothosPrismaPlugin } from '.';
16
17
  import type { PrismaInterfaceRef, PrismaRef } from './interface-ref';
17
18
  import type { PrismaNodeRef } from './node-ref';
18
19
  import type { PrismaObjectRef, prismaModelKey } from './object-ref';
@@ -28,13 +29,11 @@ import {
28
29
  type PrismaNodeOptions,
29
30
  type PrismaObjectFieldOptions,
30
31
  type PrismaObjectTypeOptions,
32
+ prismaModelName,
31
33
  type ShapeFromConnection,
32
34
  type ShapeFromSelection,
33
- prismaModelName,
34
35
  } from './types';
35
36
 
36
- import type { PothosPrismaPlugin } from '.';
37
-
38
37
  declare global {
39
38
  export namespace PothosSchemaTypes {
40
39
  export interface Plugins<Types extends SchemaTypes> {
@@ -254,11 +253,11 @@ declare global {
254
253
  > {
255
254
  prismaField: <
256
255
  Args extends InputFieldMap,
257
- TypeParam extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
256
+ TypeParam extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
258
257
  | PrismaRef<any, PrismaModelTypes>
259
258
  | keyof Types['PrismaTypes']
260
259
  | [keyof Types['PrismaTypes']]
261
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
260
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
262
261
  | [PrismaRef<any, PrismaModelTypes>],
263
262
  Nullable extends FieldNullability<Type>,
264
263
  ResolveShape,
@@ -269,10 +268,10 @@ declare global {
269
268
  Model extends PrismaModelTypes = PrismaModelTypes &
270
269
  (TypeParam extends [keyof Types['PrismaTypes']]
271
270
  ? Types['PrismaTypes'][TypeParam[0]]
272
- : // biome-ignore lint/suspicious/noExplicitAny: <explanation>
271
+ : // biome-ignore lint/suspicious/noExplicitAny: this is fine
273
272
  TypeParam extends [PrismaRef<any, PrismaModelTypes>]
274
273
  ? TypeParam[0][typeof prismaModelKey]
275
- : // biome-ignore lint/suspicious/noExplicitAny: <explanation>
274
+ : // biome-ignore lint/suspicious/noExplicitAny: this is fine
276
275
  TypeParam extends PrismaRef<any, PrismaModelTypes>
277
276
  ? TypeParam[typeof prismaModelKey]
278
277
  : TypeParam extends keyof Types['PrismaTypes']
@@ -295,16 +294,16 @@ declare global {
295
294
 
296
295
  prismaConnection: 'relay' extends PluginName
297
296
  ? <
298
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
297
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
299
298
  Type extends PrismaRef<any, PrismaModelTypes> | keyof Types['PrismaTypes'],
300
299
  Nullable extends boolean,
301
300
  ResolveReturnShape,
302
301
  Args extends InputFieldMap = {},
303
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
302
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
304
303
  Model extends PrismaModelTypes = Type extends PrismaRef<any, infer T>
305
304
  ? T
306
305
  : PrismaModelTypes & Types['PrismaTypes'][Type & keyof Types['PrismaTypes']],
307
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
306
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
308
307
  Shape = Type extends PrismaRef<any, PrismaModelTypes, infer S> ? S : Model['Shape'],
309
308
  const ConnectionInterfaces extends InterfaceParam<Types>[] = [],
310
309
  const EdgeInterfaces extends InterfaceParam<Types>[] = [],
@@ -362,11 +361,11 @@ declare global {
362
361
  prismaFieldWithInput: 'withInput' extends PluginName
363
362
  ? <
364
363
  Fields extends InputFieldMap,
365
- TypeParam extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
364
+ TypeParam extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
366
365
  | PrismaRef<any, PrismaModelTypes>
367
366
  | keyof Types['PrismaTypes']
368
367
  | [keyof Types['PrismaTypes']]
369
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
368
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
370
369
  | [PrismaRef<any, PrismaModelTypes>],
371
370
  Type extends TypeParam extends [unknown]
372
371
  ? [ObjectRef<Types, Model['Shape']>]
@@ -380,10 +379,10 @@ declare global {
380
379
  Model extends PrismaModelTypes = PrismaModelTypes &
381
380
  (TypeParam extends [keyof Types['PrismaTypes']]
382
381
  ? Types['PrismaTypes'][TypeParam[0]]
383
- : // biome-ignore lint/suspicious/noExplicitAny: <explanation>
382
+ : // biome-ignore lint/suspicious/noExplicitAny: this is fine
384
383
  TypeParam extends [PrismaRef<any, PrismaModelTypes>]
385
384
  ? TypeParam[0][typeof prismaModelKey]
386
- : // biome-ignore lint/suspicious/noExplicitAny: <explanation>
385
+ : // biome-ignore lint/suspicious/noExplicitAny: this is fine
387
386
  TypeParam extends PrismaRef<any, PrismaModelTypes>
388
387
  ? TypeParam[typeof prismaModelKey]
389
388
  : TypeParam extends keyof Types['PrismaTypes']
package/src/index.ts CHANGED
@@ -9,8 +9,7 @@ import SchemaBuilder, {
9
9
  type PothosTypeConfig,
10
10
  type SchemaTypes,
11
11
  } from '@pothos/core';
12
- // biome-ignore lint/style/useImportType: <explanation>
13
- import { GraphQLFieldResolver, GraphQLResolveInfo } from 'graphql';
12
+ import type { GraphQLFieldResolver, GraphQLResolveInfo } from 'graphql';
14
13
  import type { ModelLoader } from './model-loader';
15
14
  import { PrismaObjectFieldBuilder as InternalPrismaObjectFieldBuilder } from './prisma-field-builder';
16
15
  import type { PrismaModelTypes } from './types';
@@ -19,12 +18,12 @@ import { getModel, getRefFromModel } from './util/datamodel';
19
18
  import { getLoaderMapping, setLoaderMappings } from './util/loader-map';
20
19
  import { queryFromInfo } from './util/map-query';
21
20
 
22
- export { prismaClientCache } from './util/get-client';
23
21
  export { prismaConnectionHelpers } from './connection-helpers';
24
22
  export { PrismaInterfaceRef } from './interface-ref';
25
23
  export { PrismaNodeRef } from './node-ref';
26
- export { prismaModelKey, PrismaObjectRef } from './object-ref';
24
+ export { PrismaObjectRef, prismaModelKey } from './object-ref';
27
25
  export * from './types';
26
+ export { prismaClientCache } from './util/get-client';
28
27
 
29
28
  const pluginName = 'prisma';
30
29
 
@@ -1,19 +1,19 @@
1
1
  import {
2
+ createContextCache,
2
3
  type InterfaceRef,
3
4
  type ObjectRef,
4
5
  PothosSchemaError,
5
6
  type SchemaTypes,
6
- createContextCache,
7
7
  } from '@pothos/core';
8
8
  import type { GraphQLResolveInfo } from 'graphql';
9
- import type { PrismaDelegate, SelectionMap } from './types';
9
+ import type { SelectionMap } from './types';
10
10
  import { getDelegateFromModel, getModel } from './util/datamodel';
11
11
  import { getClient } from './util/get-client';
12
12
  import { cacheKey, setLoaderMappings } from './util/loader-map';
13
13
  import { selectionStateFromInfo } from './util/map-query';
14
14
  import {
15
- type SelectionState,
16
15
  mergeSelection,
16
+ type SelectionState,
17
17
  selectionCompatible,
18
18
  selectionToQuery,
19
19
  } from './util/selections';
@@ -282,7 +282,7 @@ export class ModelLoader {
282
282
  return this.initLoad(selection, model);
283
283
  }
284
284
 
285
- async initLoad(state: SelectionState, initialModel: {}) {
285
+ initLoad(state: SelectionState, initialModel: {}) {
286
286
  const delegate = getDelegateFromModel(
287
287
  getClient(this.builder, this.context as never),
288
288
  this.modelName,
package/src/object-ref.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
- ObjectRef,
3
- type SchemaTypes,
4
2
  abstractReturnShapeKey,
5
3
  brandWithType,
4
+ ObjectRef,
5
+ type SchemaTypes,
6
6
  typeBrandKey,
7
7
  } from '@pothos/core';
8
8
  import type { PrismaModelTypes, WithBrand } from './types';
@@ -6,6 +6,7 @@ import {
6
6
  type InferredFieldOptionKeys,
7
7
  type InputFieldMap,
8
8
  type InterfaceParam,
9
+ isThenable,
9
10
  type MaybePromise,
10
11
  type NormalizeArgs,
11
12
  ObjectRef,
@@ -14,12 +15,11 @@ import {
14
15
  type SchemaTypes,
15
16
  type ShapeFromTypeParam,
16
17
  type TypeParam,
17
- isThenable,
18
18
  } from '@pothos/core';
19
19
  import {
20
20
  type FieldNode,
21
+ Kind as GraphQLKind,
21
22
  type GraphQLResolveInfo,
22
- Kind,
23
23
  getNamedType,
24
24
  isInterfaceType,
25
25
  isObjectType,
@@ -49,7 +49,6 @@ import type { FieldMap } from './util/relation-map';
49
49
 
50
50
  // Workaround for FieldKind not being extended on Builder classes
51
51
  const RootBuilder: {
52
- // biome-ignore lint/suspicious/noRedeclare: <explanation>
53
52
  new <Types extends SchemaTypes, Shape, Kind extends FieldKind>(
54
53
  builder: PothosSchemaTypes.SchemaBuilder<Types>,
55
54
  kind: FieldKind,
@@ -301,11 +300,11 @@ export class PrismaObjectFieldBuilder<
301
300
  const hasTotalCount = totalCount && !!getSelection(['totalCount']);
302
301
 
303
302
  const selections = selection.selectionSet?.selections.filter(
304
- (sel) => !(sel.kind === Kind.FIELD && sel.name.value === '__typename'),
303
+ (sel) => !(sel.kind === GraphQLKind.FIELD && sel.name.value === '__typename'),
305
304
  );
306
305
  const totalCountOnly =
307
306
  selections?.length === 1 &&
308
- selections[0].kind === Kind.FIELD &&
307
+ selections[0].kind === GraphQLKind.FIELD &&
309
308
  selections[0].name.value === 'totalCount' &&
310
309
  hasTotalCount;
311
310
 
@@ -355,7 +354,7 @@ export class PrismaObjectFieldBuilder<
355
354
  const totalCountOnly = selections.every((selection) =>
356
355
  selection.selectionSet?.selections.every(
357
356
  (s) =>
358
- s.kind === Kind.FIELD &&
357
+ s.kind === GraphQLKind.FIELD &&
359
358
  (fields[s.name.value]?.extensions?.pothosPrismaTotalCount ||
360
359
  s.name.value === '__typename'),
361
360
  ),
@@ -514,8 +513,6 @@ export class PrismaObjectFieldBuilder<
514
513
  ): FieldRef<Types, number, 'Object'> {
515
514
  const [{ where, ...options } = {} as never] = allArgs;
516
515
 
517
- const { resolve, ...rest } = options;
518
-
519
516
  const countSelect =
520
517
  typeof where === 'function'
521
518
  ? (args: {}, context: {}) => ({
@@ -532,7 +529,7 @@ export class PrismaObjectFieldBuilder<
532
529
  };
533
530
 
534
531
  return this.field({
535
- ...(rest as {}),
532
+ ...(options as {}),
536
533
  type: 'Int',
537
534
  nullable: false,
538
535
  select: countSelect as never,
@@ -542,7 +539,7 @@ export class PrismaObjectFieldBuilder<
542
539
  }
543
540
 
544
541
  variant<
545
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
542
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
546
543
  Variant extends Model['Name'] | PrismaRef<any, Model>,
547
544
  Args extends InputFieldMap,
548
545
  Nullable,
@@ -553,7 +550,7 @@ export class PrismaObjectFieldBuilder<
553
550
  options: VariantFieldOptions<
554
551
  Types,
555
552
  Model,
556
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
553
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
557
554
  Variant extends PrismaRef<any, Model> ? Variant : PrismaRef<Types, Model>,
558
555
  Args,
559
556
  Nullable,
@@ -1,11 +1,8 @@
1
1
  import './global-types';
2
2
  import SchemaBuilder, {
3
3
  brandWithType,
4
- completeValue,
5
- type FieldRef,
6
4
  type InterfaceRef,
7
5
  type OutputType,
8
- PothosError,
9
6
  type SchemaTypes,
10
7
  } from '@pothos/core';
11
8
  import type { GraphQLResolveInfo } from 'graphql';
package/src/types.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  type InterfaceParam,
13
13
  type ListResolveValue,
14
14
  type MaybePromise,
15
+ type Merge,
15
16
  type Normalize,
16
17
  type ObjectRef,
17
18
  type OutputShape,
@@ -27,9 +28,9 @@ import type { PrismaInterfaceRef, PrismaRef } from './interface-ref';
27
28
  import type { PrismaObjectFieldBuilder } from './prisma-field-builder';
28
29
 
29
30
  export interface PrismaDelegate {
30
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
31
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
31
32
  findUniqueOrThrow?: (...args: any[]) => Promise<unknown>;
32
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
33
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
33
34
  findUnique: (...args: any[]) => Promise<unknown>;
34
35
  }
35
36
 
@@ -86,7 +87,7 @@ export type PrismaObjectFieldOptions<
86
87
  ShapeFromSelection<
87
88
  Types,
88
89
  ExtractModel<Types, ParentShape>,
89
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
90
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
90
91
  { select: Select extends (...args: any[]) => infer S ? S : Select }
91
92
  >,
92
93
  > = PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Type, Nullable, Args, ResolveReturnShape> &
@@ -435,7 +436,7 @@ export type RelatedFieldOptions<
435
436
  info: GraphQLResolveInfo,
436
437
  ) => MaybePromise<ShapeWithNullability<Types, Model['Relations'][Field]['Shape'], Nullable>>;
437
438
  description?: string | false;
438
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
439
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
439
440
  type?: PrismaRef<any, TypesForRelation<Types, Model, Field>>;
440
441
  query?: QueryForField<Types, Args, Model['Include'][Field & keyof Model['Include']]>;
441
442
  onNull?:
@@ -458,7 +459,7 @@ export type RelatedFieldOptions<
458
459
  export type VariantFieldOptions<
459
460
  Types extends SchemaTypes,
460
461
  Model extends PrismaModelTypes,
461
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
462
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
462
463
  Variant extends PrismaRef<any, Model>,
463
464
  Args extends InputFieldMap,
464
465
  isNull,
@@ -504,11 +505,11 @@ export type RelationCountOptions<
504
505
  export type PrismaFieldOptions<
505
506
  Types extends SchemaTypes,
506
507
  ParentShape,
507
- Type extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
508
+ Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
508
509
  | PrismaRef<any, PrismaModelTypes>
509
510
  | keyof Types['PrismaTypes']
510
511
  | [keyof Types['PrismaTypes']]
511
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
512
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
512
513
  | [PrismaRef<any, PrismaModelTypes>],
513
514
  Model extends PrismaModelTypes,
514
515
  Param extends TypeParam<Types>,
@@ -530,7 +531,7 @@ export type PrismaFieldOptions<
530
531
  ? Omit<FieldOptions, InferredFieldOptionKeys | 'type'> & {
531
532
  type: Type;
532
533
  resolve: FieldOptions extends {
533
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
534
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
534
535
  resolve?: (parent: infer Parent, ...args: any[]) => unknown;
535
536
  }
536
537
  ? PrismaFieldResolver<Types, Model, Parent, Param, Args, Nullable, ResolveReturnShape>
@@ -544,11 +545,11 @@ export type PrismaFieldWithInputOptions<
544
545
  Kind extends FieldKind,
545
546
  Args extends InputFieldMap,
546
547
  Fields extends InputFieldMap,
547
- Type extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
548
+ Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
548
549
  | PrismaRef<any, PrismaModelTypes>
549
550
  | keyof Types['PrismaTypes']
550
551
  | [keyof Types['PrismaTypes']]
551
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
552
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
552
553
  | [PrismaRef<any, PrismaModelTypes>],
553
554
  Model extends PrismaModelTypes,
554
555
  Param extends TypeParam<Types>,
@@ -616,9 +617,9 @@ export type PrismaFieldResolver<
616
617
  export type PrismaConnectionFieldOptions<
617
618
  Types extends SchemaTypes,
618
619
  ParentShape,
619
- Type extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
620
+ Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
620
621
  | PrismaInterfaceRef<any, PrismaModelTypes>
621
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
622
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
622
623
  | PrismaRef<any, PrismaModelTypes>
623
624
  | keyof Types['PrismaTypes'],
624
625
  Model extends PrismaModelTypes,
@@ -741,7 +742,7 @@ export type RelatedConnectionOptions<
741
742
  } & {
742
743
  description?: string | false;
743
744
  query?: QueryForField<Types, Args, Model['Include'][Field & keyof Model['Include']]>;
744
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
745
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
745
746
  type?: PrismaRef<any, TypesForRelation<Types, Model, Field>>;
746
747
  cursor: CursorFromRelation<Model, Field>;
747
748
  defaultSize?: number | ((args: ConnectionArgs, ctx: Types['Context']) => number);
@@ -796,18 +797,26 @@ export type PrismaConnectionShape<
796
797
  T,
797
798
  Parent,
798
799
  Args extends InputFieldMap,
799
- > = (
800
+ > = Merge<
800
801
  ShapeFromConnection<PothosSchemaTypes.ConnectionShapeHelper<Types, T, false>> extends infer Shape
801
802
  ? Shape & {
802
803
  parent: Parent;
803
804
  args: InputShapeFromFields<Args> & PothosSchemaTypes.DefaultConnectionArguments;
804
805
  }
805
806
  : never
806
- ) extends infer C
807
+ > extends infer C
807
808
  ? [C] extends [
808
- { edges: MaybePromise<readonly (infer Edge | null | undefined)[] | null | undefined> },
809
+ {
810
+ edges: infer Edges;
811
+ },
809
812
  ]
810
- ? Omit<C, 'edges'> & { edges: (Edge & { connection: C })[] }
813
+ ? Merge<
814
+ Omit<C, 'edges'> & {
815
+ edges: Edges extends Iterable<MaybePromise<infer Edge> | null | undefined>
816
+ ? Merge<Edge & { connection: C }>[]
817
+ : never;
818
+ }
819
+ >
811
820
  : C
812
821
  : never;
813
822
 
@@ -848,7 +857,7 @@ type InferModelShape<Model> = Simplify<
848
857
  // Infer relations for a given model
849
858
  type InferRelations<Model> = {
850
859
  [K in keyof Model]: {
851
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
860
+ // biome-ignore lint/suspicious/noExplicitAny: matching against any is okay
852
861
  Shape: Model[K] extends any[] ? InferModelShape<Model[K][0]>[] : InferModelShape<Model[K]>;
853
862
  Name: InferField<InferItemOfArray<Model[K]>, 'name'>;
854
863
  Nullable: IsNullable<Model[K]>;
@@ -857,7 +866,7 @@ type InferRelations<Model> = {
857
866
 
858
867
  // Create a list of keys that represent array relations
859
868
  type InferRelationList<Model> = {
860
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
869
+ // biome-ignore lint/suspicious/noExplicitAny: matching against any is okay
861
870
  [K in keyof Model as Model[K] extends any[] ? K : never]: K;
862
871
  };
863
872
 
@@ -869,7 +878,7 @@ type InferItemOfArray<T> = T extends Array<infer U> ? U : T;
869
878
 
870
879
  // Infers the composites of a given model
871
880
  type InferComposites<Model> = {
872
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
881
+ // biome-ignore lint/suspicious/noExplicitAny: matching against any is okay
873
882
  [K in keyof Model]: Model[K] extends any[]
874
883
  ? Simplify<
875
884
  InferField<Model[K][0], 'scalars'> & InferComposites<InferField<Model[K][0], 'composites'>>