@vantreeseba/drizzle-graphql 5.4.0 → 5.5.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
@@ -693,6 +693,40 @@ type BuildSchemaConfig = {
693
693
  * queries are always generated, so `Query` is never empty.
694
694
  */
695
695
  features?: SchemaFeatures;
696
+ /**
697
+ * Automatic transactions for GraphQL documents that fire more than one mutation.
698
+ *
699
+ * `'none'` (default) — every root mutation field runs on its own connection, so a failure
700
+ * mid-document leaves the earlier mutations committed (today's behavior).
701
+ *
702
+ * `'auto'` — when a request's document selects more than one root mutation field, the
703
+ * library opens `db.transaction()` once for the whole request and runs every mutation
704
+ * field (and the reads nested under them) inside it. The transaction commits when the
705
+ * last mutation field completes and rolls back when any of them fails; mutation fields
706
+ * after a failure are not executed against the rolled-back transaction — they fail fast.
707
+ * The object form additionally sets the safety timeout (default 30000ms) after which an
708
+ * abandoned transaction — e.g. the host server stopped calling resolvers because of a
709
+ * non-null completion error — is rolled back instead of leaking a connection.
710
+ *
711
+ * Never nests: a caller-supplied executor on the GraphQL context under
712
+ * `drizzleExecutorKey` always wins, and the library opens nothing of its own.
713
+ *
714
+ * Requirements and caveats:
715
+ * - The driver must support `db.transaction()` (e.g. `neon-http` does not). For SQLite
716
+ * only asynchronous drivers (libsql, better-sqlite3 is synchronous) can hold a
717
+ * transaction open across resolvers; `buildSchema` throws for synchronous ones.
718
+ * - The GraphQL context value must be a fresh object per request (every mainstream
719
+ * server does this) — it keys the per-request transaction state.
720
+ * - Documents that mix in mutation fields not generated by this build (consumer
721
+ * extensions) are left alone: their completion cannot be tracked, so no transaction
722
+ * is opened.
723
+ *
724
+ * @default 'none'
725
+ */
726
+ transactions?: 'auto' | 'none' | {
727
+ mode: 'auto';
728
+ timeoutMs?: number;
729
+ };
696
730
  /**
697
731
  * Optional mapper from table key to singular/plural name pair.
698
732
  * When provided for a table, overrides the default (table key) naming for GraphQL type names,
package/dist/index.d.ts CHANGED
@@ -693,6 +693,40 @@ type BuildSchemaConfig = {
693
693
  * queries are always generated, so `Query` is never empty.
694
694
  */
695
695
  features?: SchemaFeatures;
696
+ /**
697
+ * Automatic transactions for GraphQL documents that fire more than one mutation.
698
+ *
699
+ * `'none'` (default) — every root mutation field runs on its own connection, so a failure
700
+ * mid-document leaves the earlier mutations committed (today's behavior).
701
+ *
702
+ * `'auto'` — when a request's document selects more than one root mutation field, the
703
+ * library opens `db.transaction()` once for the whole request and runs every mutation
704
+ * field (and the reads nested under them) inside it. The transaction commits when the
705
+ * last mutation field completes and rolls back when any of them fails; mutation fields
706
+ * after a failure are not executed against the rolled-back transaction — they fail fast.
707
+ * The object form additionally sets the safety timeout (default 30000ms) after which an
708
+ * abandoned transaction — e.g. the host server stopped calling resolvers because of a
709
+ * non-null completion error — is rolled back instead of leaking a connection.
710
+ *
711
+ * Never nests: a caller-supplied executor on the GraphQL context under
712
+ * `drizzleExecutorKey` always wins, and the library opens nothing of its own.
713
+ *
714
+ * Requirements and caveats:
715
+ * - The driver must support `db.transaction()` (e.g. `neon-http` does not). For SQLite
716
+ * only asynchronous drivers (libsql, better-sqlite3 is synchronous) can hold a
717
+ * transaction open across resolvers; `buildSchema` throws for synchronous ones.
718
+ * - The GraphQL context value must be a fresh object per request (every mainstream
719
+ * server does this) — it keys the per-request transaction state.
720
+ * - Documents that mix in mutation fields not generated by this build (consumer
721
+ * extensions) are left alone: their completion cannot be tracked, so no transaction
722
+ * is opened.
723
+ *
724
+ * @default 'none'
725
+ */
726
+ transactions?: 'auto' | 'none' | {
727
+ mode: 'auto';
728
+ timeoutMs?: number;
729
+ };
696
730
  /**
697
731
  * Optional mapper from table key to singular/plural name pair.
698
732
  * When provided for a table, overrides the default (table key) naming for GraphQL type names,