@confect/core 10.0.0-next.1 → 10.0.0-next.11

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 (61) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/dist/FunctionProvenance.d.ts +74 -3
  3. package/dist/FunctionProvenance.d.ts.map +1 -1
  4. package/dist/FunctionProvenance.js +44 -4
  5. package/dist/FunctionProvenance.js.map +1 -1
  6. package/dist/FunctionSpec.d.ts +42 -9
  7. package/dist/FunctionSpec.d.ts.map +1 -1
  8. package/dist/FunctionSpec.js +17 -4
  9. package/dist/FunctionSpec.js.map +1 -1
  10. package/dist/GenericId.js +2 -3
  11. package/dist/GenericId.js.map +1 -1
  12. package/dist/GroupPath.js +1 -2
  13. package/dist/GroupSpec.js +1 -2
  14. package/dist/GroupSpec.js.map +1 -1
  15. package/dist/Identifier.js +3 -4
  16. package/dist/Identifier.js.map +1 -1
  17. package/dist/Lazy.js +1 -2
  18. package/dist/Lazy.js.map +1 -1
  19. package/dist/PaginationOptions.d.ts +23 -0
  20. package/dist/PaginationOptions.d.ts.map +1 -0
  21. package/dist/PaginationOptions.js +29 -0
  22. package/dist/PaginationOptions.js.map +1 -0
  23. package/dist/PaginationResult.d.ts +1 -0
  24. package/dist/PaginationResult.d.ts.map +1 -1
  25. package/dist/PaginationResult.js +1 -2
  26. package/dist/PaginationResult.js.map +1 -1
  27. package/dist/Ref.d.ts +34 -5
  28. package/dist/Ref.d.ts.map +1 -1
  29. package/dist/Ref.js +51 -13
  30. package/dist/Ref.js.map +1 -1
  31. package/dist/Refs.js +1 -2
  32. package/dist/Refs.js.map +1 -1
  33. package/dist/Registry.js +1 -2
  34. package/dist/Registry.js.map +1 -1
  35. package/dist/RuntimeAndFunctionType.js +1 -2
  36. package/dist/RuntimeAndFunctionType.js.map +1 -1
  37. package/dist/Spec.js +1 -2
  38. package/dist/Spec.js.map +1 -1
  39. package/dist/SystemFields.d.ts.map +1 -1
  40. package/dist/SystemFields.js +2 -3
  41. package/dist/SystemFields.js.map +1 -1
  42. package/dist/Types.d.ts +1 -1
  43. package/dist/Types.d.ts.map +1 -1
  44. package/dist/Types.js +1 -2
  45. package/dist/Types.js.map +1 -1
  46. package/dist/UserIdentity.js +1 -2
  47. package/dist/UserIdentity.js.map +1 -1
  48. package/dist/_virtual/_rolldown/runtime.js +6 -11
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +3 -3
  52. package/dist/tsconfig.src.tsbuildinfo +1 -1
  53. package/package.json +12 -11
  54. package/src/FunctionProvenance.ts +147 -4
  55. package/src/FunctionSpec.ts +67 -1
  56. package/src/PaginationOptions.ts +23 -0
  57. package/src/PaginationResult.ts +4 -0
  58. package/src/Ref.ts +90 -25
  59. package/src/SystemFields.ts +2 -5
  60. package/src/Types.ts +5 -1
  61. package/src/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type {\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Codec<any, any>,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const internalMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const publicAction = make(RuntimeAndFunctionType.ConvexAction, \"public\");\nexport const internalAction = make(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\n\nexport const publicNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const internalNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n\ntype MatchingRegisteredFunction<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n> =\n RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"query\"\n ? RegisteredQuery<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"mutation\"\n ? RegisteredMutation<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"action\"\n ? RegisteredAction<FunctionVisibility_, any, any>\n : never;\n\ntype ExtractArgs<F> =\n F extends RegisteredQuery<any, infer A, any>\n ? A\n : F extends RegisteredMutation<any, infer A, any>\n ? A\n : F extends RegisteredAction<any, infer A, any>\n ? A\n : never;\n\ntype ExtractReturns<F> =\n F extends RegisteredQuery<any, any, infer R>\n ? R\n : F extends RegisteredMutation<any, any, infer R>\n ? R\n : F extends RegisteredAction<any, any, infer R>\n ? R\n : never;\n\nconst makeConvex =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n F extends MatchingRegisteredFunction<\n RuntimeAndFunctionType_,\n FunctionVisibility_\n >,\n >() =>\n <const Name_ extends string>(\n name: Name_,\n ): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Convex<\n ExtractArgs<F>,\n ExtractReturns<F>\n >(),\n }) as any;\n };\n\nexport const convexPublicQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const convexInternalQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const convexPublicMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const convexInternalMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const convexPublicAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"public\",\n);\nexport const convexInternalAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\nexport const convexPublicNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const convexInternalNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,OAAO;AAyLlC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,QAMF,wBACA,wBAOA,EACA,MACA,MACA,SACA,YAWG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBA,QAA2B,MAAM,SAAS,MAAM;EACrE,CAAC;;AAGN,MAAa,cAAc,KAAKC,aAAoC,SAAS;AAC7E,MAAa,gBAAgB,KAC3BA,aACA,WACD;AACD,MAAa,iBAAiB,KAC5BC,gBACA,SACD;AACD,MAAa,mBAAmB,KAC9BA,gBACA,WACD;AACD,MAAa,eAAe,KAAKC,cAAqC,SAAS;AAC/E,MAAa,iBAAiB,KAC5BA,cACA,WACD;AAED,MAAa,mBAAmB,KAC9BC,YACA,SACD;AACD,MAAa,qBAAqB,KAChCA,YACA,WACD;AAgCD,MAAM,cAMF,wBACA,8BASA,SAMG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBC,QAGjB;EACJ,CAAC;;AAGN,MAAa,oBAAoB,WAC/BJ,aACA,SACD;AACD,MAAa,sBAAsB,WACjCA,aACA,WACD;AACD,MAAa,uBAAuB,WAClCC,gBACA,SACD;AACD,MAAa,yBAAyB,WACpCA,gBACA,WACD;AACD,MAAa,qBAAqB,WAChCC,cACA,SACD;AACD,MAAa,uBAAuB,WAClCA,cACA,WACD;AACD,MAAa,yBAAyB,WACpCC,YACA,SACD;AACD,MAAa,2BAA2B,WACtCA,YACA,WACD"}
1
+ {"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","FunctionProvenance.ConfectPaginated","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type {\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport * as Schema from \"effect/Schema\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Codec<any, any>,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\n/**\n * `Schema.Struct` fields that must not declare `paginationOpts`. Used to\n * reject a user args schema that redeclares the field the paginated\n * constructors add themselves; the check reports at the `args` thunk with an\n * unsatisfiable type when violated.\n */\ntype ForbidPaginationOpts<UserArgs extends FunctionProvenance.AnyUserArgs> =\n \"paginationOpts\" extends keyof UserArgs[\"fields\"]\n ? { readonly fields: { readonly paginationOpts: never } }\n : unknown;\n\nconst makePaginated =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Item_ extends Schema.Codec<any, any>,\n UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n item,\n error,\n }: {\n name: Name_;\n /** User-declared args, without `paginationOpts` — it is added automatically. */\n args?: (() => UserArgs_) & ForbidPaginationOpts<UserArgs_>;\n /** The page element schema. */\n item: () => Item_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.ConfectPaginated(\n // When `args` is omitted, `UserArgs_` is its `Schema.Struct<{}>` default.\n args ?? ((() => Schema.Struct({})) as unknown as () => UserArgs_),\n item,\n error,\n ),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicPaginatedQuery = makePaginated(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const internalPaginatedQuery = makePaginated(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const internalMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const publicAction = make(RuntimeAndFunctionType.ConvexAction, \"public\");\nexport const internalAction = make(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\n\nexport const publicNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const internalNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n\ntype MatchingRegisteredFunction<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n> =\n RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"query\"\n ? RegisteredQuery<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"mutation\"\n ? RegisteredMutation<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"action\"\n ? RegisteredAction<FunctionVisibility_, any, any>\n : never;\n\ntype ExtractArgs<F> =\n F extends RegisteredQuery<any, infer A, any>\n ? A\n : F extends RegisteredMutation<any, infer A, any>\n ? A\n : F extends RegisteredAction<any, infer A, any>\n ? A\n : never;\n\ntype ExtractReturns<F> =\n F extends RegisteredQuery<any, any, infer R>\n ? R\n : F extends RegisteredMutation<any, any, infer R>\n ? R\n : F extends RegisteredAction<any, any, infer R>\n ? R\n : never;\n\nconst makeConvex =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n F extends MatchingRegisteredFunction<\n RuntimeAndFunctionType_,\n FunctionVisibility_\n >,\n >() =>\n <const Name_ extends string>(\n name: Name_,\n ): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Convex<\n ExtractArgs<F>,\n ExtractReturns<F>\n >(),\n }) as any;\n };\n\nexport const convexPublicQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const convexInternalQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const convexPublicMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const convexInternalMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const convexPublicAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"public\",\n);\nexport const convexInternalAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\nexport const convexPublicNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const convexInternalNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,MAAM;AAyLjC,MAAM,QAAQ,GACX,SAAS,OACZ;AAEA,MAAM,QAMF,wBACA,wBAOA,EACA,MACA,MACA,SACA,YAWG;CACH,kCAAkC,IAAI;CAEtC,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBA,QAA2B,MAAM,SAAS,KAAK;CACrE,CAAC;AACH;AAaF,MAAM,iBAMF,wBACA,wBAOA,EACA,MACA,MACA,MACA,YAaG;CACH,kCAAkC,IAAI;CAEtC,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBC,iBAElB,eAAgB,OAAO,OAAO,CAAC,CAAC,IAChC,MACA,KACF;CACF,CAAC;AACH;AAEF,MAAa,cAAc,KAAKC,aAAoC,QAAQ;AAC5E,MAAa,gBAAgB,KAC3BA,aACA,UACF;AACA,MAAa,uBAAuB,cAClCA,aACA,QACF;AACA,MAAa,yBAAyB,cACpCA,aACA,UACF;AACA,MAAa,iBAAiB,KAC5BC,gBACA,QACF;AACA,MAAa,mBAAmB,KAC9BA,gBACA,UACF;AACA,MAAa,eAAe,KAAKC,cAAqC,QAAQ;AAC9E,MAAa,iBAAiB,KAC5BA,cACA,UACF;AAEA,MAAa,mBAAmB,KAC9BC,YACA,QACF;AACA,MAAa,qBAAqB,KAChCA,YACA,UACF;AAgCA,MAAM,cAMF,wBACA,8BASA,SAMG;CACH,kCAAkC,IAAI;CAEtC,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBC,OAGlB;CACJ,CAAC;AACH;AAEF,MAAa,oBAAoB,WAC/BJ,aACA,QACF;AACA,MAAa,sBAAsB,WACjCA,aACA,UACF;AACA,MAAa,uBAAuB,WAClCC,gBACA,QACF;AACA,MAAa,yBAAyB,WACpCA,gBACA,UACF;AACA,MAAa,qBAAqB,WAChCC,cACA,QACF;AACA,MAAa,uBAAuB,WAClCA,cACA,UACF;AACA,MAAa,yBAAyB,WACpCC,YACA,QACF;AACA,MAAa,2BAA2B,WACtCA,YACA,UACF"}
package/dist/GenericId.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import * as Option from "effect/Option";
3
2
  import * as Schema from "effect/Schema";
3
+ import * as Option from "effect/Option";
4
4
  import * as SchemaAST from "effect/SchemaAST";
5
-
6
5
  //#region src/GenericId.ts
7
6
  var GenericId_exports = /* @__PURE__ */ __exportAll({
8
7
  GenericId: () => GenericId,
@@ -11,7 +10,7 @@ var GenericId_exports = /* @__PURE__ */ __exportAll({
11
10
  const ConvexId = "~@confect/core/ConvexId";
12
11
  const GenericId = (tableName) => Schema.String.annotate({ [ConvexId]: tableName });
13
12
  const tableName = (ast) => Option.fromNullishOr(SchemaAST.resolveAt(ConvexId)(ast));
14
-
15
13
  //#endregion
16
14
  export { GenericId, GenericId_exports, tableName };
15
+
17
16
  //# sourceMappingURL=GenericId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GenericId.js","names":[],"sources":["../src/GenericId.ts"],"sourcesContent":["import type { GenericId as ConvexGenericId } from \"convex/values\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\n\nconst ConvexId = \"~@confect/core/ConvexId\";\n\nexport const GenericId = <TableName extends string>(\n tableName: TableName,\n): Schema.Codec<ConvexGenericId<TableName>> =>\n Schema.String.annotate({\n [ConvexId]: tableName,\n }) as unknown as Schema.Codec<ConvexGenericId<TableName>>;\n\nexport type GenericId<TableName extends string> = ConvexGenericId<TableName>;\n\nexport const tableName = <TableName extends string>(\n ast: SchemaAST.AST,\n): Option.Option<TableName> =>\n Option.fromNullishOr(SchemaAST.resolveAt<TableName>(ConvexId)(ast));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,WAAW;AAEjB,MAAa,aACX,cAEA,OAAO,OAAO,SAAS,GACpB,WAAW,WACb,CAAC;AAIJ,MAAa,aACX,QAEA,OAAO,cAAc,UAAU,UAAqB,SAAS,CAAC,IAAI,CAAC"}
1
+ {"version":3,"file":"GenericId.js","names":[],"sources":["../src/GenericId.ts"],"sourcesContent":["import type { GenericId as ConvexGenericId } from \"convex/values\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\n\nconst ConvexId = \"~@confect/core/ConvexId\";\n\nexport const GenericId = <TableName extends string>(\n tableName: TableName,\n): Schema.Codec<ConvexGenericId<TableName>> =>\n Schema.String.annotate({\n [ConvexId]: tableName,\n }) as unknown as Schema.Codec<ConvexGenericId<TableName>>;\n\nexport type GenericId<TableName extends string> = ConvexGenericId<TableName>;\n\nexport const tableName = <TableName extends string>(\n ast: SchemaAST.AST,\n): Option.Option<TableName> =>\n Option.fromNullishOr(SchemaAST.resolveAt<TableName>(ConvexId)(ast));\n"],"mappings":";;;;;;;;;AAKA,MAAM,WAAW;AAEjB,MAAa,aACX,cAEA,OAAO,OAAO,SAAS,GACpB,WAAW,UACd,CAAC;AAIH,MAAa,aACX,QAEA,OAAO,cAAc,UAAU,UAAqB,QAAQ,CAAC,CAAC,GAAG,CAAC"}
package/dist/GroupPath.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
-
3
2
  //#region src/GroupPath.ts
4
3
  var GroupPath_exports = /* @__PURE__ */ __exportAll({});
5
-
6
4
  //#endregion
7
5
  export { GroupPath_exports };
6
+
8
7
  //# sourceMappingURL=GroupPath.js.map
package/dist/GroupSpec.js CHANGED
@@ -2,7 +2,6 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { validateConfectFunctionIdentifier } from "./Identifier.js";
3
3
  import * as Predicate from "effect/Predicate";
4
4
  import * as Record from "effect/Record";
5
-
6
5
  //#region src/GroupSpec.ts
7
6
  var GroupSpec_exports = /* @__PURE__ */ __exportAll({
8
7
  TypeId: () => TypeId,
@@ -94,7 +93,7 @@ const withName = (name, group) => {
94
93
  groups: group_.groups
95
94
  });
96
95
  };
97
-
98
96
  //#endregion
99
97
  export { GroupSpec_exports, TypeId, isGroupSpec, make, makeAt, makeNode, makeNodeAt, withName };
98
+
100
99
  //# sourceMappingURL=GroupSpec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\n\nexport const TypeId = \"@confect/core/GroupSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isGroupSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface GroupSpec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never,\n // Subgroups may be of any runtime, independent of this group's own runtime: a\n // group is only a namespace for its children, which are otherwise-independent\n // modules. Functions, by contrast, stay homogeneous (a Node group only accepts\n // Node actions) — `addFunction` keeps the `<Runtime>` bound below.\n Groups_ extends AnyWithProps = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly name: Name_;\n readonly functions: {\n [FunctionName in FunctionSpec.Name<\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>\n >]: FunctionSpec.WithName<Functions_, FunctionName>;\n };\n readonly groups: {\n [GroupName in Name<Groups_>]: WithName<Groups_, GroupName>;\n };\n\n addFunction<Function extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>>(\n function_: Function,\n ): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_>;\n\n addGroup<Group extends AnyWithProps>(\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group>;\n\n addGroupAt<const AtName extends string, Group extends AnyWithProps>(\n name: AtName,\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends GroupSpec<\n RuntimeAndFunctionType.Runtime,\n string,\n FunctionSpec.AnyWithProps,\n AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends GroupSpec<\n Runtime,\n string,\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n AnyWithPropsWithRuntime<Runtime>\n> {}\n\nexport type Name<Group extends AnyWithProps> = Group[\"name\"];\n\nexport type Functions<Group extends AnyWithProps> =\n Group[\"functions\"][keyof Group[\"functions\"]];\n\nexport type Groups<Group extends AnyWithProps> =\n Group[\"groups\"][keyof Group[\"groups\"]];\n\nexport type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [\n never,\n]\n ? never\n : Name<Groups<Group>>;\n\nexport type WithName<\n Group extends AnyWithProps,\n Name_ extends Name<Group>,\n> = Extract<Group, { readonly name: Name_ }>;\n\n/** Assigns a segment name to a leaf group created with {@link make} for typing and refs. */\nexport type NamedAt<Group extends Any, Name_ extends string> = Omit<\n Group,\n \"name\"\n> & {\n readonly name: Name_;\n};\n\nexport type AddGroups<\n Group extends AnyWithProps,\n ExtraGroups extends AnyWithProps,\n> =\n Group extends GroupSpec<\n infer Runtime,\n infer Name_,\n infer Functions_,\n infer Groups_\n >\n ? GroupSpec<Runtime, Name_, Functions_, Groups_ | ExtraGroups>\n : never;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addFunction<Function extends FunctionSpec.AnyWithProps>(\n this: Any,\n function_: Function,\n ) {\n const this_ = this as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: Record.set(this_.functions, function_.name, function_),\n groups: this_.groups,\n });\n },\n\n addGroup<Group extends Any>(this: Any, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, group_.name, group_),\n });\n },\n\n addGroupAt<Group extends Any>(this: Any, name: string, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, name, withName(name, group_)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n Groups_ extends AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n name,\n functions,\n groups,\n}: {\n runtime: Runtime;\n name: Name_;\n functions: Record.ReadonlyRecord<string, Functions_>;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): GroupSpec<Runtime, Name_, Functions_, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n name,\n functions,\n groups,\n });\n\nexport const make = (): GroupSpec<\"Convex\", \"\"> =>\n makeProto({\n runtime: \"Convex\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Convex\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Convex\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const makeNode = (): GroupSpec<\"Node\", \"\"> =>\n makeProto({\n runtime: \"Node\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeNodeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Node\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Node\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const withName = <const Name_ extends string>(\n name: Name_,\n group: Any,\n): AnyWithProps => {\n validateConfectFunctionIdentifier(name);\n const group_ = group as AnyWithProps;\n\n if (group_.name === name) {\n return group_;\n }\n\n return makeProto({\n runtime: group_.runtime,\n name,\n functions: group_.functions,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AAC7B,mCAAkC,KAAK;AAEvC,QAAO,UAAU;EACf,SAAS;EACT;EACA,WAAW,OAAO,OAAO;EACzB,QAAQ,OAAO,OAAO;EACvB,CAAC;;AAGJ,MAAa,YACX,MACA,UACiB;AACjB,mCAAkC,KAAK;CACvC,MAAM,SAAS;AAEf,KAAI,OAAO,SAAS,KAClB,QAAO;AAGT,QAAO,UAAU;EACf,SAAS,OAAO;EAChB;EACA,WAAW,OAAO;EAClB,QAAQ,OAAO;EAChB,CAAC"}
1
+ {"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\n\nexport const TypeId = \"@confect/core/GroupSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isGroupSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface GroupSpec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never,\n // Subgroups may be of any runtime, independent of this group's own runtime: a\n // group is only a namespace for its children, which are otherwise-independent\n // modules. Functions, by contrast, stay homogeneous (a Node group only accepts\n // Node actions) — `addFunction` keeps the `<Runtime>` bound below.\n Groups_ extends AnyWithProps = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly name: Name_;\n readonly functions: {\n [FunctionName in FunctionSpec.Name<\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>\n >]: FunctionSpec.WithName<Functions_, FunctionName>;\n };\n readonly groups: {\n [GroupName in Name<Groups_>]: WithName<Groups_, GroupName>;\n };\n\n addFunction<Function extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>>(\n function_: Function,\n ): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_>;\n\n addGroup<Group extends AnyWithProps>(\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group>;\n\n addGroupAt<const AtName extends string, Group extends AnyWithProps>(\n name: AtName,\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends GroupSpec<\n RuntimeAndFunctionType.Runtime,\n string,\n FunctionSpec.AnyWithProps,\n AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends GroupSpec<\n Runtime,\n string,\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n AnyWithPropsWithRuntime<Runtime>\n> {}\n\nexport type Name<Group extends AnyWithProps> = Group[\"name\"];\n\nexport type Functions<Group extends AnyWithProps> =\n Group[\"functions\"][keyof Group[\"functions\"]];\n\nexport type Groups<Group extends AnyWithProps> =\n Group[\"groups\"][keyof Group[\"groups\"]];\n\nexport type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [\n never,\n]\n ? never\n : Name<Groups<Group>>;\n\nexport type WithName<\n Group extends AnyWithProps,\n Name_ extends Name<Group>,\n> = Extract<Group, { readonly name: Name_ }>;\n\n/** Assigns a segment name to a leaf group created with {@link make} for typing and refs. */\nexport type NamedAt<Group extends Any, Name_ extends string> = Omit<\n Group,\n \"name\"\n> & {\n readonly name: Name_;\n};\n\nexport type AddGroups<\n Group extends AnyWithProps,\n ExtraGroups extends AnyWithProps,\n> =\n Group extends GroupSpec<\n infer Runtime,\n infer Name_,\n infer Functions_,\n infer Groups_\n >\n ? GroupSpec<Runtime, Name_, Functions_, Groups_ | ExtraGroups>\n : never;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addFunction<Function extends FunctionSpec.AnyWithProps>(\n this: Any,\n function_: Function,\n ) {\n const this_ = this as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: Record.set(this_.functions, function_.name, function_),\n groups: this_.groups,\n });\n },\n\n addGroup<Group extends Any>(this: Any, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, group_.name, group_),\n });\n },\n\n addGroupAt<Group extends Any>(this: Any, name: string, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, name, withName(name, group_)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n Groups_ extends AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n name,\n functions,\n groups,\n}: {\n runtime: Runtime;\n name: Name_;\n functions: Record.ReadonlyRecord<string, Functions_>;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): GroupSpec<Runtime, Name_, Functions_, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n name,\n functions,\n groups,\n });\n\nexport const make = (): GroupSpec<\"Convex\", \"\"> =>\n makeProto({\n runtime: \"Convex\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Convex\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Convex\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const makeNode = (): GroupSpec<\"Node\", \"\"> =>\n makeProto({\n runtime: \"Node\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeNodeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Node\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Node\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const withName = <const Name_ extends string>(\n name: Name_,\n group: Any,\n): AnyWithProps => {\n validateConfectFunctionIdentifier(name);\n const group_ = group as AnyWithProps;\n\n if (group_.name === name) {\n return group_;\n }\n\n return makeProto({\n runtime: group_.runtime,\n name,\n functions: group_.functions,\n groups: group_.groups,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAMA,MAAa,SAAS;AAGtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,MAAM;AAkGjC,MAAM,QAAQ;EACX,SAAS;CAEV,YAEE,WACA;EACA,MAAM,QAAQ;EAEd,OAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,OAAO,IAAI,MAAM,WAAW,UAAU,MAAM,SAAS;GAChE,QAAQ,MAAM;EAChB,CAAC;CACH;CAEA,SAAuC,OAAc;EACnD,MAAM,QAAQ;EACd,MAAM,SAAS;EAEf,OAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,MAAM;GACjB,QAAQ,OAAO,IAAI,MAAM,QAAQ,OAAO,MAAM,MAAM;EACtD,CAAC;CACH;CAEA,WAAyC,MAAc,OAAc;EACnE,MAAM,QAAQ;EACd,MAAM,SAAS;EAEf,OAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,MAAM;GACjB,QAAQ,OAAO,IAAI,MAAM,QAAQ,MAAM,SAAS,MAAM,MAAM,CAAC;EAC/D,CAAC;CACH;AACF;AAEA,MAAM,aAKJ,EACA,SACA,MACA,WACA,aAOA,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;CAClC;CACA;CACA;CACA;AACF,CAAC;AAEH,MAAa,aACX,UAAU;CACR,SAAS;CACT,MAAM;CACN,WAAW,OAAO,MAAM;CACxB,QAAQ,OAAO,MAAM;AACvB,CAAC;AAEH,MAAa,UACX,SAC+B;CAC/B,kCAAkC,IAAI;CAEtC,OAAO,UAAU;EACf,SAAS;EACT;EACA,WAAW,OAAO,MAAM;EACxB,QAAQ,OAAO,MAAM;CACvB,CAAC;AACH;AAEA,MAAa,iBACX,UAAU;CACR,SAAS;CACT,MAAM;CACN,WAAW,OAAO,MAAM;CACxB,QAAQ,OAAO,MAAM;AACvB,CAAC;AAEH,MAAa,cACX,SAC6B;CAC7B,kCAAkC,IAAI;CAEtC,OAAO,UAAU;EACf,SAAS;EACT;EACA,WAAW,OAAO,MAAM;EACxB,QAAQ,OAAO,MAAM;CACvB,CAAC;AACH;AAEA,MAAa,YACX,MACA,UACiB;CACjB,kCAAkC,IAAI;CACtC,MAAM,SAAS;CAEf,IAAI,OAAO,SAAS,MAClB,OAAO;CAGT,OAAO,UAAU;EACf,SAAS,OAAO;EAChB;EACA,WAAW,OAAO;EAClB,QAAQ,OAAO;CACjB,CAAC;AACH"}
@@ -1,11 +1,10 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
-
3
2
  //#region src/Identifier.ts
4
3
  var Identifier_exports = /* @__PURE__ */ __exportAll({
5
4
  validateConfectFunctionIdentifier: () => validateConfectFunctionIdentifier,
6
5
  validateConfectTableIdentifier: () => validateConfectTableIdentifier
7
6
  });
8
- const RESERVED_JS_IDENTIFIERS = new Set([
7
+ const RESERVED_JS_IDENTIFIERS = /* @__PURE__ */ new Set([
9
8
  "break",
10
9
  "case",
11
10
  "catch",
@@ -54,7 +53,7 @@ const RESERVED_JS_IDENTIFIERS = new Set([
54
53
  "false",
55
54
  "undefined"
56
55
  ]);
57
- const RESERVED_CONVEX_FILE_NAMES = new Set([
56
+ const RESERVED_CONVEX_FILE_NAMES = /* @__PURE__ */ new Set([
58
57
  "schema",
59
58
  "http",
60
59
  "crons"
@@ -85,7 +84,7 @@ const validateConfectTableIdentifier = (identifier) => {
85
84
  if (!matchesTableNamePattern(identifier)) throw new Error(`Expected a valid Confect table identifier, but received: "${identifier}". Valid table identifiers must start with a letter and can only contain letters, numbers, and underscores. Leading underscores are reserved for Convex system tables.`);
86
85
  if (isReservedJsIdentifier(identifier)) throw new Error(`Expected a valid Confect table identifier, but received: "${identifier}". "${identifier}" is a reserved JavaScript identifier.`);
87
86
  };
88
-
89
87
  //#endregion
90
88
  export { Identifier_exports, validateConfectFunctionIdentifier, validateConfectTableIdentifier };
89
+
91
90
  //# sourceMappingURL=Identifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Identifier.js","names":[],"sources":["../src/Identifier.ts"],"sourcesContent":["const RESERVED_JS_IDENTIFIERS = new Set([\n // Reserved keywords\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"export\",\n \"extends\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n // Future reserved keywords\n \"await\",\n \"enum\",\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n // Literal values that cannot be reassigned\n \"null\",\n \"true\",\n \"false\",\n // Global objects that shouldn't be shadowed\n \"undefined\",\n]);\n\nconst RESERVED_CONVEX_FILE_NAMES = new Set([\"schema\", \"http\", \"crons\"]);\n\nconst jsIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n\n// Stricter than `jsIdentifierRegex`: tables cannot start with `_` (Convex\n// reserves leading underscores for system tables) or `$` (Convex's table\n// naming grammar does not accept it). Letters/digits/underscore only,\n// letter-leading.\nconst tableNameRegex = /^[a-zA-Z][a-zA-Z0-9_]*$/;\n\nconst isReservedJsIdentifier = (identifier: string) =>\n RESERVED_JS_IDENTIFIERS.has(identifier);\n\nconst isReservedConvexFileName = (fileName: string) =>\n RESERVED_CONVEX_FILE_NAMES.has(fileName);\n\nconst matchesJsIdentifierPattern = (identifier: string) =>\n jsIdentifierRegex.test(identifier);\n\nconst matchesTableNamePattern = (identifier: string) =>\n tableNameRegex.test(identifier);\n\nexport const validateConfectFunctionIdentifier = (identifier: string) => {\n if (!matchesJsIdentifierPattern(identifier)) {\n throw new Error(\n `Expected a valid Confect function identifier, but received: \"${identifier}\". Valid identifiers must start with a letter, underscore, or dollar sign, and can only contain letters, numbers, underscores, or dollar signs.`,\n );\n }\n\n if (isReservedJsIdentifier(identifier)) {\n throw new Error(\n `Expected a valid Confect function identifier, but received: \"${identifier}\". \"${identifier}\" is a reserved JavaScript identifier.`,\n );\n }\n\n if (isReservedConvexFileName(identifier)) {\n throw new Error(\n `Expected a valid Confect function identifier, but received: \"${identifier}\". \"${identifier}\" is a reserved Convex file name.`,\n );\n }\n};\n\n/**\n * Validate that `identifier` is suitable as a Convex table name (and, equivalently,\n * as a `confect/tables/<identifier>.ts` filename).\n *\n * Rules:\n * - Must match `/^[A-Za-z][A-Za-z0-9_]*$/` — letter-leading, alphanumeric plus\n * underscore. No `$` (not a valid Convex table name character); no leading\n * `_` (Convex reserves `_<name>` for its system tables).\n * - Must not be a reserved JavaScript identifier, so the name can also be used\n * as a binding name in generated code without escaping.\n */\nexport const validateConfectTableIdentifier = (identifier: string) => {\n if (!matchesTableNamePattern(identifier)) {\n throw new Error(\n `Expected a valid Confect table identifier, but received: \"${identifier}\". Valid table identifiers must start with a letter and can only contain letters, numbers, and underscores. Leading underscores are reserved for Convex system tables.`,\n );\n }\n\n if (isReservedJsIdentifier(identifier)) {\n throw new Error(\n `Expected a valid Confect table identifier, but received: \"${identifier}\". \"${identifier}\" is a reserved JavaScript identifier.`,\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,MAAM,0BAA0B,IAAI,IAAI;CAEtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACD,CAAC;AAEF,MAAM,6BAA6B,IAAI,IAAI;CAAC;CAAU;CAAQ;CAAQ,CAAC;AAEvE,MAAM,oBAAoB;AAM1B,MAAM,iBAAiB;AAEvB,MAAM,0BAA0B,eAC9B,wBAAwB,IAAI,WAAW;AAEzC,MAAM,4BAA4B,aAChC,2BAA2B,IAAI,SAAS;AAE1C,MAAM,8BAA8B,eAClC,kBAAkB,KAAK,WAAW;AAEpC,MAAM,2BAA2B,eAC/B,eAAe,KAAK,WAAW;AAEjC,MAAa,qCAAqC,eAAuB;AACvE,KAAI,CAAC,2BAA2B,WAAW,CACzC,OAAM,IAAI,MACR,gEAAgE,WAAW,iJAC5E;AAGH,KAAI,uBAAuB,WAAW,CACpC,OAAM,IAAI,MACR,gEAAgE,WAAW,MAAM,WAAW,wCAC7F;AAGH,KAAI,yBAAyB,WAAW,CACtC,OAAM,IAAI,MACR,gEAAgE,WAAW,MAAM,WAAW,mCAC7F;;;;;;;;;;;;;AAeL,MAAa,kCAAkC,eAAuB;AACpE,KAAI,CAAC,wBAAwB,WAAW,CACtC,OAAM,IAAI,MACR,6DAA6D,WAAW,wKACzE;AAGH,KAAI,uBAAuB,WAAW,CACpC,OAAM,IAAI,MACR,6DAA6D,WAAW,MAAM,WAAW,wCAC1F"}
1
+ {"version":3,"file":"Identifier.js","names":[],"sources":["../src/Identifier.ts"],"sourcesContent":["const RESERVED_JS_IDENTIFIERS = new Set([\n // Reserved keywords\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"export\",\n \"extends\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n // Future reserved keywords\n \"await\",\n \"enum\",\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n // Literal values that cannot be reassigned\n \"null\",\n \"true\",\n \"false\",\n // Global objects that shouldn't be shadowed\n \"undefined\",\n]);\n\nconst RESERVED_CONVEX_FILE_NAMES = new Set([\"schema\", \"http\", \"crons\"]);\n\nconst jsIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n\n// Stricter than `jsIdentifierRegex`: tables cannot start with `_` (Convex\n// reserves leading underscores for system tables) or `$` (Convex's table\n// naming grammar does not accept it). Letters/digits/underscore only,\n// letter-leading.\nconst tableNameRegex = /^[a-zA-Z][a-zA-Z0-9_]*$/;\n\nconst isReservedJsIdentifier = (identifier: string) =>\n RESERVED_JS_IDENTIFIERS.has(identifier);\n\nconst isReservedConvexFileName = (fileName: string) =>\n RESERVED_CONVEX_FILE_NAMES.has(fileName);\n\nconst matchesJsIdentifierPattern = (identifier: string) =>\n jsIdentifierRegex.test(identifier);\n\nconst matchesTableNamePattern = (identifier: string) =>\n tableNameRegex.test(identifier);\n\nexport const validateConfectFunctionIdentifier = (identifier: string) => {\n if (!matchesJsIdentifierPattern(identifier)) {\n throw new Error(\n `Expected a valid Confect function identifier, but received: \"${identifier}\". Valid identifiers must start with a letter, underscore, or dollar sign, and can only contain letters, numbers, underscores, or dollar signs.`,\n );\n }\n\n if (isReservedJsIdentifier(identifier)) {\n throw new Error(\n `Expected a valid Confect function identifier, but received: \"${identifier}\". \"${identifier}\" is a reserved JavaScript identifier.`,\n );\n }\n\n if (isReservedConvexFileName(identifier)) {\n throw new Error(\n `Expected a valid Confect function identifier, but received: \"${identifier}\". \"${identifier}\" is a reserved Convex file name.`,\n );\n }\n};\n\n/**\n * Validate that `identifier` is suitable as a Convex table name (and, equivalently,\n * as a `confect/tables/<identifier>.ts` filename).\n *\n * Rules:\n * - Must match `/^[A-Za-z][A-Za-z0-9_]*$/` — letter-leading, alphanumeric plus\n * underscore. No `$` (not a valid Convex table name character); no leading\n * `_` (Convex reserves `_<name>` for its system tables).\n * - Must not be a reserved JavaScript identifier, so the name can also be used\n * as a binding name in generated code without escaping.\n */\nexport const validateConfectTableIdentifier = (identifier: string) => {\n if (!matchesTableNamePattern(identifier)) {\n throw new Error(\n `Expected a valid Confect table identifier, but received: \"${identifier}\". Valid table identifiers must start with a letter and can only contain letters, numbers, and underscores. Leading underscores are reserved for Convex system tables.`,\n );\n }\n\n if (isReservedJsIdentifier(identifier)) {\n throw new Error(\n `Expected a valid Confect table identifier, but received: \"${identifier}\". \"${identifier}\" is a reserved JavaScript identifier.`,\n );\n }\n};\n"],"mappings":";;;;;;AAAA,MAAM,0CAA0B,IAAI,IAAI;CAEtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;AACF,CAAC;AAED,MAAM,6CAA6B,IAAI,IAAI;CAAC;CAAU;CAAQ;AAAO,CAAC;AAEtE,MAAM,oBAAoB;AAM1B,MAAM,iBAAiB;AAEvB,MAAM,0BAA0B,eAC9B,wBAAwB,IAAI,UAAU;AAExC,MAAM,4BAA4B,aAChC,2BAA2B,IAAI,QAAQ;AAEzC,MAAM,8BAA8B,eAClC,kBAAkB,KAAK,UAAU;AAEnC,MAAM,2BAA2B,eAC/B,eAAe,KAAK,UAAU;AAEhC,MAAa,qCAAqC,eAAuB;CACvE,IAAI,CAAC,2BAA2B,UAAU,GACxC,MAAM,IAAI,MACR,gEAAgE,WAAW,gJAC7E;CAGF,IAAI,uBAAuB,UAAU,GACnC,MAAM,IAAI,MACR,gEAAgE,WAAW,MAAM,WAAW,uCAC9F;CAGF,IAAI,yBAAyB,UAAU,GACrC,MAAM,IAAI,MACR,gEAAgE,WAAW,MAAM,WAAW,kCAC9F;AAEJ;;;;;;;;;;;;AAaA,MAAa,kCAAkC,eAAuB;CACpE,IAAI,CAAC,wBAAwB,UAAU,GACrC,MAAM,IAAI,MACR,6DAA6D,WAAW,uKAC1E;CAGF,IAAI,uBAAuB,UAAU,GACnC,MAAM,IAAI,MACR,6DAA6D,WAAW,MAAM,WAAW,uCAC3F;AAEJ"}
package/dist/Lazy.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
-
3
2
  //#region src/Lazy.ts
4
3
  var Lazy_exports = /* @__PURE__ */ __exportAll({ defineProperty: () => defineProperty });
5
4
  /**
@@ -38,7 +37,7 @@ const defineProperty = (target, key, compute) => {
38
37
  }
39
38
  });
40
39
  };
41
-
42
40
  //#endregion
43
41
  export { Lazy_exports, defineProperty };
42
+
44
43
  //# sourceMappingURL=Lazy.js.map
package/dist/Lazy.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Lazy.js","names":[],"sources":["../src/Lazy.ts"],"sourcesContent":["/**\n * Install a lazy memoised property on `target`. The first access runs\n * `compute()` and replaces the getter with a plain, non-writable data\n * property whose value is the computed result. Subsequent accesses hit\n * the V8 fast path for own data properties — no function call, identical\n * returned reference — so first and second-and-subsequent accesses are\n * observably indistinguishable.\n *\n * The replacement property is `enumerable: true` so the lazy property\n * still participates in `Object.keys` / `JSON.stringify` after it\n * materialises, matching the shape of a plain data property. The property\n * is also `enumerable` before materialising, so presence checks\n * (`\"key\" in target`, `Object.hasOwn(target, key)`) observe it without\n * forcing the computation.\n *\n * This is the single shared implementation consumed across packages (e.g.\n * `@confect/core`'s lazy `FunctionSpec` schemas and `@confect/server`'s lazy\n * `Table` `Fields` / `Doc` / `tableDefinition`), so there is no chance of the\n * two drifting apart.\n */\nexport const defineProperty = <T extends object, K extends PropertyKey>(\n target: T,\n key: K,\n compute: () => unknown,\n): void => {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n get(this: T) {\n const value = compute();\n Object.defineProperty(this, key, {\n value,\n writable: false,\n enumerable: true,\n configurable: false,\n });\n return value;\n },\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,kBACX,QACA,KACA,YACS;AACT,QAAO,eAAe,QAAQ,KAAK;EACjC,cAAc;EACd,YAAY;EACZ,MAAa;GACX,MAAM,QAAQ,SAAS;AACvB,UAAO,eAAe,MAAM,KAAK;IAC/B;IACA,UAAU;IACV,YAAY;IACZ,cAAc;IACf,CAAC;AACF,UAAO;;EAEV,CAAC"}
1
+ {"version":3,"file":"Lazy.js","names":[],"sources":["../src/Lazy.ts"],"sourcesContent":["/**\n * Install a lazy memoised property on `target`. The first access runs\n * `compute()` and replaces the getter with a plain, non-writable data\n * property whose value is the computed result. Subsequent accesses hit\n * the V8 fast path for own data properties — no function call, identical\n * returned reference — so first and second-and-subsequent accesses are\n * observably indistinguishable.\n *\n * The replacement property is `enumerable: true` so the lazy property\n * still participates in `Object.keys` / `JSON.stringify` after it\n * materialises, matching the shape of a plain data property. The property\n * is also `enumerable` before materialising, so presence checks\n * (`\"key\" in target`, `Object.hasOwn(target, key)`) observe it without\n * forcing the computation.\n *\n * This is the single shared implementation consumed across packages (e.g.\n * `@confect/core`'s lazy `FunctionSpec` schemas and `@confect/server`'s lazy\n * `Table` `Fields` / `Doc` / `tableDefinition`), so there is no chance of the\n * two drifting apart.\n */\nexport const defineProperty = <T extends object, K extends PropertyKey>(\n target: T,\n key: K,\n compute: () => unknown,\n): void => {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n get(this: T) {\n const value = compute();\n Object.defineProperty(this, key, {\n value,\n writable: false,\n enumerable: true,\n configurable: false,\n });\n return value;\n },\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,kBACX,QACA,KACA,YACS;CACT,OAAO,eAAe,QAAQ,KAAK;EACjC,cAAc;EACd,YAAY;EACZ,MAAa;GACX,MAAM,QAAQ,QAAQ;GACtB,OAAO,eAAe,MAAM,KAAK;IAC/B;IACA,UAAU;IACV,YAAY;IACZ,cAAc;GAChB,CAAC;GACD,OAAO;EACT;CACF,CAAC;AACH"}
@@ -0,0 +1,23 @@
1
+ import * as Schema from "effect/Schema";
2
+ /**
3
+ * Schema for the `paginationOpts` argument that every paginated query
4
+ * receives. Mirrors `paginationOptsValidator` from `convex/server`.
5
+ *
6
+ * Use this as the `paginationOpts` field of a paginated query's args schema.
7
+ * Beyond `numItems` and `cursor`, Convex's pagination protocol sends the
8
+ * optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)
9
+ * with real requests — most notably `usePaginatedQuery` from `convex/react`
10
+ * always includes `id`, and includes `endCursor` when splitting pages.
11
+ * Declaring them is required for the generated Convex argument validator to
12
+ * accept those requests and for the fields to survive decoding and reach
13
+ * `paginate`.
14
+ */
15
+ export declare const PaginationOptions: Schema.Struct<{
16
+ readonly numItems: Schema.Number;
17
+ readonly cursor: Schema.Union<readonly [Schema.String, Schema.Null]>;
18
+ readonly endCursor: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
19
+ readonly id: Schema.optionalKey<Schema.Number>;
20
+ readonly maximumRowsRead: Schema.optionalKey<Schema.Number>;
21
+ readonly maximumBytesRead: Schema.optionalKey<Schema.Number>;
22
+ }>;
23
+ //# sourceMappingURL=PaginationOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaginationOptions.d.ts","sourceRoot":"","sources":["../src/PaginationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import * as Schema from "effect/Schema";
3
+ //#region src/PaginationOptions.ts
4
+ var PaginationOptions_exports = /* @__PURE__ */ __exportAll({ PaginationOptions: () => PaginationOptions });
5
+ /**
6
+ * Schema for the `paginationOpts` argument that every paginated query
7
+ * receives. Mirrors `paginationOptsValidator` from `convex/server`.
8
+ *
9
+ * Use this as the `paginationOpts` field of a paginated query's args schema.
10
+ * Beyond `numItems` and `cursor`, Convex's pagination protocol sends the
11
+ * optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)
12
+ * with real requests — most notably `usePaginatedQuery` from `convex/react`
13
+ * always includes `id`, and includes `endCursor` when splitting pages.
14
+ * Declaring them is required for the generated Convex argument validator to
15
+ * accept those requests and for the fields to survive decoding and reach
16
+ * `paginate`.
17
+ */
18
+ const PaginationOptions = Schema.Struct({
19
+ numItems: Schema.Number,
20
+ cursor: Schema.Union([Schema.String, Schema.Null]),
21
+ endCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
22
+ id: Schema.optionalKey(Schema.Number),
23
+ maximumRowsRead: Schema.optionalKey(Schema.Number),
24
+ maximumBytesRead: Schema.optionalKey(Schema.Number)
25
+ });
26
+ //#endregion
27
+ export { PaginationOptions, PaginationOptions_exports };
28
+
29
+ //# sourceMappingURL=PaginationOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaginationOptions.js","names":[],"sources":["../src/PaginationOptions.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\n/**\n * Schema for the `paginationOpts` argument that every paginated query\n * receives. Mirrors `paginationOptsValidator` from `convex/server`.\n *\n * Use this as the `paginationOpts` field of a paginated query's args schema.\n * Beyond `numItems` and `cursor`, Convex's pagination protocol sends the\n * optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)\n * with real requests — most notably `usePaginatedQuery` from `convex/react`\n * always includes `id`, and includes `endCursor` when splitting pages.\n * Declaring them is required for the generated Convex argument validator to\n * accept those requests and for the fields to survive decoding and reach\n * `paginate`.\n */\nexport const PaginationOptions = Schema.Struct({\n numItems: Schema.Number,\n cursor: Schema.Union([Schema.String, Schema.Null]),\n endCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),\n id: Schema.optionalKey(Schema.Number),\n maximumRowsRead: Schema.optionalKey(Schema.Number),\n maximumBytesRead: Schema.optionalKey(Schema.Number),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,oBAAoB,OAAO,OAAO;CAC7C,UAAU,OAAO;CACjB,QAAQ,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC;CACjD,WAAW,OAAO,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC,CAAC;CACxE,IAAI,OAAO,YAAY,OAAO,MAAM;CACpC,iBAAiB,OAAO,YAAY,OAAO,MAAM;CACjD,kBAAkB,OAAO,YAAY,OAAO,MAAM;AACpD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import * as Schema from "effect/Schema";
2
+ export type PaginationResult<Doc extends Schema.Codec<any, any>> = ReturnType<typeof PaginationResult<Doc>>;
2
3
  export declare const PaginationResult: <Doc extends Schema.Codec<any, any>>(Doc: Doc) => Schema.Struct<{
3
4
  readonly page: Schema.mutable<Schema.$Array<Doc>>;
4
5
  readonly isDone: Schema.Boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACjE,KAAK,GAAG;;;;;;EAcN,CAAC"}
1
+ {"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,CAC3E,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACjE,KAAK,GAAG;;;;;;EAcN,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import * as Schema from "effect/Schema";
3
-
4
3
  //#region src/PaginationResult.ts
5
4
  var PaginationResult_exports = /* @__PURE__ */ __exportAll({ PaginationResult: () => PaginationResult });
6
5
  const PaginationResult = (Doc) => Schema.Struct({
@@ -14,7 +13,7 @@ const PaginationResult = (Doc) => Schema.Struct({
14
13
  Schema.Null
15
14
  ]))
16
15
  });
17
-
18
16
  //#endregion
19
17
  export { PaginationResult, PaginationResult_exports };
18
+
20
19
  //# sourceMappingURL=PaginationResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const PaginationResult = <Doc extends Schema.Codec<any, any>>(\n Doc: Doc,\n) =>\n Schema.Struct({\n page: Schema.mutable(Schema.Array(Doc)),\n isDone: Schema.Boolean,\n continueCursor: Schema.String,\n splitCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),\n pageStatus: Schema.optionalKey(\n Schema.Union([\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ]),\n ),\n });\n"],"mappings":";;;;;AAEA,MAAa,oBACX,QAEA,OAAO,OAAO;CACZ,MAAM,OAAO,QAAQ,OAAO,MAAM,IAAI,CAAC;CACvC,QAAQ,OAAO;CACf,gBAAgB,OAAO;CACvB,aAAa,OAAO,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,KAAK,CAAC,CAAC;CAC3E,YAAY,OAAO,YACjB,OAAO,MAAM;EACX,OAAO,QAAQ,mBAAmB;EAClC,OAAO,QAAQ,gBAAgB;EAC/B,OAAO;EACR,CAAC,CACH;CACF,CAAC"}
1
+ {"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport type PaginationResult<Doc extends Schema.Codec<any, any>> = ReturnType<\n typeof PaginationResult<Doc>\n>;\n\nexport const PaginationResult = <Doc extends Schema.Codec<any, any>>(\n Doc: Doc,\n) =>\n Schema.Struct({\n page: Schema.mutable(Schema.Array(Doc)),\n isDone: Schema.Boolean,\n continueCursor: Schema.String,\n splitCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),\n pageStatus: Schema.optionalKey(\n Schema.Union([\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ]),\n ),\n });\n"],"mappings":";;;;AAMA,MAAa,oBACX,QAEA,OAAO,OAAO;CACZ,MAAM,OAAO,QAAQ,OAAO,MAAM,GAAG,CAAC;CACtC,QAAQ,OAAO;CACf,gBAAgB,OAAO;CACvB,aAAa,OAAO,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC,CAAC;CAC1E,YAAY,OAAO,YACjB,OAAO,MAAM;EACX,OAAO,QAAQ,kBAAkB;EACjC,OAAO,QAAQ,eAAe;EAC9B,OAAO;CACT,CAAC,CACH;AACF,CAAC"}
package/dist/Ref.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FunctionReference as ConvexFunctionReference, FunctionVisibility } from "convex/server";
1
+ import type { FunctionReference as ConvexFunctionReference, FunctionVisibility, PaginationOptions, PaginationResult } from "convex/server";
2
2
  import type { Value } from "convex/values";
3
3
  import { ConvexError } from "convex/values";
4
4
  import * as Effect from "effect/Effect";
@@ -21,6 +21,11 @@ export interface AnyPublic extends Ref<any, "public", any, any, any> {
21
21
  }
22
22
  export interface AnyQuery extends Ref<RuntimeAndFunctionType.AnyQuery, FunctionVisibility, any, any, any> {
23
23
  }
24
+ export interface AnyPublicPaginatedQuery extends Ref<RuntimeAndFunctionType.AnyQuery, "public", {
25
+ [key: string]: any;
26
+ paginationOpts: PaginationOptions;
27
+ }, PaginationResult<any>, any> {
28
+ }
24
29
  export interface AnyMutation extends Ref<RuntimeAndFunctionType.AnyMutation, FunctionVisibility, any, any, any> {
25
30
  }
26
31
  export interface AnyAction extends Ref<RuntimeAndFunctionType.AnyAction, FunctionVisibility, any, any, any> {
@@ -77,11 +82,35 @@ export declare const decodeErrorOrElse: <Ref_ extends Any, E>(ref: Ref_, mapUnkn
77
82
  */
78
83
  export declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option.Option<Error<Ref_>>, Schema.SchemaError>;
79
84
  /**
80
- * Synchronous counterpart to `decodeError`. Throws on schema decode failure;
81
- * returns `None` when the ref doesn't declare a typed error.
85
+ * Synchronous counterpart to `decodeError`. Returns `None` when the value is
86
+ * not this ref's typed error — either because the ref declares no `error`
87
+ * schema, or because `encodedError` doesn't match the one it declares.
88
+ *
89
+ * The second case is reachable in normal operation: Convex raises its own
90
+ * `ConvexError`s (an `InvalidCursor` pagination error, for instance), and
91
+ * those never match a user-declared error schema. Callers pair this with a
92
+ * fallback that surfaces the original error, so failing to decode must not
93
+ * throw — a `ParseError` here would replace the real error with an opaque one
94
+ * and lose the only useful diagnostic. Hence the `Option` suffix rather than
95
+ * `Sync`, matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers
96
+ * in this module all throw on a parse failure, and this one deliberately
97
+ * doesn't.
98
+ */
99
+ export declare const decodeErrorOption: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Option.Option<Error<Ref_>>;
100
+ /**
101
+ * Encode the args of a paginated query ref via its user-args schema —
102
+ * `paginationOpts` is excluded, since the pagination protocol fields are
103
+ * managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by
104
+ * the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery`
105
+ * (or `internalPaginatedQuery`).
106
+ */
107
+ export declare const encodePaginatedQueryArgsSync: <Ref_ extends AnyPublicPaginatedQuery>(ref: Ref_, args: Omit<Args<Ref_>, "paginationOpts">) => unknown;
108
+ /**
109
+ * Decode a page of a paginated query's results via the ref's item schema.
110
+ * Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or
111
+ * `internalPaginatedQuery`).
82
112
  */
83
- export declare const decodeErrorSync: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Option.Option<Error<Ref_>>;
84
- export declare const maybeDecodeErrorSync: <Ref_ extends Any>(ref: Ref_, error: unknown) => unknown;
113
+ export declare const decodePaginationPageSync: <Ref_ extends AnyPublicPaginatedQuery>(ref: Ref_, encodedPage: unknown) => Returns<Ref_>["page"];
85
114
  /**
86
115
  * Encode args via the ref's args schema, invoke `call`, decode returns via the
87
116
  * ref's returns schema, and translate any thrown `ConvexError` into the ref's
package/dist/Ref.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../src/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,uBAAuB,EAC5C,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,YAAY,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AAExE,MAAM,WAAW,GAAG,CA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,SAAS,uBAAuB,EAEpC,KAAK,IAAI,EACT,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,KACvC,OAYA,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,IAAI,SAAS,uBAAuB,EAC3E,KAAK,IAAI,EACT,aAAa,OAAO,KACnB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAYK,CAAC;AAE7B;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,GAAG,EAAE,CAAC,GAAG,KAAK,EACtD,KAAK,IAAI,EACT,MAAM,IAAI,CAAC,IAAI,CAAC,EAChB,MAAM,CACJ,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAC1C,WAAW,EAAE,OAAO,KACjB,WAAW,CAAC,OAAO,CAAC,EACzB,kBAAkB,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,KACtC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAqChE,CAAC"}
package/dist/Ref.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import * as Option from "effect/Option";
3
2
  import * as Schema from "effect/Schema";
3
+ import * as Option from "effect/Option";
4
4
  import { makeFunctionReference } from "convex/server";
5
5
  import { ConvexError } from "convex/values";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Match from "effect/Match";
8
-
9
8
  //#region src/Ref.ts
10
9
  var Ref_exports = /* @__PURE__ */ __exportAll({
11
10
  decodeArgsSync: () => decodeArgsSync,
12
11
  decodeError: () => decodeError,
12
+ decodeErrorOption: () => decodeErrorOption,
13
13
  decodeErrorOrElse: () => decodeErrorOrElse,
14
- decodeErrorSync: () => decodeErrorSync,
14
+ decodePaginationPageSync: () => decodePaginationPageSync,
15
15
  decodeReturns: () => decodeReturns,
16
16
  decodeReturnsSync: () => decodeReturnsSync,
17
17
  encodeArgs: () => encodeArgs,
18
18
  encodeArgsSync: () => encodeArgsSync,
19
+ encodePaginatedQueryArgsSync: () => encodePaginatedQueryArgsSync,
19
20
  encodeReturnsSync: () => encodeReturnsSync,
20
21
  getConvexFunctionName: () => getConvexFunctionName,
21
22
  getFunctionReference: () => getFunctionReference,
22
23
  hasErrorSchema: () => hasErrorSchema,
23
24
  isConvexError: () => isConvexError,
24
25
  make: () => make,
25
- maybeDecodeErrorSync: () => maybeDecodeErrorSync,
26
26
  runWithCodec: () => runWithCodec
27
27
  });
28
28
  const make = (functionNamespace, functionSpec) => ({
@@ -59,7 +59,7 @@ const isConvexError = (error) => error instanceof ConvexError || typeof error ==
59
59
  */
60
60
  const decodeErrorOrElse = (ref, mapUnknownError) => (error) => {
61
61
  if (isConvexError(error)) {
62
- const decoded = decodeErrorSync(ref, error.data);
62
+ const decoded = decodeErrorOption(ref, error.data);
63
63
  if (Option.isSome(decoded)) return decoded.value;
64
64
  }
65
65
  return mapUnknownError(error);
@@ -73,11 +73,48 @@ const decodeErrorOrElse = (ref, mapUnknownError) => (error) => {
73
73
  */
74
74
  const decodeError = (ref, encodedError) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Effect.map(Schema.decodeUnknownEffect(confectFunctionProvenance.error)(encodedError), Option.some) : Effect.succeed(Option.none())), Match.tag("Convex", () => Effect.succeed(Option.none())), Match.exhaustive);
75
75
  /**
76
- * Synchronous counterpart to `decodeError`. Throws on schema decode failure;
77
- * returns `None` when the ref doesn't declare a typed error.
76
+ * Synchronous counterpart to `decodeError`. Returns `None` when the value is
77
+ * not this ref's typed error — either because the ref declares no `error`
78
+ * schema, or because `encodedError` doesn't match the one it declares.
79
+ *
80
+ * The second case is reachable in normal operation: Convex raises its own
81
+ * `ConvexError`s (an `InvalidCursor` pagination error, for instance), and
82
+ * those never match a user-declared error schema. Callers pair this with a
83
+ * fallback that surfaces the original error, so failing to decode must not
84
+ * throw — a `ParseError` here would replace the real error with an opaque one
85
+ * and lose the only useful diagnostic. Hence the `Option` suffix rather than
86
+ * `Sync`, matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers
87
+ * in this module all throw on a parse failure, and this one deliberately
88
+ * doesn't.
89
+ */
90
+ const decodeErrorOption = (ref, encodedError) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Schema.decodeUnknownOption(confectFunctionProvenance.error)(encodedError) : Option.none()), Match.tag("Convex", () => Option.none()), Match.exhaustive);
91
+ const missingPaginatedProvenanceError = (ref) => new globalThis.Error(`Paginated query ref "${getConvexFunctionName(ref)}" was not built with \`FunctionSpec.publicPaginatedQuery\` (or \`FunctionSpec.internalPaginatedQuery\`). Paginated encoding and decoding require the user-args and item schemas those constructors store. Define the function as, e.g.:
92
+
93
+ FunctionSpec.publicPaginatedQuery({
94
+ name: "...",
95
+ args: () => Schema.Struct({ ... }), // optional; without paginationOpts
96
+ item: () => ItemSchema,
97
+ })`);
98
+ /**
99
+ * Encode the args of a paginated query ref via its user-args schema —
100
+ * `paginationOpts` is excluded, since the pagination protocol fields are
101
+ * managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by
102
+ * the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery`
103
+ * (or `internalPaginatedQuery`).
104
+ */
105
+ const encodePaginatedQueryArgsSync = (ref, args) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => {
106
+ if (confectFunctionProvenance.kind._tag !== "Paginated") throw missingPaginatedProvenanceError(ref);
107
+ return Schema.encodeUnknownSync(confectFunctionProvenance.kind.userArgs)(args);
108
+ }), Match.tag("Convex", () => args), Match.exhaustive);
109
+ /**
110
+ * Decode a page of a paginated query's results via the ref's item schema.
111
+ * Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or
112
+ * `internalPaginatedQuery`).
78
113
  */
79
- const decodeErrorSync = (ref, encodedError) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Option.some(Schema.decodeUnknownSync(confectFunctionProvenance.error)(encodedError)) : Option.none()), Match.tag("Convex", () => Option.none()), Match.exhaustive);
80
- const maybeDecodeErrorSync = (ref, error) => isConvexError(error) ? Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Schema.decodeUnknownSync(confectFunctionProvenance.error)(error.data) : error), Match.tag("Convex", () => error), Match.exhaustive) : error;
114
+ const decodePaginationPageSync = (ref, encodedPage) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => {
115
+ if (confectFunctionProvenance.kind._tag !== "Paginated") throw missingPaginatedProvenanceError(ref);
116
+ return Schema.decodeUnknownSync(confectFunctionProvenance.kind.page)(encodedPage);
117
+ }), Match.tag("Convex", () => encodedPage), Match.exhaustive);
81
118
  /**
82
119
  * Encode args via the ref's args schema, invoke `call`, decode returns via the
83
120
  * ref's returns schema, and translate any thrown `ConvexError` into the ref's
@@ -93,7 +130,7 @@ const runWithCodec = (ref, args, call, mapUnknownError) => Effect.gen(function*
93
130
  try: () => Promise.resolve(call(functionReference, encodedArgs)),
94
131
  catch: (error) => {
95
132
  if (isConvexError(error)) {
96
- const decoded = decodeErrorSync(ref, error.data);
133
+ const decoded = decodeErrorOption(ref, error.data);
97
134
  if (Option.isSome(decoded)) return decoded.value;
98
135
  }
99
136
  if (mapUnknownError !== void 0) return mapUnknownError(error);
@@ -101,11 +138,12 @@ const runWithCodec = (ref, args, call, mapUnknownError) => Effect.gen(function*
101
138
  }
102
139
  });
103
140
  return yield* Match.value(functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Effect.gen(function* () {
104
- const encodedReturns = yield* invoke(yield* Schema.encodeEffect(confectFunctionProvenance.args)(args));
141
+ const encodedArgs = yield* Schema.encodeEffect(confectFunctionProvenance.args)(args);
142
+ const encodedReturns = yield* invoke(encodedArgs);
105
143
  return yield* Schema.decodeUnknownEffect(confectFunctionProvenance.returns)(encodedReturns);
106
144
  })), Match.tag("Convex", () => invoke(args)), Match.exhaustive);
107
145
  });
108
-
109
146
  //#endregion
110
- export { Ref_exports, decodeArgsSync, decodeError, decodeErrorOrElse, decodeErrorSync, decodeReturns, decodeReturnsSync, encodeArgs, encodeArgsSync, encodeReturnsSync, getConvexFunctionName, getFunctionReference, hasErrorSchema, isConvexError, make, maybeDecodeErrorSync, runWithCodec };
147
+ export { Ref_exports, decodeArgsSync, decodeError, decodeErrorOption, decodeErrorOrElse, decodePaginationPageSync, decodeReturns, decodeReturnsSync, encodeArgs, encodeArgsSync, encodePaginatedQueryArgsSync, encodeReturnsSync, getConvexFunctionName, getFunctionReference, hasErrorSchema, isConvexError, make, runWithCodec };
148
+
111
149
  //# sourceMappingURL=Ref.js.map