@gaganref/confect-server 10.3.1-fork.3 → 10.3.1-fork.31

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 (273) 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/ActionCtx.d.ts +1 -1
  6. package/dist/ActionCtx.d.ts.map +1 -1
  7. package/dist/ActionCtx.js.map +1 -1
  8. package/dist/ActionRunner.js +2 -2
  9. package/dist/AiGatewayDecisionClient.d.ts +2 -2
  10. package/dist/AiGatewayDecisionClient.d.ts.map +1 -1
  11. package/dist/AiGatewayDecisionClient.js +1 -1
  12. package/dist/AiGatewayDecisionClient.js.map +1 -1
  13. package/dist/AiGatewayLanguageClient.d.ts +2 -2
  14. package/dist/AiGatewayLanguageClient.d.ts.map +1 -1
  15. package/dist/AiGatewayLanguageClient.js +1 -1
  16. package/dist/AiGatewayLanguageClient.js.map +1 -1
  17. package/dist/Auth.d.ts +1 -1
  18. package/dist/Auth.d.ts.map +1 -1
  19. package/dist/Auth.js +1 -1
  20. package/dist/Auth.js.map +1 -1
  21. package/dist/Callback.js +3 -3
  22. package/dist/ComponentCtx.d.ts +1 -1
  23. package/dist/ComponentCtx.d.ts.map +1 -1
  24. package/dist/ConvexConfigProvider.js +2 -2
  25. package/dist/ConvexFunctionDefinitions.d.ts +4 -4
  26. package/dist/ConvexFunctionDefinitions.d.ts.map +1 -1
  27. package/dist/ConvexFunctionDefinitions.js +2 -2
  28. package/dist/ConvexFunctionDefinitions.js.map +1 -1
  29. package/dist/ConvexLogger.js +1 -1
  30. package/dist/CronJobs.d.ts +1 -1
  31. package/dist/CronJobs.d.ts.map +1 -1
  32. package/dist/CronJobs.js +6 -6
  33. package/dist/CronJobs.js.map +1 -1
  34. package/dist/DataModel.d.ts +3 -3
  35. package/dist/DataModel.d.ts.map +1 -1
  36. package/dist/DataModel.js.map +1 -1
  37. package/dist/DatabaseReader.d.ts +4 -4
  38. package/dist/DatabaseReader.d.ts.map +1 -1
  39. package/dist/DatabaseReader.js.map +1 -1
  40. package/dist/DatabaseSchema.d.ts +1 -1
  41. package/dist/DatabaseSchema.d.ts.map +1 -1
  42. package/dist/DatabaseSchema.js +2 -2
  43. package/dist/DatabaseSchema.js.map +1 -1
  44. package/dist/DatabaseWriter.d.ts +41 -7
  45. package/dist/DatabaseWriter.d.ts.map +1 -1
  46. package/dist/DatabaseWriter.js +55 -8
  47. package/dist/DatabaseWriter.js.map +1 -1
  48. package/dist/Document.d.ts +4 -4
  49. package/dist/Document.d.ts.map +1 -1
  50. package/dist/Document.js.map +1 -1
  51. package/dist/ExecutionMetadata.js +1 -1
  52. package/dist/FunctionImpl.d.ts +2 -2
  53. package/dist/FunctionImpl.d.ts.map +1 -1
  54. package/dist/FunctionImpl.js +2 -2
  55. package/dist/FunctionImpl.js.map +1 -1
  56. package/dist/FunctionRegistryItem.d.ts +1 -1
  57. package/dist/FunctionRegistryItem.d.ts.map +1 -1
  58. package/dist/FunctionRegistryItem.js +1 -1
  59. package/dist/FunctionRegistryItem.js.map +1 -1
  60. package/dist/GroupImpl.d.ts +24 -5
  61. package/dist/GroupImpl.d.ts.map +1 -1
  62. package/dist/GroupImpl.js +21 -22
  63. package/dist/GroupImpl.js.map +1 -1
  64. package/dist/GroupRegistry.d.ts +2 -2
  65. package/dist/GroupRegistry.d.ts.map +1 -1
  66. package/dist/GroupRegistry.js.map +1 -1
  67. package/dist/Handler.d.ts +30 -26
  68. package/dist/Handler.d.ts.map +1 -1
  69. package/dist/Handler.js.map +1 -1
  70. package/dist/HttpRouter.d.ts +13 -13
  71. package/dist/HttpRouter.d.ts.map +1 -1
  72. package/dist/HttpRouter.js +2 -2
  73. package/dist/HttpRouter.js.map +1 -1
  74. package/dist/MiddlewareImpl.d.ts +14 -14
  75. package/dist/MiddlewareImpl.d.ts.map +1 -1
  76. package/dist/MiddlewareImpl.js +1 -1
  77. package/dist/MiddlewareImpl.js.map +1 -1
  78. package/dist/MutationCtx.d.ts +1 -1
  79. package/dist/MutationCtx.d.ts.map +1 -1
  80. package/dist/MutationCtx.js.map +1 -1
  81. package/dist/MutationRunner.d.ts +1 -1
  82. package/dist/MutationRunner.d.ts.map +1 -1
  83. package/dist/MutationRunner.js +2 -2
  84. package/dist/MutationRunner.js.map +1 -1
  85. package/dist/MutationTransactionContext.d.ts +2 -2
  86. package/dist/MutationTransactionContext.d.ts.map +1 -1
  87. package/dist/MutationTransactionContext.js +2 -2
  88. package/dist/MutationTransactionContext.js.map +1 -1
  89. package/dist/OfficialComponent.d.ts +50 -0
  90. package/dist/OfficialComponent.d.ts.map +1 -0
  91. package/dist/OfficialComponent.js +70 -0
  92. package/dist/OfficialComponent.js.map +1 -0
  93. package/dist/OrderedQuery.d.ts +4 -4
  94. package/dist/OrderedQuery.d.ts.map +1 -1
  95. package/dist/OrderedQuery.js.map +1 -1
  96. package/dist/QueryCtx.d.ts +1 -1
  97. package/dist/QueryCtx.d.ts.map +1 -1
  98. package/dist/QueryCtx.js.map +1 -1
  99. package/dist/QueryInitializer.d.ts +10 -10
  100. package/dist/QueryInitializer.d.ts.map +1 -1
  101. package/dist/QueryInitializer.js +2 -2
  102. package/dist/QueryInitializer.js.map +1 -1
  103. package/dist/QueryRunner.d.ts +2 -2
  104. package/dist/QueryRunner.d.ts.map +1 -1
  105. package/dist/QueryRunner.js +2 -2
  106. package/dist/QueryRunner.js.map +1 -1
  107. package/dist/QueryStream.d.ts +131 -23
  108. package/dist/QueryStream.d.ts.map +1 -1
  109. package/dist/QueryStream.js +142 -40
  110. package/dist/QueryStream.js.map +1 -1
  111. package/dist/QueryStreamCursor.d.ts +2 -2
  112. package/dist/QueryStreamCursor.d.ts.map +1 -1
  113. package/dist/QueryStreamCursor.js +1 -1
  114. package/dist/QueryStreamCursor.js.map +1 -1
  115. package/dist/QueryStreamIndexPrefix.d.ts +2 -2
  116. package/dist/QueryStreamIndexPrefix.d.ts.map +1 -1
  117. package/dist/QueryStreamIndexPrefix.js +1 -1
  118. package/dist/QueryStreamIndexPrefix.js.map +1 -1
  119. package/dist/QueryStreamIndexRange.d.ts +4 -4
  120. package/dist/QueryStreamIndexRange.d.ts.map +1 -1
  121. package/dist/QueryStreamIndexRange.js +2 -2
  122. package/dist/QueryStreamIndexRange.js.map +1 -1
  123. package/dist/QueryStreamKey.d.ts +2 -2
  124. package/dist/QueryStreamKey.d.ts.map +1 -1
  125. package/dist/QueryStreamKey.js +1 -1
  126. package/dist/QueryStreamKey.js.map +1 -1
  127. package/dist/QueryStreamKeyBounds.d.ts +3 -3
  128. package/dist/QueryStreamKeyBounds.d.ts.map +1 -1
  129. package/dist/QueryStreamKeyBounds.js +2 -2
  130. package/dist/QueryStreamKeyBounds.js.map +1 -1
  131. package/dist/QueryStreamKeyLayout.d.ts +1 -1
  132. package/dist/QueryStreamKeyLayout.d.ts.map +1 -1
  133. package/dist/QueryStreamKeyLayout.js +2 -2
  134. package/dist/QueryStreamKeyLayout.js.map +1 -1
  135. package/dist/QueryStreamKeyValues.d.ts +1 -1
  136. package/dist/QueryStreamKeyValues.d.ts.map +1 -1
  137. package/dist/QueryStreamKeyValues.js +1 -1
  138. package/dist/QueryStreamKeyValues.js.map +1 -1
  139. package/dist/QueryStreamPagination.d.ts +1 -1
  140. package/dist/QueryStreamPagination.d.ts.map +1 -1
  141. package/dist/QueryStreamPagination.js +1 -1
  142. package/dist/QueryStreamPagination.js.map +1 -1
  143. package/dist/QueryStreamReadBudget.d.ts +3 -2
  144. package/dist/QueryStreamReadBudget.d.ts.map +1 -1
  145. package/dist/QueryStreamReadBudget.js +6 -3
  146. package/dist/QueryStreamReadBudget.js.map +1 -1
  147. package/dist/QueryTransactionContext.js +2 -2
  148. package/dist/RegisteredConvexFunction.d.ts +20 -20
  149. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  150. package/dist/RegisteredConvexFunction.js +19 -19
  151. package/dist/RegisteredConvexFunction.js.map +1 -1
  152. package/dist/RegisteredFunction.d.ts +26 -26
  153. package/dist/RegisteredFunction.d.ts.map +1 -1
  154. package/dist/RegisteredFunction.js +55 -13
  155. package/dist/RegisteredFunction.js.map +1 -1
  156. package/dist/RegisteredFunctions.d.ts +3 -3
  157. package/dist/RegisteredFunctions.d.ts.map +1 -1
  158. package/dist/RegisteredFunctions.js.map +1 -1
  159. package/dist/RegisteredNodeFunction.d.ts +6 -6
  160. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  161. package/dist/RegisteredNodeFunction.js +1 -1
  162. package/dist/RegisteredNodeFunction.js.map +1 -1
  163. package/dist/Registry.d.ts +1 -1
  164. package/dist/Registry.d.ts.map +1 -1
  165. package/dist/Registry.js.map +1 -1
  166. package/dist/RegistryItems.d.ts +7 -0
  167. package/dist/RegistryItems.d.ts.map +1 -1
  168. package/dist/RegistryItems.js +8 -3
  169. package/dist/RegistryItems.js.map +1 -1
  170. package/dist/RequestMetadata.js +1 -1
  171. package/dist/ResolvedMiddleware.d.ts +2 -2
  172. package/dist/ResolvedMiddleware.d.ts.map +1 -1
  173. package/dist/ResolvedMiddleware.js.map +1 -1
  174. package/dist/Scheduler.js +2 -2
  175. package/dist/Storage.d.ts +6 -6
  176. package/dist/Storage.d.ts.map +1 -1
  177. package/dist/Storage.js +1 -1
  178. package/dist/Storage.js.map +1 -1
  179. package/dist/StorageActionWriter.d.ts +1 -1
  180. package/dist/StorageActionWriter.d.ts.map +1 -1
  181. package/dist/StorageActionWriter.js +1 -1
  182. package/dist/StorageActionWriter.js.map +1 -1
  183. package/dist/StorageReader.d.ts +1 -1
  184. package/dist/StorageReader.d.ts.map +1 -1
  185. package/dist/StorageReader.js +1 -1
  186. package/dist/StorageReader.js.map +1 -1
  187. package/dist/StorageWriter.d.ts +1 -1
  188. package/dist/StorageWriter.d.ts.map +1 -1
  189. package/dist/StorageWriter.js +1 -1
  190. package/dist/StorageWriter.js.map +1 -1
  191. package/dist/TableInfo.d.ts +2 -2
  192. package/dist/TableInfo.d.ts.map +1 -1
  193. package/dist/TableInfo.js.map +1 -1
  194. package/dist/TransactionMetadata.js +1 -1
  195. package/dist/VectorSearch.d.ts +1 -1
  196. package/dist/VectorSearch.d.ts.map +1 -1
  197. package/dist/VectorSearch.js +1 -1
  198. package/dist/VectorSearch.js.map +1 -1
  199. package/dist/index.d.ts +62 -60
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/index.js +11 -9
  202. package/dist/internal/AiGatewayDecisionClient.d.ts +1 -1
  203. package/dist/internal/AiGatewayDecisionClient.d.ts.map +1 -1
  204. package/dist/internal/AiGatewayDecisionClient.js +1 -1
  205. package/dist/internal/AiGatewayDecisionClient.js.map +1 -1
  206. package/dist/internal/AiGatewayLanguageClient.d.ts +1 -1
  207. package/dist/internal/AiGatewayLanguageClient.d.ts.map +1 -1
  208. package/dist/internal/AiGatewayLanguageClient.js +1 -1
  209. package/dist/internal/AiGatewayLanguageClient.js.map +1 -1
  210. package/dist/internal/AiGatewayServiceToken.js +1 -1
  211. package/dist/internal/DocumentPatch.d.ts +16 -0
  212. package/dist/internal/DocumentPatch.d.ts.map +1 -0
  213. package/dist/internal/DocumentPatch.js +36 -0
  214. package/dist/internal/DocumentPatch.js.map +1 -0
  215. package/dist/node.d.ts +1 -1
  216. package/dist/node.d.ts.map +1 -1
  217. package/package.json +2 -2
  218. package/src/ActionCall.ts +82 -0
  219. package/src/ActionCtx.ts +1 -1
  220. package/src/AiGatewayDecisionClient.ts +3 -3
  221. package/src/AiGatewayLanguageClient.ts +3 -3
  222. package/src/Auth.ts +1 -1
  223. package/src/ComponentCtx.ts +1 -1
  224. package/src/ConvexFunctionDefinitions.ts +8 -8
  225. package/src/CronJobs.ts +1 -1
  226. package/src/DataModel.ts +3 -3
  227. package/src/DatabaseReader.ts +4 -4
  228. package/src/DatabaseSchema.ts +1 -1
  229. package/src/DatabaseWriter.ts +189 -31
  230. package/src/Document.ts +4 -4
  231. package/src/FunctionImpl.ts +5 -5
  232. package/src/FunctionRegistryItem.ts +1 -1
  233. package/src/GroupImpl.ts +66 -13
  234. package/src/GroupRegistry.ts +4 -4
  235. package/src/Handler.ts +43 -28
  236. package/src/HttpRouter.ts +17 -17
  237. package/src/MiddlewareImpl.ts +17 -17
  238. package/src/MutationCtx.ts +1 -1
  239. package/src/MutationRunner.ts +1 -1
  240. package/src/MutationTransactionContext.ts +2 -2
  241. package/src/OfficialComponent.ts +151 -0
  242. package/src/OrderedQuery.ts +4 -4
  243. package/src/QueryCtx.ts +1 -1
  244. package/src/QueryInitializer.ts +9 -9
  245. package/src/QueryRunner.ts +2 -2
  246. package/src/QueryStream.ts +406 -76
  247. package/src/QueryStreamCursor.ts +3 -3
  248. package/src/QueryStreamIndexPrefix.ts +2 -2
  249. package/src/QueryStreamIndexRange.ts +4 -4
  250. package/src/QueryStreamKey.ts +2 -2
  251. package/src/QueryStreamKeyBounds.ts +3 -3
  252. package/src/QueryStreamKeyLayout.ts +1 -1
  253. package/src/QueryStreamKeyValues.ts +1 -1
  254. package/src/QueryStreamPagination.ts +2 -2
  255. package/src/QueryStreamReadBudget.ts +19 -6
  256. package/src/RegisteredConvexFunction.ts +21 -21
  257. package/src/RegisteredFunction.ts +72 -19
  258. package/src/RegisteredFunctions.ts +4 -4
  259. package/src/RegisteredNodeFunction.ts +8 -8
  260. package/src/Registry.ts +1 -1
  261. package/src/RegistryItems.ts +33 -2
  262. package/src/ResolvedMiddleware.ts +2 -2
  263. package/src/Storage.ts +3 -3
  264. package/src/StorageActionWriter.ts +1 -1
  265. package/src/StorageReader.ts +1 -1
  266. package/src/StorageWriter.ts +1 -1
  267. package/src/TableInfo.ts +2 -2
  268. package/src/VectorSearch.ts +1 -1
  269. package/src/index.ts +62 -60
  270. package/src/internal/AiGatewayDecisionClient.ts +2 -2
  271. package/src/internal/AiGatewayLanguageClient.ts +2 -2
  272. package/src/internal/DocumentPatch.ts +87 -0
  273. package/src/node.ts +1 -1
package/dist/GroupImpl.js CHANGED
@@ -1,16 +1,18 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { Registry } from "./Registry.js";
3
- import { functionNames, middlewareKeys } from "./RegistryItems.js";
3
+ import { functionNames, middlewareKeys, missingRequired } from "./RegistryItems.js";
4
4
  import * as Context from "effect/Context";
5
- import * as Layer from "effect/Layer";
5
+ import * as Data from "effect/Data";
6
6
  import * as Effect from "effect/Effect";
7
- import * as Option from "effect/Option";
8
- import * as Array from "effect/Array";
9
- import * as Predicate from "effect/Predicate";
7
+ import * as Layer from "effect/Layer";
10
8
  import * as Ref from "effect/Ref";
9
+ import * as Predicate from "effect/Predicate";
10
+ import * as Array from "effect/Array";
11
+ import * as Option from "effect/Option";
11
12
  //#region src/GroupImpl.ts
12
13
  var GroupImpl_exports = /* @__PURE__ */ __exportAll({
13
14
  GroupImpl: () => GroupImpl,
15
+ MissingRequiredMiddlewareError: () => MissingRequiredMiddlewareError,
14
16
  TypeId: () => TypeId,
15
17
  finalize: () => finalize,
16
18
  isFinalizedGroupImpl: () => isFinalizedGroupImpl,
@@ -48,25 +50,22 @@ const make = (_databaseSchema, _group) => Layer.succeed(GroupImpl({ finalization
48
50
  registeredFunctionNames: [],
49
51
  registeredMiddlewareKeys: []
50
52
  });
51
- const findUnfinalizedGroupImpl = (context) => Array.findFirst(context.mapUnsafe.values(), isUnfinalizedGroupImpl);
52
- /**
53
- * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults
54
- * `RIn = never`, so passing a layer that still requires any `FunctionImpl`
55
- * service produces a type error at the impl author's site. The codegen boundary
56
- * requires the resulting `"Finalized"` brand, so omitting this call is also
57
- * rejected downstream.
58
- *
59
- * As a side effect of finalization, the names of every `FunctionImpl` that
60
- * registered into this group's scope are snapshotted onto the produced service
61
- * value's `registeredFunctionNames` field, so consumers can verify impl
62
- * completeness against a `GroupSpec`'s expected functions without having to
63
- * inspect the `Registry` themselves.
64
- */
65
- const finalize = (group) => Layer.flatMap(group, (context) => findUnfinalizedGroupImpl(context).pipe(Option.match({
66
- onNone: () => Layer.effect(GroupImpl({ finalizationStatus: "Finalized" }), Effect.die(/* @__PURE__ */ new Error("GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context."))),
53
+ const findGroupImpl = (context) => Array.findFirst(context.mapUnsafe.values(), isGroupImpl);
54
+ var MissingRequiredMiddlewareError = class extends Data.TaggedError("MissingRequiredMiddlewareError") {
55
+ get message() {
56
+ return `GroupImpl.finalize: ${this.missing.map(({ functionName, middlewareKey }) => `${functionName} requires middleware "${middlewareKey}"`).join("\n")}`;
57
+ }
58
+ };
59
+ function finalize(input) {
60
+ return "required" in input ? (group) => finalizeWith(group, input.required, input.groupPath) : finalizeWith(input, []);
61
+ }
62
+ const finalizeWith = (group, required, groupPath = "") => Layer.flatMap(group, (context) => findGroupImpl(context).pipe(Option.match({
63
+ onNone: () => Layer.effect(GroupImpl({ finalizationStatus: "Finalized" }), Effect.die(/* @__PURE__ */ new Error("GroupImpl.finalize: no GroupImpl service was found in the layer's context."))),
67
64
  onSome: () => Layer.effect(GroupImpl({ finalizationStatus: "Finalized" }), Effect.gen(function* () {
68
65
  const registry = yield* Registry;
69
66
  const items = yield* Ref.get(registry);
67
+ const missing = missingRequired(items, required, groupPath);
68
+ if (missing.length > 0) return yield* Effect.die(new MissingRequiredMiddlewareError({ missing }));
70
69
  return {
71
70
  [TypeId]: TypeId,
72
71
  finalizationStatus: "Finalized",
@@ -76,6 +75,6 @@ const finalize = (group) => Layer.flatMap(group, (context) => findUnfinalizedGro
76
75
  }))
77
76
  })));
78
77
  //#endregion
79
- export { GroupImpl, GroupImpl_exports, TypeId, finalize, isFinalizedGroupImpl, isGroupImpl, isUnfinalizedGroupImpl, make };
78
+ export { GroupImpl, GroupImpl_exports, MissingRequiredMiddlewareError, TypeId, finalize, isFinalizedGroupImpl, isGroupImpl, isUnfinalizedGroupImpl, make };
80
79
 
81
80
  //# sourceMappingURL=GroupImpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupImpl.js","names":["Registry.Registry","RegistryItems.functionNames","RegistryItems.middlewareKeys"],"sources":["../src/GroupImpl.ts"],"sourcesContent":["import type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as MiddlewareSpec from \"@confect/core/MiddlewareSpec\";\nimport * as Registry from \"./Registry\";\nimport * as RegistryItems from \"./RegistryItems\";\nimport * as Array from \"effect/Array\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as FunctionImpl from \"./FunctionImpl\";\nimport type * as MiddlewareImpl from \"./MiddlewareImpl\";\n\nexport const TypeId = \"~@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\n readonly finalizationStatus: FinalizationStatus_;\n /**\n * Names of every function registered into this group's layer scope by\n * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is\n * `\"Finalized\"`; the `\"Unfinalized\"` value is set to `[]` at `make`-time\n * since the list is only known once `finalize` snapshots the registry.\n */\n readonly registeredFunctionNames: ReadonlyArray<string>;\n /**\n * Keys of every middleware whose implementation registered into this group's\n * layer scope via `MiddlewareImpl.make` (and friends). Same authoritativeness\n * caveat as `registeredFunctionNames`. Lets consumers (the CLI's\n * `validateImpl`) verify middleware-impl completeness against a `GroupSpec`'s\n * attached middleware without inspecting the `Registry`.\n */\n readonly registeredMiddlewareKeys: ReadonlyArray<string>;\n}\n\nexport interface Any extends GroupImpl<FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<\"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<\"Unfinalized\"> {}\n\nexport const isFinalizedGroupImpl = (u: unknown): u is AnyFinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Finalized\";\n\nexport const isUnfinalizedGroupImpl = (u: unknown): u is AnyUnfinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Unfinalized\";\n\n/**\n * Build the runtime tag for a `GroupImpl` service. The finalization status is\n * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct\n * services at runtime; consumers of a finalized layer (the server's\n * `RegisteredFunctions.buildForGroup` and the CLI's `validateImpl`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n *\n * The tag is keyed only by finalization status—no group path—because each\n * group's impl layer is built in its own isolated scope\n * (`buildForGroup`/`validateImpl` each provide a fresh `Registry`), so at most\n * one `GroupImpl` service of each status exists per build.\n */\nexport const GroupImpl = <FinalizationStatus_ extends FinalizationStatus>({\n finalizationStatus,\n}: {\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.Service<GroupImpl<FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}`,\n );\n\n/**\n * Begin a group's impl layer. `databaseSchema` and `group` are retained only as\n * type-level carriers (`group` drives the required `FunctionImpl` services via\n * `FromGroupSpec<Group>`; `databaseSchema` keeps the impl's dependency on\n * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at\n * runtime.\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n _databaseSchema: DatabaseSchema_,\n _group: Group &\n MiddlewareSpec.ValidateImplRequires<\n GroupSpec.Functions<Group>,\n GroupSpec.MiddlewareSpecs<Group>\n >,\n): Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n> =>\n Layer.succeed(\n GroupImpl<\"Unfinalized\">({ finalizationStatus: \"Unfinalized\" }),\n {\n [TypeId]: TypeId,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n registeredMiddlewareKeys: [],\n },\n ) as Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n >;\n\nconst findUnfinalizedGroupImpl = <S>(\n context: Context.Context<S>,\n): Option.Option<AnyUnfinalized> =>\n Array.findFirst(context.mapUnsafe.values(), isUnfinalizedGroupImpl);\n\n/**\n * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults\n * `RIn = never`, so passing a layer that still requires any `FunctionImpl`\n * service produces a type error at the impl author's site. The codegen boundary\n * requires the resulting `\"Finalized\"` brand, so omitting this call is also\n * rejected downstream.\n *\n * As a side effect of finalization, the names of every `FunctionImpl` that\n * registered into this group's scope are snapshotted onto the produced service\n * value's `registeredFunctionNames` field, so consumers can verify impl\n * completeness against a `GroupSpec`'s expected functions without having to\n * inspect the `Registry` themselves.\n */\nexport const finalize = (\n group: Layer.Layer<GroupImpl<\"Unfinalized\">>,\n): Layer.Layer<GroupImpl<\"Finalized\">> =>\n Layer.flatMap(group, (context): Layer.Layer<GroupImpl<\"Finalized\">> =>\n findUnfinalizedGroupImpl(context).pipe(\n Option.match({\n onNone: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.die(\n new Error(\n \"GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context.\",\n ),\n ),\n ),\n onSome: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n return {\n [TypeId]: TypeId,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: RegistryItems.functionNames(items),\n registeredMiddlewareKeys: RegistryItems.middlewareKeys(items),\n };\n }),\n ),\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n | FunctionImpl.FromGroupSpec<Group>\n | MiddlewareImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,MAAa,SAAS;AA6BtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,MAAM;AAKjC,MAAa,wBAAwB,MACnC,YAAY,CAAC,KAAK,EAAE,uBAAuB;AAE7C,MAAa,0BAA0B,MACrC,YAAY,CAAC,KAAK,EAAE,uBAAuB;;;;;;;;;;;;;AAc7C,MAAa,aAA6D,EACxE,yBAIA,QAAQ,QACN,6BAA6B,oBAC/B;;;;;;;;AASF,MAAa,QAIX,iBACA,WAUA,MAAM,QACJ,UAAyB,EAAE,oBAAoB,cAAc,CAAC,GAC9D;EACG,SAAS;CACV,oBAAoB;CACpB,yBAAyB,CAAC;CAC1B,0BAA0B,CAAC;AAC7B,CACF;AAMF,MAAM,4BACJ,YAEA,MAAM,UAAU,QAAQ,UAAU,OAAO,GAAG,sBAAsB;;;;;;;;;;;;;;AAepE,MAAa,YACX,UAEA,MAAM,QAAQ,QAAQ,YACpB,yBAAyB,OAAO,CAAC,CAAC,KAChC,OAAO,MAAM;CACX,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,YAAY,CAAC,GAC1D,OAAO,oBACL,IAAI,MACF,wFACF,CACF,CACF;CACF,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,YAAY,CAAC,GAC1D,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAOA;EACxB,MAAM,QAAQ,OAAO,IAAI,IAAI,QAAQ;EACrC,OAAO;IACJ,SAAS;GACV,oBAAoB;GACpB,yBAAyBC,cAA4B,KAAK;GAC1D,0BAA0BC,eAA6B,KAAK;EAC9D;CACF,CAAC,CACH;AACJ,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"GroupImpl.js","names":["Registry.Registry","RegistryItems.missingRequired","RegistryItems.functionNames","RegistryItems.middlewareKeys"],"sources":["../src/GroupImpl.ts"],"sourcesContent":["import type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as MiddlewareSpec from \"@confect/core/MiddlewareSpec\";\nimport * as Registry from \"./Registry.js\";\nimport * as RegistryItems from \"./RegistryItems.js\";\nimport * as Array from \"effect/Array\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Data from \"effect/Data\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as FunctionImpl from \"./FunctionImpl.js\";\nimport type * as MiddlewareImpl from \"./MiddlewareImpl.js\";\n\nexport const TypeId = \"~@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\n readonly finalizationStatus: FinalizationStatus_;\n /**\n * Names of every function registered into this group's layer scope by\n * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is\n * `\"Finalized\"`; the `\"Unfinalized\"` value is set to `[]` at `make`-time\n * since the list is only known once `finalize` snapshots the registry.\n */\n readonly registeredFunctionNames: ReadonlyArray<string>;\n /**\n * Keys of every middleware whose implementation registered into this group's\n * layer scope via `MiddlewareImpl.make` (and friends). Same authoritativeness\n * caveat as `registeredFunctionNames`. Lets consumers (the CLI's\n * `validateImpl`) verify middleware-impl completeness against a `GroupSpec`'s\n * attached middleware without inspecting the `Registry`.\n */\n readonly registeredMiddlewareKeys: ReadonlyArray<string>;\n}\n\nexport interface Any extends GroupImpl<FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<\"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<\"Unfinalized\"> {}\n\nexport const isFinalizedGroupImpl = (u: unknown): u is AnyFinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Finalized\";\n\nexport const isUnfinalizedGroupImpl = (u: unknown): u is AnyUnfinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Unfinalized\";\n\n/**\n * Build the runtime tag for a `GroupImpl` service. The finalization status is\n * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct\n * services at runtime; consumers of a finalized layer (the server's\n * `RegisteredFunctions.buildForGroup` and the CLI's `validateImpl`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n *\n * The tag is keyed only by finalization status—no group path—because each\n * group's impl layer is built in its own isolated scope\n * (`buildForGroup`/`validateImpl` each provide a fresh `Registry`), so at most\n * one `GroupImpl` service of each status exists per build.\n */\nexport const GroupImpl = <FinalizationStatus_ extends FinalizationStatus>({\n finalizationStatus,\n}: {\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.Service<GroupImpl<FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}`,\n );\n\n/**\n * Begin a group's impl layer. `databaseSchema` and `group` are retained only as\n * type-level carriers (`group` drives the required `FunctionImpl` services via\n * `FromGroupSpec<Group>`; `databaseSchema` keeps the impl's dependency on\n * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at\n * runtime.\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n _databaseSchema: DatabaseSchema_,\n _group: Group &\n MiddlewareSpec.ValidateImplRequires<\n GroupSpec.Functions<Group>,\n GroupSpec.MiddlewareSpecs<Group>\n >,\n): Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n> =>\n Layer.succeed(\n GroupImpl<\"Unfinalized\">({ finalizationStatus: \"Unfinalized\" }),\n {\n [TypeId]: TypeId,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n registeredMiddlewareKeys: [],\n },\n ) as Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n >;\n\nconst findGroupImpl = <S>(context: Context.Context<S>): Option.Option<Any> =>\n Array.findFirst(context.mapUnsafe.values(), isGroupImpl);\n\nexport class MissingRequiredMiddlewareError extends Data.TaggedError(\n \"MissingRequiredMiddlewareError\",\n)<{\n readonly missing: ReadonlyArray<RegistryItems.MissingMiddleware>;\n}> {\n override get message(): string {\n return `GroupImpl.finalize: ${this.missing.map(({ functionName, middlewareKey }) => `${functionName} requires middleware \"${middlewareKey}\"`).join(\"\\n\")}`;\n }\n}\n\ntype Finalizable = Layer.Layer<AnyUnfinalized> | Layer.Layer<AnyFinalized>;\n\n/**\n * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults\n * `RIn = never`, so passing a layer that still requires any `FunctionImpl`\n * service produces a type error at the impl author's site. The codegen boundary\n * requires the resulting `\"Finalized\"` brand, so omitting this call is also\n * rejected downstream.\n *\n * As a side effect of finalization, the names of every `FunctionImpl` that\n * registered into this group's scope are snapshotted onto the produced service\n * value's `registeredFunctionNames` field, so consumers can verify impl\n * completeness against a `GroupSpec`'s expected functions without having to\n * inspect the `Registry` themselves. Pass `{ required }` to check every\n * registered function's middleware at layer build, including internal\n * functions. This form also accepts a finalized layer so generated registration\n * can enforce the backend declaration without changing authored impls. Pass\n * `groupPath` to qualify uncovered function names in the diagnostic.\n */\nexport function finalize(options: {\n readonly groupPath?: string;\n readonly required: ReadonlyArray<\n Pick<MiddlewareSpec.AnyMiddlewareSpec, \"key\">\n >;\n}): (group: Finalizable) => Layer.Layer<GroupImpl<\"Finalized\">>;\nexport function finalize(\n group: Layer.Layer<GroupImpl<\"Unfinalized\">>,\n): Layer.Layer<GroupImpl<\"Finalized\">>;\nexport function finalize(\n input:\n | Finalizable\n | {\n readonly groupPath?: string;\n readonly required: ReadonlyArray<\n Pick<MiddlewareSpec.AnyMiddlewareSpec, \"key\">\n >;\n },\n):\n | Layer.Layer<GroupImpl<\"Finalized\">>\n | ((group: Finalizable) => Layer.Layer<GroupImpl<\"Finalized\">>) {\n return \"required\" in input\n ? (group) => finalizeWith(group, input.required, input.groupPath)\n : finalizeWith(input, []);\n}\n\nconst finalizeWith = (\n group: Layer.Layer<never>,\n required: ReadonlyArray<Pick<MiddlewareSpec.AnyMiddlewareSpec, \"key\">>,\n groupPath = \"\",\n): Layer.Layer<GroupImpl<\"Finalized\">> =>\n Layer.flatMap(group, (context): Layer.Layer<GroupImpl<\"Finalized\">> =>\n findGroupImpl(context).pipe(\n Option.match({\n onNone: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.die(\n new Error(\n \"GroupImpl.finalize: no GroupImpl service was found in the layer's context.\",\n ),\n ),\n ),\n onSome: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n const missing = RegistryItems.missingRequired(\n items,\n required,\n groupPath,\n );\n if (missing.length > 0) {\n return yield* Effect.die(\n new MissingRequiredMiddlewareError({ missing }),\n );\n }\n return {\n [TypeId]: TypeId,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: RegistryItems.functionNames(items),\n registeredMiddlewareKeys: RegistryItems.middlewareKeys(items),\n };\n }),\n ),\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n | FunctionImpl.FromGroupSpec<Group>\n | MiddlewareImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS;AA6BtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,MAAM;AAKjC,MAAa,wBAAwB,MACnC,YAAY,CAAC,KAAK,EAAE,uBAAuB;AAE7C,MAAa,0BAA0B,MACrC,YAAY,CAAC,KAAK,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1D,0BAA0BC,eAA6B,KAAK;EAC9D;CACF,CAAC,CACH;AACJ,CAAC,CACH,CACF"}
@@ -1,6 +1,6 @@
1
1
  import type * as Layer from "effect/Layer";
2
- import type * as GroupImpl from "./GroupImpl";
3
- import * as MiddlewareRegistryItem from "./MiddlewareRegistryItem";
2
+ import type * as GroupImpl from "./GroupImpl.js";
3
+ import * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
4
4
  export declare const make: (groupLayer: Layer.Layer<GroupImpl.GroupImpl<"Finalized">>) => {
5
5
  functionRegistryItems: Record<string, unknown>;
6
6
  middlewareRegistryItems: Map<string, MiddlewareRegistryItem.MiddlewareRegistryItem>;
@@ -1 +1 @@
1
- {"version":3,"file":"GroupRegistry.d.ts","sourceRoot":"","sources":["../src/GroupRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,IAAI,eACH,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;;;CAe1D,CAAC"}
1
+ {"version":3,"file":"GroupRegistry.d.ts","sourceRoot":"","sources":["../src/GroupRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AAEtE,eAAO,MAAM,IAAI,eACH,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;;;CAe1D,CAAC"}
@@ -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\";\nimport type * as RegistryItems from \"./RegistryItems\";\nimport type * as GroupImpl from \"./GroupImpl\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem\";\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","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"}
package/dist/Handler.d.ts CHANGED
@@ -1,30 +1,31 @@
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";
4
5
  import type { Effect } from "effect";
5
- import type * as ActionCtx from "./ActionCtx";
6
- import type * as ActionRunner from "./ActionRunner";
7
- import type * as Auth from "./Auth";
8
- import type * as DatabaseReader from "./DatabaseReader";
9
- import type * as DatabaseSchema from "./DatabaseSchema";
10
- import type * as DatabaseWriter from "./DatabaseWriter";
11
- import type * as DataModel from "./DataModel";
12
- import type { ExecutionMetadata } from "./ExecutionMetadata";
13
- import type { RequestMetadata } from "./RequestMetadata";
14
- import type { TransactionMetadata } from "./TransactionMetadata";
15
- import type * as MutationCtx from "./MutationCtx";
16
- import type * as MutationRunner from "./MutationRunner";
17
- import type { MutationTransactionContext } from "./MutationTransactionContext";
18
- import type * as QueryCtx from "./QueryCtx";
19
- import type * as QueryRunner from "./QueryRunner";
20
- import type { QueryTransactionContext } from "./QueryTransactionContext";
21
- import type * as RegisteredFunction from "./RegisteredFunction";
22
- import type * as Scheduler from "./Scheduler";
23
- import type { Storage } from "./Storage";
24
- import type * as StorageActionWriter from "./StorageActionWriter";
25
- import type * as StorageReader from "./StorageReader";
26
- import type * as StorageWriter from "./StorageWriter";
27
- import type * as VectorSearch from "./VectorSearch";
6
+ import type * as ActionCtx from "./ActionCtx.js";
7
+ import type * as ActionRunner from "./ActionRunner.js";
8
+ import type * as Auth from "./Auth.js";
9
+ import type * as DatabaseReader from "./DatabaseReader.js";
10
+ import type * as DatabaseSchema from "./DatabaseSchema.js";
11
+ import type * as DatabaseWriter from "./DatabaseWriter.js";
12
+ import type * as DataModel from "./DataModel.js";
13
+ import type { ExecutionMetadata } from "./ExecutionMetadata.js";
14
+ import type { RequestMetadata } from "./RequestMetadata.js";
15
+ import type { TransactionMetadata } from "./TransactionMetadata.js";
16
+ import type * as MutationCtx from "./MutationCtx.js";
17
+ import type * as MutationRunner from "./MutationRunner.js";
18
+ import type { MutationTransactionContext } from "./MutationTransactionContext.js";
19
+ import type * as QueryCtx from "./QueryCtx.js";
20
+ import type * as QueryRunner from "./QueryRunner.js";
21
+ import type { QueryTransactionContext } from "./QueryTransactionContext.js";
22
+ import type * as RegisteredFunction from "./RegisteredFunction.js";
23
+ import type * as Scheduler from "./Scheduler.js";
24
+ import type { Storage } from "./Storage.js";
25
+ import type * as StorageActionWriter from "./StorageActionWriter.js";
26
+ import type * as StorageReader from "./StorageReader.js";
27
+ import type * as StorageWriter from "./StorageWriter.js";
28
+ import type * as VectorSearch from "./VectorSearch.js";
28
29
  export type Handler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps, R = never> = FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConvex> ? ConvexProvenanceHandler<FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConfect> ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_, R> : never;
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;
@@ -33,11 +34,14 @@ export type MutationServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps
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,aAAa,CAAC;AAC9C,OAAO,KAAK,KAAK,YAAY,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;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,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\";\nimport type * as ActionRunner from \"./ActionRunner\";\nimport type * as Auth from \"./Auth\";\nimport type * as DatabaseReader from \"./DatabaseReader\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DatabaseWriter from \"./DatabaseWriter\";\nimport type * as DataModel from \"./DataModel\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata\";\nimport type { RequestMetadata } from \"./RequestMetadata\";\nimport type { TransactionMetadata } from \"./TransactionMetadata\";\nimport type * as MutationCtx from \"./MutationCtx\";\nimport type * as MutationRunner from \"./MutationRunner\";\nimport type { MutationTransactionContext } from \"./MutationTransactionContext\";\nimport type * as QueryCtx from \"./QueryCtx\";\nimport type * as QueryRunner from \"./QueryRunner\";\nimport type { QueryTransactionContext } from \"./QueryTransactionContext\";\nimport type * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as Scheduler from \"./Scheduler\";\nimport type { Storage } from \"./Storage\";\nimport type * as StorageActionWriter from \"./StorageActionWriter\";\nimport type * as StorageReader from \"./StorageReader\";\nimport type * as StorageWriter from \"./StorageWriter\";\nimport type * as VectorSearch from \"./VectorSearch\";\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 | (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":""}
@@ -7,19 +7,19 @@ import type * as HttpApiGroup from "effect/http-api/HttpApiGroup";
7
7
  import type * as Etag from "effect/http/Etag";
8
8
  import type * as HttpPlatform from "effect/http/HttpPlatform";
9
9
  import * as HttpRouter from "effect/http/HttpRouter";
10
- import type * as ActionRunner from "./ActionRunner";
11
- import type * as Auth from "./Auth";
12
- import type { ExecutionMetadata } from "./ExecutionMetadata";
13
- import type { RequestMetadata } from "./RequestMetadata";
14
- import type * as DatabaseSchema from "./DatabaseSchema";
15
- import type * as Handler from "./Handler";
16
- import type * as MutationRunner from "./MutationRunner";
17
- import type * as QueryRunner from "./QueryRunner";
18
- import type * as Scheduler from "./Scheduler";
19
- import type { Storage } from "./Storage";
20
- import type { StorageActionWriter } from "./StorageActionWriter";
21
- import type { StorageReader } from "./StorageReader";
22
- import type { StorageWriter } from "./StorageWriter";
10
+ import type * as ActionRunner from "./ActionRunner.js";
11
+ import type * as Auth from "./Auth.js";
12
+ import type { ExecutionMetadata } from "./ExecutionMetadata.js";
13
+ import type { RequestMetadata } from "./RequestMetadata.js";
14
+ import type * as DatabaseSchema from "./DatabaseSchema.js";
15
+ import type * as Handler from "./Handler.js";
16
+ import type * as MutationRunner from "./MutationRunner.js";
17
+ import type * as QueryRunner from "./QueryRunner.js";
18
+ import type * as Scheduler from "./Scheduler.js";
19
+ import type { Storage } from "./Storage.js";
20
+ import type { StorageActionWriter } from "./StorageActionWriter.js";
21
+ import type { StorageReader } from "./StorageReader.js";
22
+ import type { StorageWriter } from "./StorageWriter.js";
23
23
  /**
24
24
  * The Confect services available to HTTP route handlers and middleware,
25
25
  * supplied per request from the Convex action context.
@@ -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,gBAAgB,CAAC;AACpD,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,CAAC;AAG1C,OAAO,KAAK,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,KAAK,WAAW,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,mB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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;IAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;CAAE,KACnE,gBAgBA,CAAC"}
@@ -3,12 +3,12 @@ import { layer } from "./ConvexConfigProvider.js";
3
3
  import { layer as layer$1 } from "./ConvexLogger.js";
4
4
  import { actionLayer, baseActionLayer } from "./RegisteredFunction.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
+ import * as Array from "effect/Array";
8
9
  import { ROUTABLE_HTTP_METHODS, httpActionGeneric, httpRouter } from "convex/server";
9
10
  import * as Schema from "effect/Schema";
10
11
  import * as Match from "effect/Match";
11
- import * as Array from "effect/Array";
12
12
  import * as SchemaAST from "effect/SchemaAST";
13
13
  import * as Console from "effect/Console";
14
14
  import * as Config from "effect/Config";
@@ -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\";\nimport type * as Auth from \"./Auth\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata\";\nimport type { RequestMetadata } from \"./RequestMetadata\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as Handler from \"./Handler\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as ConvexLogger from \"./ConvexLogger\";\nimport type * as MutationRunner from \"./MutationRunner\";\nimport type * as QueryRunner from \"./QueryRunner\";\nimport * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as Scheduler from \"./Scheduler\";\nimport type { Storage } from \"./Storage\";\nimport type { StorageActionWriter } from \"./StorageActionWriter\";\nimport type { StorageReader } from \"./StorageReader\";\nimport type { StorageWriter } from \"./StorageWriter\";\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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","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,OAAO,OAAO,SAAS,QAAQ,QAAQ;AACzC,CAAC,CAAC,CAAC,KAAK,OAAO,KAAK,CACtB;AAEA,MAAM,iBAMJ,QACA,SACA,QACqB;CACrB,mBAAmB;CAMnB,MAAM,WAAW,OA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AI,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"}
@@ -5,20 +5,20 @@ import type { FunctionType } from "convex/server";
5
5
  import * as Context from "effect/Context";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Layer from "effect/Layer";
8
- import type * as Auth from "./Auth";
9
- import type * as DatabaseReader from "./DatabaseReader";
10
- import type * as DatabaseSchema from "./DatabaseSchema";
11
- import type * as Handler from "./Handler";
12
- import type { ExecutionMetadata } from "./ExecutionMetadata";
13
- import type { RequestMetadata } from "./RequestMetadata";
14
- import type { TransactionMetadata } from "./TransactionMetadata";
15
- import type * as MutationRunner from "./MutationRunner";
16
- import type * as QueryRunner from "./QueryRunner";
17
- import type { QueryTransactionContext } from "./QueryTransactionContext";
18
- import type * as Scheduler from "./Scheduler";
19
- import type { Storage } from "./Storage";
20
- import type * as StorageReader from "./StorageReader";
21
- import type * as StorageWriter from "./StorageWriter";
8
+ import type * as Auth from "./Auth.js";
9
+ import type * as DatabaseReader from "./DatabaseReader.js";
10
+ import type * as DatabaseSchema from "./DatabaseSchema.js";
11
+ import type * as Handler from "./Handler.js";
12
+ import type { ExecutionMetadata } from "./ExecutionMetadata.js";
13
+ import type { RequestMetadata } from "./RequestMetadata.js";
14
+ import type { TransactionMetadata } from "./TransactionMetadata.js";
15
+ import type * as MutationRunner from "./MutationRunner.js";
16
+ import type * as QueryRunner from "./QueryRunner.js";
17
+ import type { QueryTransactionContext } from "./QueryTransactionContext.js";
18
+ import type * as Scheduler from "./Scheduler.js";
19
+ import type { Storage } from "./Storage.js";
20
+ import type * as StorageReader from "./StorageReader.js";
21
+ import type * as StorageWriter from "./StorageWriter.js";
22
22
  /**
23
23
  * Marker service produced by providing a middleware's implementation to a
24
24
  * group's impl layer. `GroupImpl.make` requires one per middleware attached to
@@ -1 +1 @@
1
- {"version":3,"file":"MiddlewareImpl.d.ts","sourceRoot":"","sources":["../src/MiddlewareImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB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AAM,CACnB,KAAK,EACL,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,EACnC,cAAc,CACZ,eAAe,EACf,cAAc,CAAC,aAAa,CAAC,eAAe,CAAC,CAC9C,GACD,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAC3C,KACA,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAEE,CAAC"}
@@ -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