@confect/server 9.0.0-next.0 → 9.0.0-next.10

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 (190) hide show
  1. package/CHANGELOG.md +299 -4
  2. package/dist/ActionCtx.d.ts +4 -11
  3. package/dist/ActionCtx.d.ts.map +1 -1
  4. package/dist/ActionCtx.js +1 -1
  5. package/dist/ActionCtx.js.map +1 -1
  6. package/dist/ActionRunner.d.ts +8 -13
  7. package/dist/ActionRunner.d.ts.map +1 -1
  8. package/dist/ActionRunner.js +4 -3
  9. package/dist/ActionRunner.js.map +1 -1
  10. package/dist/Auth.d.ts +17 -23
  11. package/dist/Auth.d.ts.map +1 -1
  12. package/dist/Auth.js +5 -1
  13. package/dist/Auth.js.map +1 -1
  14. package/dist/BlobNotFoundError.d.ts +6 -12
  15. package/dist/BlobNotFoundError.d.ts.map +1 -1
  16. package/dist/BlobNotFoundError.js +1 -1
  17. package/dist/BlobNotFoundError.js.map +1 -1
  18. package/dist/ConvexConfigProvider.d.ts +2 -9
  19. package/dist/ConvexConfigProvider.d.ts.map +1 -1
  20. package/dist/ConvexConfigProvider.js +6 -1
  21. package/dist/ConvexConfigProvider.js.map +1 -1
  22. package/dist/CronJob.d.ts +12 -19
  23. package/dist/CronJob.d.ts.map +1 -1
  24. package/dist/CronJob.js +1 -1
  25. package/dist/CronJob.js.map +1 -1
  26. package/dist/CronJobs.d.ts +11 -18
  27. package/dist/CronJobs.d.ts.map +1 -1
  28. package/dist/CronJobs.js +11 -4
  29. package/dist/CronJobs.js.map +1 -1
  30. package/dist/DataModel.d.ts +24 -29
  31. package/dist/DataModel.d.ts.map +1 -1
  32. package/dist/DatabaseReader.d.ts +4323 -64
  33. package/dist/DatabaseReader.d.ts.map +1 -1
  34. package/dist/DatabaseReader.js +6 -6
  35. package/dist/DatabaseReader.js.map +1 -1
  36. package/dist/DatabaseSchema.d.ts +38 -130
  37. package/dist/DatabaseSchema.d.ts.map +1 -1
  38. package/dist/DatabaseSchema.js +20 -30
  39. package/dist/DatabaseSchema.js.map +1 -1
  40. package/dist/DatabaseWriter.d.ts +38 -42
  41. package/dist/DatabaseWriter.d.ts.map +1 -1
  42. package/dist/DatabaseWriter.js +8 -5
  43. package/dist/DatabaseWriter.js.map +1 -1
  44. package/dist/Document.d.ts +28 -37
  45. package/dist/Document.d.ts.map +1 -1
  46. package/dist/Document.js +5 -1
  47. package/dist/Document.js.map +1 -1
  48. package/dist/FunctionImpl.d.ts +30 -29
  49. package/dist/FunctionImpl.d.ts.map +1 -1
  50. package/dist/FunctionImpl.js +25 -14
  51. package/dist/FunctionImpl.js.map +1 -1
  52. package/dist/GroupImpl.d.ts +45 -41
  53. package/dist/GroupImpl.d.ts.map +1 -1
  54. package/dist/GroupImpl.js +42 -35
  55. package/dist/GroupImpl.js.map +1 -1
  56. package/dist/Handler.d.ts +34 -40
  57. package/dist/Handler.d.ts.map +1 -1
  58. package/dist/HttpApi.d.ts +21 -25
  59. package/dist/HttpApi.d.ts.map +1 -1
  60. package/dist/HttpApi.js +11 -6
  61. package/dist/HttpApi.js.map +1 -1
  62. package/dist/MutationCtx.d.ts +4 -11
  63. package/dist/MutationCtx.d.ts.map +1 -1
  64. package/dist/MutationCtx.js +1 -1
  65. package/dist/MutationCtx.js.map +1 -1
  66. package/dist/MutationRunner.d.ts +8 -13
  67. package/dist/MutationRunner.d.ts.map +1 -1
  68. package/dist/MutationRunner.js +4 -3
  69. package/dist/MutationRunner.js.map +1 -1
  70. package/dist/OrderedQuery.d.ts +16 -21
  71. package/dist/OrderedQuery.d.ts.map +1 -1
  72. package/dist/OrderedQuery.js +4 -1
  73. package/dist/OrderedQuery.js.map +1 -1
  74. package/dist/QueryCtx.d.ts +4 -11
  75. package/dist/QueryCtx.d.ts.map +1 -1
  76. package/dist/QueryCtx.js +1 -1
  77. package/dist/QueryCtx.js.map +1 -1
  78. package/dist/QueryInitializer.d.ts +34 -39
  79. package/dist/QueryInitializer.d.ts.map +1 -1
  80. package/dist/QueryInitializer.js +5 -1
  81. package/dist/QueryInitializer.js.map +1 -1
  82. package/dist/QueryRunner.d.ts +8 -13
  83. package/dist/QueryRunner.d.ts.map +1 -1
  84. package/dist/QueryRunner.js +4 -3
  85. package/dist/QueryRunner.js.map +1 -1
  86. package/dist/RegisteredConvexFunction.d.ts +1107 -60
  87. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  88. package/dist/RegisteredConvexFunction.js +14 -9
  89. package/dist/RegisteredConvexFunction.js.map +1 -1
  90. package/dist/RegisteredFunction.d.ts +48 -64
  91. package/dist/RegisteredFunction.d.ts.map +1 -1
  92. package/dist/RegisteredFunction.js +9 -5
  93. package/dist/RegisteredFunction.js.map +1 -1
  94. package/dist/RegisteredFunctions.d.ts +48 -26
  95. package/dist/RegisteredFunctions.d.ts.map +1 -1
  96. package/dist/RegisteredFunctions.js +22 -9
  97. package/dist/RegisteredFunctions.js.map +1 -1
  98. package/dist/RegisteredNodeFunction.d.ts +4 -14
  99. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  100. package/dist/RegisteredNodeFunction.js +5 -4
  101. package/dist/RegisteredNodeFunction.js.map +1 -1
  102. package/dist/RegistryItem.d.ts +17 -27
  103. package/dist/RegistryItem.d.ts.map +1 -1
  104. package/dist/RegistryItem.js +1 -1
  105. package/dist/RegistryItem.js.map +1 -1
  106. package/dist/Scheduler.d.ts +16 -20
  107. package/dist/Scheduler.d.ts.map +1 -1
  108. package/dist/Scheduler.js +10 -6
  109. package/dist/Scheduler.js.map +1 -1
  110. package/dist/SchemaToValidator.d.ts +71 -64
  111. package/dist/SchemaToValidator.d.ts.map +1 -1
  112. package/dist/SchemaToValidator.js +15 -3
  113. package/dist/SchemaToValidator.js.map +1 -1
  114. package/dist/StorageActionWriter.d.ts +21 -28
  115. package/dist/StorageActionWriter.d.ts.map +1 -1
  116. package/dist/StorageActionWriter.js +4 -1
  117. package/dist/StorageActionWriter.js.map +1 -1
  118. package/dist/StorageReader.d.ts +14 -21
  119. package/dist/StorageReader.d.ts.map +1 -1
  120. package/dist/StorageReader.js +5 -1
  121. package/dist/StorageReader.js.map +1 -1
  122. package/dist/StorageWriter.d.ts +16 -23
  123. package/dist/StorageWriter.d.ts.map +1 -1
  124. package/dist/StorageWriter.js +4 -1
  125. package/dist/StorageWriter.js.map +1 -1
  126. package/dist/Table.d.ts +204 -197
  127. package/dist/Table.d.ts.map +1 -1
  128. package/dist/Table.js +72 -62
  129. package/dist/Table.js.map +1 -1
  130. package/dist/TableInfo.d.ts +35 -41
  131. package/dist/TableInfo.d.ts.map +1 -1
  132. package/dist/VectorSearch.d.ts +30 -35
  133. package/dist/VectorSearch.d.ts.map +1 -1
  134. package/dist/VectorSearch.js +3 -1
  135. package/dist/VectorSearch.js.map +1 -1
  136. package/dist/index.d.ts +35 -36
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +4 -5
  139. package/dist/internal/utils.d.ts +9 -11
  140. package/dist/internal/utils.d.ts.map +1 -1
  141. package/dist/internal/utils.js +3 -1
  142. package/dist/internal/utils.js.map +1 -1
  143. package/dist/node.d.ts +2 -2
  144. package/dist/node.d.ts.map +1 -0
  145. package/dist/tsconfig.src.tsbuildinfo +1 -0
  146. package/package.json +50 -59
  147. package/src/ActionCtx.ts +1 -1
  148. package/src/ActionRunner.ts +2 -1
  149. package/src/Auth.ts +5 -1
  150. package/src/BlobNotFoundError.ts +1 -1
  151. package/src/ConvexConfigProvider.ts +6 -8
  152. package/src/CronJob.ts +1 -1
  153. package/src/CronJobs.ts +8 -10
  154. package/src/DatabaseReader.ts +18 -21
  155. package/src/DatabaseSchema.ts +38 -98
  156. package/src/DatabaseWriter.ts +13 -6
  157. package/src/Document.ts +5 -1
  158. package/src/FunctionImpl.ts +36 -44
  159. package/src/GroupImpl.ts +54 -81
  160. package/src/HttpApi.ts +8 -9
  161. package/src/MutationCtx.ts +1 -1
  162. package/src/MutationRunner.ts +2 -1
  163. package/src/OrderedQuery.ts +5 -1
  164. package/src/QueryCtx.ts +1 -1
  165. package/src/QueryInitializer.ts +15 -3
  166. package/src/QueryRunner.ts +2 -1
  167. package/src/RegisteredConvexFunction.ts +11 -7
  168. package/src/RegisteredFunction.ts +5 -1
  169. package/src/RegisteredFunctions.ts +69 -93
  170. package/src/RegisteredNodeFunction.ts +7 -6
  171. package/src/RegistryItem.ts +1 -1
  172. package/src/Scheduler.ts +5 -1
  173. package/src/SchemaToValidator.ts +14 -16
  174. package/src/StorageActionWriter.ts +4 -1
  175. package/src/StorageReader.ts +5 -1
  176. package/src/StorageWriter.ts +4 -1
  177. package/src/Table.ts +253 -132
  178. package/src/VectorSearch.ts +3 -1
  179. package/src/index.ts +0 -1
  180. package/src/internal/utils.ts +3 -1
  181. package/dist/Api.d.ts +0 -30
  182. package/dist/Api.d.ts.map +0 -1
  183. package/dist/Api.js +0 -26
  184. package/dist/Api.js.map +0 -1
  185. package/dist/GroupPath.d.ts +0 -8
  186. package/dist/GroupPath.d.ts.map +0 -1
  187. package/dist/GroupPath.js +0 -10
  188. package/dist/GroupPath.js.map +0 -1
  189. package/src/Api.ts +0 -75
  190. package/src/GroupPath.ts +0 -43
package/dist/Handler.d.ts CHANGED
@@ -1,42 +1,36 @@
1
- import { ActionCtx } from "./ActionCtx.js";
2
- import { ActionRunner } from "./ActionRunner.js";
3
- import { AnyWithProps } from "./DatabaseSchema.js";
4
- import { Auth } from "./Auth.js";
5
- import { FromSchema, ToConvex } from "./DataModel.js";
6
- import { DatabaseReader } from "./DatabaseReader.js";
7
- import { DatabaseWriter } from "./DatabaseWriter.js";
8
- import { MutationCtx } from "./MutationCtx.js";
9
- import { MutationRunner } from "./MutationRunner.js";
10
- import { QueryCtx } from "./QueryCtx.js";
11
- import { QueryRunner } from "./QueryRunner.js";
12
- import { Scheduler } from "./Scheduler.js";
13
- import { StorageActionWriter } from "./StorageActionWriter.js";
14
- import { StorageReader } from "./StorageReader.js";
15
- import { StorageWriter } from "./StorageWriter.js";
16
- import { VectorSearch } from "./VectorSearch.js";
17
- import { Any as Any$1, ConvexRegisteredFunction } from "./RegisteredFunction.js";
18
- import { Effect } from "effect";
19
- import { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
20
- import { NodeContext } from "@effect/platform-node";
21
- import * as FunctionProvenance from "@confect/core/FunctionProvenance";
22
-
23
- //#region src/Handler.d.ts
24
- declare namespace Handler_d_exports {
25
- export { Any, AnyConfectProvenance, AnyConvexProvenance, ConfectProvenanceMutation, ConfectProvenanceQuery, ConvexRuntimeAction, Handler, NodeRuntimeAction, WithName };
26
- }
27
- type Handler<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps> = FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConvex> ? ConvexProvenanceHandler<FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConfect> ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_> : never;
28
- type ConvexProvenanceHandler<FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>> = ConvexRegisteredFunction<FunctionSpec_>;
29
- type ConfectProvenanceHandler<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>> = FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "query"> ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "mutation"> ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.ConvexAction> ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.NodeAction> ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_> : never;
30
- type ConfectProvenanceQuery<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>> = Base<FunctionSpec_, DatabaseReader<DatabaseSchema_> | Auth | StorageReader | QueryRunner | QueryCtx<ToConvex<FromSchema<DatabaseSchema_>>>>;
31
- type ConfectProvenanceMutation<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>> = Base<FunctionSpec_, DatabaseReader<DatabaseSchema_> | DatabaseWriter<DatabaseSchema_> | Auth | Scheduler | StorageReader | StorageWriter | QueryRunner | MutationRunner | MutationCtx<ToConvex<FromSchema<DatabaseSchema_>>>>;
32
- type ActionServices<DatabaseSchema_ extends AnyWithProps> = Scheduler | Auth | StorageReader | StorageWriter | StorageActionWriter | QueryRunner | MutationRunner | ActionRunner | VectorSearch<FromSchema<DatabaseSchema_>> | ActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>;
33
- type ConvexRuntimeAction<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>> = Base<FunctionSpec_, ActionServices<DatabaseSchema_>>;
34
- type NodeRuntimeAction<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | NodeContext.NodeContext>;
1
+ import type { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
2
+ import type * as FunctionProvenance from "@confect/core/FunctionProvenance";
3
+ import type { NodeContext } from "@effect/platform-node";
4
+ 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 * as MutationCtx from "./MutationCtx";
13
+ import type * as MutationRunner from "./MutationRunner";
14
+ import type * as QueryCtx from "./QueryCtx";
15
+ import type * as QueryRunner from "./QueryRunner";
16
+ import type * as RegisteredFunction from "./RegisteredFunction";
17
+ import type * as Scheduler from "./Scheduler";
18
+ import type { StorageActionWriter } from "./StorageActionWriter";
19
+ import type { StorageReader } from "./StorageReader";
20
+ import type { StorageWriter } from "./StorageWriter";
21
+ import type * as VectorSearch from "./VectorSearch";
22
+ export type Handler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps> = FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConvex> ? ConvexProvenanceHandler<FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConfect> ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_> : never;
23
+ type ConvexProvenanceHandler<FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;
24
+ type ConfectProvenanceHandler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>> = FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "query"> ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "mutation"> ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.ConvexAction> ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.NodeAction> ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_> : never;
25
+ export type ConfectProvenanceQuery<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>> = Base<FunctionSpec_, DatabaseReader.DatabaseReader<DatabaseSchema_> | Auth.Auth | StorageReader | QueryRunner.QueryRunner | QueryCtx.QueryCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>>>;
26
+ export type ConfectProvenanceMutation<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>> = Base<FunctionSpec_, DatabaseReader.DatabaseReader<DatabaseSchema_> | DatabaseWriter.DatabaseWriter<DatabaseSchema_> | Auth.Auth | Scheduler.Scheduler | StorageReader | StorageWriter | QueryRunner.QueryRunner | MutationRunner.MutationRunner | MutationCtx.MutationCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>>>;
27
+ type ActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> = Scheduler.Scheduler | Auth.Auth | StorageReader | StorageWriter | StorageActionWriter | QueryRunner.QueryRunner | MutationRunner.MutationRunner | ActionRunner.ActionRunner | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>> | ActionCtx.ActionCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>>;
28
+ export type ConvexRuntimeAction<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>> = Base<FunctionSpec_, ActionServices<DatabaseSchema_>>;
29
+ export type NodeRuntimeAction<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | NodeContext.NodeContext>;
35
30
  type Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (args: FunctionSpec.Args<FunctionSpec_>) => Effect.Effect<FunctionSpec.Returns<FunctionSpec_>, FunctionSpec.Error<FunctionSpec_>, R>;
36
- type Any = AnyConfectProvenance | AnyConvexProvenance;
37
- type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;
38
- type AnyConvexProvenance = Any$1;
39
- type WithName<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps, FunctionName extends string> = Handler<DatabaseSchema_, FunctionSpec.WithName<FunctionSpec_, FunctionName>>;
40
- //#endregion
41
- export { Any, AnyConfectProvenance, AnyConvexProvenance, ConfectProvenanceMutation, ConfectProvenanceQuery, ConvexRuntimeAction, Handler, Handler_d_exports, NodeRuntimeAction, WithName };
31
+ export type Any = AnyConfectProvenance | AnyConvexProvenance;
32
+ export type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;
33
+ export type AnyConvexProvenance = RegisteredFunction.Any;
34
+ export type WithName<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps, FunctionName extends string> = Handler<DatabaseSchema_, FunctionSpec.WithName<FunctionSpec_, FunctionName>>;
35
+ export {};
42
36
  //# sourceMappingURL=Handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Handler.d.ts","names":[],"sources":["../src/Handler.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KAsBY,OAAA,yBACc,YAAA,wBACF,YAAA,CAAa,YAAA,IAEnC,aAAA,SAAsB,YAAA,CAAa,sBAAA,CACjC,aAAA,EACA,kBAAA,CAAmB,SAAA,IAEjB,uBAAA,CAAwB,aAAA,IACxB,aAAA,SAAsB,YAAA,CAAa,sBAAA,CAC/B,aAAA,E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AY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC9D,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,KACnC,MAAM,CAAC,MAAM,CAChB,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,EACnC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,EACjC,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,GAAG,CAAC;AAEzD,MAAM,MAAM,QAAQ,CAClB,eAAe,SAAS,cAAc,CAAC,YAAY,EACnD,aAAa,SAAS,YAAY,CAAC,YAAY,EAC/C,YAAY,SAAS,MAAM,IACzB,OAAO,CACT,eAAe,EACf,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,CACnD,CAAC"}
package/dist/HttpApi.d.ts CHANGED
@@ -1,28 +1,24 @@
1
- import { ActionRunner } from "./ActionRunner.js";
2
- import { Auth as Auth$1 } from "./Auth.js";
3
- import { MutationRunner } from "./MutationRunner.js";
4
- import { QueryRunner } from "./QueryRunner.js";
5
- import { Scheduler as Scheduler$1 } from "./Scheduler.js";
6
- import { StorageActionWriter as StorageActionWriter$1 } from "./StorageActionWriter.js";
7
- import { StorageReader as StorageReader$1 } from "./StorageReader.js";
8
- import { StorageWriter as StorageWriter$1 } from "./StorageWriter.js";
9
- import { Layer } from "effect";
10
- import { HttpRouter } from "convex/server";
11
- import { HttpApi, HttpApiBuilder, HttpApiScalar, HttpApp, HttpRouter as HttpRouter$1 } from "@effect/platform";
12
-
13
- //#region src/HttpApi.d.ts
14
- declare namespace HttpApi_d_exports {
15
- export { HttpApi_, RoutePath, make };
16
- }
17
- type Middleware = (httpApp: HttpApp.Default) => HttpApp.Default<never, HttpApi.Api | HttpApiBuilder.Router | HttpRouter$1.HttpRouter.DefaultServices>;
18
- type HttpApi_ = {
19
- apiLive: Layer.Layer<HttpApi.Api, never, QueryRunner | MutationRunner | ActionRunner | Scheduler$1 | Auth$1 | StorageReader$1 | StorageWriter$1 | StorageActionWriter$1>;
20
- middleware?: Middleware;
21
- scalar?: HttpApiScalar.ScalarConfig;
1
+ import type { HttpApi, HttpApp, HttpRouter } from "@effect/platform";
2
+ import * as HttpApiBuilder from "@effect/platform/HttpApiBuilder";
3
+ import * as HttpApiScalar from "@effect/platform/HttpApiScalar";
4
+ import { type HttpRouter as ConvexHttpRouter } from "convex/server";
5
+ import * as Layer from "effect/Layer";
6
+ import * as ActionRunner from "./ActionRunner";
7
+ import * as Auth from "./Auth";
8
+ import * as MutationRunner from "./MutationRunner";
9
+ import * as QueryRunner from "./QueryRunner";
10
+ import * as Scheduler from "./Scheduler";
11
+ import { StorageActionWriter } from "./StorageActionWriter";
12
+ import { StorageReader } from "./StorageReader";
13
+ import { StorageWriter } from "./StorageWriter";
14
+ type Middleware = (httpApp: HttpApp.Default) => HttpApp.Default<never, HttpApi.Api | HttpApiBuilder.Router | HttpRouter.HttpRouter.DefaultServices>;
15
+ export type HttpApi_ = {
16
+ apiLive: Layer.Layer<HttpApi.Api, never, QueryRunner.QueryRunner | MutationRunner.MutationRunner | ActionRunner.ActionRunner | Scheduler.Scheduler | Auth.Auth | StorageReader | StorageWriter | StorageActionWriter>;
17
+ middleware?: Middleware;
18
+ scalar?: HttpApiScalar.ScalarConfig;
22
19
  };
23
- type RoutePath = "/" | `/${string}/`;
20
+ export type RoutePath = "/" | `/${string}/`;
24
21
  type HttpApis = Partial<Record<RoutePath, HttpApi_>>;
25
- declare const make: (httpApis: HttpApis) => HttpRouter;
26
- //#endregion
27
- export { HttpApi_, HttpApi_d_exports, RoutePath, make };
22
+ export declare const make: (httpApis: HttpApis) => ConvexHttpRouter;
23
+ export {};
28
24
  //# sourceMappingURL=HttpApi.d.ts.map
@@ -1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,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,UAAU,GAAG,CAChB,OAAO,EAAE,OAAO,CAAC,OAAO,KACrB,OAAO,CAAC,OAAO,CAClB,KAAK,EACL,OAAO,CAAC,GAAG,GAAG,cAAc,CAAC,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,eAAe,CAC5E,CAAC;AAqGF,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,KAAK,CAAC,KAAK,CAClB,OAAO,CAAC,GAAG,EACX,KAAK,EACH,WAAW,CAAC,WAAW,GACvB,cAAc,CAAC,cAAc,GAC7B,YAAY,CAAC,YAAY,GACzB,SAAS,CAAC,SAAS,GACnB,IAAI,CAAC,IAAI,GACT,aAAa,GACb,aAAa,GACb,mBAAmB,CACtB,CAAC;IACF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,MAAM,GAAG,CAAC;AA8C5C,KAAK,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAErD,eAAO,MAAM,IAAI,GAAI,UAAU,QAAQ,KAAG,gBAiBzC,CAAC"}
package/dist/HttpApi.js CHANGED
@@ -6,17 +6,22 @@ import { make as make$1 } from "./ConvexConfigProvider.js";
6
6
  import { layer as layer$2 } from "./MutationRunner.js";
7
7
  import { layer as layer$3 } from "./QueryRunner.js";
8
8
  import { layer as layer$4 } from "./Scheduler.js";
9
- import { StorageActionWriter as StorageActionWriter$1 } from "./StorageActionWriter.js";
10
- import { StorageReader as StorageReader$1 } from "./StorageReader.js";
11
- import { StorageWriter as StorageWriter$1 } from "./StorageWriter.js";
12
- import { Array, Layer, Record, pipe } from "effect";
9
+ import { StorageActionWriter } from "./StorageActionWriter.js";
10
+ import { StorageReader } from "./StorageReader.js";
11
+ import { StorageWriter } from "./StorageWriter.js";
13
12
  import { ROUTABLE_HTTP_METHODS, httpActionGeneric, httpRouter } from "convex/server";
14
- import { HttpApiBuilder, HttpApiScalar, HttpServer } from "@effect/platform";
13
+ import * as Layer from "effect/Layer";
14
+ import { pipe } from "effect/Function";
15
+ import * as Array from "effect/Array";
16
+ import * as Record from "effect/Record";
17
+ import * as HttpApiBuilder from "@effect/platform/HttpApiBuilder";
18
+ import * as HttpApiScalar from "@effect/platform/HttpApiScalar";
19
+ import * as HttpServer from "@effect/platform/HttpServer";
15
20
 
16
21
  //#region src/HttpApi.ts
17
22
  var HttpApi_exports = /* @__PURE__ */ __exportAll({ make: () => make });
18
23
  const makeHandler = ({ pathPrefix, apiLive, middleware, scalar }) => (ctx, request) => {
19
- const ApiLive = apiLive.pipe(Layer.provide(Layer.mergeAll(layer$3(ctx.runQuery), layer$2(ctx.runMutation), layer(ctx.runAction), layer$4(ctx.scheduler), layer$1(ctx.auth), StorageReader$1.layer(ctx.storage), StorageWriter$1.layer(ctx.storage), StorageActionWriter$1.layer(ctx.storage), Layer.succeed(ActionCtx(), ctx))));
24
+ const ApiLive = apiLive.pipe(Layer.provide(Layer.mergeAll(layer$3(ctx.runQuery), layer$2(ctx.runMutation), layer(ctx.runAction), layer$4(ctx.scheduler), layer$1(ctx.auth), StorageReader.layer(ctx.storage), StorageWriter.layer(ctx.storage), StorageActionWriter.layer(ctx.storage), Layer.succeed(ActionCtx(), ctx))));
20
25
  const ApiDocsLive = HttpApiScalar.layer({
21
26
  path: `${pathPrefix}docs`,
22
27
  scalar: {
@@ -1 +1 @@
1
- {"version":3,"file":"HttpApi.js","names":["QueryRunner.layer","MutationRunner.layer","ActionRunner.layer","Scheduler.layer","Auth.layer","StorageReader","StorageWriter","StorageActionWriter","ActionCtx.ActionCtx","ConvexConfigProvider.make"],"sources":["../src/HttpApi.ts"],"sourcesContent":["import {\n type HttpApi,\n HttpApiBuilder,\n HttpApiScalar,\n type HttpApp,\n type HttpRouter,\n HttpServer,\n} from \"@effect/platform\";\nimport {\n type HttpRouter as ConvexHttpRouter,\n type GenericActionCtx,\n type GenericDataModel,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n} from \"convex/server\";\nimport { Array, Layer, pipe, Record } from \"effect\";\nimport * as ActionCtx from \"./ActionCtx\";\nimport * as ActionRunner from \"./ActionRunner\";\nimport * as Auth from \"./Auth\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as MutationRunner from \"./MutationRunner\";\nimport * as QueryRunner from \"./QueryRunner\";\nimport * as Scheduler from \"./Scheduler\";\nimport { StorageActionWriter } from \"./StorageActionWriter\";\nimport { StorageReader } from \"./StorageReader\";\nimport { StorageWriter } from \"./StorageWriter\";\n\ntype Middleware = (\n httpApp: HttpApp.Default,\n) => HttpApp.Default<\n never,\n HttpApi.Api | HttpApiBuilder.Router | HttpRouter.HttpRouter.DefaultServices\n>;\n\nconst makeHandler =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (ctx: GenericActionCtx<DataModel>, request: Request): Promise<Response> => {\n const ApiLive = apiLive.pipe(\n Layer.provide(\n Layer.mergeAll(\n QueryRunner.layer(ctx.runQuery),\n MutationRunner.layer(ctx.runMutation),\n ActionRunner.layer(ctx.runAction),\n Scheduler.layer(ctx.scheduler),\n Auth.layer(ctx.auth),\n StorageReader.layer(ctx.storage),\n StorageWriter.layer(ctx.storage),\n StorageActionWriter.layer(ctx.storage),\n Layer.succeed(ActionCtx.ActionCtx<DataModel>(), ctx),\n ),\n ),\n );\n\n const ApiDocsLive = HttpApiScalar.layer({\n path: `${pathPrefix}docs`,\n scalar: {\n baseServerURL: `${process.env[\"CONVEX_SITE_URL\"]}${pathPrefix}`,\n ...scalar,\n },\n }).pipe(Layer.provide(ApiLive));\n\n const EnvLive = Layer.mergeAll(\n ApiLive,\n ApiDocsLive,\n HttpServer.layerContext,\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n );\n\n const { handler } = HttpApiBuilder.toWebHandler(\n EnvLive,\n middleware ? { middleware } : {},\n );\n\n return handler(request);\n };\n\nconst makeHttpAction = <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n}: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n}) =>\n httpActionGeneric(\n makeHandler<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n }) as unknown as (\n ctx: GenericActionCtx<GenericDataModel>,\n request: Request,\n ) => Promise<Response>,\n );\n\nexport type HttpApi_ = {\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n};\n\nexport type RoutePath = \"/\" | `/${string}/`;\n\nconst mountEffectHttpApi =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (convexHttpRouter: ConvexHttpRouter): ConvexHttpRouter => {\n const handler = makeHttpAction<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n });\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix,\n method,\n handler,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n return convexHttpRouter;\n };\n\ntype HttpApis = Partial<Record<RoutePath, HttpApi_>>;\n\nexport const make = (httpApis: HttpApis): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n return pipe(\n httpApis as Record<RoutePath, HttpApi_>,\n Record.toEntries,\n Array.reduce(\n httpRouter(),\n (convexHttpRouter, [pathPrefix, { apiLive, middleware, scalar }]) =>\n mountEffectHttpApi({\n pathPrefix: pathPrefix as RoutePath,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n })(convexHttpRouter),\n ),\n );\n};\n\nconst applyMonkeyPatches = () => {\n // These are necessary until the Convex runtime supports these APIs. See https://discord.com/channels/1019350475847499849/1281364098419785760\n\n // eslint-disable-next-line no-global-assign\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,MAAM,eACiC,EACnC,YACA,SACA,YACA,cAmBD,KAAkC,YAAwC;CAC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,QAAO,KACL,UACA,OAAO,WACP,MAAM,OACJ,YAAY,GACX,kBAAkB,CAAC,YAAY,EAAE,SAAS,YAAY,cACrD,mBAAmB;EACL;EACZ;EACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;EACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAC7B,CAAC,CAAC,iBAAiB,CACvB,CACF;;AAGH,MAAM,2BAA2B;AAI/B,OAAM,cAAc,IAAI;EACtB,IAAa,WAAW;AACtB,UAAO;;EAET,IAAa,WAAW;AACtB,UAAO;;;AAIX,QAAO,eAAe,QAAQ,WAAW,UAAU,EACjD,WAAW,IAAI,aAAa,EAC7B,CAAC"}
1
+ {"version":3,"file":"HttpApi.js","names":["QueryRunner.layer","MutationRunner.layer","ActionRunner.layer","Scheduler.layer","Auth.layer","ActionCtx.ActionCtx","ConvexConfigProvider.make"],"sources":["../src/HttpApi.ts"],"sourcesContent":["import type { HttpApi, HttpApp, HttpRouter } from \"@effect/platform\";\nimport * as HttpApiBuilder from \"@effect/platform/HttpApiBuilder\";\nimport * as HttpApiScalar from \"@effect/platform/HttpApiScalar\";\nimport * as HttpServer from \"@effect/platform/HttpServer\";\nimport {\n type HttpRouter as ConvexHttpRouter,\n type GenericActionCtx,\n type GenericDataModel,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n} from \"convex/server\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Layer from \"effect/Layer\";\nimport * as Record from \"effect/Record\";\nimport * as ActionCtx from \"./ActionCtx\";\nimport * as ActionRunner from \"./ActionRunner\";\nimport * as Auth from \"./Auth\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as MutationRunner from \"./MutationRunner\";\nimport * as QueryRunner from \"./QueryRunner\";\nimport * as Scheduler from \"./Scheduler\";\nimport { StorageActionWriter } from \"./StorageActionWriter\";\nimport { StorageReader } from \"./StorageReader\";\nimport { StorageWriter } from \"./StorageWriter\";\n\ntype Middleware = (\n httpApp: HttpApp.Default,\n) => HttpApp.Default<\n never,\n HttpApi.Api | HttpApiBuilder.Router | HttpRouter.HttpRouter.DefaultServices\n>;\n\nconst makeHandler =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (ctx: GenericActionCtx<DataModel>, request: Request): Promise<Response> => {\n const ApiLive = apiLive.pipe(\n Layer.provide(\n Layer.mergeAll(\n QueryRunner.layer(ctx.runQuery),\n MutationRunner.layer(ctx.runMutation),\n ActionRunner.layer(ctx.runAction),\n Scheduler.layer(ctx.scheduler),\n Auth.layer(ctx.auth),\n StorageReader.layer(ctx.storage),\n StorageWriter.layer(ctx.storage),\n StorageActionWriter.layer(ctx.storage),\n Layer.succeed(ActionCtx.ActionCtx<DataModel>(), ctx),\n ),\n ),\n );\n\n const ApiDocsLive = HttpApiScalar.layer({\n path: `${pathPrefix}docs`,\n scalar: {\n baseServerURL: `${process.env[\"CONVEX_SITE_URL\"]}${pathPrefix}`,\n ...scalar,\n },\n }).pipe(Layer.provide(ApiLive));\n\n const EnvLive = Layer.mergeAll(\n ApiLive,\n ApiDocsLive,\n HttpServer.layerContext,\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n );\n\n const { handler } = HttpApiBuilder.toWebHandler(\n EnvLive,\n middleware ? { middleware } : {},\n );\n\n return handler(request);\n };\n\nconst makeHttpAction = <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n}: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n}) =>\n httpActionGeneric(\n makeHandler<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n }) as unknown as (\n ctx: GenericActionCtx<GenericDataModel>,\n request: Request,\n ) => Promise<Response>,\n );\n\nexport type HttpApi_ = {\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n};\n\nexport type RoutePath = \"/\" | `/${string}/`;\n\nconst mountEffectHttpApi =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (convexHttpRouter: ConvexHttpRouter): ConvexHttpRouter => {\n const handler = makeHttpAction<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n });\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix,\n method,\n handler,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n return convexHttpRouter;\n };\n\ntype HttpApis = Partial<Record<RoutePath, HttpApi_>>;\n\nexport const make = (httpApis: HttpApis): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n return pipe(\n httpApis as Record<RoutePath, HttpApi_>,\n Record.toEntries,\n Array.reduce(\n httpRouter(),\n (convexHttpRouter, [pathPrefix, { apiLive, middleware, scalar }]) =>\n mountEffectHttpApi({\n pathPrefix: pathPrefix as RoutePath,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n })(convexHttpRouter),\n ),\n );\n};\n\nconst applyMonkeyPatches = () => {\n // These are necessary until the Convex runtime supports these APIs. See https://discord.com/channels/1019350475847499849/1281364098419785760\n\n // eslint-disable-next-line no-global-assign\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,eACiC,EACnC,YACA,SACA,YACA,cAmBD,KAAkC,YAAwC;CACzE,MAAM,UAAU,QAAQ,KACtB,MAAM,QACJ,MAAM,SACJA,QAAkB,IAAI,SAAS,EAC/BC,QAAqB,IAAI,YAAY,EACrCC,MAAmB,IAAI,UAAU,EACjCC,QAAgB,IAAI,UAAU,EAC9BC,QAAW,IAAI,KAAK,EACpB,cAAc,MAAM,IAAI,QAAQ,EAChC,cAAc,MAAM,IAAI,QAAQ,EAChC,oBAAoB,MAAM,IAAI,QAAQ,EACtC,MAAM,QAAQC,WAAgC,EAAE,IAAI,CACrD,CACF,CACF;CAED,MAAM,cAAc,cAAc,MAAM;EACtC,MAAM,GAAG,WAAW;EACpB,QAAQ;GACN,eAAe,GAAG,QAAQ,IAAI,qBAAqB;GACnD,GAAG;GACJ;EACF,CAAC,CAAC,KAAK,MAAM,QAAQ,QAAQ,CAAC;CAE/B,MAAM,UAAU,MAAM,SACpB,SACA,aACA,WAAW,cACX,MAAM,kBAAkBC,QAA2B,CAAC,CACrD;CAED,MAAM,EAAE,YAAY,eAAe,aACjC,SACA,aAAa,EAAE,YAAY,GAAG,EAAE,CACjC;AAED,QAAO,QAAQ,QAAQ;;AAG3B,MAAM,kBAAsD,EAC1D,YACA,SACA,YACA,aAmBA,kBACE,YAAuB;CACrB;CACA;CACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;CACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;CAC7B,CAAC,CAIH;AAqBH,MAAM,sBACiC,EACnC,YACA,SACA,YACA,cAmBD,qBAAyD;CACxD,MAAM,UAAU,eAA0B;EACxC;EACA;EACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;EACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAC7B,CAAC;AAEF,OAAM,QAAQ,wBAAwB,WAAW;EAC/C,MAAM,YAAqC;GACzC;GACA;GACA;GACD;AACD,mBAAiB,MAAM,UAAU;GACjC;AAEF,QAAO;;AAKX,MAAa,QAAQ,aAAyC;AAC5D,qBAAoB;AAEpB,QAAO,KACL,UACA,OAAO,WACP,MAAM,OACJ,YAAY,GACX,kBAAkB,CAAC,YAAY,EAAE,SAAS,YAAY,cACrD,mBAAmB;EACL;EACZ;EACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;EACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAC7B,CAAC,CAAC,iBAAiB,CACvB,CACF;;AAGH,MAAM,2BAA2B;AAI/B,OAAM,cAAc,IAAI;EACtB,IAAa,WAAW;AACtB,UAAO;;EAET,IAAa,WAAW;AACtB,UAAO;;;AAIX,QAAO,eAAe,QAAQ,WAAW,UAAU,EACjD,WAAW,IAAI,aAAa,EAC7B,CAAC"}
@@ -1,12 +1,5 @@
1
- import { Context } from "effect";
2
- import { GenericDataModel, GenericMutationCtx } from "convex/server";
3
-
4
- //#region src/MutationCtx.d.ts
5
- declare namespace MutationCtx_d_exports {
6
- export { MutationCtx };
7
- }
8
- declare const MutationCtx: <DataModel extends GenericDataModel>() => Context.Tag<GenericMutationCtx<DataModel>, GenericMutationCtx<DataModel>>;
9
- type MutationCtx<DataModel extends GenericDataModel> = ReturnType<typeof MutationCtx<DataModel>>["Identifier"];
10
- //#endregion
11
- export { MutationCtx, MutationCtx_d_exports };
1
+ import type { GenericDataModel, GenericMutationCtx } from "convex/server";
2
+ import * as Context from "effect/Context";
3
+ export declare const MutationCtx: <DataModel extends GenericDataModel>() => Context.Tag<GenericMutationCtx<DataModel>, GenericMutationCtx<DataModel>>;
4
+ export type MutationCtx<DataModel extends GenericDataModel> = ReturnType<typeof MutationCtx<DataModel>>["Identifier"];
12
5
  //# sourceMappingURL=MutationCtx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutationCtx.d.ts","names":[],"sources":["../src/MutationCtx.ts"],"mappings":";;;;;;;cAGa,WAAA,qBAAiC,gBAAA,OAAgB,OAAA,CAAA,GAAA,CAAA,kBAAA,CAAA,SAAA,GAAA,kBAAA,CAAA,SAAA;AAAA,KAKlD,WAAA,mBAA8B,gBAAA,IAAoB,UAAA,QACrD,WAAA,CAAY,SAAA"}
1
+ {"version":3,"file":"MutationCtx.d.ts","sourceRoot":"","sources":["../src/MutationCtx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,eAAO,MAAM,WAAW,GAAI,SAAS,SAAS,gBAAgB,gFAG3D,CAAC;AAEJ,MAAM,MAAM,WAAW,CAAC,SAAS,SAAS,gBAAgB,IAAI,UAAU,CACtE,OAAO,WAAW,CAAC,SAAS,CAAC,CAC9B,CAAC,YAAY,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context } from "effect";
2
+ import * as Context from "effect/Context";
3
3
 
4
4
  //#region src/MutationCtx.ts
5
5
  var MutationCtx_exports = /* @__PURE__ */ __exportAll({ MutationCtx: () => MutationCtx });
@@ -1 +1 @@
1
- {"version":3,"file":"MutationCtx.js","names":[],"sources":["../src/MutationCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericMutationCtx } from \"convex/server\";\nimport { Context } from \"effect\";\n\nexport const MutationCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericMutationCtx<DataModel>>(\n \"@confect/server/MutationCtx\",\n );\n\nexport type MutationCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof MutationCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,oBACX,QAAQ,WACN,8BACD"}
1
+ {"version":3,"file":"MutationCtx.js","names":[],"sources":["../src/MutationCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericMutationCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\n\nexport const MutationCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericMutationCtx<DataModel>>(\n \"@confect/server/MutationCtx\",\n );\n\nexport type MutationCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof MutationCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,oBACX,QAAQ,WACN,8BACD"}
@@ -1,14 +1,9 @@
1
- import { Context, Effect, Layer, ParseResult } from "effect";
2
- import * as Ref$1 from "@confect/core/Ref";
3
- import { GenericMutationCtx } from "convex/server";
4
-
5
- //#region src/MutationRunner.d.ts
6
- declare namespace MutationRunner_d_exports {
7
- export { MutationRunner, layer };
8
- }
9
- declare const MutationRunner: Context.Tag<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>), <Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>>;
10
- type MutationRunner = typeof MutationRunner.Identifier;
11
- declare const layer: (runMutation: GenericMutationCtx<any>["runMutation"]) => Layer.Layer<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>), never, never>;
12
- //#endregion
13
- export { MutationRunner, MutationRunner_d_exports, layer };
1
+ import * as Ref from "@confect/core/Ref";
2
+ import { type GenericMutationCtx } from "convex/server";
3
+ import type { ParseResult, Effect } from "effect";
4
+ import * as Context from "effect/Context";
5
+ import * as Layer from "effect/Layer";
6
+ export declare const MutationRunner: Context.Tag<(<Mutation extends Ref.AnyMutation>(mutation: Mutation, ...args: Ref.OptionalArgs<Mutation>) => Effect.Effect<Ref.Returns<Mutation>, Ref.Error<Mutation> | ParseResult.ParseError>), <Mutation extends Ref.AnyMutation>(mutation: Mutation, ...args: Ref.OptionalArgs<Mutation>) => Effect.Effect<Ref.Returns<Mutation>, Ref.Error<Mutation> | ParseResult.ParseError>>;
7
+ export type MutationRunner = typeof MutationRunner.Identifier;
8
+ export declare const layer: (runMutation: GenericMutationCtx<any>["runMutation"]) => Layer.Layer<(<Mutation extends Ref.AnyMutation>(mutation: Mutation, ...args: Ref.OptionalArgs<Mutation>) => Effect.Effect<Ref.Returns<Mutation>, Ref.Error<Mutation> | ParseResult.ParseError>), never, never>;
14
9
  //# sourceMappingURL=MutationRunner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutationRunner.d.ts","names":[],"sources":["../src/MutationRunner.ts"],"mappings":";;;;;;;;cAqBa,cAAA,EAAc,OAAA,CAAA,GAAA,oBAdP,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,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AQ,SAAS,GAAG,CAAC,WAAW,YACrB,QAAQ,WACT,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,KAClC,MAAM,CAAC,MAAM,CACd,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,UAAU,CAC7C,CAUF,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,UAAU,CAAC;AAE9D,eAAO,MAAM,KAAK,GAAI,aAAa,kBAAkB,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,mBAnBtE,QAAQ,SAAS,GAAG,CAAC,WAAW,YACrB,QAAQ,WACT,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,KAClC,MAAM,CAAC,MAAM,CACd,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,UAAU,CAC7C,gBAc+C,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context, Layer } from "effect";
3
- import * as Ref$1 from "@confect/core/Ref";
2
+ import * as Context from "effect/Context";
3
+ import * as Ref from "@confect/core/Ref";
4
4
  import "convex/server";
5
+ import * as Layer from "effect/Layer";
5
6
 
6
7
  //#region src/MutationRunner.ts
7
8
  var MutationRunner_exports = /* @__PURE__ */ __exportAll({
8
9
  MutationRunner: () => MutationRunner,
9
10
  layer: () => layer
10
11
  });
11
- const make = (runMutation) => (mutation, ...args) => Ref$1.runWithCodec(mutation, args[0] ?? {}, (functionReference, encodedArgs) => runMutation(functionReference, encodedArgs));
12
+ const make = (runMutation) => (mutation, ...args) => Ref.runWithCodec(mutation, args[0] ?? {}, (functionReference, encodedArgs) => runMutation(functionReference, encodedArgs));
12
13
  const MutationRunner = Context.GenericTag("@confect/server/MutationRunner");
13
14
  const layer = (runMutation) => Layer.succeed(MutationRunner, make(runMutation));
14
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"MutationRunner.js","names":["Ref"],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericMutationCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: Ref.OptionalArgs<Mutation>\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n mutation,\n (args[0] ?? {}) as Ref.Args<Mutation>,\n (functionReference, encodedArgs) =>\n runMutation(functionReference, encodedArgs),\n );\n\nexport const MutationRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,QACH,iBAEC,UACA,GAAG,SAKHA,MAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,YAAY,mBAAmB,YAAY,CAC9C;AAEL,MAAa,iBAAiB,QAAQ,WACpC,iCACD;AAGD,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,YAAY,CAAC"}
1
+ {"version":3,"file":"MutationRunner.js","names":[],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericMutationCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\nconst make =\n (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: Ref.OptionalArgs<Mutation>\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n mutation,\n (args[0] ?? {}) as Ref.Args<Mutation>,\n (functionReference, encodedArgs) =>\n runMutation(functionReference, encodedArgs),\n );\n\nexport const MutationRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;;AAMA,MAAM,QACH,iBAEC,UACA,GAAG,SAKH,IAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,YAAY,mBAAmB,YAAY,CAC9C;AAEL,MAAa,iBAAiB,QAAQ,WACpC,iCACD;AAGD,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,YAAY,CAAC"}
@@ -1,23 +1,18 @@
1
- import { DocumentDecodeError } from "./Document.js";
2
- import { AnyWithProps, ConvexTableInfo, TableSchema } from "./TableInfo.js";
3
- import { Effect, Option, Stream } from "effect";
4
- import { ExpressionOrValue, FilterBuilder, OrderedQuery as OrderedQuery$1, PaginationResult } from "convex/server";
5
-
6
- //#region src/OrderedQuery.d.ts
7
- declare namespace OrderedQuery_d_exports {
8
- export { OrderedQuery, make };
9
- }
10
- type OrderedQuery<TableInfo_ extends AnyWithProps, _TableName extends string> = {
11
- readonly first: () => Effect.Effect<Option.Option<TableInfo_["document"]>, DocumentDecodeError>;
12
- readonly take: (n: number) => Effect.Effect<ReadonlyArray<TableInfo_["document"]>, DocumentDecodeError>;
13
- readonly collect: () => Effect.Effect<ReadonlyArray<TableInfo_["document"]>, DocumentDecodeError>;
14
- readonly stream: () => Stream.Stream<TableInfo_["document"], DocumentDecodeError>;
15
- readonly paginate: (options: {
16
- cursor: string | null;
17
- numItems: number;
18
- }, filter?: (q: FilterBuilder<ConvexTableInfo<TableInfo_>>) => ExpressionOrValue<boolean>) => Effect.Effect<PaginationResult<TableInfo_["document"]>, DocumentDecodeError>;
1
+ import type { ExpressionOrValue, FilterBuilder, OrderedQuery as ConvexOrderedQuery, PaginationResult } from "convex/server";
2
+ import type { Option } from "effect";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Stream from "effect/Stream";
5
+ import * as Document from "./Document";
6
+ import type * as TableInfo from "./TableInfo";
7
+ export type OrderedQuery<TableInfo_ extends TableInfo.AnyWithProps, _TableName extends string> = {
8
+ readonly first: () => Effect.Effect<Option.Option<TableInfo_["document"]>, Document.DocumentDecodeError>;
9
+ readonly take: (n: number) => Effect.Effect<ReadonlyArray<TableInfo_["document"]>, Document.DocumentDecodeError>;
10
+ readonly collect: () => Effect.Effect<ReadonlyArray<TableInfo_["document"]>, Document.DocumentDecodeError>;
11
+ readonly stream: () => Stream.Stream<TableInfo_["document"], Document.DocumentDecodeError>;
12
+ readonly paginate: (options: {
13
+ cursor: string | null;
14
+ numItems: number;
15
+ }, filter?: (q: FilterBuilder<TableInfo.ConvexTableInfo<TableInfo_>>) => ExpressionOrValue<boolean>) => Effect.Effect<PaginationResult<TableInfo_["document"]>, Document.DocumentDecodeError>;
19
16
  };
20
- declare const make: <TableInfo_ extends AnyWithProps, TableName extends string>(query: OrderedQuery$1<ConvexTableInfo<TableInfo_>>, tableName: TableName, tableSchema: TableSchema<TableInfo_>) => OrderedQuery<TableInfo_, TableName>;
21
- //#endregion
22
- export { OrderedQuery, OrderedQuery_d_exports, make };
17
+ export declare const make: <TableInfo_ extends TableInfo.AnyWithProps, TableName extends string>(query: ConvexOrderedQuery<TableInfo.ConvexTableInfo<TableInfo_>>, tableName: TableName, tableSchema: TableInfo.TableSchema<TableInfo_>) => OrderedQuery<TableInfo_, TableName>;
23
18
  //# sourceMappingURL=OrderedQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedQuery.d.ts","names":[],"sources":["../src/OrderedQuery.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C,UAAU,EAAE,SAAS,CAgEpC,CAAC"}
@@ -1,6 +1,9 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { decode } from "./Document.js";
3
- import { Chunk, Effect, Stream, identity, pipe } from "effect";
3
+ import { identity, pipe } from "effect/Function";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Chunk from "effect/Chunk";
6
+ import * as Stream from "effect/Stream";
4
7
 
5
8
  //#region src/OrderedQuery.ts
6
9
  var OrderedQuery_exports = /* @__PURE__ */ __exportAll({ make: () => make });
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedQuery.js","names":["Document.decode"],"sources":["../src/OrderedQuery.ts"],"sourcesContent":["import type {\n ExpressionOrValue,\n FilterBuilder,\n OrderedQuery as ConvexOrderedQuery,\n PaginationResult,\n} from \"convex/server\";\nimport { Chunk, Effect, identity, type Option, pipe, Stream } from \"effect\";\nimport * as Document from \"./Document\";\nimport type * as TableInfo from \"./TableInfo\";\n\nexport type OrderedQuery<\n TableInfo_ extends TableInfo.AnyWithProps,\n _TableName extends string,\n> = {\n readonly first: () => Effect.Effect<\n Option.Option<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n readonly take: (\n n: number,\n ) => Effect.Effect<\n ReadonlyArray<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n readonly collect: () => Effect.Effect<\n ReadonlyArray<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n readonly stream: () => Stream.Stream<\n TableInfo_[\"document\"],\n Document.DocumentDecodeError\n >;\n readonly paginate: (\n options: {\n cursor: string | null;\n numItems: number;\n },\n filter?: (\n q: FilterBuilder<TableInfo.ConvexTableInfo<TableInfo_>>,\n ) => ExpressionOrValue<boolean>,\n ) => Effect.Effect<\n PaginationResult<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n};\n\nexport const make = <\n TableInfo_ extends TableInfo.AnyWithProps,\n TableName extends string,\n>(\n query: ConvexOrderedQuery<TableInfo.ConvexTableInfo<TableInfo_>>,\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<TableInfo_>,\n): OrderedQuery<TableInfo_, TableName> => {\n type OrderedQueryFunction<\n FunctionName extends keyof OrderedQuery<TableInfo_, TableName>,\n > = OrderedQuery<TableInfo_, TableName>[FunctionName];\n\n const streamEncoded = Stream.fromAsyncIterable(query, identity).pipe(\n Stream.orDie,\n );\n\n const stream: OrderedQueryFunction<\"stream\"> = () =>\n pipe(\n streamEncoded,\n Stream.mapEffect(Document.decode(tableName, tableSchema)),\n );\n\n const first: OrderedQueryFunction<\"first\"> = () =>\n pipe(stream(), Stream.take(1), Stream.runHead);\n\n const take: OrderedQueryFunction<\"take\"> = (n: number) =>\n pipe(\n stream(),\n Stream.take(n),\n Stream.runCollect,\n Effect.map((chunk) => Chunk.toReadonlyArray(chunk)),\n );\n\n const collect: OrderedQueryFunction<\"collect\"> = () =>\n pipe(stream(), Stream.runCollect, Effect.map(Chunk.toReadonlyArray));\n\n const paginate: OrderedQueryFunction<\"paginate\"> = (options, filter) =>\n Effect.gen(function* () {\n const filteredQuery = filter !== undefined ? query.filter(filter) : query;\n\n const paginationResult = yield* Effect.promise(() =>\n filteredQuery.paginate(options),\n );\n\n const parsedPage = yield* Effect.forEach(\n paginationResult.page,\n Document.decode(tableName, tableSchema),\n );\n\n return {\n page: parsedPage,\n isDone: paginationResult.isDone,\n continueCursor: paginationResult.continueCursor,\n /* v8 ignore start */\n ...(paginationResult.splitCursor\n ? { splitCursor: paginationResult.splitCursor }\n : {}),\n ...(paginationResult.pageStatus\n ? { pageStatus: paginationResult.pageStatus }\n : {}),\n /* v8 ignore stop */\n };\n });\n\n return {\n first,\n take,\n collect,\n paginate,\n stream,\n };\n};\n"],"mappings":";;;;;;AA8CA,MAAa,QAIX,OACA,WACA,gBACwC;CAKxC,MAAM,gBAAgB,OAAO,kBAAkB,OAAO,SAAS,CAAC,KAC9D,OAAO,MACR;CAED,MAAM,eACJ,KACE,eACA,OAAO,UAAUA,OAAgB,WAAW,YAAY,CAAC,CAC1D;CAEH,MAAM,cACJ,KAAK,QAAQ,EAAE,OAAO,KAAK,EAAE,EAAE,OAAO,QAAQ;CAEhD,MAAM,QAAsC,MAC1C,KACE,QAAQ,EACR,OAAO,KAAK,EAAE,EACd,OAAO,YACP,OAAO,KAAK,UAAU,MAAM,gBAAgB,MAAM,CAAC,CACpD;CAEH,MAAM,gBACJ,KAAK,QAAQ,EAAE,OAAO,YAAY,OAAO,IAAI,MAAM,gBAAgB,CAAC;CAEtE,MAAM,YAA8C,SAAS,WAC3D,OAAO,IAAI,aAAa;EACtB,MAAM,gBAAgB,WAAW,SAAY,MAAM,OAAO,OAAO,GAAG;EAEpE,MAAM,mBAAmB,OAAO,OAAO,cACrC,cAAc,SAAS,QAAQ,CAChC;AAOD,SAAO;GACL,MANiB,OAAO,OAAO,QAC/B,iBAAiB,MACjBA,OAAgB,WAAW,YAAY,CACxC;GAIC,QAAQ,iBAAiB;GACzB,gBAAgB,iBAAiB;GAEjC,GAAI,iBAAiB,cACjB,EAAE,aAAa,iBAAiB,aAAa,GAC7C,EAAE;GACN,GAAI,iBAAiB,aACjB,EAAE,YAAY,iBAAiB,YAAY,GAC3C,EAAE;GAEP;GACD;AAEJ,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"OrderedQuery.js","names":["Document.decode"],"sources":["../src/OrderedQuery.ts"],"sourcesContent":["import type {\n ExpressionOrValue,\n FilterBuilder,\n OrderedQuery as ConvexOrderedQuery,\n PaginationResult,\n} from \"convex/server\";\nimport { identity, pipe } from \"effect/Function\";\nimport type { Option } from \"effect\";\nimport * as Chunk from \"effect/Chunk\";\nimport * as Effect from \"effect/Effect\";\nimport * as Stream from \"effect/Stream\";\nimport * as Document from \"./Document\";\nimport type * as TableInfo from \"./TableInfo\";\n\nexport type OrderedQuery<\n TableInfo_ extends TableInfo.AnyWithProps,\n _TableName extends string,\n> = {\n readonly first: () => Effect.Effect<\n Option.Option<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n readonly take: (\n n: number,\n ) => Effect.Effect<\n ReadonlyArray<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n readonly collect: () => Effect.Effect<\n ReadonlyArray<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n readonly stream: () => Stream.Stream<\n TableInfo_[\"document\"],\n Document.DocumentDecodeError\n >;\n readonly paginate: (\n options: {\n cursor: string | null;\n numItems: number;\n },\n filter?: (\n q: FilterBuilder<TableInfo.ConvexTableInfo<TableInfo_>>,\n ) => ExpressionOrValue<boolean>,\n ) => Effect.Effect<\n PaginationResult<TableInfo_[\"document\"]>,\n Document.DocumentDecodeError\n >;\n};\n\nexport const make = <\n TableInfo_ extends TableInfo.AnyWithProps,\n TableName extends string,\n>(\n query: ConvexOrderedQuery<TableInfo.ConvexTableInfo<TableInfo_>>,\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<TableInfo_>,\n): OrderedQuery<TableInfo_, TableName> => {\n type OrderedQueryFunction<\n FunctionName extends keyof OrderedQuery<TableInfo_, TableName>,\n > = OrderedQuery<TableInfo_, TableName>[FunctionName];\n\n const streamEncoded = Stream.fromAsyncIterable(query, identity).pipe(\n Stream.orDie,\n );\n\n const stream: OrderedQueryFunction<\"stream\"> = () =>\n pipe(\n streamEncoded,\n Stream.mapEffect(Document.decode(tableName, tableSchema)),\n );\n\n const first: OrderedQueryFunction<\"first\"> = () =>\n pipe(stream(), Stream.take(1), Stream.runHead);\n\n const take: OrderedQueryFunction<\"take\"> = (n: number) =>\n pipe(\n stream(),\n Stream.take(n),\n Stream.runCollect,\n Effect.map((chunk) => Chunk.toReadonlyArray(chunk)),\n );\n\n const collect: OrderedQueryFunction<\"collect\"> = () =>\n pipe(stream(), Stream.runCollect, Effect.map(Chunk.toReadonlyArray));\n\n const paginate: OrderedQueryFunction<\"paginate\"> = (options, filter) =>\n Effect.gen(function* () {\n const filteredQuery = filter !== undefined ? query.filter(filter) : query;\n\n const paginationResult = yield* Effect.promise(() =>\n filteredQuery.paginate(options),\n );\n\n const parsedPage = yield* Effect.forEach(\n paginationResult.page,\n Document.decode(tableName, tableSchema),\n );\n\n return {\n page: parsedPage,\n isDone: paginationResult.isDone,\n continueCursor: paginationResult.continueCursor,\n /* v8 ignore start */\n ...(paginationResult.splitCursor\n ? { splitCursor: paginationResult.splitCursor }\n : {}),\n ...(paginationResult.pageStatus\n ? { pageStatus: paginationResult.pageStatus }\n : {}),\n /* v8 ignore stop */\n };\n });\n\n return {\n first,\n take,\n collect,\n paginate,\n stream,\n };\n};\n"],"mappings":";;;;;;;;;AAkDA,MAAa,QAIX,OACA,WACA,gBACwC;CAKxC,MAAM,gBAAgB,OAAO,kBAAkB,OAAO,SAAS,CAAC,KAC9D,OAAO,MACR;CAED,MAAM,eACJ,KACE,eACA,OAAO,UAAUA,OAAgB,WAAW,YAAY,CAAC,CAC1D;CAEH,MAAM,cACJ,KAAK,QAAQ,EAAE,OAAO,KAAK,EAAE,EAAE,OAAO,QAAQ;CAEhD,MAAM,QAAsC,MAC1C,KACE,QAAQ,EACR,OAAO,KAAK,EAAE,EACd,OAAO,YACP,OAAO,KAAK,UAAU,MAAM,gBAAgB,MAAM,CAAC,CACpD;CAEH,MAAM,gBACJ,KAAK,QAAQ,EAAE,OAAO,YAAY,OAAO,IAAI,MAAM,gBAAgB,CAAC;CAEtE,MAAM,YAA8C,SAAS,WAC3D,OAAO,IAAI,aAAa;EACtB,MAAM,gBAAgB,WAAW,SAAY,MAAM,OAAO,OAAO,GAAG;EAEpE,MAAM,mBAAmB,OAAO,OAAO,cACrC,cAAc,SAAS,QAAQ,CAChC;AAOD,SAAO;GACL,MANiB,OAAO,OAAO,QAC/B,iBAAiB,MACjBA,OAAgB,WAAW,YAAY,CACxC;GAIC,QAAQ,iBAAiB;GACzB,gBAAgB,iBAAiB;GAEjC,GAAI,iBAAiB,cACjB,EAAE,aAAa,iBAAiB,aAAa,GAC7C,EAAE;GACN,GAAI,iBAAiB,aACjB,EAAE,YAAY,iBAAiB,YAAY,GAC3C,EAAE;GAEP;GACD;AAEJ,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
@@ -1,12 +1,5 @@
1
- import { Context } from "effect";
2
- import { GenericDataModel, GenericQueryCtx } from "convex/server";
3
-
4
- //#region src/QueryCtx.d.ts
5
- declare namespace QueryCtx_d_exports {
6
- export { QueryCtx };
7
- }
8
- declare const QueryCtx: <DataModel extends GenericDataModel>() => Context.Tag<GenericQueryCtx<DataModel>, GenericQueryCtx<DataModel>>;
9
- type QueryCtx<DataModel extends GenericDataModel> = ReturnType<typeof QueryCtx<DataModel>>["Identifier"];
10
- //#endregion
11
- export { QueryCtx, QueryCtx_d_exports };
1
+ import type { GenericDataModel, GenericQueryCtx } from "convex/server";
2
+ import * as Context from "effect/Context";
3
+ export declare const QueryCtx: <DataModel extends GenericDataModel>() => Context.Tag<GenericQueryCtx<DataModel>, GenericQueryCtx<DataModel>>;
4
+ export type QueryCtx<DataModel extends GenericDataModel> = ReturnType<typeof QueryCtx<DataModel>>["Identifier"];
12
5
  //# sourceMappingURL=QueryCtx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryCtx.d.ts","names":[],"sources":["../src/QueryCtx.ts"],"mappings":";;;;;;;cAGa,QAAA,qBAA8B,gBAAA,OAAgB,OAAA,CAAA,GAAA,CAAA,eAAA,CAAA,SAAA,GAAA,eAAA,CAAA,SAAA;AAAA,KAG/C,QAAA,mBAA2B,gBAAA,IAAoB,UAAA,QAClD,QAAA,CAAS,SAAA"}
1
+ {"version":3,"file":"QueryCtx.d.ts","sourceRoot":"","sources":["../src/QueryCtx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,eAAO,MAAM,QAAQ,GAAI,SAAS,SAAS,gBAAgB,0EACiB,CAAC;AAE7E,MAAM,MAAM,QAAQ,CAAC,SAAS,SAAS,gBAAgB,IAAI,UAAU,CACnE,OAAO,QAAQ,CAAC,SAAS,CAAC,CAC3B,CAAC,YAAY,CAAC,CAAC"}
package/dist/QueryCtx.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context } from "effect";
2
+ import * as Context from "effect/Context";
3
3
 
4
4
  //#region src/QueryCtx.ts
5
5
  var QueryCtx_exports = /* @__PURE__ */ __exportAll({ QueryCtx: () => QueryCtx });
@@ -1 +1 @@
1
- {"version":3,"file":"QueryCtx.js","names":[],"sources":["../src/QueryCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericQueryCtx } from \"convex/server\";\nimport { Context } from \"effect\";\n\nexport const QueryCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericQueryCtx<DataModel>>(\"@confect/server/QueryCtx\");\n\nexport type QueryCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof QueryCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,iBACX,QAAQ,WAAuC,2BAA2B"}
1
+ {"version":3,"file":"QueryCtx.js","names":[],"sources":["../src/QueryCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericQueryCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\n\nexport const QueryCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericQueryCtx<DataModel>>(\"@confect/server/QueryCtx\");\n\nexport type QueryCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof QueryCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,iBACX,QAAQ,WAAuC,2BAA2B"}