@gaganref/confect-server 10.3.1-fork.9 → 10.3.1-fork.90

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 (183) hide show
  1. package/dist/ActionCall.d.ts +30 -0
  2. package/dist/ActionCall.d.ts.map +1 -0
  3. package/dist/ActionCall.js +41 -0
  4. package/dist/ActionCall.js.map +1 -0
  5. package/dist/ActionRunner.d.ts +1 -1
  6. package/dist/ActionRunner.d.ts.map +1 -1
  7. package/dist/ActionRunner.js +3 -3
  8. package/dist/ActionRunner.js.map +1 -1
  9. package/dist/AiGatewayDecisionClient.js +1 -1
  10. package/dist/AiGatewayLanguageClient.js +1 -1
  11. package/dist/Auth.d.ts +31 -2
  12. package/dist/Auth.d.ts.map +1 -1
  13. package/dist/Auth.js +23 -3
  14. package/dist/Auth.js.map +1 -1
  15. package/dist/Callback.d.ts +1 -1
  16. package/dist/Callback.d.ts.map +1 -1
  17. package/dist/Callback.js +6 -6
  18. package/dist/Callback.js.map +1 -1
  19. package/dist/ComponentCtx.d.ts +4 -0
  20. package/dist/ComponentCtx.d.ts.map +1 -1
  21. package/dist/ConvexConfigProvider.js +2 -2
  22. package/dist/ConvexFunctionDefinitions.d.ts.map +1 -1
  23. package/dist/ConvexFunctionDefinitions.js +4 -4
  24. package/dist/ConvexFunctionDefinitions.js.map +1 -1
  25. package/dist/ConvexLogger.js +1 -1
  26. package/dist/CronJobs.d.ts.map +1 -1
  27. package/dist/CronJobs.js +7 -6
  28. package/dist/CronJobs.js.map +1 -1
  29. package/dist/DatabaseSchema.js +2 -2
  30. package/dist/DatabaseWriter.d.ts +44 -2
  31. package/dist/DatabaseWriter.d.ts.map +1 -1
  32. package/dist/DatabaseWriter.js +59 -9
  33. package/dist/DatabaseWriter.js.map +1 -1
  34. package/dist/ExecutionMetadata.js +1 -1
  35. package/dist/FunctionImpl.js +2 -2
  36. package/dist/FunctionRegistryItem.d.ts +1 -0
  37. package/dist/FunctionRegistryItem.d.ts.map +1 -1
  38. package/dist/FunctionRegistryItem.js +2 -1
  39. package/dist/FunctionRegistryItem.js.map +1 -1
  40. package/dist/GroupImpl.d.ts +21 -2
  41. package/dist/GroupImpl.d.ts.map +1 -1
  42. package/dist/GroupImpl.js +21 -22
  43. package/dist/GroupImpl.js.map +1 -1
  44. package/dist/GroupRegistry.d.ts +1 -0
  45. package/dist/GroupRegistry.d.ts.map +1 -1
  46. package/dist/GroupRegistry.js +10 -3
  47. package/dist/GroupRegistry.js.map +1 -1
  48. package/dist/Handler.d.ts +8 -4
  49. package/dist/Handler.d.ts.map +1 -1
  50. package/dist/Handler.js.map +1 -1
  51. package/dist/HttpRouter.d.ts +3 -0
  52. package/dist/HttpRouter.d.ts.map +1 -1
  53. package/dist/HttpRouter.js +29 -10
  54. package/dist/HttpRouter.js.map +1 -1
  55. package/dist/MiddlewareImpl.js +1 -1
  56. package/dist/MountInit.d.ts +31 -0
  57. package/dist/MountInit.d.ts.map +1 -0
  58. package/dist/MountInit.js +49 -0
  59. package/dist/MountInit.js.map +1 -0
  60. package/dist/MutationRunner.d.ts +1 -1
  61. package/dist/MutationRunner.d.ts.map +1 -1
  62. package/dist/MutationRunner.js +3 -3
  63. package/dist/MutationRunner.js.map +1 -1
  64. package/dist/MutationTransactionContext.d.ts.map +1 -1
  65. package/dist/MutationTransactionContext.js +4 -3
  66. package/dist/MutationTransactionContext.js.map +1 -1
  67. package/dist/OfficialComponent.d.ts +60 -0
  68. package/dist/OfficialComponent.d.ts.map +1 -0
  69. package/dist/OfficialComponent.js +72 -0
  70. package/dist/OfficialComponent.js.map +1 -0
  71. package/dist/OrderedQuery.d.ts +4 -5
  72. package/dist/OrderedQuery.d.ts.map +1 -1
  73. package/dist/OrderedQuery.js.map +1 -1
  74. package/dist/QueryInitializer.js +2 -2
  75. package/dist/QueryRunner.js +2 -2
  76. package/dist/QueryStream.d.ts +120 -12
  77. package/dist/QueryStream.d.ts.map +1 -1
  78. package/dist/QueryStream.js +143 -41
  79. package/dist/QueryStream.js.map +1 -1
  80. package/dist/QueryStreamCursor.js +1 -1
  81. package/dist/QueryStreamIndexPrefix.js +1 -1
  82. package/dist/QueryStreamIndexRange.js +2 -2
  83. package/dist/QueryStreamKey.js +1 -1
  84. package/dist/QueryStreamKeyBounds.js +2 -2
  85. package/dist/QueryStreamKeyLayout.js +2 -2
  86. package/dist/QueryStreamKeyValues.js +2 -2
  87. package/dist/QueryStreamPagination.js +1 -1
  88. package/dist/QueryStreamReadBudget.d.ts +3 -2
  89. package/dist/QueryStreamReadBudget.d.ts.map +1 -1
  90. package/dist/QueryStreamReadBudget.js +8 -5
  91. package/dist/QueryStreamReadBudget.js.map +1 -1
  92. package/dist/QueryTransactionContext.js +2 -2
  93. package/dist/RegisteredConvexFunction.d.ts +10 -5
  94. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  95. package/dist/RegisteredConvexFunction.js +49 -29
  96. package/dist/RegisteredConvexFunction.js.map +1 -1
  97. package/dist/RegisteredFunction.d.ts +48 -22
  98. package/dist/RegisteredFunction.d.ts.map +1 -1
  99. package/dist/RegisteredFunction.js +163 -42
  100. package/dist/RegisteredFunction.js.map +1 -1
  101. package/dist/RegisteredNodeFunction.d.ts +1 -1
  102. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  103. package/dist/RegisteredNodeFunction.js +10 -6
  104. package/dist/RegisteredNodeFunction.js.map +1 -1
  105. package/dist/RegistryItems.d.ts +7 -0
  106. package/dist/RegistryItems.d.ts.map +1 -1
  107. package/dist/RegistryItems.js +8 -3
  108. package/dist/RegistryItems.js.map +1 -1
  109. package/dist/RequestMetadata.js +1 -1
  110. package/dist/Scheduler.d.ts +1 -1
  111. package/dist/Scheduler.d.ts.map +1 -1
  112. package/dist/Scheduler.js +14 -13
  113. package/dist/Scheduler.js.map +1 -1
  114. package/dist/Storage.js +1 -1
  115. package/dist/StorageActionWriter.js +1 -1
  116. package/dist/StorageReader.js +1 -1
  117. package/dist/StorageWriter.js +1 -1
  118. package/dist/Table.d.ts +6 -6
  119. package/dist/Table.d.ts.map +1 -1
  120. package/dist/TableInfo.d.ts +7 -7
  121. package/dist/TableInfo.d.ts.map +1 -1
  122. package/dist/TableInfo.js.map +1 -1
  123. package/dist/TransactionMetadata.js +1 -1
  124. package/dist/VectorSearch.js +1 -1
  125. package/dist/index.d.ts +3 -0
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +21 -18
  128. package/dist/internal/AiGatewayDecisionClient.js +1 -1
  129. package/dist/internal/AiGatewayLanguageClient.js +1 -1
  130. package/dist/internal/AiGatewayServiceToken.js +1 -1
  131. package/dist/internal/DocumentPatch.d.ts +16 -0
  132. package/dist/internal/DocumentPatch.d.ts.map +1 -0
  133. package/dist/internal/DocumentPatch.js +36 -0
  134. package/dist/internal/DocumentPatch.js.map +1 -0
  135. package/dist/internal/httpBody.d.ts +13 -0
  136. package/dist/internal/httpBody.d.ts.map +1 -0
  137. package/dist/internal/httpBody.js +47 -0
  138. package/dist/internal/httpBody.js.map +1 -0
  139. package/dist/internal/httpOptions.d.ts +4 -0
  140. package/dist/internal/httpOptions.d.ts.map +1 -0
  141. package/dist/internal/httpOptions.js +83 -0
  142. package/dist/internal/httpOptions.js.map +1 -0
  143. package/dist/internal/observability.d.ts +5 -0
  144. package/dist/internal/observability.d.ts.map +1 -0
  145. package/dist/internal/observability.js +21 -0
  146. package/dist/internal/observability.js.map +1 -0
  147. package/dist/internal/reservedArgument.d.ts +8 -0
  148. package/dist/internal/reservedArgument.d.ts.map +1 -0
  149. package/dist/internal/reservedArgument.js +30 -0
  150. package/dist/internal/reservedArgument.js.map +1 -0
  151. package/package.json +5 -5
  152. package/src/ActionCall.ts +83 -0
  153. package/src/ActionRunner.ts +3 -2
  154. package/src/Auth.ts +49 -1
  155. package/src/Callback.ts +3 -2
  156. package/src/ComponentCtx.ts +2 -0
  157. package/src/ConvexFunctionDefinitions.ts +2 -1
  158. package/src/CronJobs.ts +2 -1
  159. package/src/DatabaseWriter.ts +190 -26
  160. package/src/FunctionRegistryItem.ts +4 -0
  161. package/src/GroupImpl.ts +61 -8
  162. package/src/GroupRegistry.ts +7 -3
  163. package/src/Handler.ts +21 -5
  164. package/src/HttpRouter.ts +69 -5
  165. package/src/MountInit.ts +80 -0
  166. package/src/MutationRunner.ts +3 -2
  167. package/src/MutationTransactionContext.ts +2 -1
  168. package/src/OfficialComponent.ts +168 -0
  169. package/src/OrderedQuery.ts +4 -5
  170. package/src/QueryStream.ts +391 -61
  171. package/src/QueryStreamReadBudget.ts +19 -6
  172. package/src/RegisteredConvexFunction.ts +39 -2
  173. package/src/RegisteredFunction.ts +305 -49
  174. package/src/RegisteredNodeFunction.ts +11 -1
  175. package/src/RegistryItems.ts +31 -0
  176. package/src/Scheduler.ts +17 -19
  177. package/src/TableInfo.ts +18 -22
  178. package/src/index.ts +3 -0
  179. package/src/internal/DocumentPatch.ts +87 -0
  180. package/src/internal/httpBody.ts +72 -0
  181. package/src/internal/httpOptions.ts +154 -0
  182. package/src/internal/observability.ts +27 -0
  183. package/src/internal/reservedArgument.ts +56 -0
@@ -1 +1 @@
1
- {"version":3,"file":"GroupRegistry.js","names":["Registry.Registry","MiddlewareRegistryItem.isMiddlewareRegistryItem"],"sources":["../src/GroupRegistry.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport type * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport * as Registry from \"./Registry.js\";\nimport type * as RegistryItems from \"./RegistryItems.js\";\nimport type * as GroupImpl from \"./GroupImpl.js\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem.js\";\n\nexport const make = (\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n) => {\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.makeUnsafe<RegistryItems.RegistryItems>({}),\n ),\n Effect.runSync,\n );\n\n return partitionRegistryItems(registryItems);\n};\n\nconst partitionRegistryItems = (registryItems: RegistryItems.RegistryItems) => {\n const middlewareRegistryItems = new Map<\n string,\n MiddlewareRegistryItem.MiddlewareRegistryItem\n >();\n const functionRegistryItems: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(registryItems)) {\n if (MiddlewareRegistryItem.isMiddlewareRegistryItem(value)) {\n middlewareRegistryItems.set(value.middlewareSpec.key, value);\n } else {\n functionRegistryItems[key] = value;\n }\n }\n return { functionRegistryItems, middlewareRegistryItems };\n};\n"],"mappings":";;;;;AAQA,MAAa,QACX,eACG;CACH,MAAM,gBAAgB,OAAO,IAAI,aAAa;EAC5C,MAAM,WAAW,OAAOA;EACxB,OAAO,OAAO,IAAI,IAAI,QAAQ;CAChC,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,UAAU,GACzB,OAAO,eACLA,UACA,IAAI,WAAwC,CAAC,CAAC,CAChD,GACA,OAAO,OACT;CAEA,OAAO,uBAAuB,aAAa;AAC7C;AAEA,MAAM,0BAA0B,kBAA+C;CAC7E,MAAM,0CAA0B,IAAI,IAGlC;CACF,MAAM,wBAAiD,CAAC;CACxD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,GACrD,IAAIC,yBAAgD,KAAK,GACvD,wBAAwB,IAAI,MAAM,eAAe,KAAK,KAAK;MAE3D,sBAAsB,OAAO;CAGjC,OAAO;EAAE;EAAuB;CAAwB;AAC1D"}
1
+ {"version":3,"file":"GroupRegistry.js","names":["Registry.Registry","RegisteredFunction.Observability","MiddlewareRegistryItem.isMiddlewareRegistryItem"],"sources":["../src/GroupRegistry.ts"],"sourcesContent":["import * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport * as Effect from \"effect/Effect\";\nimport type * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport * as Registry from \"./Registry.js\";\nimport type * as RegistryItems from \"./RegistryItems.js\";\nimport type * as GroupImpl from \"./GroupImpl.js\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem.js\";\n\nexport const make = (\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n) => {\n const { registryItems, observability } = Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n return {\n registryItems: yield* Ref.get(registry),\n observability: yield* RegisteredFunction.Observability,\n };\n }).pipe(\n Effect.provide(groupLayer),\n Effect.provideService(\n Registry.Registry,\n Ref.makeUnsafe<RegistryItems.RegistryItems>({}),\n ),\n Effect.runSync,\n );\n\n return { ...partitionRegistryItems(registryItems), observability };\n};\n\nconst partitionRegistryItems = (registryItems: RegistryItems.RegistryItems) => {\n const middlewareRegistryItems = new Map<\n string,\n MiddlewareRegistryItem.MiddlewareRegistryItem\n >();\n const functionRegistryItems: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(registryItems)) {\n if (MiddlewareRegistryItem.isMiddlewareRegistryItem(value)) {\n middlewareRegistryItems.set(value.middlewareSpec.key, value);\n } else {\n functionRegistryItems[key] = value;\n }\n }\n return { functionRegistryItems, middlewareRegistryItems };\n};\n"],"mappings":";;;;;;AASA,MAAa,QACX,eACG;CACH,MAAM,EAAE,eAAe,kBAAkB,OAAO,IAAI,aAAa;EAC/D,MAAM,WAAW,OAAOA;EACxB,OAAO;GACL,eAAe,OAAO,IAAI,IAAI,QAAQ;GACtC,eAAe,OAAOC;EACxB;CACF,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,UAAU,GACzB,OAAO,eACLD,UACA,IAAI,WAAwC,CAAC,CAAC,CAChD,GACA,OAAO,OACT;CAEA,OAAO;EAAE,GAAG,uBAAuB,aAAa;EAAG;CAAc;AACnE;AAEA,MAAM,0BAA0B,kBAA+C;CAC7E,MAAM,0CAA0B,IAAI,IAGlC;CACF,MAAM,wBAAiD,CAAC;CACxD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,GACrD,IAAIE,yBAAgD,KAAK,GACvD,wBAAwB,IAAI,MAAM,eAAe,KAAK,KAAK;MAE3D,sBAAsB,OAAO;CAGjC,OAAO;EAAE;EAAuB;CAAwB;AAC1D"}
package/dist/Handler.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ActionCall } from "@confect/core/ActionCall";
1
2
  import type { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
2
3
  import type * as FunctionProvenance from "@confect/core/FunctionProvenance";
3
4
  import type * as NodeServices from "@effect/platform-node/NodeServices";
@@ -29,15 +30,18 @@ export type Handler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, Functio
29
30
  type ConvexProvenanceHandler<FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;
30
31
  type ConfectProvenanceHandler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>, R = never> = FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "query"> ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_, R> : FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "mutation"> ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_, R> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.ConvexAction> ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_, R> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.NodeAction> ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_, R> : never;
31
32
  export type QueryServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> = DatabaseReader.DatabaseReader<DatabaseSchema_> | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Auth.Auth) | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | ExecutionMetadata | TransactionMetadata | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Storage) | QueryRunner.QueryRunner | QueryTransactionContext | QueryCtx.QueryCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>, DatabaseSchema.Scope<DatabaseSchema_>>;
32
- export type MutationServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> = DatabaseReader.DatabaseReader<DatabaseSchema_> | DatabaseWriter.DatabaseWriter<DatabaseSchema_> | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Auth.Auth) | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | ExecutionMetadata | TransactionMetadata | RequestMetadata | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Storage) | QueryRunner.QueryRunner | MutationRunner.MutationRunner | QueryTransactionContext | MutationTransactionContext | MutationCtx.MutationCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>, DatabaseSchema.Scope<DatabaseSchema_>>;
33
+ export type MutationServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> = DatabaseReader.DatabaseReader<DatabaseSchema_> | DatabaseWriter.DatabaseWriter<DatabaseSchema_> | Auth.MutationAuth | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Auth.Auth) | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | ExecutionMetadata | TransactionMetadata | RequestMetadata | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Storage) | QueryRunner.QueryRunner | MutationRunner.MutationRunner | QueryTransactionContext | MutationTransactionContext | MutationCtx.MutationCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>, DatabaseSchema.Scope<DatabaseSchema_>>;
33
34
  /**
34
35
  * Shared by both action runtimes.
35
36
  */
36
- export type ActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> = Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Auth.Auth) | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageActionWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | ExecutionMetadata | RequestMetadata | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Storage) | QueryRunner.QueryRunner | MutationRunner.MutationRunner | ActionRunner.ActionRunner | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>> | ActionCtx.ActionCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>, DatabaseSchema.Scope<DatabaseSchema_>>;
37
+ type RawActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> = Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Auth.Auth) | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | StorageActionWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>> | ExecutionMetadata | RequestMetadata | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Storage) | QueryRunner.QueryRunner | MutationRunner.MutationRunner | ActionRunner.ActionRunner | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>> | ActionCtx.ActionCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>, DatabaseSchema.Scope<DatabaseSchema_>>;
38
+ export type ActionServices<S extends DatabaseSchema.AnyWithProps, R = never> = [
39
+ Extract<R, ActionCall>
40
+ ] extends [never] ? RawActionServices<S> : Exclude<RawActionServices<S>, Scheduler.ForScope<DatabaseSchema.Scope<S>> | QueryRunner.QueryRunner | MutationRunner.MutationRunner | ActionRunner.ActionRunner | ActionCtx.ActionCtx<DataModel.ToConvex<DataModel.FromSchema<S>>, DatabaseSchema.Scope<S>>>;
37
41
  export type ConfectProvenanceQuery<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>, R = never> = Base<FunctionSpec_, QueryServices<DatabaseSchema_> | R>;
38
42
  export type ConfectProvenanceMutation<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>, R = never> = Base<FunctionSpec_, MutationServices<DatabaseSchema_> | R>;
39
- export type ConvexRuntimeAction<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>, R = never> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | R>;
40
- export type NodeRuntimeAction<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>, R = never> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | NodeServices.NodeServices | R>;
43
+ export type ConvexRuntimeAction<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>, R = never> = Base<FunctionSpec_, ActionServices<DatabaseSchema_, R> | R>;
44
+ export type NodeRuntimeAction<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>, R = never> = Base<FunctionSpec_, ActionServices<DatabaseSchema_, R> | NodeServices.NodeServices | R>;
41
45
  type Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (args: FunctionSpec.Args<FunctionSpec_>) => Effect.Effect<FunctionSpec.Returns<FunctionSpec_>, FunctionSpec.Error<FunctionSpec_>, R>;
42
46
  export type Any = AnyConfectProvenance | AnyConvexProvenance;
43
47
  export type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"Handler.d.ts","sourceRoot":"","sources":["../src/Handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,KAAK,kBAAkB,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,KAAK,YAAY,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,YAAY,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,KAAK,WAAW,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,KAAK,WAAW,MAAM,kBAAkB,CAAC;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IACP,IAAI,CACN,aAAa,EACb,cAAc,CAAC,eAAe,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,YAAY,GAAG,CAAC,CACnE,CAAC;AAEF,KAAK,IAAI,CAAC,aAAa,SAAS,YAAY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC9D,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,KACnC,MAAM,CAAC,MAAM,CAChB,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,EACnC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,EACjC,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,GAAG,CAAC;AAEzD,MAAM,MAAM,QAAQ,CAClB,eAAe,SAAS,cAAc,CAAC,YAAY,EACnD,aAAa,SAAS,YAAY,CAAC,YAAY,EAC/C,YAAY,SAAS,MAAM,EAC3B,CAAC,GAAG,KAAK,IACP,OAAO,CACT,eAAe,EACf,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,EAClD,CAAC,CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Handler.js","names":[],"sources":["../src/Handler.ts"],"sourcesContent":["import type { FunctionSpec, RuntimeAndFunctionType } from \"@confect/core\";\nimport type * as FunctionProvenance from \"@confect/core/FunctionProvenance\";\nimport type * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport type { Effect } from \"effect\";\nimport type * as ActionCtx from \"./ActionCtx.js\";\nimport type * as ActionRunner from \"./ActionRunner.js\";\nimport type * as Auth from \"./Auth.js\";\nimport type * as DatabaseReader from \"./DatabaseReader.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as DatabaseWriter from \"./DatabaseWriter.js\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata.js\";\nimport type { RequestMetadata } from \"./RequestMetadata.js\";\nimport type { TransactionMetadata } from \"./TransactionMetadata.js\";\nimport type * as MutationCtx from \"./MutationCtx.js\";\nimport type * as MutationRunner from \"./MutationRunner.js\";\nimport type { MutationTransactionContext } from \"./MutationTransactionContext.js\";\nimport type * as QueryCtx from \"./QueryCtx.js\";\nimport type * as QueryRunner from \"./QueryRunner.js\";\nimport type { QueryTransactionContext } from \"./QueryTransactionContext.js\";\nimport type * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport type * as Scheduler from \"./Scheduler.js\";\nimport type { Storage } from \"./Storage.js\";\nimport type * as StorageActionWriter from \"./StorageActionWriter.js\";\nimport type * as StorageReader from \"./StorageReader.js\";\nimport type * as StorageWriter from \"./StorageWriter.js\";\nimport type * as VectorSearch from \"./VectorSearch.js\";\n\nexport type Handler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConvex\n >\n ? ConvexProvenanceHandler<FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConfect\n >\n ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\ntype ConvexProvenanceHandler<\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>,\n> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;\n\ntype ConfectProvenanceHandler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, \"query\">\n ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithFunctionType<\n FunctionSpec_,\n \"mutation\"\n >\n ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.ConvexAction\n >\n ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.NodeAction\n >\n ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\nexport type QueryServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | QueryTransactionContext\n | QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type MutationServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | DatabaseWriter.DatabaseWriter<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | QueryTransactionContext\n | MutationTransactionContext\n | MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\n/**\n * Shared by both action runtimes.\n */\nexport type ActionServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageActionWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>>\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type ConfectProvenanceQuery<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>,\n R = never,\n> = Base<FunctionSpec_, QueryServices<DatabaseSchema_> | R>;\n\nexport type ConfectProvenanceMutation<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>,\n R = never,\n> = Base<FunctionSpec_, MutationServices<DatabaseSchema_> | R>;\n\nexport type ConvexRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,\n R = never,\n> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | R>;\n\nexport type NodeRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>,\n R = never,\n> = Base<\n FunctionSpec_,\n ActionServices<DatabaseSchema_> | NodeServices.NodeServices | R\n>;\n\ntype Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (\n args: FunctionSpec.Args<FunctionSpec_>,\n) => Effect.Effect<\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>,\n R\n>;\n\nexport type Any = AnyConfectProvenance | AnyConvexProvenance;\n\nexport type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;\n\nexport type AnyConvexProvenance = RegisteredFunction.Any;\n\nexport type WithName<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n FunctionName extends string,\n R = never,\n> = Handler<\n DatabaseSchema_,\n FunctionSpec.WithName<FunctionSpec_, FunctionName>,\n R\n>;\n"],"mappings":""}
1
+ {"version":3,"file":"Handler.js","names":[],"sources":["../src/Handler.ts"],"sourcesContent":["import type { ActionCall } from \"@confect/core/ActionCall\";\nimport type { FunctionSpec, RuntimeAndFunctionType } from \"@confect/core\";\nimport type * as FunctionProvenance from \"@confect/core/FunctionProvenance\";\nimport type * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport type { Effect } from \"effect\";\nimport type * as ActionCtx from \"./ActionCtx.js\";\nimport type * as ActionRunner from \"./ActionRunner.js\";\nimport type * as Auth from \"./Auth.js\";\nimport type * as DatabaseReader from \"./DatabaseReader.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as DatabaseWriter from \"./DatabaseWriter.js\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata.js\";\nimport type { RequestMetadata } from \"./RequestMetadata.js\";\nimport type { TransactionMetadata } from \"./TransactionMetadata.js\";\nimport type * as MutationCtx from \"./MutationCtx.js\";\nimport type * as MutationRunner from \"./MutationRunner.js\";\nimport type { MutationTransactionContext } from \"./MutationTransactionContext.js\";\nimport type * as QueryCtx from \"./QueryCtx.js\";\nimport type * as QueryRunner from \"./QueryRunner.js\";\nimport type { QueryTransactionContext } from \"./QueryTransactionContext.js\";\nimport type * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport type * as Scheduler from \"./Scheduler.js\";\nimport type { Storage } from \"./Storage.js\";\nimport type * as StorageActionWriter from \"./StorageActionWriter.js\";\nimport type * as StorageReader from \"./StorageReader.js\";\nimport type * as StorageWriter from \"./StorageWriter.js\";\nimport type * as VectorSearch from \"./VectorSearch.js\";\n\nexport type Handler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConvex\n >\n ? ConvexProvenanceHandler<FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConfect\n >\n ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\ntype ConvexProvenanceHandler<\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>,\n> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;\n\ntype ConfectProvenanceHandler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, \"query\">\n ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithFunctionType<\n FunctionSpec_,\n \"mutation\"\n >\n ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.ConvexAction\n >\n ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.NodeAction\n >\n ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\nexport type QueryServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | QueryTransactionContext\n | QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type MutationServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | DatabaseWriter.DatabaseWriter<DatabaseSchema_>\n | Auth.MutationAuth\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | QueryTransactionContext\n | MutationTransactionContext\n | MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\n/**\n * Shared by both action runtimes.\n */\ntype RawActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> =\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageActionWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>>\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type ActionServices<S extends DatabaseSchema.AnyWithProps, R = never> = [\n Extract<R, ActionCall>,\n] extends [never]\n ? RawActionServices<S>\n : Exclude<\n RawActionServices<S>,\n | Scheduler.ForScope<DatabaseSchema.Scope<S>>\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<S>>,\n DatabaseSchema.Scope<S>\n >\n >;\n\nexport type ConfectProvenanceQuery<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>,\n R = never,\n> = Base<FunctionSpec_, QueryServices<DatabaseSchema_> | R>;\n\nexport type ConfectProvenanceMutation<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>,\n R = never,\n> = Base<FunctionSpec_, MutationServices<DatabaseSchema_> | R>;\n\nexport type ConvexRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,\n R = never,\n> = Base<FunctionSpec_, ActionServices<DatabaseSchema_, R> | R>;\n\nexport type NodeRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>,\n R = never,\n> = Base<\n FunctionSpec_,\n ActionServices<DatabaseSchema_, R> | NodeServices.NodeServices | R\n>;\n\ntype Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (\n args: FunctionSpec.Args<FunctionSpec_>,\n) => Effect.Effect<\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>,\n R\n>;\n\nexport type Any = AnyConfectProvenance | AnyConvexProvenance;\n\nexport type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;\n\nexport type AnyConvexProvenance = RegisteredFunction.Any;\n\nexport type WithName<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n FunctionName extends string,\n R = never,\n> = Handler<\n DatabaseSchema_,\n FunctionSpec.WithName<FunctionSpec_, FunctionName>,\n R\n>;\n"],"mappings":""}
@@ -67,6 +67,7 @@ export type Routes<Services_ = Services> = Layer.Layer<never, never, HttpRouter.
67
67
  * precedence.
68
68
  */
69
69
  export declare const make: <Id extends string, Groups extends HttpApiGroup.Constraint>(routes: Routes, options?: {
70
+ readonly observability?: Layer.Layer<never> | undefined;
70
71
  readonly api?: HttpApi.HttpApi<Id, Groups> | undefined;
71
72
  }) => ConvexHttpRouter;
72
73
  /**
@@ -75,6 +76,8 @@ export declare const make: <Id extends string, Groups extends HttpApiGroup.Const
75
76
  * Supply `{ api }` as in {@link make}; labels stay component-relative.
76
77
  */
77
78
  export declare const forSchema: <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(schema: DatabaseSchema_) => <Id extends string, Groups extends HttpApiGroup.Constraint>(routes: Routes<Handler.ActionServices<DatabaseSchema_>>, options?: {
79
+ readonly observability?: Layer.Layer<never> | undefined;
78
80
  readonly api?: HttpApi.HttpApi<Id, Groups> | undefined;
79
81
  }) => ConvexHttpRouter;
82
+ export { withBodyLimit } from "./internal/httpBody.js";
80
83
  //# sourceMappingURL=HttpRouter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpRouter.d.ts","sourceRoot":"","sources":["../src/HttpRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,IAAI,gBAAgB,EAOpC,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,KAAK,UAAU,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAC;AAIzC,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,KAAK,IAAI,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,KAAK,YAAY,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,KAAK,YAAY,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe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,OAAO,EAAE,GAAG,CAAC,GAChC,UAAU,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CACzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,EAAE,SAAS,MAAM,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,UACpE,MAAM,YACJ;IACR,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CACxD,KACA,gBAMA,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,SAAS,GACnB,eAAe,SAAS,cAAc,CAAC,YAAY,UAC1C,eAAe,MAExB,EAAE,SAAS,MAAM,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,UAChD,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,YAC7C;IACR,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CACxD,KACA,gBAkBA,CAAC;AA4RN,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,25 +1,30 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { layer } from "./ConvexConfigProvider.js";
3
3
  import { layer as layer$1 } from "./ConvexLogger.js";
4
+ import { memoized } from "./internal/observability.js";
4
5
  import { actionLayer, baseActionLayer } from "./RegisteredFunction.js";
6
+ import { withOptions } from "./internal/httpOptions.js";
7
+ import { withBodyLimit } from "./internal/httpBody.js";
5
8
  import * as Context from "effect/Context";
6
- import * as Layer from "effect/Layer";
7
9
  import * as Effect from "effect/Effect";
10
+ import * as Layer from "effect/Layer";
11
+ import * as Array from "effect/Array";
8
12
  import { ROUTABLE_HTTP_METHODS, httpActionGeneric, httpRouter } from "convex/server";
9
13
  import * as Schema from "effect/Schema";
10
14
  import * as Match from "effect/Match";
11
- import * as Array from "effect/Array";
12
15
  import * as SchemaAST from "effect/SchemaAST";
13
- import * as Console from "effect/Console";
14
16
  import * as Config from "effect/Config";
17
+ import * as Console from "effect/Console";
15
18
  import * as FindMyWay from "effect/http/FindMyWay";
16
19
  import * as HttpApi from "effect/http-api/HttpApi";
17
20
  import * as HttpRouter from "effect/http/HttpRouter";
21
+ import * as HttpMiddleware from "effect/http/HttpMiddleware";
18
22
  import * as HttpServer from "effect/http/HttpServer";
19
23
  //#region src/HttpRouter.ts
20
24
  var HttpRouter_exports = /* @__PURE__ */ __exportAll({
21
25
  forSchema: () => forSchema,
22
- make: () => make
26
+ make: () => make,
27
+ withBodyLimit: () => withBodyLimit
23
28
  });
24
29
  /**
25
30
  * Create a Convex HTTP router serving the given routes.
@@ -40,22 +45,36 @@ var HttpRouter_exports = /* @__PURE__ */ __exportAll({
40
45
  * exact paths first and longer path prefixes before the catch-all, so they take
41
46
  * precedence.
42
47
  */
43
- const make = (routes, options) => makeWithLayer(routes, baseActionLayer, options?.api);
48
+ const make = (routes, options) => makeWithLayer(routes, baseActionLayer, options?.api, options?.observability);
44
49
  /**
45
50
  * Derive HTTP capabilities and ID scopes from the generated database schema.
46
51
  * Component routes are relative to their installation's HTTP mount prefix.
47
52
  * Supply `{ api }` as in {@link make}; labels stay component-relative.
48
53
  */
49
- const forSchema = (schema) => (routes, options) => makeWithLayer(Match.value(schema.target.kind).pipe(Match.when("app", () => routes), Match.when("component", () => routes.pipe(Layer.provide(componentRouter))), Match.exhaustive), (ctx) => actionLayer(schema, ctx), options?.api);
54
+ const forSchema = (schema) => (routes, options) => makeWithLayer(Match.value(schema.target.kind).pipe(Match.when("app", () => routes), Match.when("component", () => routes.pipe(Layer.provide(componentRouter))), Match.exhaustive), (ctx) => actionLayer(schema, ctx), options?.api, options?.observability, schema.target.kind === "component");
50
55
  const componentRouter = Layer.effect(HttpRouter.HttpRouter, Effect.gen(function* () {
51
56
  const router = yield* HttpRouter.HttpRouter;
52
57
  const siteUrl = yield* Config.schema(Schema.URLFromString, "CONVEX_SITE_URL");
53
58
  return router.prefixed(siteUrl.pathname);
54
59
  }).pipe(Effect.orDie));
55
- const makeWithLayer = (routes, layer$2, api) => {
60
+ const makeWithLayer = (routes, layer$2, api, observability, siteRelative = false) => {
56
61
  applyMonkeyPatches();
57
- const AppLayer = routes.pipe(Layer.provideMerge(layer$1), Layer.provideMerge(layer), Layer.provide(HttpServer.layerServices));
58
- const { handler } = HttpRouter.toWebHandler(AppLayer, { disableLogger: true });
62
+ const spanName = Layer.effect(HttpMiddleware.SpanNameGenerator, Effect.gen(function* () {
63
+ const prefix = siteRelative ? (yield* Config.schema(Schema.URLFromString, "CONVEX_SITE_URL")).pathname.replace(/\/$/, "") : "";
64
+ return (request) => convexHttpRouter.lookup(new URL(request.originalUrl).pathname.slice(prefix.length) || "/", request.method)?.[2] ?? "/*";
65
+ }).pipe(Effect.orDie));
66
+ const endpoints = /* @__PURE__ */ new Set();
67
+ if (api !== void 0) HttpApi.reflect(api, {
68
+ onGroup: () => {},
69
+ onEndpoint: ({ endpoint }) => {
70
+ endpoints.add(`${endpoint.method} ${apiRouterPath(endpoint.path, endpoint.params)}`);
71
+ }
72
+ });
73
+ const AppLayer = withOptions(routes, endpoints).pipe(Layer.provideMerge(observability === void 0 ? layer$1 : Layer.merge(memoized(observability), spanName)), Layer.provideMerge(layer), Layer.provide(HttpServer.layerServices));
74
+ const { handler } = HttpRouter.toWebHandler(AppLayer, {
75
+ disableLogger: true,
76
+ ...observability === void 0 ? {} : { middleware: (effect) => Effect.andThen(Effect.annotateCurrentSpan("kind", "httpAction"), effect) }
77
+ });
59
78
  const httpAction = httpActionGeneric((ctx, request) => {
60
79
  const services = Effect.runSync(Effect.scoped(Layer.build(layer$2(ctx))));
61
80
  return handler(request, Context.add(services, Console.Console, globalThis.console));
@@ -190,6 +209,6 @@ const applyMonkeyPatches = () => {
190
209
  });
191
210
  };
192
211
  //#endregion
193
- export { HttpRouter_exports, forSchema, make };
212
+ export { HttpRouter_exports, forSchema, make, withBodyLimit };
194
213
 
195
214
  //# sourceMappingURL=HttpRouter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpRouter.js","names":["RegisteredFunction.baseActionLayer","RegisteredFunction.actionLayer","ConvexLogger.layer","ConvexConfigProvider.layer","layer"],"sources":["../src/HttpRouter.ts"],"sourcesContent":["import {\n type HttpRouter as ConvexHttpRouter,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n type GenericActionCtx,\n type GenericDataModel,\n} from \"convex/server\";\nimport * as Array from \"effect/Array\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Config from \"effect/Config\";\nimport * as Effect from \"effect/Effect\";\nimport type * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport type * as Path from \"effect/Path\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport * as FindMyWay from \"effect/http/FindMyWay\";\nimport * as HttpApi from \"effect/http-api/HttpApi\";\nimport type * as HttpApiGroup from \"effect/http-api/HttpApiGroup\";\nimport type * as Etag from \"effect/http/Etag\";\nimport type * as HttpPlatform from \"effect/http/HttpPlatform\";\nimport * as HttpRouter from \"effect/http/HttpRouter\";\nimport * as HttpServer from \"effect/http/HttpServer\";\nimport type * as ActionRunner from \"./ActionRunner.js\";\nimport type * as Auth from \"./Auth.js\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata.js\";\nimport type { RequestMetadata } from \"./RequestMetadata.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type * as Handler from \"./Handler.js\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider.js\";\nimport * as ConvexLogger from \"./ConvexLogger.js\";\nimport type * as MutationRunner from \"./MutationRunner.js\";\nimport type * as QueryRunner from \"./QueryRunner.js\";\nimport * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport type * as Scheduler from \"./Scheduler.js\";\nimport type { Storage } from \"./Storage.js\";\nimport type { StorageActionWriter } from \"./StorageActionWriter.js\";\nimport type { StorageReader } from \"./StorageReader.js\";\nimport type { StorageWriter } from \"./StorageWriter.js\";\n\n/**\n * The Confect services available to HTTP route handlers and middleware,\n * supplied per request from the Convex action context.\n */\nexport type Services =\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | ExecutionMetadata\n | RequestMetadata\n | Storage\n | StorageReader\n | StorageWriter\n | StorageActionWriter;\n\n/**\n * A layer that registers routes on the HTTP router—the input to {@link make}.\n *\n * Compose it from Effect's `effect/http` and `effect/http-api` modules:\n * `HttpApiBuilder.layer(api)` registers an `HttpApi`'s endpoints (provide its\n * group handler layers with `Layer.provide`), `HttpApiScalar.layer(api, ...)`\n * serves interactive API docs, `HttpRouter.add` registers a plain route, and\n * `HttpRouter.middleware(fn, { global: true })` applies middleware to every\n * route. Merge any number of these with `Layer.mergeAll`.\n *\n * Route handlers and middleware may require any of the Confect {@link Services},\n * which surface as request-level `Requires` markers and are supplied per\n * request. Anything else the layer requires is a type error—notably, an\n * `HttpApiBuilder.layer(api)` whose group handler layers are not provided\n * leaves an `HttpApiGroup.ToService` requirement behind, so a missing handler\n * group is caught at compile time.\n *\n * Layers are built with Confect's Convex-aware `ConfigProvider` in context, so\n * `Config` reads (e.g. in `Layer.unwrap`) resolve against Convex environment\n * variables.\n */\nexport type Routes<Services_ = Services> = Layer.Layer<\n never,\n never,\n | HttpRouter.HttpRouter\n | Etag.Generator\n | FileSystem.FileSystem\n | HttpPlatform.HttpPlatform\n | Path.Path\n | HttpRouter.Request<\"Requires\", Services_>\n | HttpRouter.Request<\"GlobalRequires\", Services_>\n | HttpRouter.Request<\"Error\", any>\n | HttpRouter.Request<\"GlobalError\", any>\n>;\n\n/**\n * Create a Convex HTTP router serving the given routes.\n *\n * A single catch-all `httpAction` is registered for every routable method under\n * the path prefix `\"/\"`, making the Effect router the single source of truth\n * for paths: place an API with `HttpApi.prefix` or absolute route paths.\n * Requests that match no route receive the Effect router's 404 response.\n *\n * Supply `{ api }` with the `HttpApi` registered by the routes layer to show\n * endpoint patterns in Convex completion logs and the dashboard. Requests that\n * match no reflected endpoint keep the catch-all completion label. Without the\n * option, Convex reports the catch-all registrations. Application endpoints\n * must not overlap component HTTP mounts: Convex also uses dashboard route\n * entries to select between application and component routers.\n *\n * Plain Convex routes can still be added to the returned router—Convex matches\n * exact paths first and longer path prefixes before the catch-all, so they take\n * precedence.\n */\nexport const make = <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes,\n options?: { readonly api?: HttpApi.HttpApi<Id, Groups> | undefined },\n): ConvexHttpRouter =>\n makeWithLayer(routes, RegisteredFunction.baseActionLayer, options?.api);\n\n/**\n * Derive HTTP capabilities and ID scopes from the generated database schema.\n * Component routes are relative to their installation's HTTP mount prefix.\n * Supply `{ api }` as in {@link make}; labels stay component-relative.\n */\nexport const forSchema =\n <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n schema: DatabaseSchema_,\n ) =>\n <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes<Handler.ActionServices<DatabaseSchema_>>,\n options?: { readonly api?: HttpApi.HttpApi<Id, Groups> | undefined },\n ): ConvexHttpRouter =>\n makeWithLayer<\n Handler.ActionServices<DatabaseSchema_>,\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n Id,\n Groups\n >(\n Match.value(schema.target.kind).pipe(\n Match.when(\"app\", () => routes),\n Match.when(\"component\", () =>\n routes.pipe(Layer.provide(componentRouter)),\n ),\n Match.exhaustive,\n ),\n (ctx) => RegisteredFunction.actionLayer(schema, ctx),\n options?.api,\n );\n\n// Convex uses a component-relative path to select its HTTP action but passes\n// the original request URL to that action. Its CONVEX_SITE_URL includes the\n// installation's full mount prefix (including parent mounts). Prefixing the\n// Effect router preserves relative routes without rewriting the Request body.\nconst componentRouter = Layer.effect(\n HttpRouter.HttpRouter,\n Effect.gen(function* () {\n const router = yield* HttpRouter.HttpRouter;\n const siteUrl = yield* Config.schema(\n Schema.URLFromString,\n \"CONVEX_SITE_URL\",\n );\n return router.prefixed(siteUrl.pathname);\n }).pipe(Effect.orDie),\n);\n\nconst makeWithLayer = <\n Services_,\n DataModel_ extends GenericDataModel,\n Id extends string,\n Groups extends HttpApiGroup.Constraint,\n>(\n routes: Routes<Services_>,\n layer: (ctx: GenericActionCtx<DataModel_>) => Layer.Layer<Services_>,\n api: HttpApi.HttpApi<Id, Groups> | undefined,\n): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n // Provided (not just merged) so that route layers' own construction—e.g.\n // a `Layer.unwrap` reading `Config`—resolves configuration through the\n // Convex-aware provider; merged so that request fibers—endpoint handlers\n // and middleware—do too.\n const AppLayer = routes.pipe(\n Layer.provideMerge(ConvexLogger.layer),\n Layer.provideMerge(ConvexConfigProvider.layer),\n Layer.provide(HttpServer.layerServices),\n );\n\n // The Confect service requirements of route handlers and middleware surface\n // as request-level `Requires` markers on the layer, which the web handler\n // exposes as a per-request context argument.\n const { handler } = HttpRouter.toWebHandler(AppLayer, {\n disableLogger: true,\n });\n\n const httpAction = httpActionGeneric((ctx, request): Promise<Response> => {\n // The ctx-backed service layers are all synchronous and finalizer-free,\n // so the scope can close as soon as the context is built.\n // Convex's HTTP registration erases the data model. The supplied generated\n // schema restores it; this does not change the runtime context or services.\n const services = Effect.runSync(\n Effect.scoped(\n Layer.build(layer(ctx as unknown as GenericActionCtx<DataModel_>)),\n ),\n );\n return handler(\n request,\n Context.add(services, Console.Console, globalThis.console),\n );\n });\n\n const convexHttpRouter = httpRouter();\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix: \"/\",\n method,\n handler: httpAction,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n if (api !== undefined) {\n const matcher = FindMyWay.make<string>();\n const reflected: ReturnType<ConvexHttpRouter[\"getRoutes\"]> = [];\n HttpApi.reflect(api, {\n onGroup: () => {},\n onEndpoint: ({ endpoint }) => {\n const method = ROUTABLE_HTTP_METHODS.find(\n (candidate) => candidate === endpoint.method,\n );\n if (method === undefined) return;\n const path = apiRouterPath(\n endpoint.path as FindMyWay.PathInput,\n endpoint.params,\n );\n matcher.on(method, path, endpoint.path);\n // Effect also matches a wildcard route's base path without its slash.\n if (path.endsWith(\"/*\")) {\n matcher.on(method, path.slice(0, -2) as `/${string}`, endpoint.path);\n }\n reflected.push([endpoint.path, method, httpAction]);\n },\n });\n reflected.sort(\n ([pathA, methodA], [pathB, methodB]) =>\n pathA.localeCompare(pathB) || methodA.localeCompare(methodB),\n );\n\n const getRoutes = convexHttpRouter.getRoutes;\n convexHttpRouter.getRoutes = () =>\n reflected.length === 0\n ? getRoutes()\n : [\n ...getRoutes().filter(([, , action]) => action !== httpAction),\n ...reflected,\n ];\n const lookup = convexHttpRouter.lookup;\n convexHttpRouter.lookup = (path, method) => {\n const match = lookup(path, method);\n if (match === null || match[0] !== httpAction) return match;\n const normalized = match[1];\n const reflectedPath = matcher.find(normalized, path)?.handler;\n return reflectedPath === undefined\n ? match\n : [httpAction, normalized, reflectedPath];\n };\n }\n\n return convexHttpRouter;\n};\n\n/*!\n * apiRouterPath is adapted from Effect 4.0.1 http-api/internal/path.ts.\n *\n * MIT License\n *\n * Copyright (c) 2023 Effectful Technologies Inc\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Match Effect's HttpApiBuilder path normalization, which is not publicly\n// exported (effect/http-api/internal/path.ts). Undeclared colons are literals;\n// declared params followed by a literal suffix need an explicit regex boundary.\nconst apiRouterPath = (\n path: FindMyWay.PathInput,\n params: Schema.Top | undefined,\n): FindMyWay.PathInput => {\n if (params === undefined || !path.includes(\":\")) return path;\n let ast = params.ast;\n while (ast.encoding !== undefined) {\n ast = ast.encoding[ast.encoding.length - 1].to;\n }\n if (!SchemaAST.isObjects(ast) || ast.indexSignatures.length !== 0)\n return path;\n const names = new Set(\n ast.propertySignatures.map((property) => String(property.name)),\n );\n let normalized = \"\";\n let depth = 0;\n let regexStart = -1;\n for (let i = 0; i < path.length; i++) {\n const char = path[i];\n if (depth > 0 || i === regexStart) {\n normalized += char;\n if (char === \"\\\\\") normalized += path[++i] ?? \"\";\n else if (char === \"(\") depth++;\n else if (char === \")\") depth--;\n } else if (char !== \":\") {\n normalized += char;\n } else if (path[i + 1] === \":\") {\n normalized += \"::\";\n i++;\n } else {\n const param = /^:(\\w+)/.exec(path.slice(i));\n if (param !== null && names.has(param[1])) {\n normalized += param[0];\n i += param[0].length - 1;\n const next = path[i + 1];\n if (next === \"(\") regexStart = i + 1;\n else if (next !== undefined && !\"/.-?\".includes(next))\n normalized += \"(.*?)\";\n } else {\n normalized += \"::\";\n }\n }\n }\n return normalized as FindMyWay.PathInput;\n};\n\n// These are necessary until the Convex runtime supports these APIs. See\n// https://discord.com/channels/1019350475847499849/1281364098419785760\n// Each patch is applied only where the API is actually broken, so runtimes\n// with working implementations—Node under convex-test, notably, where\n// `new AbortSignal()` is an illegal constructor—keep their native behavior.\nconst applyMonkeyPatches = () => {\n const urlCredentialsBroken = (() => {\n try {\n return new URL(\"https://confect.dev\").username === undefined;\n } catch {\n return true;\n }\n })();\n if (urlCredentialsBroken) {\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n }\n\n const requestSignalBroken = (() => {\n try {\n return new Request(\"https://confect.dev\").signal === undefined;\n } catch {\n return true;\n }\n })();\n if (requestSignalBroken) {\n // `configurable` so repeated definition—e.g. module re-evaluation in a\n // long-lived environment—does not throw.\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n configurable: true,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,MAAa,QACX,QACA,YAEA,cAAc,QAAQA,iBAAoC,SAAS,GAAG;;;;;;AAOxE,MAAa,aAET,YAGA,QACA,YAEA,cAME,MAAM,MAAM,OAAO,OAAO,IAAI,CAAC,CAAC,KAC9B,MAAM,KAAK,aAAa,MAAM,GAC9B,MAAM,KAAK,mBACT,OAAO,KAAK,MAAM,QAAQ,eAAe,CAAC,CAC5C,GACA,MAAM,UACR,IACC,QAAQC,YAA+B,QAAQ,GAAG,GACnD,SAAS,GACX;AAMJ,MAAM,kBAAkB,MAAM,OAC5B,WAAW,YACX,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO,WAAW;CACjC,MAAM,UAAU,OAAO,OAAO,OAC5B,OAAO,eACP,iBACF;CACA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;OACT,IAAI,KAAK,IAAI,OAAO,KAAK;GAC9B,cAAc;GACd;EACF,OAAO;GACL,MAAM,QAAQ,UAAU,KAAK,KAAK,MAAM,CAAC,CAAC;GAC1C,IAAI,UAAU,QAAQ,MAAM,IAAI,MAAM,EAAE,GAAG;IACzC,cAAc,MAAM;IACpB,KAAK,MAAM,EAAE,CAAC,SAAS;IACvB,MAAM,OAAO,KAAK,IAAI;IACtB,IAAI,SAAS,KAAK,aAAa,IAAI;SAC9B,IAAI,SAAS,KAAA,KAAa,CAAC,OAAO,SAAS,IAAI,GAClD,cAAc;GAClB,OACE,cAAc;EAElB;CACF;CACA,OAAO;AACT;AAOA,MAAM,2BAA2B;CAQ/B,WAPoC;EAClC,IAAI;GACF,OAAO,IAAI,IAAI,qBAAqB,CAAC,CAAC,aAAa,KAAA;EACrD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACuB,GACrB,MAAM,cAAc,IAAI;EACtB,IAAa,WAAW;GACtB,OAAO;EACT;EACA,IAAa,WAAW;GACtB,OAAO;EACT;CACF;CAUF,WAPmC;EACjC,IAAI;GACF,OAAO,IAAI,QAAQ,qBAAqB,CAAC,CAAC,WAAW,KAAA;EACvD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACsB,GAGpB,OAAO,eAAe,QAAQ,WAAW,UAAU;EACjD,WAAW,IAAI,YAAY;EAC3B,cAAc;CAChB,CAAC;AAEL"}
1
+ {"version":3,"file":"HttpRouter.js","names":["RegisteredFunction.baseActionLayer","RegisteredFunction.actionLayer","ConvexLogger.layer","ObservabilityRuntime.memoized","ConvexConfigProvider.layer","layer"],"sources":["../src/HttpRouter.ts"],"sourcesContent":["import {\n type HttpRouter as ConvexHttpRouter,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n type GenericActionCtx,\n type GenericDataModel,\n} from \"convex/server\";\nimport * as Array from \"effect/Array\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Config from \"effect/Config\";\nimport * as Effect from \"effect/Effect\";\nimport type * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport type * as Path from \"effect/Path\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport * as FindMyWay from \"effect/http/FindMyWay\";\nimport * as HttpApi from \"effect/http-api/HttpApi\";\nimport type * as HttpApiGroup from \"effect/http-api/HttpApiGroup\";\nimport type * as Etag from \"effect/http/Etag\";\nimport type * as HttpPlatform from \"effect/http/HttpPlatform\";\nimport * as HttpRouter from \"effect/http/HttpRouter\";\nimport * as HttpMiddleware from \"effect/http/HttpMiddleware\";\nimport type * as HttpServerRequest from \"effect/http/HttpServerRequest\";\nimport * as HttpServer from \"effect/http/HttpServer\";\nimport type * as ActionRunner from \"./ActionRunner.js\";\nimport type * as Auth from \"./Auth.js\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata.js\";\nimport type { RequestMetadata } from \"./RequestMetadata.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type * as Handler from \"./Handler.js\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider.js\";\nimport * as ObservabilityRuntime from \"./internal/observability.js\";\nimport { withOptions } from \"./internal/httpOptions.js\";\nimport * as ConvexLogger from \"./ConvexLogger.js\";\nimport type * as MutationRunner from \"./MutationRunner.js\";\nimport type * as QueryRunner from \"./QueryRunner.js\";\nimport * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport type * as Scheduler from \"./Scheduler.js\";\nimport type { Storage } from \"./Storage.js\";\nimport type { StorageActionWriter } from \"./StorageActionWriter.js\";\nimport type { StorageReader } from \"./StorageReader.js\";\nimport type { StorageWriter } from \"./StorageWriter.js\";\n\n/**\n * The Confect services available to HTTP route handlers and middleware,\n * supplied per request from the Convex action context.\n */\nexport type Services =\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | ExecutionMetadata\n | RequestMetadata\n | Storage\n | StorageReader\n | StorageWriter\n | StorageActionWriter;\n\n/**\n * A layer that registers routes on the HTTP router—the input to {@link make}.\n *\n * Compose it from Effect's `effect/http` and `effect/http-api` modules:\n * `HttpApiBuilder.layer(api)` registers an `HttpApi`'s endpoints (provide its\n * group handler layers with `Layer.provide`), `HttpApiScalar.layer(api, ...)`\n * serves interactive API docs, `HttpRouter.add` registers a plain route, and\n * `HttpRouter.middleware(fn, { global: true })` applies middleware to every\n * route. Merge any number of these with `Layer.mergeAll`.\n *\n * Route handlers and middleware may require any of the Confect {@link Services},\n * which surface as request-level `Requires` markers and are supplied per\n * request. Anything else the layer requires is a type error—notably, an\n * `HttpApiBuilder.layer(api)` whose group handler layers are not provided\n * leaves an `HttpApiGroup.ToService` requirement behind, so a missing handler\n * group is caught at compile time.\n *\n * Layers are built with Confect's Convex-aware `ConfigProvider` in context, so\n * `Config` reads (e.g. in `Layer.unwrap`) resolve against Convex environment\n * variables.\n */\nexport type Routes<Services_ = Services> = Layer.Layer<\n never,\n never,\n | HttpRouter.HttpRouter\n | Etag.Generator\n | FileSystem.FileSystem\n | HttpPlatform.HttpPlatform\n | Path.Path\n | HttpRouter.Request<\"Requires\", Services_>\n | HttpRouter.Request<\"GlobalRequires\", Services_>\n | HttpRouter.Request<\"Error\", any>\n | HttpRouter.Request<\"GlobalError\", any>\n>;\n\n/**\n * Create a Convex HTTP router serving the given routes.\n *\n * A single catch-all `httpAction` is registered for every routable method under\n * the path prefix `\"/\"`, making the Effect router the single source of truth\n * for paths: place an API with `HttpApi.prefix` or absolute route paths.\n * Requests that match no route receive the Effect router's 404 response.\n *\n * Supply `{ api }` with the `HttpApi` registered by the routes layer to show\n * endpoint patterns in Convex completion logs and the dashboard. Requests that\n * match no reflected endpoint keep the catch-all completion label. Without the\n * option, Convex reports the catch-all registrations. Application endpoints\n * must not overlap component HTTP mounts: Convex also uses dashboard route\n * entries to select between application and component routers.\n *\n * Plain Convex routes can still be added to the returned router—Convex matches\n * exact paths first and longer path prefixes before the catch-all, so they take\n * precedence.\n */\nexport const make = <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes,\n options?: {\n readonly observability?: Layer.Layer<never> | undefined;\n readonly api?: HttpApi.HttpApi<Id, Groups> | undefined;\n },\n): ConvexHttpRouter =>\n makeWithLayer(\n routes,\n RegisteredFunction.baseActionLayer,\n options?.api,\n options?.observability,\n );\n\n/**\n * Derive HTTP capabilities and ID scopes from the generated database schema.\n * Component routes are relative to their installation's HTTP mount prefix.\n * Supply `{ api }` as in {@link make}; labels stay component-relative.\n */\nexport const forSchema =\n <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n schema: DatabaseSchema_,\n ) =>\n <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes<Handler.ActionServices<DatabaseSchema_>>,\n options?: {\n readonly observability?: Layer.Layer<never> | undefined;\n readonly api?: HttpApi.HttpApi<Id, Groups> | undefined;\n },\n ): ConvexHttpRouter =>\n makeWithLayer<\n Handler.ActionServices<DatabaseSchema_>,\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n Id,\n Groups\n >(\n Match.value(schema.target.kind).pipe(\n Match.when(\"app\", () => routes),\n Match.when(\"component\", () =>\n routes.pipe(Layer.provide(componentRouter)),\n ),\n Match.exhaustive,\n ),\n (ctx) => RegisteredFunction.actionLayer(schema, ctx),\n options?.api,\n options?.observability,\n schema.target.kind === \"component\",\n );\n\n// Convex uses a component-relative path to select its HTTP action but passes\n// the original request URL to that action. Its CONVEX_SITE_URL includes the\n// installation's full mount prefix (including parent mounts). Prefixing the\n// Effect router preserves relative routes without rewriting the Request body.\nconst componentRouter = Layer.effect(\n HttpRouter.HttpRouter,\n Effect.gen(function* () {\n const router = yield* HttpRouter.HttpRouter;\n const siteUrl = yield* Config.schema(\n Schema.URLFromString,\n \"CONVEX_SITE_URL\",\n );\n return router.prefixed(siteUrl.pathname);\n }).pipe(Effect.orDie),\n);\n\nconst makeWithLayer = <\n Services_,\n DataModel_ extends GenericDataModel,\n Id extends string,\n Groups extends HttpApiGroup.Constraint,\n>(\n routes: Routes<Services_>,\n layer: (ctx: GenericActionCtx<DataModel_>) => Layer.Layer<Services_>,\n api: HttpApi.HttpApi<Id, Groups> | undefined,\n observability?: Layer.Layer<never>,\n siteRelative = false,\n): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n const spanName = Layer.effect(\n HttpMiddleware.SpanNameGenerator,\n Effect.gen(function* () {\n const prefix = siteRelative\n ? (yield* Config.schema(\n Schema.URLFromString,\n \"CONVEX_SITE_URL\",\n )).pathname.replace(/\\/$/, \"\")\n : \"\";\n return (request: HttpServerRequest.HttpServerRequest) =>\n convexHttpRouter.lookup(\n new URL(request.originalUrl).pathname.slice(prefix.length) || \"/\",\n request.method as (typeof ROUTABLE_HTTP_METHODS)[number],\n )?.[2] ?? \"/*\";\n }).pipe(Effect.orDie),\n );\n\n // Provided (not just merged) so that route layers' own construction—e.g.\n // a `Layer.unwrap` reading `Config`—resolves configuration through the\n // Convex-aware provider; merged so that request fibers—endpoint handlers\n // and middleware—do too.\n // Collected now: toWebHandler builds AppLayer before the reflection below.\n const endpoints = new Set<string>();\n if (api !== undefined)\n HttpApi.reflect(api, {\n onGroup: () => {},\n onEndpoint: ({ endpoint }) => {\n endpoints.add(\n `${endpoint.method} ${apiRouterPath(endpoint.path as FindMyWay.PathInput, endpoint.params)}`,\n );\n },\n });\n const AppLayer = withOptions(routes, endpoints).pipe(\n Layer.provideMerge(\n observability === undefined\n ? ConvexLogger.layer\n : Layer.merge(ObservabilityRuntime.memoized(observability), spanName),\n ),\n Layer.provideMerge(ConvexConfigProvider.layer),\n Layer.provide(HttpServer.layerServices),\n );\n\n // The Confect service requirements of route handlers and middleware surface\n // as request-level `Requires` markers on the layer, which the web handler\n // exposes as a per-request context argument.\n const { handler } = HttpRouter.toWebHandler(AppLayer, {\n disableLogger: true,\n /* oxlint-disable effecttsgo/any-unknown-in-error-context -- Keep Effect's erased HTTP boundary errors intact. */\n ...(observability === undefined\n ? {}\n : {\n middleware: (effect) =>\n Effect.andThen(\n Effect.annotateCurrentSpan(\"kind\", \"httpAction\"),\n effect,\n ),\n }),\n /* oxlint-enable effecttsgo/any-unknown-in-error-context */\n });\n\n const httpAction = httpActionGeneric((ctx, request): Promise<Response> => {\n // The ctx-backed service layers are all synchronous and finalizer-free,\n // so the scope can close as soon as the context is built.\n // Convex's HTTP registration erases the data model. The supplied generated\n // schema restores it; this does not change the runtime context or services.\n const services = Effect.runSync(\n Effect.scoped(\n Layer.build(layer(ctx as unknown as GenericActionCtx<DataModel_>)),\n ),\n );\n return handler(\n request,\n Context.add(services, Console.Console, globalThis.console),\n );\n });\n\n const convexHttpRouter = httpRouter();\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix: \"/\",\n method,\n handler: httpAction,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n if (api !== undefined) {\n const matcher = FindMyWay.make<string>();\n const reflected: ReturnType<ConvexHttpRouter[\"getRoutes\"]> = [];\n HttpApi.reflect(api, {\n onGroup: () => {},\n onEndpoint: ({ endpoint }) => {\n const method = ROUTABLE_HTTP_METHODS.find(\n (candidate) => candidate === endpoint.method,\n );\n if (method === undefined) return;\n const path = apiRouterPath(\n endpoint.path as FindMyWay.PathInput,\n endpoint.params,\n );\n matcher.on(method, path, endpoint.path);\n // Effect also matches a wildcard route's base path without its slash.\n if (path.endsWith(\"/*\")) {\n matcher.on(method, path.slice(0, -2) as `/${string}`, endpoint.path);\n }\n reflected.push([endpoint.path, method, httpAction]);\n },\n });\n reflected.sort(\n ([pathA, methodA], [pathB, methodB]) =>\n pathA.localeCompare(pathB) || methodA.localeCompare(methodB),\n );\n\n const getRoutes = convexHttpRouter.getRoutes;\n convexHttpRouter.getRoutes = () =>\n reflected.length === 0\n ? getRoutes()\n : [\n ...getRoutes().filter(([, , action]) => action !== httpAction),\n ...reflected,\n ];\n const lookup = convexHttpRouter.lookup;\n convexHttpRouter.lookup = (path, method) => {\n const match = lookup(path, method);\n if (match === null || match[0] !== httpAction) return match;\n const normalized = match[1];\n const reflectedPath = matcher.find(normalized, path)?.handler;\n return reflectedPath === undefined\n ? match\n : [httpAction, normalized, reflectedPath];\n };\n }\n\n return convexHttpRouter;\n};\n\n/*!\n * apiRouterPath is adapted from Effect 4.0.1 http-api/internal/path.ts.\n *\n * MIT License\n *\n * Copyright (c) 2023 Effectful Technologies Inc\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Match Effect's HttpApiBuilder path normalization, which is not publicly\n// exported (effect/http-api/internal/path.ts). Undeclared colons are literals;\n// declared params followed by a literal suffix need an explicit regex boundary.\nconst apiRouterPath = (\n path: FindMyWay.PathInput,\n params: Schema.Top | undefined,\n): FindMyWay.PathInput => {\n if (params === undefined || !path.includes(\":\")) return path;\n let ast = params.ast;\n while (ast.encoding !== undefined) {\n ast = ast.encoding[ast.encoding.length - 1].to;\n }\n if (!SchemaAST.isObjects(ast) || ast.indexSignatures.length !== 0)\n return path;\n const names = new Set(\n ast.propertySignatures.map((property) => String(property.name)),\n );\n let normalized = \"\";\n let depth = 0;\n let regexStart = -1;\n for (let i = 0; i < path.length; i++) {\n const char = path[i];\n if (depth > 0 || i === regexStart) {\n normalized += char;\n if (char === \"\\\\\") normalized += path[++i] ?? \"\";\n else if (char === \"(\") depth++;\n else if (char === \")\") depth--;\n } else if (char !== \":\") {\n normalized += char;\n } else if (path[i + 1] === \":\") {\n normalized += \"::\";\n i++;\n } else {\n const param = /^:(\\w+)/.exec(path.slice(i));\n if (param !== null && names.has(param[1])) {\n normalized += param[0];\n i += param[0].length - 1;\n const next = path[i + 1];\n if (next === \"(\") regexStart = i + 1;\n else if (next !== undefined && !\"/.-?\".includes(next))\n normalized += \"(.*?)\";\n } else {\n normalized += \"::\";\n }\n }\n }\n return normalized as FindMyWay.PathInput;\n};\n\n// These are necessary until the Convex runtime supports these APIs. See\n// https://discord.com/channels/1019350475847499849/1281364098419785760\n// Each patch is applied only where the API is actually broken, so runtimes\n// with working implementations—Node under convex-test, notably, where\n// `new AbortSignal()` is an illegal constructor—keep their native behavior.\nconst applyMonkeyPatches = () => {\n const urlCredentialsBroken = (() => {\n try {\n return new URL(\"https://confect.dev\").username === undefined;\n } catch {\n return true;\n }\n })();\n if (urlCredentialsBroken) {\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n }\n\n const requestSignalBroken = (() => {\n try {\n return new Request(\"https://confect.dev\").signal === undefined;\n } catch {\n return true;\n }\n })();\n if (requestSignalBroken) {\n // `configurable` so repeated definition—e.g. module re-evaluation in a\n // long-lived environment—does not throw.\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n configurable: true,\n });\n }\n};\n\nexport { withBodyLimit } from \"./internal/httpBody.js\";\n"],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SAAS,MAAM,cAAc,KAAK,EAAE,MAAM;QACzC,IAAI,SAAS,KAAK;QAClB,IAAI,SAAS,KAAK;EACzB,OAAO,IAAI,SAAS,KAClB,cAAc;OACT,IAAI,KAAK,IAAI,OAAO,KAAK;GAC9B,cAAc;GACd;EACF,OAAO;GACL,MAAM,QAAQ,UAAU,KAAK,KAAK,MAAM,CAAC,CAAC;GAC1C,IAAI,UAAU,QAAQ,MAAM,IAAI,MAAM,EAAE,GAAG;IACzC,cAAc,MAAM;IACpB,KAAK,MAAM,EAAE,CAAC,SAAS;IACvB,MAAM,OAAO,KAAK,IAAI;IACtB,IAAI,SAAS,KAAK,aAAa,IAAI;SAC9B,IAAI,SAAS,KAAA,KAAa,CAAC,OAAO,SAAS,IAAI,GAClD,cAAc;GAClB,OACE,cAAc;EAElB;CACF;CACA,OAAO;AACT;AAOA,MAAM,2BAA2B;CAQ/B,WAPoC;EAClC,IAAI;GACF,OAAO,IAAI,IAAI,qBAAqB,CAAC,CAAC,aAAa,KAAA;EACrD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACuB,GACrB,MAAM,cAAc,IAAI;EACtB,IAAa,WAAW;GACtB,OAAO;EACT;EACA,IAAa,WAAW;GACtB,OAAO;EACT;CACF;CAUF,WAPmC;EACjC,IAAI;GACF,OAAO,IAAI,QAAQ,qBAAqB,CAAC,CAAC,WAAW,KAAA;EACvD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACsB,GAGpB,OAAO,eAAe,QAAQ,WAAW,UAAU;EACjD,WAAW,IAAI,YAAY;EAC3B,cAAc;CAChB,CAAC;AAEL"}
@@ -3,8 +3,8 @@ import { Registry } from "./Registry.js";
3
3
  import { TypeId, registryKey } from "./MiddlewareRegistryItem.js";
4
4
  import { setNestedProperty } from "./internal/utils.js";
5
5
  import * as Context from "effect/Context";
6
- import * as Layer from "effect/Layer";
7
6
  import * as Effect from "effect/Effect";
7
+ import * as Layer from "effect/Layer";
8
8
  import * as MiddlewareSpec from "@confect/core/MiddlewareSpec";
9
9
  import * as Ref from "effect/Ref";
10
10
  //#region src/MiddlewareImpl.ts
@@ -0,0 +1,31 @@
1
+ import * as Mount from "@confect/core/Mount";
2
+ /**
3
+ * A mount the push visits: its `init`, if its component declares one, and
4
+ * whether its component lists mounts of its own.
5
+ */
6
+ export interface Entry {
7
+ readonly mount: Mount.Any;
8
+ readonly nested: boolean;
9
+ }
10
+ /**
11
+ * What the push does at one mount, in order. A mount whose callback handles
12
+ * cannot be made ends the list with its failure, so no later mount runs.
13
+ */
14
+ export type Step = {
15
+ readonly componentPath: string;
16
+ readonly nested: boolean;
17
+ readonly init: {
18
+ readonly functionName: string;
19
+ readonly args: unknown;
20
+ } | null;
21
+ } | {
22
+ readonly componentPath: string;
23
+ readonly failure: string;
24
+ };
25
+ /**
26
+ * The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes
27
+ * each mount's callback handles and returns the steps a push runs, in
28
+ * declaration order.
29
+ */
30
+ export declare const mutation: (entries: ReadonlyArray<Entry>) => import("convex/server").RegisteredMutation<"internal", {}, Promise<Step[]>>;
31
+ //# sourceMappingURL=MountInit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MountInit.d.ts","sourceRoot":"","sources":["../src/MountInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAQ7C;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,IAAI,GACZ;IACE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;KACxB,GAAG,IAAI,CAAC;CACV,GACD;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA6BjE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,YAAa,aAAa,CAAC,KAAK,CAAC,gFAelD,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { create } from "./Callback.js";
3
+ import * as Effect from "effect/Effect";
4
+ import { internalMutationGeneric } from "convex/server";
5
+ import * as Option from "effect/Option";
6
+ import * as Cause from "effect/Cause";
7
+ import * as Exit from "effect/Exit";
8
+ import * as Mount from "@confect/core/Mount";
9
+ //#region src/MountInit.ts
10
+ var MountInit_exports = /* @__PURE__ */ __exportAll({ mutation: () => mutation });
11
+ const failure = (cause) => {
12
+ const error = Cause.squash(cause);
13
+ return error instanceof Error ? error.message : String(error);
14
+ };
15
+ const step = (entry) => Mount.initCall(entry.mount, (contract, ref) => create(contract, ref)).pipe(Effect.exit, Effect.map((exit) => Exit.isSuccess(exit) ? {
16
+ componentPath: Mount.data(entry.mount).name,
17
+ nested: entry.nested,
18
+ init: Option.match(exit.value, {
19
+ onNone: () => null,
20
+ onSome: ({ functionName, args }) => ({
21
+ functionName,
22
+ args
23
+ })
24
+ })
25
+ } : {
26
+ componentPath: Mount.data(entry.mount).name,
27
+ failure: failure(exit.cause)
28
+ }));
29
+ /**
30
+ * The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes
31
+ * each mount's callback handles and returns the steps a push runs, in
32
+ * declaration order.
33
+ */
34
+ const mutation = (entries) => internalMutationGeneric({
35
+ args: {},
36
+ handler: () => Effect.runPromise(Effect.gen(function* () {
37
+ const steps = [];
38
+ for (const entry of entries) {
39
+ const next = yield* step(entry);
40
+ steps.push(next);
41
+ if ("failure" in next) break;
42
+ }
43
+ return steps;
44
+ }))
45
+ });
46
+ //#endregion
47
+ export { MountInit_exports, mutation };
48
+
49
+ //# sourceMappingURL=MountInit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MountInit.js","names":["Callback.create"],"sources":["../src/MountInit.ts"],"sourcesContent":["import * as Mount from \"@confect/core/Mount\";\nimport { internalMutationGeneric } from \"convex/server\";\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Option from \"effect/Option\";\nimport * as Callback from \"./Callback.js\";\n\n/**\n * A mount the push visits: its `init`, if its component declares one, and\n * whether its component lists mounts of its own.\n */\nexport interface Entry {\n readonly mount: Mount.Any;\n readonly nested: boolean;\n}\n\n/**\n * What the push does at one mount, in order. A mount whose callback handles\n * cannot be made ends the list with its failure, so no later mount runs.\n */\nexport type Step =\n | {\n readonly componentPath: string;\n readonly nested: boolean;\n readonly init: {\n readonly functionName: string;\n readonly args: unknown;\n } | null;\n }\n | { readonly componentPath: string; readonly failure: string };\n\nconst failure = (cause: Cause.Cause<unknown>) => {\n const error = Cause.squash(cause);\n return error instanceof Error ? error.message : String(error);\n};\n\nconst step = (entry: Entry) =>\n Mount.initCall(entry.mount, (contract, ref) =>\n Callback.create(contract, ref as never),\n ).pipe(\n Effect.exit,\n Effect.map((exit): Step =>\n Exit.isSuccess(exit)\n ? {\n componentPath: Mount.data(entry.mount).name,\n nested: entry.nested,\n init: Option.match(exit.value, {\n onNone: () => null,\n onSome: ({ functionName, args }) => ({ functionName, args }),\n }),\n }\n : {\n componentPath: Mount.data(entry.mount).name,\n failure: failure(exit.cause),\n },\n ),\n );\n\n/**\n * The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes\n * each mount's callback handles and returns the steps a push runs, in\n * declaration order.\n */\nexport const mutation = (entries: ReadonlyArray<Entry>) =>\n internalMutationGeneric({\n args: {},\n handler: () =>\n Effect.runPromise(\n Effect.gen(function* () {\n const steps: Array<Step> = [];\n for (const entry of entries) {\n const next = yield* step(entry);\n steps.push(next);\n if (\"failure\" in next) break;\n }\n return steps;\n }),\n ),\n });\n"],"mappings":";;;;;;;;;;AAgCA,MAAM,WAAW,UAAgC;CAC/C,MAAM,QAAQ,MAAM,OAAO,KAAK;CAChC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;AAEA,MAAM,QAAQ,UACZ,MAAM,SAAS,MAAM,QAAQ,UAAU,QACrCA,OAAgB,UAAU,GAAY,CACxC,CAAC,CAAC,KACA,OAAO,MACP,OAAO,KAAK,SACV,KAAK,UAAU,IAAI,IACf;CACE,eAAe,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC;CACvC,QAAQ,MAAM;CACd,MAAM,OAAO,MAAM,KAAK,OAAO;EAC7B,cAAc;EACd,SAAS,EAAE,cAAc,YAAY;GAAE;GAAc;EAAK;CAC5D,CAAC;AACH,IACA;CACE,eAAe,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC;CACvC,SAAS,QAAQ,KAAK,KAAK;AAC7B,CACN,CACF;;;;;;AAOF,MAAa,YAAY,YACvB,wBAAwB;CACtB,MAAM,CAAC;CACP,eACE,OAAO,WACL,OAAO,IAAI,aAAa;EACtB,MAAM,QAAqB,CAAC;EAC5B,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,OAAO,OAAO,KAAK,KAAK;GAC9B,MAAM,KAAK,IAAI;GACf,IAAI,aAAa,MAAM;EACzB;EACA,OAAO;CACT,CAAC,CACH;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import * as Ref from "@confect/core/Ref";
1
+ import type * as Ref from "@confect/core/Ref";
2
2
  import type { GenericActionCtx } from "convex/server";
3
3
  import * as Context from "effect/Context";
4
4
  import * as Effect from "effect/Effect";
@@ -1 +1 @@
1
- {"version":3,"file":"MutationRunner.d.ts","sourceRoot":"","sources":["../src/MutationRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;A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,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,WACf,OAAO,GAAG,SAAS,GAC3B,MAAM,CAAC,MAAM,CACd,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,WAAW,EACxC,0BAA0B,CAAC,0BAA0B,CACtD;;;;;;;EA+BF,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,UAAU,CAAC;AAE9D,eAAO,MAAM,KAAK,gBAAiB,gBAAgB,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC;;SAjDhD,QAAQ,SAAS,GAAG,CAAC,WAAW,YACzC,QAAQ,WACT,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,GAC5D,MAAM,CAAC,MAAM,CACd,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,WAAW,CACzC;SACoB,QAAQ,SAAS,GAAG,CAAC,WAAW,YACzC,QAAQ,QACZ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,WACf,OAAO,GAAG,SAAS,GAC3B,MAAM,CAAC,MAAM,CACd,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,WAAW,EACxC,0BAA0B,CAAC,0BAA0B,CACtD;;gBAmC+C,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { runWithCodec } from "./internal/reservedArgument.js";
2
3
  import { MutationTransactionContext } from "./MutationTransactionContext.js";
3
4
  import * as Context from "effect/Context";
4
- import * as Layer from "effect/Layer";
5
- import * as Ref from "@confect/core/Ref";
6
5
  import * as Effect from "effect/Effect";
6
+ import * as Layer from "effect/Layer";
7
7
  //#region src/MutationRunner.ts
8
8
  var MutationRunner_exports = /* @__PURE__ */ __exportAll({
9
9
  MutationRunner: () => MutationRunner,
@@ -15,7 +15,7 @@ const make = (nativeRunMutation) => {
15
15
  return run(Effect.gen(function* () {
16
16
  const actualArgs = args ?? {};
17
17
  if (options !== void 0) return yield* (yield* MutationTransactionContext).runMutation(mutation, actualArgs, options);
18
- return yield* Ref.runWithCodec(mutation, actualArgs, (ref, encodedArgs) => nativeRunMutation(ref, encodedArgs));
18
+ return yield* runWithCodec(mutation, actualArgs, (ref, encodedArgs) => nativeRunMutation(ref, encodedArgs));
19
19
  }));
20
20
  }
21
21
  return { runMutation };
@@ -1 +1 @@
1
- {"version":3,"file":"MutationRunner.js","names":["MutationTransactionContext.MutationTransactionContext"],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport type { GenericActionCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport type * as Schema from \"effect/Schema\";\nimport * as MutationTransactionContext from \"./MutationTransactionContext.js\";\n\nexport type Options = MutationTransactionContext.MutationOptions;\n\nconst run = Effect.fn(\"MutationRunner.runMutation\")(\n <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> => effect,\n);\n\nconst make = (nativeRunMutation: GenericActionCtx<any>[\"runMutation\"]) => {\n function runMutation<Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: [...Ref.OptionalArgs<Mutation>, options?: undefined]\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | Schema.SchemaError\n >;\n function runMutation<Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n args: Ref.Args<Mutation>,\n options: Options | undefined,\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | Schema.SchemaError,\n MutationTransactionContext.MutationTransactionContext\n >;\n function runMutation<Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n args?: Ref.Args<Mutation>,\n options?: Options,\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | Schema.SchemaError,\n MutationTransactionContext.MutationTransactionContext\n > {\n return run(\n Effect.gen(function* () {\n const actualArgs = (args ?? {}) as Ref.Args<Mutation>;\n if (options !== undefined) {\n const controls =\n yield* MutationTransactionContext.MutationTransactionContext;\n return yield* controls.runMutation(mutation, actualArgs, options);\n }\n return yield* Ref.runWithCodec(\n mutation,\n actualArgs,\n (ref, encodedArgs) => nativeRunMutation(ref, encodedArgs),\n );\n }),\n );\n }\n return { runMutation };\n};\n\nexport const MutationRunner = Context.Service<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericActionCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,MAAM,OAAO,GAAG,4BAA4B,CAAC,EACvC,WAA2D,MACvE;AAEA,MAAM,QAAQ,sBAA4D;CAiBxE,SAAS,YACP,UACA,MACA,SAKA;EACA,OAAO,IACL,OAAO,IAAI,aAAa;GACtB,MAAM,aAAc,QAAQ,CAAC;GAC7B,IAAI,YAAY,KAAA,GAGd,OAAO,QAAO,OADLA,2BAAAA,CACc,YAAY,UAAU,YAAY,OAAO;GAElE,OAAO,OAAO,IAAI,aAChB,UACA,aACC,KAAK,gBAAgB,kBAAkB,KAAK,WAAW,CAC1D;EACF,CAAC,CACH;CACF;CACA,OAAO,EAAE,YAAY;AACvB;AAEA,MAAa,iBAAiB,QAAQ,QACpC,gCACF;AAGA,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,WAAW,CAAC"}
1
+ {"version":3,"file":"MutationRunner.js","names":["MutationTransactionContext.MutationTransactionContext","ReservedArgument.runWithCodec"],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as ReservedArgument from \"./internal/reservedArgument.js\";\nimport type * as Ref from \"@confect/core/Ref\";\nimport type { GenericActionCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport type * as Schema from \"effect/Schema\";\nimport * as MutationTransactionContext from \"./MutationTransactionContext.js\";\n\nexport type Options = MutationTransactionContext.MutationOptions;\n\nconst run = Effect.fn(\"MutationRunner.runMutation\")(\n <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> => effect,\n);\n\nconst make = (nativeRunMutation: GenericActionCtx<any>[\"runMutation\"]) => {\n function runMutation<Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: [...Ref.OptionalArgs<Mutation>, options?: undefined]\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | Schema.SchemaError\n >;\n function runMutation<Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n args: Ref.Args<Mutation>,\n options: Options | undefined,\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | Schema.SchemaError,\n MutationTransactionContext.MutationTransactionContext\n >;\n function runMutation<Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n args?: Ref.Args<Mutation>,\n options?: Options,\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | Schema.SchemaError,\n MutationTransactionContext.MutationTransactionContext\n > {\n return run(\n Effect.gen(function* () {\n const actualArgs = (args ?? {}) as Ref.Args<Mutation>;\n if (options !== undefined) {\n const controls =\n yield* MutationTransactionContext.MutationTransactionContext;\n return yield* controls.runMutation(mutation, actualArgs, options);\n }\n return yield* ReservedArgument.runWithCodec(\n mutation,\n actualArgs,\n (ref, encodedArgs) => nativeRunMutation(ref, encodedArgs),\n );\n }),\n );\n }\n return { runMutation };\n};\n\nexport const MutationRunner = Context.Service<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericActionCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,MAAM,OAAO,GAAG,4BAA4B,CAAC,EACvC,WAA2D,MACvE;AAEA,MAAM,QAAQ,sBAA4D;CAiBxE,SAAS,YACP,UACA,MACA,SAKA;EACA,OAAO,IACL,OAAO,IAAI,aAAa;GACtB,MAAM,aAAc,QAAQ,CAAC;GAC7B,IAAI,YAAY,KAAA,GAGd,OAAO,QAAO,OADLA,2BAAAA,CACc,YAAY,UAAU,YAAY,OAAO;GAElE,OAAO,OAAOC,aACZ,UACA,aACC,KAAK,gBAAgB,kBAAkB,KAAK,WAAW,CAC1D;EACF,CAAC,CACH;CACF;CACA,OAAO,EAAE,YAAY;AACvB;AAEA,MAAa,iBAAiB,QAAQ,QACpC,gCACF;AAGA,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MutationTransactionContext.d.ts","sourceRoot":"","sources":["../src/MutationTransactionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAC;;eAM9C,KAAK,SAAS,GAAG,CAAC,QAAQ;kBAU1B,QAAQ,SAAS,GAAG,CAAC,WAAW;;AAWrC,qBAAa,0BAA2B,SAAQ,+BAGC;CAAG;AAEpD,eAAO,MAAM,KAAK,QACX,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,0DACpB,CAAC"}
1
+ {"version":3,"file":"MutationTransactionContext.d.ts","sourceRoot":"","sources":["../src/MutationTransactionContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAC;;eAM9C,KAAK,SAAS,GAAG,CAAC,QAAQ;kBAU1B,QAAQ,SAAS,GAAG,CAAC,WAAW;;AAWrC,qBAAa,0BAA2B,SAAQ,+BAGC;CAAG;AAEpD,eAAO,MAAM,KAAK,QACX,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,0DACpB,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import * as Context from "effect/Context";
3
- import * as Layer from "effect/Layer";
2
+ import { runWithCodec } from "./internal/reservedArgument.js";
4
3
  import * as Ref from "@confect/core/Ref";
4
+ import * as Context from "effect/Context";
5
5
  import * as Effect from "effect/Effect";
6
+ import * as Layer from "effect/Layer";
6
7
  //#region src/MutationTransactionContext.ts
7
8
  var MutationTransactionContext_exports = /* @__PURE__ */ __exportAll({
8
9
  MutationTransactionContext: () => MutationTransactionContext,
@@ -10,7 +11,7 @@ var MutationTransactionContext_exports = /* @__PURE__ */ __exportAll({
10
11
  });
11
12
  const make = (ctx) => ({
12
13
  runQuery: Effect.fn("MutationTransactionContext.runQuery")((query, args, options) => Ref.runWithCodec(query, args, (ref, encodedArgs) => ctx.runQuery(ref, encodedArgs, options))),
13
- runMutation: Effect.fn("MutationTransactionContext.runMutation")((mutation, args, options) => Ref.runWithCodec(mutation, args, (ref, encodedArgs) => ctx.runMutation(ref, encodedArgs, options)))
14
+ runMutation: Effect.fn("MutationTransactionContext.runMutation")((mutation, args, options) => runWithCodec(mutation, args, (ref, encodedArgs) => ctx.runMutation(ref, encodedArgs, options)))
14
15
  });
15
16
  var MutationTransactionContext = class extends Context.Service()("@confect/server/MutationTransactionContext") {};
16
17
  const layer = (ctx) => Layer.succeed(MutationTransactionContext, make(ctx));
@@ -1 +1 @@
1
- {"version":3,"file":"MutationTransactionContext.js","names":[],"sources":["../src/MutationTransactionContext.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport type {\n AdvancedRunQueryOptions,\n GenericDataModel,\n GenericMutationCtx,\n} from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport type { Options as MutationOptions } from \"./QueryTransactionContext.js\";\n\nexport type { TransactionLimits } from \"convex/server\";\nexport type { Options as MutationOptions } from \"./QueryTransactionContext.js\";\nexport type QueryOptions = AdvancedRunQueryOptions;\n\nconst make = (\n ctx: Pick<GenericMutationCtx<GenericDataModel>, \"runQuery\" | \"runMutation\">,\n) => ({\n runQuery: Effect.fn(\"MutationTransactionContext.runQuery\")(\n <Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options: QueryOptions,\n ) =>\n Ref.runWithCodec(query, args, (ref, encodedArgs) =>\n ctx.runQuery(ref, encodedArgs, options),\n ),\n ),\n runMutation: Effect.fn(\"MutationTransactionContext.runMutation\")(\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n args: Ref.Args<Mutation>,\n options: MutationOptions,\n ) =>\n Ref.runWithCodec(mutation, args, (ref, encodedArgs) =>\n ctx.runMutation(ref, encodedArgs, options),\n ),\n ),\n});\n\nexport class MutationTransactionContext extends Context.Service<\n MutationTransactionContext,\n ReturnType<typeof make>\n>()(\"@confect/server/MutationTransactionContext\") {}\n\nexport const layer = (\n ctx: Pick<GenericMutationCtx<GenericDataModel>, \"runQuery\" | \"runMutation\">,\n) => Layer.succeed(MutationTransactionContext, make(ctx));\n"],"mappings":";;;;;;;;;;AAeA,MAAM,QACJ,SACI;CACJ,UAAU,OAAO,GAAG,qCAAqC,CAAC,EAEtD,OACA,MACA,YAEA,IAAI,aAAa,OAAO,OAAO,KAAK,gBAClC,IAAI,SAAS,KAAK,aAAa,OAAO,CACxC,CACJ;CACA,aAAa,OAAO,GAAG,wCAAwC,CAAC,EAE5D,UACA,MACA,YAEA,IAAI,aAAa,UAAU,OAAO,KAAK,gBACrC,IAAI,YAAY,KAAK,aAAa,OAAO,CAC3C,CACJ;AACF;AAEA,IAAa,6BAAb,cAAgD,QAAQ,QAGtD,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC;AAEnD,MAAa,SACX,QACG,MAAM,QAAQ,4BAA4B,KAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"MutationTransactionContext.js","names":["ReservedArgument.runWithCodec"],"sources":["../src/MutationTransactionContext.ts"],"sourcesContent":["import * as ReservedArgument from \"./internal/reservedArgument.js\";\nimport * as Ref from \"@confect/core/Ref\";\nimport type {\n AdvancedRunQueryOptions,\n GenericDataModel,\n GenericMutationCtx,\n} from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport type { Options as MutationOptions } from \"./QueryTransactionContext.js\";\n\nexport type { TransactionLimits } from \"convex/server\";\nexport type { Options as MutationOptions } from \"./QueryTransactionContext.js\";\nexport type QueryOptions = AdvancedRunQueryOptions;\n\nconst make = (\n ctx: Pick<GenericMutationCtx<GenericDataModel>, \"runQuery\" | \"runMutation\">,\n) => ({\n runQuery: Effect.fn(\"MutationTransactionContext.runQuery\")(\n <Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options: QueryOptions,\n ) =>\n Ref.runWithCodec(query, args, (ref, encodedArgs) =>\n ctx.runQuery(ref, encodedArgs, options),\n ),\n ),\n runMutation: Effect.fn(\"MutationTransactionContext.runMutation\")(\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n args: Ref.Args<Mutation>,\n options: MutationOptions,\n ) =>\n ReservedArgument.runWithCodec(mutation, args, (ref, encodedArgs) =>\n ctx.runMutation(ref, encodedArgs, options),\n ),\n ),\n});\n\nexport class MutationTransactionContext extends Context.Service<\n MutationTransactionContext,\n ReturnType<typeof make>\n>()(\"@confect/server/MutationTransactionContext\") {}\n\nexport const layer = (\n ctx: Pick<GenericMutationCtx<GenericDataModel>, \"runQuery\" | \"runMutation\">,\n) => Layer.succeed(MutationTransactionContext, make(ctx));\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,QACJ,SACI;CACJ,UAAU,OAAO,GAAG,qCAAqC,CAAC,EAEtD,OACA,MACA,YAEA,IAAI,aAAa,OAAO,OAAO,KAAK,gBAClC,IAAI,SAAS,KAAK,aAAa,OAAO,CACxC,CACJ;CACA,aAAa,OAAO,GAAG,wCAAwC,CAAC,EAE5D,UACA,MACA,YAEAA,aAA8B,UAAU,OAAO,KAAK,gBAClD,IAAI,YAAY,KAAK,aAAa,OAAO,CAC3C,CACJ;AACF;AAEA,IAAa,6BAAb,cAAgD,QAAQ,QAGtD,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC;AAEnD,MAAa,SACX,QACG,MAAM,QAAQ,4BAA4B,KAAK,GAAG,CAAC"}