kitcn 0.13.5 → 0.13.7

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.
@@ -1,4 +1,4 @@
1
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-DcEhkJ12.js";
1
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-Dv-3mnJF.js";
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Infer, Value } from "convex/values";
4
4
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -1,2 +1,2 @@
1
- import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-C_-KWRfT.js";
1
+ import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-xOmfTKh8.js";
2
2
  export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
@@ -1,7 +1,7 @@
1
1
  import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-CNo9ffvI.js";
2
2
  import { t as GetAuth } from "../types-BCl8gfGy.js";
3
3
  import { t as GenericCtx } from "../context-utils-OMkMGhBk.js";
4
- import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-C_-KWRfT.js";
4
+ import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-xOmfTKh8.js";
5
5
  import * as convex_values0 from "convex/values";
6
6
  import { Infer } from "convex/values";
7
7
  import { AuthConfig, DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
@@ -107,27 +107,27 @@ type AdapterPaginationOptions = PaginationOptions & {
107
107
  };
108
108
  declare const adapterWhereValidator: convex_values0.VObject<{
109
109
  mode?: "sensitive" | "insensitive" | undefined;
110
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
110
111
  connector?: "AND" | "OR" | undefined;
111
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
112
112
  value: string | number | boolean | string[] | number[] | null;
113
113
  field: string;
114
114
  }, {
115
115
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
116
116
  field: convex_values0.VString<string, "required">;
117
117
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
118
- operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
118
+ operator: convex_values0.VUnion<"eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
119
119
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
120
- }, "required", "mode" | "value" | "connector" | "field" | "operator">;
120
+ }, "required", "mode" | "operator" | "value" | "field" | "connector">;
121
121
  declare const adapterArgsValidator: convex_values0.VObject<{
122
- select?: string[] | undefined;
122
+ limit?: number | undefined;
123
123
  where?: {
124
124
  mode?: "sensitive" | "insensitive" | undefined;
125
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
125
126
  connector?: "AND" | "OR" | undefined;
126
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
127
127
  value: string | number | boolean | string[] | number[] | null;
128
128
  field: string;
129
129
  }[] | undefined;
130
- limit?: number | undefined;
130
+ select?: string[] | undefined;
131
131
  offset?: number | undefined;
132
132
  sortBy?: {
133
133
  field: string;
@@ -148,24 +148,24 @@ declare const adapterArgsValidator: convex_values0.VObject<{
148
148
  }, "optional", "field" | "direction">;
149
149
  where: convex_values0.VArray<{
150
150
  mode?: "sensitive" | "insensitive" | undefined;
151
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
151
152
  connector?: "AND" | "OR" | undefined;
152
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
153
153
  value: string | number | boolean | string[] | number[] | null;
154
154
  field: string;
155
155
  }[] | undefined, convex_values0.VObject<{
156
156
  mode?: "sensitive" | "insensitive" | undefined;
157
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
157
158
  connector?: "AND" | "OR" | undefined;
158
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
159
159
  value: string | number | boolean | string[] | number[] | null;
160
160
  field: string;
161
161
  }, {
162
162
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
163
163
  field: convex_values0.VString<string, "required">;
164
164
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
165
- operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
165
+ operator: convex_values0.VUnion<"eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
166
166
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
167
- }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
168
- }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
167
+ }, "required", "mode" | "operator" | "value" | "field" | "connector">, "optional">;
168
+ }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
169
169
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
170
170
  declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
171
171
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -319,6 +319,34 @@ const resolveSchemaTableName = (schema, betterAuthSchema, model) => {
319
319
  if (schema.tables[value.modelName]) return value.modelName;
320
320
  }
321
321
  };
322
+ const AUTH_TIMESTAMP_FIELDS = ["createdAt", "updatedAt"];
323
+ const resolveBetterAuthModel = (betterAuthSchema, model) => {
324
+ if (betterAuthSchema?.[model]) return betterAuthSchema[model];
325
+ return Object.values(betterAuthSchema ?? {}).find((value) => value?.modelName === model);
326
+ };
327
+ const resolveWriteFields = (schema, betterAuthSchema, model) => {
328
+ const tableName = resolveSchemaTableName(schema, betterAuthSchema, model);
329
+ const validatorFields = tableName ? schema.tables[tableName]?.validator?.fields : void 0;
330
+ if (validatorFields) return new Set(Object.keys(validatorFields));
331
+ const modelFields = resolveBetterAuthModel(betterAuthSchema, model)?.fields;
332
+ if (!modelFields) return;
333
+ const fields = /* @__PURE__ */ new Set();
334
+ for (const [field, config] of Object.entries(modelFields)) {
335
+ fields.add(field);
336
+ if (typeof config?.fieldName === "string") fields.add(config.fieldName);
337
+ }
338
+ return fields;
339
+ };
340
+ const stripUnsupportedAuthTimestamps = (data, schema, betterAuthSchema, model) => {
341
+ const writeFields = resolveWriteFields(schema, betterAuthSchema, model);
342
+ if (!writeFields) return data;
343
+ let result;
344
+ for (const field of AUTH_TIMESTAMP_FIELDS) if (field in data && !writeFields.has(field)) {
345
+ result ??= { ...data };
346
+ delete result[field];
347
+ }
348
+ return result ?? data;
349
+ };
322
350
  const resolveOrmTable = (ctx, schema, betterAuthSchema, model) => {
323
351
  if (!ctx?.orm || typeof ctx.orm.insert !== "function" || typeof ctx.orm.update !== "function" || typeof ctx.orm.delete !== "function") return;
324
352
  const tableName = resolveSchemaTableName(schema, betterAuthSchema, model);
@@ -418,19 +446,23 @@ const serializeDatesForConvex = (value) => {
418
446
  return serialized ?? value;
419
447
  };
420
448
  const toConvexSafe = (value) => serializeDatesForConvex(value);
421
- const withAuthTimestamps = (data) => {
422
- if (data.createdAt !== void 0) return data;
449
+ const withAuthTimestamps = (data, schema, betterAuthSchema, model) => {
450
+ const writeFields = resolveWriteFields(schema, betterAuthSchema, model);
451
+ if (data.createdAt !== void 0) return stripUnsupportedAuthTimestamps(data, schema, betterAuthSchema, model);
452
+ const supportsCreatedAt = !writeFields || writeFields.has("createdAt");
453
+ const supportsUpdatedAt = !writeFields || writeFields.has("updatedAt");
454
+ if (!(supportsCreatedAt || supportsUpdatedAt)) return data;
423
455
  const now = Date.now();
424
- return {
456
+ return stripUnsupportedAuthTimestamps({
425
457
  ...data,
426
- createdAt: now,
427
- ...data.updatedAt === void 0 ? { updatedAt: now } : {}
428
- };
458
+ ...supportsCreatedAt ? { createdAt: now } : {},
459
+ ...supportsUpdatedAt && data.updatedAt === void 0 ? { updatedAt: now } : {}
460
+ }, schema, betterAuthSchema, model);
429
461
  };
430
462
  const createHandler = async (ctx, args, schema, betterAuthSchema) => {
431
463
  const triggerCtx = args.triggerCtx ?? ctx;
432
464
  const tableTriggers = args.tableTriggers;
433
- const data = serializeDatesForConvex(withAuthTimestamps(await applyBeforeHook(args.input.model, "create", args.input.data, tableTriggers?.create?.before, triggerCtx)));
465
+ const data = serializeDatesForConvex(withAuthTimestamps(await applyBeforeHook(args.input.model, "create", args.input.data, tableTriggers?.create?.before, triggerCtx), schema, betterAuthSchema, args.input.model));
434
466
  await checkUniqueFields(ctx, schema, betterAuthSchema, args.input.model, data);
435
467
  const ormTable = resolveOrmTable(ctx, schema, betterAuthSchema, args.input.model);
436
468
  const doc = ormTable ? await ormInsert(ctx, ormTable.table, data) : await (async () => {
@@ -459,7 +491,7 @@ const updateOneHandler = async (ctx, args, schema, betterAuthSchema) => {
459
491
  const doc = await listOne(ctx, schema, betterAuthSchema, args.input);
460
492
  if (!doc) throw new Error(`Failed to update ${args.input.model}`);
461
493
  const normalizedDoc = withBothIdFields(doc);
462
- const update = serializeDatesForConvex(await applyBeforeHook(args.input.model, "update", args.input.update, tableTriggers?.update?.before, triggerCtx));
494
+ const update = stripUnsupportedAuthTimestamps(serializeDatesForConvex(await applyBeforeHook(args.input.model, "update", args.input.update, tableTriggers?.update?.before, triggerCtx)), schema, betterAuthSchema, args.input.model);
463
495
  await checkUniqueFields(ctx, schema, betterAuthSchema, args.input.model, update, normalizedDoc);
464
496
  const ormTable = resolveOrmTable(ctx, schema, betterAuthSchema, args.input.model);
465
497
  const updatedDoc = ormTable ? await ormUpdate(ctx, ormTable.table, normalizedDoc._id, update) : await (async () => {
@@ -492,7 +524,7 @@ const updateManyHandler = async (ctx, args, schema, betterAuthSchema) => {
492
524
  if (hasUniqueFields(betterAuthSchema, args.input.model, args.input.update ?? {}) && page.length > 1) throw new Error(`Attempted to set unique fields in multiple documents in ${args.input.model} with the same value. Fields: ${Object.keys(args.input.update ?? {}).join(", ")}`);
493
525
  await asyncMap(page, async (doc) => {
494
526
  const normalizedDoc = withBothIdFields(doc);
495
- const update = serializeDatesForConvex(await applyBeforeHook(args.input.model, "update", args.input.update ?? {}, tableTriggers?.update?.before, triggerCtx));
527
+ const update = stripUnsupportedAuthTimestamps(serializeDatesForConvex(await applyBeforeHook(args.input.model, "update", args.input.update ?? {}, tableTriggers?.update?.before, triggerCtx)), schema, betterAuthSchema, args.input.model);
496
528
  await checkUniqueFields(ctx, schema, betterAuthSchema, args.input.model, update ?? {}, normalizedDoc);
497
529
  const hookNewDoc = serializeDatesForConvex(withBothIdFields(ormTable ? await ormUpdate(ctx, ormTable.table, normalizedDoc._id, update ?? {}) : await (async () => {
498
530
  await ctx.db.patch(normalizedDoc._id, update);
@@ -173,10 +173,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
173
173
  };
174
174
  }, Promise<any>>;
175
175
  deleteMany: convex_server0.RegisteredMutation<"internal", {
176
+ paginationOpts: {
177
+ id?: number;
178
+ endCursor?: string | null;
179
+ maximumRowsRead?: number;
180
+ maximumBytesRead?: number;
181
+ numItems: number;
182
+ cursor: string | null;
183
+ };
176
184
  input: {
177
185
  where?: {
186
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
178
187
  connector?: "AND" | "OR" | undefined;
179
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
180
188
  value: string | number | boolean | string[] | number[] | null;
181
189
  field: string;
182
190
  }[] | undefined;
@@ -185,14 +193,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
185
193
  where?: any[] | undefined;
186
194
  model: string;
187
195
  };
188
- paginationOpts: {
189
- id?: number;
190
- endCursor?: string | null;
191
- maximumRowsRead?: number;
192
- maximumBytesRead?: number;
193
- numItems: number;
194
- cursor: string | null;
195
- };
196
196
  }, Promise<{
197
197
  count: number;
198
198
  ids: any[];
@@ -204,8 +204,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
204
204
  deleteOne: convex_server0.RegisteredMutation<"internal", {
205
205
  input: {
206
206
  where?: {
207
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
207
208
  connector?: "AND" | "OR" | undefined;
208
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
209
209
  value: string | number | boolean | string[] | number[] | null;
210
210
  field: string;
211
211
  }[] | undefined;
@@ -216,21 +216,20 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
216
216
  };
217
217
  }, Promise<Record<string, unknown> | undefined>>;
218
218
  findMany: convex_server0.RegisteredQuery<"internal", {
219
+ limit?: number | undefined;
219
220
  join?: any;
220
221
  where?: {
221
222
  mode?: "sensitive" | "insensitive" | undefined;
223
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
222
224
  connector?: "AND" | "OR" | undefined;
223
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
224
225
  value: string | number | boolean | string[] | number[] | null;
225
226
  field: string;
226
227
  }[] | undefined;
227
- limit?: number | undefined;
228
228
  offset?: number | undefined;
229
229
  sortBy?: {
230
230
  field: string;
231
231
  direction: "asc" | "desc";
232
232
  } | undefined;
233
- model: string;
234
233
  paginationOpts: {
235
234
  id?: number;
236
235
  endCursor?: string | null;
@@ -239,47 +238,48 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
239
238
  numItems: number;
240
239
  cursor: string | null;
241
240
  };
241
+ model: string;
242
242
  }, Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>>;
243
243
  findOne: convex_server0.RegisteredQuery<"internal", {
244
244
  join?: any;
245
- select?: string[] | undefined;
246
245
  where?: {
247
246
  mode?: "sensitive" | "insensitive" | undefined;
247
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
248
248
  connector?: "AND" | "OR" | undefined;
249
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
250
249
  value: string | number | boolean | string[] | number[] | null;
251
250
  field: string;
252
251
  }[] | undefined;
252
+ select?: string[] | undefined;
253
253
  model: string;
254
254
  }, Promise<convex_server0.GenericDocument | null>>;
255
255
  getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
256
256
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
257
257
  updateMany: convex_server0.RegisteredMutation<"internal", {
258
+ paginationOpts: {
259
+ id?: number;
260
+ endCursor?: string | null;
261
+ maximumRowsRead?: number;
262
+ maximumBytesRead?: number;
263
+ numItems: number;
264
+ cursor: string | null;
265
+ };
258
266
  input: {
259
267
  where?: {
268
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
260
269
  connector?: "AND" | "OR" | undefined;
261
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
262
270
  value: string | number | boolean | string[] | number[] | null;
263
271
  field: string;
264
272
  }[] | undefined;
265
- model: string;
266
273
  update: {
267
274
  [x: string]: unknown;
268
275
  [x: number]: unknown;
269
276
  [x: symbol]: unknown;
270
277
  };
278
+ model: string;
271
279
  } | {
272
280
  where?: any[] | undefined;
273
- model: string;
274
281
  update: any;
275
- };
276
- paginationOpts: {
277
- id?: number;
278
- endCursor?: string | null;
279
- maximumRowsRead?: number;
280
- maximumBytesRead?: number;
281
- numItems: number;
282
- cursor: string | null;
282
+ model: string;
283
283
  };
284
284
  }, Promise<{
285
285
  count: number;
@@ -292,21 +292,21 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
292
292
  updateOne: convex_server0.RegisteredMutation<"internal", {
293
293
  input: {
294
294
  where?: {
295
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
295
296
  connector?: "AND" | "OR" | undefined;
296
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
297
297
  value: string | number | boolean | string[] | number[] | null;
298
298
  field: string;
299
299
  }[] | undefined;
300
- model: string;
301
300
  update: {
302
301
  [x: string]: unknown;
303
302
  [x: number]: unknown;
304
303
  [x: symbol]: unknown;
305
304
  };
305
+ model: string;
306
306
  } | {
307
307
  where?: any[] | undefined;
308
- model: string;
309
308
  update: any;
309
+ model: string;
310
310
  };
311
311
  }, Promise<any>>;
312
312
  };
@@ -1,4 +1,4 @@
1
- import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-DcEhkJ12.js";
1
+ import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-Dv-3mnJF.js";
2
2
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-BhsByJeg.js";
3
3
  import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-CNo9ffvI.js";
4
4
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
@@ -5,9 +5,9 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, use
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { getFunctionName } from "convex/server";
7
7
  import { notifyManager, skipToken, useQueries, useQueryClient } from "@tanstack/react-query";
8
- import { ConvexHttpClient } from "convex/browser";
9
8
  import { hashKey } from "@tanstack/query-core";
10
9
  import { convexToJson } from "convex/values";
10
+ import { ConvexHttpClient } from "convex/browser";
11
11
 
12
12
  //#region src/shared/meta-utils.ts
13
13
  const metaCache = /* @__PURE__ */ new WeakMap();
@@ -723,6 +723,57 @@ function useAuthSkip(funcRef, opts) {
723
723
  };
724
724
  }
725
725
 
726
+ //#endregion
727
+ //#region src/internal/query-key.ts
728
+ /**
729
+ * Shared query key utilities for Convex + TanStack Query.
730
+ * This file has NO React dependencies so it can be imported in both
731
+ * server (RSC) and client contexts.
732
+ */
733
+ /**
734
+ * Check if query key is for a Convex query function.
735
+ * Format: ['convexQuery', 'namespace:functionName', { args }]
736
+ */
737
+ function isConvexQuery(queryKey) {
738
+ return queryKey.length >= 2 && queryKey[0] === "convexQuery";
739
+ }
740
+ /**
741
+ * Check if query key is for a Convex action function.
742
+ * Format: ['convexAction', 'namespace:functionName', { args }]
743
+ */
744
+ function isConvexAction$1(queryKey) {
745
+ return queryKey.length >= 2 && queryKey[0] === "convexAction";
746
+ }
747
+ /**
748
+ * Create stable hash for Convex query keys.
749
+ * Uses Convex's JSON serialization for consistent argument hashing.
750
+ */
751
+ function hashConvexQuery(queryKey) {
752
+ const [, funcName, args] = queryKey;
753
+ return `convexQuery|${funcName}|${JSON.stringify(convexToJson(args))}`;
754
+ }
755
+ /**
756
+ * Create stable hash for Convex action keys.
757
+ * Uses Convex's JSON serialization for consistent argument hashing.
758
+ */
759
+ function hashConvexAction(queryKey) {
760
+ const [, funcName, args] = queryKey;
761
+ return `convexAction|${funcName}|${JSON.stringify(convexToJson(args))}`;
762
+ }
763
+
764
+ //#endregion
765
+ //#region src/internal/hash.ts
766
+ /**
767
+ * Create a hash function for TanStack Query that handles Convex keys.
768
+ */
769
+ function createHashFn(fallback = hashKey) {
770
+ return (queryKey) => {
771
+ if (isConvexQuery(queryKey)) return hashConvexQuery(queryKey);
772
+ if (isConvexAction$1(queryKey)) return hashConvexAction(queryKey);
773
+ return fallback(queryKey);
774
+ };
775
+ }
776
+
726
777
  //#endregion
727
778
  //#region src/react/use-query-options.ts
728
779
  /** biome-ignore-all lint/suspicious/noExplicitAny: Convex type compatibility */
@@ -730,6 +781,37 @@ function useAuthSkip(funcRef, opts) {
730
781
  * Query options factories for Convex functions.
731
782
  * Forked from @convex-dev/react-query to support auth-aware error handling.
732
783
  */
784
+ const EMPTY_ARGS = {};
785
+ const hashConvexOptionsKey = createHashFn();
786
+ const MAX_STABLE_ARGS = 500;
787
+ const stableArgsByHash = /* @__PURE__ */ new Map();
788
+ function getStableArgsByHash(hash, args) {
789
+ if (stableArgsByHash.has(hash)) {
790
+ const stableArgs = stableArgsByHash.get(hash);
791
+ stableArgsByHash.delete(hash);
792
+ stableArgsByHash.set(hash, stableArgs);
793
+ return stableArgs;
794
+ }
795
+ stableArgsByHash.set(hash, args);
796
+ if (stableArgsByHash.size > MAX_STABLE_ARGS) {
797
+ const oldestHash = stableArgsByHash.keys().next().value;
798
+ if (oldestHash !== void 0) stableArgsByHash.delete(oldestHash);
799
+ }
800
+ return args;
801
+ }
802
+ function useStableQueryArgs(prefix, funcRef, args) {
803
+ const resolvedArgs = args === skipToken || args == null ? EMPTY_ARGS : args;
804
+ const argsHash = hashConvexOptionsKey([
805
+ prefix,
806
+ getFunctionName(funcRef),
807
+ resolvedArgs
808
+ ]);
809
+ const value = useMemo(() => getStableArgsByHash(argsHash, resolvedArgs), [argsHash, resolvedArgs]);
810
+ return useMemo(() => ({
811
+ hash: argsHash,
812
+ value
813
+ }), [argsHash, value]);
814
+ }
733
815
  /**
734
816
  * Hook that returns query options for use with useQuery.
735
817
  * Handles skipUnauth by setting enabled: false when unauthorized.
@@ -761,18 +843,27 @@ function useConvexQueryOptions(funcRef, args, options) {
761
843
  enabled: isSkipped ? false : enabled,
762
844
  skipUnauth: options?.skipUnauth
763
845
  });
764
- const baseOptions = convexQuery(funcRef, isSkipped ? {} : args);
765
- const { skipUnauth: _, subscribe, ...queryOptions } = options ?? {};
766
- return {
767
- ...baseOptions,
768
- ...queryOptions,
769
- enabled: isSkipped ? false : !shouldSkip,
770
- meta: {
771
- ...baseOptions.meta,
772
- authType,
773
- subscribe: subscribe !== false
774
- }
775
- };
846
+ const stableArgs = useStableQueryArgs("convexQuery", funcRef, isSkipped ? EMPTY_ARGS : args);
847
+ const baseOptions = useMemo(() => convexQuery(funcRef, stableArgs.value), [funcRef, stableArgs]);
848
+ return useMemo(() => {
849
+ const { skipUnauth: _, subscribe, ...queryOptions } = options ?? {};
850
+ return {
851
+ ...baseOptions,
852
+ ...queryOptions,
853
+ enabled: isSkipped ? false : !shouldSkip,
854
+ meta: {
855
+ ...baseOptions.meta,
856
+ authType,
857
+ subscribe: subscribe !== false
858
+ }
859
+ };
860
+ }, [
861
+ authType,
862
+ baseOptions,
863
+ isSkipped,
864
+ options,
865
+ shouldSkip
866
+ ]);
776
867
  }
777
868
  /**
778
869
  * Hook that returns infinite query options for use with useInfiniteQuery.
@@ -846,13 +937,21 @@ function useConvexActionQueryOptions(action, args, options) {
846
937
  enabled: isSkipped ? false : enabled,
847
938
  skipUnauth: options?.skipUnauth
848
939
  });
849
- const baseOptions = convexAction(action, isSkipped ? {} : args);
850
- const { skipUnauth: _, ...queryOptions } = options ?? {};
851
- return {
852
- ...baseOptions,
853
- ...queryOptions,
854
- enabled: isSkipped ? false : !shouldSkip
855
- };
940
+ const stableArgs = useStableQueryArgs("convexAction", action, isSkipped ? EMPTY_ARGS : args);
941
+ const baseOptions = useMemo(() => convexAction(action, stableArgs.value), [action, stableArgs]);
942
+ return useMemo(() => {
943
+ const { skipUnauth: _, ...queryOptions } = options ?? {};
944
+ return {
945
+ ...baseOptions,
946
+ ...queryOptions,
947
+ enabled: isSkipped ? false : !shouldSkip
948
+ };
949
+ }, [
950
+ baseOptions,
951
+ isSkipped,
952
+ options,
953
+ shouldSkip
954
+ ]);
856
955
  }
857
956
  /**
858
957
  * Hook that returns mutation options for use with useMutation.
@@ -1511,57 +1610,6 @@ function createAuthMutations(authClient) {
1511
1610
  };
1512
1611
  }
1513
1612
 
1514
- //#endregion
1515
- //#region src/internal/query-key.ts
1516
- /**
1517
- * Shared query key utilities for Convex + TanStack Query.
1518
- * This file has NO React dependencies so it can be imported in both
1519
- * server (RSC) and client contexts.
1520
- */
1521
- /**
1522
- * Check if query key is for a Convex query function.
1523
- * Format: ['convexQuery', 'namespace:functionName', { args }]
1524
- */
1525
- function isConvexQuery(queryKey) {
1526
- return queryKey.length >= 2 && queryKey[0] === "convexQuery";
1527
- }
1528
- /**
1529
- * Check if query key is for a Convex action function.
1530
- * Format: ['convexAction', 'namespace:functionName', { args }]
1531
- */
1532
- function isConvexAction$1(queryKey) {
1533
- return queryKey.length >= 2 && queryKey[0] === "convexAction";
1534
- }
1535
- /**
1536
- * Create stable hash for Convex query keys.
1537
- * Uses Convex's JSON serialization for consistent argument hashing.
1538
- */
1539
- function hashConvexQuery(queryKey) {
1540
- const [, funcName, args] = queryKey;
1541
- return `convexQuery|${funcName}|${JSON.stringify(convexToJson(args))}`;
1542
- }
1543
- /**
1544
- * Create stable hash for Convex action keys.
1545
- * Uses Convex's JSON serialization for consistent argument hashing.
1546
- */
1547
- function hashConvexAction(queryKey) {
1548
- const [, funcName, args] = queryKey;
1549
- return `convexAction|${funcName}|${JSON.stringify(convexToJson(args))}`;
1550
- }
1551
-
1552
- //#endregion
1553
- //#region src/internal/hash.ts
1554
- /**
1555
- * Create a hash function for TanStack Query that handles Convex keys.
1556
- */
1557
- function createHashFn(fallback = hashKey) {
1558
- return (queryKey) => {
1559
- if (isConvexQuery(queryKey)) return hashConvexQuery(queryKey);
1560
- if (isConvexAction$1(queryKey)) return hashConvexAction(queryKey);
1561
- return fallback(queryKey);
1562
- };
1563
- }
1564
-
1565
1613
  //#endregion
1566
1614
  //#region src/react/client.ts
1567
1615
  /**
@@ -3992,11 +3992,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3992
3992
  readonly aggregate_extrema: ConvexTableWithColumns<{
3993
3993
  name: "aggregate_extrema";
3994
3994
  columns: {
3995
- value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
3996
- _: {
3997
- $type: convex_values0.Value;
3998
- };
3999
- } & {
3995
+ count: ConvexNumberBuilderInitial<""> & {
4000
3996
  _: {
4001
3997
  notNull: true;
4002
3998
  };
@@ -4006,10 +4002,14 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4006
4002
  };
4007
4003
  } & {
4008
4004
  _: {
4009
- fieldName: "value";
4005
+ fieldName: "count";
4010
4006
  };
4011
4007
  };
4012
- count: ConvexNumberBuilderInitial<""> & {
4008
+ value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
4009
+ _: {
4010
+ $type: convex_values0.Value;
4011
+ };
4012
+ } & {
4013
4013
  _: {
4014
4014
  notNull: true;
4015
4015
  };
@@ -4019,7 +4019,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4019
4019
  };
4020
4020
  } & {
4021
4021
  _: {
4022
- fieldName: "count";
4022
+ fieldName: "value";
4023
4023
  };
4024
4024
  };
4025
4025
  updatedAt: ConvexNumberBuilderInitial<""> & {
@@ -4411,22 +4411,22 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4411
4411
  fieldName: "status";
4412
4412
  };
4413
4413
  };
4414
- cursor: ConvexTextBuilderInitial<""> & {
4414
+ direction: ConvexTextBuilderInitial<""> & {
4415
4415
  _: {
4416
4416
  tableName: "migration_state";
4417
4417
  };
4418
4418
  } & {
4419
4419
  _: {
4420
- fieldName: "cursor";
4420
+ fieldName: "direction";
4421
4421
  };
4422
4422
  };
4423
- direction: ConvexTextBuilderInitial<""> & {
4423
+ cursor: ConvexTextBuilderInitial<""> & {
4424
4424
  _: {
4425
4425
  tableName: "migration_state";
4426
4426
  };
4427
4427
  } & {
4428
4428
  _: {
4429
- fieldName: "direction";
4429
+ fieldName: "cursor";
4430
4430
  };
4431
4431
  };
4432
4432
  updatedAt: ConvexNumberBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.13.5",
3
+ "version": "0.13.7",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",