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.
Files changed (36) hide show
  1. package/dist/aggregate/index.d.ts +10 -10
  2. package/dist/aggregate/index.js +1 -1
  3. package/dist/auth/index.js +2 -2
  4. package/dist/auth/nextjs/index.d.ts +1 -1
  5. package/dist/{builder-1Vx-tEnS.js → builder-DoeyW4Vq.js} +71 -65
  6. package/dist/cli.mjs +154 -39
  7. package/dist/{customFunctions-BbhgdRGl.js → customFunctions-ivbc6-_g.js} +1 -1
  8. package/dist/{definitions-D9vhJ6OV.js → definitions-Dzk8mSTL.js} +2 -2
  9. package/dist/{extensions-DzjCJXYl.js → extensions-Blzsyekm.js} +1 -1
  10. package/dist/{id-Bibg34Yb.js → id-CuSfWa5q.js} +1 -1
  11. package/dist/{local-env-Du24tdbp.mjs → local-env-Dkh4a_BK.mjs} +1 -0
  12. package/dist/{middleware-cJDRHTRY.js → middleware-DIj-bwVi.js} +1 -1
  13. package/dist/orm/aggregate-index/index.js +3 -3
  14. package/dist/orm/index.d.ts +2 -2
  15. package/dist/orm/index.js +43 -10
  16. package/dist/orm/migrations/index.d.ts +1 -1
  17. package/dist/orm/migrations/index.js +1 -1
  18. package/dist/plugins/index.js +1 -1
  19. package/dist/{procedure-caller-DIzXfX2E.js → procedure-caller-Dxae9DW5.js} +3 -3
  20. package/dist/{procedure-name-B09-cf1-.d.ts → procedure-name-l2YusEZI.d.ts} +55 -52
  21. package/dist/ratelimit/index.js +2 -2
  22. package/dist/{runtime-DfGsZtx3.js → runtime-BdqTbgKh.js} +9 -3
  23. package/dist/{schema-Besl-rpv.js → schema-D8sVYuYO.js} +28 -14
  24. package/dist/server/index.d.ts +1 -1
  25. package/dist/server/index.js +2 -2
  26. package/dist/{table-rmJm5Qio.js → table-CX2lnX7e.js} +1 -1
  27. package/dist/{validators-Dmbhsd3U.js → validators-CIoUYCqO.js} +1 -0
  28. package/dist/{validators-V4eM2-Jg.d.ts → validators-wOIjhkfN.d.ts} +7 -1
  29. package/dist/watcher.mjs +1 -1
  30. package/dist/{where-clause-compiler-mohWFiG0.d.ts → where-clause-compiler-TMNQB6US.d.ts} +103 -56
  31. package/package.json +4 -3
  32. package/skills/kitcn/SKILL.md +1 -1
  33. package/skills/kitcn/references/features/auth-polar.md +2 -2
  34. package/skills/kitcn/references/features/scheduling.md +1 -1
  35. package/skills/kitcn/references/setup/auth.md +1 -1
  36. package/skills/kitcn/references/setup/index.md +3 -3
@@ -1,10 +1,10 @@
1
- import { t as VRequired } from "./validators-V4eM2-Jg.js";
1
+ import { t as VRequired } from "./validators-wOIjhkfN.js";
2
2
  import { A as HttpProcedureBuilderDef, D as HttpHandlerOpts, L as DataTransformerOptions, N as ProcedureMeta, O as HttpMethod, W as getTransformer, _ as CRPCHttpRouter, f as InferHttpInput, k as HttpProcedure, p as InferHttpOutput, y as HttpRouterRecord } from "./http-types-90mapMP9.js";
3
3
  import { g as UnsetMarker, i as IntersectIfDefined, o as MiddlewareBuilder, p as Overwrite$1, s as MiddlewareFunction, t as AnyMiddleware } from "./types-eNzQmbqM.js";
4
4
  import { ConvexError, GenericId, GenericValidator, ObjectType, OptionalProperty, PropertyValidators, VAny, VArray, VBoolean, VBytes, VFloat64, VId, VInt64, VLiteral, VNull, VObject, VOptional, VRecord, VString, VUnion, Validator, Value as Value$1 } from "convex/values";
5
5
  import { ActionBuilder, ArgsArrayToObject, DefaultFunctionArgs, FunctionReference, FunctionReturnType, FunctionVisibility, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, MutationBuilder, QueryBuilder, RegisteredAction, RegisteredMutation, RegisteredQuery, TableNamesInDataModel } from "convex/server";
6
- import { z } from "zod";
7
- import * as z$1 from "zod/v4";
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/index.d.ts
@@ -264,7 +264,7 @@ declare function zCustomAction<CustomArgsValidator extends PropertyValidators, C
264
264
  */
265
265
  declare const zid: <DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel> = TableNamesInDataModel<DataModel>>(tableName: TableName) => Zid<TableName>;
266
266
  /** The type of Convex validators in Zod */
267
- type Zid<TableName extends string> = z$1.ZodCustom<GenericId<TableName>> & zCore.$ZodRecordKey;
267
+ type Zid<TableName extends string> = z$2.ZodCustom<GenericId<TableName>> & zCore.$ZodRecordKey;
268
268
  /**
269
269
  * Useful to get the input context type for a custom function using Zod.
270
270
  */
@@ -490,7 +490,7 @@ declare function withSystemFields<Table extends string, T extends {
490
490
  [key: string]: zCore.$ZodType;
491
491
  }>(tableName: Table, zObject: T): T & {
492
492
  _id: Zid<Table>;
493
- _creationTime: z$1.ZodNumber;
493
+ _creationTime: z$2.ZodNumber;
494
494
  };
495
495
  /**
496
496
  * A builder that customizes a Convex function, whether or not it validates
@@ -534,7 +534,7 @@ type Returns<T> = Promise<NullToUndefinedOrNull<T>> | NullToUndefinedOrNull<T>;
534
534
  type ReturnValueInput<ReturnsValidator extends zCore.$ZodType | ZodFields | void> = [ReturnsValidator] extends [zCore.$ZodType] ? Returns<zCore.input<ReturnsValidator>> : [ReturnsValidator] extends [ZodFields] ? Returns<zCore.input<zCore.$ZodObject<ReturnsValidator>>> : any;
535
535
  type ReturnValueOutput<ReturnsValidator extends zCore.$ZodType | ZodFields | void> = [ReturnsValidator] extends [zCore.$ZodType] ? Returns<zCore.output<ReturnsValidator>> : [ReturnsValidator] extends [ZodFields] ? Returns<zCore.output<zCore.$ZodObject<ReturnsValidator, zCore.$strict>>> : any;
536
536
  type ReturnValueForHandler<ReturnsValidator extends zCore.$ZodType | ZodFields | void, SkipZodReturnsValidation extends boolean> = SkipZodReturnsValidation extends true ? ReturnValueOutput<ReturnsValidator> : ReturnValueInput<ReturnsValidator>;
537
- type ArgsInput<ArgsValidator extends ZodFields | zCore.$ZodObject<any> | void> = [ArgsValidator] extends [zCore.$ZodObject<any>] ? [zCore.input<ArgsValidator>] : ArgsValidator extends Record<string, never> ? [{}] : [ArgsValidator] extends [Record<string, z$1.ZodTypeAny>] ? [zCore.input<zCore.$ZodObject<ArgsValidator, zCore.$strict>>] : OneArgArray;
537
+ type ArgsInput<ArgsValidator extends ZodFields | zCore.$ZodObject<any> | void> = [ArgsValidator] extends [zCore.$ZodObject<any>] ? [zCore.input<ArgsValidator>] : ArgsValidator extends Record<string, never> ? [{}] : [ArgsValidator] extends [Record<string, z$2.ZodTypeAny>] ? [zCore.input<zCore.$ZodObject<ArgsValidator, zCore.$strict>>] : OneArgArray;
538
538
  type ArgsOutput<ArgsValidator extends ZodFields | zCore.$ZodObject<any> | void> = [ArgsValidator] extends [zCore.$ZodObject<any>] ? [zCore.output<ArgsValidator>] : [ArgsValidator] extends [ZodFields] ? [zCore.output<zCore.$ZodObject<ArgsValidator, zCore.$strict>>] : OneArgArray;
539
539
  type Overwrite<T, U> = Omit<T, keyof U> & U;
540
540
  type OneArgArray<ArgsObject extends DefaultFunctionArgs = DefaultFunctionArgs> = [ArgsObject];
@@ -567,11 +567,14 @@ type IsUnknownOrAny<T> = 0 extends 1 & T ? true : unknown extends T ? true : fal
567
567
  * ZodValidatorFromConvex<typeof v.string()> // → z.ZodString
568
568
  * ```
569
569
  */
570
- type ZodValidatorFromConvex<V extends GenericValidator> = V extends Validator<any, 'optional', any> ? z$1.ZodOptional<ZodFromValidatorBase<VRequired<V>>> : ZodFromValidatorBase<V>;
571
- type ZodFromValidatorBase<V extends GenericValidator> = V extends VId<infer Type> ? Zid<TableNameFromType<NotUndefined<Type>>> : V extends VString<infer T> ? BrandIfBranded<T, z$1.ZodString> : V extends VFloat64<infer T> ? BrandIfBranded<T, z$1.ZodNumber> : V extends VInt64<any> ? z$1.ZodBigInt : V extends VBoolean<any> ? z$1.ZodBoolean : V extends VNull<any> ? z$1.ZodNull : V extends VArray<any, infer Element> ? Element extends VArray<any, any> ? z$1.ZodArray<zCore.SomeType> : z$1.ZodArray<ZodFromValidatorBase<Element>> : V extends VObject<any, infer Fields extends Record<string, GenericValidator>> ? z$1.ZodObject<ZodShapeFromConvexObject<Fields>, zCore.$strict> : V extends VBytes<any, any> ? never : V extends VLiteral<infer T extends zCore.util.Literal, OptionalProperty> ? z$1.ZodLiteral<NotUndefined<T>> : V extends VRecord<any, infer Key, infer Value, OptionalProperty, any> ? z$1.ZodRecord<ZodFromStringValidator<Key>, ZodFromValidatorBase<Value>> : V extends VUnion<any, [], OptionalProperty, any> ? z$1.ZodNever : V extends VUnion<any, [infer I extends GenericValidator], OptionalProperty, any> ? ZodValidatorFromConvex<I> : V extends VUnion<any, [infer A extends GenericValidator, ...infer Rest extends GenericValidator[]], OptionalProperty, any> ? z$1.ZodUnion<readonly [ZodValidatorFromConvex<A>, ...{ [K in keyof Rest]: ZodValidatorFromConvex<Rest[K]> }]> : V extends VAny<any, OptionalProperty, any> ? z$1.ZodAny : never;
570
+ type ZodValidatorFromConvex<V extends GenericValidator> = V extends Validator<any, 'optional', any> ? z$2.ZodOptional<ZodFromValidatorBase<VRequired<V>>> : ZodFromValidatorBase<V>;
571
+ type ZodFromValidatorBase<V extends GenericValidator> = V extends VId<infer Type> ? Zid<TableNameFromType<NotUndefined<Type>>> : V extends VString<infer T> ? BrandIfBranded<T, z$2.ZodString> : V extends VFloat64<infer T> ? BrandIfBranded<T, z$2.ZodNumber> : V extends VInt64<any> ? z$2.ZodBigInt : V extends {
572
+ readonly kind: 'commitTs';
573
+ readonly type: infer Type;
574
+ } ? z$2.ZodType<NotUndefined<Type>> : V extends VBoolean<any> ? z$2.ZodBoolean : V extends VNull<any> ? z$2.ZodNull : V extends VArray<any, infer Element> ? Element extends VArray<any, any> ? z$2.ZodArray<zCore.SomeType> : z$2.ZodArray<ZodFromValidatorBase<Element>> : V extends VObject<any, infer Fields extends Record<string, GenericValidator>> ? z$2.ZodObject<ZodShapeFromConvexObject<Fields>, zCore.$strict> : V extends VBytes<any, any> ? never : V extends VLiteral<infer T extends zCore.util.Literal, OptionalProperty> ? z$2.ZodLiteral<NotUndefined<T>> : V extends VRecord<any, infer Key, infer Value, OptionalProperty, any> ? z$2.ZodRecord<ZodFromStringValidator<Key>, ZodFromValidatorBase<Value>> : V extends VUnion<any, [], OptionalProperty, any> ? z$2.ZodNever : V extends VUnion<any, [infer I extends GenericValidator], OptionalProperty, any> ? ZodValidatorFromConvex<I> : V extends VUnion<any, [infer A extends GenericValidator, ...infer Rest extends GenericValidator[]], OptionalProperty, any> ? z$2.ZodUnion<readonly [ZodValidatorFromConvex<A>, ...{ [K in keyof Rest]: ZodValidatorFromConvex<Rest[K]> }]> : V extends VAny<any, OptionalProperty, any> ? z$2.ZodAny : never;
572
575
  type BrandIfBranded<InnerType, Validator extends zCore.SomeType> = InnerType extends zCore.$brand<infer Brand> ? zCore.$ZodBranded<Validator, Brand> : Validator;
573
576
  type StringValidator = Validator<string, 'required', any>;
574
- type ZodFromStringValidator<V extends StringValidator> = V extends VId<GenericId<infer TableName extends string>> ? Zid<TableName> : V extends VString<infer T, any> ? BrandIfBranded<T, z$1.ZodString> : V extends VLiteral<infer Literal extends string> ? z$1.ZodLiteral<Literal> : V extends VUnion<any, [], any, any> ? z$1.ZodNever : V extends VUnion<any, [infer I extends GenericValidator], any, any> ? ZodFromStringValidator<I> : V extends VUnion<any, [infer A extends GenericValidator, ...infer Rest extends GenericValidator[]], any, any> ? z$1.ZodUnion<readonly [ZodFromStringValidator<A>, ...{ [K in keyof Rest]: ZodFromStringValidator<Rest[K]> }]> : never;
577
+ type ZodFromStringValidator<V extends StringValidator> = V extends VId<GenericId<infer TableName extends string>> ? Zid<TableName> : V extends VString<infer T, any> ? BrandIfBranded<T, z$2.ZodString> : V extends VLiteral<infer Literal extends string> ? z$2.ZodLiteral<Literal> : V extends VUnion<any, [], any, any> ? z$2.ZodNever : V extends VUnion<any, [infer I extends GenericValidator], any, any> ? ZodFromStringValidator<I> : V extends VUnion<any, [infer A extends GenericValidator, ...infer Rest extends GenericValidator[]], any, any> ? z$2.ZodUnion<readonly [ZodFromStringValidator<A>, ...{ [K in keyof Rest]: ZodFromStringValidator<Rest[K]> }]> : never;
575
578
  type ZodShapeFromConvexObject<Fields extends Record<string, GenericValidator>> = Fields extends infer F ? { [K in keyof F]: F[K] extends GenericValidator ? ZodValidatorFromConvex<F[K]> : never } : never;
576
579
  type NotUndefined<T> = Exclude<T, undefined>;
577
580
  type TableNameFromType<T> = T extends GenericId<infer TableName> ? TableName : string;
@@ -588,16 +591,16 @@ declare function handleHttpError(error: unknown): Response;
588
591
  * - Factory function creates implementation objects
589
592
  * - This preserves literal types like 'GET' through method chains
590
593
  */
591
- interface HttpProcedureBuilder<TInitialCtx, TCtx, TInput extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TOutput extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TParams extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TQuery extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TMeta extends ProcedureMeta = ProcedureMeta, TMethod extends HttpMethod = HttpMethod, TForm extends UnsetMarker | z.ZodTypeAny = UnsetMarker> {
594
+ interface HttpProcedureBuilder<TInitialCtx, TCtx, TInput extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TOutput extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TParams extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TQuery extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TMeta extends ProcedureMeta = ProcedureMeta, TMethod extends HttpMethod = HttpMethod, TForm extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker> {
592
595
  _def: HttpProcedureBuilderDef<TCtx, TInput, TOutput, TParams, TQuery, TMeta, TMethod, TForm>;
593
596
  /** DELETE endpoint (Hono-style) */
594
597
  delete(path: string): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, 'DELETE', TForm>;
595
598
  /** Define form data schema (for multipart/form-data uploads) */
596
- form<TSchema extends z.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, TMethod, TSchema>;
599
+ form<TSchema extends z$1.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, TMethod, TSchema>;
597
600
  /** GET endpoint (Hono-style) */
598
601
  get(path: string): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, 'GET', TForm>;
599
602
  /** Define request body schema (for POST/PUT/PATCH) */
600
- input<TSchema extends z.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TSchema, TOutput, TParams, TQuery, TMeta, TMethod, TForm>;
603
+ input<TSchema extends z$1.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TSchema, TOutput, TParams, TQuery, TMeta, TMethod, TForm>;
601
604
  /** Set procedure metadata (shallow merged when chained) */
602
605
  meta(value: TMeta): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, TMethod, TForm>;
603
606
  /**
@@ -605,13 +608,13 @@ interface HttpProcedureBuilder<TInitialCtx, TCtx, TInput extends UnsetMarker | z
605
608
  * Handler receives Hono Context `c` for Response helpers (c.json, c.body, c.text).
606
609
  * Return Response for custom responses, or plain object for auto JSON serialization.
607
610
  */
608
- mutation<TResult>(handler: (opts: HttpHandlerOpts<TCtx, TInput, TParams, TQuery, TForm>) => Promise<Response | (TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult)>): HttpProcedure<TInput, TOutput, TParams, TQuery, TMethod, TForm>;
611
+ mutation<TResult>(handler: (opts: HttpHandlerOpts<TCtx, TInput, TParams, TQuery, TForm>) => Promise<Response | (TOutput extends z$1.ZodTypeAny ? z$1.infer<TOutput> : TResult)>): HttpProcedure<TInput, TOutput, TParams, TQuery, TMethod, TForm>;
609
612
  /** Set a server-only procedure name for middleware/logging */
610
613
  name(value: string): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, TMethod, TForm>;
611
614
  /** Define response schema */
612
- output<TSchema extends z.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TSchema, TParams, TQuery, TMeta, TMethod, TForm>;
615
+ output<TSchema extends z$1.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TSchema, TParams, TQuery, TMeta, TMethod, TForm>;
613
616
  /** Define path parameter schema (for :param in path) */
614
- params<TSchema extends z.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TSchema, TQuery, TMeta, TMethod, TForm>;
617
+ params<TSchema extends z$1.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TSchema, TQuery, TMeta, TMethod, TForm>;
615
618
  /** PATCH endpoint (Hono-style) */
616
619
  patch(path: string): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, 'PATCH', TForm>;
617
620
  /** POST endpoint (Hono-style) */
@@ -623,11 +626,11 @@ interface HttpProcedureBuilder<TInitialCtx, TCtx, TInput extends UnsetMarker | z
623
626
  * Handler receives Hono Context `c` for Response helpers (c.json, c.body, c.text).
624
627
  * Return Response for custom responses, or plain object for auto JSON serialization.
625
628
  */
626
- query<TResult>(handler: (opts: HttpHandlerOpts<TCtx, TInput, TParams, TQuery, TForm>) => Promise<Response | (TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult)>): HttpProcedure<TInput, TOutput, TParams, TQuery, TMethod, TForm>;
629
+ query<TResult>(handler: (opts: HttpHandlerOpts<TCtx, TInput, TParams, TQuery, TForm>) => Promise<Response | (TOutput extends z$1.ZodTypeAny ? z$1.infer<TOutput> : TResult)>): HttpProcedure<TInput, TOutput, TParams, TQuery, TMethod, TForm>;
627
630
  /** Define the route path and HTTP method */
628
631
  route<M extends HttpMethod>(path: string, method: M): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TQuery, TMeta, M, TForm>;
629
632
  /** Define query parameter schema (?key=value) */
630
- searchParams<TSchema extends z.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TSchema, TMeta, TMethod, TForm>;
633
+ searchParams<TSchema extends z$1.ZodTypeAny>(schema: TSchema): HttpProcedureBuilder<TInitialCtx, TCtx, TInput, TOutput, TParams, TSchema, TMeta, TMethod, TForm>;
631
634
  /** Add middleware to the procedure */
632
635
  use<$ContextOverridesOut extends object>(middlewareOrBuilder: MiddlewareFunction<TCtx, TMeta, UnsetMarker, $ContextOverridesOut, unknown> | MiddlewareBuilder<any, // Allow reusable middleware with any context
633
636
  TMeta, $ContextOverridesOut, unknown>): HttpProcedureBuilder<TInitialCtx, Overwrite$1<TCtx, $ContextOverridesOut>, TInput, TOutput, TParams, TQuery, TMeta, TMethod, TForm>;
@@ -648,32 +651,32 @@ declare function createHttpProcedureBuilder<TCtx, TMeta extends ProcedureMeta>(c
648
651
  * After .paginated() applies defaults, cursor and limit are always defined.
649
652
  * The actual runtime schema uses .default() and .transform() for validation.
650
653
  */
651
- declare const paginatedSchemaForTypes: z.ZodObject<{
652
- cursor: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
653
- limit: z.ZodNumber;
654
- }, z.core.$strip>;
654
+ declare const paginatedSchemaForTypes: z$1.ZodObject<{
655
+ cursor: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>;
656
+ limit: z$1.ZodNumber;
657
+ }, z$1.core.$strip>;
655
658
  /** Paginated schema type - both cursor and limit are required after .paginated() */
656
659
  type PaginatedInputSchema = typeof paginatedSchemaForTypes;
657
660
  /** Paginated schema type for external callers - both fields are optional due defaults. */
658
- declare const paginatedSchemaForClientTypes: z.ZodObject<{
659
- cursor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
660
- limit: z.ZodOptional<z.ZodNumber>;
661
- }, z.core.$strip>;
661
+ declare const paginatedSchemaForClientTypes: z$1.ZodObject<{
662
+ cursor: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
663
+ limit: z$1.ZodOptional<z$1.ZodNumber>;
664
+ }, z$1.core.$strip>;
662
665
  type PaginatedClientInputSchema = typeof paginatedSchemaForClientTypes;
663
666
  /**
664
667
  * Infer input type from ZodObject schema (for handlers)
665
668
  */
666
- type InferInput<T> = T extends UnsetMarker ? Record<string, never> : T extends z.ZodObject<any> ? z.infer<T> : never;
669
+ type InferInput<T> = T extends UnsetMarker ? Record<string, never> : T extends z$1.ZodObject<any> ? z$1.infer<T> : never;
667
670
  /**
668
671
  * Infer raw client input before defaults/transforms.
669
672
  * Used for generated API arg typing.
670
673
  */
671
- type InferClientInput<T> = T extends UnsetMarker ? Record<string, never> : T extends z.ZodObject<any> ? z.input<T> : never;
674
+ type InferClientInput<T> = T extends UnsetMarker ? Record<string, never> : T extends z$1.ZodObject<any> ? z$1.input<T> : never;
672
675
  /**
673
676
  * Infer input type for middleware (returns unknown for UnsetMarker, matching tRPC)
674
677
  * Middleware before .input() receives unknown input
675
678
  */
676
- type InferMiddlewareInput<T> = T extends UnsetMarker ? unknown : T extends z.ZodObject<any> ? z.infer<T> : unknown;
679
+ type InferMiddlewareInput<T> = T extends UnsetMarker ? unknown : T extends z$1.ZodObject<any> ? z$1.infer<T> : unknown;
677
680
  /**
678
681
  * Static-only type hint attached to cRPC exports.
679
682
  *
@@ -753,8 +756,8 @@ type ProcedureBuilderDef<TMeta = object> = {
753
756
  * (`.refine()`, `.superRefine()`, strict/catchall) only survive on the
754
757
  * schema itself.
755
758
  */
756
- inputSchemas: z.ZodObject<any>[];
757
- outputSchema?: z.ZodTypeAny;
759
+ inputSchemas: z$1.ZodObject<any>[];
760
+ outputSchema?: z$1.ZodTypeAny;
758
761
  meta?: TMeta;
759
762
  procedureName?: string;
760
763
  functionConfig: InternalFunctionConfig; /** Whether this procedure uses internal function (not exposed to clients) */
@@ -770,15 +773,15 @@ type ProcedureBuilderDef<TMeta = object> = {
770
773
  * @typeParam TOutput - Output schema (starts as UnsetMarker)
771
774
  * @typeParam TMeta - Procedure metadata type
772
775
  */
773
- declare class ProcedureBuilder<TBaseCtx, _TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z.ZodObject<any> = UnsetMarker, TOutput extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TMeta extends object = object> {
776
+ declare class ProcedureBuilder<TBaseCtx, _TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z$1.ZodObject<any> = UnsetMarker, TOutput extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TMeta extends object = object> {
774
777
  protected readonly _def: ProcedureBuilderDef<TMeta>;
775
778
  constructor(def: ProcedureBuilderDef<TMeta>);
776
779
  /** Add middleware that transforms the context - to be overridden by subclasses */
777
780
  protected _use<$ContextOverridesOut>(middlewareOrBuilder: MiddlewareFunction<TBaseCtx, TMeta, TContextOverrides, $ContextOverridesOut> | MiddlewareBuilder<TBaseCtx, TMeta, $ContextOverridesOut>): ProcedureBuilderDef<TMeta>;
778
781
  /** Define input schema (chainable - schemas are merged) - to be overridden by subclasses */
779
- protected _input<TNewInput extends z.ZodObject<any>>(schema: TNewInput): ProcedureBuilderDef<TMeta>;
782
+ protected _input<TNewInput extends z$1.ZodObject<any>>(schema: TNewInput): ProcedureBuilderDef<TMeta>;
780
783
  /** Define output schema - to be overridden by subclasses */
781
- protected _output<TNewOutput extends z.ZodTypeAny>(schema: TNewOutput): ProcedureBuilderDef<TMeta>;
784
+ protected _output<TNewOutput extends z$1.ZodTypeAny>(schema: TNewOutput): ProcedureBuilderDef<TMeta>;
782
785
  /** Set procedure metadata (shallow merged when chained) - to be overridden by subclasses */
783
786
  protected _meta(value: TMeta): ProcedureBuilderDef<TMeta>;
784
787
  /** Set server-only procedure name for middleware/logging */
@@ -791,7 +794,7 @@ declare class ProcedureBuilder<TBaseCtx, _TContext, TContextOverrides extends Un
791
794
  * Query-specific procedure builder
792
795
  * Only exposes .query() and .internalQuery() methods
793
796
  */
794
- declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z.ZodObject<any> = UnsetMarker, TClientInput extends UnsetMarker | z.ZodObject<any> = TInput, TOutput extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TMeta extends object = object> extends ProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta> {
797
+ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z$1.ZodObject<any> = UnsetMarker, TClientInput extends UnsetMarker | z$1.ZodObject<any> = TInput, TOutput extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TMeta extends object = object> extends ProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta> {
795
798
  /**
796
799
  * Add middleware that transforms the context
797
800
  * Middleware receives typed input if called after .input(), unknown otherwise
@@ -804,7 +807,7 @@ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extend
804
807
  /** Set a server-only procedure name for middleware/logging */
805
808
  name(value: string): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TClientInput, TOutput, TMeta>;
806
809
  /** Define input schema (chainable - schemas are merged) */
807
- input<TNewInput extends z.ZodObject<any>>(schema: TNewInput): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, TNewInput>, IntersectIfDefined<TClientInput, TNewInput>, TOutput, TMeta>;
810
+ input<TNewInput extends z$1.ZodObject<any>>(schema: TNewInput): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, TNewInput>, IntersectIfDefined<TClientInput, TNewInput>, TOutput, TMeta>;
808
811
  /**
809
812
  * Add pagination input (chainable before .query())
810
813
  *
@@ -814,21 +817,21 @@ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extend
814
817
  * @param opts.limit - Default/max items per page
815
818
  * @param opts.item - Zod schema for each item in the page array
816
819
  */
817
- paginated<TItem extends z.ZodTypeAny>(opts: {
820
+ paginated<TItem extends z$1.ZodTypeAny>(opts: {
818
821
  limit: number;
819
822
  item: TItem;
820
- }): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, PaginatedInputSchema>, IntersectIfDefined<TClientInput, PaginatedClientInputSchema>, z.ZodObject<{
821
- continueCursor: z.ZodUnion<[z.ZodString, z.ZodNull]>;
822
- isDone: z.ZodBoolean;
823
- page: z.ZodArray<TItem>;
823
+ }): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, PaginatedInputSchema>, IntersectIfDefined<TClientInput, PaginatedClientInputSchema>, z$1.ZodObject<{
824
+ continueCursor: z$1.ZodUnion<[z$1.ZodString, z$1.ZodNull]>;
825
+ isDone: z$1.ZodBoolean;
826
+ page: z$1.ZodArray<TItem>;
824
827
  }>, TMeta>;
825
828
  /** Define output schema */
826
- output<TNewOutput extends z.ZodTypeAny>(schema: TNewOutput): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TClientInput, TNewOutput, TMeta>;
829
+ output<TNewOutput extends z$1.ZodTypeAny>(schema: TNewOutput): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TClientInput, TNewOutput, TMeta>;
827
830
  /** Create a query */
828
831
  query<TResult>(handler: (opts: {
829
832
  ctx: Overwrite$1<TContext, TContextOverrides>;
830
833
  input: InferInput<TInput>;
831
- }) => Promise<TOutput extends z.ZodTypeAny ? z.input<TOutput> : TResult>): Record<string, unknown> & CRPCFunctionTypeHint<InferClientInput<TClientInput>, TOutput extends z.ZodTypeAny ? z.output<TOutput> : TResult>;
834
+ }) => Promise<TOutput extends z$1.ZodTypeAny ? z$1.input<TOutput> : TResult>): Record<string, unknown> & CRPCFunctionTypeHint<InferClientInput<TClientInput>, TOutput extends z$1.ZodTypeAny ? z$1.output<TOutput> : TResult>;
832
835
  /** Mark as internal - returns chainable builder using internal function */
833
836
  internal(): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TClientInput, TOutput, TMeta>;
834
837
  }
@@ -836,7 +839,7 @@ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extend
836
839
  * Mutation-specific procedure builder
837
840
  * Only exposes .mutation() and .internalMutation() methods
838
841
  */
839
- declare class MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z.ZodObject<any> = UnsetMarker, TOutput extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TMeta extends object = object> extends ProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta> {
842
+ declare class MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z$1.ZodObject<any> = UnsetMarker, TOutput extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TMeta extends object = object> extends ProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta> {
840
843
  /**
841
844
  * Add middleware that transforms the context
842
845
  * Middleware receives typed input if called after .input(), unknown otherwise
@@ -849,14 +852,14 @@ declare class MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides ext
849
852
  /** Set a server-only procedure name for middleware/logging */
850
853
  name(value: string): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
851
854
  /** Define input schema (chainable - schemas are merged) */
852
- input<TNewInput extends z.ZodObject<any>>(schema: TNewInput): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, TNewInput>, TOutput, TMeta>;
855
+ input<TNewInput extends z$1.ZodObject<any>>(schema: TNewInput): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, TNewInput>, TOutput, TMeta>;
853
856
  /** Define output schema */
854
- output<TNewOutput extends z.ZodTypeAny>(schema: TNewOutput): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TNewOutput, TMeta>;
857
+ output<TNewOutput extends z$1.ZodTypeAny>(schema: TNewOutput): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TNewOutput, TMeta>;
855
858
  /** Create a mutation */
856
859
  mutation<TResult>(handler: (opts: {
857
860
  ctx: Overwrite$1<TContext, TContextOverrides>;
858
861
  input: InferInput<TInput>;
859
- }) => Promise<TOutput extends z.ZodTypeAny ? z.input<TOutput> : TResult>): Record<string, unknown> & CRPCFunctionTypeHint<InferClientInput<TInput>, TOutput extends z.ZodTypeAny ? z.output<TOutput> : TResult>;
862
+ }) => Promise<TOutput extends z$1.ZodTypeAny ? z$1.input<TOutput> : TResult>): Record<string, unknown> & CRPCFunctionTypeHint<InferClientInput<TInput>, TOutput extends z$1.ZodTypeAny ? z$1.output<TOutput> : TResult>;
860
863
  /** Mark as internal - returns chainable builder using internal function */
861
864
  internal(): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
862
865
  }
@@ -864,7 +867,7 @@ declare class MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides ext
864
867
  * Action-specific procedure builder
865
868
  * Only exposes .action() and .internalAction() methods
866
869
  */
867
- declare class ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z.ZodObject<any> = UnsetMarker, TOutput extends UnsetMarker | z.ZodTypeAny = UnsetMarker, TMeta extends object = object> extends ProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta> {
870
+ declare class ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends UnsetMarker | object = UnsetMarker, TInput extends UnsetMarker | z$1.ZodObject<any> = UnsetMarker, TOutput extends UnsetMarker | z$1.ZodTypeAny = UnsetMarker, TMeta extends object = object> extends ProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta> {
868
871
  /** Add middleware that transforms the context - $ContextOverridesOut is inferred from next() */
869
872
  use<$ContextOverridesOut extends object>(middlewareOrBuilder: MiddlewareFunction<Overwrite$1<TContext, TContextOverrides>, TMeta, TContextOverrides, $ContextOverridesOut, InferMiddlewareInput<TInput>> | MiddlewareBuilder<any, // Allow reusable middleware with any context
870
873
  TMeta, $ContextOverridesOut, InferMiddlewareInput<TInput>>): ActionProcedureBuilder<TBaseCtx, TContext, Overwrite$1<TContextOverrides, $ContextOverridesOut>, TInput, TOutput, TMeta>;
@@ -873,14 +876,14 @@ declare class ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides exten
873
876
  /** Set a server-only procedure name for middleware/logging */
874
877
  name(value: string): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
875
878
  /** Define input schema (chainable - schemas are merged) */
876
- input<TNewInput extends z.ZodObject<any>>(schema: TNewInput): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, TNewInput>, TOutput, TMeta>;
879
+ input<TNewInput extends z$1.ZodObject<any>>(schema: TNewInput): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, IntersectIfDefined<TInput, TNewInput>, TOutput, TMeta>;
877
880
  /** Define output schema */
878
- output<TNewOutput extends z.ZodTypeAny>(schema: TNewOutput): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TNewOutput, TMeta>;
881
+ output<TNewOutput extends z$1.ZodTypeAny>(schema: TNewOutput): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TNewOutput, TMeta>;
879
882
  /** Create an action */
880
883
  action<TResult>(handler: (opts: {
881
884
  ctx: Overwrite$1<TContext, TContextOverrides>;
882
885
  input: InferInput<TInput>;
883
- }) => Promise<TOutput extends z.ZodTypeAny ? z.input<TOutput> : TResult>): Record<string, unknown> & CRPCFunctionTypeHint<InferClientInput<TInput>, TOutput extends z.ZodTypeAny ? z.output<TOutput> : TResult>;
886
+ }) => Promise<TOutput extends z$1.ZodTypeAny ? z$1.input<TOutput> : TResult>): Record<string, unknown> & CRPCFunctionTypeHint<InferClientInput<TInput>, TOutput extends z$1.ZodTypeAny ? z$1.output<TOutput> : TResult>;
884
887
  /** Mark as internal - returns chainable builder using internal function */
885
888
  internal(): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
886
889
  }
@@ -1130,14 +1133,14 @@ declare function createCallerFactory<TApi extends Record<string, unknown>>(opts:
1130
1133
  //#endregion
1131
1134
  //#region src/server/env.d.ts
1132
1135
  type RuntimeEnv = Record<string, string | undefined>;
1133
- type CreateEnvOptions<TSchema extends z.ZodObject<z.ZodRawShape>> = {
1136
+ type CreateEnvOptions<TSchema extends z$1.ZodObject<z$1.ZodRawShape>> = {
1134
1137
  cache?: boolean;
1135
1138
  codegenFallback?: boolean;
1136
1139
  readOptionalRuntimeEnv?: readonly string[];
1137
1140
  runtimeEnv?: RuntimeEnv;
1138
1141
  schema: TSchema;
1139
1142
  };
1140
- declare function createEnv<TSchema extends z.ZodObject<z.ZodRawShape>>(options: CreateEnvOptions<TSchema>): () => z.infer<TSchema>;
1143
+ declare function createEnv<TSchema extends z$1.ZodObject<z$1.ZodRawShape>>(options: CreateEnvOptions<TSchema>): () => z$1.infer<TSchema>;
1141
1144
  //#endregion
1142
1145
  //#region src/server/error.d.ts
1143
1146
  /** JSON-RPC 2.0 error codes (tRPC-style) */
@@ -1,6 +1,6 @@
1
1
  import { u as requireMutationCtx } from "../api-entry-CkDpGYVg.js";
2
- import { _ as CRPCError } from "../builder-1Vx-tEnS.js";
3
- import { t as definePlugin } from "../middleware-cJDRHTRY.js";
2
+ import { _ as CRPCError } from "../builder-DoeyW4Vq.js";
3
+ import { t as definePlugin } from "../middleware-DIj-bwVi.js";
4
4
  import { v } from "convex/values";
5
5
  import { mutationGeneric, queryGeneric } from "convex/server";
6
6
 
@@ -1,8 +1,11 @@
1
- import { A as integer, C as index, M as custom, O as text, t as convexTable } from "./table-rmJm5Qio.js";
2
- import { t as id } from "./id-Bibg34Yb.js";
1
+ import { A as integer, C as index, M as custom, O as text, t as convexTable } from "./table-CX2lnX7e.js";
2
+ import { t as id } from "./id-CuSfWa5q.js";
3
3
  import { ConvexError, convexToJson, jsonToConvex, v } from "convex/values";
4
4
 
5
5
  //#region src/aggregate-core/compare.ts
6
+ function isCommitTsPlaceholder(value) {
7
+ return Object.getPrototypeOf(value)?.constructor?.name === "CommitTsPlaceholder";
8
+ }
6
9
  function compareValues$1(k1, k2) {
7
10
  return compareAsTuples(makeComparable(k1), makeComparable(k2));
8
11
  }
@@ -35,7 +38,10 @@ function makeComparable(v) {
35
38
  if (typeof v === "string") return [5, v];
36
39
  if (v instanceof ArrayBuffer) return [6, Array.from(new Uint8Array(v)).map(makeComparable)];
37
40
  if (Array.isArray(v)) return [7, v.map(makeComparable)];
38
- return [8, Object.keys(v).sort().map((k) => [k, v[k]]).map(makeComparable)];
41
+ if (isCommitTsPlaceholder(v)) throw new Error("Commit timestamp placeholders cannot be compared before commit.");
42
+ const keys = Object.keys(v).sort();
43
+ const record = v;
44
+ return [8, keys.map((k) => [k, record[k]]).map(makeComparable)];
39
45
  }
40
46
 
41
47
  //#endregion
@@ -1,7 +1,7 @@
1
- import { A as integer, C as index, N as json, O as text, P as objectOf, _ as TableDeleteConfig, a as Columns, j as arrayOf, s as OrmContext, t as convexTable, v as TableName, y as TablePolymorphic } from "./table-rmJm5Qio.js";
2
- import { t as id } from "./id-Bibg34Yb.js";
1
+ import { A as integer, C as index, N as json, O as text, P as objectOf, _ as TableDeleteConfig, a as Columns, j as arrayOf, s as OrmContext, t as convexTable, v as TableName, y as TablePolymorphic } from "./table-CX2lnX7e.js";
2
+ import { t as id } from "./id-CuSfWa5q.js";
3
3
  import { C as matchLikePattern, _ as isFieldReference, d as filterValueInList, f as filterValuesEqual, u as fieldRef } from "./filter-expression-Dydt8wS0.js";
4
- import { t as defineSchemaExtension } from "./extensions-DzjCJXYl.js";
4
+ import { t as defineSchemaExtension } from "./extensions-Blzsyekm.js";
5
5
 
6
6
  //#region src/orm/timestamp-mode.ts
7
7
  const PUBLIC_CREATED_AT_FIELD = "createdAt";
@@ -92,21 +92,21 @@ function findRelationIndex(table, columns, relationName, targetTableName, strict
92
92
  }
93
93
 
94
94
  //#endregion
95
- //#region src/orm/write-fanout.ts
95
+ //#region src/internal/concurrency.ts
96
96
  /**
97
- * Shared primitives for fanning out independent writes.
97
+ * Bounded-concurrency fan-out, shared by the ORM write path, relation loading
98
+ * and the CLI's entry-point analyzer.
98
99
  *
99
- * Deliberately dependency-free: `mutation-utils`, `lifecycle` and `query` all
100
- * import it, and Convex bundles every static import of a function entry.
100
+ * Deliberately dependency-free: ORM callers reach it from a Convex function
101
+ * entry, and Convex bundles every static import of an entry.
101
102
  */
102
- const ORMLIFECYCLE_HOOKED_TABLES = Symbol.for("kitcn:OrmLifecycleHookedTables");
103
- /** Matches the ORM's relation-loading default. */
104
- const DEFAULT_WRITE_FANOUT_CONCURRENCY = 25;
105
103
  /**
106
104
  * Runs `worker` over `items` with at most `limit` in flight. Results keep input
107
- * order. Unbounded `Promise.all` is not an option here: a fan-out is bounded
108
- * only by `mutationMaxRows` (10,000), and that many simultaneous in-flight
109
- * syscalls is its own failure mode.
105
+ * order, so callers can rely on a stable mapping back to `items`.
106
+ *
107
+ * Unbounded `Promise.all` is not an option for the ORM caller: a fan-out is
108
+ * bounded only by `mutationMaxRows` (10,000), and that many simultaneous
109
+ * in-flight syscalls is its own failure mode.
110
110
  */
111
111
  async function mapWithConcurrency(items, limit, worker) {
112
112
  if (items.length === 0) return [];
@@ -124,6 +124,20 @@ async function mapWithConcurrency(items, limit, worker) {
124
124
  await Promise.all(Array.from({ length: width }, () => runWorker()));
125
125
  return results;
126
126
  }
127
+
128
+ //#endregion
129
+ //#region src/orm/write-fanout.ts
130
+ /**
131
+ * Lifecycle bookkeeping for the ORM write path.
132
+ *
133
+ * Deliberately dependency-free: `mutation-utils`, `lifecycle` and `query` all
134
+ * import it, and Convex bundles every static import of a function entry. The
135
+ * bounded fan-out primitive itself lives in `internal/concurrency` so the CLI
136
+ * can share it without dragging this module in.
137
+ */
138
+ const ORMLIFECYCLE_HOOKED_TABLES = Symbol.for("kitcn:OrmLifecycleHookedTables");
139
+ /** Matches the ORM's relation-loading default. */
140
+ const DEFAULT_WRITE_FANOUT_CONCURRENCY = 25;
127
141
  /**
128
142
  * Records which tables the lifecycle writer intercepts, so write fan-out can
129
143
  * see it without importing `lifecycle` (which would close an import cycle
@@ -1408,4 +1422,4 @@ function aggregateExtension() {
1408
1422
  }
1409
1423
 
1410
1424
  //#endregion
1411
- export { serializeFilterExpression as $, ensureNonNullValues as A, getMutationExecutionMode as B, deserializeFilterExpression as C, enforcePolymorphicWrite as D, enforceForeignKeys as E, getChecks as F, getUniqueIndexes as G, getTableColumns as H, getColumnName as I, normalizeDateFieldsForWrite as J, hardDeleteRow as K, getForeignKeys as L, evaluateCheckConstraintTriState as M, evaluateFilter as N, enforceUniqueIndexes as O, extractPrimaryIdLookup as P, selectReturningRowWithHydration as Q, getMutationAsyncDelayMs as R, decodeUndefinedDeep as S, enforceCheckConstraints as T, getTableDeleteConfig as U, getOrmContext as V, getTableName as W, patchReferencingRows as X, normalizeTemporalComparableValue as Y, resolveOrmRuntimeDefaults as Z, applyIncomingForeignKeyActionsOnUpdate as _, usesSystemCreatedAtAlias as _t, aggregateExtension as a, markLifecycleHookedTables as at, collectMutationRowsBounded as b, AGGREGATE_ERROR as c, findSearchIndexByName as ct, createCountError as d, getIndexes as dt, softDeleteRow as et, createError as f, getRankIndexes as ft, applyIncomingForeignKeyActionsOnDelete as g, PUBLIC_CREATED_AT_FIELD as gt, applyDefaults as h, INTERNAL_CREATION_TIME_FIELD as ht, AGGREGATE_STATE_TABLE as i, mapWithConcurrency as it, ensureNullableColumns as j, ensureDefaultColumns as k, COUNT_ERROR as l, findVectorIndexByName as lt, ensureCountAllowedForRls as m, CREATED_AT_MIGRATION_MESSAGE as mt, AGGREGATE_EXTREMA_TABLE as n, takeRowsWithinByteBudget as nt, getAggregateIndexDefinitions as o, findIndexForColumns as ot, ensureAggregateAllowedForRls as p, resolveIndexOrderPushdown as pt, hydrateDateFieldsForRead as q, AGGREGATE_MEMBER_TABLE as r, toConvexFilter as rt, getRankIndexDefinitions as s, findRelationIndex as st, AGGREGATE_BUCKET_TABLE as t, splitReturningSelection as tt, createAggregateError as u, getAggregateIndexes as ut, buildForeignKeyGraph as v, encodeUndefinedDeep as w, collectPrimaryIdLookupRows as x, canUsePrimaryIdLookupCursor as y, getMutationCollectionLimits as z };
1425
+ export { serializeFilterExpression as $, ensureNonNullValues as A, getMutationExecutionMode as B, deserializeFilterExpression as C, enforcePolymorphicWrite as D, enforceForeignKeys as E, getChecks as F, getUniqueIndexes as G, getTableColumns as H, getColumnName as I, normalizeDateFieldsForWrite as J, hardDeleteRow as K, getForeignKeys as L, evaluateCheckConstraintTriState as M, evaluateFilter as N, enforceUniqueIndexes as O, extractPrimaryIdLookup as P, selectReturningRowWithHydration as Q, getMutationAsyncDelayMs as R, decodeUndefinedDeep as S, enforceCheckConstraints as T, getTableDeleteConfig as U, getOrmContext as V, getTableName as W, patchReferencingRows as X, normalizeTemporalComparableValue as Y, resolveOrmRuntimeDefaults as Z, applyIncomingForeignKeyActionsOnUpdate as _, PUBLIC_CREATED_AT_FIELD as _t, aggregateExtension as a, markLifecycleHookedTables as at, collectMutationRowsBounded as b, AGGREGATE_ERROR as c, findRelationIndex as ct, createCountError as d, getAggregateIndexes as dt, softDeleteRow as et, createError as f, getIndexes as ft, applyIncomingForeignKeyActionsOnDelete as g, INTERNAL_CREATION_TIME_FIELD as gt, applyDefaults as h, CREATED_AT_MIGRATION_MESSAGE as ht, AGGREGATE_STATE_TABLE as i, hasLifecycleHooks as it, ensureNullableColumns as j, ensureDefaultColumns as k, COUNT_ERROR as l, findSearchIndexByName as lt, ensureCountAllowedForRls as m, resolveIndexOrderPushdown as mt, AGGREGATE_EXTREMA_TABLE as n, takeRowsWithinByteBudget as nt, getAggregateIndexDefinitions as o, mapWithConcurrency as ot, ensureAggregateAllowedForRls as p, getRankIndexes as pt, hydrateDateFieldsForRead as q, AGGREGATE_MEMBER_TABLE as r, toConvexFilter as rt, getRankIndexDefinitions as s, findIndexForColumns as st, AGGREGATE_BUCKET_TABLE as t, splitReturningSelection as tt, createAggregateError as u, findVectorIndexByName as ut, buildForeignKeyGraph as v, usesSystemCreatedAtAlias as vt, encodeUndefinedDeep as w, collectPrimaryIdLookupRows as x, canUsePrimaryIdLookupCursor as y, getMutationCollectionLimits as z };
@@ -1,4 +1,4 @@
1
- import { $ as ActionProcedureBuilder, A as CRPCError, B as RuntimeEnv, C as createProcedureHandlerFactory, Ct as zCustomQuery, D as WithHttpRouter, Dt as zodToConvex, E as typedProcedureResolver, Et as zodOutputToConvexFields, F as getCRPCErrorFromUnknown, G as createLazyCaller, H as ConvexContext, I as getHTTPStatusCodeFromError, J as ServerCaller, K as CallerMeta, L as isCRPCError, M as CRPCErrorData, N as CRPC_ERROR_CODES_BY_KEY, O as inferApiInputs, Ot as zodToConvexFields, P as CRPC_ERROR_CODE_TO_HTTP, Q as getGeneratedValue, R as toCRPCError, S as createProcedureCallerFactory, St as zCustomMutation, T as getGeneratedFunctionReference, Tt as zodOutputToConvex, U as createCallerFactory, V as createEnv, W as LazyCaller, X as createApiLeaf, Y as createServerCaller, Z as createGeneratedFunctionReference, _ as ProcedureSchedulableCallerFromRegistry, _t as ZodValidatorFromConvex, a as CreateProcedureCallerFactoryOptions, at as initCRPC, b as createGenericCallerFactory, bt as withSystemFields, c as GeneratedRegistryCallerFactory, ct as extractPathParams, d as GeneratedRegistryHandlerForContext, dt as ConvexValidatorFromZod, et as CRPCFunctionTypeHint, f as ProcedureActionCallerFromRegistry, ft as ConvexValidatorFromZodOutput, g as ProcedureFromFunctionReference, gt as ZodFromValidatorBase, h as ProcedureDefinition, ht as Zid, i as registerProcedureNameLookup, it as createMiddlewareFactory, j as CRPCErrorCode, k as inferApiOutputs, l as GeneratedRegistryCallerForContext, lt as handleHttpError, m as ProcedureCallerFromRegistry, mt as ZCustomCtx, n as ProcedureNameLookup, nt as ProcedureBuilder, o as GeneratedProcedureRegistry, ot as HttpProcedureBuilder, p as ProcedureCaller, pt as CustomBuilder, q as CallerOpts, r as inferProcedureNameFromCallsite, rt as QueryProcedureBuilder, s as GeneratedProcedureRegistryEntry, st as createHttpProcedureBuilder, t as ProcedureNameEntry, tt as MutationProcedureBuilder, u as GeneratedRegistryHandlerFactory, ut as matchPathParams, v as ProcedureScheduleCallerFromRegistry, vt as convexToZod, w as defineProcedure, wt as zid, x as createGenericHandlerFactory, xt as zCustomAction, y as createGeneratedRegistryRuntime, yt as convexToZodFields, z as CreateEnvOptions } from "../procedure-name-B09-cf1-.js";
1
+ import { $ as ActionProcedureBuilder, A as CRPCError, B as RuntimeEnv, C as createProcedureHandlerFactory, Ct as zCustomQuery, D as WithHttpRouter, Dt as zodToConvex, E as typedProcedureResolver, Et as zodOutputToConvexFields, F as getCRPCErrorFromUnknown, G as createLazyCaller, H as ConvexContext, I as getHTTPStatusCodeFromError, J as ServerCaller, K as CallerMeta, L as isCRPCError, M as CRPCErrorData, N as CRPC_ERROR_CODES_BY_KEY, O as inferApiInputs, Ot as zodToConvexFields, P as CRPC_ERROR_CODE_TO_HTTP, Q as getGeneratedValue, R as toCRPCError, S as createProcedureCallerFactory, St as zCustomMutation, T as getGeneratedFunctionReference, Tt as zodOutputToConvex, U as createCallerFactory, V as createEnv, W as LazyCaller, X as createApiLeaf, Y as createServerCaller, Z as createGeneratedFunctionReference, _ as ProcedureSchedulableCallerFromRegistry, _t as ZodValidatorFromConvex, a as CreateProcedureCallerFactoryOptions, at as initCRPC, b as createGenericCallerFactory, bt as withSystemFields, c as GeneratedRegistryCallerFactory, ct as extractPathParams, d as GeneratedRegistryHandlerForContext, dt as ConvexValidatorFromZod, et as CRPCFunctionTypeHint, f as ProcedureActionCallerFromRegistry, ft as ConvexValidatorFromZodOutput, g as ProcedureFromFunctionReference, gt as ZodFromValidatorBase, h as ProcedureDefinition, ht as Zid, i as registerProcedureNameLookup, it as createMiddlewareFactory, j as CRPCErrorCode, k as inferApiOutputs, l as GeneratedRegistryCallerForContext, lt as handleHttpError, m as ProcedureCallerFromRegistry, mt as ZCustomCtx, n as ProcedureNameLookup, nt as ProcedureBuilder, o as GeneratedProcedureRegistry, ot as HttpProcedureBuilder, p as ProcedureCaller, pt as CustomBuilder, q as CallerOpts, r as inferProcedureNameFromCallsite, rt as QueryProcedureBuilder, s as GeneratedProcedureRegistryEntry, st as createHttpProcedureBuilder, t as ProcedureNameEntry, tt as MutationProcedureBuilder, u as GeneratedRegistryHandlerFactory, ut as matchPathParams, v as ProcedureScheduleCallerFromRegistry, vt as convexToZod, w as defineProcedure, wt as zid, x as createGenericHandlerFactory, xt as zCustomAction, y as createGeneratedRegistryRuntime, yt as convexToZodFields, z as CreateEnvOptions } from "../procedure-name-l2YusEZI.js";
2
2
  import { A as HttpProcedureBuilderDef, C as extractRouteMap, D as HttpHandlerOpts, E as HttpActionHandler, M as InferHttpInput, N as ProcedureMeta, O as HttpMethod, S as createHttpRouterFactory, T as HttpActionConstructor, _ as CRPCHttpRouter, b as HttpRouterWithHono, j as HttpRouteDefinition, k as HttpProcedure, v as HttpRouterDef, w as CRPCHonoHandler, x as createHttpRouter, y as HttpRouterRecord } from "../http-types-90mapMP9.js";
3
3
  import { a as MergeZodObjects, c as MiddlewareMarker, d as MiddlewareProcedureType, f as MiddlewareResult, g as UnsetMarker, h as Simplify, i as IntersectIfDefined, l as MiddlewareNext, m as ResolveIfSet, n as AnyMiddlewareBuilder, o as MiddlewareBuilder, p as Overwrite, r as GetRawInputFn, s as MiddlewareFunction, t as AnyMiddleware, u as MiddlewareProcedureInfo } from "../types-eNzQmbqM.js";
4
4
  import { a as isMutationCtx, c as isSchedulerCtx, d as requireQueryCtx, f as requireRunMutationCtx, i as isActionCtx, l as requireActionCtx, n as RunMutationCtx, o as isQueryCtx, p as requireSchedulerCtx, r as SchedulerCtx, s as isRunMutationCtx, t as GenericCtx, u as requireMutationCtx } from "../context-utils-DwZ3Cam1.js";
@@ -1,6 +1,6 @@
1
1
  import { a as isMutationCtx, c as isSchedulerCtx, d as requireQueryCtx, f as requireRunMutationCtx, i as isActionCtx, l as requireActionCtx, n as createGeneratedFunctionReference, o as isQueryCtx, p as requireSchedulerCtx, r as getGeneratedValue, s as isRunMutationCtx, t as createApiLeaf, u as requireMutationCtx } from "../api-entry-CkDpGYVg.js";
2
2
  import { n as createLazyCaller, r as createServerCaller, t as createCallerFactory } from "../caller-factory-Dd3H7j3V.js";
3
- import { A as zid, C as toCRPCError, D as zCustomAction, E as withSystemFields, M as zodOutputToConvexFields, N as zodToConvex, O as zCustomMutation, P as zodToConvexFields, S as isCRPCError, T as convexToZodFields, _ as CRPCError, a as createMiddlewareFactory, b as getCRPCErrorFromUnknown, c as registerProcedureNameLookup, d as createHttpRouterFactory, f as extractRouteMap, g as matchPathParams, h as handleHttpError, i as QueryProcedureBuilder, j as zodOutputToConvex, k as zCustomQuery, l as HttpRouterWithHono, m as extractPathParams, n as MutationProcedureBuilder, o as initCRPC, p as createHttpProcedureBuilder, r as ProcedureBuilder, s as inferProcedureNameFromCallsite, t as ActionProcedureBuilder, u as createHttpRouter, v as CRPC_ERROR_CODES_BY_KEY, w as convexToZod, x as getHTTPStatusCodeFromError, y as CRPC_ERROR_CODE_TO_HTTP } from "../builder-1Vx-tEnS.js";
4
- import { a as createProcedureHandlerFactory, c as typedProcedureResolver, i as createProcedureCallerFactory, l as createEnv, n as createGenericCallerFactory, o as defineProcedure, r as createGenericHandlerFactory, s as getGeneratedFunctionReference, t as createGeneratedRegistryRuntime } from "../procedure-caller-DIzXfX2E.js";
3
+ import { A as zid, C as toCRPCError, D as zCustomAction, E as withSystemFields, M as zodOutputToConvexFields, N as zodToConvex, O as zCustomMutation, P as zodToConvexFields, S as isCRPCError, T as convexToZodFields, _ as CRPCError, a as createMiddlewareFactory, b as getCRPCErrorFromUnknown, c as registerProcedureNameLookup, d as createHttpRouterFactory, f as extractRouteMap, g as matchPathParams, h as handleHttpError, i as QueryProcedureBuilder, j as zodOutputToConvex, k as zCustomQuery, l as HttpRouterWithHono, m as extractPathParams, n as MutationProcedureBuilder, o as initCRPC, p as createHttpProcedureBuilder, r as ProcedureBuilder, s as inferProcedureNameFromCallsite, t as ActionProcedureBuilder, u as createHttpRouter, v as CRPC_ERROR_CODES_BY_KEY, w as convexToZod, x as getHTTPStatusCodeFromError, y as CRPC_ERROR_CODE_TO_HTTP } from "../builder-DoeyW4Vq.js";
4
+ import { a as createProcedureHandlerFactory, c as typedProcedureResolver, i as createProcedureCallerFactory, l as createEnv, n as createGenericCallerFactory, o as defineProcedure, r as createGenericHandlerFactory, s as getGeneratedFunctionReference, t as createGeneratedRegistryRuntime } from "../procedure-caller-Dxae9DW5.js";
5
5
 
6
6
  export { ActionProcedureBuilder, CRPCError, CRPC_ERROR_CODES_BY_KEY, CRPC_ERROR_CODE_TO_HTTP, HttpRouterWithHono, MutationProcedureBuilder, ProcedureBuilder, QueryProcedureBuilder, convexToZod, convexToZodFields, createApiLeaf, createCallerFactory, createEnv, createGeneratedFunctionReference, createGeneratedRegistryRuntime, createGenericCallerFactory, createGenericHandlerFactory, createHttpProcedureBuilder, createHttpRouter, createHttpRouterFactory, createLazyCaller, createMiddlewareFactory, createProcedureCallerFactory, createProcedureHandlerFactory, createServerCaller, defineProcedure, extractPathParams, extractRouteMap, getCRPCErrorFromUnknown, getGeneratedFunctionReference, getGeneratedValue, getHTTPStatusCodeFromError, handleHttpError, inferProcedureNameFromCallsite, initCRPC, isActionCtx, isCRPCError, isMutationCtx, isQueryCtx, isRunMutationCtx, isSchedulerCtx, matchPathParams, registerProcedureNameLookup, requireActionCtx, requireMutationCtx, requireQueryCtx, requireRunMutationCtx, requireSchedulerCtx, toCRPCError, typedProcedureResolver, withSystemFields, zCustomAction, zCustomMutation, zCustomQuery, zid, zodOutputToConvex, zodOutputToConvexFields, zodToConvex, zodToConvexFields };
@@ -1,4 +1,4 @@
1
- import { o as vRequired } from "./validators-Dmbhsd3U.js";
1
+ import { o as vRequired } from "./validators-CIoUYCqO.js";
2
2
  import { v } from "convex/values";
3
3
 
4
4
  //#region src/orm/builders/column-builder.ts
@@ -180,6 +180,7 @@ function vRequired(validator) {
180
180
  case "string": return v.string();
181
181
  case "float64": return v.float64();
182
182
  case "int64": return v.int64();
183
+ case "commitTs": return v.commitTs();
183
184
  case "boolean": return v.boolean();
184
185
  case "null": return v.null();
185
186
  case "any": return v.any();
@@ -83,6 +83,12 @@ type NotUndefined<T> = Exclude<T, undefined>;
83
83
  * type RequiredString = VRequired<OptionalString>; // VString<string, "required">
84
84
  * ```
85
85
  */
86
- type VRequired<T extends Validator<any, OptionalProperty, any>> = T extends VId<infer Type, OptionalProperty> ? VId<NotUndefined<Type>, 'required'> : T extends VString<infer Type, OptionalProperty> ? VString<NotUndefined<Type>, 'required'> : T extends VFloat64<infer Type, OptionalProperty> ? VFloat64<NotUndefined<Type>, 'required'> : T extends VInt64<infer Type, OptionalProperty> ? VInt64<NotUndefined<Type>, 'required'> : T extends VBoolean<infer Type, OptionalProperty> ? VBoolean<NotUndefined<Type>, 'required'> : T extends VNull<infer Type, OptionalProperty> ? VNull<NotUndefined<Type>, 'required'> : T extends VAny<infer Type, OptionalProperty> ? VAny<NotUndefined<Type>, 'required'> : T extends VLiteral<infer Type, OptionalProperty> ? VLiteral<NotUndefined<Type>, 'required'> : T extends VBytes<infer Type, OptionalProperty> ? VBytes<NotUndefined<Type>, 'required'> : T extends VObject<infer Type, infer Fields, OptionalProperty, infer FieldPaths> ? VObject<NotUndefined<Type>, Fields, 'required', FieldPaths> : T extends VArray<infer Type, infer Element, OptionalProperty> ? VArray<NotUndefined<Type>, Element, 'required'> : T extends VRecord<infer Type, infer Key, infer Value, OptionalProperty, infer FieldPaths> ? VRecord<NotUndefined<Type>, Key, Value, 'required', FieldPaths> : T extends VUnion<infer Type, infer Members, OptionalProperty, infer FieldPaths> ? VUnion<NotUndefined<Type>, Members, 'required', FieldPaths> : never;
86
+ type VRequired<T extends Validator<any, OptionalProperty, any>> = T extends VId<infer Type, OptionalProperty> ? VId<NotUndefined<Type>, 'required'> : T extends VString<infer Type, OptionalProperty> ? VString<NotUndefined<Type>, 'required'> : T extends VFloat64<infer Type, OptionalProperty> ? VFloat64<NotUndefined<Type>, 'required'> : T extends VInt64<infer Type, OptionalProperty> ? VInt64<NotUndefined<Type>, 'required'> : T extends {
87
+ readonly kind: 'commitTs';
88
+ readonly type: infer Type;
89
+ } ? Omit<T, 'isOptional' | 'type'> & {
90
+ readonly isOptional: 'required';
91
+ readonly type: NotUndefined<Type>;
92
+ } : T extends VBoolean<infer Type, OptionalProperty> ? VBoolean<NotUndefined<Type>, 'required'> : T extends VNull<infer Type, OptionalProperty> ? VNull<NotUndefined<Type>, 'required'> : T extends VAny<infer Type, OptionalProperty> ? VAny<NotUndefined<Type>, 'required'> : T extends VLiteral<infer Type, OptionalProperty> ? VLiteral<NotUndefined<Type>, 'required'> : T extends VBytes<infer Type, OptionalProperty> ? VBytes<NotUndefined<Type>, 'required'> : T extends VObject<infer Type, infer Fields, OptionalProperty, infer FieldPaths> ? VObject<NotUndefined<Type>, Fields, 'required', FieldPaths> : T extends VArray<infer Type, infer Element, OptionalProperty> ? VArray<NotUndefined<Type>, Element, 'required'> : T extends VRecord<infer Type, infer Key, infer Value, OptionalProperty, infer FieldPaths> ? VRecord<NotUndefined<Type>, Key, Value, 'required', FieldPaths> : T extends VUnion<infer Type, infer Members, OptionalProperty, infer FieldPaths> ? VUnion<NotUndefined<Type>, Members, 'required', FieldPaths> : never;
87
93
  //#endregion
88
94
  export { pretendRequired as i, deprecated as n, pretend as r, VRequired as t };
package/dist/watcher.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as generateMeta, d as PARSE_SNAPSHOT_SUFFIX, i as resolveConfiguredBackend, n as withLocalCodegenEnv, o as getConvexConfig, r as loadCliConfig, u as logger } from "./local-env-Du24tdbp.mjs";
2
+ import { a as generateMeta, d as PARSE_SNAPSHOT_SUFFIX, i as resolveConfiguredBackend, n as withLocalCodegenEnv, o as getConvexConfig, r as loadCliConfig, u as logger } from "./local-env-Dkh4a_BK.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5