@pothos/plugin-drizzle 0.10.3 → 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.
- package/CHANGELOG.md +12 -0
- package/dts/drizzle-field-builder.d.ts.map +1 -1
- package/dts/global-types.d.ts +3 -3
- package/dts/global-types.d.ts.map +1 -1
- package/dts/index.d.ts +2 -2
- package/dts/index.d.ts.map +1 -1
- package/dts/model-loader.d.ts.map +1 -1
- package/dts/object-ref.d.ts +1 -1
- package/dts/object-ref.d.ts.map +1 -1
- package/dts/types.d.ts +1 -1
- package/dts/types.d.ts.map +1 -1
- package/dts/utils/config.d.ts.map +1 -1
- package/dts/utils/cursors.d.ts.map +1 -1
- package/dts/utils/map-query.d.ts.map +1 -1
- package/dts/utils/selections.d.ts.map +1 -1
- package/esm/drizzle-field-builder.d.ts.map +1 -1
- package/esm/drizzle-field-builder.js +3 -3
- package/esm/drizzle-field-builder.js.map +1 -1
- package/esm/field-builder.js.map +1 -1
- package/esm/global-types.d.ts +3 -3
- package/esm/global-types.d.ts.map +1 -1
- package/esm/global-types.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/interface-ref.js.map +1 -1
- package/esm/model-loader.d.ts.map +1 -1
- package/esm/model-loader.js +2 -2
- package/esm/model-loader.js.map +1 -1
- package/esm/node-ref.js.map +1 -1
- package/esm/object-ref.d.ts +1 -1
- package/esm/object-ref.d.ts.map +1 -1
- package/esm/object-ref.js +1 -1
- package/esm/object-ref.js.map +1 -1
- package/esm/schema-builder.js.map +1 -1
- package/esm/types.d.ts +1 -1
- package/esm/types.d.ts.map +1 -1
- package/esm/utils/config.d.ts.map +1 -1
- package/esm/utils/config.js.map +1 -1
- package/esm/utils/cursors.d.ts.map +1 -1
- package/esm/utils/cursors.js +1 -2
- package/esm/utils/cursors.js.map +1 -1
- package/esm/utils/drizzle-graphql.js +6 -6
- package/esm/utils/drizzle-graphql.js.map +1 -1
- package/esm/utils/map-query.d.ts.map +1 -1
- package/esm/utils/map-query.js +2 -2
- package/esm/utils/map-query.js.map +1 -1
- package/esm/utils/selections.d.ts.map +1 -1
- package/esm/utils/selections.js +1 -1
- package/esm/utils/selections.js.map +1 -1
- package/lib/drizzle-field-builder.js +1 -1
- package/lib/drizzle-field-builder.js.map +1 -1
- package/lib/field-builder.js.map +1 -1
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/interface-ref.js.map +1 -1
- package/lib/model-loader.js +2 -2
- package/lib/model-loader.js.map +1 -1
- package/lib/node-ref.js +3 -3
- package/lib/node-ref.js.map +1 -1
- package/lib/object-ref.js +3 -3
- package/lib/object-ref.js.map +1 -1
- package/lib/schema-builder.js.map +1 -1
- package/lib/types.js +3 -3
- package/lib/types.js.map +1 -1
- package/lib/utils/config.js +4 -4
- package/lib/utils/config.js.map +1 -1
- package/lib/utils/cursors.js +16 -17
- package/lib/utils/cursors.js.map +1 -1
- package/lib/utils/drizzle-graphql.js +6 -6
- package/lib/utils/drizzle-graphql.js.map +1 -1
- package/lib/utils/loader-map.js +4 -4
- package/lib/utils/loader-map.js.map +1 -1
- package/lib/utils/map-query.js +6 -6
- package/lib/utils/map-query.js.map +1 -1
- package/lib/utils/refs.js +3 -3
- package/lib/utils/refs.js.map +1 -1
- package/lib/utils/selections.js +8 -8
- package/lib/utils/selections.js.map +1 -1
- package/lib/utils/usage.js +5 -5
- package/lib/utils/usage.js.map +1 -1
- package/package.json +12 -12
- package/src/connection-helpers.ts +1 -1
- package/src/drizzle-field-builder.ts +3 -3
- package/src/field-builder.ts +1 -1
- package/src/global-types.ts +15 -20
- package/src/index.ts +3 -4
- package/src/model-loader.ts +9 -7
- package/src/object-ref.ts +2 -2
- package/src/schema-builder.ts +3 -4
- package/src/types.ts +8 -8
- package/src/utils/config.ts +2 -2
- package/src/utils/cursors.ts +3 -12
- package/src/utils/drizzle-graphql.ts +6 -6
- package/src/utils/map-query.ts +6 -6
- package/src/utils/selections.ts +2 -4
package/src/utils/cursors.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
// );
|
package/src/utils/map-query.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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';
|
package/src/utils/selections.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { PothosValidationError } from '@pothos/core';
|
|
2
2
|
import {
|
|
3
3
|
type DBQueryConfig,
|
|
4
|
-
|
|
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 &&
|