better-convex 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aggregate/index.d.ts +1 -4
- package/dist/aggregate/index.js +1 -1
- package/dist/auth/index.d.ts +26 -27
- package/dist/auth/nextjs/index.d.ts +0 -1
- package/dist/cli.mjs +16 -1
- package/dist/{id-BcBb900m.js → id-BF_SaWhQ.js} +10 -11
- package/dist/orm/index.d.ts +2 -2
- package/dist/orm/index.js +98 -90
- package/dist/plugins/index.d.ts +4 -4
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/ratelimit/index.d.ts +1 -4
- package/dist/plugins/ratelimit/index.js +2 -2
- package/dist/{runtime-C0WcYGY0.js → runtime-B20PP4Qr.js} +2 -2
- package/dist/{schema-Bx6j2doh.js → schema-Cw5-LWTg.js} +2 -2
- package/dist/server/index.d.ts +0 -1
- package/dist/{table-B7yzBihE.js → table-Bxqm450r.js} +107 -3
- package/dist/{text-enum-CFdcLUuw.js → text-enum-KyijdQ8Q.js} +1 -1
- package/dist/{where-clause-compiler-m-GQNB_K.d.ts → where-clause-compiler-UavDdMUX.d.ts} +183 -164
- package/package.json +1 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { jt as ConvexCustomBuilderInitial, sn as ConvexTableWithColumns, vt as ConvexTextBuilderInitial, wt as ConvexIdBuilderInitial, xt as ConvexNumberBuilderInitial } from "../where-clause-compiler-m-GQNB_K.js";
|
|
3
|
-
import "../query-context-ji7By8u0.js";
|
|
4
|
-
import "../orm/index.js";
|
|
1
|
+
import { Dt as ConvexCustomBuilderInitial, _t as ConvexNumberBuilderInitial, bt as ConvexIdBuilderInitial, qn as ConvexTextBuilderInitial, rn as ConvexTableWithColumns } from "../where-clause-compiler-UavDdMUX.js";
|
|
5
2
|
import * as convex_values0 from "convex/values";
|
|
6
3
|
import { GenericId, Infer, Value } from "convex/values";
|
|
7
4
|
import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
|
package/dist/aggregate/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as TableAggregate$1, r as aggregateStorageTables, t as DirectAggregate$1 } from "../runtime-
|
|
1
|
+
import { n as TableAggregate$1, r as aggregateStorageTables, t as DirectAggregate$1 } from "../runtime-B20PP4Qr.js";
|
|
2
2
|
|
|
3
3
|
//#region src/aggregate/index.ts
|
|
4
4
|
const wrapTriggerFactory = (methodName, factory) => ((...args) => {
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../validators-BcQFm1oY.js";
|
|
2
1
|
import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-ji7By8u0.js";
|
|
3
2
|
import { t as GetAuth } from "../types-CM67ko7K.js";
|
|
4
3
|
import { A as GenericCtx } from "../procedure-caller-DYjpq7rG.js";
|
|
@@ -184,27 +183,27 @@ type AdapterPaginationOptions = PaginationOptions & {
|
|
|
184
183
|
declare const adapterWhereValidator: convex_values0.VObject<{
|
|
185
184
|
connector?: "AND" | "OR" | undefined;
|
|
186
185
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
187
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
188
186
|
field: string;
|
|
187
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
189
188
|
}, {
|
|
190
189
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
191
190
|
field: convex_values0.VString<string, "required">;
|
|
192
191
|
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>;
|
|
193
192
|
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>;
|
|
194
|
-
}, "required", "
|
|
193
|
+
}, "required", "connector" | "field" | "operator" | "value">;
|
|
195
194
|
declare const adapterArgsValidator: convex_values0.VObject<{
|
|
196
195
|
limit?: number | undefined;
|
|
197
196
|
select?: string[] | undefined;
|
|
198
197
|
offset?: number | undefined;
|
|
199
198
|
sortBy?: {
|
|
200
|
-
direction: "asc" | "desc";
|
|
201
199
|
field: string;
|
|
200
|
+
direction: "asc" | "desc";
|
|
202
201
|
} | undefined;
|
|
203
202
|
where?: {
|
|
204
203
|
connector?: "AND" | "OR" | undefined;
|
|
205
204
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
206
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
207
205
|
field: string;
|
|
206
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
208
207
|
}[] | undefined;
|
|
209
208
|
model: string;
|
|
210
209
|
}, {
|
|
@@ -213,29 +212,29 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
213
212
|
offset: convex_values0.VFloat64<number | undefined, "optional">;
|
|
214
213
|
select: convex_values0.VArray<string[] | undefined, convex_values0.VString<string, "required">, "optional">;
|
|
215
214
|
sortBy: convex_values0.VObject<{
|
|
216
|
-
direction: "asc" | "desc";
|
|
217
215
|
field: string;
|
|
216
|
+
direction: "asc" | "desc";
|
|
218
217
|
} | undefined, {
|
|
219
218
|
direction: convex_values0.VUnion<"asc" | "desc", [convex_values0.VLiteral<"asc", "required">, convex_values0.VLiteral<"desc", "required">], "required", never>;
|
|
220
219
|
field: convex_values0.VString<string, "required">;
|
|
221
|
-
}, "optional", "
|
|
220
|
+
}, "optional", "field" | "direction">;
|
|
222
221
|
where: convex_values0.VArray<{
|
|
223
222
|
connector?: "AND" | "OR" | undefined;
|
|
224
223
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
225
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
226
224
|
field: string;
|
|
225
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
227
226
|
}[] | undefined, convex_values0.VObject<{
|
|
228
227
|
connector?: "AND" | "OR" | undefined;
|
|
229
228
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
230
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
231
229
|
field: string;
|
|
230
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
232
231
|
}, {
|
|
233
232
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
234
233
|
field: convex_values0.VString<string, "required">;
|
|
235
234
|
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>;
|
|
236
235
|
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>;
|
|
237
|
-
}, "required", "
|
|
238
|
-
}, "required", "limit" | "model" | "select" | "offset" | "sortBy" | "where" | "sortBy.
|
|
236
|
+
}, "required", "connector" | "field" | "operator" | "value">, "optional">;
|
|
237
|
+
}, "required", "limit" | "model" | "select" | "offset" | "sortBy" | "where" | "sortBy.field" | "sortBy.direction">;
|
|
239
238
|
declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
|
|
240
239
|
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>;
|
|
241
240
|
declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => Promise<D | null>;
|
|
@@ -372,8 +371,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
372
371
|
where?: {
|
|
373
372
|
connector?: "AND" | "OR" | undefined;
|
|
374
373
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
375
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
376
374
|
field: string;
|
|
375
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
377
376
|
}[] | undefined;
|
|
378
377
|
model: string;
|
|
379
378
|
} | {
|
|
@@ -393,8 +392,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
393
392
|
where?: {
|
|
394
393
|
connector?: "AND" | "OR" | undefined;
|
|
395
394
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
396
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
397
395
|
field: string;
|
|
396
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
398
397
|
}[] | undefined;
|
|
399
398
|
model: string;
|
|
400
399
|
} | {
|
|
@@ -403,18 +402,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
403
402
|
};
|
|
404
403
|
}, Promise<Record<string, unknown> | undefined>>;
|
|
405
404
|
findMany: convex_server0.RegisteredQuery<"internal", {
|
|
406
|
-
join?: any;
|
|
407
405
|
limit?: number | undefined;
|
|
406
|
+
join?: any;
|
|
408
407
|
offset?: number | undefined;
|
|
409
408
|
sortBy?: {
|
|
410
|
-
direction: "asc" | "desc";
|
|
411
409
|
field: string;
|
|
410
|
+
direction: "asc" | "desc";
|
|
412
411
|
} | undefined;
|
|
413
412
|
where?: {
|
|
414
413
|
connector?: "AND" | "OR" | undefined;
|
|
415
414
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
416
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
417
415
|
field: string;
|
|
416
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
418
417
|
}[] | undefined;
|
|
419
418
|
paginationOpts: {
|
|
420
419
|
id?: number;
|
|
@@ -432,8 +431,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
432
431
|
where?: {
|
|
433
432
|
connector?: "AND" | "OR" | undefined;
|
|
434
433
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
435
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
436
434
|
field: string;
|
|
435
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
437
436
|
}[] | undefined;
|
|
438
437
|
model: string;
|
|
439
438
|
}, Promise<convex_server0.GenericDocument | null>>;
|
|
@@ -450,8 +449,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
450
449
|
where?: {
|
|
451
450
|
connector?: "AND" | "OR" | undefined;
|
|
452
451
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
453
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
454
452
|
field: string;
|
|
453
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
455
454
|
}[] | undefined;
|
|
456
455
|
update: {
|
|
457
456
|
[x: string]: unknown;
|
|
@@ -477,8 +476,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
477
476
|
where?: {
|
|
478
477
|
connector?: "AND" | "OR" | undefined;
|
|
479
478
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
480
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
481
479
|
field: string;
|
|
480
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
482
481
|
}[] | undefined;
|
|
483
482
|
update: {
|
|
484
483
|
[x: string]: unknown;
|
|
@@ -19168,8 +19167,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
|
|
|
19168
19167
|
where?: {
|
|
19169
19168
|
connector?: "AND" | "OR" | undefined;
|
|
19170
19169
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
19171
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
19172
19170
|
field: string;
|
|
19171
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
19173
19172
|
}[] | undefined;
|
|
19174
19173
|
model: string;
|
|
19175
19174
|
} | {
|
|
@@ -19189,8 +19188,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
|
|
|
19189
19188
|
where?: {
|
|
19190
19189
|
connector?: "AND" | "OR" | undefined;
|
|
19191
19190
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
19192
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
19193
19191
|
field: string;
|
|
19192
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
19194
19193
|
}[] | undefined;
|
|
19195
19194
|
model: string;
|
|
19196
19195
|
} | {
|
|
@@ -19199,18 +19198,18 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
|
|
|
19199
19198
|
};
|
|
19200
19199
|
}, Promise<Record<string, unknown> | undefined>>;
|
|
19201
19200
|
findMany: convex_server0.RegisteredQuery<"internal", {
|
|
19202
|
-
join?: any;
|
|
19203
19201
|
limit?: number | undefined;
|
|
19202
|
+
join?: any;
|
|
19204
19203
|
offset?: number | undefined;
|
|
19205
19204
|
sortBy?: {
|
|
19206
|
-
direction: "asc" | "desc";
|
|
19207
19205
|
field: string;
|
|
19206
|
+
direction: "asc" | "desc";
|
|
19208
19207
|
} | undefined;
|
|
19209
19208
|
where?: {
|
|
19210
19209
|
connector?: "AND" | "OR" | undefined;
|
|
19211
19210
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
19212
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
19213
19211
|
field: string;
|
|
19212
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
19214
19213
|
}[] | undefined;
|
|
19215
19214
|
paginationOpts: {
|
|
19216
19215
|
id?: number;
|
|
@@ -19228,8 +19227,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
|
|
|
19228
19227
|
where?: {
|
|
19229
19228
|
connector?: "AND" | "OR" | undefined;
|
|
19230
19229
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
19231
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
19232
19230
|
field: string;
|
|
19231
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
19233
19232
|
}[] | undefined;
|
|
19234
19233
|
model: string;
|
|
19235
19234
|
}, Promise<convex_server0.GenericDocument | null>>;
|
|
@@ -19246,8 +19245,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
|
|
|
19246
19245
|
where?: {
|
|
19247
19246
|
connector?: "AND" | "OR" | undefined;
|
|
19248
19247
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
19249
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
19250
19248
|
field: string;
|
|
19249
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
19251
19250
|
}[] | undefined;
|
|
19252
19251
|
update: {
|
|
19253
19252
|
[x: string]: unknown;
|
|
@@ -19273,8 +19272,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
|
|
|
19273
19272
|
where?: {
|
|
19274
19273
|
connector?: "AND" | "OR" | undefined;
|
|
19275
19274
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
19276
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
19277
19275
|
field: string;
|
|
19276
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
19278
19277
|
}[] | undefined;
|
|
19279
19278
|
update: {
|
|
19280
19279
|
[x: string]: unknown;
|
package/dist/cli.mjs
CHANGED
|
@@ -230,6 +230,7 @@ const OrmContext = Symbol.for("better-convex:OrmContext");
|
|
|
230
230
|
const RlsPolicies = Symbol.for("better-convex:RlsPolicies");
|
|
231
231
|
const EnableRLS = Symbol.for("better-convex:EnableRLS");
|
|
232
232
|
const TableDeleteConfig = Symbol.for("better-convex:TableDeleteConfig");
|
|
233
|
+
const TablePolymorphic = Symbol.for("better-convex:TablePolymorphic");
|
|
233
234
|
const OrmSchemaOptions = Symbol.for("better-convex:OrmSchemaOptions");
|
|
234
235
|
const OrmSchemaDefinition = Symbol.for("better-convex:OrmSchemaDefinition");
|
|
235
236
|
const OrmSchemaPluginTables = Symbol.for("better-convex:OrmSchemaPluginTables");
|
|
@@ -449,8 +450,22 @@ const walkDeployEntryPoints = (dir, options) => {
|
|
|
449
450
|
};
|
|
450
451
|
const detectProjectRoots = () => {
|
|
451
452
|
const projectRoot = process.cwd();
|
|
453
|
+
const convexConfigPath = path.join(projectRoot, "convex.json");
|
|
454
|
+
const configuredFunctionsRoot = (() => {
|
|
455
|
+
if (!fs.existsSync(convexConfigPath)) return null;
|
|
456
|
+
try {
|
|
457
|
+
const parsed = JSON.parse(fs.readFileSync(convexConfigPath, "utf8"));
|
|
458
|
+
return typeof parsed.functions === "string" && parsed.functions.length > 0 ? path.join(projectRoot, parsed.functions) : null;
|
|
459
|
+
} catch {
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
})();
|
|
452
463
|
const preferredFunctionsRoot = path.join(projectRoot, "convex", "functions");
|
|
453
464
|
const fallbackFunctionsRoot = path.join(projectRoot, "convex");
|
|
465
|
+
if (configuredFunctionsRoot && fs.existsSync(configuredFunctionsRoot)) return {
|
|
466
|
+
projectRoot,
|
|
467
|
+
functionsRoot: configuredFunctionsRoot
|
|
468
|
+
};
|
|
454
469
|
if (fs.existsSync(preferredFunctionsRoot)) return {
|
|
455
470
|
projectRoot,
|
|
456
471
|
functionsRoot: preferredFunctionsRoot
|
|
@@ -459,7 +474,7 @@ const detectProjectRoots = () => {
|
|
|
459
474
|
projectRoot,
|
|
460
475
|
functionsRoot: fallbackFunctionsRoot
|
|
461
476
|
};
|
|
462
|
-
throw new Error(`Missing Convex functions directory. Expected one of:\n- ${preferredFunctionsRoot}\n- ${fallbackFunctionsRoot}`);
|
|
477
|
+
throw new Error(`Missing Convex functions directory. Expected one of:\n- ${configuredFunctionsRoot ?? "<convex.json functions>"}\n- ${preferredFunctionsRoot}\n- ${fallbackFunctionsRoot}`);
|
|
463
478
|
};
|
|
464
479
|
const hasUseNodeDirective = (source) => {
|
|
465
480
|
if (!source.includes("use node")) return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as entityKind, E as ConvexColumnBuilder } from "./table-Bxqm450r.js";
|
|
2
2
|
import { o as vRequired } from "./validators-D_i3BK7v.js";
|
|
3
3
|
import { v } from "convex/values";
|
|
4
4
|
|
|
@@ -15,15 +15,14 @@ function isColumnBuilder(value) {
|
|
|
15
15
|
function toRequiredValidator(validator) {
|
|
16
16
|
return validator.isOptional === "optional" ? vRequired(validator) : validator;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return stripNullUnionMember(toRequiredValidator(validator));
|
|
18
|
+
function toRequiredBuilderValidator(validator) {
|
|
19
|
+
const requiredValidator = toRequiredValidator(validator);
|
|
20
|
+
if (requiredValidator.kind !== "union") return requiredValidator;
|
|
21
|
+
const nonNullMembers = requiredValidator.members.filter((member) => member.kind !== "null");
|
|
22
|
+
if (nonNullMembers.length !== 1) return requiredValidator;
|
|
23
|
+
const [member] = nonNullMembers;
|
|
24
|
+
if (member.kind === "object" || member.kind === "array") return member;
|
|
25
|
+
return requiredValidator;
|
|
27
26
|
}
|
|
28
27
|
function formatInvalidInput(path, value) {
|
|
29
28
|
return `${path} expected a column builder, Convex validator, or nested object shape. Got ${Array.isArray(value) ? "array" : value === null ? "null" : typeof value}.`;
|
|
@@ -34,7 +33,7 @@ function objectShapeToValidator(shape, path) {
|
|
|
34
33
|
return v.object(fields);
|
|
35
34
|
}
|
|
36
35
|
function nestedInputToValidator(input, path) {
|
|
37
|
-
if (isColumnBuilder(input)) return
|
|
36
|
+
if (isColumnBuilder(input)) return toRequiredBuilderValidator(input.convexValidator);
|
|
38
37
|
if (isValidator(input)) return toRequiredValidator(input);
|
|
39
38
|
if (isRecord(input)) return objectShapeToValidator(input, path);
|
|
40
39
|
throw new Error(formatInvalidInput(path, input));
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-BcQFm1oY.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as DatabaseWithQuery, $n as BuildRelationResult, $r as notInArray, $t as defineRelationsPart, A as MigrationRunArgs, An as aggregateIndex, Ar as FieldReference, At as json, B as MigrationMigrateOne, Bn as ConvexUniqueConstraintBuilder, Br as gt, Bt as bigint, C as OrmBeforeResult, Cn as ConvexRankIndexBuilderOn, Cr as ReturningSelection, Ct as ConvexDateBuilderInitial, D as OrmTriggers, Dn as ConvexVectorIndexBuilder, Dr as unsetToken, Dt as ConvexCustomBuilderInitial, E as OrmTriggerContext, En as ConvexSearchIndexConfig, Er as VectorSearchProvider, Et as ConvexCustomBuilder, F as MigrationDirection, Fn as vectorIndex, Fr as between, Ft as ConvexBooleanBuilder, G as MigrationStep, Gn as unique, Gr as isNotNull, Gt as ManyConfig, H as MigrationRunStatus, Hn as ConvexUniqueConstraintConfig, Hr as ilike, Ht as CountBackfillKickoffArgs, I as MigrationDoc, In as ConvexCheckBuilder, Ir as contains, It as ConvexBooleanBuilderInitial, J as buildMigrationPlan, Jn as text, Jr as lt, Jt as RelationsBuilderColumnBase, K as MigrationTableName, Kn as ConvexTextBuilder, Kr as isNull, Kt as OneConfig, L as MigrationDocContext, Ln as ConvexCheckConfig, Lr as endsWith, Lt as boolean, M as MigrationStatusArgs, Mn as rankIndex, Mr as LogicalExpression, Mt as ConvexBytesBuilder, N as MigrationAppliedState, Nn as searchIndex, Nr as UnaryExpression, Nt as ConvexBytesBuilderInitial, O as defineTriggers, On as ConvexVectorIndexBuilderOn, Or as BinaryExpression, Ot as arrayOf, P as MigrationDefinition, Pn as uniqueIndex, Pr as and, Pt as bytes, Q as DatabaseWithMutations, Qn as BuildQueryResult, Qr as notBetween, Qt as defineRelations, R as MigrationDriftIssue, Rn as ConvexForeignKeyBuilder, Rr as eq, Rt as ConvexBigIntBuilder, S as scheduledDeleteFactory, Sn as ConvexRankIndexBuilder, Sr as ReturningResult, St as ConvexDateBuilder, T as OrmTriggerChange, Tn as ConvexSearchIndexBuilderOn, Tr as VectorQueryConfig, Tt as date, U as MigrationSet, Un as check, Ur as inArray, Ut as CountBackfillStatusArgs, V as MigrationPlan, Vn as ConvexUniqueConstraintBuilderOn, Vr as gte, Vt as CountBackfillChunkArgs, W as MigrationStateMap, Wn as foreignKey, Wr as isFieldReference, Wt as ExtractTablesWithRelations, X as defineMigrationSet, Xn as AggregateFieldValue, Xr as ne, Xt as TableRelationalConfig, Y as defineMigration, Yn as AggregateConfig, Yr as lte, Yt as RelationsBuilderColumnConfig, Z as detectMigrationDrift, Zn as AggregateResult, Zr as not, Zt as TablesRelationalConfig, _ as OrmWriterCtx, _i as IsPrimaryKey, _n as rlsRole, _r as OrderByClause, _t as ConvexNumberBuilderInitial, a as TableConfigResult, ai as OrmSchemaPluginTables, an as OrmLifecycleChange, ar as InferInsertModel, at as extractRelationsConfig, b as scheduledMutationBatchFactory, bn as ConvexIndexBuilder, br as PredicateWhereIndexConfig, bt as ConvexIdBuilderInitial, c as OrmNotFoundError, ci as AnyColumn, cn as convexTable, cr as InsertValue, ct as vector, d as GenericOrmCtx, di as ColumnBuilderRuntimeConfig, dn as RlsPolicy, dr as MutationExecutionMode, dt as ConvexTimestampMode, ei as or, en as ConvexDeletionBuilder, er as CountConfig, et as OrmReader, f as OrmApiResult, fi as ColumnBuilderTypeConfig, fn as RlsPolicyConfig, fr as MutationPaginateConfig, ft as timestamp, g as OrmReaderCtx, gi as HasDefault, gn as RlsRoleConfig, gr as MutationRunMode, gt as ConvexNumberBuilder, h as OrmFunctions, hi as DrizzleEntity, hn as RlsRole, hr as MutationReturning, ht as textEnum, i as desc, ii as OrmSchemaPlugin, in as DiscriminatorBuilderConfig, ir as GetColumnData, it as EdgeMetadata, j as MigrationRunChunkArgs, jn as index, jr as FilterExpression, jt as objectOf, k as MigrationCancelArgs, kn as ConvexVectorIndexConfig, kr as ExpressionVisitor, kt as custom, l as CreateOrmOptions, li as ColumnBuilder, ln as deletion, lr as MutationExecuteConfig, lt as ConvexTimestampBuilder, m as OrmClientWithApi, mi as ColumnDataType, mn as rlsPolicy, mr as MutationResult, mt as ConvexTextEnumBuilderInitial, n as defineSchema, ni as Brand, nn as ConvexTable, nr as DBQueryConfig, nt as RlsContext, o as getTableColumns, oi as TableName, on as OrmLifecycleOperation, or as InferModelFromColumns, ot as ConvexVectorBuilder, p as OrmClientBase, pi as ColumnBuilderWithTableName, pn as RlsPolicyToOption, pr as MutationPaginatedResult, pt as ConvexTextEnumBuilder, q as MigrationWriteMode, qn as ConvexTextBuilderInitial, qr as like, qt as RelationsBuilder, r as asc, ri as Columns, rr as FilterOperators, rt as RlsMode, s as getTableConfig, si as SystemFields, sn as TableConfig, sr as InferSelectModel, st as ConvexVectorBuilderInitial, t as WhereClauseResult, ti as startsWith, tn as ConvexDeletionConfig, tr as CountResult, tt as OrmWriter, u as GenericOrm, ui as ColumnBuilderBaseConfig, un as discriminator, ur as MutationExecuteResult, ut as ConvexTimestampBuilderInitial, v as createOrm, vi as IsUnique, vn as ConvexAggregateIndexBuilder, vr as OrderDirection, vt as integer, w as OrmTableTriggers, wn as ConvexSearchIndexBuilder, wr as UpdateSet, wt as ConvexDateMode, x as ScheduledDeleteArgs, xn as ConvexIndexBuilderOn, xr as ReturningAll, xt as id, y as ScheduledMutationBatchArgs, yi as NotNull, yn as ConvexAggregateIndexBuilderOn, yr as PaginatedResult, yt as ConvexIdBuilder, z as MigrationManifestEntry, zn as ConvexForeignKeyConfig, zr as fieldRef, zt as ConvexBigIntBuilderInitial } from "../where-clause-compiler-UavDdMUX.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-ji7By8u0.js";
|
|
4
4
|
import { DefineSchemaOptions, GenericSchema, SchemaDefinition } from "convex/server";
|
|
5
|
-
export { type AggregateConfig, type AggregateFieldValue, type AggregateResult, type AnyColumn, type BinaryExpression, Brand, type BuildQueryResult, type BuildRelationResult, type ColumnBuilder, type ColumnBuilderBaseConfig, type ColumnBuilderRuntimeConfig, type ColumnBuilderTypeConfig, type ColumnBuilderWithTableName, type ColumnDataType, Columns, type ConvexAggregateIndexBuilder, type ConvexAggregateIndexBuilderOn, type ConvexBigIntBuilder, type ConvexBigIntBuilderInitial, type ConvexBooleanBuilder, type ConvexBooleanBuilderInitial, type ConvexBytesBuilder, type ConvexBytesBuilderInitial, type ConvexCheckBuilder, type ConvexCheckConfig, type ConvexCustomBuilder, type ConvexCustomBuilderInitial, type ConvexDateBuilder, type ConvexDateBuilderInitial, type ConvexDateMode, type ConvexDeletionBuilder, type ConvexDeletionConfig, type ConvexForeignKeyBuilder, type ConvexForeignKeyConfig, type ConvexIdBuilder, type ConvexIdBuilderInitial, type ConvexIndexBuilder, type ConvexIndexBuilderOn, type ConvexNumberBuilder, type ConvexNumberBuilderInitial, type ConvexRankIndexBuilder, type ConvexRankIndexBuilderOn, type ConvexSearchIndexBuilder, type ConvexSearchIndexBuilderOn, type ConvexSearchIndexConfig, type ConvexTable, type ConvexTextBuilder, type ConvexTextBuilderInitial, type ConvexTextEnumBuilder, type ConvexTextEnumBuilderInitial, type ConvexTimestampBuilder, type ConvexTimestampBuilderInitial, type ConvexTimestampMode, type ConvexUniqueConstraintBuilder, type ConvexUniqueConstraintBuilderOn, type ConvexUniqueConstraintConfig, type ConvexVectorBuilder, type ConvexVectorBuilderInitial, type ConvexVectorIndexBuilder, type ConvexVectorIndexBuilderOn, type ConvexVectorIndexConfig, type CountBackfillChunkArgs, type CountBackfillKickoffArgs, type CountBackfillStatusArgs, type CountConfig, type CountResult, type CreateOrmOptions, type DBQueryConfig, type DatabaseWithMutations, type DatabaseWithQuery, type DefineSchemaOptions, type DocByCtx, type DrizzleEntity, type EdgeMetadata, type ExpressionVisitor, type ExtractTablesWithRelations, type FieldReference, type FilterExpression, type FilterOperators, type GenericOrm, type GenericOrmCtx, type GenericSchema, type GetColumnData, type HasDefault, type InferInsertModel, type InferModelFromColumns, type InferSelectModel, type InsertValue, type IsPrimaryKey, type IsUnique, type LogicalExpression, type LookupByIdResultByCtx, type ManyConfig, 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, type MutationExecuteConfig, type MutationExecuteResult, type MutationExecutionMode, type MutationPaginateConfig, type MutationPaginatedResult, type MutationResult, type MutationReturning, type MutationRunMode, type NotNull, type OneConfig, type OrderByClause, type OrderDirection, type OrmApiResult, type OrmBeforeResult, type OrmClientBase, type OrmClientWithApi, type OrmFunctions, type OrmLifecycleChange, type OrmLifecycleOperation, OrmNotFoundError, type OrmReader, type OrmReaderCtx, type OrmSchemaPlugin, OrmSchemaPluginTables, type OrmTableTriggers, type OrmTriggerChange, type OrmTriggerContext, type OrmTriggers, type OrmWriter, type OrmWriterCtx, type PaginatedResult, type PredicateWhereIndexConfig, type QueryCtxWithOptionalOrmQueryTable, type QueryCtxWithOrmQueryTable, type QueryCtxWithPreferredOrmQueryTable, type RelationsBuilder, type RelationsBuilderColumnBase, type RelationsBuilderColumnConfig, type ReturningAll, type ReturningResult, type ReturningSelection, type RlsContext, type RlsMode, RlsPolicy, type RlsPolicyConfig, type RlsPolicyToOption, RlsRole, type RlsRoleConfig, type ScheduledDeleteArgs, type ScheduledMutationBatchArgs, type SchemaDefinition, type SystemFields, type TableConfig, type TableConfigResult, TableName, type TableRelationalConfig, type TablesRelationalConfig, type UnaryExpression, type UpdateSet, type VectorQueryConfig, type VectorSearchProvider, type WhereClauseResult, aggregateIndex, and, arrayOf, asc, between, bigint, boolean, buildMigrationPlan, bytes, check, contains, convexTable, createOrm, custom, date, defineMigration, defineMigrationSet, defineRelations, defineRelationsPart, defineSchema, defineTriggers, deletion, deprecated, desc, detectMigrationDrift, endsWith, eq, extractRelationsConfig, fieldRef, foreignKey, getByIdWithOrmQueryFallback, getTableColumns, getTableConfig, gt, gte, id, ilike, inArray, index, integer, isFieldReference, isNotNull, isNull, json, like, lt, lte, ne, not, notBetween, notInArray, objectOf, or, pretend, pretendRequired, rankIndex, rlsPolicy, rlsRole, scheduledDeleteFactory, scheduledMutationBatchFactory, searchIndex, startsWith, text, textEnum, timestamp, unique, uniqueIndex, unsetToken, vector, vectorIndex };
|
|
5
|
+
export { type AggregateConfig, type AggregateFieldValue, type AggregateResult, type AnyColumn, type BinaryExpression, Brand, type BuildQueryResult, type BuildRelationResult, type ColumnBuilder, type ColumnBuilderBaseConfig, type ColumnBuilderRuntimeConfig, type ColumnBuilderTypeConfig, type ColumnBuilderWithTableName, type ColumnDataType, Columns, type ConvexAggregateIndexBuilder, type ConvexAggregateIndexBuilderOn, type ConvexBigIntBuilder, type ConvexBigIntBuilderInitial, type ConvexBooleanBuilder, type ConvexBooleanBuilderInitial, type ConvexBytesBuilder, type ConvexBytesBuilderInitial, type ConvexCheckBuilder, type ConvexCheckConfig, type ConvexCustomBuilder, type ConvexCustomBuilderInitial, type ConvexDateBuilder, type ConvexDateBuilderInitial, type ConvexDateMode, type ConvexDeletionBuilder, type ConvexDeletionConfig, type ConvexForeignKeyBuilder, type ConvexForeignKeyConfig, type ConvexIdBuilder, type ConvexIdBuilderInitial, type ConvexIndexBuilder, type ConvexIndexBuilderOn, type ConvexNumberBuilder, type ConvexNumberBuilderInitial, type ConvexRankIndexBuilder, type ConvexRankIndexBuilderOn, type ConvexSearchIndexBuilder, type ConvexSearchIndexBuilderOn, type ConvexSearchIndexConfig, type ConvexTable, type ConvexTextBuilder, type ConvexTextBuilderInitial, type ConvexTextEnumBuilder, type ConvexTextEnumBuilderInitial, type ConvexTimestampBuilder, type ConvexTimestampBuilderInitial, type ConvexTimestampMode, type ConvexUniqueConstraintBuilder, type ConvexUniqueConstraintBuilderOn, type ConvexUniqueConstraintConfig, type ConvexVectorBuilder, type ConvexVectorBuilderInitial, type ConvexVectorIndexBuilder, type ConvexVectorIndexBuilderOn, type ConvexVectorIndexConfig, type CountBackfillChunkArgs, type CountBackfillKickoffArgs, type CountBackfillStatusArgs, type CountConfig, type CountResult, type CreateOrmOptions, type DBQueryConfig, type DatabaseWithMutations, type DatabaseWithQuery, type DefineSchemaOptions, type DiscriminatorBuilderConfig, type DocByCtx, type DrizzleEntity, type EdgeMetadata, type ExpressionVisitor, type ExtractTablesWithRelations, type FieldReference, type FilterExpression, type FilterOperators, type GenericOrm, type GenericOrmCtx, type GenericSchema, type GetColumnData, type HasDefault, type InferInsertModel, type InferModelFromColumns, type InferSelectModel, type InsertValue, type IsPrimaryKey, type IsUnique, type LogicalExpression, type LookupByIdResultByCtx, type ManyConfig, 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, type MutationExecuteConfig, type MutationExecuteResult, type MutationExecutionMode, type MutationPaginateConfig, type MutationPaginatedResult, type MutationResult, type MutationReturning, type MutationRunMode, type NotNull, type OneConfig, type OrderByClause, type OrderDirection, type OrmApiResult, type OrmBeforeResult, type OrmClientBase, type OrmClientWithApi, type OrmFunctions, type OrmLifecycleChange, type OrmLifecycleOperation, OrmNotFoundError, type OrmReader, type OrmReaderCtx, type OrmSchemaPlugin, OrmSchemaPluginTables, type OrmTableTriggers, type OrmTriggerChange, type OrmTriggerContext, type OrmTriggers, type OrmWriter, type OrmWriterCtx, type PaginatedResult, type PredicateWhereIndexConfig, type QueryCtxWithOptionalOrmQueryTable, type QueryCtxWithOrmQueryTable, type QueryCtxWithPreferredOrmQueryTable, type RelationsBuilder, type RelationsBuilderColumnBase, type RelationsBuilderColumnConfig, type ReturningAll, type ReturningResult, type ReturningSelection, type RlsContext, type RlsMode, RlsPolicy, type RlsPolicyConfig, type RlsPolicyToOption, RlsRole, type RlsRoleConfig, type ScheduledDeleteArgs, type ScheduledMutationBatchArgs, type SchemaDefinition, type SystemFields, type TableConfig, type TableConfigResult, TableName, type TableRelationalConfig, type TablesRelationalConfig, type UnaryExpression, type UpdateSet, type VectorQueryConfig, type VectorSearchProvider, type WhereClauseResult, aggregateIndex, and, arrayOf, asc, between, bigint, boolean, buildMigrationPlan, bytes, check, contains, convexTable, createOrm, custom, date, defineMigration, defineMigrationSet, defineRelations, defineRelationsPart, defineSchema, defineTriggers, deletion, deprecated, desc, detectMigrationDrift, discriminator, endsWith, eq, extractRelationsConfig, fieldRef, foreignKey, getByIdWithOrmQueryFallback, getTableColumns, getTableConfig, gt, gte, id, ilike, inArray, index, integer, isFieldReference, isNotNull, isNull, json, like, lt, lte, ne, not, notBetween, notInArray, objectOf, or, pretend, pretendRequired, rankIndex, rlsPolicy, rlsRole, scheduledDeleteFactory, scheduledMutationBatchFactory, searchIndex, startsWith, text, textEnum, timestamp, unique, uniqueIndex, unsetToken, vector, vectorIndex };
|