kitcn 0.25.0 → 0.25.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/dist/aggregate/index.d.ts +10 -10
- package/dist/aggregate/index.js +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/auth/nextjs/index.d.ts +1 -1
- package/dist/{builder-1Vx-tEnS.js → builder-DoeyW4Vq.js} +71 -65
- package/dist/cli.mjs +154 -39
- package/dist/{customFunctions-BbhgdRGl.js → customFunctions-ivbc6-_g.js} +1 -1
- package/dist/{definitions-D9vhJ6OV.js → definitions-Dzk8mSTL.js} +2 -2
- package/dist/{extensions-DzjCJXYl.js → extensions-Blzsyekm.js} +1 -1
- package/dist/{id-Bibg34Yb.js → id-CuSfWa5q.js} +1 -1
- package/dist/{local-env-Du24tdbp.mjs → local-env-Dkh4a_BK.mjs} +1 -0
- package/dist/{middleware-cJDRHTRY.js → middleware-DIj-bwVi.js} +1 -1
- package/dist/orm/aggregate-index/index.js +3 -3
- package/dist/orm/index.d.ts +2 -2
- package/dist/orm/index.js +43 -10
- package/dist/orm/migrations/index.d.ts +1 -1
- package/dist/orm/migrations/index.js +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/{procedure-caller-DIzXfX2E.js → procedure-caller-Dxae9DW5.js} +3 -3
- package/dist/{procedure-name-B09-cf1-.d.ts → procedure-name-l2YusEZI.d.ts} +55 -52
- package/dist/ratelimit/index.js +2 -2
- package/dist/{runtime-DfGsZtx3.js → runtime-BdqTbgKh.js} +9 -3
- package/dist/{schema-Besl-rpv.js → schema-D8sVYuYO.js} +28 -14
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -2
- package/dist/{table-rmJm5Qio.js → table-CX2lnX7e.js} +1 -1
- package/dist/{validators-Dmbhsd3U.js → validators-CIoUYCqO.js} +1 -0
- package/dist/{validators-V4eM2-Jg.d.ts → validators-wOIjhkfN.d.ts} +7 -1
- package/dist/watcher.mjs +1 -1
- package/dist/{where-clause-compiler-mohWFiG0.d.ts → where-clause-compiler-TMNQB6US.d.ts} +103 -56
- package/package.json +4 -3
- package/skills/kitcn/SKILL.md +1 -1
- package/skills/kitcn/references/features/auth-polar.md +2 -2
- package/skills/kitcn/references/features/scheduling.md +1 -1
- package/skills/kitcn/references/setup/auth.md +1 -1
- package/skills/kitcn/references/setup/index.md +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-Bem7xvGK.js";
|
|
2
|
-
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-
|
|
2
|
+
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-TMNQB6US.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";
|
|
@@ -82,6 +82,15 @@ declare const aggregateStorageTables: {
|
|
|
82
82
|
fieldName: "aggregateName";
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
+
deletionStack: ConvexCustomBuilderInitial<"", convex_values0.VArray<convex_values0.GenericId<"aggregate_rank_node">[], convex_values0.VId<convex_values0.GenericId<"aggregate_rank_node">, "required">, "required">> & {
|
|
86
|
+
_: {
|
|
87
|
+
tableName: "aggregate_rank_tree";
|
|
88
|
+
};
|
|
89
|
+
} & {
|
|
90
|
+
_: {
|
|
91
|
+
fieldName: "deletionStack";
|
|
92
|
+
};
|
|
93
|
+
};
|
|
85
94
|
maxNodeSize: ConvexNumberBuilderInitial<""> & {
|
|
86
95
|
_: {
|
|
87
96
|
notNull: true;
|
|
@@ -117,15 +126,6 @@ declare const aggregateStorageTables: {
|
|
|
117
126
|
fieldName: "root";
|
|
118
127
|
};
|
|
119
128
|
};
|
|
120
|
-
deletionStack: ConvexCustomBuilderInitial<"", convex_values0.VArray<convex_values0.GenericId<"aggregate_rank_node">[], convex_values0.VId<convex_values0.GenericId<"aggregate_rank_node">, "required">, "required">> & {
|
|
121
|
-
_: {
|
|
122
|
-
tableName: "aggregate_rank_tree";
|
|
123
|
-
};
|
|
124
|
-
} & {
|
|
125
|
-
_: {
|
|
126
|
-
fieldName: "deletionStack";
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
129
|
};
|
|
130
130
|
}, {
|
|
131
131
|
by_creation_time: ["_creationTime"];
|
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-BdqTbgKh.js";
|
|
2
2
|
|
|
3
3
|
//#region src/aggregate/index.ts
|
|
4
4
|
const wrapTriggerFactory = (methodName, factory) => ((...args) => {
|
package/dist/auth/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as asyncMap } from "../upstream-BCgGZX6q.js";
|
|
2
|
-
import { r as partial } from "../validators-
|
|
2
|
+
import { r as partial } from "../validators-CIoUYCqO.js";
|
|
3
3
|
import { i as defineAuth, n as createDisabledAuthRuntime, r as getGeneratedAuthDisabledReason, t as DEFAULT_AUTH_DEFINITION_PATH } from "../generated-contract-disabled-CZa0iyV0.js";
|
|
4
4
|
import { n as createGeneratedFunctionReference, o as isQueryCtx, s as isRunMutationCtx } from "../api-entry-CkDpGYVg.js";
|
|
5
|
-
import { n as customCtx, r as customMutation } from "../customFunctions-
|
|
5
|
+
import { n as customCtx, r as customMutation } from "../customFunctions-ivbc6-_g.js";
|
|
6
6
|
import { l as eq } from "../filter-expression-Dydt8wS0.js";
|
|
7
7
|
import { o as mergedStream, s as stream, t as getByIdWithOrmQueryFallback, u as unsetToken } from "../query-context-DOm5Xm3H.js";
|
|
8
8
|
import { n as convex } from "../convex-plugin-DfOhBU9g.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as ConvexContext, W as LazyCaller } from "../../procedure-name-
|
|
1
|
+
import { H as ConvexContext, W as LazyCaller } from "../../procedure-name-l2YusEZI.js";
|
|
2
2
|
import { t as GetTokenOptions } from "../../token-kQaqFby4.js";
|
|
3
3
|
|
|
4
4
|
//#region src/auth-nextjs/index.d.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as vRequired, t as addFieldsToValidator } from "./validators-
|
|
2
|
-
import { n as customCtx, t as NoOp } from "./customFunctions-
|
|
1
|
+
import { o as vRequired, t as addFieldsToValidator } from "./validators-CIoUYCqO.js";
|
|
2
|
+
import { n as customCtx, t as NoOp } from "./customFunctions-ivbc6-_g.js";
|
|
3
3
|
import { s as getTransformer } from "./transformer-D8wO-kEj.js";
|
|
4
4
|
import { ConvexError, v } from "convex/values";
|
|
5
5
|
import { HttpRouter, actionGeneric, httpActionGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, mutationGeneric, queryGeneric } from "convex/server";
|
|
6
|
-
import
|
|
7
|
-
import * as z$
|
|
6
|
+
import * as z$1 from "zod";
|
|
7
|
+
import * as z$2 from "zod/v4";
|
|
8
8
|
import * as zCore from "zod/v4/core";
|
|
9
9
|
|
|
10
10
|
//#region src/internal/upstream/server/zod4.ts
|
|
@@ -190,7 +190,7 @@ function zCustomAction(action, customization) {
|
|
|
190
190
|
* @returns A Zod schema representing a Convex `Id`
|
|
191
191
|
*/
|
|
192
192
|
const zid = (tableName) => {
|
|
193
|
-
const result = z$
|
|
193
|
+
const result = z$2.custom((val) => typeof val === "string");
|
|
194
194
|
_zidRegistry.add(result, { tableName });
|
|
195
195
|
return result;
|
|
196
196
|
};
|
|
@@ -386,6 +386,9 @@ function zodToConvexFields(fields) {
|
|
|
386
386
|
function zodOutputToConvexFields(fields) {
|
|
387
387
|
return Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, zodOutputToConvex(v)]));
|
|
388
388
|
}
|
|
389
|
+
function isCommitTsPlaceholder(value) {
|
|
390
|
+
return typeof value === "object" && value !== null && Object.getPrototypeOf(value)?.constructor?.name === "CommitTsPlaceholder";
|
|
391
|
+
}
|
|
389
392
|
/**
|
|
390
393
|
* Turns a Convex validator into a Zod validator.
|
|
391
394
|
*
|
|
@@ -410,32 +413,35 @@ function convexToZod(convexValidator) {
|
|
|
410
413
|
zodValidator = zid(convexValidator.tableName);
|
|
411
414
|
break;
|
|
412
415
|
case "string":
|
|
413
|
-
zodValidator = z$
|
|
416
|
+
zodValidator = z$2.string();
|
|
414
417
|
break;
|
|
415
418
|
case "float64":
|
|
416
|
-
zodValidator = z$
|
|
419
|
+
zodValidator = z$2.number();
|
|
417
420
|
break;
|
|
418
421
|
case "int64":
|
|
419
|
-
zodValidator = z$
|
|
422
|
+
zodValidator = z$2.bigint();
|
|
423
|
+
break;
|
|
424
|
+
case "commitTs":
|
|
425
|
+
zodValidator = z$2.union([z$2.bigint(), z$2.custom(isCommitTsPlaceholder)]);
|
|
420
426
|
break;
|
|
421
427
|
case "boolean":
|
|
422
|
-
zodValidator = z$
|
|
428
|
+
zodValidator = z$2.boolean();
|
|
423
429
|
break;
|
|
424
430
|
case "null":
|
|
425
|
-
zodValidator = z$
|
|
431
|
+
zodValidator = z$2.null();
|
|
426
432
|
break;
|
|
427
433
|
case "any":
|
|
428
|
-
zodValidator = z$
|
|
434
|
+
zodValidator = z$2.any();
|
|
429
435
|
break;
|
|
430
436
|
case "array":
|
|
431
|
-
zodValidator = z$
|
|
437
|
+
zodValidator = z$2.array(convexToZod(convexValidator.element));
|
|
432
438
|
break;
|
|
433
439
|
case "object":
|
|
434
|
-
zodValidator = z$
|
|
440
|
+
zodValidator = z$2.object(convexToZodFields(convexValidator.fields));
|
|
435
441
|
break;
|
|
436
442
|
case "union": {
|
|
437
443
|
if (convexValidator.members.length === 0) {
|
|
438
|
-
zodValidator = z$
|
|
444
|
+
zodValidator = z$2.never();
|
|
439
445
|
break;
|
|
440
446
|
}
|
|
441
447
|
if (convexValidator.members.length === 1) {
|
|
@@ -443,21 +449,21 @@ function convexToZod(convexValidator) {
|
|
|
443
449
|
break;
|
|
444
450
|
}
|
|
445
451
|
const memberValidators = convexValidator.members.map((member) => convexToZod(member));
|
|
446
|
-
zodValidator = z$
|
|
452
|
+
zodValidator = z$2.union([...memberValidators]);
|
|
447
453
|
break;
|
|
448
454
|
}
|
|
449
455
|
case "literal": {
|
|
450
456
|
const literalValidator = convexValidator;
|
|
451
|
-
zodValidator = z$
|
|
457
|
+
zodValidator = z$2.literal(literalValidator.value);
|
|
452
458
|
break;
|
|
453
459
|
}
|
|
454
460
|
case "record":
|
|
455
|
-
zodValidator = z$
|
|
461
|
+
zodValidator = z$2.record(convexToZod(convexValidator.key), convexToZod(convexValidator.value));
|
|
456
462
|
break;
|
|
457
463
|
case "bytes": throw new Error("v.bytes() is not supported");
|
|
458
464
|
default: throw new Error(`Unknown convex validator type: ${kind}`);
|
|
459
465
|
}
|
|
460
|
-
return isOptional ? z$
|
|
466
|
+
return isOptional ? z$2.optional(zodValidator) : zodValidator;
|
|
461
467
|
}
|
|
462
468
|
/**
|
|
463
469
|
* Like {@link convexToZod}, but it takes in a bare object, as expected by Convex
|
|
@@ -497,7 +503,7 @@ function withSystemFields(tableName, zObject) {
|
|
|
497
503
|
return {
|
|
498
504
|
...zObject,
|
|
499
505
|
_id: zid(tableName),
|
|
500
|
-
_creationTime: z$
|
|
506
|
+
_creationTime: z$2.number()
|
|
501
507
|
};
|
|
502
508
|
}
|
|
503
509
|
/**
|
|
@@ -517,7 +523,7 @@ function customFnBuilder(builder, customization) {
|
|
|
517
523
|
const inputArgs = customization.args ?? NoOp.args;
|
|
518
524
|
return function customBuilder(fn) {
|
|
519
525
|
const { args, handler = fn, skipConvexValidation = false, skipZodReturnsValidation = false, returns: maybeObject, ...extra } = fn;
|
|
520
|
-
const returns = maybeObject && !(maybeObject instanceof zCore.$ZodType) ? z$
|
|
526
|
+
const returns = maybeObject && !(maybeObject instanceof zCore.$ZodType) ? z$2.object(maybeObject) : maybeObject;
|
|
521
527
|
const returnValidator = returns && !skipConvexValidation ? { returns: zodOutputToConvex(returns) } : null;
|
|
522
528
|
const parseReturns = returns && !skipZodReturnsValidation ? (value) => returns.parseAsync(value === void 0 ? null : value) : null;
|
|
523
529
|
if (args) {
|
|
@@ -535,7 +541,7 @@ function customFnBuilder(builder, customization) {
|
|
|
535
541
|
handler: async (ctx, allArgs) => {
|
|
536
542
|
const added = await customInput(ctx, inputArgKeys.length === 0 ? {} : pickKeys(allArgs, inputArgKeySet), extra);
|
|
537
543
|
const rawArgs = pickKeys(allArgs, argKeySet);
|
|
538
|
-
argsSchema ??= z$
|
|
544
|
+
argsSchema ??= z$2.object(argsValidator);
|
|
539
545
|
const parsed = await argsSchema.safeParseAsync(rawArgs);
|
|
540
546
|
if (!parsed.success) throw new ConvexError({ ZodError: JSON.parse(JSON.stringify(parsed.error.issues, null, 2)) });
|
|
541
547
|
const args = parsed.data;
|
|
@@ -984,8 +990,8 @@ async function readFormDataBody(request) {
|
|
|
984
990
|
}
|
|
985
991
|
}
|
|
986
992
|
function getBaseSchema(schema) {
|
|
987
|
-
if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable) return getBaseSchema(schema.unwrap());
|
|
988
|
-
if (schema instanceof z.ZodDefault) return getBaseSchema(schema._def.innerType);
|
|
993
|
+
if (schema instanceof z$1.ZodOptional || schema instanceof z$1.ZodNullable) return getBaseSchema(schema.unwrap());
|
|
994
|
+
if (schema instanceof z$1.ZodDefault) return getBaseSchema(schema._def.innerType);
|
|
989
995
|
return schema;
|
|
990
996
|
}
|
|
991
997
|
/**
|
|
@@ -1001,12 +1007,12 @@ function getBaseSchema(schema) {
|
|
|
1001
1007
|
*/
|
|
1002
1008
|
function buildQueryCoercion(schema) {
|
|
1003
1009
|
const coercion = /* @__PURE__ */ new Map();
|
|
1004
|
-
if (!(schema instanceof z.ZodObject)) return coercion;
|
|
1010
|
+
if (!(schema instanceof z$1.ZodObject)) return coercion;
|
|
1005
1011
|
for (const [key, fieldSchema] of Object.entries(schema.shape)) {
|
|
1006
1012
|
const base = getBaseSchema(fieldSchema);
|
|
1007
|
-
if (base instanceof z.ZodArray) coercion.set(key, "array");
|
|
1008
|
-
else if (base instanceof z.ZodNumber) coercion.set(key, "number");
|
|
1009
|
-
else if (base instanceof z.ZodBoolean) coercion.set(key, "boolean");
|
|
1013
|
+
if (base instanceof z$1.ZodArray) coercion.set(key, "array");
|
|
1014
|
+
else if (base instanceof z$1.ZodNumber) coercion.set(key, "number");
|
|
1015
|
+
else if (base instanceof z$1.ZodBoolean) coercion.set(key, "boolean");
|
|
1010
1016
|
}
|
|
1011
1017
|
return coercion;
|
|
1012
1018
|
}
|
|
@@ -1077,7 +1083,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1077
1083
|
if (def.paramsSchema) try {
|
|
1078
1084
|
parsedParams = def.paramsSchema.parse(pathParams);
|
|
1079
1085
|
} catch (error) {
|
|
1080
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1086
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1081
1087
|
code: "BAD_REQUEST",
|
|
1082
1088
|
message: "Invalid path params",
|
|
1083
1089
|
cause: error
|
|
@@ -1090,7 +1096,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1090
1096
|
try {
|
|
1091
1097
|
parsedQuery = def.querySchema.parse(queryParams);
|
|
1092
1098
|
} catch (error) {
|
|
1093
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1099
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1094
1100
|
code: "BAD_REQUEST",
|
|
1095
1101
|
message: "Invalid query params",
|
|
1096
1102
|
cause: error
|
|
@@ -1110,7 +1116,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1110
1116
|
try {
|
|
1111
1117
|
parsedInput = def.inputSchema.parse(def.functionConfig.transformer.input.deserialize(body));
|
|
1112
1118
|
} catch (error) {
|
|
1113
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1119
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1114
1120
|
code: "BAD_REQUEST",
|
|
1115
1121
|
message: "Invalid input",
|
|
1116
1122
|
cause: error
|
|
@@ -1126,7 +1132,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1126
1132
|
try {
|
|
1127
1133
|
parsedForm = def.formSchema.parse(formObj);
|
|
1128
1134
|
} catch (error) {
|
|
1129
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1135
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1130
1136
|
code: "BAD_REQUEST",
|
|
1131
1137
|
message: "Invalid form data",
|
|
1132
1138
|
cause: error
|
|
@@ -1592,13 +1598,13 @@ function inferProcedureNameFromCallsite() {
|
|
|
1592
1598
|
*
|
|
1593
1599
|
* Core library - no project-specific dependencies
|
|
1594
1600
|
*/
|
|
1595
|
-
z.object({
|
|
1596
|
-
cursor: z.union([z.string(), z.null()]),
|
|
1597
|
-
limit: z.number()
|
|
1601
|
+
z$1.object({
|
|
1602
|
+
cursor: z$1.union([z$1.string(), z$1.null()]),
|
|
1603
|
+
limit: z$1.number()
|
|
1598
1604
|
});
|
|
1599
|
-
z.object({
|
|
1600
|
-
cursor: z.union([z.string(), z.null()]).optional(),
|
|
1601
|
-
limit: z.number().optional()
|
|
1605
|
+
z$1.object({
|
|
1606
|
+
cursor: z$1.union([z$1.string(), z$1.null()]).optional(),
|
|
1607
|
+
limit: z$1.number().optional()
|
|
1602
1608
|
});
|
|
1603
1609
|
/**
|
|
1604
1610
|
* Create a middleware factory for building reusable middleware chains
|
|
@@ -1725,32 +1731,32 @@ const withConvexSafeRunners = (ctx) => {
|
|
|
1725
1731
|
return changed ? wrappedContext : contextObject;
|
|
1726
1732
|
};
|
|
1727
1733
|
const replaceUnencodableOutputTypes = (schema) => {
|
|
1728
|
-
if (schema instanceof z.ZodDate) return z.any();
|
|
1729
|
-
if (schema instanceof z.ZodArray) return z.array(replaceUnencodableOutputTypes(schema.element));
|
|
1730
|
-
if (schema instanceof z.ZodObject) {
|
|
1734
|
+
if (schema instanceof z$1.ZodDate) return z$1.any();
|
|
1735
|
+
if (schema instanceof z$1.ZodArray) return z$1.array(replaceUnencodableOutputTypes(schema.element));
|
|
1736
|
+
if (schema instanceof z$1.ZodObject) {
|
|
1731
1737
|
const nextShape = {};
|
|
1732
1738
|
for (const [key, value] of Object.entries(schema.shape)) nextShape[key] = replaceUnencodableOutputTypes(value);
|
|
1733
|
-
return z.object(nextShape);
|
|
1739
|
+
return z$1.object(nextShape);
|
|
1734
1740
|
}
|
|
1735
|
-
if (schema instanceof z.ZodUnion) return z.union(schema.options.map((option) => replaceUnencodableOutputTypes(option)));
|
|
1736
|
-
if (schema instanceof z.ZodOptional) return replaceUnencodableOutputTypes(schema.unwrap()).optional();
|
|
1737
|
-
if (schema instanceof z.ZodNullable) return replaceUnencodableOutputTypes(schema.unwrap()).nullable();
|
|
1738
|
-
if (schema instanceof z.ZodRecord) return z.record(schema.keyType, replaceUnencodableOutputTypes(schema.valueType));
|
|
1741
|
+
if (schema instanceof z$1.ZodUnion) return z$1.union(schema.options.map((option) => replaceUnencodableOutputTypes(option)));
|
|
1742
|
+
if (schema instanceof z$1.ZodOptional) return replaceUnencodableOutputTypes(schema.unwrap()).optional();
|
|
1743
|
+
if (schema instanceof z$1.ZodNullable) return replaceUnencodableOutputTypes(schema.unwrap()).nullable();
|
|
1744
|
+
if (schema instanceof z$1.ZodRecord) return z$1.record(schema.keyType, replaceUnencodableOutputTypes(schema.valueType));
|
|
1739
1745
|
return schema;
|
|
1740
1746
|
};
|
|
1741
1747
|
const replaceUnencodableInputTypes = (schema) => {
|
|
1742
|
-
if (schema instanceof z.ZodDate) return z.any();
|
|
1743
|
-
if (schema instanceof z.ZodArray) return z.array(replaceUnencodableInputTypes(schema.element));
|
|
1744
|
-
if (schema instanceof z.ZodObject) {
|
|
1748
|
+
if (schema instanceof z$1.ZodDate) return z$1.any();
|
|
1749
|
+
if (schema instanceof z$1.ZodArray) return z$1.array(replaceUnencodableInputTypes(schema.element));
|
|
1750
|
+
if (schema instanceof z$1.ZodObject) {
|
|
1745
1751
|
const nextShape = {};
|
|
1746
1752
|
for (const [key, value] of Object.entries(schema.shape)) nextShape[key] = replaceUnencodableInputTypes(value);
|
|
1747
|
-
return z.object(nextShape);
|
|
1753
|
+
return z$1.object(nextShape);
|
|
1748
1754
|
}
|
|
1749
|
-
if (schema instanceof z.ZodUnion) return z.union(schema.options.map((option) => replaceUnencodableInputTypes(option)));
|
|
1750
|
-
if (schema instanceof z.ZodOptional) return replaceUnencodableInputTypes(schema.unwrap()).optional();
|
|
1751
|
-
if (schema instanceof z.ZodNullable) return replaceUnencodableInputTypes(schema.unwrap()).nullable();
|
|
1752
|
-
if (schema instanceof z.ZodRecord) return z.record(schema.keyType, replaceUnencodableInputTypes(schema.valueType));
|
|
1753
|
-
if (schema instanceof z.ZodDefault) return replaceUnencodableInputTypes(schema.removeDefault());
|
|
1755
|
+
if (schema instanceof z$1.ZodUnion) return z$1.union(schema.options.map((option) => replaceUnencodableInputTypes(option)));
|
|
1756
|
+
if (schema instanceof z$1.ZodOptional) return replaceUnencodableInputTypes(schema.unwrap()).optional();
|
|
1757
|
+
if (schema instanceof z$1.ZodNullable) return replaceUnencodableInputTypes(schema.unwrap()).nullable();
|
|
1758
|
+
if (schema instanceof z$1.ZodRecord) return z$1.record(schema.keyType, replaceUnencodableInputTypes(schema.valueType));
|
|
1759
|
+
if (schema instanceof z$1.ZodDefault) return replaceUnencodableInputTypes(schema.removeDefault());
|
|
1754
1760
|
return schema;
|
|
1755
1761
|
};
|
|
1756
1762
|
/**
|
|
@@ -1770,11 +1776,11 @@ const resolveConvexArgsShape = (inputShape) => {
|
|
|
1770
1776
|
try {
|
|
1771
1777
|
return toWireShape(inputShape);
|
|
1772
1778
|
} catch {
|
|
1773
|
-
const compatibleSchema = replaceUnencodableInputTypes(z.object(inputShape));
|
|
1779
|
+
const compatibleSchema = replaceUnencodableInputTypes(z$1.object(inputShape));
|
|
1774
1780
|
try {
|
|
1775
1781
|
return toWireShape(compatibleSchema.shape);
|
|
1776
1782
|
} catch {
|
|
1777
|
-
return Object.fromEntries(Object.keys(inputShape).map((key) => [key, z.any()]));
|
|
1783
|
+
return Object.fromEntries(Object.keys(inputShape).map((key) => [key, z$1.any()]));
|
|
1778
1784
|
}
|
|
1779
1785
|
}
|
|
1780
1786
|
};
|
|
@@ -1789,7 +1795,7 @@ const resolveConvexArgsShape = (inputShape) => {
|
|
|
1789
1795
|
const relaxSupersededKeys = (schema, superseded) => {
|
|
1790
1796
|
if (superseded.length === 0) return schema;
|
|
1791
1797
|
try {
|
|
1792
|
-
return schema.safeExtend(Object.fromEntries(superseded.map((key) => [key, z.any()])));
|
|
1798
|
+
return schema.safeExtend(Object.fromEntries(superseded.map((key) => [key, z$1.any()])));
|
|
1793
1799
|
} catch {
|
|
1794
1800
|
return schema;
|
|
1795
1801
|
}
|
|
@@ -1846,7 +1852,7 @@ const parseInput = (plan, value) => {
|
|
|
1846
1852
|
}
|
|
1847
1853
|
return parsed;
|
|
1848
1854
|
} catch (cause) {
|
|
1849
|
-
if (cause instanceof z.ZodError) throw new ConvexError({ ZodError: JSON.parse(JSON.stringify(cause.issues, null, 2)) });
|
|
1855
|
+
if (cause instanceof z$1.ZodError) throw new ConvexError({ ZodError: JSON.parse(JSON.stringify(cause.issues, null, 2)) });
|
|
1850
1856
|
throw cause;
|
|
1851
1857
|
}
|
|
1852
1858
|
};
|
|
@@ -2005,14 +2011,14 @@ var QueryProcedureBuilder = class QueryProcedureBuilder extends ProcedureBuilder
|
|
|
2005
2011
|
* @param opts.item - Zod schema for each item in the page array
|
|
2006
2012
|
*/
|
|
2007
2013
|
paginated(opts) {
|
|
2008
|
-
const paginationSchemaWithDefault = z.object({
|
|
2009
|
-
cursor: z.union([z.string(), z.null()]).default(null),
|
|
2010
|
-
limit: z.number().default(opts.limit).transform((n) => Math.min(n, opts.limit))
|
|
2014
|
+
const paginationSchemaWithDefault = z$1.object({
|
|
2015
|
+
cursor: z$1.union([z$1.string(), z$1.null()]).default(null),
|
|
2016
|
+
limit: z$1.number().default(opts.limit).transform((n) => Math.min(n, opts.limit))
|
|
2011
2017
|
});
|
|
2012
|
-
const outputSchema = z.object({
|
|
2013
|
-
continueCursor: z.union([z.string(), z.null()]),
|
|
2014
|
-
isDone: z.boolean(),
|
|
2015
|
-
page: z.array(opts.item)
|
|
2018
|
+
const outputSchema = z$1.object({
|
|
2019
|
+
continueCursor: z$1.union([z$1.string(), z$1.null()]),
|
|
2020
|
+
isDone: z$1.boolean(),
|
|
2021
|
+
page: z$1.array(opts.item)
|
|
2016
2022
|
});
|
|
2017
2023
|
return new QueryProcedureBuilder({
|
|
2018
2024
|
...this._def,
|