@gaganref/confect-server 10.3.1-fork.1 → 10.3.1-fork.11
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/dist/ActionCtx.d.ts +1 -1
- package/dist/ActionCtx.d.ts.map +1 -1
- package/dist/ActionCtx.js.map +1 -1
- package/dist/AiGatewayDecisionClient.d.ts +2 -2
- package/dist/AiGatewayDecisionClient.d.ts.map +1 -1
- package/dist/AiGatewayDecisionClient.js.map +1 -1
- package/dist/AiGatewayLanguageClient.d.ts +2 -2
- package/dist/AiGatewayLanguageClient.d.ts.map +1 -1
- package/dist/AiGatewayLanguageClient.js.map +1 -1
- package/dist/Auth.d.ts +1 -1
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js.map +1 -1
- package/dist/ComponentCtx.d.ts +1 -1
- package/dist/ComponentCtx.d.ts.map +1 -1
- package/dist/ConvexFunctionDefinitions.d.ts +4 -4
- package/dist/ConvexFunctionDefinitions.d.ts.map +1 -1
- package/dist/ConvexFunctionDefinitions.js.map +1 -1
- package/dist/CronJobs.d.ts +1 -1
- package/dist/CronJobs.d.ts.map +1 -1
- package/dist/CronJobs.js.map +1 -1
- package/dist/DataModel.d.ts +3 -3
- package/dist/DataModel.d.ts.map +1 -1
- package/dist/DataModel.js.map +1 -1
- package/dist/DatabaseReader.d.ts +4 -4
- package/dist/DatabaseReader.d.ts.map +1 -1
- package/dist/DatabaseReader.js.map +1 -1
- package/dist/DatabaseSchema.d.ts +1 -1
- package/dist/DatabaseSchema.d.ts.map +1 -1
- package/dist/DatabaseSchema.js.map +1 -1
- package/dist/DatabaseWriter.d.ts +5 -5
- package/dist/DatabaseWriter.d.ts.map +1 -1
- package/dist/DatabaseWriter.js.map +1 -1
- package/dist/Document.d.ts +4 -4
- package/dist/Document.d.ts.map +1 -1
- package/dist/Document.js.map +1 -1
- package/dist/FunctionImpl.d.ts +2 -2
- package/dist/FunctionImpl.d.ts.map +1 -1
- package/dist/FunctionImpl.js.map +1 -1
- package/dist/FunctionRegistryItem.d.ts +1 -1
- package/dist/FunctionRegistryItem.d.ts.map +1 -1
- package/dist/FunctionRegistryItem.js.map +1 -1
- package/dist/GroupImpl.d.ts +3 -3
- package/dist/GroupImpl.d.ts.map +1 -1
- package/dist/GroupImpl.js.map +1 -1
- package/dist/GroupRegistry.d.ts +2 -2
- package/dist/GroupRegistry.d.ts.map +1 -1
- package/dist/GroupRegistry.js.map +1 -1
- package/dist/Handler.d.ts +23 -23
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js.map +1 -1
- package/dist/HttpRouter.d.ts +13 -13
- package/dist/HttpRouter.d.ts.map +1 -1
- package/dist/HttpRouter.js.map +1 -1
- package/dist/MiddlewareImpl.d.ts +14 -14
- package/dist/MiddlewareImpl.d.ts.map +1 -1
- package/dist/MiddlewareImpl.js.map +1 -1
- package/dist/MutationCtx.d.ts +1 -1
- package/dist/MutationCtx.d.ts.map +1 -1
- package/dist/MutationCtx.js.map +1 -1
- package/dist/MutationRunner.d.ts +1 -1
- package/dist/MutationRunner.d.ts.map +1 -1
- package/dist/MutationRunner.js.map +1 -1
- package/dist/MutationTransactionContext.d.ts +2 -2
- package/dist/MutationTransactionContext.d.ts.map +1 -1
- package/dist/MutationTransactionContext.js.map +1 -1
- package/dist/OfficialComponent.d.ts +50 -0
- package/dist/OfficialComponent.d.ts.map +1 -0
- package/dist/OfficialComponent.js +70 -0
- package/dist/OfficialComponent.js.map +1 -0
- package/dist/OrderedQuery.d.ts +4 -4
- package/dist/OrderedQuery.d.ts.map +1 -1
- package/dist/OrderedQuery.js.map +1 -1
- package/dist/QueryCtx.d.ts +1 -1
- package/dist/QueryCtx.d.ts.map +1 -1
- package/dist/QueryCtx.js.map +1 -1
- package/dist/QueryInitializer.d.ts +10 -10
- package/dist/QueryInitializer.d.ts.map +1 -1
- package/dist/QueryInitializer.js.map +1 -1
- package/dist/QueryRunner.d.ts +2 -2
- package/dist/QueryRunner.d.ts.map +1 -1
- package/dist/QueryRunner.js.map +1 -1
- package/dist/QueryStream.d.ts +11 -11
- package/dist/QueryStream.d.ts.map +1 -1
- package/dist/QueryStream.js.map +1 -1
- package/dist/QueryStreamCursor.d.ts +2 -2
- package/dist/QueryStreamCursor.d.ts.map +1 -1
- package/dist/QueryStreamCursor.js.map +1 -1
- package/dist/QueryStreamIndexPrefix.d.ts +2 -2
- package/dist/QueryStreamIndexPrefix.d.ts.map +1 -1
- package/dist/QueryStreamIndexPrefix.js.map +1 -1
- package/dist/QueryStreamIndexRange.d.ts +4 -4
- package/dist/QueryStreamIndexRange.d.ts.map +1 -1
- package/dist/QueryStreamIndexRange.js.map +1 -1
- package/dist/QueryStreamKey.d.ts +2 -2
- package/dist/QueryStreamKey.d.ts.map +1 -1
- package/dist/QueryStreamKey.js.map +1 -1
- package/dist/QueryStreamKeyBounds.d.ts +3 -3
- package/dist/QueryStreamKeyBounds.d.ts.map +1 -1
- package/dist/QueryStreamKeyBounds.js.map +1 -1
- package/dist/QueryStreamKeyLayout.d.ts +1 -1
- package/dist/QueryStreamKeyLayout.d.ts.map +1 -1
- package/dist/QueryStreamKeyLayout.js.map +1 -1
- package/dist/QueryStreamKeyValues.d.ts +1 -1
- package/dist/QueryStreamKeyValues.d.ts.map +1 -1
- package/dist/QueryStreamKeyValues.js.map +1 -1
- package/dist/QueryStreamPagination.d.ts +1 -1
- package/dist/QueryStreamPagination.d.ts.map +1 -1
- package/dist/QueryStreamPagination.js.map +1 -1
- package/dist/RegisteredConvexFunction.d.ts +20 -20
- package/dist/RegisteredConvexFunction.d.ts.map +1 -1
- package/dist/RegisteredConvexFunction.js.map +1 -1
- package/dist/RegisteredFunction.d.ts +26 -26
- package/dist/RegisteredFunction.d.ts.map +1 -1
- package/dist/RegisteredFunction.js.map +1 -1
- package/dist/RegisteredFunctions.d.ts +3 -3
- package/dist/RegisteredFunctions.d.ts.map +1 -1
- package/dist/RegisteredFunctions.js.map +1 -1
- package/dist/RegisteredNodeFunction.d.ts +6 -6
- package/dist/RegisteredNodeFunction.d.ts.map +1 -1
- package/dist/RegisteredNodeFunction.js.map +1 -1
- package/dist/Registry.d.ts +1 -1
- package/dist/Registry.d.ts.map +1 -1
- package/dist/Registry.js.map +1 -1
- package/dist/RegistryItems.js.map +1 -1
- package/dist/ResolvedMiddleware.d.ts +2 -2
- package/dist/ResolvedMiddleware.d.ts.map +1 -1
- package/dist/ResolvedMiddleware.js.map +1 -1
- package/dist/Storage.d.ts +6 -6
- package/dist/Storage.d.ts.map +1 -1
- package/dist/Storage.js.map +1 -1
- package/dist/StorageActionWriter.d.ts +1 -1
- package/dist/StorageActionWriter.d.ts.map +1 -1
- package/dist/StorageActionWriter.js.map +1 -1
- package/dist/StorageReader.d.ts +1 -1
- package/dist/StorageReader.d.ts.map +1 -1
- package/dist/StorageReader.js.map +1 -1
- package/dist/StorageWriter.d.ts +1 -1
- package/dist/StorageWriter.d.ts.map +1 -1
- package/dist/StorageWriter.js.map +1 -1
- package/dist/TableInfo.d.ts +2 -2
- package/dist/TableInfo.d.ts.map +1 -1
- package/dist/TableInfo.js.map +1 -1
- package/dist/VectorSearch.d.ts +1 -1
- package/dist/VectorSearch.d.ts.map +1 -1
- package/dist/VectorSearch.js.map +1 -1
- package/dist/index.d.ts +61 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/internal/AiGatewayDecisionClient.d.ts +1 -1
- package/dist/internal/AiGatewayDecisionClient.d.ts.map +1 -1
- package/dist/internal/AiGatewayDecisionClient.js.map +1 -1
- package/dist/internal/AiGatewayLanguageClient.d.ts +1 -1
- package/dist/internal/AiGatewayLanguageClient.d.ts.map +1 -1
- package/dist/internal/AiGatewayLanguageClient.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ActionCtx.ts +1 -1
- package/src/AiGatewayDecisionClient.ts +3 -3
- package/src/AiGatewayLanguageClient.ts +3 -3
- package/src/Auth.ts +1 -1
- package/src/ComponentCtx.ts +1 -1
- package/src/ConvexFunctionDefinitions.ts +8 -8
- package/src/CronJobs.ts +1 -1
- package/src/DataModel.ts +3 -3
- package/src/DatabaseReader.ts +4 -4
- package/src/DatabaseSchema.ts +1 -1
- package/src/DatabaseWriter.ts +6 -6
- package/src/Document.ts +4 -4
- package/src/FunctionImpl.ts +5 -5
- package/src/FunctionRegistryItem.ts +1 -1
- package/src/GroupImpl.ts +5 -5
- package/src/GroupRegistry.ts +4 -4
- package/src/Handler.ts +23 -23
- package/src/HttpRouter.ts +17 -17
- package/src/MiddlewareImpl.ts +17 -17
- package/src/MutationCtx.ts +1 -1
- package/src/MutationRunner.ts +1 -1
- package/src/MutationTransactionContext.ts +2 -2
- package/src/OfficialComponent.ts +151 -0
- package/src/OrderedQuery.ts +4 -4
- package/src/QueryCtx.ts +1 -1
- package/src/QueryInitializer.ts +9 -9
- package/src/QueryRunner.ts +2 -2
- package/src/QueryStream.ts +15 -15
- package/src/QueryStreamCursor.ts +3 -3
- package/src/QueryStreamIndexPrefix.ts +2 -2
- package/src/QueryStreamIndexRange.ts +4 -4
- package/src/QueryStreamKey.ts +2 -2
- package/src/QueryStreamKeyBounds.ts +3 -3
- package/src/QueryStreamKeyLayout.ts +1 -1
- package/src/QueryStreamKeyValues.ts +1 -1
- package/src/QueryStreamPagination.ts +2 -2
- package/src/RegisteredConvexFunction.ts +21 -21
- package/src/RegisteredFunction.ts +18 -18
- package/src/RegisteredFunctions.ts +4 -4
- package/src/RegisteredNodeFunction.ts +8 -8
- package/src/Registry.ts +1 -1
- package/src/RegistryItems.ts +2 -2
- package/src/ResolvedMiddleware.ts +2 -2
- package/src/Storage.ts +3 -3
- package/src/StorageActionWriter.ts +1 -1
- package/src/StorageReader.ts +1 -1
- package/src/StorageWriter.ts +1 -1
- package/src/TableInfo.ts +2 -2
- package/src/VectorSearch.ts +1 -1
- package/src/index.ts +61 -60
- package/src/internal/AiGatewayDecisionClient.ts +2 -2
- package/src/internal/AiGatewayLanguageClient.ts +2 -2
- package/src/node.ts +1 -1
package/dist/FunctionImpl.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
|
3
3
|
import type * as MiddlewareSpec from "@confect/core/MiddlewareSpec";
|
|
4
4
|
import * as Context from "effect/Context";
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
7
|
-
import type * as Handler from "./Handler";
|
|
6
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
7
|
+
import type * as Handler from "./Handler.js";
|
|
8
8
|
export interface FunctionImpl<Name_ extends string> {
|
|
9
9
|
readonly name: Name_;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionImpl.d.ts","sourceRoot":"","sources":["../src/FunctionImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,cAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"FunctionImpl.d.ts","sourceRoot":"","sources":["../src/FunctionImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAC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.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionImpl.js","names":["Registry.Registry","FunctionRegistryItem.make"],"sources":["../src/FunctionImpl.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as MiddlewareSpec from \"@confect/core/MiddlewareSpec\";\nimport * as Registry from \"./Registry\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as Handler from \"./Handler\";\nimport { setNestedProperty } from \"./internal/utils\";\nimport * as FunctionRegistryItem from \"./FunctionRegistryItem\";\n\nexport interface FunctionImpl<Name_ extends string> {\n readonly name: Name_;\n}\n\nexport const FunctionImpl = <Name_ extends string>({ name }: { name: Name_ }) =>\n Context.Service<FunctionImpl<Name_>>(`@confect/server/FunctionImpl/${name}`);\n\n/**\n * Register a single function's implementation into the group's `Registry`.\n *\n * The function is registered under a flat, single-segment key (its own `name`),\n * not a project-wide dot-path. Each group's impl layer is built in\n * isolation—`RegisteredFunctions.buildForGroup` (and the CLI's `validateImpl`)\n * provide a fresh `Registry` per group—so function names only need to be unique\n * within their own group.\n *\n * `databaseSchema` is retained purely as a type-level carrier: the handler's\n * ctx-service requirements (`DatabaseReader`, `QueryCtx<DataModel>`, …) are\n * derived from it via `Handler.WithName`. It is not read at runtime—the\n * generated per-group registry forwards the schema value to the function\n * builders—so impls depend on `_generated/schema` (table schemas) rather than\n * `_generated/api` (which transitively imports every function spec).\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n const Name_ extends FunctionSpec.Name<GroupSpec.Functions<Group>>,\n>(\n _databaseSchema: DatabaseSchema_,\n group: Group,\n name: Name_,\n handler: Handler.WithName<\n DatabaseSchema_,\n GroupSpec.Functions<Group>,\n Name_,\n MiddlewareSpec.Provides<\n | GroupSpec.MiddlewareSpecs<Group>\n | FunctionSpec.MiddlewareSpecs<\n FunctionSpec.WithName<GroupSpec.Functions<Group>, Name_>\n >\n >\n >,\n): Layer.Layer<FunctionImpl<Name_>> => {\n const functionSpec = group.functions[name]!;\n\n return Layer.effect(\n FunctionImpl<Name_>({ name }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n\n yield* Ref.update(registry, (registryItems) =>\n setNestedProperty(\n registryItems,\n [name],\n FunctionRegistryItem.make({\n functionSpec,\n groupMiddlewareAttachments: group.middlewareAttachments,\n handler,\n }),\n ),\n );\n\n return { name };\n }),\n );\n};\n\n/**\n * Get the function implementation service type for a specific function name.\n */\nexport type ForFunction<Name_ extends string> = FunctionImpl<Name_>;\n\n/**\n * Get all function implementation services required for a group spec.\n */\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n FunctionSpec.Name<\n GroupSpec.Functions<Group>\n > extends infer FunctionNames extends string\n ? FunctionNames extends string\n ? FunctionImpl<FunctionNames>\n : never\n : never;\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAa,gBAAsC,EAAE,WACnD,QAAQ,QAA6B,gCAAgC,MAAM;;;;;;;;;;;;;;;;;AAkB7E,MAAa,QAKX,iBACA,OACA,MACA,YAWqC;CACrC,MAAM,eAAe,MAAM,UAAU;CAErC,OAAO,MAAM,OACX,aAAoB,EAAE,KAAK,CAAC,GAC5B,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAOA;EAExB,OAAO,IAAI,OAAO,WAAW,kBAC3B,kBACE,eACA,CAAC,IAAI,GACLC,OAA0B;GACxB;GACA,4BAA4B,MAAM;GAClC;EACF,CAAC,CACH,CACF;EAEA,OAAO,EAAE,KAAK;CAChB,CAAC,CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"FunctionImpl.js","names":["Registry.Registry","FunctionRegistryItem.make"],"sources":["../src/FunctionImpl.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as MiddlewareSpec from \"@confect/core/MiddlewareSpec\";\nimport * as Registry from \"./Registry.js\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as Handler from \"./Handler.js\";\nimport { setNestedProperty } from \"./internal/utils.js\";\nimport * as FunctionRegistryItem from \"./FunctionRegistryItem.js\";\n\nexport interface FunctionImpl<Name_ extends string> {\n readonly name: Name_;\n}\n\nexport const FunctionImpl = <Name_ extends string>({ name }: { name: Name_ }) =>\n Context.Service<FunctionImpl<Name_>>(`@confect/server/FunctionImpl/${name}`);\n\n/**\n * Register a single function's implementation into the group's `Registry`.\n *\n * The function is registered under a flat, single-segment key (its own `name`),\n * not a project-wide dot-path. Each group's impl layer is built in\n * isolation—`RegisteredFunctions.buildForGroup` (and the CLI's `validateImpl`)\n * provide a fresh `Registry` per group—so function names only need to be unique\n * within their own group.\n *\n * `databaseSchema` is retained purely as a type-level carrier: the handler's\n * ctx-service requirements (`DatabaseReader`, `QueryCtx<DataModel>`, …) are\n * derived from it via `Handler.WithName`. It is not read at runtime—the\n * generated per-group registry forwards the schema value to the function\n * builders—so impls depend on `_generated/schema` (table schemas) rather than\n * `_generated/api` (which transitively imports every function spec).\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n const Name_ extends FunctionSpec.Name<GroupSpec.Functions<Group>>,\n>(\n _databaseSchema: DatabaseSchema_,\n group: Group,\n name: Name_,\n handler: Handler.WithName<\n DatabaseSchema_,\n GroupSpec.Functions<Group>,\n Name_,\n MiddlewareSpec.Provides<\n | GroupSpec.MiddlewareSpecs<Group>\n | FunctionSpec.MiddlewareSpecs<\n FunctionSpec.WithName<GroupSpec.Functions<Group>, Name_>\n >\n >\n >,\n): Layer.Layer<FunctionImpl<Name_>> => {\n const functionSpec = group.functions[name]!;\n\n return Layer.effect(\n FunctionImpl<Name_>({ name }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n\n yield* Ref.update(registry, (registryItems) =>\n setNestedProperty(\n registryItems,\n [name],\n FunctionRegistryItem.make({\n functionSpec,\n groupMiddlewareAttachments: group.middlewareAttachments,\n handler,\n }),\n ),\n );\n\n return { name };\n }),\n );\n};\n\n/**\n * Get the function implementation service type for a specific function name.\n */\nexport type ForFunction<Name_ extends string> = FunctionImpl<Name_>;\n\n/**\n * Get all function implementation services required for a group spec.\n */\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n FunctionSpec.Name<\n GroupSpec.Functions<Group>\n > extends infer FunctionNames extends string\n ? FunctionNames extends string\n ? FunctionImpl<FunctionNames>\n : never\n : never;\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAa,gBAAsC,EAAE,WACnD,QAAQ,QAA6B,gCAAgC,MAAM;;;;;;;;;;;;;;;;;AAkB7E,MAAa,QAKX,iBACA,OACA,MACA,YAWqC;CACrC,MAAM,eAAe,MAAM,UAAU;CAErC,OAAO,MAAM,OACX,aAAoB,EAAE,KAAK,CAAC,GAC5B,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAOA;EAExB,OAAO,IAAI,OAAO,WAAW,kBAC3B,kBACE,eACA,CAAC,IAAI,GACLC,OAA0B;GACxB;GACA,4BAA4B,MAAM;GAClC;EACF,CAAC,CACH,CACF;EAEA,OAAO,EAAE,KAAK;CAChB,CAAC,CACH;AACF"}
|
|
@@ -2,7 +2,7 @@ import type * as MiddlewareAttachment from "@confect/core/MiddlewareAttachment";
|
|
|
2
2
|
import type * as FunctionSpec from "@confect/core/FunctionSpec";
|
|
3
3
|
import type { FunctionType, FunctionVisibility } from "convex/server";
|
|
4
4
|
import type * as Schema from "effect/Schema";
|
|
5
|
-
import type * as Handler from "./Handler";
|
|
5
|
+
import type * as Handler from "./Handler.js";
|
|
6
6
|
export declare const TypeId = "~@confect/server/FunctionRegistryItem";
|
|
7
7
|
export type TypeId = typeof TypeId;
|
|
8
8
|
export declare const isFunctionRegistryItem: (value: unknown) => value is AnyWithProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionRegistryItem.d.ts","sourceRoot":"","sources":["../src/FunctionRegistryItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,oBAAoB,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"FunctionRegistryItem.d.ts","sourceRoot":"","sources":["../src/FunctionRegistryItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,oBAAoB,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,OAAO,MAAM,cAAc,CAAC;AAE7C,eAAO,MAAM,MAAM,0CAA0C,CAAC;AAC9D,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,eAAO,MAAM,sBAAsB,UAAW,OAAO,KAAG,KAAK,IAAI,YAC3B,CAAC;AAMvC;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,2BAA2B,GAC3B,0BAA0B,CAAC;AAE/B,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxC,QAAQ,CAAC,qBAAqB,EAAE,aAAa,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IACzF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC;CAChD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC;CAC/C;AAED,eAAO,MAAM,IAAI,2DAId;IACD,YAAY,EAAE,YAAY,CAAC,YAAY,CAAC;IACxC,0BAA0B,EAAE,aAAa,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IACrF,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;CACtB,KAAG,YA8BD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionRegistryItem.js","names":[],"sources":["../src/FunctionRegistryItem.ts"],"sourcesContent":["import type * as MiddlewareAttachment from \"@confect/core/MiddlewareAttachment\";\nimport type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport * as Lazy from \"@confect/core/Lazy\";\nimport type { FunctionType, FunctionVisibility } from \"convex/server\";\nimport * as Match from \"effect/Match\";\nimport * as Predicate from \"effect/Predicate\";\nimport type * as Schema from \"effect/Schema\";\nimport type * as Handler from \"./Handler\";\n\nexport const TypeId = \"~@confect/server/FunctionRegistryItem\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionRegistryItem = (value: unknown): value is AnyWithProps =>\n Predicate.hasProperty(value, TypeId);\n\nconst FunctionRegistryItemProto = {\n [TypeId]: TypeId,\n};\n\n/**\n * A function registered by `FunctionImpl.make`, one of two shapes keyed by the\n * spec's provenance.\n */\nexport type AnyWithProps =\n | ConfectFunctionRegistryItem\n | ConvexFunctionRegistryItem;\n\nexport interface ConfectFunctionRegistryItem {\n readonly [TypeId]: TypeId;\n readonly _tag: \"Confect\";\n readonly name: string;\n readonly functionVisibility: FunctionVisibility;\n readonly functionType: FunctionType;\n readonly args: Schema.Codec<any, any>;\n readonly returns: Schema.Codec<any, any>;\n readonly error?: Schema.Codec<any, any>;\n readonly middlewareAttachments: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>;\n readonly handler: Handler.AnyConfectProvenance;\n}\n\nexport interface ConvexFunctionRegistryItem {\n readonly [TypeId]: TypeId;\n readonly _tag: \"Convex\";\n readonly handler: Handler.AnyConvexProvenance;\n}\n\nexport const make = ({\n functionSpec,\n groupMiddlewareAttachments,\n handler,\n}: {\n functionSpec: FunctionSpec.AnyWithProps;\n groupMiddlewareAttachments: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>;\n handler: Handler.Any;\n}): AnyWithProps =>\n Match.value(functionSpec.functionProvenance).pipe(\n Match.tag(\"Convex\", (): AnyWithProps =>\n Object.assign(Object.create(FunctionRegistryItemProto), {\n _tag: \"Convex\" as const,\n handler: handler as Handler.AnyConvexProvenance,\n }),\n ),\n Match.tag(\"Confect\", (provenance): AnyWithProps => {\n const item = Object.assign(Object.create(FunctionRegistryItemProto), {\n _tag: \"Confect\" as const,\n name: functionSpec.name,\n functionVisibility: functionSpec.functionVisibility,\n functionType: functionSpec.runtimeAndFunctionType.functionType,\n middlewareAttachments: [\n ...groupMiddlewareAttachments,\n ...functionSpec.middlewareAttachments,\n ],\n handler: handler as Handler.AnyConfectProvenance,\n });\n\n Lazy.defineProperty(item, \"args\", () => provenance.args);\n Lazy.defineProperty(item, \"returns\", () => provenance.returns);\n if (\"error\" in provenance) {\n Lazy.defineProperty(item, \"error\", () => provenance.error);\n }\n\n return item as AnyWithProps;\n }),\n Match.exhaustive,\n );\n"],"mappings":";;;;;;;;;;AASA,MAAa,SAAS;AAGtB,MAAa,0BAA0B,UACrC,UAAU,YAAY,OAAO,MAAM;AAErC,MAAM,4BAA4B,GAC/B,SAAS,OACZ;AA6BA,MAAa,QAAQ,EACnB,cACA,4BACA,cAMA,MAAM,MAAM,aAAa,kBAAkB,CAAC,CAAC,KAC3C,MAAM,IAAI,gBACR,OAAO,OAAO,OAAO,OAAO,yBAAyB,GAAG;CACtD,MAAM;CACG;AACX,CAAC,CACH,GACA,MAAM,IAAI,YAAY,eAA6B;CACjD,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,yBAAyB,GAAG;EACnE,MAAM;EACN,MAAM,aAAa;EACnB,oBAAoB,aAAa;EACjC,cAAc,aAAa,uBAAuB;EAClD,uBAAuB,CACrB,GAAG,4BACH,GAAG,aAAa,qBAClB;EACS;CACX,CAAC;CAED,KAAK,eAAe,MAAM,cAAc,WAAW,IAAI;CACvD,KAAK,eAAe,MAAM,iBAAiB,WAAW,OAAO;CAC7D,IAAI,WAAW,YACb,KAAK,eAAe,MAAM,eAAe,WAAW,KAAK;CAG3D,OAAO;AACT,CAAC,GACD,MAAM,UACR"}
|
|
1
|
+
{"version":3,"file":"FunctionRegistryItem.js","names":[],"sources":["../src/FunctionRegistryItem.ts"],"sourcesContent":["import type * as MiddlewareAttachment from \"@confect/core/MiddlewareAttachment\";\nimport type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport * as Lazy from \"@confect/core/Lazy\";\nimport type { FunctionType, FunctionVisibility } from \"convex/server\";\nimport * as Match from \"effect/Match\";\nimport * as Predicate from \"effect/Predicate\";\nimport type * as Schema from \"effect/Schema\";\nimport type * as Handler from \"./Handler.js\";\n\nexport const TypeId = \"~@confect/server/FunctionRegistryItem\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionRegistryItem = (value: unknown): value is AnyWithProps =>\n Predicate.hasProperty(value, TypeId);\n\nconst FunctionRegistryItemProto = {\n [TypeId]: TypeId,\n};\n\n/**\n * A function registered by `FunctionImpl.make`, one of two shapes keyed by the\n * spec's provenance.\n */\nexport type AnyWithProps =\n | ConfectFunctionRegistryItem\n | ConvexFunctionRegistryItem;\n\nexport interface ConfectFunctionRegistryItem {\n readonly [TypeId]: TypeId;\n readonly _tag: \"Confect\";\n readonly name: string;\n readonly functionVisibility: FunctionVisibility;\n readonly functionType: FunctionType;\n readonly args: Schema.Codec<any, any>;\n readonly returns: Schema.Codec<any, any>;\n readonly error?: Schema.Codec<any, any>;\n readonly middlewareAttachments: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>;\n readonly handler: Handler.AnyConfectProvenance;\n}\n\nexport interface ConvexFunctionRegistryItem {\n readonly [TypeId]: TypeId;\n readonly _tag: \"Convex\";\n readonly handler: Handler.AnyConvexProvenance;\n}\n\nexport const make = ({\n functionSpec,\n groupMiddlewareAttachments,\n handler,\n}: {\n functionSpec: FunctionSpec.AnyWithProps;\n groupMiddlewareAttachments: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>;\n handler: Handler.Any;\n}): AnyWithProps =>\n Match.value(functionSpec.functionProvenance).pipe(\n Match.tag(\"Convex\", (): AnyWithProps =>\n Object.assign(Object.create(FunctionRegistryItemProto), {\n _tag: \"Convex\" as const,\n handler: handler as Handler.AnyConvexProvenance,\n }),\n ),\n Match.tag(\"Confect\", (provenance): AnyWithProps => {\n const item = Object.assign(Object.create(FunctionRegistryItemProto), {\n _tag: \"Confect\" as const,\n name: functionSpec.name,\n functionVisibility: functionSpec.functionVisibility,\n functionType: functionSpec.runtimeAndFunctionType.functionType,\n middlewareAttachments: [\n ...groupMiddlewareAttachments,\n ...functionSpec.middlewareAttachments,\n ],\n handler: handler as Handler.AnyConfectProvenance,\n });\n\n Lazy.defineProperty(item, \"args\", () => provenance.args);\n Lazy.defineProperty(item, \"returns\", () => provenance.returns);\n if (\"error\" in provenance) {\n Lazy.defineProperty(item, \"error\", () => provenance.error);\n }\n\n return item as AnyWithProps;\n }),\n Match.exhaustive,\n );\n"],"mappings":";;;;;;;;;;AASA,MAAa,SAAS;AAGtB,MAAa,0BAA0B,UACrC,UAAU,YAAY,OAAO,MAAM;AAErC,MAAM,4BAA4B,GAC/B,SAAS,OACZ;AA6BA,MAAa,QAAQ,EACnB,cACA,4BACA,cAMA,MAAM,MAAM,aAAa,kBAAkB,CAAC,CAAC,KAC3C,MAAM,IAAI,gBACR,OAAO,OAAO,OAAO,OAAO,yBAAyB,GAAG;CACtD,MAAM;CACG;AACX,CAAC,CACH,GACA,MAAM,IAAI,YAAY,eAA6B;CACjD,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,yBAAyB,GAAG;EACnE,MAAM;EACN,MAAM,aAAa;EACnB,oBAAoB,aAAa;EACjC,cAAc,aAAa,uBAAuB;EAClD,uBAAuB,CACrB,GAAG,4BACH,GAAG,aAAa,qBAClB;EACS;CACX,CAAC;CAED,KAAK,eAAe,MAAM,cAAc,WAAW,IAAI;CACvD,KAAK,eAAe,MAAM,iBAAiB,WAAW,OAAO;CAC7D,IAAI,WAAW,YACb,KAAK,eAAe,MAAM,eAAe,WAAW,KAAK;CAG3D,OAAO;AACT,CAAC,GACD,MAAM,UACR"}
|
package/dist/GroupImpl.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
|
2
2
|
import type * as MiddlewareSpec from "@confect/core/MiddlewareSpec";
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
6
|
-
import type * as FunctionImpl from "./FunctionImpl";
|
|
7
|
-
import type * as MiddlewareImpl from "./MiddlewareImpl";
|
|
5
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
6
|
+
import type * as FunctionImpl from "./FunctionImpl.js";
|
|
7
|
+
import type * as MiddlewareImpl from "./MiddlewareImpl.js";
|
|
8
8
|
export declare const TypeId = "~@confect/server/GroupImpl";
|
|
9
9
|
export type TypeId = typeof TypeId;
|
|
10
10
|
export type FinalizationStatus = "Unfinalized" | "Finalized";
|
package/dist/GroupImpl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupImpl.d.ts","sourceRoot":"","sources":["../src/GroupImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAIpE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,KAAK,KAAK,cAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"GroupImpl.d.ts","sourceRoot":"","sources":["../src/GroupImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAIpE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,KAAK,YAAY,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAE3D,eAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC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AAC,EACxB,KAAK,EACL,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CActE,CAAC;AAOJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,UACZ,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,KAC3C,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CA6BlC,CAAC;AAEJ,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,SAAS,CAAC,YAAY,IAC1D,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,GACjC,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC"}
|
package/dist/GroupImpl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupImpl.js","names":["Registry.Registry","RegistryItems.functionNames","RegistryItems.middlewareKeys"],"sources":["../src/GroupImpl.ts"],"sourcesContent":["import type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as MiddlewareSpec from \"@confect/core/MiddlewareSpec\";\nimport * as Registry from \"./Registry\";\nimport * as RegistryItems from \"./RegistryItems\";\nimport * as Array from \"effect/Array\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as FunctionImpl from \"./FunctionImpl\";\nimport type * as MiddlewareImpl from \"./MiddlewareImpl\";\n\nexport const TypeId = \"~@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\n readonly finalizationStatus: FinalizationStatus_;\n /**\n * Names of every function registered into this group's layer scope by\n * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is\n * `\"Finalized\"`; the `\"Unfinalized\"` value is set to `[]` at `make`-time\n * since the list is only known once `finalize` snapshots the registry.\n */\n readonly registeredFunctionNames: ReadonlyArray<string>;\n /**\n * Keys of every middleware whose implementation registered into this group's\n * layer scope via `MiddlewareImpl.make` (and friends). Same authoritativeness\n * caveat as `registeredFunctionNames`. Lets consumers (the CLI's\n * `validateImpl`) verify middleware-impl completeness against a `GroupSpec`'s\n * attached middleware without inspecting the `Registry`.\n */\n readonly registeredMiddlewareKeys: ReadonlyArray<string>;\n}\n\nexport interface Any extends GroupImpl<FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<\"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<\"Unfinalized\"> {}\n\nexport const isFinalizedGroupImpl = (u: unknown): u is AnyFinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Finalized\";\n\nexport const isUnfinalizedGroupImpl = (u: unknown): u is AnyUnfinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Unfinalized\";\n\n/**\n * Build the runtime tag for a `GroupImpl` service. The finalization status is\n * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct\n * services at runtime; consumers of a finalized layer (the server's\n * `RegisteredFunctions.buildForGroup` and the CLI's `validateImpl`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n *\n * The tag is keyed only by finalization status—no group path—because each\n * group's impl layer is built in its own isolated scope\n * (`buildForGroup`/`validateImpl` each provide a fresh `Registry`), so at most\n * one `GroupImpl` service of each status exists per build.\n */\nexport const GroupImpl = <FinalizationStatus_ extends FinalizationStatus>({\n finalizationStatus,\n}: {\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.Service<GroupImpl<FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}`,\n );\n\n/**\n * Begin a group's impl layer. `databaseSchema` and `group` are retained only as\n * type-level carriers (`group` drives the required `FunctionImpl` services via\n * `FromGroupSpec<Group>`; `databaseSchema` keeps the impl's dependency on\n * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at\n * runtime.\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n _databaseSchema: DatabaseSchema_,\n _group: Group &\n MiddlewareSpec.ValidateImplRequires<\n GroupSpec.Functions<Group>,\n GroupSpec.MiddlewareSpecs<Group>\n >,\n): Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n> =>\n Layer.succeed(\n GroupImpl<\"Unfinalized\">({ finalizationStatus: \"Unfinalized\" }),\n {\n [TypeId]: TypeId,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n registeredMiddlewareKeys: [],\n },\n ) as Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n >;\n\nconst findUnfinalizedGroupImpl = <S>(\n context: Context.Context<S>,\n): Option.Option<AnyUnfinalized> =>\n Array.findFirst(context.mapUnsafe.values(), isUnfinalizedGroupImpl);\n\n/**\n * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults\n * `RIn = never`, so passing a layer that still requires any `FunctionImpl`\n * service produces a type error at the impl author's site. The codegen boundary\n * requires the resulting `\"Finalized\"` brand, so omitting this call is also\n * rejected downstream.\n *\n * As a side effect of finalization, the names of every `FunctionImpl` that\n * registered into this group's scope are snapshotted onto the produced service\n * value's `registeredFunctionNames` field, so consumers can verify impl\n * completeness against a `GroupSpec`'s expected functions without having to\n * inspect the `Registry` themselves.\n */\nexport const finalize = (\n group: Layer.Layer<GroupImpl<\"Unfinalized\">>,\n): Layer.Layer<GroupImpl<\"Finalized\">> =>\n Layer.flatMap(group, (context): Layer.Layer<GroupImpl<\"Finalized\">> =>\n findUnfinalizedGroupImpl(context).pipe(\n Option.match({\n onNone: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.die(\n new Error(\n \"GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context.\",\n ),\n ),\n ),\n onSome: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n return {\n [TypeId]: TypeId,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: RegistryItems.functionNames(items),\n registeredMiddlewareKeys: RegistryItems.middlewareKeys(items),\n };\n }),\n ),\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n | FunctionImpl.FromGroupSpec<Group>\n | MiddlewareImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,MAAa,SAAS;AA6BtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,MAAM;AAKjC,MAAa,wBAAwB,MACnC,YAAY,CAAC,KAAK,EAAE,uBAAuB;AAE7C,MAAa,0BAA0B,MACrC,YAAY,CAAC,KAAK,EAAE,uBAAuB;;;;;;;;;;;;;AAc7C,MAAa,aAA6D,EACxE,yBAIA,QAAQ,QACN,6BAA6B,oBAC/B;;;;;;;;AASF,MAAa,QAIX,iBACA,WAUA,MAAM,QACJ,UAAyB,EAAE,oBAAoB,cAAc,CAAC,GAC9D;EACG,SAAS;CACV,oBAAoB;CACpB,yBAAyB,CAAC;CAC1B,0BAA0B,CAAC;AAC7B,CACF;AAMF,MAAM,4BACJ,YAEA,MAAM,UAAU,QAAQ,UAAU,OAAO,GAAG,sBAAsB;;;;;;;;;;;;;;AAepE,MAAa,YACX,UAEA,MAAM,QAAQ,QAAQ,YACpB,yBAAyB,OAAO,CAAC,CAAC,KAChC,OAAO,MAAM;CACX,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,YAAY,CAAC,GAC1D,OAAO,oBACL,IAAI,MACF,wFACF,CACF,CACF;CACF,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,YAAY,CAAC,GAC1D,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAOA;EACxB,MAAM,QAAQ,OAAO,IAAI,IAAI,QAAQ;EACrC,OAAO;IACJ,SAAS;GACV,oBAAoB;GACpB,yBAAyBC,cAA4B,KAAK;GAC1D,0BAA0BC,eAA6B,KAAK;EAC9D;CACF,CAAC,CACH;AACJ,CAAC,CACH,CACF"}
|
|
1
|
+
{"version":3,"file":"GroupImpl.js","names":["Registry.Registry","RegistryItems.functionNames","RegistryItems.middlewareKeys"],"sources":["../src/GroupImpl.ts"],"sourcesContent":["import type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as MiddlewareSpec from \"@confect/core/MiddlewareSpec\";\nimport * as Registry from \"./Registry.js\";\nimport * as RegistryItems from \"./RegistryItems.js\";\nimport * as Array from \"effect/Array\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as FunctionImpl from \"./FunctionImpl.js\";\nimport type * as MiddlewareImpl from \"./MiddlewareImpl.js\";\n\nexport const TypeId = \"~@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\n readonly finalizationStatus: FinalizationStatus_;\n /**\n * Names of every function registered into this group's layer scope by\n * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is\n * `\"Finalized\"`; the `\"Unfinalized\"` value is set to `[]` at `make`-time\n * since the list is only known once `finalize` snapshots the registry.\n */\n readonly registeredFunctionNames: ReadonlyArray<string>;\n /**\n * Keys of every middleware whose implementation registered into this group's\n * layer scope via `MiddlewareImpl.make` (and friends). Same authoritativeness\n * caveat as `registeredFunctionNames`. Lets consumers (the CLI's\n * `validateImpl`) verify middleware-impl completeness against a `GroupSpec`'s\n * attached middleware without inspecting the `Registry`.\n */\n readonly registeredMiddlewareKeys: ReadonlyArray<string>;\n}\n\nexport interface Any extends GroupImpl<FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<\"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<\"Unfinalized\"> {}\n\nexport const isFinalizedGroupImpl = (u: unknown): u is AnyFinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Finalized\";\n\nexport const isUnfinalizedGroupImpl = (u: unknown): u is AnyUnfinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Unfinalized\";\n\n/**\n * Build the runtime tag for a `GroupImpl` service. The finalization status is\n * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct\n * services at runtime; consumers of a finalized layer (the server's\n * `RegisteredFunctions.buildForGroup` and the CLI's `validateImpl`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n *\n * The tag is keyed only by finalization status—no group path—because each\n * group's impl layer is built in its own isolated scope\n * (`buildForGroup`/`validateImpl` each provide a fresh `Registry`), so at most\n * one `GroupImpl` service of each status exists per build.\n */\nexport const GroupImpl = <FinalizationStatus_ extends FinalizationStatus>({\n finalizationStatus,\n}: {\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.Service<GroupImpl<FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}`,\n );\n\n/**\n * Begin a group's impl layer. `databaseSchema` and `group` are retained only as\n * type-level carriers (`group` drives the required `FunctionImpl` services via\n * `FromGroupSpec<Group>`; `databaseSchema` keeps the impl's dependency on\n * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at\n * runtime.\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n _databaseSchema: DatabaseSchema_,\n _group: Group &\n MiddlewareSpec.ValidateImplRequires<\n GroupSpec.Functions<Group>,\n GroupSpec.MiddlewareSpecs<Group>\n >,\n): Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n> =>\n Layer.succeed(\n GroupImpl<\"Unfinalized\">({ finalizationStatus: \"Unfinalized\" }),\n {\n [TypeId]: TypeId,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n registeredMiddlewareKeys: [],\n },\n ) as Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group> | MiddlewareImpl.FromGroupSpec<Group>\n >;\n\nconst findUnfinalizedGroupImpl = <S>(\n context: Context.Context<S>,\n): Option.Option<AnyUnfinalized> =>\n Array.findFirst(context.mapUnsafe.values(), isUnfinalizedGroupImpl);\n\n/**\n * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults\n * `RIn = never`, so passing a layer that still requires any `FunctionImpl`\n * service produces a type error at the impl author's site. The codegen boundary\n * requires the resulting `\"Finalized\"` brand, so omitting this call is also\n * rejected downstream.\n *\n * As a side effect of finalization, the names of every `FunctionImpl` that\n * registered into this group's scope are snapshotted onto the produced service\n * value's `registeredFunctionNames` field, so consumers can verify impl\n * completeness against a `GroupSpec`'s expected functions without having to\n * inspect the `Registry` themselves.\n */\nexport const finalize = (\n group: Layer.Layer<GroupImpl<\"Unfinalized\">>,\n): Layer.Layer<GroupImpl<\"Finalized\">> =>\n Layer.flatMap(group, (context): Layer.Layer<GroupImpl<\"Finalized\">> =>\n findUnfinalizedGroupImpl(context).pipe(\n Option.match({\n onNone: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.die(\n new Error(\n \"GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context.\",\n ),\n ),\n ),\n onSome: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n return {\n [TypeId]: TypeId,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: RegistryItems.functionNames(items),\n registeredMiddlewareKeys: RegistryItems.middlewareKeys(items),\n };\n }),\n ),\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n | FunctionImpl.FromGroupSpec<Group>\n | MiddlewareImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,MAAa,SAAS;AA6BtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,MAAM;AAKjC,MAAa,wBAAwB,MACnC,YAAY,CAAC,KAAK,EAAE,uBAAuB;AAE7C,MAAa,0BAA0B,MACrC,YAAY,CAAC,KAAK,EAAE,uBAAuB;;;;;;;;;;;;;AAc7C,MAAa,aAA6D,EACxE,yBAIA,QAAQ,QACN,6BAA6B,oBAC/B;;;;;;;;AASF,MAAa,QAIX,iBACA,WAUA,MAAM,QACJ,UAAyB,EAAE,oBAAoB,cAAc,CAAC,GAC9D;EACG,SAAS;CACV,oBAAoB;CACpB,yBAAyB,CAAC;CAC1B,0BAA0B,CAAC;AAC7B,CACF;AAMF,MAAM,4BACJ,YAEA,MAAM,UAAU,QAAQ,UAAU,OAAO,GAAG,sBAAsB;;;;;;;;;;;;;;AAepE,MAAa,YACX,UAEA,MAAM,QAAQ,QAAQ,YACpB,yBAAyB,OAAO,CAAC,CAAC,KAChC,OAAO,MAAM;CACX,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,YAAY,CAAC,GAC1D,OAAO,oBACL,IAAI,MACF,wFACF,CACF,CACF;CACF,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,YAAY,CAAC,GAC1D,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAOA;EACxB,MAAM,QAAQ,OAAO,IAAI,IAAI,QAAQ;EACrC,OAAO;IACJ,SAAS;GACV,oBAAoB;GACpB,yBAAyBC,cAA4B,KAAK;GAC1D,0BAA0BC,eAA6B,KAAK;EAC9D;CACF,CAAC,CACH;AACJ,CAAC,CACH,CACF"}
|
package/dist/GroupRegistry.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Layer from "effect/Layer";
|
|
2
|
-
import type * as GroupImpl from "./GroupImpl";
|
|
3
|
-
import * as MiddlewareRegistryItem from "./MiddlewareRegistryItem";
|
|
2
|
+
import type * as GroupImpl from "./GroupImpl.js";
|
|
3
|
+
import * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
|
|
4
4
|
export declare const make: (groupLayer: Layer.Layer<GroupImpl.GroupImpl<"Finalized">>) => {
|
|
5
5
|
functionRegistryItems: Record<string, unknown>;
|
|
6
6
|
middlewareRegistryItems: Map<string, MiddlewareRegistryItem.MiddlewareRegistryItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupRegistry.d.ts","sourceRoot":"","sources":["../src/GroupRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,KAAK,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"GroupRegistry.d.ts","sourceRoot":"","sources":["../src/GroupRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AAEtE,eAAO,MAAM,IAAI,eACH,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;;;CAe1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupRegistry.js","names":["Registry.Registry","MiddlewareRegistryItem.isMiddlewareRegistryItem"],"sources":["../src/GroupRegistry.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport type * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport * as Registry from \"./Registry\";\nimport type * as RegistryItems from \"./RegistryItems\";\nimport type * as GroupImpl from \"./GroupImpl\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem\";\n\nexport const make = (\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n) => {\n const registryItems = Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n return yield* Ref.get(registry);\n }).pipe(\n Effect.provide(groupLayer),\n Effect.provideService(\n Registry.Registry,\n Ref.makeUnsafe<RegistryItems.RegistryItems>({}),\n ),\n Effect.runSync,\n );\n\n return partitionRegistryItems(registryItems);\n};\n\nconst partitionRegistryItems = (registryItems: RegistryItems.RegistryItems) => {\n const middlewareRegistryItems = new Map<\n string,\n MiddlewareRegistryItem.MiddlewareRegistryItem\n >();\n const functionRegistryItems: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(registryItems)) {\n if (MiddlewareRegistryItem.isMiddlewareRegistryItem(value)) {\n middlewareRegistryItems.set(value.middlewareSpec.key, value);\n } else {\n functionRegistryItems[key] = value;\n }\n }\n return { functionRegistryItems, middlewareRegistryItems };\n};\n"],"mappings":";;;;;AAQA,MAAa,QACX,eACG;CACH,MAAM,gBAAgB,OAAO,IAAI,aAAa;EAC5C,MAAM,WAAW,OAAOA;EACxB,OAAO,OAAO,IAAI,IAAI,QAAQ;CAChC,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,UAAU,GACzB,OAAO,eACLA,UACA,IAAI,WAAwC,CAAC,CAAC,CAChD,GACA,OAAO,OACT;CAEA,OAAO,uBAAuB,aAAa;AAC7C;AAEA,MAAM,0BAA0B,kBAA+C;CAC7E,MAAM,0CAA0B,IAAI,IAGlC;CACF,MAAM,wBAAiD,CAAC;CACxD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,GACrD,IAAIC,yBAAgD,KAAK,GACvD,wBAAwB,IAAI,MAAM,eAAe,KAAK,KAAK;MAE3D,sBAAsB,OAAO;CAGjC,OAAO;EAAE;EAAuB;CAAwB;AAC1D"}
|
|
1
|
+
{"version":3,"file":"GroupRegistry.js","names":["Registry.Registry","MiddlewareRegistryItem.isMiddlewareRegistryItem"],"sources":["../src/GroupRegistry.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport type * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport * as Registry from \"./Registry.js\";\nimport type * as RegistryItems from \"./RegistryItems.js\";\nimport type * as GroupImpl from \"./GroupImpl.js\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem.js\";\n\nexport const make = (\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n) => {\n const registryItems = Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n return yield* Ref.get(registry);\n }).pipe(\n Effect.provide(groupLayer),\n Effect.provideService(\n Registry.Registry,\n Ref.makeUnsafe<RegistryItems.RegistryItems>({}),\n ),\n Effect.runSync,\n );\n\n return partitionRegistryItems(registryItems);\n};\n\nconst partitionRegistryItems = (registryItems: RegistryItems.RegistryItems) => {\n const middlewareRegistryItems = new Map<\n string,\n MiddlewareRegistryItem.MiddlewareRegistryItem\n >();\n const functionRegistryItems: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(registryItems)) {\n if (MiddlewareRegistryItem.isMiddlewareRegistryItem(value)) {\n middlewareRegistryItems.set(value.middlewareSpec.key, value);\n } else {\n functionRegistryItems[key] = value;\n }\n }\n return { functionRegistryItems, middlewareRegistryItems };\n};\n"],"mappings":";;;;;AAQA,MAAa,QACX,eACG;CACH,MAAM,gBAAgB,OAAO,IAAI,aAAa;EAC5C,MAAM,WAAW,OAAOA;EACxB,OAAO,OAAO,IAAI,IAAI,QAAQ;CAChC,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,UAAU,GACzB,OAAO,eACLA,UACA,IAAI,WAAwC,CAAC,CAAC,CAChD,GACA,OAAO,OACT;CAEA,OAAO,uBAAuB,aAAa;AAC7C;AAEA,MAAM,0BAA0B,kBAA+C;CAC7E,MAAM,0CAA0B,IAAI,IAGlC;CACF,MAAM,wBAAiD,CAAC;CACxD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,GACrD,IAAIC,yBAAgD,KAAK,GACvD,wBAAwB,IAAI,MAAM,eAAe,KAAK,KAAK;MAE3D,sBAAsB,OAAO;CAGjC,OAAO;EAAE;EAAuB;CAAwB;AAC1D"}
|
package/dist/Handler.d.ts
CHANGED
|
@@ -2,29 +2,29 @@ import type { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
|
|
|
2
2
|
import type * as FunctionProvenance from "@confect/core/FunctionProvenance";
|
|
3
3
|
import type * as NodeServices from "@effect/platform-node/NodeServices";
|
|
4
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 { ExecutionMetadata } from "./ExecutionMetadata";
|
|
13
|
-
import type { RequestMetadata } from "./RequestMetadata";
|
|
14
|
-
import type { TransactionMetadata } from "./TransactionMetadata";
|
|
15
|
-
import type * as MutationCtx from "./MutationCtx";
|
|
16
|
-
import type * as MutationRunner from "./MutationRunner";
|
|
17
|
-
import type { MutationTransactionContext } from "./MutationTransactionContext";
|
|
18
|
-
import type * as QueryCtx from "./QueryCtx";
|
|
19
|
-
import type * as QueryRunner from "./QueryRunner";
|
|
20
|
-
import type { QueryTransactionContext } from "./QueryTransactionContext";
|
|
21
|
-
import type * as RegisteredFunction from "./RegisteredFunction";
|
|
22
|
-
import type * as Scheduler from "./Scheduler";
|
|
23
|
-
import type { Storage } from "./Storage";
|
|
24
|
-
import type * as StorageActionWriter from "./StorageActionWriter";
|
|
25
|
-
import type * as StorageReader from "./StorageReader";
|
|
26
|
-
import type * as StorageWriter from "./StorageWriter";
|
|
27
|
-
import type * as VectorSearch from "./VectorSearch";
|
|
5
|
+
import type * as ActionCtx from "./ActionCtx.js";
|
|
6
|
+
import type * as ActionRunner from "./ActionRunner.js";
|
|
7
|
+
import type * as Auth from "./Auth.js";
|
|
8
|
+
import type * as DatabaseReader from "./DatabaseReader.js";
|
|
9
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
10
|
+
import type * as DatabaseWriter from "./DatabaseWriter.js";
|
|
11
|
+
import type * as DataModel from "./DataModel.js";
|
|
12
|
+
import type { ExecutionMetadata } from "./ExecutionMetadata.js";
|
|
13
|
+
import type { RequestMetadata } from "./RequestMetadata.js";
|
|
14
|
+
import type { TransactionMetadata } from "./TransactionMetadata.js";
|
|
15
|
+
import type * as MutationCtx from "./MutationCtx.js";
|
|
16
|
+
import type * as MutationRunner from "./MutationRunner.js";
|
|
17
|
+
import type { MutationTransactionContext } from "./MutationTransactionContext.js";
|
|
18
|
+
import type * as QueryCtx from "./QueryCtx.js";
|
|
19
|
+
import type * as QueryRunner from "./QueryRunner.js";
|
|
20
|
+
import type { QueryTransactionContext } from "./QueryTransactionContext.js";
|
|
21
|
+
import type * as RegisteredFunction from "./RegisteredFunction.js";
|
|
22
|
+
import type * as Scheduler from "./Scheduler.js";
|
|
23
|
+
import type { Storage } from "./Storage.js";
|
|
24
|
+
import type * as StorageActionWriter from "./StorageActionWriter.js";
|
|
25
|
+
import type * as StorageReader from "./StorageReader.js";
|
|
26
|
+
import type * as StorageWriter from "./StorageWriter.js";
|
|
27
|
+
import type * as VectorSearch from "./VectorSearch.js";
|
|
28
28
|
export type Handler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithProps, R = never> = FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConvex> ? ConvexProvenanceHandler<FunctionSpec_> : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConfect> ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_, R> : never;
|
|
29
29
|
type ConvexProvenanceHandler<FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;
|
|
30
30
|
type ConfectProvenanceHandler<DatabaseSchema_ extends DatabaseSchema.AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>, R = never> = FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "query"> ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_, R> : FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, "mutation"> ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_, R> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.ConvexAction> ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_, R> : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<FunctionSpec_, RuntimeAndFunctionType.NodeAction> ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_, R> : never;
|
package/dist/Handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.d.ts","sourceRoot":"","sources":["../src/Handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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X,YAAY,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAC9E,CAAC,GAAG,KAAK,IACP,IAAI,CACN,aAAa,EACb,cAAc,CAAC,eAAe,CAAC,GAAG,YAAY,CAAC,YAAY,GAAG,CAAC,CAChE,CAAC;AAEF,KAAK,IAAI,CAAC,aAAa,SAAS,YAAY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC9D,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,KACnC,MAAM,CAAC,MAAM,CAChB,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,EACnC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,EACjC,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,GAAG,CAAC;AAEzD,MAAM,MAAM,QAAQ,CAClB,eAAe,SAAS,cAAc,CAAC,YAAY,EACnD,aAAa,SAAS,YAAY,CAAC,YAAY,EAC/C,YAAY,SAAS,MAAM,EAC3B,CAAC,GAAG,KAAK,IACP,OAAO,CACT,eAAe,EACf,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,EAClD,CAAC,CACF,CAAC"}
|
package/dist/Handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.js","names":[],"sources":["../src/Handler.ts"],"sourcesContent":["import type { FunctionSpec, RuntimeAndFunctionType } from \"@confect/core\";\nimport type * as FunctionProvenance from \"@confect/core/FunctionProvenance\";\nimport type * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport type { Effect } from \"effect\";\nimport type * as ActionCtx from \"./ActionCtx\";\nimport type * as ActionRunner from \"./ActionRunner\";\nimport type * as Auth from \"./Auth\";\nimport type * as DatabaseReader from \"./DatabaseReader\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DatabaseWriter from \"./DatabaseWriter\";\nimport type * as DataModel from \"./DataModel\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata\";\nimport type { RequestMetadata } from \"./RequestMetadata\";\nimport type { TransactionMetadata } from \"./TransactionMetadata\";\nimport type * as MutationCtx from \"./MutationCtx\";\nimport type * as MutationRunner from \"./MutationRunner\";\nimport type { MutationTransactionContext } from \"./MutationTransactionContext\";\nimport type * as QueryCtx from \"./QueryCtx\";\nimport type * as QueryRunner from \"./QueryRunner\";\nimport type { QueryTransactionContext } from \"./QueryTransactionContext\";\nimport type * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as Scheduler from \"./Scheduler\";\nimport type { Storage } from \"./Storage\";\nimport type * as StorageActionWriter from \"./StorageActionWriter\";\nimport type * as StorageReader from \"./StorageReader\";\nimport type * as StorageWriter from \"./StorageWriter\";\nimport type * as VectorSearch from \"./VectorSearch\";\n\nexport type Handler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConvex\n >\n ? ConvexProvenanceHandler<FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConfect\n >\n ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\ntype ConvexProvenanceHandler<\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>,\n> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;\n\ntype ConfectProvenanceHandler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, \"query\">\n ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithFunctionType<\n FunctionSpec_,\n \"mutation\"\n >\n ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.ConvexAction\n >\n ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.NodeAction\n >\n ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\nexport type QueryServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | QueryTransactionContext\n | QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type MutationServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | DatabaseWriter.DatabaseWriter<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | QueryTransactionContext\n | MutationTransactionContext\n | MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\n/**\n * Shared by both action runtimes.\n */\nexport type ActionServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageActionWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>>\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type ConfectProvenanceQuery<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>,\n R = never,\n> = Base<FunctionSpec_, QueryServices<DatabaseSchema_> | R>;\n\nexport type ConfectProvenanceMutation<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>,\n R = never,\n> = Base<FunctionSpec_, MutationServices<DatabaseSchema_> | R>;\n\nexport type ConvexRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,\n R = never,\n> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | R>;\n\nexport type NodeRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>,\n R = never,\n> = Base<\n FunctionSpec_,\n ActionServices<DatabaseSchema_> | NodeServices.NodeServices | R\n>;\n\ntype Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (\n args: FunctionSpec.Args<FunctionSpec_>,\n) => Effect.Effect<\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>,\n R\n>;\n\nexport type Any = AnyConfectProvenance | AnyConvexProvenance;\n\nexport type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;\n\nexport type AnyConvexProvenance = RegisteredFunction.Any;\n\nexport type WithName<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n FunctionName extends string,\n R = never,\n> = Handler<\n DatabaseSchema_,\n FunctionSpec.WithName<FunctionSpec_, FunctionName>,\n R\n>;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Handler.js","names":[],"sources":["../src/Handler.ts"],"sourcesContent":["import type { FunctionSpec, RuntimeAndFunctionType } from \"@confect/core\";\nimport type * as FunctionProvenance from \"@confect/core/FunctionProvenance\";\nimport type * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport type { Effect } from \"effect\";\nimport type * as ActionCtx from \"./ActionCtx.js\";\nimport type * as ActionRunner from \"./ActionRunner.js\";\nimport type * as Auth from \"./Auth.js\";\nimport type * as DatabaseReader from \"./DatabaseReader.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as DatabaseWriter from \"./DatabaseWriter.js\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata.js\";\nimport type { RequestMetadata } from \"./RequestMetadata.js\";\nimport type { TransactionMetadata } from \"./TransactionMetadata.js\";\nimport type * as MutationCtx from \"./MutationCtx.js\";\nimport type * as MutationRunner from \"./MutationRunner.js\";\nimport type { MutationTransactionContext } from \"./MutationTransactionContext.js\";\nimport type * as QueryCtx from \"./QueryCtx.js\";\nimport type * as QueryRunner from \"./QueryRunner.js\";\nimport type { QueryTransactionContext } from \"./QueryTransactionContext.js\";\nimport type * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport type * as Scheduler from \"./Scheduler.js\";\nimport type { Storage } from \"./Storage.js\";\nimport type * as StorageActionWriter from \"./StorageActionWriter.js\";\nimport type * as StorageReader from \"./StorageReader.js\";\nimport type * as StorageWriter from \"./StorageWriter.js\";\nimport type * as VectorSearch from \"./VectorSearch.js\";\n\nexport type Handler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConvex\n >\n ? ConvexProvenanceHandler<FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConfect\n >\n ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\ntype ConvexProvenanceHandler<\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>,\n> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;\n\ntype ConfectProvenanceHandler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>,\n R = never,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, \"query\">\n ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithFunctionType<\n FunctionSpec_,\n \"mutation\"\n >\n ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.ConvexAction\n >\n ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.NodeAction\n >\n ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_, R>\n : never;\n\nexport type QueryServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | QueryTransactionContext\n | QueryCtx.QueryCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type MutationServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | DatabaseWriter.DatabaseWriter<DatabaseSchema_>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | TransactionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | QueryTransactionContext\n | MutationTransactionContext\n | MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\n/**\n * Shared by both action runtimes.\n */\nexport type ActionServices<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> =\n | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Auth.Auth)\n | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | StorageActionWriter.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>\n | ExecutionMetadata\n | RequestMetadata\n | (DatabaseSchema_[\"target\"][\"kind\"] extends \"component\" ? never : Storage)\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>>\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n DatabaseSchema.Scope<DatabaseSchema_>\n >;\n\nexport type ConfectProvenanceQuery<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>,\n R = never,\n> = Base<FunctionSpec_, QueryServices<DatabaseSchema_> | R>;\n\nexport type ConfectProvenanceMutation<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>,\n R = never,\n> = Base<FunctionSpec_, MutationServices<DatabaseSchema_> | R>;\n\nexport type ConvexRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,\n R = never,\n> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | R>;\n\nexport type NodeRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>,\n R = never,\n> = Base<\n FunctionSpec_,\n ActionServices<DatabaseSchema_> | NodeServices.NodeServices | R\n>;\n\ntype Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (\n args: FunctionSpec.Args<FunctionSpec_>,\n) => Effect.Effect<\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>,\n R\n>;\n\nexport type Any = AnyConfectProvenance | AnyConvexProvenance;\n\nexport type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;\n\nexport type AnyConvexProvenance = RegisteredFunction.Any;\n\nexport type WithName<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n FunctionName extends string,\n R = never,\n> = Handler<\n DatabaseSchema_,\n FunctionSpec.WithName<FunctionSpec_, FunctionName>,\n R\n>;\n"],"mappings":""}
|
package/dist/HttpRouter.d.ts
CHANGED
|
@@ -7,19 +7,19 @@ import type * as HttpApiGroup from "effect/http-api/HttpApiGroup";
|
|
|
7
7
|
import type * as Etag from "effect/http/Etag";
|
|
8
8
|
import type * as HttpPlatform from "effect/http/HttpPlatform";
|
|
9
9
|
import * as HttpRouter from "effect/http/HttpRouter";
|
|
10
|
-
import type * as ActionRunner from "./ActionRunner";
|
|
11
|
-
import type * as Auth from "./Auth";
|
|
12
|
-
import type { ExecutionMetadata } from "./ExecutionMetadata";
|
|
13
|
-
import type { RequestMetadata } from "./RequestMetadata";
|
|
14
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
15
|
-
import type * as Handler from "./Handler";
|
|
16
|
-
import type * as MutationRunner from "./MutationRunner";
|
|
17
|
-
import type * as QueryRunner from "./QueryRunner";
|
|
18
|
-
import type * as Scheduler from "./Scheduler";
|
|
19
|
-
import type { Storage } from "./Storage";
|
|
20
|
-
import type { StorageActionWriter } from "./StorageActionWriter";
|
|
21
|
-
import type { StorageReader } from "./StorageReader";
|
|
22
|
-
import type { StorageWriter } from "./StorageWriter";
|
|
10
|
+
import type * as ActionRunner from "./ActionRunner.js";
|
|
11
|
+
import type * as Auth from "./Auth.js";
|
|
12
|
+
import type { ExecutionMetadata } from "./ExecutionMetadata.js";
|
|
13
|
+
import type { RequestMetadata } from "./RequestMetadata.js";
|
|
14
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
15
|
+
import type * as Handler from "./Handler.js";
|
|
16
|
+
import type * as MutationRunner from "./MutationRunner.js";
|
|
17
|
+
import type * as QueryRunner from "./QueryRunner.js";
|
|
18
|
+
import type * as Scheduler from "./Scheduler.js";
|
|
19
|
+
import type { Storage } from "./Storage.js";
|
|
20
|
+
import type { StorageActionWriter } from "./StorageActionWriter.js";
|
|
21
|
+
import type { StorageReader } from "./StorageReader.js";
|
|
22
|
+
import type { StorageWriter } from "./StorageWriter.js";
|
|
23
23
|
/**
|
|
24
24
|
* The Confect services available to HTTP route handlers and middleware,
|
|
25
25
|
* supplied per request from the Convex action context.
|
package/dist/HttpRouter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpRouter.d.ts","sourceRoot":"","sources":["../src/HttpRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,IAAI,gBAAgB,EAOpC,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,KAAK,UAAU,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAC;AAIzC,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,O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ACH,eAAO,MAAM,SAAS,GACnB,eAAe,SAAS,cAAc,CAAC,YAAY,UAC1C,eAAe,MAExB,EAAE,SAAS,MAAM,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,UAChD,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,YAC7C;IAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;CAAE,KACnE,gBAgBA,CAAC"}
|
package/dist/HttpRouter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpRouter.js","names":["RegisteredFunction.baseActionLayer","RegisteredFunction.actionLayer","ConvexLogger.layer","ConvexConfigProvider.layer","layer"],"sources":["../src/HttpRouter.ts"],"sourcesContent":["import {\n type HttpRouter as ConvexHttpRouter,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n type GenericActionCtx,\n type GenericDataModel,\n} from \"convex/server\";\nimport * as Array from \"effect/Array\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Config from \"effect/Config\";\nimport * as Effect from \"effect/Effect\";\nimport type * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport type * as Path from \"effect/Path\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport * as FindMyWay from \"effect/http/FindMyWay\";\nimport * as HttpApi from \"effect/http-api/HttpApi\";\nimport type * as HttpApiGroup from \"effect/http-api/HttpApiGroup\";\nimport type * as Etag from \"effect/http/Etag\";\nimport type * as HttpPlatform from \"effect/http/HttpPlatform\";\nimport * as HttpRouter from \"effect/http/HttpRouter\";\nimport * as HttpServer from \"effect/http/HttpServer\";\nimport type * as ActionRunner from \"./ActionRunner\";\nimport type * as Auth from \"./Auth\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata\";\nimport type { RequestMetadata } from \"./RequestMetadata\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as Handler from \"./Handler\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as ConvexLogger from \"./ConvexLogger\";\nimport type * as MutationRunner from \"./MutationRunner\";\nimport type * as QueryRunner from \"./QueryRunner\";\nimport * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as Scheduler from \"./Scheduler\";\nimport type { Storage } from \"./Storage\";\nimport type { StorageActionWriter } from \"./StorageActionWriter\";\nimport type { StorageReader } from \"./StorageReader\";\nimport type { StorageWriter } from \"./StorageWriter\";\n\n/**\n * The Confect services available to HTTP route handlers and middleware,\n * supplied per request from the Convex action context.\n */\nexport type Services =\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | ExecutionMetadata\n | RequestMetadata\n | Storage\n | StorageReader\n | StorageWriter\n | StorageActionWriter;\n\n/**\n * A layer that registers routes on the HTTP router—the input to {@link make}.\n *\n * Compose it from Effect's `effect/http` and `effect/http-api` modules:\n * `HttpApiBuilder.layer(api)` registers an `HttpApi`'s endpoints (provide its\n * group handler layers with `Layer.provide`), `HttpApiScalar.layer(api, ...)`\n * serves interactive API docs, `HttpRouter.add` registers a plain route, and\n * `HttpRouter.middleware(fn, { global: true })` applies middleware to every\n * route. Merge any number of these with `Layer.mergeAll`.\n *\n * Route handlers and middleware may require any of the Confect {@link Services},\n * which surface as request-level `Requires` markers and are supplied per\n * request. Anything else the layer requires is a type error—notably, an\n * `HttpApiBuilder.layer(api)` whose group handler layers are not provided\n * leaves an `HttpApiGroup.ToService` requirement behind, so a missing handler\n * group is caught at compile time.\n *\n * Layers are built with Confect's Convex-aware `ConfigProvider` in context, so\n * `Config` reads (e.g. in `Layer.unwrap`) resolve against Convex environment\n * variables.\n */\nexport type Routes<Services_ = Services> = Layer.Layer<\n never,\n never,\n | HttpRouter.HttpRouter\n | Etag.Generator\n | FileSystem.FileSystem\n | HttpPlatform.HttpPlatform\n | Path.Path\n | HttpRouter.Request<\"Requires\", Services_>\n | HttpRouter.Request<\"GlobalRequires\", Services_>\n | HttpRouter.Request<\"Error\", any>\n | HttpRouter.Request<\"GlobalError\", any>\n>;\n\n/**\n * Create a Convex HTTP router serving the given routes.\n *\n * A single catch-all `httpAction` is registered for every routable method under\n * the path prefix `\"/\"`, making the Effect router the single source of truth\n * for paths: place an API with `HttpApi.prefix` or absolute route paths.\n * Requests that match no route receive the Effect router's 404 response.\n *\n * Supply `{ api }` with the `HttpApi` registered by the routes layer to show\n * endpoint patterns in Convex completion logs and the dashboard. Requests that\n * match no reflected endpoint keep the catch-all completion label. Without the\n * option, Convex reports the catch-all registrations. Application endpoints\n * must not overlap component HTTP mounts: Convex also uses dashboard route\n * entries to select between application and component routers.\n *\n * Plain Convex routes can still be added to the returned router—Convex matches\n * exact paths first and longer path prefixes before the catch-all, so they take\n * precedence.\n */\nexport const make = <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes,\n options?: { readonly api?: HttpApi.HttpApi<Id, Groups> | undefined },\n): ConvexHttpRouter =>\n makeWithLayer(routes, RegisteredFunction.baseActionLayer, options?.api);\n\n/**\n * Derive HTTP capabilities and ID scopes from the generated database schema.\n * Component routes are relative to their installation's HTTP mount prefix.\n * Supply `{ api }` as in {@link make}; labels stay component-relative.\n */\nexport const forSchema =\n <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n schema: DatabaseSchema_,\n ) =>\n <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes<Handler.ActionServices<DatabaseSchema_>>,\n options?: { readonly api?: HttpApi.HttpApi<Id, Groups> | undefined },\n ): ConvexHttpRouter =>\n makeWithLayer<\n Handler.ActionServices<DatabaseSchema_>,\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n Id,\n Groups\n >(\n Match.value(schema.target.kind).pipe(\n Match.when(\"app\", () => routes),\n Match.when(\"component\", () =>\n routes.pipe(Layer.provide(componentRouter)),\n ),\n Match.exhaustive,\n ),\n (ctx) => RegisteredFunction.actionLayer(schema, ctx),\n options?.api,\n );\n\n// Convex uses a component-relative path to select its HTTP action but passes\n// the original request URL to that action. Its CONVEX_SITE_URL includes the\n// installation's full mount prefix (including parent mounts). Prefixing the\n// Effect router preserves relative routes without rewriting the Request body.\nconst componentRouter = Layer.effect(\n HttpRouter.HttpRouter,\n Effect.gen(function* () {\n const router = yield* HttpRouter.HttpRouter;\n const siteUrl = yield* Config.schema(\n Schema.URLFromString,\n \"CONVEX_SITE_URL\",\n );\n return router.prefixed(siteUrl.pathname);\n }).pipe(Effect.orDie),\n);\n\nconst makeWithLayer = <\n Services_,\n DataModel_ extends GenericDataModel,\n Id extends string,\n Groups extends HttpApiGroup.Constraint,\n>(\n routes: Routes<Services_>,\n layer: (ctx: GenericActionCtx<DataModel_>) => Layer.Layer<Services_>,\n api: HttpApi.HttpApi<Id, Groups> | undefined,\n): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n // Provided (not just merged) so that route layers' own construction—e.g.\n // a `Layer.unwrap` reading `Config`—resolves configuration through the\n // Convex-aware provider; merged so that request fibers—endpoint handlers\n // and middleware—do too.\n const AppLayer = routes.pipe(\n Layer.provideMerge(ConvexLogger.layer),\n Layer.provideMerge(ConvexConfigProvider.layer),\n Layer.provide(HttpServer.layerServices),\n );\n\n // The Confect service requirements of route handlers and middleware surface\n // as request-level `Requires` markers on the layer, which the web handler\n // exposes as a per-request context argument.\n const { handler } = HttpRouter.toWebHandler(AppLayer, {\n disableLogger: true,\n });\n\n const httpAction = httpActionGeneric((ctx, request): Promise<Response> => {\n // The ctx-backed service layers are all synchronous and finalizer-free,\n // so the scope can close as soon as the context is built.\n // Convex's HTTP registration erases the data model. The supplied generated\n // schema restores it; this does not change the runtime context or services.\n const services = Effect.runSync(\n Effect.scoped(\n Layer.build(layer(ctx as unknown as GenericActionCtx<DataModel_>)),\n ),\n );\n return handler(\n request,\n Context.add(services, Console.Console, globalThis.console),\n );\n });\n\n const convexHttpRouter = httpRouter();\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix: \"/\",\n method,\n handler: httpAction,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n if (api !== undefined) {\n const matcher = FindMyWay.make<string>();\n const reflected: ReturnType<ConvexHttpRouter[\"getRoutes\"]> = [];\n HttpApi.reflect(api, {\n onGroup: () => {},\n onEndpoint: ({ endpoint }) => {\n const method = ROUTABLE_HTTP_METHODS.find(\n (candidate) => candidate === endpoint.method,\n );\n if (method === undefined) return;\n const path = apiRouterPath(\n endpoint.path as FindMyWay.PathInput,\n endpoint.params,\n );\n matcher.on(method, path, endpoint.path);\n // Effect also matches a wildcard route's base path without its slash.\n if (path.endsWith(\"/*\")) {\n matcher.on(method, path.slice(0, -2) as `/${string}`, endpoint.path);\n }\n reflected.push([endpoint.path, method, httpAction]);\n },\n });\n reflected.sort(\n ([pathA, methodA], [pathB, methodB]) =>\n pathA.localeCompare(pathB) || methodA.localeCompare(methodB),\n );\n\n const getRoutes = convexHttpRouter.getRoutes;\n convexHttpRouter.getRoutes = () =>\n reflected.length === 0\n ? getRoutes()\n : [\n ...getRoutes().filter(([, , action]) => action !== httpAction),\n ...reflected,\n ];\n const lookup = convexHttpRouter.lookup;\n convexHttpRouter.lookup = (path, method) => {\n const match = lookup(path, method);\n if (match === null || match[0] !== httpAction) return match;\n const normalized = match[1];\n const reflectedPath = matcher.find(normalized, path)?.handler;\n return reflectedPath === undefined\n ? match\n : [httpAction, normalized, reflectedPath];\n };\n }\n\n return convexHttpRouter;\n};\n\n/*!\n * apiRouterPath is adapted from Effect 4.0.1 http-api/internal/path.ts.\n *\n * MIT License\n *\n * Copyright (c) 2023 Effectful Technologies Inc\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Match Effect's HttpApiBuilder path normalization, which is not publicly\n// exported (effect/http-api/internal/path.ts). Undeclared colons are literals;\n// declared params followed by a literal suffix need an explicit regex boundary.\nconst apiRouterPath = (\n path: FindMyWay.PathInput,\n params: Schema.Top | undefined,\n): FindMyWay.PathInput => {\n if (params === undefined || !path.includes(\":\")) return path;\n let ast = params.ast;\n while (ast.encoding !== undefined) {\n ast = ast.encoding[ast.encoding.length - 1].to;\n }\n if (!SchemaAST.isObjects(ast) || ast.indexSignatures.length !== 0)\n return path;\n const names = new Set(\n ast.propertySignatures.map((property) => String(property.name)),\n );\n let normalized = \"\";\n let depth = 0;\n let regexStart = -1;\n for (let i = 0; i < path.length; i++) {\n const char = path[i];\n if (depth > 0 || i === regexStart) {\n normalized += char;\n if (char === \"\\\\\") normalized += path[++i] ?? \"\";\n else if (char === \"(\") depth++;\n else if (char === \")\") depth--;\n } else if (char !== \":\") {\n normalized += char;\n } else if (path[i + 1] === \":\") {\n normalized += \"::\";\n i++;\n } else {\n const param = /^:(\\w+)/.exec(path.slice(i));\n if (param !== null && names.has(param[1])) {\n normalized += param[0];\n i += param[0].length - 1;\n const next = path[i + 1];\n if (next === \"(\") regexStart = i + 1;\n else if (next !== undefined && !\"/.-?\".includes(next))\n normalized += \"(.*?)\";\n } else {\n normalized += \"::\";\n }\n }\n }\n return normalized as FindMyWay.PathInput;\n};\n\n// These are necessary until the Convex runtime supports these APIs. See\n// https://discord.com/channels/1019350475847499849/1281364098419785760\n// Each patch is applied only where the API is actually broken, so runtimes\n// with working implementations—Node under convex-test, notably, where\n// `new AbortSignal()` is an illegal constructor—keep their native behavior.\nconst applyMonkeyPatches = () => {\n const urlCredentialsBroken = (() => {\n try {\n return new URL(\"https://confect.dev\").username === undefined;\n } catch {\n return true;\n }\n })();\n if (urlCredentialsBroken) {\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n }\n\n const requestSignalBroken = (() => {\n try {\n return new Request(\"https://confect.dev\").signal === undefined;\n } catch {\n return true;\n }\n })();\n if (requestSignalBroken) {\n // `configurable` so repeated definition—e.g. module re-evaluation in a\n // long-lived environment—does not throw.\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n configurable: true,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,MAAa,QACX,QACA,YAEA,cAAc,QAAQA,iBAAoC,SAAS,GAAG;;;;;;AAOxE,MAAa,aAET,YAGA,QACA,YAEA,cAME,MAAM,MAAM,OAAO,OAAO,IAAI,CAAC,CAAC,KAC9B,MAAM,KAAK,aAAa,MAAM,GAC9B,MAAM,KAAK,mBACT,OAAO,KAAK,MAAM,QAAQ,eAAe,CAAC,CAC5C,GACA,MAAM,UACR,IACC,QAAQC,YAA+B,QAAQ,GAAG,GACnD,SAAS,GACX;AAMJ,MAAM,kBAAkB,MAAM,OAC5B,WAAW,YACX,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OA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S,KAAK;QAClB,IAAI,SAAS,KAAK;EACzB,OAAO,IAAI,SAAS,KAClB,cAAc;OACT,IAAI,KAAK,IAAI,OAAO,KAAK;GAC9B,cAAc;GACd;EACF,OAAO;GACL,MAAM,QAAQ,UAAU,KAAK,KAAK,MAAM,CAAC,CAAC;GAC1C,IAAI,UAAU,QAAQ,MAAM,IAAI,MAAM,EAAE,GAAG;IACzC,cAAc,MAAM;IACpB,KAAK,MAAM,EAAE,CAAC,SAAS;IACvB,MAAM,OAAO,KAAK,IAAI;IACtB,IAAI,SAAS,KAAK,aAAa,IAAI;SAC9B,IAAI,SAAS,KAAA,KAAa,CAAC,OAAO,SAAS,IAAI,GAClD,cAAc;GAClB,OACE,cAAc;EAElB;CACF;CACA,OAAO;AACT;AAOA,MAAM,2BAA2B;CAQ/B,WAPoC;EAClC,IAAI;GACF,OAAO,IAAI,IAAI,qBAAqB,CAAC,CAAC,aAAa,KAAA;EACrD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACuB,GACrB,MAAM,cAAc,IAAI;EACtB,IAAa,WAAW;GACtB,OAAO;EACT;EACA,IAAa,WAAW;GACtB,OAAO;EACT;CACF;CAUF,WAPmC;EACjC,IAAI;GACF,OAAO,IAAI,QAAQ,qBAAqB,CAAC,CAAC,WAAW,KAAA;EACvD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACsB,GAGpB,OAAO,eAAe,QAAQ,WAAW,UAAU;EACjD,WAAW,IAAI,YAAY;EAC3B,cAAc;CAChB,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"file":"HttpRouter.js","names":["RegisteredFunction.baseActionLayer","RegisteredFunction.actionLayer","ConvexLogger.layer","ConvexConfigProvider.layer","layer"],"sources":["../src/HttpRouter.ts"],"sourcesContent":["import {\n type HttpRouter as ConvexHttpRouter,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n type GenericActionCtx,\n type GenericDataModel,\n} from \"convex/server\";\nimport * as Array from \"effect/Array\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Config from \"effect/Config\";\nimport * as Effect from \"effect/Effect\";\nimport type * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport type * as Path from \"effect/Path\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport * as FindMyWay from \"effect/http/FindMyWay\";\nimport * as HttpApi from \"effect/http-api/HttpApi\";\nimport type * as HttpApiGroup from \"effect/http-api/HttpApiGroup\";\nimport type * as Etag from \"effect/http/Etag\";\nimport type * as HttpPlatform from \"effect/http/HttpPlatform\";\nimport * as HttpRouter from \"effect/http/HttpRouter\";\nimport * as HttpServer from \"effect/http/HttpServer\";\nimport type * as ActionRunner from \"./ActionRunner.js\";\nimport type * as Auth from \"./Auth.js\";\nimport type { ExecutionMetadata } from \"./ExecutionMetadata.js\";\nimport type { RequestMetadata } from \"./RequestMetadata.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type * as Handler from \"./Handler.js\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider.js\";\nimport * as ConvexLogger from \"./ConvexLogger.js\";\nimport type * as MutationRunner from \"./MutationRunner.js\";\nimport type * as QueryRunner from \"./QueryRunner.js\";\nimport * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport type * as Scheduler from \"./Scheduler.js\";\nimport type { Storage } from \"./Storage.js\";\nimport type { StorageActionWriter } from \"./StorageActionWriter.js\";\nimport type { StorageReader } from \"./StorageReader.js\";\nimport type { StorageWriter } from \"./StorageWriter.js\";\n\n/**\n * The Confect services available to HTTP route handlers and middleware,\n * supplied per request from the Convex action context.\n */\nexport type Services =\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | ExecutionMetadata\n | RequestMetadata\n | Storage\n | StorageReader\n | StorageWriter\n | StorageActionWriter;\n\n/**\n * A layer that registers routes on the HTTP router—the input to {@link make}.\n *\n * Compose it from Effect's `effect/http` and `effect/http-api` modules:\n * `HttpApiBuilder.layer(api)` registers an `HttpApi`'s endpoints (provide its\n * group handler layers with `Layer.provide`), `HttpApiScalar.layer(api, ...)`\n * serves interactive API docs, `HttpRouter.add` registers a plain route, and\n * `HttpRouter.middleware(fn, { global: true })` applies middleware to every\n * route. Merge any number of these with `Layer.mergeAll`.\n *\n * Route handlers and middleware may require any of the Confect {@link Services},\n * which surface as request-level `Requires` markers and are supplied per\n * request. Anything else the layer requires is a type error—notably, an\n * `HttpApiBuilder.layer(api)` whose group handler layers are not provided\n * leaves an `HttpApiGroup.ToService` requirement behind, so a missing handler\n * group is caught at compile time.\n *\n * Layers are built with Confect's Convex-aware `ConfigProvider` in context, so\n * `Config` reads (e.g. in `Layer.unwrap`) resolve against Convex environment\n * variables.\n */\nexport type Routes<Services_ = Services> = Layer.Layer<\n never,\n never,\n | HttpRouter.HttpRouter\n | Etag.Generator\n | FileSystem.FileSystem\n | HttpPlatform.HttpPlatform\n | Path.Path\n | HttpRouter.Request<\"Requires\", Services_>\n | HttpRouter.Request<\"GlobalRequires\", Services_>\n | HttpRouter.Request<\"Error\", any>\n | HttpRouter.Request<\"GlobalError\", any>\n>;\n\n/**\n * Create a Convex HTTP router serving the given routes.\n *\n * A single catch-all `httpAction` is registered for every routable method under\n * the path prefix `\"/\"`, making the Effect router the single source of truth\n * for paths: place an API with `HttpApi.prefix` or absolute route paths.\n * Requests that match no route receive the Effect router's 404 response.\n *\n * Supply `{ api }` with the `HttpApi` registered by the routes layer to show\n * endpoint patterns in Convex completion logs and the dashboard. Requests that\n * match no reflected endpoint keep the catch-all completion label. Without the\n * option, Convex reports the catch-all registrations. Application endpoints\n * must not overlap component HTTP mounts: Convex also uses dashboard route\n * entries to select between application and component routers.\n *\n * Plain Convex routes can still be added to the returned router—Convex matches\n * exact paths first and longer path prefixes before the catch-all, so they take\n * precedence.\n */\nexport const make = <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes,\n options?: { readonly api?: HttpApi.HttpApi<Id, Groups> | undefined },\n): ConvexHttpRouter =>\n makeWithLayer(routes, RegisteredFunction.baseActionLayer, options?.api);\n\n/**\n * Derive HTTP capabilities and ID scopes from the generated database schema.\n * Component routes are relative to their installation's HTTP mount prefix.\n * Supply `{ api }` as in {@link make}; labels stay component-relative.\n */\nexport const forSchema =\n <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n schema: DatabaseSchema_,\n ) =>\n <Id extends string, Groups extends HttpApiGroup.Constraint>(\n routes: Routes<Handler.ActionServices<DatabaseSchema_>>,\n options?: { readonly api?: HttpApi.HttpApi<Id, Groups> | undefined },\n ): ConvexHttpRouter =>\n makeWithLayer<\n Handler.ActionServices<DatabaseSchema_>,\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>,\n Id,\n Groups\n >(\n Match.value(schema.target.kind).pipe(\n Match.when(\"app\", () => routes),\n Match.when(\"component\", () =>\n routes.pipe(Layer.provide(componentRouter)),\n ),\n Match.exhaustive,\n ),\n (ctx) => RegisteredFunction.actionLayer(schema, ctx),\n options?.api,\n );\n\n// Convex uses a component-relative path to select its HTTP action but passes\n// the original request URL to that action. Its CONVEX_SITE_URL includes the\n// installation's full mount prefix (including parent mounts). Prefixing the\n// Effect router preserves relative routes without rewriting the Request body.\nconst componentRouter = Layer.effect(\n HttpRouter.HttpRouter,\n Effect.gen(function* () {\n const router = yield* HttpRouter.HttpRouter;\n const siteUrl = yield* Config.schema(\n Schema.URLFromString,\n \"CONVEX_SITE_URL\",\n );\n return router.prefixed(siteUrl.pathname);\n }).pipe(Effect.orDie),\n);\n\nconst makeWithLayer = <\n Services_,\n DataModel_ extends GenericDataModel,\n Id extends string,\n Groups extends HttpApiGroup.Constraint,\n>(\n routes: Routes<Services_>,\n layer: (ctx: GenericActionCtx<DataModel_>) => Layer.Layer<Services_>,\n api: HttpApi.HttpApi<Id, Groups> | undefined,\n): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n // Provided (not just merged) so that route layers' own construction—e.g.\n // a `Layer.unwrap` reading `Config`—resolves configuration through the\n // Convex-aware provider; merged so that request fibers—endpoint handlers\n // and middleware—do too.\n const AppLayer = routes.pipe(\n Layer.provideMerge(ConvexLogger.layer),\n Layer.provideMerge(ConvexConfigProvider.layer),\n Layer.provide(HttpServer.layerServices),\n );\n\n // The Confect service requirements of route handlers and middleware surface\n // as request-level `Requires` markers on the layer, which the web handler\n // exposes as a per-request context argument.\n const { handler } = HttpRouter.toWebHandler(AppLayer, {\n disableLogger: true,\n });\n\n const httpAction = httpActionGeneric((ctx, request): Promise<Response> => {\n // The ctx-backed service layers are all synchronous and finalizer-free,\n // so the scope can close as soon as the context is built.\n // Convex's HTTP registration erases the data model. The supplied generated\n // schema restores it; this does not change the runtime context or services.\n const services = Effect.runSync(\n Effect.scoped(\n Layer.build(layer(ctx as unknown as GenericActionCtx<DataModel_>)),\n ),\n );\n return handler(\n request,\n Context.add(services, Console.Console, globalThis.console),\n );\n });\n\n const convexHttpRouter = httpRouter();\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix: \"/\",\n method,\n handler: httpAction,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n if (api !== undefined) {\n const matcher = FindMyWay.make<string>();\n const reflected: ReturnType<ConvexHttpRouter[\"getRoutes\"]> = [];\n HttpApi.reflect(api, {\n onGroup: () => {},\n onEndpoint: ({ endpoint }) => {\n const method = ROUTABLE_HTTP_METHODS.find(\n (candidate) => candidate === endpoint.method,\n );\n if (method === undefined) return;\n const path = apiRouterPath(\n endpoint.path as FindMyWay.PathInput,\n endpoint.params,\n );\n matcher.on(method, path, endpoint.path);\n // Effect also matches a wildcard route's base path without its slash.\n if (path.endsWith(\"/*\")) {\n matcher.on(method, path.slice(0, -2) as `/${string}`, endpoint.path);\n }\n reflected.push([endpoint.path, method, httpAction]);\n },\n });\n reflected.sort(\n ([pathA, methodA], [pathB, methodB]) =>\n pathA.localeCompare(pathB) || methodA.localeCompare(methodB),\n );\n\n const getRoutes = convexHttpRouter.getRoutes;\n convexHttpRouter.getRoutes = () =>\n reflected.length === 0\n ? getRoutes()\n : [\n ...getRoutes().filter(([, , action]) => action !== httpAction),\n ...reflected,\n ];\n const lookup = convexHttpRouter.lookup;\n convexHttpRouter.lookup = (path, method) => {\n const match = lookup(path, method);\n if (match === null || match[0] !== httpAction) return match;\n const normalized = match[1];\n const reflectedPath = matcher.find(normalized, path)?.handler;\n return reflectedPath === undefined\n ? match\n : [httpAction, normalized, reflectedPath];\n };\n }\n\n return convexHttpRouter;\n};\n\n/*!\n * apiRouterPath is adapted from Effect 4.0.1 http-api/internal/path.ts.\n *\n * MIT License\n *\n * Copyright (c) 2023 Effectful Technologies Inc\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Match Effect's HttpApiBuilder path normalization, which is not publicly\n// exported (effect/http-api/internal/path.ts). Undeclared colons are literals;\n// declared params followed by a literal suffix need an explicit regex boundary.\nconst apiRouterPath = (\n path: FindMyWay.PathInput,\n params: Schema.Top | undefined,\n): FindMyWay.PathInput => {\n if (params === undefined || !path.includes(\":\")) return path;\n let ast = params.ast;\n while (ast.encoding !== undefined) {\n ast = ast.encoding[ast.encoding.length - 1].to;\n }\n if (!SchemaAST.isObjects(ast) || ast.indexSignatures.length !== 0)\n return path;\n const names = new Set(\n ast.propertySignatures.map((property) => String(property.name)),\n );\n let normalized = \"\";\n let depth = 0;\n let regexStart = -1;\n for (let i = 0; i < path.length; i++) {\n const char = path[i];\n if (depth > 0 || i === regexStart) {\n normalized += char;\n if (char === \"\\\\\") normalized += path[++i] ?? \"\";\n else if (char === \"(\") depth++;\n else if (char === \")\") depth--;\n } else if (char !== \":\") {\n normalized += char;\n } else if (path[i + 1] === \":\") {\n normalized += \"::\";\n i++;\n } else {\n const param = /^:(\\w+)/.exec(path.slice(i));\n if (param !== null && names.has(param[1])) {\n normalized += param[0];\n i += param[0].length - 1;\n const next = path[i + 1];\n if (next === \"(\") regexStart = i + 1;\n else if (next !== undefined && !\"/.-?\".includes(next))\n normalized += \"(.*?)\";\n } else {\n normalized += \"::\";\n }\n }\n }\n return normalized as FindMyWay.PathInput;\n};\n\n// These are necessary until the Convex runtime supports these APIs. See\n// https://discord.com/channels/1019350475847499849/1281364098419785760\n// Each patch is applied only where the API is actually broken, so runtimes\n// with working implementations—Node under convex-test, notably, where\n// `new AbortSignal()` is an illegal constructor—keep their native behavior.\nconst applyMonkeyPatches = () => {\n const urlCredentialsBroken = (() => {\n try {\n return new URL(\"https://confect.dev\").username === undefined;\n } catch {\n return true;\n }\n })();\n if (urlCredentialsBroken) {\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n }\n\n const requestSignalBroken = (() => {\n try {\n return new Request(\"https://confect.dev\").signal === undefined;\n } catch {\n return true;\n }\n })();\n if (requestSignalBroken) {\n // `configurable` so repeated definition—e.g. module re-evaluation in a\n // long-lived environment—does not throw.\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n configurable: true,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,MAAa,QACX,QACA,YAEA,cAAc,QAAQA,iBAAoC,SAAS,GAAG;;;;;;AAOxE,MAAa,aAET,YAGA,QACA,YAEA,cAME,MAAM,MAAM,OAAO,OAAO,IAAI,CAAC,CAAC,KAC9B,MAAM,KAAK,aAAa,MAAM,GAC9B,MAAM,KAAK,mBACT,OAAO,KAAK,MAAM,QAAQ,eAAe,CAAC,CAC5C,GACA,MAAM,UACR,IACC,QAAQC,YAA+B,QAAQ,GAAG,GACnD,SAAS,GACX;AAMJ,MAAM,kBAAkB,MAAM,OAC5B,WAAW,YACX,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO,WAAW;CACjC,MAAM,UAAU,OAAO,OAAO,OAC5B,OAAO,eACP,iBACF;CACA,OAAO,OAAO,SAAS,QAAQ,QAAQ;AACzC,CAAC,CAAC,CAAC,KAAK,OAAO,KAAK,CACtB;AAEA,MAAM,iBAMJ,QACA,SACA,QACqB;CACrB,mBAAmB;CAMnB,MAAM,WAAW,OAAO,KACtB,MAAM,aAAaC,OAAkB,GACrC,MAAM,aAAaC,KAA0B,GAC7C,MAAM,QAAQ,WAAW,aAAa,CACxC;CAKA,MAAM,EAAE,YAAY,WAAW,aAAa,UAAU,EACpD,eAAe,KACjB,CAAC;CAED,MAAM,aAAa,mBAAmB,KAAK,YAA+B;EAKxE,MAAM,WAAW,OAAO,QACtB,OAAO,OACL,MAAM,MAAMC,QAAM,GAA8C,CAAC,CACnE,CACF;EACA,OAAO,QACL,SACA,QAAQ,IAAI,UAAU,QAAQ,SAAS,WAAW,OAAO,CAC3D;CACF,CAAC;CAED,MAAM,mBAAmB,WAAW;CAEpC,MAA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rB,MAAM,cAAc,IAAI;EACtB,IAAa,WAAW;GACtB,OAAO;EACT;EACA,IAAa,WAAW;GACtB,OAAO;EACT;CACF;CAUF,WAPmC;EACjC,IAAI;GACF,OAAO,IAAI,QAAQ,qBAAqB,CAAC,CAAC,WAAW,KAAA;EACvD,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CACsB,GAGpB,OAAO,eAAe,QAAQ,WAAW,UAAU;EACjD,WAAW,IAAI,YAAY;EAC3B,cAAc;CAChB,CAAC;AAEL"}
|
package/dist/MiddlewareImpl.d.ts
CHANGED
|
@@ -5,20 +5,20 @@ import type { FunctionType } from "convex/server";
|
|
|
5
5
|
import * as Context from "effect/Context";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Layer from "effect/Layer";
|
|
8
|
-
import type * as Auth from "./Auth";
|
|
9
|
-
import type * as DatabaseReader from "./DatabaseReader";
|
|
10
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
11
|
-
import type * as Handler from "./Handler";
|
|
12
|
-
import type { ExecutionMetadata } from "./ExecutionMetadata";
|
|
13
|
-
import type { RequestMetadata } from "./RequestMetadata";
|
|
14
|
-
import type { TransactionMetadata } from "./TransactionMetadata";
|
|
15
|
-
import type * as MutationRunner from "./MutationRunner";
|
|
16
|
-
import type * as QueryRunner from "./QueryRunner";
|
|
17
|
-
import type { QueryTransactionContext } from "./QueryTransactionContext";
|
|
18
|
-
import type * as Scheduler from "./Scheduler";
|
|
19
|
-
import type { Storage } from "./Storage";
|
|
20
|
-
import type * as StorageReader from "./StorageReader";
|
|
21
|
-
import type * as StorageWriter from "./StorageWriter";
|
|
8
|
+
import type * as Auth from "./Auth.js";
|
|
9
|
+
import type * as DatabaseReader from "./DatabaseReader.js";
|
|
10
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
11
|
+
import type * as Handler from "./Handler.js";
|
|
12
|
+
import type { ExecutionMetadata } from "./ExecutionMetadata.js";
|
|
13
|
+
import type { RequestMetadata } from "./RequestMetadata.js";
|
|
14
|
+
import type { TransactionMetadata } from "./TransactionMetadata.js";
|
|
15
|
+
import type * as MutationRunner from "./MutationRunner.js";
|
|
16
|
+
import type * as QueryRunner from "./QueryRunner.js";
|
|
17
|
+
import type { QueryTransactionContext } from "./QueryTransactionContext.js";
|
|
18
|
+
import type * as Scheduler from "./Scheduler.js";
|
|
19
|
+
import type { Storage } from "./Storage.js";
|
|
20
|
+
import type * as StorageReader from "./StorageReader.js";
|
|
21
|
+
import type * as StorageWriter from "./StorageWriter.js";
|
|
22
22
|
/**
|
|
23
23
|
* Marker service produced by providing a middleware's implementation to a
|
|
24
24
|
* group's impl layer. `GroupImpl.make` requires one per middleware attached to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiddlewareImpl.d.ts","sourceRoot":"","sources":["../src/MiddlewareImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"MiddlewareImpl.d.ts","sourceRoot":"","sources":["../src/MiddlewareImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAA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