@confect/server 9.0.0-next.5 → 9.0.0-next.7

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 (62) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/dist/Auth.d.ts +1 -1
  3. package/dist/DatabaseReader.d.ts +4299 -26
  4. package/dist/DatabaseReader.d.ts.map +1 -1
  5. package/dist/DatabaseReader.js +5 -6
  6. package/dist/DatabaseReader.js.map +1 -1
  7. package/dist/DatabaseSchema.d.ts +25 -112
  8. package/dist/DatabaseSchema.d.ts.map +1 -1
  9. package/dist/DatabaseSchema.js +20 -30
  10. package/dist/DatabaseSchema.js.map +1 -1
  11. package/dist/DatabaseWriter.d.ts +4 -4
  12. package/dist/DatabaseWriter.d.ts.map +1 -1
  13. package/dist/DatabaseWriter.js +3 -4
  14. package/dist/DatabaseWriter.js.map +1 -1
  15. package/dist/FunctionImpl.d.ts +26 -17
  16. package/dist/FunctionImpl.d.ts.map +1 -1
  17. package/dist/FunctionImpl.js +22 -14
  18. package/dist/FunctionImpl.js.map +1 -1
  19. package/dist/GroupImpl.d.ts +22 -13
  20. package/dist/GroupImpl.d.ts.map +1 -1
  21. package/dist/GroupImpl.js +34 -35
  22. package/dist/GroupImpl.js.map +1 -1
  23. package/dist/Handler.d.ts +1 -1
  24. package/dist/QueryInitializer.d.ts.map +1 -1
  25. package/dist/QueryInitializer.js.map +1 -1
  26. package/dist/RegisteredConvexFunction.d.ts +1081 -14
  27. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  28. package/dist/RegisteredConvexFunction.js +4 -4
  29. package/dist/RegisteredConvexFunction.js.map +1 -1
  30. package/dist/RegisteredFunction.d.ts +3 -3
  31. package/dist/RegisteredFunction.d.ts.map +1 -1
  32. package/dist/RegisteredFunctions.d.ts +36 -12
  33. package/dist/RegisteredFunctions.d.ts.map +1 -1
  34. package/dist/RegisteredFunctions.js +21 -9
  35. package/dist/RegisteredFunctions.js.map +1 -1
  36. package/dist/RegisteredNodeFunction.d.ts +4 -4
  37. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  38. package/dist/RegisteredNodeFunction.js +2 -2
  39. package/dist/RegisteredNodeFunction.js.map +1 -1
  40. package/dist/Table.d.ts +39 -31
  41. package/dist/Table.d.ts.map +1 -1
  42. package/dist/Table.js +69 -60
  43. package/dist/Table.js.map +1 -1
  44. package/dist/index.d.ts +4 -5
  45. package/dist/index.js +4 -5
  46. package/package.json +51 -52
  47. package/src/DatabaseReader.ts +17 -21
  48. package/src/DatabaseSchema.ts +38 -98
  49. package/src/DatabaseWriter.ts +8 -5
  50. package/src/FunctionImpl.ts +33 -43
  51. package/src/GroupImpl.ts +45 -69
  52. package/src/QueryInitializer.ts +10 -2
  53. package/src/RegisteredConvexFunction.ts +5 -6
  54. package/src/RegisteredFunctions.ts +67 -93
  55. package/src/RegisteredNodeFunction.ts +3 -4
  56. package/src/Table.ts +251 -131
  57. package/src/index.ts +0 -1
  58. package/dist/Api.d.ts +0 -43
  59. package/dist/Api.d.ts.map +0 -1
  60. package/dist/Api.js +0 -43
  61. package/dist/Api.js.map +0 -1
  62. package/src/Api.ts +0 -102
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredConvexFunction.d.ts","names":[],"sources":["../src/RegisteredConvexFunction.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCa,IAAA,gBAAqB,uBAAA,YAChC,GAAA,EAAK,IAAA;EACL,YAAA;EAAA;AAAA,GAA2B,cAAA,KAC1B,GAAA;AAAA,cAkLU,aAAA,kBAAgC,YAAA,EAC3C,MAAA,EAAQ,MAAA,EACR,GAAA,EAAK,kBAAA,CAAmB,QAAA,CAAmB,UAAA,CAAqB,MAAA,QAAS,KAAA,CAAA,KAAA,CAAA,eAAA,GAAA,MAAA;0BAAA,kBAAA,CAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;KAoB/D,gBAAA,gBAAgC,YAAA,IACxC,cAAA,CAA8B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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoBb,gBAAA,gBAAgC,YAAA,IACxC,cAAA,CAA8B,MAAA,IAC9B,cAAA,CAA8B,MAAA,IAC9B,MAAA,GACA,WAAA,GACA,eAAA,GACA,eAAA,GACA,WAAA,GACA,cAAA,GACA,WAAA,CAAwB,QAAA,CAAmB,UAAA,CAAqB,MAAA"}
@@ -20,11 +20,11 @@ var RegisteredConvexFunction_exports = /* @__PURE__ */ __exportAll({
20
20
  make: () => make,
21
21
  mutationLayer: () => mutationLayer
22
22
  });
23
- const make = (api, { functionSpec, handler }) => Match.value(functionSpec.functionProvenance).pipe(Match.tag("Convex", () => handler), Match.tag("Confect", () => {
23
+ const make = (databaseSchema, { functionSpec, handler }) => Match.value(functionSpec.functionProvenance).pipe(Match.tag("Convex", () => handler), Match.tag("Confect", () => {
24
24
  const { functionVisibility, functionProvenance } = functionSpec;
25
25
  return Match.value(functionSpec.runtimeAndFunctionType.functionType).pipe(Match.when("query", () => {
26
26
  return Match.value(functionVisibility).pipe(Match.when("public", () => queryGeneric), Match.when("internal", () => internalQueryGeneric), Match.exhaustive)(queryFunction({
27
- databaseSchema: api.databaseSchema,
27
+ databaseSchema,
28
28
  args: functionProvenance.args,
29
29
  returns: functionProvenance.returns,
30
30
  error: functionProvenance.error,
@@ -32,14 +32,14 @@ const make = (api, { functionSpec, handler }) => Match.value(functionSpec.functi
32
32
  }));
33
33
  }), Match.when("mutation", () => {
34
34
  return Match.value(functionVisibility).pipe(Match.when("public", () => mutationGeneric), Match.when("internal", () => internalMutationGeneric), Match.exhaustive)(mutationFunction({
35
- databaseSchema: api.databaseSchema,
35
+ databaseSchema,
36
36
  args: functionProvenance.args,
37
37
  returns: functionProvenance.returns,
38
38
  error: functionProvenance.error,
39
39
  handler
40
40
  }));
41
41
  }), Match.when("action", () => {
42
- return Match.value(functionVisibility).pipe(Match.when("public", () => actionGeneric), Match.when("internal", () => internalActionGeneric), Match.exhaustive)(convexActionFunction(api.databaseSchema, {
42
+ return Match.value(functionVisibility).pipe(Match.when("public", () => actionGeneric), Match.when("internal", () => internalActionGeneric), Match.exhaustive)(convexActionFunction(databaseSchema, {
43
43
  args: functionProvenance.args,
44
44
  returns: functionProvenance.returns,
45
45
  error: functionProvenance.error,
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredConvexFunction.js","names":["SchemaToValidator.compileArgsSchema","SchemaToValidator.compileReturnsSchema","DatabaseReader.layer","Auth.layer","StorageReader","QueryRunner.layer","QueryCtx.QueryCtx","ConvexConfigProvider.make","RegisteredFunction.runHandlerPromise","DatabaseWriter.layer","Scheduler.layer","StorageWriter","MutationRunner.layer","MutationCtx.MutationCtx","RegisteredFunction.actionFunctionBase","RegisteredFunction.actionLayer"],"sources":["../src/RegisteredConvexFunction.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport {\n actionGeneric,\n type DefaultFunctionArgs,\n type GenericMutationCtx,\n type GenericQueryCtx,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n mutationGeneric,\n queryGeneric,\n} from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { Clock, Effect, Layer, Match, pipe, Schema } from \"effect\";\nimport type * as Api from \"./Api\";\nimport * as Auth from \"./Auth\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as DatabaseReader from \"./DatabaseReader\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport * as DatabaseWriter from \"./DatabaseWriter\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as Handler from \"./Handler\";\nimport * as MutationCtx from \"./MutationCtx\";\nimport * as MutationRunner from \"./MutationRunner\";\nimport * as QueryCtx from \"./QueryCtx\";\nimport * as QueryRunner from \"./QueryRunner\";\nimport * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as RegistryItem from \"./RegistryItem\";\nimport * as Scheduler from \"./Scheduler\";\nimport * as SchemaToValidator from \"./SchemaToValidator\";\nimport { StorageReader } from \"./StorageReader\";\nimport { StorageWriter } from \"./StorageWriter\";\n\nexport const make = <Api_ extends Api.AnyWithPropsWithRuntime<\"Convex\">>(\n api: Api_,\n { functionSpec, handler }: RegistryItem.AnyWithProps,\n): RegisteredFunction.Any =>\n Match.value(functionSpec.functionProvenance).pipe(\n Match.tag(\"Convex\", () => handler as RegisteredFunction.Any),\n Match.tag(\"Confect\", () => {\n const { functionVisibility, functionProvenance } =\n functionSpec as FunctionSpec.AnyConfect;\n\n return Match.value(functionSpec.runtimeAndFunctionType.functionType).pipe(\n Match.when(\"query\", () => {\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => queryGeneric),\n Match.when(\"internal\", () => internalQueryGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n queryFunction({\n databaseSchema: api.databaseSchema,\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.when(\"mutation\", () => {\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => mutationGeneric),\n Match.when(\"internal\", () => internalMutationGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n mutationFunction({\n databaseSchema: api.databaseSchema,\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.when(\"action\", () => {\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => actionGeneric),\n Match.when(\"internal\", () => internalActionGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n convexActionFunction(api.databaseSchema, {\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.exhaustive,\n );\n }),\n Match.exhaustive,\n );\n\n/**\n * Convex's query cache is invalidated by any Date.now() call during handler\n * execution. Effect's unsafeFork calls Date.now() when constructing a\n * FiberId.Runtime, which trips the cache for every confect-wrapped query. We\n * stub Date.now to 0 for the span of the handler; queries are forbidden from\n * relying on real time for correctness anyway.\n *\n * Users who explicitly want the real timestamp can still reach it via Effect's\n * Clock service (Clock.currentTimeMillis/Clock.currentTimeNanos). We provide a\n * Clock whose user-facing Effects call realDateNow (Convex's tracker) directly,\n * making Clock an explicit opt-in to cache invalidation. The unsafe methods\n * used internally by Effect (logging, span events, scheduler) return constants\n * so they never touch the tracker—caching is not broken by default.\n */\nconst unpatchedClock = (realDateNow: () => number): Clock.Clock => {\n const defaultClock = Clock.make();\n return {\n ...defaultClock,\n unsafeCurrentTimeMillis: () => 0,\n unsafeCurrentTimeNanos: () => 0n,\n currentTimeMillis: Effect.sync(() => realDateNow()),\n currentTimeNanos: Effect.sync(() => BigInt(realDateNow()) * 1_000_000n),\n };\n};\n\nconst withStubbedDateNow = async <T>(\n queryHandler: (clock: Clock.Clock) => Promise<T>,\n): Promise<T> => {\n const realDateNow = Date.now;\n const clock = unpatchedClock(realDateNow);\n Date.now = () => 0;\n try {\n return await queryHandler(clock);\n } finally {\n Date.now = realDateNow;\n }\n};\n\nconst queryFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>({\n databaseSchema,\n args,\n returns,\n error,\n handler,\n}: {\n databaseSchema: DatabaseSchema_;\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema<Error, Value> | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | Auth.Auth\n | StorageReader\n | QueryRunner.QueryRunner\n | QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >\n >;\n}) => ({\n args: SchemaToValidator.compileArgsSchema(args),\n returns: SchemaToValidator.compileReturnsSchema(returns),\n handler: (\n ctx: GenericQueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n actualArgs: ConvexArgs,\n ): Promise<ConvexReturns> =>\n withStubbedDateNow((clock) =>\n Effect.gen(function* () {\n const decodedArgs = yield* pipe(\n actualArgs,\n Schema.decode(args),\n Effect.orDie,\n );\n const decodedReturns = yield* handler(decodedArgs).pipe(\n Effect.provide(\n Layer.mergeAll(\n DatabaseReader.layer(databaseSchema, ctx.db),\n Auth.layer(ctx.auth),\n StorageReader.layer(ctx.storage),\n QueryRunner.layer(ctx.runQuery),\n Layer.succeed(\n QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >(),\n ctx,\n ),\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n ),\n ),\n );\n return yield* pipe(\n decodedReturns,\n Schema.encode(returns),\n Effect.orDie,\n );\n }).pipe(\n Effect.withClock(clock),\n RegisteredFunction.runHandlerPromise(error),\n ),\n ),\n});\n\nexport const mutationLayer = <Schema extends DatabaseSchema.AnyWithProps>(\n schema: Schema,\n ctx: GenericMutationCtx<DataModel.ToConvex<DataModel.FromSchema<Schema>>>,\n) =>\n Layer.mergeAll(\n DatabaseReader.layer(schema, ctx.db),\n DatabaseWriter.layer(schema, ctx.db),\n Auth.layer(ctx.auth),\n Scheduler.layer(ctx.scheduler),\n StorageReader.layer(ctx.storage),\n StorageWriter.layer(ctx.storage),\n QueryRunner.layer(ctx.runQuery),\n MutationRunner.layer(ctx.runMutation),\n Layer.succeed(\n MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<Schema>>\n >(),\n ctx,\n ),\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n );\n\nexport type MutationServices<Schema extends DatabaseSchema.AnyWithProps> =\n | DatabaseReader.DatabaseReader<Schema>\n | DatabaseWriter.DatabaseWriter<Schema>\n | Auth.Auth\n | Scheduler.Scheduler\n | StorageReader\n | StorageWriter\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | MutationCtx.MutationCtx<DataModel.ToConvex<DataModel.FromSchema<Schema>>>;\n\nconst mutationFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>({\n databaseSchema,\n args,\n returns,\n error,\n handler,\n}: {\n databaseSchema: DatabaseSchema_;\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema<Error, Value> | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<Returns, E, MutationServices<DatabaseSchema_>>;\n}) => ({\n args: SchemaToValidator.compileArgsSchema(args),\n returns: SchemaToValidator.compileReturnsSchema(returns),\n handler: (\n ctx: GenericMutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n actualArgs: ConvexArgs,\n ): Promise<ConvexReturns> =>\n Effect.gen(function* () {\n const decodedArgs = yield* pipe(\n actualArgs,\n Schema.decode(args),\n Effect.orDie,\n );\n const decodedReturns = yield* handler(decodedArgs).pipe(\n Effect.provide(mutationLayer(databaseSchema, ctx)),\n );\n return yield* pipe(decodedReturns, Schema.encode(returns), Effect.orDie);\n }).pipe(RegisteredFunction.runHandlerPromise(error)),\n});\n\nconst convexActionFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>(\n schema: DatabaseSchema_,\n {\n args,\n returns,\n error,\n handler,\n }: {\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema.AnyNoContext | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n RegisteredFunction.ActionServices<DatabaseSchema_>\n >;\n },\n) =>\n RegisteredFunction.actionFunctionBase({\n args,\n returns,\n error,\n handler,\n createLayer: (ctx) =>\n Layer.mergeAll(\n RegisteredFunction.actionLayer(schema, ctx),\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n ),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,QACX,KACA,EAAE,cAAc,cAEhB,MAAM,MAAM,aAAa,mBAAmB,CAAC,KAC3C,MAAM,IAAI,gBAAgB,QAAkC,EAC5D,MAAM,IAAI,iBAAiB;CACzB,MAAM,EAAE,oBAAoB,uBAC1B;AAEF,QAAO,MAAM,MAAM,aAAa,uBAAuB,aAAa,CAAC,KACnE,MAAM,KAAK,eAAe;AAOxB,SANwB,MAAM,MAAM,mBAAmB,CAAC,KACtD,MAAM,KAAK,gBAAgB,aAAa,EACxC,MAAM,KAAK,kBAAkB,qBAAqB,EAClD,MAAM,WACP,CAGC,cAAc;GACZ,gBAAgB,IAAI;GACpB,MAAM,mBAAmB;GACzB,SAAS,mBAAmB;GAC5B,OAAO,mBAAmB;GACjB;GACV,CAAC,CACH;GACD,EACF,MAAM,KAAK,kBAAkB;AAO3B,SANwB,MAAM,MAAM,mBAAmB,CAAC,KACtD,MAAM,K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ator.compileArgsSchema","SchemaToValidator.compileReturnsSchema","DatabaseReader.layer","Auth.layer","StorageReader","QueryRunner.layer","QueryCtx.QueryCtx","ConvexConfigProvider.make","RegisteredFunction.runHandlerPromise","DatabaseWriter.layer","Scheduler.layer","StorageWriter","MutationRunner.layer","MutationCtx.MutationCtx","RegisteredFunction.actionFunctionBase","RegisteredFunction.actionLayer"],"sources":["../src/RegisteredConvexFunction.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport {\n actionGeneric,\n type DefaultFunctionArgs,\n type GenericMutationCtx,\n type GenericQueryCtx,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n mutationGeneric,\n queryGeneric,\n} from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { Clock, Effect, Layer, Match, pipe, Schema } from \"effect\";\nimport * as Auth from \"./Auth\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as DatabaseReader from \"./DatabaseReader\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport * as DatabaseWriter from \"./DatabaseWriter\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as Handler from \"./Handler\";\nimport * as MutationCtx from \"./MutationCtx\";\nimport * as MutationRunner from \"./MutationRunner\";\nimport * as QueryCtx from \"./QueryCtx\";\nimport * as QueryRunner from \"./QueryRunner\";\nimport * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as RegistryItem from \"./RegistryItem\";\nimport * as Scheduler from \"./Scheduler\";\nimport * as SchemaToValidator from \"./SchemaToValidator\";\nimport { StorageReader } from \"./StorageReader\";\nimport { StorageWriter } from \"./StorageWriter\";\n\nexport const make = (\n databaseSchema: DatabaseSchema.AnyWithProps,\n { functionSpec, handler }: RegistryItem.AnyWithProps,\n): RegisteredFunction.Any =>\n Match.value(functionSpec.functionProvenance).pipe(\n Match.tag(\"Convex\", () => handler as RegisteredFunction.Any),\n Match.tag(\"Confect\", () => {\n const { functionVisibility, functionProvenance } =\n functionSpec as FunctionSpec.AnyConfect;\n\n return Match.value(functionSpec.runtimeAndFunctionType.functionType).pipe(\n Match.when(\"query\", () => {\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => queryGeneric),\n Match.when(\"internal\", () => internalQueryGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n queryFunction({\n databaseSchema,\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.when(\"mutation\", () => {\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => mutationGeneric),\n Match.when(\"internal\", () => internalMutationGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n mutationFunction({\n databaseSchema,\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.when(\"action\", () => {\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => actionGeneric),\n Match.when(\"internal\", () => internalActionGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n convexActionFunction(databaseSchema, {\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.exhaustive,\n );\n }),\n Match.exhaustive,\n );\n\n/**\n * Convex's query cache is invalidated by any Date.now() call during handler\n * execution. Effect's unsafeFork calls Date.now() when constructing a\n * FiberId.Runtime, which trips the cache for every confect-wrapped query. We\n * stub Date.now to 0 for the span of the handler; queries are forbidden from\n * relying on real time for correctness anyway.\n *\n * Users who explicitly want the real timestamp can still reach it via Effect's\n * Clock service (Clock.currentTimeMillis/Clock.currentTimeNanos). We provide a\n * Clock whose user-facing Effects call realDateNow (Convex's tracker) directly,\n * making Clock an explicit opt-in to cache invalidation. The unsafe methods\n * used internally by Effect (logging, span events, scheduler) return constants\n * so they never touch the tracker—caching is not broken by default.\n */\nconst unpatchedClock = (realDateNow: () => number): Clock.Clock => {\n const defaultClock = Clock.make();\n return {\n ...defaultClock,\n unsafeCurrentTimeMillis: () => 0,\n unsafeCurrentTimeNanos: () => 0n,\n currentTimeMillis: Effect.sync(() => realDateNow()),\n currentTimeNanos: Effect.sync(() => BigInt(realDateNow()) * 1_000_000n),\n };\n};\n\nconst withStubbedDateNow = async <T>(\n queryHandler: (clock: Clock.Clock) => Promise<T>,\n): Promise<T> => {\n const realDateNow = Date.now;\n const clock = unpatchedClock(realDateNow);\n Date.now = () => 0;\n try {\n return await queryHandler(clock);\n } finally {\n Date.now = realDateNow;\n }\n};\n\nconst queryFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>({\n databaseSchema,\n args,\n returns,\n error,\n handler,\n}: {\n databaseSchema: DatabaseSchema_;\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema<Error, Value> | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | Auth.Auth\n | StorageReader\n | QueryRunner.QueryRunner\n | QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >\n >;\n}) => ({\n args: SchemaToValidator.compileArgsSchema(args),\n returns: SchemaToValidator.compileReturnsSchema(returns),\n handler: (\n ctx: GenericQueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n actualArgs: ConvexArgs,\n ): Promise<ConvexReturns> =>\n withStubbedDateNow((clock) =>\n Effect.gen(function* () {\n const decodedArgs = yield* pipe(\n actualArgs,\n Schema.decode(args),\n Effect.orDie,\n );\n const decodedReturns = yield* handler(decodedArgs).pipe(\n Effect.provide(\n Layer.mergeAll(\n DatabaseReader.layer(databaseSchema, ctx.db),\n Auth.layer(ctx.auth),\n StorageReader.layer(ctx.storage),\n QueryRunner.layer(ctx.runQuery),\n Layer.succeed(\n QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >(),\n ctx,\n ),\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n ),\n ),\n );\n return yield* pipe(\n decodedReturns,\n Schema.encode(returns),\n Effect.orDie,\n );\n }).pipe(\n Effect.withClock(clock),\n RegisteredFunction.runHandlerPromise(error),\n ),\n ),\n});\n\nexport const mutationLayer = <Schema extends DatabaseSchema.AnyWithProps>(\n schema: Schema,\n ctx: GenericMutationCtx<DataModel.ToConvex<DataModel.FromSchema<Schema>>>,\n) =>\n Layer.mergeAll(\n DatabaseReader.layer(schema, ctx.db),\n DatabaseWriter.layer(schema, ctx.db),\n Auth.layer(ctx.auth),\n Scheduler.layer(ctx.scheduler),\n StorageReader.layer(ctx.storage),\n StorageWriter.layer(ctx.storage),\n QueryRunner.layer(ctx.runQuery),\n MutationRunner.layer(ctx.runMutation),\n Layer.succeed(\n MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<Schema>>\n >(),\n ctx,\n ),\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n );\n\nexport type MutationServices<Schema extends DatabaseSchema.AnyWithProps> =\n | DatabaseReader.DatabaseReader<Schema>\n | DatabaseWriter.DatabaseWriter<Schema>\n | Auth.Auth\n | Scheduler.Scheduler\n | StorageReader\n | StorageWriter\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | MutationCtx.MutationCtx<DataModel.ToConvex<DataModel.FromSchema<Schema>>>;\n\nconst mutationFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>({\n databaseSchema,\n args,\n returns,\n error,\n handler,\n}: {\n databaseSchema: DatabaseSchema_;\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema<Error, Value> | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<Returns, E, MutationServices<DatabaseSchema_>>;\n}) => ({\n args: SchemaToValidator.compileArgsSchema(args),\n returns: SchemaToValidator.compileReturnsSchema(returns),\n handler: (\n ctx: GenericMutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n actualArgs: ConvexArgs,\n ): Promise<ConvexReturns> =>\n Effect.gen(function* () {\n const decodedArgs = yield* pipe(\n actualArgs,\n Schema.decode(args),\n Effect.orDie,\n );\n const decodedReturns = yield* handler(decodedArgs).pipe(\n Effect.provide(mutationLayer(databaseSchema, ctx)),\n );\n return yield* pipe(decodedReturns, Schema.encode(returns), Effect.orDie);\n }).pipe(RegisteredFunction.runHandlerPromise(error)),\n});\n\nconst convexActionFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>(\n schema: DatabaseSchema_,\n {\n args,\n returns,\n error,\n handler,\n }: {\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema.AnyNoContext | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n RegisteredFunction.ActionServices<DatabaseSchema_>\n >;\n },\n) =>\n RegisteredFunction.actionFunctionBase({\n args,\n returns,\n error,\n handler,\n createLayer: (ctx) =>\n Layer.mergeAll(\n RegisteredFunction.actionLayer(schema, ctx),\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n ),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,QACX,gBACA,EAAE,cAAc,cAEhB,MAAM,MAAM,aAAa,mBAAmB,CAAC,KAC3C,MAAM,IAAI,gBAAgB,QAAkC,EAC5D,MAAM,IAAI,iBAAiB;CACzB,MAAM,EAAE,oBAAoB,uBAC1B;AAEF,QAAO,MAAM,MAAM,aAAa,uB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C,CACnD,EACkC,OAAO,OAAO,QAAQ,EAAE,OAAO,MAAM;GACxE,CAAC,KAAKO,kBAAqC,MAAM,CAAC;CACvD;AAED,MAAM,wBAQJ,QACA,EACE,MACA,SACA,OACA,cAcFM,mBAAsC;CACpC;CACA;CACA;CACA;CACA,cAAc,QACZ,MAAM,SACJC,YAA+B,QAAQ,IAAI,EAC3C,MAAM,kBAAkBR,QAA2B,CAAC,CACrD;CACJ,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { ActionCtx } from "./ActionCtx.js";
2
2
  import { ActionRunner } from "./ActionRunner.js";
3
- import { AnyWithProps } from "./DatabaseSchema.js";
4
3
  import { Auth as Auth$1 } from "./Auth.js";
4
+ import { AnyWithProps } from "./DatabaseSchema.js";
5
5
  import { FromSchema, TableNames, ToConvex } from "./DataModel.js";
6
6
  import { MutationRunner } from "./MutationRunner.js";
7
7
  import { QueryRunner } from "./QueryRunner.js";
@@ -70,10 +70,10 @@ declare const actionFunctionBase: <Schema extends AnyWithProps, Args, ConvexArgs
70
70
  handler: (ctx: GenericActionCtx<ToConvex<FromSchema<Schema>>>, actualArgs: ConvexArgs) => Promise<ConvexReturns>;
71
71
  };
72
72
  type ActionServices<DatabaseSchema_ extends AnyWithProps> = Scheduler$1 | Auth$1 | StorageReader$1 | StorageWriter$1 | StorageActionWriter$1 | QueryRunner | MutationRunner | ActionRunner | VectorSearch<FromSchema<DatabaseSchema_>> | ActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>;
73
- declare const actionLayer: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, ctx: GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>) => Layer.Layer<(<Action extends _confect_core_Ref0.AnyAction>(action: Action, ...args: _confect_core_Ref0.OptionalArgs<Action>) => Effect.Effect<_confect_core_Ref0.Returns<Action>, _confect_core_Ref0.Error<Action> | effect_ParseResult0.ParseError>) | StorageActionWriter$1 | StorageWriter$1 | Auth$1 | GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>> | {
73
+ declare const actionLayer: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, ctx: GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>) => Layer.Layer<(<Action extends _confect_core_Ref0.AnyAction>(action: Action, ...args: _confect_core_Ref0.OptionalArgs<Action>) => Effect.Effect<_confect_core_Ref0.Returns<Action>, _confect_core_Ref0.Error<Action> | effect_ParseResult0.ParseError>) | GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>> | {
74
74
  runAfter: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(delay: effect_Duration0.Duration, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
75
75
  runAt: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(dateTime: effect_DateTime0.DateTime, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
76
- } | StorageReader$1 | (<Query extends _confect_core_Ref0.AnyQuery>(query: Query, ...args: _confect_core_Ref0.OptionalArgs<Query>) => Effect.Effect<_confect_core_Ref0.Returns<Query>, _confect_core_Ref0.Error<Query> | effect_ParseResult0.ParseError>) | (<Mutation extends _confect_core_Ref0.AnyMutation>(mutation: Mutation, ...args: _confect_core_Ref0.OptionalArgs<Mutation>) => Effect.Effect<_confect_core_Ref0.Returns<Mutation>, _confect_core_Ref0.Error<Mutation> | effect_ParseResult0.ParseError>) | (<TableName extends TableNames<FromSchema<DatabaseSchema_>>, IndexName extends keyof convex_server0.VectorIndexes<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>>>(tableName: TableName, indexName: IndexName, query: {
76
+ } | Auth$1 | StorageReader$1 | StorageWriter$1 | StorageActionWriter$1 | (<Query extends _confect_core_Ref0.AnyQuery>(query: Query, ...args: _confect_core_Ref0.OptionalArgs<Query>) => Effect.Effect<_confect_core_Ref0.Returns<Query>, _confect_core_Ref0.Error<Query> | effect_ParseResult0.ParseError>) | (<Mutation extends _confect_core_Ref0.AnyMutation>(mutation: Mutation, ...args: _confect_core_Ref0.OptionalArgs<Mutation>) => Effect.Effect<_confect_core_Ref0.Returns<Mutation>, _confect_core_Ref0.Error<Mutation> | effect_ParseResult0.ParseError>) | (<TableName extends TableNames<FromSchema<DatabaseSchema_>>, IndexName extends keyof convex_server0.VectorIndexes<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>>>(tableName: TableName, indexName: IndexName, query: {
77
77
  vector: number[];
78
78
  limit?: number;
79
79
  filter?: (q: convex_server0.VectorFilterBuilder<convex_server0.DocumentByInfo<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>>, convex_server0.NamedVectorIndex<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>, IndexName>>) => convex_server0.FilterExpression<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredFunction.d.ts","names":[],"sources":["../src/RegisteredFunction.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BY,GAAA,GACR,eAAA,CAAgB,kBAAA,EAAoB,mBAAA,SACpC,kBAAA,CAAmB,kBAAA,EAAoB,mBAAA,SACvC,gBAAA,CAAiB,kBAAA,EAAoB,mBAAA;AAAA,KAEpC,yBAAA,uBACmB,YAAA,CAAa,YAAA,IAEnC,YAAA,CAAa,WAAA,CAAY,aAAA,8BACvB,mBAAA,GACE,sBAAA,CAAuB,eAAA,CACrB,aAAA,8CAEA,eAAA,CACE,YAAA,CAAa,qBAAA,CAAsB,aAAA,GACnC,KAAA,EACA,OAAA,CAAQ,YAAA,CAAa,cAAA,CAAe,aAAA,MAEtC,sBAAA,CAAuB,eAAA,CACnB,aAAA,iDAEF,kBAAA,CACE,YAAA,CAAa,qBA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A,CAAqB,eAAA,KAC/C,SAAA,CACE,QAAA,CAAmB,UAAA,CAAqB,eAAA;AAAA,cAGjC,WAAA,2BACa,YAAA,EAExB,cAAA,EAAgB,eAAA,EAChB,GAAA,EAAK,gBAAA,CACH,QAAA,CAAmB,UAAA,CAAqB,eAAA,QACzC,KAAA,CAAA,KAAA,kBAFoB,kBAAA,CAEpB,SAAA,EAAA,MAAA,EAAA,MAAA,KAAA,IAAA,EAAA,kBAAA,CAAA,YAAA,CAAA,MAAA,MAAA,MAAA,CAAA,MAAA,CAAA,kBAAA,CAAA,OAAA,CAAA,MAAA,GAAA,kBAAA,CAAA,KAAA,CAAA,MAAA,IAAA,mBAAA,CAAA,UAAA,KAAA,gBAAA,CAAA,QAAA,CAAA,UAAA,CAAA,eAAA;0BAAA,kBAAA,CAAA,WAAA"}
@@ -1,33 +1,57 @@
1
- import { AnyWithProps as AnyWithProps$1 } from "./Api.js";
1
+ import { AnyWithProps as AnyWithProps$1 } from "./DatabaseSchema.js";
2
2
  import { Any, RegisteredFunction } from "./RegisteredFunction.js";
3
3
  import { GroupImpl } from "./GroupImpl.js";
4
4
  import { AnyWithProps as AnyWithProps$2 } from "./RegistryItem.js";
5
5
  import { Layer, Types } from "effect";
6
+ import * as FunctionSpec from "@confect/core/FunctionSpec";
6
7
  import * as GroupSpec from "@confect/core/GroupSpec";
7
8
  import * as Spec from "@confect/core/Spec";
8
- import * as FunctionSpec from "@confect/core/FunctionSpec";
9
9
 
10
10
  //#region src/RegisteredFunctions.d.ts
11
11
  declare namespace RegisteredFunctions_d_exports {
12
- export { AnyWithProps, ForGroupPath, RegisteredFunctions, buildForGroup };
12
+ export { AnyWithProps, RegisteredFunctions, RegisteredFunctionsForGroupSpec, buildForGroup };
13
13
  }
14
14
  type RegisteredFunctions<Spec_ extends Spec.AnyWithProps> = Types.Simplify<RegisteredFunctionsHelper<Spec.Groups<Spec_>>>;
15
- type RegisteredFunctionsHelper<Groups extends GroupSpec.AnyWithProps> = { [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<Groups, GroupName> extends infer Group extends GroupSpec.AnyWithProps ? GroupSpec.Groups<Group> extends infer SubGroups extends GroupSpec.AnyWithProps ? Types.Simplify<RegisteredFunctionsHelper<SubGroups> & { [FunctionName in FunctionSpec.Name<GroupSpec.Functions<Group>>]: FunctionSpec.WithName<GroupSpec.Functions<Group>, FunctionName> extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps ? RegisteredFunction<FunctionSpec_> : never }> : { [FunctionName in FunctionSpec.Name<GroupSpec.Functions<Group>>]: FunctionSpec.WithName<GroupSpec.Functions<Group>, FunctionName> extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps ? RegisteredFunction<FunctionSpec_> : never } : never };
15
+ type RegisteredFunctionsHelper<Groups extends GroupSpec.AnyWithProps> = { [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<Groups, GroupName> extends infer Group extends GroupSpec.AnyWithProps ? RegisteredFunctionsForGroupSpec<Group> : never };
16
+ /** The `RegisteredFunction` record for a group's own declared functions. */
17
+ type RegisteredFunctionsOf<Group extends GroupSpec.AnyWithProps> = { [FunctionName in FunctionSpec.Name<GroupSpec.Functions<Group>>]: FunctionSpec.WithName<GroupSpec.Functions<Group>, FunctionName> extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps ? RegisteredFunction<FunctionSpec_> : never };
18
+ /**
19
+ * The registered-functions record for a single group, derived from the group's
20
+ * own `GroupSpec`: its declared functions, plus any nested subgroups it carries
21
+ * directly. This is the node that `buildForGroup` returns — computed from the
22
+ * leaf `GroupSpec` itself rather than by navigating the project-wide assembled
23
+ * `Spec` to a dot-path, so the per-group registry's type depends only on its
24
+ * own leaf. For the filesystem layout a leaf `GroupSpec` carries no subgroups
25
+ * (subdirectory children are assembled separately into `_generated/spec.ts`),
26
+ * so this resolves to just the leaf's functions.
27
+ */
28
+ type RegisteredFunctionsForGroupSpec<Group extends GroupSpec.AnyWithProps> = GroupSpec.Groups<Group> extends infer SubGroups extends GroupSpec.AnyWithProps ? Types.Simplify<RegisteredFunctionsHelper<SubGroups> & RegisteredFunctionsOf<Group>> : RegisteredFunctionsOf<Group>;
16
29
  interface AnyWithProps {
17
30
  readonly [key: string]: Any | AnyWithProps;
18
31
  }
19
- type RegisteredFunctionsAtPath<Tree, Path extends string> = Path extends `${infer Head}.${infer Tail}` ? Head extends keyof Tree ? Tree[Head] extends AnyWithProps ? RegisteredFunctionsAtPath<Tree[Head], Tail> : never : never : Path extends keyof Tree ? Tree[Path] : never;
20
- type ForGroupPath<Spec_ extends Spec.AnyWithProps, Path extends string> = RegisteredFunctionsAtPath<RegisteredFunctions<Spec_>, Path>;
21
32
  /**
22
33
  * Build the registered Convex functions for a single group from its finalized
23
34
  * `GroupImpl` layer.
24
35
  *
25
- * The `groupLayer` parameter requires `GroupImpl<string, "Finalized">`, so
26
- * impls that were never piped through `GroupImpl.finalize` (and impls with
27
- * unmet `FunctionImpl` requirements, which cannot be finalized) are rejected
28
- * at the codegen boundary, not just deep inside Convex at runtime.
36
+ * The `groupLayer` parameter requires `GroupImpl<"Finalized">`, so impls that
37
+ * were never piped through `GroupImpl.finalize` (and impls with unmet
38
+ * `FunctionImpl` requirements, which cannot be finalized) are rejected at the
39
+ * codegen boundary, not just deep inside Convex at runtime.
40
+ *
41
+ * The group layer is built with a fresh, isolated `Registry` (rather than the
42
+ * globally-cached default `Context.Reference`), so each `FunctionImpl.make`
43
+ * registers under its flat, single-segment function-name key without colliding
44
+ * with any other group built in the same process — the built registry holds
45
+ * exactly this group's functions at the top level.
46
+ *
47
+ * Only the runtime `databaseSchema` value is needed at runtime (it is forwarded
48
+ * to `makeRegisteredFunction` to build each function's ctx services); the
49
+ * group's `GroupSpec` is supplied purely as the `Group` type parameter to shape
50
+ * the returned record. The generated caller passes it explicitly and imports
51
+ * the leaf spec type-only (`typeof import("…/<group>.spec")["default"]`), so a
52
+ * function's bundle never imports a spec module at runtime.
29
53
  */
30
- declare const buildForGroup: <Api_ extends AnyWithProps$1, const GroupPath_ extends string>(api: Api_, groupPath: GroupPath_, groupLayer: Layer.Layer<GroupImpl<string, "Finalized">>, makeRegisteredFunction: (api: Api_, registryItem: AnyWithProps$2) => Any) => ForGroupPath<Api_["spec"], GroupPath_>;
54
+ declare const buildForGroup: <Group extends GroupSpec.AnyWithProps>(databaseSchema: AnyWithProps$1, groupLayer: Layer.Layer<GroupImpl<"Finalized">>, makeRegisteredFunction: (databaseSchema: AnyWithProps$1, registryItem: AnyWithProps$2) => Any) => RegisteredFunctionsForGroupSpec<Group>;
31
55
  //#endregion
32
- export { AnyWithProps, ForGroupPath, RegisteredFunctions, RegisteredFunctions_d_exports, buildForGroup };
56
+ export { AnyWithProps, RegisteredFunctions, RegisteredFunctionsForGroupSpec, RegisteredFunctions_d_exports, buildForGroup };
33
57
  //# sourceMappingURL=RegisteredFunctions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredFunctions.d.ts","names":[],"sources":["../src/RegisteredFunctions.ts"],"mappings":";;;;;;;;;;;;;KAqBY,mBAAA,eAAkC,IAAA,CAAK,YAAA,IACjD,KAAA,CAAM,QAAA,CAAS,yBAAA,CAA0B,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,KAElD,yBAAA,gBAAyC,SAAA,CAAU,YAAA,oBACxC,SAAA,CAAU,IAAA,CAAK,MAAA,IAAU,SAAA,CAAU,QAAA,CAC/C,MAAA,EACA,SAAA,8BAC4B,SAAA,CAAU,YAAA,GACpC,SAAA,CAAU,MAAA,CAAO,KAAA,kCACf,SAAA,CAAU,YAAA,GACV,KAAA,CAAM,QAAA,CACJ,yBAAA,CAA0B,SAAA,uBACP,YAAA,CAAa,IAAA,CAC5B,SAAA,CAAU,SAAA,CAAU,KAAA,KAClB,YAAA,CAAa,QAAA,CACf,SAAA,CAAU,SAAA,CAAU,KAAA,GACpB,YAAA,sCACoC,YAAA,CAAa,YAAA,GAC/C,kBAAA,CAAsC,aAAA,kCAK3B,YAAA,CAAa,IAA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AAU,SAAA,CAAU,KAAA,KAClB,YAAA,CAAa,QAAA,CACf,SAAA,CAAU,SAAA,CAAU,KAAA,GACpB,YAAA,sCACoC,YAAA,CAAa,YAAA,GAC/C,kBAAA,CAAsC,aAAA;;AApB5C;;;;;;;;;KAkCY,+BAAA,eACI,SAAA,CAAU,YAAA,IAExB,SAAA,CAAU,MAAA,CAAO,KAAA,kCAAuC,SAAA,CAAU,YAAA,GAC9D,KAAA,CAAM,QAAA,CACJ,yBAAA,CAA0B,SAAA,IAAa,qBAAA,CAAsB,KAAA,KAE/D,qBAAA,CAAsB,KAAA;AAAA,UAEX,YAAA;EAAA,UACL,GAAA,WAAc,GAAA,GAAyB,YAAA;AAAA;;;;;;;;;AA3Ca;;;;;;;;;;;;;;cAoEnD,aAAA,iBAA+B,SAAA,CAAU,YAAA,EACpD,cAAA,EAAgB,cAAA,EAChB,UAAA,EAAY,KAAA,CAAM,KAAA,CAAM,SAAA,gBACxB,sBAAA,GACE,cAAA,EAAgB,cAAA,EAChB,YAAA,EAAc,cAAA,KACX,GAAA,KACJ,+BAAA,CAAgC,KAAA"}
@@ -1,7 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { mapLeaves } from "./internal/utils.js";
3
3
  import { isRegistryItem } from "./RegistryItem.js";
4
- import { Array, Effect, Option, Predicate, Ref, String, pipe } from "effect";
4
+ import { Effect, Ref } from "effect";
5
5
  import * as Registry from "@confect/core/Registry";
6
6
 
7
7
  //#region src/RegisteredFunctions.ts
@@ -10,17 +10,29 @@ var RegisteredFunctions_exports = /* @__PURE__ */ __exportAll({ buildForGroup: (
10
10
  * Build the registered Convex functions for a single group from its finalized
11
11
  * `GroupImpl` layer.
12
12
  *
13
- * The `groupLayer` parameter requires `GroupImpl<string, "Finalized">`, so
14
- * impls that were never piped through `GroupImpl.finalize` (and impls with
15
- * unmet `FunctionImpl` requirements, which cannot be finalized) are rejected
16
- * at the codegen boundary, not just deep inside Convex at runtime.
13
+ * The `groupLayer` parameter requires `GroupImpl<"Finalized">`, so impls that
14
+ * were never piped through `GroupImpl.finalize` (and impls with unmet
15
+ * `FunctionImpl` requirements, which cannot be finalized) are rejected at the
16
+ * codegen boundary, not just deep inside Convex at runtime.
17
+ *
18
+ * The group layer is built with a fresh, isolated `Registry` (rather than the
19
+ * globally-cached default `Context.Reference`), so each `FunctionImpl.make`
20
+ * registers under its flat, single-segment function-name key without colliding
21
+ * with any other group built in the same process — the built registry holds
22
+ * exactly this group's functions at the top level.
23
+ *
24
+ * Only the runtime `databaseSchema` value is needed at runtime (it is forwarded
25
+ * to `makeRegisteredFunction` to build each function's ctx services); the
26
+ * group's `GroupSpec` is supplied purely as the `Group` type parameter to shape
27
+ * the returned record. The generated caller passes it explicitly and imports
28
+ * the leaf spec type-only (`typeof import("…/<group>.spec")["default"]`), so a
29
+ * function's bundle never imports a spec module at runtime.
17
30
  */
18
- const buildForGroup = (api, groupPath, groupLayer, makeRegisteredFunction) => {
19
- const registeredFunctions = mapLeaves(Effect.gen(function* () {
31
+ const buildForGroup = (databaseSchema, groupLayer, makeRegisteredFunction) => {
32
+ return mapLeaves(Effect.gen(function* () {
20
33
  const registry = yield* Registry.Registry;
21
34
  return yield* Ref.get(registry);
22
- }).pipe(Effect.provide(groupLayer), Effect.runSync), isRegistryItem, (registryItem) => makeRegisteredFunction(api, registryItem));
23
- return pipe(String.split(groupPath, "."), Array.reduce(Option.some(registeredFunctions), (currentNode, segment) => currentNode.pipe(Option.filter(Predicate.isRecord), Option.flatMap((nodeRecord) => segment in nodeRecord ? Option.some(nodeRecord[segment]) : Option.none()))), Option.getOrThrowWith(() => /* @__PURE__ */ new Error(`No functions registered for group path "${groupPath}"`)));
35
+ }).pipe(Effect.provide(groupLayer), Effect.provideService(Registry.Registry, Ref.unsafeMake({})), Effect.runSync), isRegistryItem, (registryItem) => makeRegisteredFunction(databaseSchema, registryItem));
24
36
  };
25
37
 
26
38
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredFunctions.js","names":["RegistryItem.isRegistryItem"],"sources":["../src/RegisteredFunctions.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport * as Registry from \"@confect/core/Registry\";\nimport type * as Spec from \"@confect/core/Spec\";\nimport {\n Array,\n Effect,\n type Layer,\n Option,\n pipe,\n Predicate,\n Ref,\n String,\n type Types,\n} from \"effect\";\nimport type * as Api from \"./Api\";\nimport type * as GroupImpl from \"./GroupImpl\";\nimport { mapLeaves } from \"./internal/utils\";\nimport type * as RegisteredFunction from \"./RegisteredFunction\";\nimport * as RegistryItem from \"./RegistryItem\";\n\nexport type RegisteredFunctions<Spec_ extends Spec.AnyWithProps> =\n Types.Simplify<RegisteredFunctionsHelper<Spec.Groups<Spec_>>>;\n\ntype RegisteredFunctionsHelper<Groups extends GroupSpec.AnyWithProps> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? GroupSpec.Groups<Group> extends infer SubGroups extends\n GroupSpec.AnyWithProps\n ? Types.Simplify<\n RegisteredFunctionsHelper<SubGroups> & {\n [FunctionName in FunctionSpec.Name<\n GroupSpec.Functions<Group>\n >]: FunctionSpec.WithName<\n GroupSpec.Functions<Group>,\n FunctionName\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? RegisteredFunction.RegisteredFunction<FunctionSpec_>\n : never;\n }\n >\n : {\n [FunctionName in FunctionSpec.Name<\n GroupSpec.Functions<Group>\n >]: FunctionSpec.WithName<\n GroupSpec.Functions<Group>,\n FunctionName\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? RegisteredFunction.RegisteredFunction<FunctionSpec_>\n : never;\n }\n : never;\n};\n\nexport interface AnyWithProps {\n readonly [key: string]: RegisteredFunction.Any | AnyWithProps;\n}\n\ntype RegisteredFunctionsAtPath<\n Tree,\n Path extends string,\n> = Path extends `${infer Head}.${infer Tail}`\n ? Head extends keyof Tree\n ? Tree[Head] extends AnyWithProps\n ? RegisteredFunctionsAtPath<Tree[Head], Tail>\n : never\n : never\n : Path extends keyof Tree\n ? Tree[Path]\n : never;\n\nexport type ForGroupPath<\n Spec_ extends Spec.AnyWithProps,\n Path extends string,\n> = RegisteredFunctionsAtPath<RegisteredFunctions<Spec_>, Path>;\n\n/**\n * Build the registered Convex functions for a single group from its finalized\n * `GroupImpl` layer.\n *\n * The `groupLayer` parameter requires `GroupImpl<string, \"Finalized\">`, so\n * impls that were never piped through `GroupImpl.finalize` (and impls with\n * unmet `FunctionImpl` requirements, which cannot be finalized) are rejected\n * at the codegen boundary, not just deep inside Convex at runtime.\n */\nexport const buildForGroup = <\n Api_ extends Api.AnyWithProps,\n const GroupPath_ extends string,\n>(\n api: Api_,\n groupPath: GroupPath_,\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<string, \"Finalized\">>,\n makeRegisteredFunction: (\n api: Api_,\n registryItem: RegistryItem.AnyWithProps,\n ) => RegisteredFunction.Any,\n): ForGroupPath<Api_[\"spec\"], GroupPath_> => {\n const registryItems = Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n return yield* Ref.get(registry);\n }).pipe(Effect.provide(groupLayer), Effect.runSync);\n\n const registeredFunctions = mapLeaves<\n RegistryItem.AnyWithProps,\n RegisteredFunction.Any\n >(\n registryItems as { [key: string]: RegistryItem.AnyWithProps },\n RegistryItem.isRegistryItem,\n (registryItem) => makeRegisteredFunction(api, registryItem),\n );\n\n return pipe(\n String.split(groupPath, \".\"),\n Array.reduce(\n Option.some<unknown>(registeredFunctions),\n (currentNode, segment) =>\n currentNode.pipe(\n Option.filter(Predicate.isRecord),\n Option.flatMap((nodeRecord) =>\n segment in nodeRecord\n ? Option.some(nodeRecord[segment])\n : Option.none(),\n ),\n ),\n ),\n Option.getOrThrowWith(\n () => new Error(`No functions registered for group path \"${groupPath}\"`),\n ),\n ) as ForGroupPath<Api_[\"spec\"], GroupPath_>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAuFA,MAAa,iBAIX,KACA,WACA,YACA,2BAI2C;CAM3C,MAAM,sBAAsB,UALN,OAAO,IAAI,aAAa;EAC5C,MAAM,WAAW,OAAO,SAAS;AACjC,SAAO,OAAO,IAAI,IAAI,SAAS;GAC/B,CAAC,KAAK,OAAO,QAAQ,WAAW,EAAE,OAAO,QAAQ,EAOjDA,iBACC,iBAAiB,uBAAuB,KAAK,aAAa,CAC5D;AAED,QAAO,KACL,OAAO,MAAM,WAAW,IAAI,EAC5B,MAAM,OACJ,OAAO,KAAc,oBAAoB,GACxC,aAAa,YACZ,YAAY,KACV,OAAO,OAAO,UAAU,SAAS,EACjC,OAAO,SAAS,eACd,WAAW,aACP,OAAO,KAAK,WAAW,SAAS,GAChC,OAAO,MAAM,CAClB,CACF,CACJ,EACD,OAAO,qCACC,IAAI,MAAM,2CAA2C,UAAU,GAAG,CACzE,CACF"}
1
+ {"version":3,"file":"RegisteredFunctions.js","names":["RegistryItem.isRegistryItem"],"sources":["../src/RegisteredFunctions.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport * as Registry from \"@confect/core/Registry\";\nimport type * as Spec from \"@confect/core/Spec\";\nimport { Effect, type Layer, Ref, type Types } from \"effect\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as GroupImpl from \"./GroupImpl\";\nimport { mapLeaves } from \"./internal/utils\";\nimport type * as RegisteredFunction from \"./RegisteredFunction\";\nimport * as RegistryItem from \"./RegistryItem\";\n\nexport type RegisteredFunctions<Spec_ extends Spec.AnyWithProps> =\n Types.Simplify<RegisteredFunctionsHelper<Spec.Groups<Spec_>>>;\n\ntype RegisteredFunctionsHelper<Groups extends GroupSpec.AnyWithProps> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? RegisteredFunctionsForGroupSpec<Group>\n : never;\n};\n\n/** The `RegisteredFunction` record for a group's own declared functions. */\ntype RegisteredFunctionsOf<Group extends GroupSpec.AnyWithProps> = {\n [FunctionName in FunctionSpec.Name<\n GroupSpec.Functions<Group>\n >]: FunctionSpec.WithName<\n GroupSpec.Functions<Group>,\n FunctionName\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? RegisteredFunction.RegisteredFunction<FunctionSpec_>\n : never;\n};\n\n/**\n * The registered-functions record for a single group, derived from the group's\n * own `GroupSpec`: its declared functions, plus any nested subgroups it carries\n * directly. This is the node that `buildForGroup` returns — computed from the\n * leaf `GroupSpec` itself rather than by navigating the project-wide assembled\n * `Spec` to a dot-path, so the per-group registry's type depends only on its\n * own leaf. For the filesystem layout a leaf `GroupSpec` carries no subgroups\n * (subdirectory children are assembled separately into `_generated/spec.ts`),\n * so this resolves to just the leaf's functions.\n */\nexport type RegisteredFunctionsForGroupSpec<\n Group extends GroupSpec.AnyWithProps,\n> =\n GroupSpec.Groups<Group> extends infer SubGroups extends GroupSpec.AnyWithProps\n ? Types.Simplify<\n RegisteredFunctionsHelper<SubGroups> & RegisteredFunctionsOf<Group>\n >\n : RegisteredFunctionsOf<Group>;\n\nexport interface AnyWithProps {\n readonly [key: string]: RegisteredFunction.Any | AnyWithProps;\n}\n\n/**\n * Build the registered Convex functions for a single group from its finalized\n * `GroupImpl` layer.\n *\n * The `groupLayer` parameter requires `GroupImpl<\"Finalized\">`, so impls that\n * were never piped through `GroupImpl.finalize` (and impls with unmet\n * `FunctionImpl` requirements, which cannot be finalized) are rejected at the\n * codegen boundary, not just deep inside Convex at runtime.\n *\n * The group layer is built with a fresh, isolated `Registry` (rather than the\n * globally-cached default `Context.Reference`), so each `FunctionImpl.make`\n * registers under its flat, single-segment function-name key without colliding\n * with any other group built in the same process — the built registry holds\n * exactly this group's functions at the top level.\n *\n * Only the runtime `databaseSchema` value is needed at runtime (it is forwarded\n * to `makeRegisteredFunction` to build each function's ctx services); the\n * group's `GroupSpec` is supplied purely as the `Group` type parameter to shape\n * the returned record. The generated caller passes it explicitly and imports\n * the leaf spec type-only (`typeof import(\"…/<group>.spec\")[\"default\"]`), so a\n * function's bundle never imports a spec module at runtime.\n */\nexport const buildForGroup = <Group extends GroupSpec.AnyWithProps>(\n databaseSchema: DatabaseSchema.AnyWithProps,\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n makeRegisteredFunction: (\n databaseSchema: DatabaseSchema.AnyWithProps,\n registryItem: RegistryItem.AnyWithProps,\n ) => RegisteredFunction.Any,\n): RegisteredFunctionsForGroupSpec<Group> => {\n const registryItems = Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n return yield* Ref.get(registry);\n }).pipe(\n Effect.provide(groupLayer),\n Effect.provideService(\n Registry.Registry,\n Ref.unsafeMake<Registry.RegistryItems>({}),\n ),\n Effect.runSync,\n );\n\n return mapLeaves<RegistryItem.AnyWithProps, RegisteredFunction.Any>(\n registryItems as { [key: string]: RegistryItem.AnyWithProps },\n RegistryItem.isRegistryItem,\n (registryItem) => makeRegisteredFunction(databaseSchema, registryItem),\n ) as RegisteredFunctionsForGroupSpec<Group>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,MAAa,iBACX,gBACA,YACA,2BAI2C;AAa3C,QAAO,UAZe,OAAO,IAAI,aAAa;EAC5C,MAAM,WAAW,OAAO,SAAS;AACjC,SAAO,OAAO,IAAI,IAAI,SAAS;GAC/B,CAAC,KACD,OAAO,QAAQ,WAAW,EAC1B,OAAO,eACL,SAAS,UACT,IAAI,WAAmC,EAAE,CAAC,CAC3C,EACD,OAAO,QACR,EAICA,iBACC,iBAAiB,uBAAuB,gBAAgB,aAAa,CACvE"}
@@ -1,15 +1,15 @@
1
- import { AnyWithPropsWithRuntime } from "./Api.js";
1
+ import { AnyWithProps } from "./DatabaseSchema.js";
2
2
  import { Any } from "./RegisteredFunction.js";
3
- import { AnyWithProps } from "./RegistryItem.js";
3
+ import { AnyWithProps as AnyWithProps$1 } from "./RegistryItem.js";
4
4
 
5
5
  //#region src/RegisteredNodeFunction.d.ts
6
6
  declare namespace RegisteredNodeFunction_d_exports {
7
7
  export { make };
8
8
  }
9
- declare const make: <Api_ extends AnyWithPropsWithRuntime<"Node">>(api: Api_, {
9
+ declare const make: (databaseSchema: AnyWithProps, {
10
10
  functionSpec,
11
11
  handler
12
- }: AnyWithProps) => Any;
12
+ }: AnyWithProps$1) => Any;
13
13
  //#endregion
14
14
  export { RegisteredNodeFunction_d_exports, make };
15
15
  //# sourceMappingURL=RegisteredNodeFunction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredNodeFunction.d.ts","names":[],"sources":["../src/RegisteredNodeFunction.ts"],"mappings":";;;;;;;;cAea,IAAA,gBAAqB,uBAAA,UAChC,GAAA,EAAK,IAAA;EACL,YAAA;EAAA;AAAA,GAA2B,YAAA,KAC1B,GAAA"}
1
+ {"version":3,"file":"RegisteredNodeFunction.d.ts","names":[],"sources":["../src/RegisteredNodeFunction.ts"],"mappings":";;;;;;;;cAca,IAAA,GACX,cAAA,EAAgB,YAAA;EAChB,YAAA;EAAA;AAAA,GAA2B,cAAA,KAC1B,GAAA"}
@@ -6,9 +6,9 @@ import { NodeContext } from "@effect/platform-node";
6
6
 
7
7
  //#region src/RegisteredNodeFunction.ts
8
8
  var RegisteredNodeFunction_exports = /* @__PURE__ */ __exportAll({ make: () => make });
9
- const make = (api, { functionSpec, handler }) => Match.value(functionSpec.functionProvenance).pipe(Match.tag("Convex", () => handler), Match.tag("Confect", () => {
9
+ const make = (databaseSchema, { functionSpec, handler }) => Match.value(functionSpec.functionProvenance).pipe(Match.tag("Convex", () => handler), Match.tag("Confect", () => {
10
10
  const { functionVisibility, functionProvenance } = functionSpec;
11
- return Match.value(functionVisibility).pipe(Match.when("public", () => actionGeneric), Match.when("internal", () => internalActionGeneric), Match.exhaustive)(nodeActionFunction(api.databaseSchema, {
11
+ return Match.value(functionVisibility).pipe(Match.when("public", () => actionGeneric), Match.when("internal", () => internalActionGeneric), Match.exhaustive)(nodeActionFunction(databaseSchema, {
12
12
  args: functionProvenance.args,
13
13
  returns: functionProvenance.returns,
14
14
  error: functionProvenance.error,
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredNodeFunction.js","names":["RegisteredFunction.actionFunctionBase","RegisteredFunction.actionLayer"],"sources":["../src/RegisteredNodeFunction.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport { NodeContext } from \"@effect/platform-node\";\nimport {\n actionGeneric,\n type DefaultFunctionArgs,\n internalActionGeneric,\n} from \"convex/server\";\nimport type { Effect } from \"effect\";\nimport { Layer, Match, type Schema } from \"effect\";\nimport type * as Api from \"./Api\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as Handler from \"./Handler\";\nimport * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as RegistryItem from \"./RegistryItem\";\n\nexport const make = <Api_ extends Api.AnyWithPropsWithRuntime<\"Node\">>(\n api: Api_,\n { functionSpec, handler }: RegistryItem.AnyWithProps,\n): RegisteredFunction.Any =>\n Match.value(functionSpec.functionProvenance).pipe(\n Match.tag(\"Convex\", () => handler as RegisteredFunction.Any),\n Match.tag(\"Confect\", () => {\n const { functionVisibility, functionProvenance } =\n functionSpec as FunctionSpec.AnyConfect;\n\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => actionGeneric),\n Match.when(\"internal\", () => internalActionGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n nodeActionFunction(api.databaseSchema, {\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.exhaustive,\n );\n\nconst nodeActionFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>(\n databaseSchema: DatabaseSchema_,\n {\n args,\n returns,\n error,\n handler,\n }: {\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema.AnyNoContext | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n | RegisteredFunction.ActionServices<DatabaseSchema_>\n | NodeContext.NodeContext\n >;\n },\n) =>\n RegisteredFunction.actionFunctionBase({\n args,\n returns,\n error,\n handler,\n createLayer: (ctx) =>\n Layer.mergeAll(\n RegisteredFunction.actionLayer(databaseSchema, ctx),\n NodeContext.layer,\n ),\n });\n"],"mappings":";;;;;;;;AAeA,MAAa,QACX,KACA,EAAE,cAAc,cAEhB,MAAM,MAAM,aAAa,mBAAmB,CAAC,KAC3C,MAAM,IAAI,gBAAgB,QAAkC,EAC5D,MAAM,IAAI,iBAAiB;CACzB,MAAM,EAAE,oBAAoB,uBAC1B;AAQF,QANwB,MAAM,MAAM,mBAAmB,CAAC,KACtD,MAAM,KAAK,gBAAgB,cAAc,EACzC,MAAM,KAAK,kBAAkB,sBAAsB,EACnD,MAAM,WACP,CAGC,mBAAmB,IAAI,gBAAgB;EACrC,MAAM,mBAAmB;EACzB,SAAS,mBAAmB;EAC5B,OAAO,mBAAmB;EACjB;EACV,CAAC,CACH;EACD,EACF,MAAM,WACP;AAEH,MAAM,sBAQJ,gBACA,EACE,MACA,SACA,OACA,cAeFA,mBAAsC;CACpC;CACA;CACA;CACA;CACA,cAAc,QACZ,MAAM,SACJC,YAA+B,gBAAgB,IAAI,EACnD,YAAY,MACb;CACJ,CAAC"}
1
+ {"version":3,"file":"RegisteredNodeFunction.js","names":["RegisteredFunction.actionFunctionBase","RegisteredFunction.actionLayer"],"sources":["../src/RegisteredNodeFunction.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport { NodeContext } from \"@effect/platform-node\";\nimport {\n actionGeneric,\n type DefaultFunctionArgs,\n internalActionGeneric,\n} from \"convex/server\";\nimport type { Effect } from \"effect\";\nimport { Layer, Match, type Schema } from \"effect\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as Handler from \"./Handler\";\nimport * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as RegistryItem from \"./RegistryItem\";\n\nexport const make = (\n databaseSchema: DatabaseSchema.AnyWithProps,\n { functionSpec, handler }: RegistryItem.AnyWithProps,\n): RegisteredFunction.Any =>\n Match.value(functionSpec.functionProvenance).pipe(\n Match.tag(\"Convex\", () => handler as RegisteredFunction.Any),\n Match.tag(\"Confect\", () => {\n const { functionVisibility, functionProvenance } =\n functionSpec as FunctionSpec.AnyConfect;\n\n const genericFunction = Match.value(functionVisibility).pipe(\n Match.when(\"public\", () => actionGeneric),\n Match.when(\"internal\", () => internalActionGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n nodeActionFunction(databaseSchema, {\n args: functionProvenance.args,\n returns: functionProvenance.returns,\n error: functionProvenance.error,\n handler: handler as Handler.AnyConfectProvenance,\n }),\n );\n }),\n Match.exhaustive,\n );\n\nconst nodeActionFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>(\n databaseSchema: DatabaseSchema_,\n {\n args,\n returns,\n error,\n handler,\n }: {\n args: Schema.Schema<Args, ConvexArgs>;\n returns: Schema.Schema<Returns, ConvexReturns>;\n error: Schema.Schema.AnyNoContext | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n | RegisteredFunction.ActionServices<DatabaseSchema_>\n | NodeContext.NodeContext\n >;\n },\n) =>\n RegisteredFunction.actionFunctionBase({\n args,\n returns,\n error,\n handler,\n createLayer: (ctx) =>\n Layer.mergeAll(\n RegisteredFunction.actionLayer(databaseSchema, ctx),\n NodeContext.layer,\n ),\n });\n"],"mappings":";;;;;;;;AAcA,MAAa,QACX,gBACA,EAAE,cAAc,cAEhB,MAAM,MAAM,aAAa,mBAAmB,CAAC,KAC3C,MAAM,IAAI,gBAAgB,QAAkC,EAC5D,MAAM,IAAI,iBAAiB;CACzB,MAAM,EAAE,oBAAoB,uBAC1B;AAQF,QANwB,MAAM,MAAM,mBAAmB,CAAC,KACtD,MAAM,KAAK,gBAAgB,cAAc,EACzC,MAAM,KAAK,kBAAkB,sBAAsB,EACnD,MAAM,WACP,CAGC,mBAAmB,gBAAgB;EACjC,MAAM,mBAAmB;EACzB,SAAS,mBAAmB;EAC5B,OAAO,mBAAmB;EACjB;EACV,CAAC,CACH;EACD,EACF,MAAM,WACP;AAEH,MAAM,sBAQJ,gBACA,EACE,MACA,SACA,OACA,cAeFA,mBAAsC;CACpC;CACA;CACA;CACA;CACA,cAAc,QACZ,MAAM,SACJC,YAA+B,gBAAgB,IAAI,EACnD,YAAY,MACb;CACJ,CAAC"}
package/dist/Table.d.ts CHANGED
@@ -7,33 +7,44 @@ import { GenericValidator, Validator } from "convex/values";
7
7
 
8
8
  //#region src/Table.d.ts
9
9
  declare namespace Table_d_exports {
10
- export { Any, AnyWithProps, Doc, Fields, Indexes, Name, SearchIndexes, SystemTables, Table, TableSchema, TableValidator, TablesRecord, TypeId, VectorIndexes, WithName, isTable, make, scheduledFunctionsTable, storageTable, systemTables };
10
+ export { Any, AnyWithProps, Doc, Fields, Indexes, Name, SearchIndexes, SystemTables, Table, TableSchema, TableValidator, TablesRecord, TypeId, UnnamedAny, UnnamedAnyWithProps, UnnamedTable, VectorIndexes, WithName, isTable, isUnnamedTable, make, scheduledFunctionsTable, storageTable, systemTables };
11
11
  }
12
12
  declare const TypeId = "@confect/server/Table";
13
13
  type TypeId = typeof TypeId;
14
14
  declare const isTable: (u: unknown) => u is Any;
15
+ declare const isUnnamedTable: (u: unknown) => u is UnnamedAny;
15
16
  interface Table<Name_ extends string, TableSchema_ extends Schema.Schema.AnyNoContext, TableValidator_ extends GenericValidator = TableSchemaToTableValidator<TableSchema_>, Indexes_ extends GenericTableIndexes = {}, SearchIndexes_ extends GenericTableSearchIndexes = {}, VectorIndexes_ extends GenericTableVectorIndexes = {}> {
16
17
  readonly [TypeId]: TypeId;
18
+ readonly tableName: Name_;
17
19
  readonly tableDefinition: TableDefinition<TableValidator_, Indexes_, SearchIndexes_, VectorIndexes_>;
18
- readonly name: Name_;
19
20
  readonly Fields: TableSchema_;
20
21
  readonly Doc: SystemFields$1.ExtendWithSystemFields<Name_, TableSchema_>;
21
22
  readonly indexes: Indexes_;
22
- index<IndexName extends string, FirstFieldPath extends ExtractFieldPaths<TableValidator_>, RestFieldPaths extends ExtractFieldPaths<TableValidator_>[]>(name: IndexName, fields: [FirstFieldPath, ...RestFieldPaths]): Table<Name_, TableSchema_, TableValidator_, Expand<Indexes_ & Record<IndexName, [FirstFieldPath, ...RestFieldPaths, IndexTiebreakerField]>>, SearchIndexes_, VectorIndexes_>;
23
- searchIndex<IndexName extends string, SearchField extends ExtractFieldPaths<TableValidator_>, FilterFields extends ExtractFieldPaths<TableValidator_> = never>(name: IndexName, indexConfig: Expand<SearchIndexConfig<SearchField, FilterFields>>): Table<Name_, TableSchema_, TableValidator_, Indexes_, Expand<SearchIndexes_ & Record<IndexName, {
23
+ }
24
+ interface Any {
25
+ readonly [TypeId]: TypeId;
26
+ readonly tableName: string;
27
+ }
28
+ type AnyWithProps = Table<any, Schema.Schema.AnyNoContext, GenericValidator, GenericTableIndexes, GenericTableSearchIndexes, GenericTableVectorIndexes>;
29
+ interface UnnamedTable<TableSchema_ extends Schema.Schema.AnyNoContext, TableValidator_ extends GenericValidator = TableSchemaToTableValidator<TableSchema_>, Indexes_ extends GenericTableIndexes = {}, SearchIndexes_ extends GenericTableSearchIndexes = {}, VectorIndexes_ extends GenericTableVectorIndexes = {}> {
30
+ <const Name_ extends string>(tableName: Name_): Table<Name_, TableSchema_, TableValidator_, Indexes_, SearchIndexes_, VectorIndexes_>;
31
+ readonly [TypeId]: TypeId;
32
+ readonly indexes: Indexes_;
33
+ index<IndexName extends string, FirstFieldPath extends ExtractFieldPaths<TableValidator_>, RestFieldPaths extends ExtractFieldPaths<TableValidator_>[]>(name: IndexName, fields: [FirstFieldPath, ...RestFieldPaths]): UnnamedTable<TableSchema_, TableValidator_, Expand<Indexes_ & Record<IndexName, [FirstFieldPath, ...RestFieldPaths, IndexTiebreakerField]>>, SearchIndexes_, VectorIndexes_>;
34
+ searchIndex<IndexName extends string, SearchField extends ExtractFieldPaths<TableValidator_>, FilterFields extends ExtractFieldPaths<TableValidator_> = never>(name: IndexName, indexConfig: Expand<SearchIndexConfig<SearchField, FilterFields>>): UnnamedTable<TableSchema_, TableValidator_, Indexes_, Expand<SearchIndexes_ & Record<IndexName, {
24
35
  searchField: SearchField;
25
36
  filterFields: FilterFields;
26
37
  }>>, VectorIndexes_>;
27
- vectorIndex<IndexName extends string, VectorField extends ExtractFieldPaths<TableValidator_>, FilterFields extends ExtractFieldPaths<TableValidator_> = never>(name: IndexName, indexConfig: Expand<VectorIndexConfig<VectorField, FilterFields>>): Table<Name_, TableSchema_, TableValidator_, Indexes_, SearchIndexes_, Expand<VectorIndexes_ & Record<IndexName, {
38
+ vectorIndex<IndexName extends string, VectorField extends ExtractFieldPaths<TableValidator_>, FilterFields extends ExtractFieldPaths<TableValidator_> = never>(name: IndexName, indexConfig: Expand<VectorIndexConfig<VectorField, FilterFields>>): UnnamedTable<TableSchema_, TableValidator_, Indexes_, SearchIndexes_, Expand<VectorIndexes_ & Record<IndexName, {
28
39
  vectorField: VectorField;
29
40
  dimensions: number;
30
41
  filterFields: FilterFields;
31
42
  }>>>;
32
43
  }
33
- interface Any {
44
+ interface UnnamedAny {
34
45
  readonly [TypeId]: TypeId;
35
46
  }
36
- type AnyWithProps = Table<any, Schema.Schema.AnyNoContext, GenericValidator, GenericTableIndexes, GenericTableSearchIndexes, GenericTableVectorIndexes>;
47
+ type UnnamedAnyWithProps = UnnamedTable<Schema.Schema.AnyNoContext, GenericValidator, GenericTableIndexes, GenericTableSearchIndexes, GenericTableVectorIndexes>;
37
48
  type Name<TableDef extends AnyWithProps> = TableDef extends Table<infer TableName, infer _TableSchema, infer _TableValidator, infer _Indexes, infer _SearchIndexes, infer _VectorIndexes> ? TableName & string : never;
38
49
  type TableSchema<TableDef extends AnyWithProps> = TableDef extends Table<infer _TableName, infer TableSchema_, infer _TableValidator, infer _Indexes, infer _SearchIndexes, infer _VectorIndexes> ? TableSchema_ : never;
39
50
  type TableValidator<TableDef extends AnyWithProps> = TableDef extends Table<infer _TableName, infer _TableSchema, infer TableValidator_, infer _Indexes, infer _SearchIndexes, infer _VectorIndexes> ? TableValidator_ : never;
@@ -43,13 +54,10 @@ type VectorIndexes<TableDef extends AnyWithProps> = TableDef extends Table<infer
43
54
  type Doc<TableDef extends AnyWithProps> = TableDef extends Table<infer TableName, infer TableSchema_, infer _TableValidator, infer _Indexes, infer _SearchIndexes, infer _VectorIndexes> ? SystemFields$1.ExtendWithSystemFields<TableName, TableSchema_> : never;
44
55
  type Fields<TableDef extends AnyWithProps> = TableDef extends Table<infer _TableName, infer TableSchema_, infer _TableValidator, infer _Indexes, infer _SearchIndexes, infer _VectorIndexes> ? TableSchema_ : never;
45
56
  type WithName<TableDef extends AnyWithProps, Name_ extends string> = TableDef extends {
46
- readonly name: Name_;
57
+ readonly tableName: Name_;
47
58
  } ? TableDef : never;
48
59
  type TablesRecord<Tables extends AnyWithProps> = { readonly [TableName_ in Name<Tables>]: WithName<Tables, TableName_> };
49
- /**
50
- * Create a table.
51
- */
52
- declare const make: <const Name_ extends string, TableSchema_ extends Schema.Schema.AnyNoContext, TableValidator_ extends GenericValidator = TableSchemaToTableValidator<TableSchema_>, Indexes_ extends GenericTableIndexes = {}, SearchIndexes_ extends GenericTableSearchIndexes = {}, VectorIndexes_ extends GenericTableVectorIndexes = {}>(name: Name_, fields: TableSchema_) => Table<Name_, TableSchema_, TableValidator_, Indexes_, SearchIndexes_, VectorIndexes_>;
60
+ declare const make: <const TableSchema_ extends Schema.Schema.AnyNoContext>(lazyFields: () => TableSchema_) => UnnamedTable<TableSchema_, TableSchemaToTableValidator<TableSchema_>>;
53
61
  declare const scheduledFunctionsTable: Table<"_scheduled_functions", Schema.Struct<{
54
62
  name: typeof Schema.String;
55
63
  args: Schema.Array$<typeof Schema.Any>;
@@ -70,8 +78,8 @@ declare const scheduledFunctionsTable: Table<"_scheduled_functions", Schema.Stru
70
78
  kind: Schema.Literal<["canceled"]>;
71
79
  }>]>;
72
80
  }>, convex_values0.VObject<{
73
- name: string;
74
81
  args: any[];
82
+ name: string;
75
83
  scheduledTime: number;
76
84
  state: {
77
85
  kind: "pending";
@@ -80,15 +88,15 @@ declare const scheduledFunctionsTable: Table<"_scheduled_functions", Schema.Stru
80
88
  } | {
81
89
  kind: "success";
82
90
  } | {
83
- kind: "failed";
84
91
  error: string;
92
+ kind: "failed";
85
93
  } | {
86
94
  kind: "canceled";
87
95
  };
88
96
  completedTime?: number;
89
97
  }, {
90
- name: convex_values0.VString<string, "required">;
91
98
  args: convex_values0.VArray<any[], convex_values0.VAny<any, "required", string>, "required">;
99
+ name: convex_values0.VString<string, "required">;
92
100
  scheduledTime: convex_values0.VFloat64<number, "required">;
93
101
  state: convex_values0.VUnion<{
94
102
  kind: "pending";
@@ -97,8 +105,8 @@ declare const scheduledFunctionsTable: Table<"_scheduled_functions", Schema.Stru
97
105
  } | {
98
106
  kind: "success";
99
107
  } | {
100
- kind: "failed";
101
108
  error: string;
109
+ kind: "failed";
102
110
  } | {
103
111
  kind: "canceled";
104
112
  }, [convex_values0.VObject<{
@@ -114,18 +122,18 @@ declare const scheduledFunctionsTable: Table<"_scheduled_functions", Schema.Stru
114
122
  }, {
115
123
  kind: convex_values0.VLiteral<"success", "required">;
116
124
  }, "required", "kind">, convex_values0.VObject<{
117
- kind: "failed";
118
125
  error: string;
126
+ kind: "failed";
119
127
  }, {
120
- kind: convex_values0.VLiteral<"failed", "required">;
121
128
  error: convex_values0.VString<string, "required">;
122
- }, "required", "kind" | "error">, convex_values0.VObject<{
129
+ kind: convex_values0.VLiteral<"failed", "required">;
130
+ }, "required", "error" | "kind">, convex_values0.VObject<{
123
131
  kind: "canceled";
124
132
  }, {
125
133
  kind: convex_values0.VLiteral<"canceled", "required">;
126
- }, "required", "kind">], "required", "kind" | "error">;
134
+ }, "required", "kind">], "required", "error" | "kind">;
127
135
  completedTime: convex_values0.VFloat64<number | undefined, "optional">;
128
- }, "required", "name" | "args" | "scheduledTime" | "completedTime" | "state" | "state.kind" | "state.error">, {}, {}, {}>;
136
+ }, "required", "args" | "name" | "scheduledTime" | "completedTime" | "state" | "state.error" | "state.kind">, {}, {}, {}>;
129
137
  declare const storageTable: Table<"_storage", Schema.Struct<{
130
138
  sha256: typeof Schema.String;
131
139
  size: typeof Schema.Number;
@@ -162,8 +170,8 @@ declare const systemTables: {
162
170
  kind: Schema.Literal<["canceled"]>;
163
171
  }>]>;
164
172
  }>, convex_values0.VObject<{
165
- name: string;
166
173
  args: any[];
174
+ name: string;
167
175
  scheduledTime: number;
168
176
  state: {
169
177
  kind: "pending";
@@ -172,15 +180,15 @@ declare const systemTables: {
172
180
  } | {
173
181
  kind: "success";
174
182
  } | {
175
- kind: "failed";
176
183
  error: string;
184
+ kind: "failed";
177
185
  } | {
178
186
  kind: "canceled";
179
187
  };
180
188
  completedTime?: number;
181
189
  }, {
182
- name: convex_values0.VString<string, "required">;
183
190
  args: convex_values0.VArray<any[], convex_values0.VAny<any, "required", string>, "required">;
191
+ name: convex_values0.VString<string, "required">;
184
192
  scheduledTime: convex_values0.VFloat64<number, "required">;
185
193
  state: convex_values0.VUnion<{
186
194
  kind: "pending";
@@ -189,8 +197,8 @@ declare const systemTables: {
189
197
  } | {
190
198
  kind: "success";
191
199
  } | {
192
- kind: "failed";
193
200
  error: string;
201
+ kind: "failed";
194
202
  } | {
195
203
  kind: "canceled";
196
204
  }, [convex_values0.VObject<{
@@ -206,18 +214,18 @@ declare const systemTables: {
206
214
  }, {
207
215
  kind: convex_values0.VLiteral<"success", "required">;
208
216
  }, "required", "kind">, convex_values0.VObject<{
209
- kind: "failed";
210
217
  error: string;
218
+ kind: "failed";
211
219
  }, {
212
- kind: convex_values0.VLiteral<"failed", "required">;
213
220
  error: convex_values0.VString<string, "required">;
214
- }, "required", "kind" | "error">, convex_values0.VObject<{
221
+ kind: convex_values0.VLiteral<"failed", "required">;
222
+ }, "required", "error" | "kind">, convex_values0.VObject<{
215
223
  kind: "canceled";
216
224
  }, {
217
225
  kind: convex_values0.VLiteral<"canceled", "required">;
218
- }, "required", "kind">], "required", "kind" | "error">;
226
+ }, "required", "kind">], "required", "error" | "kind">;
219
227
  completedTime: convex_values0.VFloat64<number | undefined, "optional">;
220
- }, "required", "name" | "args" | "scheduledTime" | "completedTime" | "state" | "state.kind" | "state.error">, {}, {}, {}>;
228
+ }, "required", "args" | "name" | "scheduledTime" | "completedTime" | "state" | "state.error" | "state.kind">, {}, {}, {}>;
221
229
  readonly _storage: Table<"_storage", Schema.Struct<{
222
230
  sha256: typeof Schema.String;
223
231
  size: typeof Schema.Number;
@@ -243,5 +251,5 @@ type SystemTables = typeof scheduledFunctionsTable | typeof storageTable;
243
251
  */
244
252
  type ExtractFieldPaths<T extends Validator<any, any, any>> = T["fieldPaths"] | keyof SystemFields;
245
253
  //#endregion
246
- export { Any, AnyWithProps, Doc, Fields, Indexes, Name, SearchIndexes, SystemTables, Table, TableSchema, TableValidator, Table_d_exports, TablesRecord, TypeId, VectorIndexes, WithName, isTable, make, scheduledFunctionsTable, storageTable, systemTables };
254
+ export { Any, AnyWithProps, Doc, Fields, Indexes, Name, SearchIndexes, SystemTables, Table, TableSchema, TableValidator, Table_d_exports, TablesRecord, TypeId, UnnamedAny, UnnamedAnyWithProps, UnnamedTable, VectorIndexes, WithName, isTable, isUnnamedTable, make, scheduledFunctionsTable, storageTable, systemTables };
247
255
  //# sourceMappingURL=Table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","names":[],"sources":["../src/Table.ts"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