-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[drizzle] improve node ids and fix query being required
- Loading branch information
Showing
11 changed files
with
173 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pothos/plugin-drizzle": minor | ||
--- | ||
|
||
Fix query being required, and improve node IDs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
import type { SchemaTypes } from '@pothos/core'; | ||
import { DrizzleObjectRef } from './object-ref'; | ||
|
||
export const relayIDShapeKey = Symbol.for('Pothos.relayIDShapeKey'); | ||
|
||
export class DrizzleNodeRef< | ||
Types extends SchemaTypes, | ||
Table extends keyof Types['DrizzleRelationSchema'] = keyof Types['DrizzleRelationSchema'], | ||
T = {}, | ||
> extends DrizzleObjectRef<Types, Table, T> {} | ||
IDShape = string, | ||
> extends DrizzleObjectRef<Types, Table, T> { | ||
[relayIDShapeKey]!: IDShape; | ||
parseId: ((id: string, ctx: object) => IDShape) | undefined; | ||
|
||
constructor( | ||
name: string, | ||
tableName: string, | ||
options: { | ||
parseId?: (id: string, ctx: object) => IDShape; | ||
}, | ||
) { | ||
super(name, tableName); | ||
this.parseId = options.parseId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters