@vantreeseba/drizzle-graphql 14.0.0 → 15.1.0
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/README.md +196 -75
- package/dist/index.cjs +541 -156
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.js +541 -156
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ import "drizzle-orm/pg-core/query-builders/query";
|
|
|
6
6
|
import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
|
|
7
7
|
import "drizzle-orm/sqlite-core/query-builders/query";
|
|
8
8
|
import { ASTNode, GraphQLEnumType, GraphQLError, GraphQLFieldResolver, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema } from "graphql";
|
|
9
|
-
import {
|
|
9
|
+
import { GraphQLDateTime, GraphQLJSON, GraphQLUUID } from "graphql-scalars";
|
|
10
10
|
//#region src/util/type-naming.d.ts
|
|
11
11
|
/** A word the rules decline to decide. Widens the keys derived from it rather than guessing. */
|
|
12
12
|
type Unresolved = string;
|
|
@@ -458,7 +458,9 @@ type DrizzleErrorCode =
|
|
|
458
458
|
/** A stored value could not be represented by the scalar that transports it. */
|
|
459
459
|
'DRIZZLE_UNREPRESENTABLE_VALUE' |
|
|
460
460
|
/** The request's shared mutation transaction was rolled back, so this field never ran. */
|
|
461
|
-
'DRIZZLE_TRANSACTION_ABORTED'
|
|
461
|
+
'DRIZZLE_TRANSACTION_ABORTED' |
|
|
462
|
+
/** A relation was read on a path it cannot be loaded through (see the message). */
|
|
463
|
+
'DRIZZLE_UNSUPPORTED_RELATION';
|
|
462
464
|
/**
|
|
463
465
|
* What an error was about, published as `extensions.drizzle` beside the code — the runtime
|
|
464
466
|
* half of the `extensions.drizzle` markers a generated field carries.
|
|
@@ -607,8 +609,11 @@ type ColumnDescriber = (column: Column, info: ColumnDocInfo) => string | undefin
|
|
|
607
609
|
* `BuildSchemaConfig.deprecateColumn`.
|
|
608
610
|
*/
|
|
609
611
|
type ColumnDeprecator = (column: Column, info: ColumnDocInfo) => string | undefined;
|
|
610
|
-
/**
|
|
611
|
-
|
|
612
|
+
/**
|
|
613
|
+
* Supplies the GraphQL `description` for a table's object type. Receives the Drizzle table
|
|
614
|
+
* itself as well as its schema key. See `BuildSchemaConfig.describeTable`.
|
|
615
|
+
*/
|
|
616
|
+
type TableDescriber = (tableName: string, table: Table) => string | undefined;
|
|
612
617
|
/**
|
|
613
618
|
* Supplies the GraphQL `description` for a relation field. See
|
|
614
619
|
* `BuildSchemaConfig.describeRelation`.
|
|
@@ -2444,6 +2449,17 @@ type BuildSchemaConfig = {
|
|
|
2444
2449
|
* ```ts
|
|
2445
2450
|
* buildSchema(db, { describeTable: (tableName) => tableDocs[tableName] });
|
|
2446
2451
|
* ```
|
|
2452
|
+
*
|
|
2453
|
+
* The second argument is the Drizzle table itself, so documentation attached to the table
|
|
2454
|
+
* where it is declared can be read straight off it:
|
|
2455
|
+
*
|
|
2456
|
+
* ```ts
|
|
2457
|
+
* const tableDocs = new WeakMap<object, string>();
|
|
2458
|
+
* export const Users = pgTable('users', { ... });
|
|
2459
|
+
* tableDocs.set(Users, 'A person who can sign in.');
|
|
2460
|
+
*
|
|
2461
|
+
* buildSchema(db, { describeTable: (_tableName, table) => tableDocs.get(table) });
|
|
2462
|
+
* ```
|
|
2447
2463
|
*/
|
|
2448
2464
|
describeTable?: TableDescriber;
|
|
2449
2465
|
/**
|
|
@@ -2570,6 +2586,18 @@ declare const GraphQLBigIntString: GraphQLScalarType<string, string>;
|
|
|
2570
2586
|
* non-numeric strings (including 'NaN' and 'Infinity').
|
|
2571
2587
|
*/
|
|
2572
2588
|
declare const GraphQLDecimalString: GraphQLScalarType<string, string>;
|
|
2589
|
+
/**
|
|
2590
|
+
* A calendar day — `date` columns, whichever `mode` drizzle reads them in. Always transported
|
|
2591
|
+
* as an RFC 3339 `full-date` string (`YYYY-MM-DD`), in both directions: it has no time and no
|
|
2592
|
+
* offset, so there is nothing for a client's timezone to shift. `graphql-scalars`' own
|
|
2593
|
+
* `GraphQLDate` is deliberately not used: its `parseValue` returns a JS `Date`, so the same
|
|
2594
|
+
* scalar would be a string on the way out and an instant on the way in.
|
|
2595
|
+
*
|
|
2596
|
+
* Input accepts only a `YYYY-MM-DD` string naming a real day (`2026-02-30` and datetime
|
|
2597
|
+
* strings are rejected) and hands it on unchanged. Output also accepts a JS `Date`, read as
|
|
2598
|
+
* the UTC day it encodes.
|
|
2599
|
+
*/
|
|
2600
|
+
declare const GraphQLDate: GraphQLScalarType<string, string>;
|
|
2573
2601
|
//#endregion
|
|
2574
2602
|
//#region src/util/selection.d.ts
|
|
2575
2603
|
/** Options shared by {@link selectionToWith} and {@link resolveSelection}. */
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { MySqlAsyncDatabase } from "drizzle-orm/mysql-core";
|
|
|
3
3
|
import { PgAsyncDatabase } from "drizzle-orm/pg-core";
|
|
4
4
|
import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
|
|
5
5
|
import { ASTNode, GraphQLEnumType, GraphQLError, GraphQLFieldResolver, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema } from "graphql";
|
|
6
|
-
import {
|
|
6
|
+
import { GraphQLDateTime, GraphQLJSON, GraphQLUUID } from "graphql-scalars";
|
|
7
7
|
import "drizzle-orm/mysql-core/query-builders/query";
|
|
8
8
|
import "drizzle-orm/pg-core/query-builders/query";
|
|
9
9
|
import "drizzle-orm/sqlite-core/query-builders/query";
|
|
@@ -458,7 +458,9 @@ type DrizzleErrorCode =
|
|
|
458
458
|
/** A stored value could not be represented by the scalar that transports it. */
|
|
459
459
|
'DRIZZLE_UNREPRESENTABLE_VALUE' |
|
|
460
460
|
/** The request's shared mutation transaction was rolled back, so this field never ran. */
|
|
461
|
-
'DRIZZLE_TRANSACTION_ABORTED'
|
|
461
|
+
'DRIZZLE_TRANSACTION_ABORTED' |
|
|
462
|
+
/** A relation was read on a path it cannot be loaded through (see the message). */
|
|
463
|
+
'DRIZZLE_UNSUPPORTED_RELATION';
|
|
462
464
|
/**
|
|
463
465
|
* What an error was about, published as `extensions.drizzle` beside the code — the runtime
|
|
464
466
|
* half of the `extensions.drizzle` markers a generated field carries.
|
|
@@ -607,8 +609,11 @@ type ColumnDescriber = (column: Column, info: ColumnDocInfo) => string | undefin
|
|
|
607
609
|
* `BuildSchemaConfig.deprecateColumn`.
|
|
608
610
|
*/
|
|
609
611
|
type ColumnDeprecator = (column: Column, info: ColumnDocInfo) => string | undefined;
|
|
610
|
-
/**
|
|
611
|
-
|
|
612
|
+
/**
|
|
613
|
+
* Supplies the GraphQL `description` for a table's object type. Receives the Drizzle table
|
|
614
|
+
* itself as well as its schema key. See `BuildSchemaConfig.describeTable`.
|
|
615
|
+
*/
|
|
616
|
+
type TableDescriber = (tableName: string, table: Table) => string | undefined;
|
|
612
617
|
/**
|
|
613
618
|
* Supplies the GraphQL `description` for a relation field. See
|
|
614
619
|
* `BuildSchemaConfig.describeRelation`.
|
|
@@ -2444,6 +2449,17 @@ type BuildSchemaConfig = {
|
|
|
2444
2449
|
* ```ts
|
|
2445
2450
|
* buildSchema(db, { describeTable: (tableName) => tableDocs[tableName] });
|
|
2446
2451
|
* ```
|
|
2452
|
+
*
|
|
2453
|
+
* The second argument is the Drizzle table itself, so documentation attached to the table
|
|
2454
|
+
* where it is declared can be read straight off it:
|
|
2455
|
+
*
|
|
2456
|
+
* ```ts
|
|
2457
|
+
* const tableDocs = new WeakMap<object, string>();
|
|
2458
|
+
* export const Users = pgTable('users', { ... });
|
|
2459
|
+
* tableDocs.set(Users, 'A person who can sign in.');
|
|
2460
|
+
*
|
|
2461
|
+
* buildSchema(db, { describeTable: (_tableName, table) => tableDocs.get(table) });
|
|
2462
|
+
* ```
|
|
2447
2463
|
*/
|
|
2448
2464
|
describeTable?: TableDescriber;
|
|
2449
2465
|
/**
|
|
@@ -2570,6 +2586,18 @@ declare const GraphQLBigIntString: GraphQLScalarType<string, string>;
|
|
|
2570
2586
|
* non-numeric strings (including 'NaN' and 'Infinity').
|
|
2571
2587
|
*/
|
|
2572
2588
|
declare const GraphQLDecimalString: GraphQLScalarType<string, string>;
|
|
2589
|
+
/**
|
|
2590
|
+
* A calendar day — `date` columns, whichever `mode` drizzle reads them in. Always transported
|
|
2591
|
+
* as an RFC 3339 `full-date` string (`YYYY-MM-DD`), in both directions: it has no time and no
|
|
2592
|
+
* offset, so there is nothing for a client's timezone to shift. `graphql-scalars`' own
|
|
2593
|
+
* `GraphQLDate` is deliberately not used: its `parseValue` returns a JS `Date`, so the same
|
|
2594
|
+
* scalar would be a string on the way out and an instant on the way in.
|
|
2595
|
+
*
|
|
2596
|
+
* Input accepts only a `YYYY-MM-DD` string naming a real day (`2026-02-30` and datetime
|
|
2597
|
+
* strings are rejected) and hands it on unchanged. Output also accepts a JS `Date`, read as
|
|
2598
|
+
* the UTC day it encodes.
|
|
2599
|
+
*/
|
|
2600
|
+
declare const GraphQLDate: GraphQLScalarType<string, string>;
|
|
2573
2601
|
//#endregion
|
|
2574
2602
|
//#region src/util/selection.d.ts
|
|
2575
2603
|
/** Options shared by {@link selectionToWith} and {@link resolveSelection}. */
|