@pothos/plugin-drizzle 0.10.4 → 0.10.5

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 (95) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dts/drizzle-field-builder.d.ts.map +1 -1
  3. package/dts/global-types.d.ts +3 -3
  4. package/dts/global-types.d.ts.map +1 -1
  5. package/dts/index.d.ts +2 -2
  6. package/dts/index.d.ts.map +1 -1
  7. package/dts/model-loader.d.ts.map +1 -1
  8. package/dts/object-ref.d.ts +1 -1
  9. package/dts/object-ref.d.ts.map +1 -1
  10. package/dts/types.d.ts +1 -1
  11. package/dts/types.d.ts.map +1 -1
  12. package/dts/utils/config.d.ts.map +1 -1
  13. package/dts/utils/cursors.d.ts.map +1 -1
  14. package/dts/utils/map-query.d.ts.map +1 -1
  15. package/dts/utils/selections.d.ts.map +1 -1
  16. package/esm/drizzle-field-builder.d.ts.map +1 -1
  17. package/esm/drizzle-field-builder.js +3 -3
  18. package/esm/drizzle-field-builder.js.map +1 -1
  19. package/esm/field-builder.js.map +1 -1
  20. package/esm/global-types.d.ts +3 -3
  21. package/esm/global-types.d.ts.map +1 -1
  22. package/esm/global-types.js.map +1 -1
  23. package/esm/index.d.ts +2 -2
  24. package/esm/index.d.ts.map +1 -1
  25. package/esm/index.js +2 -2
  26. package/esm/index.js.map +1 -1
  27. package/esm/interface-ref.js.map +1 -1
  28. package/esm/model-loader.d.ts.map +1 -1
  29. package/esm/model-loader.js.map +1 -1
  30. package/esm/node-ref.js.map +1 -1
  31. package/esm/object-ref.d.ts +1 -1
  32. package/esm/object-ref.d.ts.map +1 -1
  33. package/esm/object-ref.js +1 -1
  34. package/esm/object-ref.js.map +1 -1
  35. package/esm/schema-builder.js.map +1 -1
  36. package/esm/types.d.ts +1 -1
  37. package/esm/types.d.ts.map +1 -1
  38. package/esm/utils/config.d.ts.map +1 -1
  39. package/esm/utils/config.js.map +1 -1
  40. package/esm/utils/cursors.d.ts.map +1 -1
  41. package/esm/utils/cursors.js +1 -2
  42. package/esm/utils/cursors.js.map +1 -1
  43. package/esm/utils/drizzle-graphql.js +6 -6
  44. package/esm/utils/drizzle-graphql.js.map +1 -1
  45. package/esm/utils/map-query.d.ts.map +1 -1
  46. package/esm/utils/map-query.js +2 -2
  47. package/esm/utils/map-query.js.map +1 -1
  48. package/esm/utils/selections.d.ts.map +1 -1
  49. package/esm/utils/selections.js +1 -1
  50. package/esm/utils/selections.js.map +1 -1
  51. package/lib/drizzle-field-builder.js +1 -1
  52. package/lib/drizzle-field-builder.js.map +1 -1
  53. package/lib/field-builder.js.map +1 -1
  54. package/lib/index.js +9 -9
  55. package/lib/index.js.map +1 -1
  56. package/lib/interface-ref.js.map +1 -1
  57. package/lib/model-loader.js.map +1 -1
  58. package/lib/node-ref.js +3 -3
  59. package/lib/node-ref.js.map +1 -1
  60. package/lib/object-ref.js +3 -3
  61. package/lib/object-ref.js.map +1 -1
  62. package/lib/schema-builder.js.map +1 -1
  63. package/lib/types.js +3 -3
  64. package/lib/types.js.map +1 -1
  65. package/lib/utils/config.js +4 -4
  66. package/lib/utils/config.js.map +1 -1
  67. package/lib/utils/cursors.js +16 -17
  68. package/lib/utils/cursors.js.map +1 -1
  69. package/lib/utils/drizzle-graphql.js +6 -6
  70. package/lib/utils/drizzle-graphql.js.map +1 -1
  71. package/lib/utils/loader-map.js +4 -4
  72. package/lib/utils/loader-map.js.map +1 -1
  73. package/lib/utils/map-query.js +6 -6
  74. package/lib/utils/map-query.js.map +1 -1
  75. package/lib/utils/refs.js +3 -3
  76. package/lib/utils/refs.js.map +1 -1
  77. package/lib/utils/selections.js +8 -8
  78. package/lib/utils/selections.js.map +1 -1
  79. package/lib/utils/usage.js +5 -5
  80. package/lib/utils/usage.js.map +1 -1
  81. package/package.json +12 -12
  82. package/src/connection-helpers.ts +1 -1
  83. package/src/drizzle-field-builder.ts +3 -3
  84. package/src/field-builder.ts +1 -1
  85. package/src/global-types.ts +15 -20
  86. package/src/index.ts +3 -4
  87. package/src/model-loader.ts +5 -5
  88. package/src/object-ref.ts +2 -2
  89. package/src/schema-builder.ts +3 -4
  90. package/src/types.ts +8 -8
  91. package/src/utils/config.ts +2 -2
  92. package/src/utils/cursors.ts +3 -12
  93. package/src/utils/drizzle-graphql.ts +6 -6
  94. package/src/utils/map-query.ts +6 -6
  95. package/src/utils/selections.ts +2 -4
@@ -1,19 +1,11 @@
1
1
  import {
2
+ decodeBase64,
3
+ encodeBase64,
2
4
  type MaybePromise,
3
5
  PothosValidationError,
4
6
  type SchemaTypes,
5
- decodeBase64,
6
- encodeBase64,
7
7
  } from '@pothos/core';
8
- import type {
9
- Column,
10
- DBQueryConfig,
11
- OrderByOperators,
12
- SQL,
13
- Table,
14
- TableConfig,
15
- TableRelationalConfig,
16
- } from 'drizzle-orm';
8
+ import type { Column, DBQueryConfig, SQL, TableConfig, TableRelationalConfig } from 'drizzle-orm';
17
9
  import type { GraphQLResolveInfo } from 'graphql';
18
10
  import type { ConnectionOrderBy, QueryForDrizzleConnection } from '../types';
19
11
  import type { PothosDrizzleSchemaConfig } from './config';
@@ -318,7 +310,6 @@ function parseOrderBy(
318
310
  normalized.push({ direction: 'asc', column: field });
319
311
  }
320
312
  } else {
321
- // biome-ignore lint/complexity/noForEach: <explanation>
322
313
  Object.entries(
323
314
  orderBy as {
324
315
  [k: string]: 'asc' | 'desc' | undefined;
@@ -8,7 +8,7 @@
8
8
  // } from 'drizzle-orm';
9
9
  // import { GraphQLError } from 'graphql';
10
10
 
11
- // // biome-ignore lint/suspicious/noExplicitAny: <explanation>
11
+ // // biome-ignore lint/suspicious/noExplicitAny: this is fine
12
12
  // export const remapFromGraphQLCore = (value: any, column: Column, columnName: string) => {
13
13
  // switch (column.dataType) {
14
14
  // case 'date': {
@@ -71,7 +71,7 @@
71
71
  // };
72
72
 
73
73
  // export const remapFromGraphQLSingleInput = (
74
- // // biome-ignore lint/suspicious/noExplicitAny: <explanation>
74
+ // // biome-ignore lint/suspicious/noExplicitAny: this is fine
75
75
  // queryInput: Record<string, any>,
76
76
  // table: TableRelationalConfig,
77
77
  // ) => {
@@ -97,7 +97,7 @@
97
97
  // };
98
98
 
99
99
  // export const remapFromGraphQLArrayInput = (
100
- // // biome-ignore lint/suspicious/noExplicitAny: <explanation>
100
+ // // biome-ignore lint/suspicious/noExplicitAny: this is fine
101
101
  // queryInput: Record<string, any>[],
102
102
  // table: TableRelationalConfig,
103
103
  // ) => {
@@ -117,7 +117,7 @@
117
117
 
118
118
  // export const extractOrderBy = <
119
119
  // TTable extends TableRelationalConfig,
120
- // // biome-ignore lint/suspicious/noExplicitAny: <explanation>
120
+ // // biome-ignore lint/suspicious/noExplicitAny: this is fine
121
121
  // TArgs extends OrderByArgs<any> = OrderByArgs<TTable>,
122
122
  // >(
123
123
  // table: TTable,
@@ -195,13 +195,13 @@
195
195
  // break;
196
196
  // case 'inArray':
197
197
  // case 'notInArray': {
198
- // // biome-ignore lint/suspicious/noExplicitAny: <explanation>
198
+ // // biome-ignore lint/suspicious/noExplicitAny: this is fine
199
199
  // if (!(operatorValue as any[]).length) {
200
200
  // throw new GraphQLError(
201
201
  // `WHERE ${columnName}: Unable to use operator ${operatorName} with an empty array!`,
202
202
  // );
203
203
  // }
204
- // // biome-ignore lint/suspicious/noExplicitAny: <explanation>
204
+ // // biome-ignore lint/suspicious/noExplicitAny: this is fine
205
205
  // const arrayValue = (operatorValue as any[]).map((val) =>
206
206
  // remapFromGraphQLCore(val, column, columnName),
207
207
  // );
@@ -1,4 +1,4 @@
1
- import { PothosValidationError, getMappedArgumentValues } from '@pothos/core';
1
+ import { getMappedArgumentValues, PothosValidationError } from '@pothos/core';
2
2
  import type { DBQueryConfig, TableRelationalConfig } from 'drizzle-orm';
3
3
  import {
4
4
  type FieldNode,
@@ -11,22 +11,22 @@ import {
11
11
  type GraphQLObjectType,
12
12
  type GraphQLResolveInfo,
13
13
  GraphQLSkipDirective,
14
- type InlineFragmentNode,
15
- Kind,
16
- type SelectionSetNode,
17
14
  getDirectiveValues,
18
15
  getNamedType,
16
+ type InlineFragmentNode,
19
17
  isInterfaceType,
20
18
  isObjectType,
19
+ Kind,
20
+ type SelectionSetNode,
21
21
  } from 'graphql';
22
22
  import type { DrizzleFieldSelection } from '../types';
23
23
  import type { PothosDrizzleSchemaConfig } from './config';
24
24
  import { type LoaderMappings, setLoaderMappings } from './loader-map';
25
25
  import {
26
- type SelectionMap,
27
- type SelectionState,
28
26
  createState,
29
27
  mergeSelection,
28
+ type SelectionMap,
29
+ type SelectionState,
30
30
  selectionCompatible,
31
31
  selectionToQuery,
32
32
  } from './selections';
@@ -1,11 +1,9 @@
1
1
  import { PothosValidationError } from '@pothos/core';
2
2
  import {
3
3
  type DBQueryConfig,
4
- type SQLOperator,
5
- type SQLWrapper,
4
+ getTableUniqueName,
6
5
  type Table,
7
6
  type TableRelationalConfig,
8
- getTableUniqueName,
9
7
  } from 'drizzle-orm';
10
8
  import type { PothosDrizzleSchemaConfig } from './config';
11
9
  import { deepEqual } from './deep-equal';
@@ -35,7 +33,7 @@ export function selectionCompatible(
35
33
  return ignoreQuery || !selectionMap || Object.keys(state.query).length === 0;
36
34
  }
37
35
 
38
- const { with: withSelection, extras, columns, ...query } = selectionMap;
36
+ const { with: withSelection, extras, columns: _, ...query } = selectionMap;
39
37
 
40
38
  if (
41
39
  withSelection &&