@vantreeseba/drizzle-graphql 5.2.0 → 5.4.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
@@ -233,6 +233,17 @@ type UpdateArgs<TTable extends Table> = Partial<{
233
233
  set: GetRemappedTableUpdateDataType<TTable>;
234
234
  where?: Filters<TTable>;
235
235
  }>;
236
+ /**
237
+ * One entry of an `update<Table>Many` mutation: the rows `where` matches get this
238
+ * entry's `set` applied. An omitted `where` matches every row, same as `update<Table>`.
239
+ */
240
+ type UpdateManyEntry<TTable extends Table> = {
241
+ where?: Filters<TTable>;
242
+ set: GetRemappedTableUpdateDataType<TTable>;
243
+ };
244
+ type UpdateManyArgs<TTable extends Table> = {
245
+ updates: Array<UpdateManyEntry<TTable>>;
246
+ };
236
247
  /**
237
248
  * The `onConflict` argument of the generated upsert mutations.
238
249
  *
@@ -272,6 +283,13 @@ type InsertResolver<TTable extends Table, IsReturnless extends boolean> = (sourc
272
283
  /** Resolver for `create<Table>`: an array of rows in, an array of rows out. */
273
284
  type InsertArrResolver<TTable extends Table, IsReturnless extends boolean> = (source: any, args: Partial<InsertArgs<TTable, false>>, context: any, info: GraphQLResolveInfo) => Promise<IsReturnless extends false ? Array<GetRemappedTableDataType<TTable>> : MutationReturnlessResult>;
274
285
  type UpdateResolver<TTable extends Table, IsReturnless extends boolean> = (source: any, args: UpdateArgs<TTable>, context: any, info: GraphQLResolveInfo) => Promise<IsReturnless extends false ? GetRemappedTableDataType<TTable> | undefined : MutationReturnlessResult>;
286
+ /**
287
+ * Resolver for `update<Table>Many`: per-entry `set`/`where` pairs applied in input order
288
+ * inside one transaction. Where the dialect returns rows, the result holds each entry's
289
+ * updated rows in entry order, with `null` standing in for an entry whose `where`
290
+ * matched no rows.
291
+ */
292
+ type UpdateManyResolver<TTable extends Table, IsReturnless extends boolean> = (source: any, args: UpdateManyArgs<TTable>, context: any, info: GraphQLResolveInfo) => Promise<IsReturnless extends false ? Array<GetRemappedTableDataType<TTable> | null> : MutationReturnlessResult>;
275
293
  /**
276
294
  * Resolver for `update<Table>Single`: `where` required, the single (nullable) affected row
277
295
  * out. Throws before writing anything when `where` matches more than one row.
@@ -403,6 +421,16 @@ type MutationsCore<TSchemaTables extends Record<string, Table>, TInputs extends
403
421
  };
404
422
  resolve: UpdateResolver<TSchemaTables[TName], IsReturnless>;
405
423
  } : never;
424
+ } & {
425
+ [TName in keyof TSchemaTables as TName extends string ? `update${Capitalize<TName>}Many` : never]: TName extends string ? {
426
+ type: IsReturnless extends true ? TOutputs['MutationReturn'] extends GraphQLObjectType ? TOutputs['MutationReturn'] : never : GraphQLNonNull<GraphQLList<TOutputs[`${Capitalize<TName>}Item`]>>;
427
+ args: {
428
+ updates: {
429
+ type: GraphQLNonNull<GraphQLList<GraphQLNonNull<TInputs[`${Capitalize<TName>}UpdateManyInput`]>>>;
430
+ };
431
+ };
432
+ resolve: UpdateManyResolver<TSchemaTables[TName], IsReturnless>;
433
+ } : never;
406
434
  } & {
407
435
  [TName in keyof TSchemaTables as TName extends string ? `update${Capitalize<TName>}Single` : never]: TName extends string ? {
408
436
  type: IsReturnless extends true ? TOutputs['MutationReturn'] extends GraphQLObjectType ? TOutputs['MutationReturn'] : never : TOutputs[`${Capitalize<TName>}Item`];
@@ -441,6 +469,8 @@ type GeneratedInputs<TSchema extends Record<string, Table>> = {
441
469
  [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}InsertInput` : never]: GraphQLInputObjectType;
442
470
  } & {
443
471
  [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}UpdateInput` : never]: GraphQLInputObjectType;
472
+ } & {
473
+ [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}UpdateManyInput` : never]: GraphQLInputObjectType;
444
474
  } & {
445
475
  [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}OrderBy` : never]: GraphQLInputObjectType;
446
476
  } & {
@@ -496,6 +526,14 @@ type SchemaFeatures = {
496
526
  insert?: boolean;
497
527
  /** `update<Table>` / `update<Table>Single` mutations. @default true */
498
528
  update?: boolean;
529
+ /**
530
+ * `update<Table>Many` mutations — batch update with a per-entry `set` and `where`,
531
+ * executed inside one transaction. Only generated when `update` is also enabled,
532
+ * since the entries reuse the update `set` input.
533
+ *
534
+ * @default true
535
+ */
536
+ updateMany?: boolean;
499
537
  /** `delete<Table>` / `delete<Table>Single` mutations. @default true */
500
538
  delete?: boolean;
501
539
  /**
@@ -745,4 +783,4 @@ declare const GraphQLDecimalString: GraphQLScalarType<string, string>;
745
783
 
746
784
  declare const buildSchema: <TDbClient extends AnyDrizzleDB<any>>(db: TDbClient, config?: BuildSchemaConfig) => GeneratedData<TDbClient>;
747
785
 
748
- export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationResolverFactory, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableNamedRelations, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
786
+ export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationResolverFactory, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableNamedRelations, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
package/dist/index.d.ts CHANGED
@@ -233,6 +233,17 @@ type UpdateArgs<TTable extends Table> = Partial<{
233
233
  set: GetRemappedTableUpdateDataType<TTable>;
234
234
  where?: Filters<TTable>;
235
235
  }>;
236
+ /**
237
+ * One entry of an `update<Table>Many` mutation: the rows `where` matches get this
238
+ * entry's `set` applied. An omitted `where` matches every row, same as `update<Table>`.
239
+ */
240
+ type UpdateManyEntry<TTable extends Table> = {
241
+ where?: Filters<TTable>;
242
+ set: GetRemappedTableUpdateDataType<TTable>;
243
+ };
244
+ type UpdateManyArgs<TTable extends Table> = {
245
+ updates: Array<UpdateManyEntry<TTable>>;
246
+ };
236
247
  /**
237
248
  * The `onConflict` argument of the generated upsert mutations.
238
249
  *
@@ -272,6 +283,13 @@ type InsertResolver<TTable extends Table, IsReturnless extends boolean> = (sourc
272
283
  /** Resolver for `create<Table>`: an array of rows in, an array of rows out. */
273
284
  type InsertArrResolver<TTable extends Table, IsReturnless extends boolean> = (source: any, args: Partial<InsertArgs<TTable, false>>, context: any, info: GraphQLResolveInfo) => Promise<IsReturnless extends false ? Array<GetRemappedTableDataType<TTable>> : MutationReturnlessResult>;
274
285
  type UpdateResolver<TTable extends Table, IsReturnless extends boolean> = (source: any, args: UpdateArgs<TTable>, context: any, info: GraphQLResolveInfo) => Promise<IsReturnless extends false ? GetRemappedTableDataType<TTable> | undefined : MutationReturnlessResult>;
286
+ /**
287
+ * Resolver for `update<Table>Many`: per-entry `set`/`where` pairs applied in input order
288
+ * inside one transaction. Where the dialect returns rows, the result holds each entry's
289
+ * updated rows in entry order, with `null` standing in for an entry whose `where`
290
+ * matched no rows.
291
+ */
292
+ type UpdateManyResolver<TTable extends Table, IsReturnless extends boolean> = (source: any, args: UpdateManyArgs<TTable>, context: any, info: GraphQLResolveInfo) => Promise<IsReturnless extends false ? Array<GetRemappedTableDataType<TTable> | null> : MutationReturnlessResult>;
275
293
  /**
276
294
  * Resolver for `update<Table>Single`: `where` required, the single (nullable) affected row
277
295
  * out. Throws before writing anything when `where` matches more than one row.
@@ -403,6 +421,16 @@ type MutationsCore<TSchemaTables extends Record<string, Table>, TInputs extends
403
421
  };
404
422
  resolve: UpdateResolver<TSchemaTables[TName], IsReturnless>;
405
423
  } : never;
424
+ } & {
425
+ [TName in keyof TSchemaTables as TName extends string ? `update${Capitalize<TName>}Many` : never]: TName extends string ? {
426
+ type: IsReturnless extends true ? TOutputs['MutationReturn'] extends GraphQLObjectType ? TOutputs['MutationReturn'] : never : GraphQLNonNull<GraphQLList<TOutputs[`${Capitalize<TName>}Item`]>>;
427
+ args: {
428
+ updates: {
429
+ type: GraphQLNonNull<GraphQLList<GraphQLNonNull<TInputs[`${Capitalize<TName>}UpdateManyInput`]>>>;
430
+ };
431
+ };
432
+ resolve: UpdateManyResolver<TSchemaTables[TName], IsReturnless>;
433
+ } : never;
406
434
  } & {
407
435
  [TName in keyof TSchemaTables as TName extends string ? `update${Capitalize<TName>}Single` : never]: TName extends string ? {
408
436
  type: IsReturnless extends true ? TOutputs['MutationReturn'] extends GraphQLObjectType ? TOutputs['MutationReturn'] : never : TOutputs[`${Capitalize<TName>}Item`];
@@ -441,6 +469,8 @@ type GeneratedInputs<TSchema extends Record<string, Table>> = {
441
469
  [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}InsertInput` : never]: GraphQLInputObjectType;
442
470
  } & {
443
471
  [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}UpdateInput` : never]: GraphQLInputObjectType;
472
+ } & {
473
+ [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}UpdateManyInput` : never]: GraphQLInputObjectType;
444
474
  } & {
445
475
  [TName in keyof TSchema as TName extends string ? `${Capitalize<TName>}OrderBy` : never]: GraphQLInputObjectType;
446
476
  } & {
@@ -496,6 +526,14 @@ type SchemaFeatures = {
496
526
  insert?: boolean;
497
527
  /** `update<Table>` / `update<Table>Single` mutations. @default true */
498
528
  update?: boolean;
529
+ /**
530
+ * `update<Table>Many` mutations — batch update with a per-entry `set` and `where`,
531
+ * executed inside one transaction. Only generated when `update` is also enabled,
532
+ * since the entries reuse the update `set` input.
533
+ *
534
+ * @default true
535
+ */
536
+ updateMany?: boolean;
499
537
  /** `delete<Table>` / `delete<Table>Single` mutations. @default true */
500
538
  delete?: boolean;
501
539
  /**
@@ -745,4 +783,4 @@ declare const GraphQLDecimalString: GraphQLScalarType<string, string>;
745
783
 
746
784
  declare const buildSchema: <TDbClient extends AnyDrizzleDB<any>>(db: TDbClient, config?: BuildSchemaConfig) => GeneratedData<TDbClient>;
747
785
 
748
- export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationResolverFactory, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableNamedRelations, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };
786
+ export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ComplexityConfig, type DeleteResolver, type DeleteSingleResolver, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, GraphQLBigIntString, GraphQLDecimalString, type InsertArrResolver, type InsertResolver, type MutationReturnlessResult, type MutationsCore, type QueriesCore, type RelationResolverFactory, type SchemaFeatures, type SelectResolver, type SelectSingleResolver, type TableNamedRelations, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleExecutorKey, extractFilters, extractOrderBy, extractRelationJoinColumns };