@vantreeseba/drizzle-graphql 15.1.5 → 16.0.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/dist/index.d.cts CHANGED
@@ -1213,7 +1213,8 @@ type UpdateManyArgs<TTable extends Table> = {
1213
1213
  * predicate, so neither field is generated there.
1214
1214
  *
1215
1215
  * `target` may name a partial unique index; its predicate is repeated in the statement's
1216
- * `ON CONFLICT (…) WHERE …`, which is what lets the database match it.
1216
+ * `ON CONFLICT (…) WHERE …`, which is what lets the database match it. On SQLite its values
1217
+ * are written inline, since SQLite matches the predicate to the index as written.
1217
1218
  */
1218
1219
  type UpsertConflictArgs<TTable extends Table> = {
1219
1220
  action?: 'UPDATE' | 'NOTHING';
@@ -1554,9 +1555,14 @@ type SchemaFeatures = {
1554
1555
  * is a `contextValues` column is not offered at all.
1555
1556
  *
1556
1557
  * A relation's own `where` limits the rows its writes reach the same way, and takes its
1557
- * `create` away. A relation joining on more than one column per side is not offered. A
1558
- * to-one `connect` must match exactly one row. When the parent write produces no row, a
1559
- * parent-side `create` made for it is rolled back.
1558
+ * `create` away: on a to-one whose key is on the parent, `disconnect` leaves a key pointing
1559
+ * at a row it hides and a `connect` that would replace one fails. A `where` inherited from
1560
+ * the reverse relation filters the parent, and a write through it on a parent row it hides
1561
+ * the relation for (judged after the write) fails. A relation joining on more than one
1562
+ * column per side is not offered. A to-one `connect` must match exactly one row. When the
1563
+ * parent write produces no row, a parent-side `create` made for it is rolled back, and an
1564
+ * upsert whose conflict branch does not write the join column a parent-side operation set
1565
+ * fails rather than leave its target unattached.
1560
1566
  *
1561
1567
  * PostgreSQL and SQLite only. MySQL cannot return the rows it just wrote, which is how a
1562
1568
  * nested write learns the parent's key, so `buildSchema` rejects the flag there. On SQLite
@@ -1627,6 +1633,10 @@ type SchemaFeatures = {
1627
1633
  * rejects a `where` that collapses to no filters (e.g. `where: {}`), so a schema can rule
1628
1634
  * out unbounded writes at the type level. Off by default for backwards compatibility.
1629
1635
  *
1636
+ * It covers `update<Table>Many` too: an entry with no `where`, or one that collapses to no
1637
+ * filters, rejects the whole batch with `DRIZZLE_WHERE_REQUIRED` before any entry runs. The
1638
+ * entry input's `where` stays nullable in the schema; the check runs at request time.
1639
+ *
1630
1640
  * The `Single` variants (`update<Table>Single` / `delete<Table>Single`) require a
1631
1641
  * non-empty `where` regardless of this flag.
1632
1642
  *
@@ -1991,7 +2001,15 @@ type BuildSchemaConfig = {
1991
2001
  * after a failure are not executed against the rolled-back transaction — they fail fast.
1992
2002
  * The object form additionally sets the safety timeout (default 30000ms) after which an
1993
2003
  * abandoned transaction — e.g. the host server stopped calling resolvers because of a
1994
- * non-null completion error — is rolled back instead of leaking a connection.
2004
+ * non-null completion error — is rolled back instead of leaking a connection. It must be a
2005
+ * positive integer no greater than 2147483647 (the longest delay `setTimeout` honours), or
2006
+ * `Infinity` to turn the timer off; `buildSchema` throws for anything else. With the timer off
2007
+ * an abandoned transaction holds its connection until the process ends, so prefer a finite
2008
+ * value. A later field that finds the transaction rolled back by the timeout fails with
2009
+ * `DRIZZLE_TRANSACTION_ABORTED` and a message naming the timeout.
2010
+ *
2011
+ * A root field whose arguments fail to coerce (its resolver never runs) is not waited for:
2012
+ * the transaction commits once the fields that do run have completed.
1995
2013
  *
1996
2014
  * Never nests: a caller-supplied executor on the GraphQL context under
1997
2015
  * `drizzleExecutorKey` always wins, and the library opens nothing of its own.
@@ -2188,8 +2206,9 @@ type BuildSchemaConfig = {
2188
2206
  * - A marked row still occupies its unique keys, so inserting a row that reuses the natural
2189
2207
  * key of a deleted one still fails on the constraint.
2190
2208
  * - An upsert whose conflict target hits a marked row updates nothing on PostgreSQL and
2191
- * SQLite (the conflict predicate excludes it) but revives it on MySQL, whose
2192
- * `ON DUPLICATE KEY UPDATE` takes no predicate.
2209
+ * SQLite (the conflict predicate excludes it). On MySQL, whose `ON DUPLICATE KEY UPDATE`
2210
+ * takes no predicate, it overwrites the marked row's columns but leaves the marker set,
2211
+ * so the row stays deleted; `restore<Table>` brings it back.
2193
2212
  *
2194
2213
  * Marking a parent deleted does not mark its children — a cascade is a schema decision.
2195
2214
  */
@@ -2223,6 +2242,9 @@ type BuildSchemaConfig = {
2223
2242
  * `drizzleExecutorKey`, the request's auto-transaction, or, for a field that would
2224
2243
  * otherwise have run unwrapped, a transaction opened for it because the hook is there.
2225
2244
  * - **Throwing rolls the mutation back.** That is the point of the position.
2245
+ * - **SQLite needs an asynchronous driver** (libsql, D1). A synchronous one (better-sqlite3,
2246
+ * `node:sqlite`) commits before an awaited hook runs, so `buildSchema` throws for `onWrite`
2247
+ * on one rather than let a throwing hook leave its write behind.
2226
2248
  * - **`rows` are the post-write rows as the database returned them**, before the output
2227
2249
  * mapper. Empty at the `before` position, and on MySQL, whose mutations return no rows.
2228
2250
  * - **A row holds the columns the client selected**, because `RETURNING` is built from the
package/dist/index.d.ts CHANGED
@@ -1213,7 +1213,8 @@ type UpdateManyArgs<TTable extends Table> = {
1213
1213
  * predicate, so neither field is generated there.
1214
1214
  *
1215
1215
  * `target` may name a partial unique index; its predicate is repeated in the statement's
1216
- * `ON CONFLICT (…) WHERE …`, which is what lets the database match it.
1216
+ * `ON CONFLICT (…) WHERE …`, which is what lets the database match it. On SQLite its values
1217
+ * are written inline, since SQLite matches the predicate to the index as written.
1217
1218
  */
1218
1219
  type UpsertConflictArgs<TTable extends Table> = {
1219
1220
  action?: 'UPDATE' | 'NOTHING';
@@ -1554,9 +1555,14 @@ type SchemaFeatures = {
1554
1555
  * is a `contextValues` column is not offered at all.
1555
1556
  *
1556
1557
  * A relation's own `where` limits the rows its writes reach the same way, and takes its
1557
- * `create` away. A relation joining on more than one column per side is not offered. A
1558
- * to-one `connect` must match exactly one row. When the parent write produces no row, a
1559
- * parent-side `create` made for it is rolled back.
1558
+ * `create` away: on a to-one whose key is on the parent, `disconnect` leaves a key pointing
1559
+ * at a row it hides and a `connect` that would replace one fails. A `where` inherited from
1560
+ * the reverse relation filters the parent, and a write through it on a parent row it hides
1561
+ * the relation for (judged after the write) fails. A relation joining on more than one
1562
+ * column per side is not offered. A to-one `connect` must match exactly one row. When the
1563
+ * parent write produces no row, a parent-side `create` made for it is rolled back, and an
1564
+ * upsert whose conflict branch does not write the join column a parent-side operation set
1565
+ * fails rather than leave its target unattached.
1560
1566
  *
1561
1567
  * PostgreSQL and SQLite only. MySQL cannot return the rows it just wrote, which is how a
1562
1568
  * nested write learns the parent's key, so `buildSchema` rejects the flag there. On SQLite
@@ -1627,6 +1633,10 @@ type SchemaFeatures = {
1627
1633
  * rejects a `where` that collapses to no filters (e.g. `where: {}`), so a schema can rule
1628
1634
  * out unbounded writes at the type level. Off by default for backwards compatibility.
1629
1635
  *
1636
+ * It covers `update<Table>Many` too: an entry with no `where`, or one that collapses to no
1637
+ * filters, rejects the whole batch with `DRIZZLE_WHERE_REQUIRED` before any entry runs. The
1638
+ * entry input's `where` stays nullable in the schema; the check runs at request time.
1639
+ *
1630
1640
  * The `Single` variants (`update<Table>Single` / `delete<Table>Single`) require a
1631
1641
  * non-empty `where` regardless of this flag.
1632
1642
  *
@@ -1991,7 +2001,15 @@ type BuildSchemaConfig = {
1991
2001
  * after a failure are not executed against the rolled-back transaction — they fail fast.
1992
2002
  * The object form additionally sets the safety timeout (default 30000ms) after which an
1993
2003
  * abandoned transaction — e.g. the host server stopped calling resolvers because of a
1994
- * non-null completion error — is rolled back instead of leaking a connection.
2004
+ * non-null completion error — is rolled back instead of leaking a connection. It must be a
2005
+ * positive integer no greater than 2147483647 (the longest delay `setTimeout` honours), or
2006
+ * `Infinity` to turn the timer off; `buildSchema` throws for anything else. With the timer off
2007
+ * an abandoned transaction holds its connection until the process ends, so prefer a finite
2008
+ * value. A later field that finds the transaction rolled back by the timeout fails with
2009
+ * `DRIZZLE_TRANSACTION_ABORTED` and a message naming the timeout.
2010
+ *
2011
+ * A root field whose arguments fail to coerce (its resolver never runs) is not waited for:
2012
+ * the transaction commits once the fields that do run have completed.
1995
2013
  *
1996
2014
  * Never nests: a caller-supplied executor on the GraphQL context under
1997
2015
  * `drizzleExecutorKey` always wins, and the library opens nothing of its own.
@@ -2188,8 +2206,9 @@ type BuildSchemaConfig = {
2188
2206
  * - A marked row still occupies its unique keys, so inserting a row that reuses the natural
2189
2207
  * key of a deleted one still fails on the constraint.
2190
2208
  * - An upsert whose conflict target hits a marked row updates nothing on PostgreSQL and
2191
- * SQLite (the conflict predicate excludes it) but revives it on MySQL, whose
2192
- * `ON DUPLICATE KEY UPDATE` takes no predicate.
2209
+ * SQLite (the conflict predicate excludes it). On MySQL, whose `ON DUPLICATE KEY UPDATE`
2210
+ * takes no predicate, it overwrites the marked row's columns but leaves the marker set,
2211
+ * so the row stays deleted; `restore<Table>` brings it back.
2193
2212
  *
2194
2213
  * Marking a parent deleted does not mark its children — a cascade is a schema decision.
2195
2214
  */
@@ -2223,6 +2242,9 @@ type BuildSchemaConfig = {
2223
2242
  * `drizzleExecutorKey`, the request's auto-transaction, or, for a field that would
2224
2243
  * otherwise have run unwrapped, a transaction opened for it because the hook is there.
2225
2244
  * - **Throwing rolls the mutation back.** That is the point of the position.
2245
+ * - **SQLite needs an asynchronous driver** (libsql, D1). A synchronous one (better-sqlite3,
2246
+ * `node:sqlite`) commits before an awaited hook runs, so `buildSchema` throws for `onWrite`
2247
+ * on one rather than let a throwing hook leave its write behind.
2226
2248
  * - **`rows` are the post-write rows as the database returned them**, before the output
2227
2249
  * mapper. Empty at the `before` position, and on MySQL, whose mutations return no rows.
2228
2250
  * - **A row holds the columns the client selected**, because `RETURNING` is built from the