@pothos/plugin-drizzle 0.17.1 → 0.17.3
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 +16 -0
- package/dts/connection-helpers.d.ts +7 -7
- package/dts/connection-helpers.d.ts.map +1 -1
- package/dts/drizzle-field-builder.d.ts +35 -20
- package/dts/drizzle-field-builder.d.ts.map +1 -1
- package/dts/global-types.d.ts.map +1 -1
- package/dts/index.d.ts.map +1 -1
- package/dts/interface-ref.d.ts.map +1 -1
- package/dts/model-loader.d.ts.map +1 -1
- package/dts/node-ref.d.ts.map +1 -1
- package/dts/object-ref.d.ts.map +1 -1
- package/dts/types.d.ts +8 -8
- package/dts/types.d.ts.map +1 -1
- package/dts/utils/cursors.d.ts +1 -1
- package/dts/utils/cursors.d.ts.map +1 -1
- package/dts/utils/map-query.d.ts +1 -1
- package/dts/utils/map-query.d.ts.map +1 -1
- package/esm/connection-helpers.d.ts +1 -1
- package/esm/connection-helpers.d.ts.map +1 -1
- package/esm/drizzle-field-builder.d.ts +75 -30
- package/esm/drizzle-field-builder.d.ts.map +1 -1
- package/esm/global-types.d.ts.map +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/interface-ref.d.ts.map +1 -1
- package/esm/model-loader.d.ts.map +1 -1
- package/esm/node-ref.d.ts.map +1 -1
- package/esm/object-ref.d.ts.map +1 -1
- package/esm/types.d.ts +8 -8
- package/esm/types.d.ts.map +1 -1
- package/esm/utils/cursors.d.ts +1 -1
- package/esm/utils/cursors.d.ts.map +1 -1
- package/esm/utils/map-query.d.ts +1 -1
- package/esm/utils/map-query.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/types.ts +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pothos/plugin-drizzle",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.3",
|
|
4
4
|
"description": "A Pothos plugin for drizzle",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./dts/index.d.ts",
|
|
@@ -41,26 +41,26 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@libsql/client": "^0.17.2",
|
|
43
43
|
"drizzle-graphql": "^0.8.5",
|
|
44
|
-
"drizzle-kit": "1.0.0-beta.
|
|
45
|
-
"drizzle-orm": "1.0.0-beta.
|
|
44
|
+
"drizzle-kit": "1.0.0-beta.23",
|
|
45
|
+
"drizzle-orm": "1.0.0-beta.23",
|
|
46
46
|
"graphql-scalars": "^1.25.0",
|
|
47
47
|
"graphql-tag": "^2.12.6",
|
|
48
48
|
"postgres": "^3.4.9",
|
|
49
49
|
"@pothos/core": "4.12.0",
|
|
50
|
-
"@pothos/plugin-add-graphql": "4.3.0",
|
|
51
50
|
"@pothos/plugin-errors": "4.9.0",
|
|
52
|
-
"@pothos/plugin-relay": "4.7.0",
|
|
53
51
|
"@pothos/plugin-scope-auth": "4.1.6",
|
|
52
|
+
"@pothos/plugin-relay": "4.7.0",
|
|
53
|
+
"@pothos/plugin-add-graphql": "4.3.0",
|
|
54
54
|
"@pothos/plugin-with-input": "4.1.4",
|
|
55
55
|
"@pothos/test-utils": "2.1.3"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
-
"type": "
|
|
58
|
+
"type": "tsgo --project tsconfig.type.json",
|
|
59
59
|
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:dts && pnpm build:esm",
|
|
60
60
|
"build:clean": "git clean -dfX esm lib",
|
|
61
61
|
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs --strip-leading-paths",
|
|
62
62
|
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths && pnpm esm:extensions",
|
|
63
|
-
"build:dts": "
|
|
63
|
+
"build:dts": "tsgo",
|
|
64
64
|
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts",
|
|
65
65
|
"test": "pnpm vitest --run"
|
|
66
66
|
}
|
package/src/types.ts
CHANGED
|
@@ -236,8 +236,8 @@ export type DrizzleFieldOptions<
|
|
|
236
236
|
> & {
|
|
237
237
|
type: Param;
|
|
238
238
|
resolve: (
|
|
239
|
-
query: <T
|
|
240
|
-
selection?: T,
|
|
239
|
+
query: <T = {}>(
|
|
240
|
+
selection?: T & QueryForDrizzleField<Types, Param, Table>,
|
|
241
241
|
) => Omit<T, 'columns' | 'extra'> & {
|
|
242
242
|
columns: T extends { columns: infer C extends {} } ? C : {};
|
|
243
243
|
extras: {
|
|
@@ -392,7 +392,7 @@ export type RelatedFieldOptions<
|
|
|
392
392
|
> & {
|
|
393
393
|
description?: string | false;
|
|
394
394
|
// biome-ignore lint/suspicious/noExplicitAny: this is fine
|
|
395
|
-
type?: DrizzleRef<any, Table['relations'][Field]['
|
|
395
|
+
type?: DrizzleRef<any, Table['relations'][Field]['targetTableName']>;
|
|
396
396
|
query?: QueryForField<Types, Args, Table['relations'][Field]>;
|
|
397
397
|
};
|
|
398
398
|
|
|
@@ -446,7 +446,7 @@ export type VariantFieldOptions<
|
|
|
446
446
|
};
|
|
447
447
|
|
|
448
448
|
export type RefForRelation<Types extends SchemaTypes, Rel extends Relation> = Rel extends {
|
|
449
|
-
|
|
449
|
+
relationType: 'one';
|
|
450
450
|
}
|
|
451
451
|
? ObjectRef<Types, TypesForRelation<Types, Rel>>
|
|
452
452
|
: [ObjectRef<Types, TypesForRelation<Types, Rel>>];
|
|
@@ -465,7 +465,7 @@ export type RelatedCountOptions<
|
|
|
465
465
|
|
|
466
466
|
export type TypesForRelation<Types extends SchemaTypes, Rel extends Relation> = BuildQueryResult<
|
|
467
467
|
Types['DrizzleRelations'],
|
|
468
|
-
Types['DrizzleRelations'][Rel['
|
|
468
|
+
Types['DrizzleRelations'][Rel['targetTableName']],
|
|
469
469
|
true
|
|
470
470
|
>;
|
|
471
471
|
|
|
@@ -475,13 +475,13 @@ export type QueryForField<
|
|
|
475
475
|
Rel extends Relation,
|
|
476
476
|
> = (
|
|
477
477
|
Rel extends {
|
|
478
|
-
|
|
478
|
+
relationType: 'one';
|
|
479
479
|
}
|
|
480
480
|
? Omit<
|
|
481
481
|
DBQueryConfig<
|
|
482
482
|
'one',
|
|
483
483
|
Types['DrizzleRelations'],
|
|
484
|
-
Types['DrizzleRelations'][Rel['
|
|
484
|
+
Types['DrizzleRelations'][Rel['targetTableName']]
|
|
485
485
|
>,
|
|
486
486
|
'columns' | 'extra' | 'with'
|
|
487
487
|
>
|
|
@@ -489,7 +489,7 @@ export type QueryForField<
|
|
|
489
489
|
DBQueryConfig<
|
|
490
490
|
'many',
|
|
491
491
|
Types['DrizzleRelations'],
|
|
492
|
-
Types['DrizzleRelations'][Rel['
|
|
492
|
+
Types['DrizzleRelations'][Rel['targetTableName']]
|
|
493
493
|
>,
|
|
494
494
|
'columns' | 'extra' | 'with'
|
|
495
495
|
>
|
|
@@ -626,7 +626,7 @@ export type RelatedConnectionOptions<
|
|
|
626
626
|
Args extends InputFieldMap,
|
|
627
627
|
Type = unknown,
|
|
628
628
|
NodeTable extends
|
|
629
|
-
TableRelationalConfig = Types['DrizzleRelations'][Table['relations'][Field]['
|
|
629
|
+
TableRelationalConfig = Types['DrizzleRelations'][Table['relations'][Field]['targetTableName']],
|
|
630
630
|
> = Omit<
|
|
631
631
|
PothosSchemaTypes.ObjectFieldOptions<
|
|
632
632
|
Types,
|
|
@@ -669,7 +669,7 @@ export type RelatedConnectionOptions<
|
|
|
669
669
|
>;
|
|
670
670
|
query?: QueryForRelatedConnection<Types, NodeTable, ConnectionArgs>;
|
|
671
671
|
// biome-ignore lint/suspicious/noExplicitAny: this is fine
|
|
672
|
-
type?: Type & DrizzleRef<any, Table['relations'][Field]['
|
|
672
|
+
type?: Type & DrizzleRef<any, Table['relations'][Field]['targetTableName']>;
|
|
673
673
|
|
|
674
674
|
defaultSize?: number | ((args: ConnectionArgs, ctx: Types['Context']) => number);
|
|
675
675
|
maxSize?: number | ((args: ConnectionArgs, ctx: Types['Context']) => number);
|