@pothos/plugin-drizzle 0.17.0 → 0.17.2
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/README.md +1 -1
- package/dts/types.d.ts +7 -7
- package/dts/types.d.ts.map +1 -1
- package/dts/utils/selections.d.ts.map +1 -1
- package/esm/connection-helpers.js +3 -4
- package/esm/connection-helpers.js.map +1 -1
- package/esm/drizzle-field-builder.js +4 -5
- package/esm/drizzle-field-builder.js.map +1 -1
- package/esm/schema-builder.js +5 -5
- package/esm/schema-builder.js.map +1 -1
- package/esm/types.d.ts +7 -7
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js.map +1 -1
- package/esm/utils/config.js +1 -1
- package/esm/utils/config.js.map +1 -1
- package/esm/utils/cursors.js +4 -5
- package/esm/utils/cursors.js.map +1 -1
- package/esm/utils/loader-map.js +1 -1
- package/esm/utils/loader-map.js.map +1 -1
- package/esm/utils/map-query.js +17 -19
- package/esm/utils/map-query.js.map +1 -1
- package/esm/utils/selections.d.ts.map +1 -1
- package/esm/utils/selections.js +4 -2
- package/esm/utils/selections.js.map +1 -1
- package/lib/connection-helpers.js +3 -4
- package/lib/connection-helpers.js.map +1 -1
- package/lib/drizzle-field-builder.js +4 -5
- package/lib/drizzle-field-builder.js.map +1 -1
- package/lib/schema-builder.js +5 -5
- package/lib/schema-builder.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/config.js.map +1 -1
- package/lib/utils/cursors.js +4 -5
- package/lib/utils/cursors.js.map +1 -1
- package/lib/utils/loader-map.js +1 -1
- package/lib/utils/loader-map.js.map +1 -1
- package/lib/utils/map-query.js +17 -19
- package/lib/utils/map-query.js.map +1 -1
- package/lib/utils/selections.js +4 -2
- package/lib/utils/selections.js.map +1 -1
- package/package.json +7 -7
- package/src/types.ts +32 -29
- package/src/utils/selections.ts +4 -2
package/src/types.ts
CHANGED
|
@@ -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);
|
|
@@ -694,28 +694,31 @@ export type DrizzleConnectionShape<
|
|
|
694
694
|
T,
|
|
695
695
|
Parent,
|
|
696
696
|
Args extends InputFieldMap,
|
|
697
|
-
> =
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
>
|
|
705
|
-
? [C] extends [
|
|
706
|
-
{
|
|
707
|
-
edges: infer Edges;
|
|
708
|
-
},
|
|
709
|
-
]
|
|
710
|
-
? Merge<
|
|
711
|
-
Omit<C, 'edges'> & {
|
|
712
|
-
edges: Edges extends Iterable<MaybePromise<infer Edge> | null | undefined>
|
|
713
|
-
? Merge<Edge & { connection: C }>[]
|
|
714
|
-
: never;
|
|
697
|
+
> =
|
|
698
|
+
Merge<
|
|
699
|
+
ShapeFromConnection<
|
|
700
|
+
PothosSchemaTypes.ConnectionShapeHelper<Types, T, false>
|
|
701
|
+
> extends infer Shape
|
|
702
|
+
? Shape & {
|
|
703
|
+
parent: Parent;
|
|
704
|
+
args: InputShapeFromFields<Args> & PothosSchemaTypes.DefaultConnectionArguments;
|
|
715
705
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
706
|
+
: never
|
|
707
|
+
> extends infer C
|
|
708
|
+
? [C] extends [
|
|
709
|
+
{
|
|
710
|
+
edges: infer Edges;
|
|
711
|
+
},
|
|
712
|
+
]
|
|
713
|
+
? Merge<
|
|
714
|
+
Omit<C, 'edges'> & {
|
|
715
|
+
edges: Edges extends Iterable<MaybePromise<infer Edge> | null | undefined>
|
|
716
|
+
? Merge<Edge & { connection: C }>[]
|
|
717
|
+
: never;
|
|
718
|
+
}
|
|
719
|
+
>
|
|
720
|
+
: C
|
|
721
|
+
: never;
|
|
719
722
|
|
|
720
723
|
export type WithBrand<T> = T & { [typeBrandKey]: string };
|
|
721
724
|
|
package/src/utils/selections.ts
CHANGED
|
@@ -149,8 +149,10 @@ export function mergeSelection(
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
if (columns && !state.allColumns) {
|
|
152
|
-
for (const key of Object.
|
|
153
|
-
|
|
152
|
+
for (const [key, value] of Object.entries(columns)) {
|
|
153
|
+
if (value) {
|
|
154
|
+
state.columns.add(key);
|
|
155
|
+
}
|
|
154
156
|
}
|
|
155
157
|
} else {
|
|
156
158
|
state.allColumns = true;
|