kitcn 0.27.0 → 0.27.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # kitcn
2
2
 
3
+ ## 0.27.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#397](https://github.com/udecode/kitcn/pull/397) [`c90f821`](https://github.com/udecode/kitcn/commit/c90f821e9d416303147b93cc3a1b14a5ccff1fed) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
8
+
9
+ - Fix organization permission checks returning a false "not a member" once an
10
+ organization grows past ~200 members. The generated auth schema now indexes
11
+ the composite lookups the organization plugin actually issues:
12
+ `member` by `organizationId` + `userId` and by `organizationId` + `role`,
13
+ `teamMember` by `teamId` + `userId`, `invitation` by
14
+ `organizationId` + `status` and by `email` + `organizationId` + `status`, and
15
+ `organizationRole` by `organizationId` + `role`. Every index that was emitted
16
+ before is still emitted, so this is additive — rerun
17
+ `npx kitcn add auth --schema --yes` to pick the new ones up.
18
+
19
+ - Fix `findOne` reporting "not found" when the scan budget ran out before
20
+ reaching a matching row. Single-document reads now page until they match a row
21
+ or exhaust the query, so an unindexed lookup is slow and warns rather than
22
+ silently wrong. Watch for `Querying without an index on table "..."` in your
23
+ logs and add the index it names.
24
+
25
+ ## 0.27.1
26
+
27
+ ### Patch Changes
28
+
29
+ - [#396](https://github.com/udecode/kitcn/pull/396) [`8fca5cc`](https://github.com/udecode/kitcn/commit/8fca5cc53c37bd6f651cfbfbf50b87d5461d0ce5) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
30
+
31
+ - Match every args variant from `crpc.<path>.queryFilter()` when `args` is
32
+ omitted, `null`, or `{}`, in both the React and Solid bindings. The filter
33
+ built a key with an empty args slot, which TanStack's partial matching never
34
+ matched, so `invalidateQueries` silently refreshed nothing and stale data
35
+ stayed on screen. Pass args to narrow the filter; omit them to reach every
36
+ variant. `crpc.http.*.queryFilter()` follows the same rule.
37
+
38
+ ```ts
39
+ // Before
40
+ crpc.analytics.getReport.queryFilter(); // ['convexQuery', 'analytics:getReport', undefined] — matched nothing
41
+ queryClient.invalidateQueries(crpc.analytics.getReport.queryFilter()); // no-op
42
+
43
+ // After
44
+ crpc.analytics.getReport.queryFilter(); // ['convexQuery', 'analytics:getReport']
45
+ queryClient.invalidateQueries(crpc.analytics.getReport.queryFilter()); // every args variant
46
+ ```
47
+
3
48
  ## 0.27.0
4
49
 
5
50
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-CLCYgRdY.js";
2
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-DAPEBp1y.js";
2
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-ChMQ575O.js";
3
3
  import * as convex_values0 from "convex/values";
4
4
  import { GenericId, Infer, Value } from "convex/values";
5
5
  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-DwYwySy3.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-BEc4d98x.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-DJONf8X5.js";
2
2
  import { t as GetAuth } from "../types-Bf3XQex5.js";
3
3
  import { t as GenericCtx } from "../context-utils-DwZ3Cam1.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-DwYwySy3.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-BEc4d98x.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";
@@ -123,7 +123,6 @@ declare const adapterWhereValidator: convex_values0.VObject<{
123
123
  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>;
124
124
  }, "required", "mode" | "value" | "connector" | "field" | "operator">;
125
125
  declare const adapterArgsValidator: convex_values0.VObject<{
126
- limit?: number | undefined;
127
126
  select?: string[] | undefined;
128
127
  where?: {
129
128
  mode?: "sensitive" | "insensitive" | undefined;
@@ -132,10 +131,11 @@ declare const adapterArgsValidator: convex_values0.VObject<{
132
131
  value: string | number | boolean | string[] | number[] | null;
133
132
  field: string;
134
133
  }[] | undefined;
134
+ limit?: number | undefined;
135
135
  offset?: number | undefined;
136
136
  sortBy?: {
137
- direction: "asc" | "desc";
138
137
  field: string;
138
+ direction: "asc" | "desc";
139
139
  } | undefined;
140
140
  model: string;
141
141
  }, {
@@ -144,12 +144,12 @@ declare const adapterArgsValidator: convex_values0.VObject<{
144
144
  offset: convex_values0.VFloat64<number | undefined, "optional">;
145
145
  select: convex_values0.VArray<string[] | undefined, convex_values0.VString<string, "required">, "optional">;
146
146
  sortBy: convex_values0.VObject<{
147
- direction: "asc" | "desc";
148
147
  field: string;
148
+ direction: "asc" | "desc";
149
149
  } | undefined, {
150
150
  direction: convex_values0.VUnion<"asc" | "desc", [convex_values0.VLiteral<"asc", "required">, convex_values0.VLiteral<"desc", "required">], "required", never>;
151
151
  field: convex_values0.VString<string, "required">;
152
- }, "optional", "direction" | "field">;
152
+ }, "optional", "field" | "direction">;
153
153
  where: convex_values0.VArray<{
154
154
  mode?: "sensitive" | "insensitive" | undefined;
155
155
  connector?: "AND" | "OR" | undefined;
@@ -169,7 +169,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
169
169
  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>;
170
170
  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>;
171
171
  }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
172
- }, "required", "limit" | "model" | "select" | "where" | "offset" | "sortBy" | "sortBy.direction" | "sortBy.field">;
172
+ }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
173
173
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
174
174
  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>;
175
175
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -298,13 +298,22 @@ const paginate = async (ctx, schema, betterAuthSchema, args) => {
298
298
  page: result.page.map((doc) => selectFields(doc, args.select))
299
299
  };
300
300
  };
301
- const listOne = async (ctx, schema, betterAuthSchema, args) => (await paginate(ctx, schema, betterAuthSchema, {
302
- ...args,
303
- paginationOpts: {
304
- cursor: null,
305
- numItems: 1
301
+ const listOne = async (ctx, schema, betterAuthSchema, args) => {
302
+ let cursor = null;
303
+ for (;;) {
304
+ const result = await paginate(ctx, schema, betterAuthSchema, {
305
+ ...args,
306
+ paginationOpts: {
307
+ cursor,
308
+ numItems: 1
309
+ }
310
+ });
311
+ if (result.page.length > 0) return result.page[0];
312
+ if (result.isDone) return null;
313
+ if (result.continueCursor === cursor) throw new Error(`Pagination made no forward progress reading one ${args.model}`);
314
+ cursor = result.continueCursor;
306
315
  }
307
- })).page[0];
316
+ };
308
317
 
309
318
  //#endregion
310
319
  //#region src/auth/create-api.ts
@@ -899,13 +908,13 @@ const ORM_SCHEMA_OPTIONS = Symbol.for("kitcn:OrmSchemaOptions");
899
908
  const hasOrmSchemaMetadata = (schema) => !!schema && typeof schema === "object" && ORM_SCHEMA_OPTIONS in schema;
900
909
  const createAuthSchema = async ({ file, schema, tables }) => {
901
910
  if (hasOrmSchemaMetadata(schema)) {
902
- const { createSchemaOrm } = await import("../create-schema-orm-Bu2JCiBS.js");
911
+ const { createSchemaOrm } = await import("../create-schema-orm-C3y6GLwQ.js");
903
912
  return createSchemaOrm({
904
913
  file,
905
914
  tables
906
915
  });
907
916
  }
908
- const { createSchema } = await import("../create-schema-BRFjdgRr.js");
917
+ const { createSchema } = await import("../create-schema-DqhLA_UF.js");
909
918
  return createSchema({
910
919
  file,
911
920
  tables
package/dist/cli.mjs CHANGED
@@ -5669,11 +5669,28 @@ const indexFields = {
5669
5669
  ["accountId", "providerId"],
5670
5670
  ["providerId", "userId"]
5671
5671
  ],
5672
+ invitation: [
5673
+ "email",
5674
+ [
5675
+ "email",
5676
+ "organizationId",
5677
+ "status"
5678
+ ],
5679
+ "organizationId",
5680
+ ["organizationId", "status"]
5681
+ ],
5682
+ member: [
5683
+ "organizationId",
5684
+ ["organizationId", "role"],
5685
+ ["organizationId", "userId"]
5686
+ ],
5672
5687
  oauthConsent: [["clientId", "userId"]],
5688
+ organizationRole: ["organizationId", ["organizationId", "role"]],
5673
5689
  passkey: ["credentialID"],
5674
5690
  ratelimit: ["key"],
5675
5691
  rateLimit: ["key"],
5676
5692
  session: ["expiresAt", ["expiresAt", "userId"]],
5693
+ teamMember: ["teamId", ["teamId", "userId"]],
5677
5694
  user: [["email", "name"], "name"],
5678
5695
  verification: ["expiresAt", "identifier"]
5679
5696
  };
@@ -5,11 +5,28 @@ const indexFields = {
5
5
  ["accountId", "providerId"],
6
6
  ["providerId", "userId"]
7
7
  ],
8
+ invitation: [
9
+ "email",
10
+ [
11
+ "email",
12
+ "organizationId",
13
+ "status"
14
+ ],
15
+ "organizationId",
16
+ ["organizationId", "status"]
17
+ ],
18
+ member: [
19
+ "organizationId",
20
+ ["organizationId", "role"],
21
+ ["organizationId", "userId"]
22
+ ],
8
23
  oauthConsent: [["clientId", "userId"]],
24
+ organizationRole: ["organizationId", ["organizationId", "role"]],
9
25
  passkey: ["credentialID"],
10
26
  ratelimit: ["key"],
11
27
  rateLimit: ["key"],
12
28
  session: ["expiresAt", ["expiresAt", "userId"]],
29
+ teamMember: ["teamId", ["teamId", "userId"]],
13
30
  user: [["email", "name"], "name"],
14
31
  verification: ["expiresAt", "identifier"]
15
32
  };
@@ -1,4 +1,4 @@
1
- import { augmentBetterAuthTables, indexFields } from "./create-schema-BRFjdgRr.js";
1
+ import { augmentBetterAuthTables, indexFields } from "./create-schema-DqhLA_UF.js";
2
2
 
3
3
  //#region src/auth/create-schema-orm.ts
4
4
  const specialFields = (tables) => Object.fromEntries(Object.entries(tables).map(([key, table]) => {
@@ -224,7 +224,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
224
224
  };
225
225
  }, Promise<Record<string, unknown> | undefined>>;
226
226
  findMany: convex_server0.RegisteredQuery<"internal", {
227
- limit?: number | undefined;
228
227
  join?: any;
229
228
  where?: {
230
229
  mode?: "sensitive" | "insensitive" | undefined;
@@ -233,10 +232,11 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
233
232
  value: string | number | boolean | string[] | number[] | null;
234
233
  field: string;
235
234
  }[] | undefined;
235
+ limit?: number | undefined;
236
236
  offset?: number | undefined;
237
237
  sortBy?: {
238
- direction: "asc" | "desc";
239
238
  field: string;
239
+ direction: "asc" | "desc";
240
240
  } | undefined;
241
241
  model: string;
242
242
  paginationOpts: {
@@ -1,5 +1,5 @@
1
1
  import { $n as BinaryExpression, $t as OrmLifecycleOperation, A as DatabaseWithMutations, An as ConvexCheckConfig, Ar as AnyColumn, At as VectorQueryConfig, B as RlsContext, Bn as ConvexTextBuilderInitial, Br as IsUnique, Bt as RelationsBuilderColumnConfig, C as MigrationTableName, Cn as aggregateIndex, Cr as notBetween, Ct as OrderDirection, D as defineMigrationSet, Dn as uniqueIndex, Dt as ReturningResult, E as defineMigration, En as searchIndex, Er as startsWith, Et as ReturningAll, Fn as ConvexUniqueConstraintConfig, Fr as ColumnBuilderWithTableName, Ft as ExtractTablesWithRelations, Gt as defineRelations, H as EdgeMetadata, In as check, Ir as ColumnDataType, It as ManyConfig, Jt as ConvexDeletionConfig, Kt as defineRelationsPart, Ln as foreignKey, Lr as DrizzleEntity, Lt as OneConfig, M as OrmReader$1, Mn as ConvexForeignKeyConfig, Mr as ColumnBuilderBaseConfig, Mt as unsetToken, N as OrmWriter$1, Nn as ConvexUniqueConstraintBuilder, Nr as ColumnBuilderRuntimeConfig, O as detectMigrationDrift, On as vectorIndex, Or as SystemFields, Ot as ReturningSelection, Pn as ConvexUniqueConstraintBuilderOn, Pr as ColumnBuilderTypeConfig, Pt as ExtractTablesFromSchema, Qn as TableName, Qt as OrmLifecycleChange, Rn as unique, Rr as HasDefault, Rt as RelationsBuilder, S as MigrationStep, Sn as ConvexVectorIndexConfig, Sr as not, St as OrderByClause, T as buildMigrationPlan, Tn as rankIndex, Tr as or, Tt as PredicateWhereIndexConfig, U as extractRelationsConfig, Un as Brand, Ut as TableRelationalConfig, V as RlsMode, Vn as text, Vr as NotNull, Wn as Columns, Wt as TablesRelationalConfig, Xn as OrmSchemaRelations, Xt as ConvexTableWithColumns, Yn as OrmSchemaExtensions, Yt as ConvexTable, Zn as OrmSchemaTriggers, Zt as DiscriminatorBuilderConfig, _ as MigrationMigrateOne, _n as ConvexSearchIndexBuilder, _r as isNull, _t as MutationPaginateConfig, an as RlsPolicyConfig, ar as and, at as CountConfig, b as MigrationSet, bn as ConvexVectorIndexBuilder, br as lte, bt as MutationReturning, cn as RlsRole, cr as endsWith, ct as FilterOperators, d as MigrationDefinition, dn as ConvexAggregateIndexBuilder, dr as gt, dt as InferModelFromColumns, en as TableConfig, er as ExpressionVisitor, et as AggregateConfig, f as MigrationDirection, fn as ConvexAggregateIndexBuilderOn, fr as gte, ft as InferSelectModel, g as MigrationManifestEntry, gn as ConvexRankIndexBuilderOn, gr as isNotNull, gt as MutationExecutionMode, h as MigrationDriftIssue, hn as ConvexRankIndexBuilder, hr as isFieldReference, ht as MutationExecuteResult, i as OrmMigrationCapability, in as RlsPolicy, ir as UnaryExpression, it as BuildRelationResult, j as DatabaseWithQuery, jn as ConvexForeignKeyBuilder, jr as ColumnBuilder, jt as VectorSearchProvider, kn as ConvexCheckBuilder, kt as UpdateSet, ln as RlsRoleConfig, lr as eq, lt as GetColumnData, m as MigrationDocContext, mn as ConvexIndexBuilderOn, mr as inArray, mt as MutationExecuteConfig, n as OrmCapabilities, nn as deletion, nr as FilterExpression, nt as AggregateResult, on as RlsPolicyToOption, or as between, ot as CountResult, p as MigrationDoc, pn as ConvexIndexBuilder, pr as ilike, pt as InsertValue, qn as OrmSchemaExtensionTables, qt as ConvexDeletionBuilder, r as OrmCapability, rn as discriminator, rr as LogicalExpression, rt as BuildQueryResult, sn as rlsPolicy, sr as contains, st as DBQueryConfig, t as OrmAggregateCapability, tn as convexTable, tr as FieldReference, tt as AggregateFieldValue, u as MigrationAppliedState, un as rlsRole, ur as fieldRef, ut as InferInsertModel, v as MigrationPlan, vn as ConvexSearchIndexBuilderOn, vr as like, vt as MutationPaginatedResult, w as MigrationWriteMode, wn as index, wr as notInArray, wt as PaginatedResult, x as MigrationStateMap, xn as ConvexVectorIndexBuilderOn, xr as ne, xt as MutationRunMode, y as MigrationRunStatus, yn as ConvexSearchIndexConfig, yr as lt, yt as MutationResult, zn as ConvexTextBuilder, zr as IsPrimaryKey, zt as RelationsBuilderColumnBase } from "../capabilities-CLCYgRdY.js";
2
- import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-DAPEBp1y.js";
2
+ import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-ChMQ575O.js";
3
3
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-wOIjhkfN.js";
4
4
  import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-DJONf8X5.js";
5
5
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
@@ -1,3 +1,3 @@
1
1
  import { C as MigrationTableName, D as defineMigrationSet, E as defineMigration, O as detectMigrationDrift, S as MigrationStep, T as buildMigrationPlan, _ as MigrationMigrateOne, a as MigrationCancelArgs, b as MigrationSet, c as MigrationStatusArgs, d as MigrationDefinition, f as MigrationDirection, g as MigrationManifestEntry, h as MigrationDriftIssue, l as createMigrationHandlers, m as MigrationDocContext, o as MigrationRunArgs, p as MigrationDoc, s as MigrationRunChunkArgs, u as MigrationAppliedState, v as MigrationPlan, w as MigrationWriteMode, x as MigrationStateMap, y as MigrationRunStatus } from "../../capabilities-CLCYgRdY.js";
2
- import { Ct as migrationCapability, dt as MIGRATION_STORAGE_TABLE_NAMES, ft as injectMigrationStorageTables, lt as MIGRATION_RUN_TABLE, mt as migrationStorageTables, pt as migrationExtension, ut as MIGRATION_STATE_TABLE } from "../../where-clause-compiler-DAPEBp1y.js";
2
+ import { Ct as migrationCapability, dt as MIGRATION_STORAGE_TABLE_NAMES, ft as injectMigrationStorageTables, lt as MIGRATION_RUN_TABLE, mt as migrationStorageTables, pt as migrationExtension, ut as MIGRATION_STATE_TABLE } from "../../where-clause-compiler-ChMQ575O.js";
3
3
  export { MIGRATION_RUN_TABLE, MIGRATION_STATE_TABLE, MIGRATION_STORAGE_TABLE_NAMES, type MigrationAppliedState, type MigrationCancelArgs, type MigrationDefinition, type MigrationDirection, type MigrationDoc, type MigrationDocContext, type MigrationDriftIssue, type MigrationManifestEntry, type MigrationMigrateOne, type MigrationPlan, type MigrationRunArgs, type MigrationRunChunkArgs, type MigrationRunStatus, type MigrationSet, type MigrationStateMap, type MigrationStatusArgs, type MigrationStep, type MigrationTableName, type MigrationWriteMode, buildMigrationPlan, createMigrationHandlers, defineMigration, defineMigrationSet, detectMigrationDrift, injectMigrationStorageTables, migrationCapability, migrationExtension, migrationStorageTables };
@@ -499,6 +499,38 @@ const getTransformer = (transformer) => {
499
499
  */
500
500
  const encodeWire = (value, transformer) => getTransformer(transformer).input.serialize(value);
501
501
 
502
+ //#endregion
503
+ //#region src/internal/query-filter.ts
504
+ /**
505
+ * Whether a `queryFilter` call actually narrowed by args.
506
+ *
507
+ * Nullish args and `{}` all mean "match every args variant". They have to
508
+ * collapse to a shorter prefix key rather than sit in the args slot, because
509
+ * TanStack matches filters with `partialMatchKey`, which walks
510
+ * `Object.keys(filterKey)` — an args slot holding `undefined` or `null` is
511
+ * compared against the real args and fails on every entry that carries any,
512
+ * so the filter silently matches nothing.
513
+ */
514
+ function hasQueryFilterArgs(args) {
515
+ if (args == null) return false;
516
+ if (typeof args === "object") return Object.keys(args).length > 0;
517
+ return true;
518
+ }
519
+ /**
520
+ * Build the key for a Convex `queryFilter`.
521
+ *
522
+ * With args, this is the exact 3-element key and TanStack partial-matches the
523
+ * args object. Without args, it stops before the args slot so the filter
524
+ * matches every variant of the function.
525
+ */
526
+ function buildConvexFilterKey(prefix, funcName, args) {
527
+ return hasQueryFilterArgs(args) ? [
528
+ prefix,
529
+ funcName,
530
+ args
531
+ ] : [prefix, funcName];
532
+ }
533
+
502
534
  //#endregion
503
535
  //#region src/react/http-proxy.ts
504
536
  /**
@@ -579,10 +611,9 @@ function createRecursiveHttpProxy(opts, path = []) {
579
611
  }
580
612
  if (prop === "queryKey") return (args) => buildHttpQueryKey(routeKey, args);
581
613
  if (prop === "queryFilter") return (args, filters) => {
582
- const hasArgs = args !== void 0 && !(typeof args === "object" && args !== null && Object.keys(args).length === 0);
583
614
  return {
584
615
  ...filters,
585
- queryKey: hasArgs ? buildHttpQueryKey(routeKey, args) : buildHttpQueryPrefixKey(routeKey)
616
+ queryKey: hasQueryFilterArgs(args) ? buildHttpQueryKey(routeKey, args) : buildHttpQueryPrefixKey(routeKey)
586
617
  };
587
618
  };
588
619
  if (prop === "mutationOptions") {
@@ -813,16 +844,21 @@ function resolveEnabled(allowed, enabled) {
813
844
  /**
814
845
  * Check if query key is for a Convex query function.
815
846
  * Format: ['convexQuery', 'namespace:functionName', { args }]
847
+ *
848
+ * Requires the args slot: a 2-element key is a `queryFilter` prefix, never a
849
+ * cache key, and hashing one would serialize `undefined` args and throw.
816
850
  */
817
851
  function isConvexQuery(queryKey) {
818
- return queryKey.length >= 2 && queryKey[0] === "convexQuery";
852
+ return queryKey.length >= 3 && queryKey[0] === "convexQuery";
819
853
  }
820
854
  /**
821
855
  * Check if query key is for a Convex action function.
822
856
  * Format: ['convexAction', 'namespace:functionName', { args }]
857
+ *
858
+ * Requires the args slot, for the same reason as {@link isConvexQuery}.
823
859
  */
824
- function isConvexAction$1(queryKey) {
825
- return queryKey.length >= 2 && queryKey[0] === "convexAction";
860
+ function isConvexAction(queryKey) {
861
+ return queryKey.length >= 3 && queryKey[0] === "convexAction";
826
862
  }
827
863
  /**
828
864
  * Serialize args the same way they go over the wire, so non-native Convex
@@ -856,7 +892,7 @@ function hashConvexAction(queryKey) {
856
892
  function createHashFn(fallback = hashKey) {
857
893
  return (queryKey) => {
858
894
  if (isConvexQuery(queryKey)) return hashConvexQuery(queryKey);
859
- if (isConvexAction$1(queryKey)) return hashConvexAction(queryKey);
895
+ if (isConvexAction(queryKey)) return hashConvexAction(queryKey);
860
896
  return fallback(queryKey);
861
897
  };
862
898
  }
@@ -1254,11 +1290,7 @@ function createRecursiveProxy(api, path, meta, transformer) {
1254
1290
  const prefix = getQueryKeyPrefix(path, meta);
1255
1291
  return {
1256
1292
  ...filters,
1257
- queryKey: [
1258
- prefix,
1259
- funcName,
1260
- args
1261
- ]
1293
+ queryKey: buildConvexFilterKey(prefix, funcName, args)
1262
1294
  };
1263
1295
  };
1264
1296
  if (prop === "infiniteQueryOptions") return (args = {}, opts = {}) => {
@@ -1906,13 +1938,6 @@ function isConvexSkipped(queryKey) {
1906
1938
  return queryKey.length >= 2 && ["convexQuery", "convexAction"].includes(queryKey[0]) && queryKey[2] === "skip";
1907
1939
  }
1908
1940
  /**
1909
- * Check if query key is for a Convex action function.
1910
- * Format: ['convexAction', 'namespace:functionName', { args }]
1911
- */
1912
- function isConvexAction(queryKey) {
1913
- return queryKey.length >= 2 && queryKey[0] === "convexAction";
1914
- }
1915
- /**
1916
1941
  * Write a subscription value into an already-resolved Query.
1917
1942
  *
1918
1943
  * Going through the Query skips the query-key re-hash that the key-based
package/dist/rsc/index.js CHANGED
@@ -116,16 +116,21 @@ function createServerCRPCProxy(options) {
116
116
  /**
117
117
  * Check if query key is for a Convex query function.
118
118
  * Format: ['convexQuery', 'namespace:functionName', { args }]
119
+ *
120
+ * Requires the args slot: a 2-element key is a `queryFilter` prefix, never a
121
+ * cache key, and hashing one would serialize `undefined` args and throw.
119
122
  */
120
123
  function isConvexQuery(queryKey) {
121
- return queryKey.length >= 2 && queryKey[0] === "convexQuery";
124
+ return queryKey.length >= 3 && queryKey[0] === "convexQuery";
122
125
  }
123
126
  /**
124
127
  * Check if query key is for a Convex action function.
125
128
  * Format: ['convexAction', 'namespace:functionName', { args }]
129
+ *
130
+ * Requires the args slot, for the same reason as {@link isConvexQuery}.
126
131
  */
127
132
  function isConvexAction(queryKey) {
128
- return queryKey.length >= 2 && queryKey[0] === "convexAction";
133
+ return queryKey.length >= 3 && queryKey[0] === "convexAction";
129
134
  }
130
135
  /**
131
136
  * Serialize args the same way they go over the wire, so non-native Convex
@@ -800,6 +800,38 @@ const getTransformer = (transformer) => {
800
800
  */
801
801
  const encodeWire = (value, transformer) => getTransformer(transformer).input.serialize(value);
802
802
 
803
+ //#endregion
804
+ //#region src/internal/query-filter.ts
805
+ /**
806
+ * Whether a `queryFilter` call actually narrowed by args.
807
+ *
808
+ * Nullish args and `{}` all mean "match every args variant". They have to
809
+ * collapse to a shorter prefix key rather than sit in the args slot, because
810
+ * TanStack matches filters with `partialMatchKey`, which walks
811
+ * `Object.keys(filterKey)` — an args slot holding `undefined` or `null` is
812
+ * compared against the real args and fails on every entry that carries any,
813
+ * so the filter silently matches nothing.
814
+ */
815
+ function hasQueryFilterArgs(args) {
816
+ if (args == null) return false;
817
+ if (typeof args === "object") return Object.keys(args).length > 0;
818
+ return true;
819
+ }
820
+ /**
821
+ * Build the key for a Convex `queryFilter`.
822
+ *
823
+ * With args, this is the exact 3-element key and TanStack partial-matches the
824
+ * args object. Without args, it stops before the args slot so the filter
825
+ * matches every variant of the function.
826
+ */
827
+ function buildConvexFilterKey(prefix, funcName, args) {
828
+ return hasQueryFilterArgs(args) ? [
829
+ prefix,
830
+ funcName,
831
+ args
832
+ ] : [prefix, funcName];
833
+ }
834
+
803
835
  //#endregion
804
836
  //#region src/solid/http-proxy.ts
805
837
  /**
@@ -880,10 +912,9 @@ function createRecursiveHttpProxy(opts, path = []) {
880
912
  }
881
913
  if (prop === "queryKey") return (args) => buildHttpQueryKey(routeKey, args);
882
914
  if (prop === "queryFilter") return (args, filters) => {
883
- const hasArgs = args !== void 0 && !(typeof args === "object" && args !== null && Object.keys(args).length === 0);
884
915
  return {
885
916
  ...filters,
886
- queryKey: hasArgs ? buildHttpQueryKey(routeKey, args) : buildHttpQueryPrefixKey(routeKey)
917
+ queryKey: hasQueryFilterArgs(args) ? buildHttpQueryKey(routeKey, args) : buildHttpQueryPrefixKey(routeKey)
887
918
  };
888
919
  };
889
920
  if (prop === "mutationOptions") {
@@ -1493,11 +1524,7 @@ function createRecursiveProxy(api, path, meta, transformer) {
1493
1524
  const prefix = getQueryKeyPrefix(path, meta);
1494
1525
  return {
1495
1526
  ...filters,
1496
- queryKey: [
1497
- prefix,
1498
- funcName,
1499
- args
1500
- ]
1527
+ queryKey: buildConvexFilterKey(prefix, funcName, args)
1501
1528
  };
1502
1529
  };
1503
1530
  if (prop === "infiniteQueryOptions") return (args = {}, opts = {}) => {
@@ -1996,16 +2023,21 @@ async function clearAuthBoundQueries(cache, isAuthBound) {
1996
2023
  /**
1997
2024
  * Check if query key is for a Convex query function.
1998
2025
  * Format: ['convexQuery', 'namespace:functionName', { args }]
2026
+ *
2027
+ * Requires the args slot: a 2-element key is a `queryFilter` prefix, never a
2028
+ * cache key, and hashing one would serialize `undefined` args and throw.
1999
2029
  */
2000
2030
  function isConvexQuery(queryKey) {
2001
- return queryKey.length >= 2 && queryKey[0] === "convexQuery";
2031
+ return queryKey.length >= 3 && queryKey[0] === "convexQuery";
2002
2032
  }
2003
2033
  /**
2004
2034
  * Check if query key is for a Convex action function.
2005
2035
  * Format: ['convexAction', 'namespace:functionName', { args }]
2036
+ *
2037
+ * Requires the args slot, for the same reason as {@link isConvexQuery}.
2006
2038
  */
2007
- function isConvexAction$1(queryKey) {
2008
- return queryKey.length >= 2 && queryKey[0] === "convexAction";
2039
+ function isConvexAction(queryKey) {
2040
+ return queryKey.length >= 3 && queryKey[0] === "convexAction";
2009
2041
  }
2010
2042
  /**
2011
2043
  * Serialize args the same way they go over the wire, so non-native Convex
@@ -2039,7 +2071,7 @@ function hashConvexAction(queryKey) {
2039
2071
  function createHashFn(fallback = hashKey) {
2040
2072
  return (queryKey) => {
2041
2073
  if (isConvexQuery(queryKey)) return hashConvexQuery(queryKey);
2042
- if (isConvexAction$1(queryKey)) return hashConvexAction(queryKey);
2074
+ if (isConvexAction(queryKey)) return hashConvexAction(queryKey);
2043
2075
  return fallback(queryKey);
2044
2076
  };
2045
2077
  }
@@ -2123,13 +2155,6 @@ function isConvexSkipped(queryKey) {
2123
2155
  return queryKey.length >= 2 && ["convexQuery", "convexAction"].includes(queryKey[0]) && queryKey[2] === "skip";
2124
2156
  }
2125
2157
  /**
2126
- * Check if query key is for a Convex action function.
2127
- * Format: ['convexAction', 'namespace:functionName', { args }]
2128
- */
2129
- function isConvexAction(queryKey) {
2130
- return queryKey.length >= 2 && queryKey[0] === "convexAction";
2131
- }
2132
- /**
2133
2158
  * Bridges TanStack Query with Convex real-time subscriptions (SolidJS).
2134
2159
  *
2135
2160
  * Uses `ConvexClient.onUpdate()` instead of `ConvexReactClient.watchQuery()`.
@@ -102,20 +102,25 @@ declare const migrationStorageTables: {
102
102
  fieldName: "status";
103
103
  };
104
104
  };
105
- migrationId: ConvexTextBuilderInitial<""> & {
105
+ cursor: ConvexTextBuilderInitial<""> & {
106
106
  _: {
107
- notNull: true;
107
+ tableName: "migration_state";
108
108
  };
109
109
  } & {
110
+ _: {
111
+ fieldName: "cursor";
112
+ };
113
+ };
114
+ direction: ConvexTextBuilderInitial<""> & {
110
115
  _: {
111
116
  tableName: "migration_state";
112
117
  };
113
118
  } & {
114
119
  _: {
115
- fieldName: "migrationId";
120
+ fieldName: "direction";
116
121
  };
117
122
  };
118
- checksum: ConvexTextBuilderInitial<""> & {
123
+ updatedAt: ConvexNumberBuilderInitial<""> & {
119
124
  _: {
120
125
  notNull: true;
121
126
  };
@@ -125,10 +130,10 @@ declare const migrationStorageTables: {
125
130
  };
126
131
  } & {
127
132
  _: {
128
- fieldName: "checksum";
133
+ fieldName: "updatedAt";
129
134
  };
130
135
  };
131
- applied: ConvexBooleanBuilderInitial<""> & {
136
+ migrationId: ConvexTextBuilderInitial<""> & {
132
137
  _: {
133
138
  notNull: true;
134
139
  };
@@ -138,34 +143,42 @@ declare const migrationStorageTables: {
138
143
  };
139
144
  } & {
140
145
  _: {
141
- fieldName: "applied";
146
+ fieldName: "migrationId";
142
147
  };
143
148
  };
144
- direction: ConvexTextBuilderInitial<""> & {
149
+ checksum: ConvexTextBuilderInitial<""> & {
150
+ _: {
151
+ notNull: true;
152
+ };
153
+ } & {
145
154
  _: {
146
155
  tableName: "migration_state";
147
156
  };
148
157
  } & {
149
158
  _: {
150
- fieldName: "direction";
159
+ fieldName: "checksum";
151
160
  };
152
161
  };
153
- runId: ConvexTextBuilderInitial<""> & {
162
+ applied: ConvexBooleanBuilderInitial<""> & {
163
+ _: {
164
+ notNull: true;
165
+ };
166
+ } & {
154
167
  _: {
155
168
  tableName: "migration_state";
156
169
  };
157
170
  } & {
158
171
  _: {
159
- fieldName: "runId";
172
+ fieldName: "applied";
160
173
  };
161
174
  };
162
- cursor: ConvexTextBuilderInitial<""> & {
175
+ runId: ConvexTextBuilderInitial<""> & {
163
176
  _: {
164
177
  tableName: "migration_state";
165
178
  };
166
179
  } & {
167
180
  _: {
168
- fieldName: "cursor";
181
+ fieldName: "runId";
169
182
  };
170
183
  };
171
184
  processed: ConvexNumberBuilderInitial<""> & {
@@ -190,19 +203,6 @@ declare const migrationStorageTables: {
190
203
  fieldName: "startedAt";
191
204
  };
192
205
  };
193
- updatedAt: ConvexNumberBuilderInitial<""> & {
194
- _: {
195
- notNull: true;
196
- };
197
- } & {
198
- _: {
199
- tableName: "migration_state";
200
- };
201
- } & {
202
- _: {
203
- fieldName: "updatedAt";
204
- };
205
- };
206
206
  completedAt: ConvexNumberBuilderInitial<""> & {
207
207
  _: {
208
208
  tableName: "migration_state";
@@ -269,7 +269,7 @@ declare const migrationStorageTables: {
269
269
  fieldName: "direction";
270
270
  };
271
271
  };
272
- runId: ConvexTextBuilderInitial<""> & {
272
+ updatedAt: ConvexNumberBuilderInitial<""> & {
273
273
  _: {
274
274
  notNull: true;
275
275
  };
@@ -279,10 +279,10 @@ declare const migrationStorageTables: {
279
279
  };
280
280
  } & {
281
281
  _: {
282
- fieldName: "runId";
282
+ fieldName: "updatedAt";
283
283
  };
284
284
  };
285
- startedAt: ConvexNumberBuilderInitial<""> & {
285
+ runId: ConvexTextBuilderInitial<""> & {
286
286
  _: {
287
287
  notNull: true;
288
288
  };
@@ -292,10 +292,10 @@ declare const migrationStorageTables: {
292
292
  };
293
293
  } & {
294
294
  _: {
295
- fieldName: "startedAt";
295
+ fieldName: "runId";
296
296
  };
297
297
  };
298
- updatedAt: ConvexNumberBuilderInitial<""> & {
298
+ startedAt: ConvexNumberBuilderInitial<""> & {
299
299
  _: {
300
300
  notNull: true;
301
301
  };
@@ -305,7 +305,7 @@ declare const migrationStorageTables: {
305
305
  };
306
306
  } & {
307
307
  _: {
308
- fieldName: "updatedAt";
308
+ fieldName: "startedAt";
309
309
  };
310
310
  };
311
311
  completedAt: ConvexNumberBuilderInitial<""> & {
@@ -1008,7 +1008,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1008
1008
  readonly aggregate_bucket: ConvexTableWithColumns<{
1009
1009
  name: "aggregate_bucket";
1010
1010
  columns: {
1011
- updatedAt: ConvexNumberBuilderInitial<""> & {
1011
+ count: ConvexNumberBuilderInitial<""> & {
1012
1012
  _: {
1013
1013
  notNull: true;
1014
1014
  };
@@ -1018,10 +1018,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1018
1018
  };
1019
1019
  } & {
1020
1020
  _: {
1021
- fieldName: "updatedAt";
1021
+ fieldName: "count";
1022
1022
  };
1023
1023
  };
1024
- count: ConvexNumberBuilderInitial<""> & {
1024
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1025
1025
  _: {
1026
1026
  notNull: true;
1027
1027
  };
@@ -1031,10 +1031,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1031
1031
  };
1032
1032
  } & {
1033
1033
  _: {
1034
- fieldName: "count";
1034
+ fieldName: "updatedAt";
1035
1035
  };
1036
1036
  };
1037
- indexName: ConvexTextBuilderInitial<""> & {
1037
+ tableKey: ConvexTextBuilderInitial<""> & {
1038
1038
  _: {
1039
1039
  notNull: true;
1040
1040
  };
@@ -1044,10 +1044,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1044
1044
  };
1045
1045
  } & {
1046
1046
  _: {
1047
- fieldName: "indexName";
1047
+ fieldName: "tableKey";
1048
1048
  };
1049
1049
  };
1050
- tableKey: ConvexTextBuilderInitial<""> & {
1050
+ indexName: ConvexTextBuilderInitial<""> & {
1051
1051
  _: {
1052
1052
  notNull: true;
1053
1053
  };
@@ -1057,7 +1057,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1057
1057
  };
1058
1058
  } & {
1059
1059
  _: {
1060
- fieldName: "tableKey";
1060
+ fieldName: "indexName";
1061
1061
  };
1062
1062
  };
1063
1063
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1133,7 +1133,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1133
1133
  readonly aggregate_member: ConvexTableWithColumns<{
1134
1134
  name: "aggregate_member";
1135
1135
  columns: {
1136
- updatedAt: ConvexNumberBuilderInitial<""> & {
1136
+ kind: ConvexTextBuilderInitial<""> & {
1137
1137
  _: {
1138
1138
  notNull: true;
1139
1139
  };
@@ -1143,10 +1143,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1143
1143
  };
1144
1144
  } & {
1145
1145
  _: {
1146
- fieldName: "updatedAt";
1146
+ fieldName: "kind";
1147
1147
  };
1148
1148
  };
1149
- kind: ConvexTextBuilderInitial<""> & {
1149
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1150
1150
  _: {
1151
1151
  notNull: true;
1152
1152
  };
@@ -1156,10 +1156,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1156
1156
  };
1157
1157
  } & {
1158
1158
  _: {
1159
- fieldName: "kind";
1159
+ fieldName: "updatedAt";
1160
1160
  };
1161
1161
  };
1162
- indexName: ConvexTextBuilderInitial<""> & {
1162
+ tableKey: ConvexTextBuilderInitial<""> & {
1163
1163
  _: {
1164
1164
  notNull: true;
1165
1165
  };
@@ -1169,10 +1169,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1169
1169
  };
1170
1170
  } & {
1171
1171
  _: {
1172
- fieldName: "indexName";
1172
+ fieldName: "tableKey";
1173
1173
  };
1174
1174
  };
1175
- tableKey: ConvexTextBuilderInitial<""> & {
1175
+ indexName: ConvexTextBuilderInitial<""> & {
1176
1176
  _: {
1177
1177
  notNull: true;
1178
1178
  };
@@ -1182,7 +1182,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1182
1182
  };
1183
1183
  } & {
1184
1184
  _: {
1185
- fieldName: "tableKey";
1185
+ fieldName: "indexName";
1186
1186
  };
1187
1187
  };
1188
1188
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1323,7 +1323,11 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1323
1323
  readonly aggregate_extrema: ConvexTableWithColumns<{
1324
1324
  name: "aggregate_extrema";
1325
1325
  columns: {
1326
- updatedAt: ConvexNumberBuilderInitial<""> & {
1326
+ value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
1327
+ _: {
1328
+ $type: convex_values0.Value;
1329
+ };
1330
+ } & {
1327
1331
  _: {
1328
1332
  notNull: true;
1329
1333
  };
@@ -1333,14 +1337,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1333
1337
  };
1334
1338
  } & {
1335
1339
  _: {
1336
- fieldName: "updatedAt";
1340
+ fieldName: "value";
1337
1341
  };
1338
1342
  };
1339
- value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
1340
- _: {
1341
- $type: convex_values0.Value;
1342
- };
1343
- } & {
1343
+ count: ConvexNumberBuilderInitial<""> & {
1344
1344
  _: {
1345
1345
  notNull: true;
1346
1346
  };
@@ -1350,10 +1350,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1350
1350
  };
1351
1351
  } & {
1352
1352
  _: {
1353
- fieldName: "value";
1353
+ fieldName: "count";
1354
1354
  };
1355
1355
  };
1356
- count: ConvexNumberBuilderInitial<""> & {
1356
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1357
1357
  _: {
1358
1358
  notNull: true;
1359
1359
  };
@@ -1363,10 +1363,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1363
1363
  };
1364
1364
  } & {
1365
1365
  _: {
1366
- fieldName: "count";
1366
+ fieldName: "updatedAt";
1367
1367
  };
1368
1368
  };
1369
- indexName: ConvexTextBuilderInitial<""> & {
1369
+ tableKey: ConvexTextBuilderInitial<""> & {
1370
1370
  _: {
1371
1371
  notNull: true;
1372
1372
  };
@@ -1376,10 +1376,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1376
1376
  };
1377
1377
  } & {
1378
1378
  _: {
1379
- fieldName: "indexName";
1379
+ fieldName: "tableKey";
1380
1380
  };
1381
1381
  };
1382
- tableKey: ConvexTextBuilderInitial<""> & {
1382
+ indexName: ConvexTextBuilderInitial<""> & {
1383
1383
  _: {
1384
1384
  notNull: true;
1385
1385
  };
@@ -1389,7 +1389,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1389
1389
  };
1390
1390
  } & {
1391
1391
  _: {
1392
- fieldName: "tableKey";
1392
+ fieldName: "indexName";
1393
1393
  };
1394
1394
  };
1395
1395
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1589,6 +1589,19 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1589
1589
  fieldName: "status";
1590
1590
  };
1591
1591
  };
1592
+ kind: ConvexTextBuilderInitial<""> & {
1593
+ _: {
1594
+ notNull: true;
1595
+ };
1596
+ } & {
1597
+ _: {
1598
+ tableName: "aggregate_state";
1599
+ };
1600
+ } & {
1601
+ _: {
1602
+ fieldName: "kind";
1603
+ };
1604
+ };
1592
1605
  cursor: ConvexTextBuilderInitial<""> & {
1593
1606
  _: {
1594
1607
  tableName: "aggregate_state";
@@ -1598,7 +1611,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1598
1611
  fieldName: "cursor";
1599
1612
  };
1600
1613
  };
1601
- processed: ConvexNumberBuilderInitial<""> & {
1614
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1602
1615
  _: {
1603
1616
  notNull: true;
1604
1617
  };
@@ -1608,10 +1621,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1608
1621
  };
1609
1622
  } & {
1610
1623
  _: {
1611
- fieldName: "processed";
1624
+ fieldName: "updatedAt";
1612
1625
  };
1613
1626
  };
1614
- startedAt: ConvexNumberBuilderInitial<""> & {
1627
+ processed: ConvexNumberBuilderInitial<""> & {
1615
1628
  _: {
1616
1629
  notNull: true;
1617
1630
  };
@@ -1621,10 +1634,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1621
1634
  };
1622
1635
  } & {
1623
1636
  _: {
1624
- fieldName: "startedAt";
1637
+ fieldName: "processed";
1625
1638
  };
1626
1639
  };
1627
- updatedAt: ConvexNumberBuilderInitial<""> & {
1640
+ startedAt: ConvexNumberBuilderInitial<""> & {
1628
1641
  _: {
1629
1642
  notNull: true;
1630
1643
  };
@@ -1634,7 +1647,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1634
1647
  };
1635
1648
  } & {
1636
1649
  _: {
1637
- fieldName: "updatedAt";
1650
+ fieldName: "startedAt";
1638
1651
  };
1639
1652
  };
1640
1653
  completedAt: ConvexNumberBuilderInitial<""> & {
@@ -1655,7 +1668,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1655
1668
  fieldName: "lastError";
1656
1669
  };
1657
1670
  };
1658
- kind: ConvexTextBuilderInitial<""> & {
1671
+ tableKey: ConvexTextBuilderInitial<""> & {
1659
1672
  _: {
1660
1673
  notNull: true;
1661
1674
  };
@@ -1665,7 +1678,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1665
1678
  };
1666
1679
  } & {
1667
1680
  _: {
1668
- fieldName: "kind";
1681
+ fieldName: "tableKey";
1669
1682
  };
1670
1683
  };
1671
1684
  indexName: ConvexTextBuilderInitial<""> & {
@@ -1707,19 +1720,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1707
1720
  fieldName: "metricDefinitionHash";
1708
1721
  };
1709
1722
  };
1710
- tableKey: ConvexTextBuilderInitial<""> & {
1711
- _: {
1712
- notNull: true;
1713
- };
1714
- } & {
1715
- _: {
1716
- tableName: "aggregate_state";
1717
- };
1718
- } & {
1719
- _: {
1720
- fieldName: "tableKey";
1721
- };
1722
- };
1723
1723
  };
1724
1724
  }, {
1725
1725
  by_creation_time: ["_creationTime"];
@@ -1744,20 +1744,25 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1744
1744
  fieldName: "status";
1745
1745
  };
1746
1746
  };
1747
- migrationId: ConvexTextBuilderInitial<""> & {
1747
+ cursor: ConvexTextBuilderInitial<""> & {
1748
1748
  _: {
1749
- notNull: true;
1749
+ tableName: "migration_state";
1750
1750
  };
1751
1751
  } & {
1752
+ _: {
1753
+ fieldName: "cursor";
1754
+ };
1755
+ };
1756
+ direction: ConvexTextBuilderInitial<""> & {
1752
1757
  _: {
1753
1758
  tableName: "migration_state";
1754
1759
  };
1755
1760
  } & {
1756
1761
  _: {
1757
- fieldName: "migrationId";
1762
+ fieldName: "direction";
1758
1763
  };
1759
1764
  };
1760
- checksum: ConvexTextBuilderInitial<""> & {
1765
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1761
1766
  _: {
1762
1767
  notNull: true;
1763
1768
  };
@@ -1767,10 +1772,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1767
1772
  };
1768
1773
  } & {
1769
1774
  _: {
1770
- fieldName: "checksum";
1775
+ fieldName: "updatedAt";
1771
1776
  };
1772
1777
  };
1773
- applied: ConvexBooleanBuilderInitial<""> & {
1778
+ migrationId: ConvexTextBuilderInitial<""> & {
1774
1779
  _: {
1775
1780
  notNull: true;
1776
1781
  };
@@ -1780,34 +1785,42 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1780
1785
  };
1781
1786
  } & {
1782
1787
  _: {
1783
- fieldName: "applied";
1788
+ fieldName: "migrationId";
1784
1789
  };
1785
1790
  };
1786
- direction: ConvexTextBuilderInitial<""> & {
1791
+ checksum: ConvexTextBuilderInitial<""> & {
1792
+ _: {
1793
+ notNull: true;
1794
+ };
1795
+ } & {
1787
1796
  _: {
1788
1797
  tableName: "migration_state";
1789
1798
  };
1790
1799
  } & {
1791
1800
  _: {
1792
- fieldName: "direction";
1801
+ fieldName: "checksum";
1793
1802
  };
1794
1803
  };
1795
- runId: ConvexTextBuilderInitial<""> & {
1804
+ applied: ConvexBooleanBuilderInitial<""> & {
1805
+ _: {
1806
+ notNull: true;
1807
+ };
1808
+ } & {
1796
1809
  _: {
1797
1810
  tableName: "migration_state";
1798
1811
  };
1799
1812
  } & {
1800
1813
  _: {
1801
- fieldName: "runId";
1814
+ fieldName: "applied";
1802
1815
  };
1803
1816
  };
1804
- cursor: ConvexTextBuilderInitial<""> & {
1817
+ runId: ConvexTextBuilderInitial<""> & {
1805
1818
  _: {
1806
1819
  tableName: "migration_state";
1807
1820
  };
1808
1821
  } & {
1809
1822
  _: {
1810
- fieldName: "cursor";
1823
+ fieldName: "runId";
1811
1824
  };
1812
1825
  };
1813
1826
  processed: ConvexNumberBuilderInitial<""> & {
@@ -1832,19 +1845,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1832
1845
  fieldName: "startedAt";
1833
1846
  };
1834
1847
  };
1835
- updatedAt: ConvexNumberBuilderInitial<""> & {
1836
- _: {
1837
- notNull: true;
1838
- };
1839
- } & {
1840
- _: {
1841
- tableName: "migration_state";
1842
- };
1843
- } & {
1844
- _: {
1845
- fieldName: "updatedAt";
1846
- };
1847
- };
1848
1848
  completedAt: ConvexNumberBuilderInitial<""> & {
1849
1849
  _: {
1850
1850
  tableName: "migration_state";
@@ -1911,7 +1911,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1911
1911
  fieldName: "direction";
1912
1912
  };
1913
1913
  };
1914
- runId: ConvexTextBuilderInitial<""> & {
1914
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1915
1915
  _: {
1916
1916
  notNull: true;
1917
1917
  };
@@ -1921,10 +1921,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1921
1921
  };
1922
1922
  } & {
1923
1923
  _: {
1924
- fieldName: "runId";
1924
+ fieldName: "updatedAt";
1925
1925
  };
1926
1926
  };
1927
- startedAt: ConvexNumberBuilderInitial<""> & {
1927
+ runId: ConvexTextBuilderInitial<""> & {
1928
1928
  _: {
1929
1929
  notNull: true;
1930
1930
  };
@@ -1934,10 +1934,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1934
1934
  };
1935
1935
  } & {
1936
1936
  _: {
1937
- fieldName: "startedAt";
1937
+ fieldName: "runId";
1938
1938
  };
1939
1939
  };
1940
- updatedAt: ConvexNumberBuilderInitial<""> & {
1940
+ startedAt: ConvexNumberBuilderInitial<""> & {
1941
1941
  _: {
1942
1942
  notNull: true;
1943
1943
  };
@@ -1947,7 +1947,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1947
1947
  };
1948
1948
  } & {
1949
1949
  _: {
1950
- fieldName: "updatedAt";
1950
+ fieldName: "startedAt";
1951
1951
  };
1952
1952
  };
1953
1953
  completedAt: ConvexNumberBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.27.0",
3
+ "version": "0.27.2",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -110,6 +110,7 @@ export const member = convexTable(
110
110
  },
111
111
  (t) => [
112
112
  index("userId").on(t.userId),
113
+ index("organizationId").on(t.organizationId),
113
114
  index("organizationId_userId").on(t.organizationId, t.userId),
114
115
  index("organizationId_role").on(t.organizationId, t.role),
115
116
  // Backs `member.count({ where: { organizationId } })` for seat limits.
@@ -131,6 +132,7 @@ export const invitation = convexTable(
131
132
  (t) => [
132
133
  index("email").on(t.email),
133
134
  index("status").on(t.status),
135
+ index("organizationId").on(t.organizationId),
134
136
  index("email_organizationId_status").on(
135
137
  t.email,
136
138
  t.organizationId,
@@ -178,7 +180,11 @@ export const teamMember = convexTable(
178
180
  userId: id("user").notNull(),
179
181
  createdAt: timestamp(),
180
182
  },
181
- (t) => [index("teamId").on(t.teamId), index("userId").on(t.userId)]
183
+ (t) => [
184
+ index("teamId").on(t.teamId),
185
+ index("userId").on(t.userId),
186
+ index("teamId_userId").on(t.teamId, t.userId),
187
+ ]
182
188
  );
183
189
  ```
184
190
 
@@ -235,11 +235,20 @@ useQuery(crpc.user.get.queryOptions(userId ? { id: userId } : skipToken));
235
235
 
236
236
  ### Query Keys & Filters
237
237
 
238
+ `queryKey(args)` is the exact cache key — use it for `getQueryData`/`setQueryData`.
239
+ `queryFilter(args?)` matches on prefix — use it for `invalidateQueries`/`cancelQueries`/`removeQueries`.
240
+
238
241
  ```ts
239
242
  const queryKey = crpc.user.list.queryKey({}); // ['convexQuery', 'user:list', {}]
240
243
  const data = queryClient.getQueryData(queryKey);
241
244
 
242
- const filter = crpc.user.list.queryFilter({}, { predicate: (q) => q.state.dataUpdatedAt > Date.now() - 60000 });
245
+ // Omit args to match every args variant: ['convexQuery', 'user:list']
246
+ queryClient.invalidateQueries(crpc.user.list.queryFilter());
247
+
248
+ // Partial args match every query whose args contain them
249
+ queryClient.invalidateQueries(crpc.user.list.queryFilter({ status: 'active' }));
250
+
251
+ const filter = crpc.user.list.queryFilter({ status: 'active' }, { predicate: (q) => q.state.dataUpdatedAt > Date.now() - 60000 });
243
252
  queryClient.invalidateQueries(filter);
244
253
  ```
245
254