@confect/core 10.0.0-next.8 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +966 -46
- package/README.md +3 -1
- package/dist/FunctionProvenance.d.ts +166 -68
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +55 -13
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +320 -138
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +56 -13
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GenericId.d.ts.map +1 -1
- package/dist/GenericId.js +1 -1
- package/dist/GroupPath.d.ts +6 -10
- package/dist/GroupPath.d.ts.map +1 -1
- package/dist/GroupPath.js.map +1 -1
- package/dist/GroupSpec.d.ts +25 -12
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +51 -14
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Identifier.d.ts +6 -5
- package/dist/Identifier.d.ts.map +1 -1
- package/dist/Identifier.js +6 -5
- package/dist/Identifier.js.map +1 -1
- package/dist/Lazy.d.ts +11 -14
- package/dist/Lazy.d.ts.map +1 -1
- package/dist/Lazy.js +11 -14
- package/dist/Lazy.js.map +1 -1
- package/dist/MiddlewareAttachment.d.ts +171 -0
- package/dist/MiddlewareAttachment.d.ts.map +1 -0
- package/dist/MiddlewareAttachment.js +48 -0
- package/dist/MiddlewareAttachment.js.map +1 -0
- package/dist/MiddlewareSpec.d.ts +198 -0
- package/dist/MiddlewareSpec.d.ts.map +1 -0
- package/dist/MiddlewareSpec.js +60 -0
- package/dist/MiddlewareSpec.js.map +1 -0
- package/dist/PaginationError.d.ts +20 -0
- package/dist/PaginationError.d.ts.map +1 -0
- package/dist/PaginationError.js +31 -0
- package/dist/PaginationError.js.map +1 -0
- package/dist/PaginationOptions.d.ts +23 -0
- package/dist/PaginationOptions.d.ts.map +1 -0
- package/dist/PaginationOptions.js +29 -0
- package/dist/PaginationOptions.js.map +1 -0
- package/dist/PaginationResult.d.ts +1 -0
- package/dist/PaginationResult.d.ts.map +1 -1
- package/dist/PaginationResult.js.map +1 -1
- package/dist/Ref.d.ts +135 -47
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +104 -46
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +10 -5
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +5 -4
- package/dist/Refs.js.map +1 -1
- package/dist/SchemaToValidator.d.ts +99 -0
- package/dist/SchemaToValidator.d.ts.map +1 -0
- package/dist/SchemaToValidator.js +158 -0
- package/dist/SchemaToValidator.js.map +1 -0
- package/dist/Spec.d.ts +16 -12
- package/dist/Spec.d.ts.map +1 -1
- package/dist/Spec.js +14 -9
- package/dist/Spec.js.map +1 -1
- package/dist/SystemFields.d.ts +16 -15
- package/dist/SystemFields.d.ts.map +1 -1
- package/dist/SystemFields.js +16 -15
- package/dist/SystemFields.js.map +1 -1
- package/dist/Table.d.ts +75 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Table.js +77 -0
- package/dist/Table.js.map +1 -0
- package/dist/Types.d.ts +8 -2
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js.map +1 -1
- package/dist/UserIdentity.d.ts.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/package.json +17 -15
- package/src/FunctionProvenance.ts +197 -34
- package/src/FunctionSpec.ts +332 -86
- package/src/GroupPath.ts +6 -12
- package/src/GroupSpec.ts +184 -25
- package/src/Identifier.ts +6 -5
- package/src/Lazy.ts +11 -14
- package/src/MiddlewareAttachment.ts +106 -0
- package/src/MiddlewareSpec.ts +392 -0
- package/src/PaginationError.ts +78 -0
- package/src/PaginationOptions.ts +23 -0
- package/src/PaginationResult.ts +4 -0
- package/src/Ref.ts +468 -236
- package/src/Refs.ts +43 -18
- package/src/SchemaToValidator.ts +612 -0
- package/src/Spec.ts +50 -39
- package/src/SystemFields.ts +32 -36
- package/src/Table.ts +427 -0
- package/src/Types.ts +9 -3
- package/src/index.ts +6 -1
- package/dist/Registry.d.ts +0 -24
- package/dist/Registry.d.ts.map +0 -1
- package/dist/Registry.js +0 -19
- package/dist/Registry.js.map +0 -1
- package/dist/tsconfig.src.tsbuildinfo +0 -1
- package/src/Registry.ts +0 -30
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MiddlewareSpec.js","names":[],"sources":["../src/MiddlewareSpec.ts"],"sourcesContent":["import type { FunctionType, FunctionVisibility } from \"convex/server\";\nimport type * as Effect from \"effect/Effect\";\nimport * as Predicate from \"effect/Predicate\";\nimport type * as Schema from \"effect/Schema\";\nimport type { unhandled } from \"effect/Types\";\nimport type * as FunctionProvenance from \"./FunctionProvenance\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport * as Lazy from \"./Lazy\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"~@confect/core/MiddlewareSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isMiddlewareSpec = (u: unknown): u is AnyMiddlewareSpec =>\n Predicate.hasProperty(u, TypeId);\n\nexport const allFunctionTypes: ReadonlyArray<FunctionType> = [\n \"query\",\n \"mutation\",\n \"action\",\n];\n\nexport interface SupportedFunctionTypes {\n readonly query: boolean;\n readonly mutation: boolean;\n readonly action: boolean;\n}\n\n/**\n * Marker success type used by middleware to represent the handler's outcome\n * without exposing its concrete success value.\n *\n * Mirrors `RpcMiddleware.SuccessValue` in Effect.\n */\nexport interface SuccessValue {\n readonly _: unique symbol;\n}\n\n/**\n * The wrap-style middleware implementation shape: receives the downstream\n * effect (the remaining middleware plus the function handler) and the covered\n * invocation's metadata, and returns the effect that runs in its place.\n *\n * Mirrors `RpcMiddleware.RpcMiddleware` in Effect.\n */\nexport interface MiddlewareImpl<Provides_, E, R, Options_ = never> {\n (\n effect: Effect.Effect<SuccessValue, E | unhandled, Provides_>,\n context: MiddlewareOptions<Options_>,\n ): Effect.Effect<SuccessValue, E | unhandled, R>;\n}\n\nexport type MiddlewareOptions<Options_ = never> = {\n readonly invocation: {\n readonly name: string;\n readonly functionType: FunctionType;\n readonly functionVisibility: FunctionVisibility;\n readonly args: unknown;\n };\n} & ([Options_] extends [never] ? unknown : { readonly options: Options_ });\n\nexport interface AnyMiddlewareImpl {\n (\n effect: Effect.Effect<SuccessValue, any, any>,\n context: MiddlewareOptions | MiddlewareOptions<unknown>,\n ): Effect.Effect<SuccessValue, any, any>;\n}\n\n/**\n * The class shape produced by {@link MiddlewareSpec}. Only the static side is\n * ever used—the class is a value-level carrier for the middleware's key, its\n * declared functionTypes, and its (lazily-evaluated) error schema, plus the\n * type-level `Provides`/`Error` metadata. It is deliberately not a\n * `Context.Tag`: implementations are registered through the group `Registry`\n * (like `FunctionImpl`s), not resolved from a Layer context.\n */\nexport interface MiddlewareSpec<\n in out Self,\n Key_ extends string,\n Provides_,\n Requires_,\n ErrorSchema_ extends Schema.Codec<any, any>,\n FunctionTypes_ extends FunctionType,\n OptionsSchema_ extends Schema.Schema<any> = never,\n> {\n new (_: never): {\n readonly [TypeId]: TypeId;\n readonly key: Key_;\n };\n readonly [TypeId]: TypeId;\n readonly key: Key_;\n readonly functionTypes: SupportedFunctionTypes;\n readonly error?: ErrorSchema_;\n readonly options?: OptionsSchema_;\n readonly \"~Provides\": Provides_;\n readonly \"~Requires\": Requires_;\n readonly \"~Error\": ErrorSchema_;\n readonly \"~FunctionTypes\": FunctionTypes_;\n readonly \"~Self\": Self;\n readonly \"~Options\": OptionsSchema_;\n}\n\nexport interface AnyMiddlewareSpec {\n readonly [TypeId]: TypeId;\n readonly key: string;\n readonly functionTypes: SupportedFunctionTypes;\n readonly error?: Schema.Codec<any, any>;\n readonly options?: Schema.Schema<any>;\n readonly \"~Provides\": any;\n readonly \"~Requires\": any;\n readonly \"~Error\": any;\n readonly \"~FunctionTypes\": FunctionType;\n readonly \"~Options\": any;\n}\n\nexport type Options<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_[\"~Options\"][\"Type\"];\n\nexport type WithoutOptions<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec\n ? [MiddlewareSpec_[\"~Options\"]] extends [never]\n ? MiddlewareSpec_\n : never\n : never;\n\nexport type Key<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_[\"key\"];\n\nexport type Provides<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec\n ? MiddlewareSpec_[\"~Provides\"]\n : never;\n\n/**\n * The services a middleware's implementation may consume from middleware that\n * runs earlier in the same chain (type-level only, like `provides`).\n */\nexport type Requires<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec\n ? MiddlewareSpec_[\"~Requires\"]\n : never;\n\nexport type ErrorSchema<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec ? MiddlewareSpec_[\"~Error\"] : never;\n\nexport type Error<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec\n ? MiddlewareSpec_[\"~Error\"][\"Type\"]\n : never;\n\nexport type EncodedError<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec\n ? MiddlewareSpec_[\"~Error\"][\"Encoded\"]\n : never;\n\nexport type FunctionTypes<MiddlewareSpec_ extends AnyMiddlewareSpec> =\n MiddlewareSpec_ extends AnyMiddlewareSpec\n ? MiddlewareSpec_[\"~FunctionTypes\"]\n : never;\n\n/**\n * Declare a middleware's client-safe interface: its identifying key, the\n * service it provides to downstream handlers, the error schema its failures\n * encode through, and the function types it may attach to.\n *\n * ```ts\n * class RequireUser extends MiddlewareSpec.MiddlewareSpec<\n * RequireUser,\n * {\n * provides: CurrentUser;\n * }\n * >()(\"RequireUser\", {\n * error: () => NotSignedIn,\n * functionTypes: { query: true, mutation: true, action: false },\n * }) {}\n * ```\n *\n * The implementation is server-only and supplied separately via\n * `MiddlewareImpl.make` (or `makeByFunctionType`/`provides`) in\n * `@confect/server`.\n */\nexport const MiddlewareSpec =\n <Self, Config extends { provides?: any; requires?: any } = {}>() =>\n <\n const Key_ extends string,\n const FunctionTypesConfig_ extends SupportedFunctionTypes,\n ErrorSchema_ extends Schema.Codec<any, any> = never,\n OptionsSchema_ extends Schema.Schema<any> = never,\n >(\n key: Key_,\n options: {\n readonly error?: () => ErrorSchema_;\n readonly options?: () => OptionsSchema_;\n readonly functionTypes: FunctionTypesConfig_ &\n ValidateFunctionTypesConfig<FunctionTypesConfig_>;\n },\n ): MiddlewareSpec<\n Self,\n Key_,\n \"provides\" extends keyof Config ? Config[\"provides\"] : never,\n \"requires\" extends keyof Config ? Config[\"requires\"] : never,\n ErrorSchema_,\n FunctionTypesFromConfig<FunctionTypesConfig_>,\n OptionsSchema_\n > => {\n const { query, mutation, action } = options.functionTypes;\n if (!query && !mutation && !action) {\n throw new Error(\n `Middleware \"${key}\" must declare at least one function type`,\n );\n }\n\n function MiddlewareSpecClass() {}\n const class_ = MiddlewareSpecClass as any;\n class_[TypeId] = TypeId;\n class_.key = key;\n class_.functionTypes = {\n query,\n mutation,\n action,\n } satisfies SupportedFunctionTypes;\n if (options.error !== undefined) {\n Lazy.defineProperty(class_, \"error\", options.error);\n }\n if (options.options !== undefined) {\n Lazy.defineProperty(class_, \"options\", options.options);\n }\n return class_;\n };\n\ntype FunctionTypesFromConfig<Config extends SupportedFunctionTypes> = {\n [K in FunctionType]: Config[K] extends true ? K : never;\n}[FunctionType];\n\ntype ValidateFunctionTypesConfig<Config extends SupportedFunctionTypes> =\n ValidationResult<\n | {\n [K in keyof Config]: boolean extends Config[K]\n ? AttachmentError<`Function type flag \"${K & string}\" must be a literal \\`true\\` or \\`false\\`, not a computed \\`boolean\\``>\n : never;\n }[keyof Config]\n | ([FunctionTypesFromConfig<Config>] extends [never]\n ? AttachmentError<`A middleware must declare at least one function type`>\n : never)\n >;\n\nexport const errorSchemas = (\n middlewareSpecs: ReadonlyArray<AnyMiddlewareSpec>,\n): ReadonlyArray<Schema.Codec<any, any>> =>\n middlewareSpecs.flatMap((middlewareSpec) =>\n \"error\" in middlewareSpec && middlewareSpec.error !== undefined\n ? [middlewareSpec.error]\n : [],\n );\n\n/**\n * A branded, unconstructible type carrying a spec-authoring error message.\n * Surfaced as (part of) a parameter type so the diagnostic names the exact\n * problem at the `.middleware()`/`.addFunction()` call site.\n */\nexport interface AttachmentError<Message extends string> {\n readonly \"~@confect/core/MiddlewareSpec/AttachmentError\": Message;\n}\n\ntype FunctionTypeOf<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"][\"functionType\"];\n\ntype ValidationResult<Errors> = [Errors] extends [never] ? unknown : Errors;\n\n/**\n * A matching-type Convex-provenance function is rejected rather than silently\n * skipped: its raw handler passes through Confect untouched, so the middleware\n * could not actually cover it, and skipping it would be a policy hole.\n */\nexport type ValidateFunction<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n MiddlewareSpec_ extends AnyMiddlewareSpec,\n> = FunctionSpec_ extends any\n ? MiddlewareSpec_ extends any\n ? FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Convex\" };\n }\n ? FunctionTypeOf<FunctionSpec_> extends FunctionTypes<MiddlewareSpec_>\n ? AttachmentError<`Convex-provenance function \"${FunctionSpec_[\"name\"]}\" cannot be covered by middleware \"${Key<MiddlewareSpec_>}\"—attach middleware only to groups whose matching-type functions are all Confect-provenance`>\n : never\n : [\n Extract<\n FunctionSpec.MiddlewareSpecs<FunctionSpec_>,\n { readonly key: Key<WithoutOptions<MiddlewareSpec_>> }\n >,\n ] extends [never]\n ? FunctionTypeOf<FunctionSpec_> extends FunctionTypes<MiddlewareSpec_>\n ? never\n : AttachmentError<`Middleware \"${Key<MiddlewareSpec_>}\" does not declare function type \"${FunctionTypeOf<FunctionSpec_>}\", the type of function \"${FunctionSpec_[\"name\"]}\"`>\n : AttachmentError<`Middleware \"${Key<MiddlewareSpec_>}\" is already attached to function \"${FunctionSpec_[\"name\"]}\"`>\n : never\n : never;\n\n/**\n * Attachment order is chain order, so requiring `requires` to be satisfied by\n * already-attached middleware is exactly requiring the provider to run\n * earlier.\n */\nexport type ValidateAttach<\n MiddlewareSpec_ extends AnyMiddlewareSpec,\n Functions_ extends FunctionSpec.AnyWithProps,\n MiddlewareSpecs_ extends AnyMiddlewareSpec,\n> = [\n Extract<\n MiddlewareSpecs_,\n { readonly key: Key<WithoutOptions<MiddlewareSpec_>> }\n >,\n] extends [never]\n ? [Exclude<Requires<MiddlewareSpec_>, Provides<MiddlewareSpecs_>>] extends [\n never,\n ]\n ? ValidationResult<ValidateFunction<Functions_, MiddlewareSpec_>>\n : AttachmentError<`Middleware \"${Key<MiddlewareSpec_>}\" requires services that no middleware attached earlier to this group provides—attach the providing middleware first`>\n : AttachmentError<`Middleware \"${Key<MiddlewareSpec_>}\" is already attached to this group`>;\n\nexport type ValidateAddedFunction<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n MiddlewareSpecs_ extends AnyMiddlewareSpec,\n> = [MiddlewareSpecs_] extends [never]\n ? unknown\n : ValidationResult<\n | ValidateFunction<FunctionSpec_, MiddlewareSpecs_>\n | GroupOverlap<FunctionSpec_, MiddlewareSpecs_>\n >;\n\ntype GroupOverlap<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n MiddlewareSpecs_ extends AnyMiddlewareSpec,\n> =\n FunctionSpec.MiddlewareSpecs<FunctionSpec_> extends infer FunctionMiddlewareSpec\n ? FunctionMiddlewareSpec extends AnyMiddlewareSpec\n ? [\n Extract<\n MiddlewareSpecs_,\n { readonly key: Key<WithoutOptions<FunctionMiddlewareSpec>> }\n >,\n ] extends [never]\n ? never\n : AttachmentError<`Middleware \"${Key<FunctionMiddlewareSpec>}\" is attached to both function \"${FunctionSpec_[\"name\"]}\" and its group`>\n : never\n : never;\n\n/**\n * The parameter-type validation applied to the group spec at `GroupImpl.make`:\n * every function's attached middleware must have its `requires` services\n * provided by some middleware covering that function (the group's or the\n * function's own). Checked here—with the group fully assembled—rather than at\n * the spec builders, because a function-level middleware's `requires` may\n * legitimately be satisfied by a group middleware the function spec never sees,\n * and group attachment is declaratively order-independent with respect to\n * `addFunction`.\n */\nexport type ValidateImplRequires<\n Functions_ extends FunctionSpec.AnyWithProps,\n GroupMiddlewareSpecs_ extends AnyMiddlewareSpec,\n> = ValidationResult<\n Functions_ extends any\n ? [\n Exclude<\n Requires<FunctionSpec.MiddlewareSpecs<Functions_>>,\n Provides<\n GroupMiddlewareSpecs_ | FunctionSpec.MiddlewareSpecs<Functions_>\n >\n >,\n ] extends [never]\n ? never\n : AttachmentError<`Function \"${Functions_[\"name\"]}\" has middleware requiring services that no middleware covering it provides`>\n : never\n>;\n\nexport type ValidateFunctionAttach<\n MiddlewareSpec_ extends AnyMiddlewareSpec,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n MiddlewareSpecs_ extends AnyMiddlewareSpec,\n> = FunctionProvenance_ extends { readonly _tag: \"Convex\" }\n ? AttachmentError<`Plain Convex functions cannot have middleware—their raw handlers are passed through untouched`>\n : [\n Extract<\n MiddlewareSpecs_,\n { readonly key: Key<WithoutOptions<MiddlewareSpec_>> }\n >,\n ] extends [never]\n ? RuntimeAndFunctionType_[\"functionType\"] extends FunctionTypes<MiddlewareSpec_>\n ? unknown\n : AttachmentError<`Middleware \"${Key<MiddlewareSpec_>}\" does not declare function type \"${RuntimeAndFunctionType_[\"functionType\"]}\"`>\n : AttachmentError<`Middleware \"${Key<MiddlewareSpec_>}\" is already attached to this function`>;\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,SAAS;AAGtB,MAAa,oBAAoB,MAC/B,UAAU,YAAY,GAAG,MAAM;AAEjC,MAAa,mBAAgD;CAC3D;CACA;CACA;AACF;;;;;;;;;;;;;;;;;;;;;;AAiKA,MAAa,wBAQT,KACA,YAcG;CACH,MAAM,EAAE,OAAO,UAAU,WAAW,QAAQ;CAC5C,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAC1B,MAAM,IAAI,MACR,eAAe,IAAI,0CACrB;CAGF,SAAS,sBAAsB,CAAC;CAChC,MAAM,SAAS;CACf,OAAO,UAAU;CACjB,OAAO,MAAM;CACb,OAAO,gBAAgB;EACrB;EACA;EACA;CACF;CACA,IAAI,QAAQ,UAAU,KAAA,GACpB,eAAoB,QAAQ,SAAS,QAAQ,KAAK;CAEpD,IAAI,QAAQ,YAAY,KAAA,GACtB,eAAoB,QAAQ,WAAW,QAAQ,OAAO;CAExD,OAAO;AACT;AAkBF,MAAa,gBACX,oBAEA,gBAAgB,SAAS,mBACvB,WAAW,kBAAkB,eAAe,UAAU,KAAA,IAClD,CAAC,eAAe,KAAK,IACrB,CAAC,CACP"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Option from "effect/Option";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
declare const InvalidCursor_base: Schema.Class<InvalidCursor, Schema.TaggedStruct<"InvalidCursor", {
|
|
4
|
+
readonly cause: Schema.Defect;
|
|
5
|
+
}>, import("effect/Cause").YieldableError>;
|
|
6
|
+
/**
|
|
7
|
+
* A Convex pagination cursor that no longer describes the current query.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InvalidCursor extends InvalidCursor_base {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Recognizes an invalid-cursor error emitted by a Convex query.
|
|
13
|
+
*/
|
|
14
|
+
export declare const fromConvexQueryError: (error: unknown) => Option.Option<InvalidCursor>;
|
|
15
|
+
/**
|
|
16
|
+
* Recognizes the error data attached to Convex's invalid-cursor error.
|
|
17
|
+
*/
|
|
18
|
+
export declare const fromConvexErrorData: (errorData: unknown) => Option.Option<InvalidCursor>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=PaginationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationError.d.ts","sourceRoot":"","sources":["../src/PaginationError.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;AAExC;;GAEG;AACH,qBAAa,aAAc,SAAQ,kBAKlC;CAAG;AA8BJ;;GAEG;AACH,eAAO,MAAM,oBAAoB,UACxB,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,aAAa,CAc3B,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,mBAAmB,cACnB,OAAO,KACjB,MAAM,CAAC,MAAM,CAAC,aAAa,CAO3B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
import { ConvexError } from "convex/values";
|
|
5
|
+
import * as Match from "effect/Match";
|
|
6
|
+
//#region src/PaginationError.ts
|
|
7
|
+
var PaginationError_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
InvalidCursor: () => InvalidCursor,
|
|
9
|
+
fromConvexErrorData: () => fromConvexErrorData,
|
|
10
|
+
fromConvexQueryError: () => fromConvexQueryError
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* A Convex pagination cursor that no longer describes the current query.
|
|
14
|
+
*/
|
|
15
|
+
var InvalidCursor = class extends Schema.TaggedError()("InvalidCursor", { cause: Schema.Defect() }) {};
|
|
16
|
+
const ConvexErrorIdentifier = Symbol.for("ConvexError");
|
|
17
|
+
const isConvexError = (error) => error instanceof ConvexError || typeof error === "object" && error !== null && ConvexErrorIdentifier in error;
|
|
18
|
+
const isInvalidCursorData = (value) => typeof value === "object" && value !== null && "isConvexSystemError" in value && value.isConvexSystemError === true && "paginationError" in value && value.paginationError === "InvalidCursor";
|
|
19
|
+
const fromErrorMessage = (error) => error.message.includes("InvalidCursor") ? Option.some(new InvalidCursor({ cause: error })) : Option.none();
|
|
20
|
+
/**
|
|
21
|
+
* Recognizes an invalid-cursor error emitted by a Convex query.
|
|
22
|
+
*/
|
|
23
|
+
const fromConvexQueryError = (error) => Match.value(error).pipe(Match.when(isConvexError, (convexError) => Match.value(isInvalidCursorData(convexError.data)).pipe(Match.when(true, () => Option.some(new InvalidCursor({ cause: error }))), Match.when(false, () => fromErrorMessage(convexError)), Match.exhaustive)), Match.when(Match.instanceOf(globalThis.Error), fromErrorMessage), Match.when(Match.any, () => Option.none()), Match.exhaustive);
|
|
24
|
+
/**
|
|
25
|
+
* Recognizes the error data attached to Convex's invalid-cursor error.
|
|
26
|
+
*/
|
|
27
|
+
const fromConvexErrorData = (errorData) => Match.value(errorData).pipe(Match.when(isInvalidCursorData, (cause) => Option.some(new InvalidCursor({ cause }))), Match.when(Match.any, () => Option.none()), Match.exhaustive);
|
|
28
|
+
//#endregion
|
|
29
|
+
export { InvalidCursor, PaginationError_exports, fromConvexErrorData, fromConvexQueryError };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=PaginationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationError.js","names":[],"sources":["../src/PaginationError.ts"],"sourcesContent":["import { ConvexError } from \"convex/values\";\nimport type { Value } from \"convex/values\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\n\n/**\n * A Convex pagination cursor that no longer describes the current query.\n */\nexport class InvalidCursor extends Schema.TaggedError<InvalidCursor>()(\n \"InvalidCursor\",\n {\n cause: Schema.Defect(),\n },\n) {}\n\ninterface InvalidCursorData {\n readonly isConvexSystemError: true;\n readonly paginationError: \"InvalidCursor\";\n}\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nconst isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\nconst isInvalidCursorData = (value: unknown): value is InvalidCursorData =>\n typeof value === \"object\" &&\n value !== null &&\n \"isConvexSystemError\" in value &&\n value.isConvexSystemError === true &&\n \"paginationError\" in value &&\n value.paginationError === \"InvalidCursor\";\n\nconst fromErrorMessage = (\n error: globalThis.Error,\n): Option.Option<InvalidCursor> =>\n error.message.includes(\"InvalidCursor\")\n ? Option.some(new InvalidCursor({ cause: error }))\n : Option.none();\n\n/**\n * Recognizes an invalid-cursor error emitted by a Convex query.\n */\nexport const fromConvexQueryError = (\n error: unknown,\n): Option.Option<InvalidCursor> =>\n Match.value(error).pipe(\n Match.when(isConvexError, (convexError) =>\n Match.value(isInvalidCursorData(convexError.data)).pipe(\n Match.when(true, () =>\n Option.some(new InvalidCursor({ cause: error })),\n ),\n Match.when(false, () => fromErrorMessage(convexError)),\n Match.exhaustive,\n ),\n ),\n Match.when(Match.instanceOf(globalThis.Error), fromErrorMessage),\n Match.when(Match.any, () => Option.none<InvalidCursor>()),\n Match.exhaustive,\n );\n\n/**\n * Recognizes the error data attached to Convex's invalid-cursor error.\n */\nexport const fromConvexErrorData = (\n errorData: unknown,\n): Option.Option<InvalidCursor> =>\n Match.value(errorData).pipe(\n Match.when(isInvalidCursorData, (cause) =>\n Option.some(new InvalidCursor({ cause })),\n ),\n Match.when(Match.any, () => Option.none<InvalidCursor>()),\n Match.exhaustive,\n );\n"],"mappings":";;;;;;;;;;;;;;AASA,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CACpE,iBACA,EACE,OAAO,OAAO,OAAO,EACvB,CACF,CAAC,CAAC,CAAC;AAOH,MAAM,wBAAwB,OAAO,IAAI,aAAa;AAEtD,MAAM,iBAAiB,UACrB,iBAAiB,eAChB,OAAO,UAAU,YAChB,UAAU,QACV,yBAAyB;AAE7B,MAAM,uBAAuB,UAC3B,OAAO,UAAU,YACjB,UAAU,QACV,yBAAyB,SACzB,MAAM,wBAAwB,QAC9B,qBAAqB,SACrB,MAAM,oBAAoB;AAE5B,MAAM,oBACJ,UAEA,MAAM,QAAQ,SAAS,eAAe,IAClC,OAAO,KAAK,IAAI,cAAc,EAAE,OAAO,MAAM,CAAC,CAAC,IAC/C,OAAO,KAAK;;;;AAKlB,MAAa,wBACX,UAEA,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,gBAAgB,gBACzB,MAAM,MAAM,oBAAoB,YAAY,IAAI,CAAC,CAAC,CAAC,KACjD,MAAM,KAAK,YACT,OAAO,KAAK,IAAI,cAAc,EAAE,OAAO,MAAM,CAAC,CAAC,CACjD,GACA,MAAM,KAAK,aAAa,iBAAiB,WAAW,CAAC,GACrD,MAAM,UACR,CACF,GACA,MAAM,KAAK,MAAM,WAAW,WAAW,KAAK,GAAG,gBAAgB,GAC/D,MAAM,KAAK,MAAM,WAAW,OAAO,KAAoB,CAAC,GACxD,MAAM,UACR;;;;AAKF,MAAa,uBACX,cAEA,MAAM,MAAM,SAAS,CAAC,CAAC,KACrB,MAAM,KAAK,sBAAsB,UAC/B,OAAO,KAAK,IAAI,cAAc,EAAE,MAAM,CAAC,CAAC,CAC1C,GACA,MAAM,KAAK,MAAM,WAAW,OAAO,KAAoB,CAAC,GACxD,MAAM,UACR"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/**
|
|
3
|
+
* Schema for the `paginationOpts` argument that every paginated query receives.
|
|
4
|
+
* Mirrors `paginationOptsValidator` from `convex/server`.
|
|
5
|
+
*
|
|
6
|
+
* Use this as the `paginationOpts` field of a paginated query's args schema.
|
|
7
|
+
* Beyond `numItems` and `cursor`, Convex's pagination protocol sends the
|
|
8
|
+
* optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)
|
|
9
|
+
* with real requests—most notably `usePaginatedQuery` from `convex/react`
|
|
10
|
+
* always includes `id`, and includes `endCursor` when splitting pages.
|
|
11
|
+
* Declaring them is required for the generated Convex argument validator to
|
|
12
|
+
* accept those requests and for the fields to survive decoding and reach
|
|
13
|
+
* `paginate`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PaginationOptions: Schema.Struct<{
|
|
16
|
+
readonly numItems: Schema.Finite;
|
|
17
|
+
readonly cursor: Schema.Union<readonly [Schema.String, Schema.Null]>;
|
|
18
|
+
readonly endCursor: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
19
|
+
readonly id: Schema.optionalKey<Schema.Finite>;
|
|
20
|
+
readonly maximumRowsRead: Schema.optionalKey<Schema.Finite>;
|
|
21
|
+
readonly maximumBytesRead: Schema.optionalKey<Schema.Finite>;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=PaginationOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationOptions.d.ts","sourceRoot":"","sources":["../src/PaginationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
//#region src/PaginationOptions.ts
|
|
4
|
+
var PaginationOptions_exports = /* @__PURE__ */ __exportAll({ PaginationOptions: () => PaginationOptions });
|
|
5
|
+
/**
|
|
6
|
+
* Schema for the `paginationOpts` argument that every paginated query receives.
|
|
7
|
+
* Mirrors `paginationOptsValidator` from `convex/server`.
|
|
8
|
+
*
|
|
9
|
+
* Use this as the `paginationOpts` field of a paginated query's args schema.
|
|
10
|
+
* Beyond `numItems` and `cursor`, Convex's pagination protocol sends the
|
|
11
|
+
* optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)
|
|
12
|
+
* with real requests—most notably `usePaginatedQuery` from `convex/react`
|
|
13
|
+
* always includes `id`, and includes `endCursor` when splitting pages.
|
|
14
|
+
* Declaring them is required for the generated Convex argument validator to
|
|
15
|
+
* accept those requests and for the fields to survive decoding and reach
|
|
16
|
+
* `paginate`.
|
|
17
|
+
*/
|
|
18
|
+
const PaginationOptions = Schema.Struct({
|
|
19
|
+
numItems: Schema.Finite,
|
|
20
|
+
cursor: Schema.Union([Schema.String, Schema.Null]),
|
|
21
|
+
endCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
22
|
+
id: Schema.optionalKey(Schema.Finite),
|
|
23
|
+
maximumRowsRead: Schema.optionalKey(Schema.Finite),
|
|
24
|
+
maximumBytesRead: Schema.optionalKey(Schema.Finite)
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PaginationOptions, PaginationOptions_exports };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=PaginationOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationOptions.js","names":[],"sources":["../src/PaginationOptions.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\n/**\n * Schema for the `paginationOpts` argument that every paginated query receives.\n * Mirrors `paginationOptsValidator` from `convex/server`.\n *\n * Use this as the `paginationOpts` field of a paginated query's args schema.\n * Beyond `numItems` and `cursor`, Convex's pagination protocol sends the\n * optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)\n * with real requests—most notably `usePaginatedQuery` from `convex/react`\n * always includes `id`, and includes `endCursor` when splitting pages.\n * Declaring them is required for the generated Convex argument validator to\n * accept those requests and for the fields to survive decoding and reach\n * `paginate`.\n */\nexport const PaginationOptions = Schema.Struct({\n numItems: Schema.Finite,\n cursor: Schema.Union([Schema.String, Schema.Null]),\n endCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),\n id: Schema.optionalKey(Schema.Finite),\n maximumRowsRead: Schema.optionalKey(Schema.Finite),\n maximumBytesRead: Schema.optionalKey(Schema.Finite),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,oBAAoB,OAAO,OAAO;CAC7C,UAAU,OAAO;CACjB,QAAQ,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC;CACjD,WAAW,OAAO,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC,CAAC;CACxE,IAAI,OAAO,YAAY,OAAO,MAAM;CACpC,iBAAiB,OAAO,YAAY,OAAO,MAAM;CACjD,kBAAkB,OAAO,YAAY,OAAO,MAAM;AACpD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
|
+
export type PaginationResult<Doc extends Schema.Codec<any, any>> = ReturnType<typeof PaginationResult<Doc>>;
|
|
2
3
|
export declare const PaginationResult: <Doc extends Schema.Codec<any, any>>(Doc: Doc) => Schema.Struct<{
|
|
3
4
|
readonly page: Schema.mutable<Schema.$Array<Doc>>;
|
|
4
5
|
readonly isDone: Schema.Boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,
|
|
1
|
+
{"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,CAC3E,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,OAC5D,GAAG;;;;;;EAcN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const PaginationResult = <Doc extends Schema.Codec<any, any>>(\n Doc: Doc,\n) =>\n Schema.Struct({\n page: Schema.mutable(Schema.Array(Doc)),\n isDone: Schema.Boolean,\n continueCursor: Schema.String,\n splitCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),\n pageStatus: Schema.optionalKey(\n Schema.Union([\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ]),\n ),\n });\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport type PaginationResult<Doc extends Schema.Codec<any, any>> = ReturnType<\n typeof PaginationResult<Doc>\n>;\n\nexport const PaginationResult = <Doc extends Schema.Codec<any, any>>(\n Doc: Doc,\n) =>\n Schema.Struct({\n page: Schema.mutable(Schema.Array(Doc)),\n isDone: Schema.Boolean,\n continueCursor: Schema.String,\n splitCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),\n pageStatus: Schema.optionalKey(\n Schema.Union([\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ]),\n ),\n });\n"],"mappings":";;;;AAMA,MAAa,oBACX,QAEA,OAAO,OAAO;CACZ,MAAM,OAAO,QAAQ,OAAO,MAAM,GAAG,CAAC;CACtC,QAAQ,OAAO;CACf,gBAAgB,OAAO;CACvB,aAAa,OAAO,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC,CAAC;CAC1E,YAAY,OAAO,YACjB,OAAO,MAAM;EACX,OAAO,QAAQ,kBAAkB;EACjC,OAAO,QAAQ,eAAe;EAC9B,OAAO;CACT,CAAC,CACH;AACF,CAAC"}
|
package/dist/Ref.d.ts
CHANGED
|
@@ -1,53 +1,115 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as MiddlewareAttachment from "./MiddlewareAttachment";
|
|
2
|
+
import type { DefaultFunctionArgs, FunctionReference as ConvexFunctionReference, FunctionVisibility, PaginationOptions, PaginationResult } from "convex/server";
|
|
2
3
|
import type { Value } from "convex/values";
|
|
3
4
|
import { ConvexError } from "convex/values";
|
|
4
5
|
import * as Effect from "effect/Effect";
|
|
5
6
|
import * as Option from "effect/Option";
|
|
6
7
|
import * as Schema from "effect/Schema";
|
|
8
|
+
import type * as FunctionProvenance from "./FunctionProvenance";
|
|
7
9
|
import type * as FunctionSpec from "./FunctionSpec";
|
|
10
|
+
import * as MiddlewareSpec from "./MiddlewareSpec";
|
|
8
11
|
import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
9
|
-
export interface
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
12
|
+
export interface Base<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Args_ extends DefaultFunctionArgs, Returns_, Error_ = never> {
|
|
13
|
+
readonly "~RuntimeAndFunctionType": RuntimeAndFunctionType_;
|
|
14
|
+
readonly "~FunctionVisibility": FunctionVisibility_;
|
|
15
|
+
readonly "~Args": Args_;
|
|
16
|
+
readonly "~Returns": Returns_;
|
|
17
|
+
readonly "~Error": Error_;
|
|
18
|
+
readonly convexFunctionName: string;
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A reference to a single Convex function, as callers see it: the wire name
|
|
22
|
+
* plus the data needed to encode args, decode returns, and decode typed errors.
|
|
23
|
+
* A ref is one of two shapes, keyed by the spec's provenance.
|
|
24
|
+
*/
|
|
25
|
+
export type Ref<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Args_ extends DefaultFunctionArgs, Returns_, Error_ = never> = ConfectRefWithTypes<RuntimeAndFunctionType_, FunctionVisibility_, FunctionProvenance.ArgsFields, Args_, Returns_, Error_> | ConvexRef<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_, Error_>;
|
|
26
|
+
export type ConfectRef<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, ArgsFields_ extends FunctionProvenance.ArgsFields, ReturnsSchema_ extends Schema.Codec<any, any>, ErrorSchema_ extends Schema.Codec<any, any> = never, MiddlewareError_ = never> = ConfectRefWithTypes<RuntimeAndFunctionType_, FunctionVisibility_, ArgsFields_, Schema.Struct.Type<ArgsFields_>, ReturnsSchema_["Type"], ErrorSchema_["Type"] | MiddlewareError_>;
|
|
27
|
+
/**
|
|
28
|
+
* Internal form used while mapping a spec to a ref. Supplying the already
|
|
29
|
+
* derived value types avoids repeatedly expanding `Schema.Struct` for every
|
|
30
|
+
* leaf in a generated ref tree; the public `ConfectRef` alias still derives the
|
|
31
|
+
* same values from its fields and schemas.
|
|
32
|
+
*/
|
|
33
|
+
interface ConfectRefWithTypes<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, ArgsFields_ extends FunctionProvenance.ArgsFields, Args_ extends DefaultFunctionArgs, Returns_, Error_> extends Base<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_, Error_> {
|
|
34
|
+
readonly _tag: "Confect";
|
|
35
|
+
readonly args: FunctionProvenance.ArgsSchema<ArgsFields_>;
|
|
36
|
+
readonly returns: Schema.Codec<any, any>;
|
|
37
|
+
readonly kind: FunctionProvenance.ConfectKind;
|
|
38
|
+
readonly middlewareSpecs: ReadonlyArray<MiddlewareSpec.AnyMiddlewareSpec>;
|
|
39
|
+
readonly middlewareAttachments: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>;
|
|
40
|
+
readonly error?: Schema.Codec<any, any>;
|
|
31
41
|
}
|
|
32
|
-
export interface
|
|
42
|
+
export interface ConvexRef<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Args_ extends DefaultFunctionArgs, Returns_, Error_ = never> extends Base<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_, Error_> {
|
|
43
|
+
readonly _tag: "Convex";
|
|
33
44
|
}
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export type
|
|
45
|
+
export type Any = Ref<any, any, any, any, any>;
|
|
46
|
+
/**
|
|
47
|
+
* Erased Confect-provenance ref used by provenance-specific APIs.
|
|
48
|
+
*/
|
|
49
|
+
export type AnyConfect = Extract<Any, {
|
|
50
|
+
readonly _tag: "Confect";
|
|
51
|
+
}>;
|
|
52
|
+
export type AnyInternal = Ref<any, "internal", any, any, any>;
|
|
53
|
+
export type AnyPublic = Ref<any, "public", any, any, any>;
|
|
54
|
+
export type AnyQuery = Ref<RuntimeAndFunctionType.AnyQuery, FunctionVisibility, any, any, any>;
|
|
55
|
+
export type AnyPaginatedQuery = AnyQuery & Base<RuntimeAndFunctionType.AnyQuery, FunctionVisibility, {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
paginationOpts: PaginationOptions;
|
|
58
|
+
}, PaginationResult<any>, any>;
|
|
59
|
+
export type AnyMutation = Ref<RuntimeAndFunctionType.AnyMutation, FunctionVisibility, any, any, any>;
|
|
60
|
+
export type AnyAction = Ref<RuntimeAndFunctionType.AnyAction, FunctionVisibility, any, any, any>;
|
|
61
|
+
export type AnyPublicQuery = Ref<RuntimeAndFunctionType.AnyQuery, "public", any, any, any>;
|
|
62
|
+
export type AnyConfectPublicQuery = Extract<AnyPublicQuery, AnyConfect>;
|
|
63
|
+
export type AnyPublicPaginatedQuery = AnyPublicQuery & AnyPaginatedQuery;
|
|
64
|
+
export type AnyConfectPublicPaginatedQuery = AnyConfectPublicQuery & AnyPublicPaginatedQuery;
|
|
65
|
+
export type AnyPublicMutation = Ref<RuntimeAndFunctionType.AnyMutation, "public", any, any, any>;
|
|
66
|
+
export type AnyConfectPublicMutation = Extract<AnyPublicMutation, AnyConfect>;
|
|
67
|
+
export type AnyPublicAction = Ref<RuntimeAndFunctionType.AnyAction, "public", any, any, any>;
|
|
68
|
+
export type AnyConfectPublicAction = Extract<AnyPublicAction, AnyConfect>;
|
|
69
|
+
export type GetRuntimeAndFunctionType<Ref_> = Ref_ extends {
|
|
70
|
+
readonly "~RuntimeAndFunctionType": infer RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType;
|
|
71
|
+
} ? RuntimeAndFunctionType_ : never;
|
|
72
|
+
export type GetRuntime<Ref_> = RuntimeAndFunctionType.GetRuntime<GetRuntimeAndFunctionType<Ref_>>;
|
|
73
|
+
export type GetFunctionType<Ref_> = RuntimeAndFunctionType.GetFunctionType<GetRuntimeAndFunctionType<Ref_>>;
|
|
74
|
+
export type GetFunctionVisibility<Ref_> = Ref_ extends {
|
|
75
|
+
readonly "~FunctionVisibility": infer FunctionVisibility_;
|
|
76
|
+
} ? FunctionVisibility_ : never;
|
|
77
|
+
export type Args<Ref_> = Ref_ extends {
|
|
78
|
+
readonly "~Args": infer Args_;
|
|
79
|
+
} ? Args_ : never;
|
|
80
|
+
/**
|
|
81
|
+
* The field map captured by a Confect-provenance ref.
|
|
82
|
+
*/
|
|
83
|
+
export type ArgsFields<Ref_> = Ref_ extends {
|
|
84
|
+
readonly _tag: "Confect";
|
|
85
|
+
readonly args: {
|
|
86
|
+
readonly fields: infer ArgsFields_ extends FunctionProvenance.ArgsFields;
|
|
87
|
+
};
|
|
88
|
+
} ? ArgsFields_ : never;
|
|
89
|
+
/**
|
|
90
|
+
* The assembled args schema carried by a Confect-provenance ref.
|
|
91
|
+
*/
|
|
92
|
+
export type ArgsSchema<Ref_> = Ref_ extends {
|
|
93
|
+
readonly _tag: "Confect";
|
|
94
|
+
readonly args: infer ArgsSchema_ extends FunctionProvenance.AnyArgsSchema;
|
|
95
|
+
} ? ArgsSchema_ : never;
|
|
39
96
|
export type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never ? [args?: Args<Ref_>] : [args: Args<Ref_>];
|
|
40
|
-
export type Returns<Ref_> = Ref_ extends
|
|
41
|
-
|
|
97
|
+
export type Returns<Ref_> = Ref_ extends {
|
|
98
|
+
readonly "~Returns": infer Returns_;
|
|
99
|
+
} ? Returns_ : never;
|
|
100
|
+
export type Error<Ref_> = Ref_ extends {
|
|
101
|
+
readonly "~Error": infer Error_;
|
|
102
|
+
} ? Error_ : never;
|
|
42
103
|
export type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<GetFunctionType<Ref_>, GetFunctionVisibility<Ref_>>;
|
|
43
|
-
export type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =
|
|
104
|
+
export type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps, MiddlewareError = never> = FromFunctionSpecHelper<FunctionSpec_, FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>, FunctionSpec.GetFunctionVisibility<FunctionSpec_>, FunctionSpec.ArgsFields<FunctionSpec_>, FunctionSpec.Args<FunctionSpec_>, FunctionSpec.Returns<FunctionSpec_>, FunctionSpec.Error<FunctionSpec_> | MiddlewareError>;
|
|
105
|
+
type FromFunctionSpecHelper<FunctionSpec_ extends FunctionSpec.AnyWithProps, RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, ArgsFields_ extends FunctionProvenance.ArgsFields, Args_ extends DefaultFunctionArgs, Returns_, Error_> = FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConvex> ? ConvexRef<RuntimeAndFunctionType_, FunctionVisibility_, Args_ extends DefaultFunctionArgs ? Args_ : never, Returns_, never> : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<FunctionSpec_, FunctionProvenance.AnyConfect> ? ConfectRefWithTypes<RuntimeAndFunctionType_, FunctionVisibility_, ArgsFields_, Args_, Returns_, Error_> : Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_, Error_>;
|
|
44
106
|
export declare const make: <FunctionSpec_ extends FunctionSpec.AnyWithProps>(
|
|
45
107
|
/**
|
|
46
108
|
* The namespace portion of a Convex function name, i.e. the part before the
|
|
47
109
|
* colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be
|
|
48
110
|
* `myGroupDir/myGroupMod`.
|
|
49
111
|
*/
|
|
50
|
-
|
|
112
|
+
convexFunctionNamespace: string, functionSpec: FunctionSpec_, groupMiddlewareAttachments?: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>) => FromFunctionSpec<FunctionSpec_>;
|
|
51
113
|
export declare const getConvexFunctionName: (ref: Any) => string;
|
|
52
114
|
export declare const getFunctionReference: <Ref_ extends Any>(ref: Ref_) => FunctionReference<Ref_>;
|
|
53
115
|
export declare const hasErrorSchema: (ref: Any) => boolean;
|
|
@@ -61,27 +123,52 @@ export declare const isConvexError: (error: unknown) => error is ConvexError<Val
|
|
|
61
123
|
/**
|
|
62
124
|
* Build a callback-style handler that decodes the ref's typed error from a
|
|
63
125
|
* caught `ConvexError`, or else forwards the value to `mapUnknownError`. The
|
|
64
|
-
* fallback is also invoked when the input
|
|
65
|
-
* doesn't declare a typed-error schema—by definition such a value falls
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
126
|
+
* fallback is also invoked when the input _is_ a `ConvexError` but the ref
|
|
127
|
+
* doesn't declare a typed-error schema—by definition such a value falls outside
|
|
128
|
+
* the ref's error contract. Useful when adapting non-Effect APIs (e.g. emitter
|
|
129
|
+
* callbacks for streamed subscriptions) to the same error semantics that
|
|
130
|
+
* `runWithCodec` provides.
|
|
69
131
|
*/
|
|
70
132
|
export declare const decodeErrorOrElse: <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) => (error: unknown) => Error<Ref_> | E;
|
|
71
133
|
/**
|
|
72
|
-
* Decode `encodedError` against the ref's error schema
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
134
|
+
* Decode `encodedError` against the ref's error schema—the function's declared
|
|
135
|
+
* `error` schema unioned with its covering middlewares' error schemas. Returns
|
|
136
|
+
* `None` if the ref declares no typed error at all (Confect ref without an
|
|
137
|
+
* `error` schema and without failing middleware, or a Convex-provenance ref)—by
|
|
138
|
+
* definition there's nothing to decode the value into, and the caller is
|
|
139
|
+
* responsible for deciding what to do (typically: surface the original value as
|
|
140
|
+
* a defect).
|
|
77
141
|
*/
|
|
78
142
|
export declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option.Option<Error<Ref_>>, Schema.SchemaError>;
|
|
79
143
|
/**
|
|
80
|
-
* Synchronous counterpart to `decodeError`.
|
|
81
|
-
*
|
|
144
|
+
* Synchronous counterpart to `decodeError`. Returns `None` when the value is
|
|
145
|
+
* not this ref's typed error—either because the ref declares no `error` schema,
|
|
146
|
+
* or because `encodedError` doesn't match the one it declares.
|
|
147
|
+
*
|
|
148
|
+
* The second case is reachable in normal operation: Convex raises its own
|
|
149
|
+
* `ConvexError`s (an `InvalidCursor` pagination error, for instance), and those
|
|
150
|
+
* never match a user-declared error schema. Callers pair this with a fallback
|
|
151
|
+
* that surfaces the original error, so failing to decode must not throw—a
|
|
152
|
+
* `ParseError` here would replace the real error with an opaque one and lose
|
|
153
|
+
* the only useful diagnostic. Hence the `Option` suffix rather than `Sync`,
|
|
154
|
+
* matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers in this
|
|
155
|
+
* module all throw on a parse failure, and this one deliberately doesn't.
|
|
156
|
+
*/
|
|
157
|
+
export declare const decodeErrorOption: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Option.Option<Error<Ref_>>;
|
|
158
|
+
/**
|
|
159
|
+
* Encode the args of a paginated query ref via its user-args
|
|
160
|
+
* schema—`paginationOpts` is excluded, since the pagination protocol fields are
|
|
161
|
+
* managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by
|
|
162
|
+
* the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or
|
|
163
|
+
* `internalPaginatedQuery`).
|
|
164
|
+
*/
|
|
165
|
+
export declare const encodePaginatedQueryArgsSync: <Ref_ extends AnyPublicPaginatedQuery>(ref: Ref_, args: Omit<Args<Ref_>, "paginationOpts">) => unknown;
|
|
166
|
+
/**
|
|
167
|
+
* Decode a page of a paginated query's results via the ref's item schema.
|
|
168
|
+
* Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or
|
|
169
|
+
* `internalPaginatedQuery`).
|
|
82
170
|
*/
|
|
83
|
-
export declare const
|
|
84
|
-
export declare const maybeDecodeErrorSync: <Ref_ extends Any>(ref: Ref_, error: unknown) => unknown;
|
|
171
|
+
export declare const decodePaginationPageSync: <Ref_ extends AnyPublicPaginatedQuery>(ref: Ref_, encodedPage: unknown) => Returns<Ref_>["page"];
|
|
85
172
|
/**
|
|
86
173
|
* Encode args via the ref's args schema, invoke `call`, decode returns via the
|
|
87
174
|
* ref's returns schema, and translate any thrown `ConvexError` into the ref's
|
|
@@ -90,5 +177,6 @@ export declare const maybeDecodeErrorSync: <Ref_ extends Any>(ref: Ref_, error:
|
|
|
90
177
|
* `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when
|
|
91
178
|
* no handler is provided.
|
|
92
179
|
*/
|
|
93
|
-
export declare const runWithCodec: <Ref_ extends Any, E = never>(ref: Ref_, args: Args<Ref_>, call: (functionReference: FunctionReference<Ref_>, encodedArgs: unknown) => PromiseLike<unknown>, mapUnknownError?: (error: unknown) => E) => Effect.Effect<Returns<Ref_>, E | Error<Ref_
|
|
180
|
+
export declare const runWithCodec: <Ref_ extends Any, E = never>(ref: Ref_, args: Args<Ref_>, call: (functionReference: FunctionReference<Ref_>, encodedArgs: unknown) => PromiseLike<unknown>, mapUnknownError?: ((error: unknown) => E) | undefined) => Effect.Effect<Returns<Ref_>, E | Schema.SchemaError | Error<Ref_>, never>;
|
|
181
|
+
export {};
|
|
94
182
|
//# sourceMappingURL=Ref.d.ts.map
|
package/dist/Ref.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../src/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,uBAAuB,EAC5C,kBAAkB,
|
|
1
|
+
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../src/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,oBAAoB,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,IAAI,uBAAuB,EAC5C,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,cAAc,MAA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