@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.
- package/CHANGELOG.md +299 -4
- package/dist/ActionCtx.d.ts +4 -11
- package/dist/ActionCtx.d.ts.map +1 -1
- package/dist/ActionCtx.js +1 -1
- package/dist/ActionCtx.js.map +1 -1
- package/dist/ActionRunner.d.ts +8 -13
- package/dist/ActionRunner.d.ts.map +1 -1
- package/dist/ActionRunner.js +4 -3
- package/dist/ActionRunner.js.map +1 -1
- package/dist/Auth.d.ts +17 -23
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js +5 -1
- package/dist/Auth.js.map +1 -1
- package/dist/BlobNotFoundError.d.ts +6 -12
- package/dist/BlobNotFoundError.d.ts.map +1 -1
- package/dist/BlobNotFoundError.js +1 -1
- package/dist/BlobNotFoundError.js.map +1 -1
- package/dist/ConvexConfigProvider.d.ts +2 -9
- package/dist/ConvexConfigProvider.d.ts.map +1 -1
- package/dist/ConvexConfigProvider.js +6 -1
- package/dist/ConvexConfigProvider.js.map +1 -1
- package/dist/CronJob.d.ts +12 -19
- package/dist/CronJob.d.ts.map +1 -1
- package/dist/CronJob.js +1 -1
- package/dist/CronJob.js.map +1 -1
- package/dist/CronJobs.d.ts +11 -18
- package/dist/CronJobs.d.ts.map +1 -1
- package/dist/CronJobs.js +11 -4
- package/dist/CronJobs.js.map +1 -1
- package/dist/DataModel.d.ts +24 -29
- package/dist/DataModel.d.ts.map +1 -1
- package/dist/DatabaseReader.d.ts +4323 -64
- package/dist/DatabaseReader.d.ts.map +1 -1
- package/dist/DatabaseReader.js +6 -6
- package/dist/DatabaseReader.js.map +1 -1
- package/dist/DatabaseSchema.d.ts +38 -130
- package/dist/DatabaseSchema.d.ts.map +1 -1
- package/dist/DatabaseSchema.js +20 -30
- package/dist/DatabaseSchema.js.map +1 -1
- package/dist/DatabaseWriter.d.ts +38 -42
- package/dist/DatabaseWriter.d.ts.map +1 -1
- package/dist/DatabaseWriter.js +8 -5
- package/dist/DatabaseWriter.js.map +1 -1
- package/dist/Document.d.ts +28 -37
- package/dist/Document.d.ts.map +1 -1
- package/dist/Document.js +5 -1
- package/dist/Document.js.map +1 -1
- package/dist/FunctionImpl.d.ts +30 -29
- package/dist/FunctionImpl.d.ts.map +1 -1
- package/dist/FunctionImpl.js +25 -14
- package/dist/FunctionImpl.js.map +1 -1
- package/dist/GroupImpl.d.ts +45 -41
- package/dist/GroupImpl.d.ts.map +1 -1
- package/dist/GroupImpl.js +42 -35
- package/dist/GroupImpl.js.map +1 -1
- package/dist/Handler.d.ts +34 -40
- package/dist/Handler.d.ts.map +1 -1
- package/dist/HttpApi.d.ts +21 -25
- package/dist/HttpApi.d.ts.map +1 -1
- package/dist/HttpApi.js +11 -6
- package/dist/HttpApi.js.map +1 -1
- package/dist/MutationCtx.d.ts +4 -11
- package/dist/MutationCtx.d.ts.map +1 -1
- package/dist/MutationCtx.js +1 -1
- package/dist/MutationCtx.js.map +1 -1
- package/dist/MutationRunner.d.ts +8 -13
- package/dist/MutationRunner.d.ts.map +1 -1
- package/dist/MutationRunner.js +4 -3
- package/dist/MutationRunner.js.map +1 -1
- package/dist/OrderedQuery.d.ts +16 -21
- package/dist/OrderedQuery.d.ts.map +1 -1
- package/dist/OrderedQuery.js +4 -1
- package/dist/OrderedQuery.js.map +1 -1
- package/dist/QueryCtx.d.ts +4 -11
- package/dist/QueryCtx.d.ts.map +1 -1
- package/dist/QueryCtx.js +1 -1
- package/dist/QueryCtx.js.map +1 -1
- package/dist/QueryInitializer.d.ts +34 -39
- package/dist/QueryInitializer.d.ts.map +1 -1
- package/dist/QueryInitializer.js +5 -1
- package/dist/QueryInitializer.js.map +1 -1
- package/dist/QueryRunner.d.ts +8 -13
- package/dist/QueryRunner.d.ts.map +1 -1
- package/dist/QueryRunner.js +4 -3
- package/dist/QueryRunner.js.map +1 -1
- package/dist/RegisteredConvexFunction.d.ts +1107 -60
- package/dist/RegisteredConvexFunction.d.ts.map +1 -1
- package/dist/RegisteredConvexFunction.js +14 -9
- package/dist/RegisteredConvexFunction.js.map +1 -1
- package/dist/RegisteredFunction.d.ts +48 -64
- package/dist/RegisteredFunction.d.ts.map +1 -1
- package/dist/RegisteredFunction.js +9 -5
- package/dist/RegisteredFunction.js.map +1 -1
- package/dist/RegisteredFunctions.d.ts +48 -26
- package/dist/RegisteredFunctions.d.ts.map +1 -1
- package/dist/RegisteredFunctions.js +22 -9
- package/dist/RegisteredFunctions.js.map +1 -1
- package/dist/RegisteredNodeFunction.d.ts +4 -14
- package/dist/RegisteredNodeFunction.d.ts.map +1 -1
- package/dist/RegisteredNodeFunction.js +5 -4
- package/dist/RegisteredNodeFunction.js.map +1 -1
- package/dist/RegistryItem.d.ts +17 -27
- package/dist/RegistryItem.d.ts.map +1 -1
- package/dist/RegistryItem.js +1 -1
- package/dist/RegistryItem.js.map +1 -1
- package/dist/Scheduler.d.ts +16 -20
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +10 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/SchemaToValidator.d.ts +71 -64
- package/dist/SchemaToValidator.d.ts.map +1 -1
- package/dist/SchemaToValidator.js +15 -3
- package/dist/SchemaToValidator.js.map +1 -1
- package/dist/StorageActionWriter.d.ts +21 -28
- package/dist/StorageActionWriter.d.ts.map +1 -1
- package/dist/StorageActionWriter.js +4 -1
- package/dist/StorageActionWriter.js.map +1 -1
- package/dist/StorageReader.d.ts +14 -21
- package/dist/StorageReader.d.ts.map +1 -1
- package/dist/StorageReader.js +5 -1
- package/dist/StorageReader.js.map +1 -1
- package/dist/StorageWriter.d.ts +16 -23
- package/dist/StorageWriter.d.ts.map +1 -1
- package/dist/StorageWriter.js +4 -1
- package/dist/StorageWriter.js.map +1 -1
- package/dist/Table.d.ts +204 -197
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +72 -62
- package/dist/Table.js.map +1 -1
- package/dist/TableInfo.d.ts +35 -41
- package/dist/TableInfo.d.ts.map +1 -1
- package/dist/VectorSearch.d.ts +30 -35
- package/dist/VectorSearch.d.ts.map +1 -1
- package/dist/VectorSearch.js +3 -1
- package/dist/VectorSearch.js.map +1 -1
- package/dist/index.d.ts +35 -36
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -5
- package/dist/internal/utils.d.ts +9 -11
- package/dist/internal/utils.d.ts.map +1 -1
- package/dist/internal/utils.js +3 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -0
- package/dist/tsconfig.src.tsbuildinfo +1 -0
- package/package.json +50 -59
- package/src/ActionCtx.ts +1 -1
- package/src/ActionRunner.ts +2 -1
- package/src/Auth.ts +5 -1
- package/src/BlobNotFoundError.ts +1 -1
- package/src/ConvexConfigProvider.ts +6 -8
- package/src/CronJob.ts +1 -1
- package/src/CronJobs.ts +8 -10
- package/src/DatabaseReader.ts +18 -21
- package/src/DatabaseSchema.ts +38 -98
- package/src/DatabaseWriter.ts +13 -6
- package/src/Document.ts +5 -1
- package/src/FunctionImpl.ts +36 -44
- package/src/GroupImpl.ts +54 -81
- package/src/HttpApi.ts +8 -9
- package/src/MutationCtx.ts +1 -1
- package/src/MutationRunner.ts +2 -1
- package/src/OrderedQuery.ts +5 -1
- package/src/QueryCtx.ts +1 -1
- package/src/QueryInitializer.ts +15 -3
- package/src/QueryRunner.ts +2 -1
- package/src/RegisteredConvexFunction.ts +11 -7
- package/src/RegisteredFunction.ts +5 -1
- package/src/RegisteredFunctions.ts +69 -93
- package/src/RegisteredNodeFunction.ts +7 -6
- package/src/RegistryItem.ts +1 -1
- package/src/Scheduler.ts +5 -1
- package/src/SchemaToValidator.ts +14 -16
- package/src/StorageActionWriter.ts +4 -1
- package/src/StorageReader.ts +5 -1
- package/src/StorageWriter.ts +4 -1
- package/src/Table.ts +253 -132
- package/src/VectorSearch.ts +3 -1
- package/src/index.ts +0 -1
- package/src/internal/utils.ts +3 -1
- package/dist/Api.d.ts +0 -30
- package/dist/Api.d.ts.map +0 -1
- package/dist/Api.js +0 -26
- package/dist/Api.js.map +0 -1
- package/dist/GroupPath.d.ts +0 -8
- package/dist/GroupPath.d.ts.map +0 -1
- package/dist/GroupPath.js +0 -10
- package/dist/GroupPath.js.map +0 -1
- package/src/Api.ts +0 -75
- package/src/GroupPath.ts +0 -43
package/dist/Handler.d.ts
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import * as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type
|
|
28
|
-
type
|
|
29
|
-
type
|
|
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
|
|
39
|
-
type WithName<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps, FunctionName extends string> = Handler<DatabaseSchema_, FunctionSpec.WithName<FunctionSpec_, FunctionName>>;
|
|
40
|
-
|
|
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
|
package/dist/Handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.d.ts","
|
|
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,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,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,MAA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AY,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 {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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) =>
|
|
26
|
-
|
|
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
|
package/dist/HttpApi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpApi.d.ts","
|
|
1
|
+
{"version":3,"file":"HttpApi.d.ts","sourceRoot":"","sources":["../src/HttpApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KA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AM,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
|
|
10
|
-
import { StorageReader
|
|
11
|
-
import { StorageWriter
|
|
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
|
|
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
|
|
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: {
|
package/dist/HttpApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpApi.js","names":["QueryRunner.layer","MutationRunner.layer","ActionRunner.layer","Scheduler.layer","Auth.layer","
|
|
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,Q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
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","
|
|
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"}
|
package/dist/MutationCtx.js
CHANGED
package/dist/MutationCtx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationCtx.js","names":[],"sources":["../src/MutationCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericMutationCtx } from \"convex/server\";\nimport
|
|
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"}
|
package/dist/MutationRunner.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare
|
|
7
|
-
|
|
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","
|
|
1
|
+
{"version":3,"file":"MutationRunner.d.ts","sourceRoot":"","sources":["../src/MutationRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAkBtC,eAAO,MAAM,cAAc,gBAdxB,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,IANA,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,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"}
|
package/dist/MutationRunner.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import * as 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
|
|
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":[
|
|
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"}
|
package/dist/OrderedQuery.d.ts
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
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","
|
|
1
|
+
{"version":3,"file":"OrderedQuery.d.ts","sourceRoot":"","sources":["../src/OrderedQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,IAAI,kBAAkB,EAClC,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,YAAY,CACtB,UAAU,SAAS,SAAS,CAAC,YAAY,EACzC,UAAU,SAAS,MAAM,IACvB;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC,MAAM,CACjC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EACrC,QAAQ,CAAC,mBAAmB,CAC7B,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE,CACb,CAAC,EAAE,MAAM,KACN,MAAM,CAAC,MAAM,CAChB,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EACrC,QAAQ,CAAC,mBAAmB,CAC7B,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,CACnC,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EACrC,QAAQ,CAAC,mBAAmB,CAC7B,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,CAClC,UAAU,CAAC,UAAU,CAAC,EACtB,QAAQ,CAAC,mBAAmB,CAC7B,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,CACjB,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;KAClB,EACD,MAAM,CAAC,EAAE,CACP,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,KACpD,iBAAiB,CAAC,OAAO,CAAC,KAC5B,MAAM,CAAC,MAAM,CAChB,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EACxC,QAAQ,CAAC,mBAAmB,CAC7B,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,IAAI,GACf,UAAU,SAAS,SAAS,CAAC,YAAY,EACzC,SAAS,SAAS,MAAM,EAExB,OAAO,kBAAkB,CAAC,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAChE,WAAW,SAAS,EACpB,aAAa,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,KAC7C,YAAY,CAAC,UAAU,EAAE,SAAS,CAgEpC,CAAC"}
|
package/dist/OrderedQuery.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { decode } from "./Document.js";
|
|
3
|
-
import {
|
|
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 });
|
package/dist/OrderedQuery.js.map
CHANGED
|
@@ -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 {
|
|
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"}
|
package/dist/QueryCtx.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/dist/QueryCtx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryCtx.d.ts","
|
|
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
package/dist/QueryCtx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryCtx.js","names":[],"sources":["../src/QueryCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericQueryCtx } from \"convex/server\";\nimport
|
|
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"}
|