@confect/core 9.2.3 → 10.0.0-next.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 +15 -2
- package/dist/FunctionProvenance.d.ts +30 -30
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +14 -14
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GenericId.d.ts +2 -2
- package/dist/GenericId.d.ts.map +1 -1
- package/dist/GenericId.js +4 -3
- package/dist/GenericId.js.map +1 -1
- package/dist/PaginationResult.d.ts +6 -10
- package/dist/PaginationResult.d.ts.map +1 -1
- package/dist/PaginationResult.js +6 -2
- package/dist/PaginationResult.js.map +1 -1
- package/dist/Ref.d.ts +5 -5
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +10 -10
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.js +1 -1
- package/dist/Registry.d.ts +1 -4
- package/dist/Registry.d.ts.map +1 -1
- package/dist/Registry.js +1 -1
- package/dist/Registry.js.map +1 -1
- package/dist/SystemFields.d.ts +51 -10
- package/dist/SystemFields.d.ts.map +1 -1
- package/dist/SystemFields.js +79 -2
- package/dist/SystemFields.js.map +1 -1
- package/dist/UserIdentity.d.ts +20 -54
- package/dist/UserIdentity.d.ts.map +1 -1
- package/dist/UserIdentity.js +17 -17
- package/dist/UserIdentity.js.map +1 -1
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/FunctionProvenance.ts +12 -12
- package/src/FunctionSpec.ts +9 -9
- package/src/GenericId.ts +7 -7
- package/src/PaginationResult.ts +5 -8
- package/src/Ref.ts +21 -16
- package/src/Registry.ts +3 -3
- package/src/SystemFields.ts +255 -26
- package/src/UserIdentity.ts +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
# @confect/core
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 10.0.0-next.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 70e313e: Migrate to Effect v4. All `@confect/*` packages now require `effect@^4.0.0-beta.97`; `@effect/platform` and `@effect/cli` are no longer dependencies (their functionality moved into `effect` core and `effect/unstable/*`).
|
|
8
|
+
|
|
9
|
+
Breaking changes for users:
|
|
10
|
+
- **Schemas** follow Effect v4's Schema API: `Schema.Union([a, b])` (array form), `Schema.Literals([...])` for literal unions, `Schema.optionalKey` in place of `optionalWith({ exact: true })`, `Schema.TaggedErrorClass` in place of `Schema.TaggedError`, and checks like `Schema.String.check(Schema.isMaxLength(...))` in place of piped filters.
|
|
11
|
+
- **Option-returning functions** must use a codec with a serializable encoded form, such as `Schema.OptionFromNullOr(...)` — v4's `Schema.Option` encodes to an `Option` instance, which is not a Convex value.
|
|
12
|
+
- **Table schemas** may now be transformations (`Schema.decodeTo` chains, `Schema.encodeKeys`), branded structs, suspended schemas, or unions of these — Convex's system fields are carried through the whole encoding chain. Schemas that do not resolve to an object shape at every step (such as `Schema.Class`) are rejected with a descriptive error when the table is defined.
|
|
13
|
+
- **Clients**: decode failures surface as `SchemaError` rather than `ParseError` in `@confect/js` and `@confect/react`, and `@confect/react`'s `useMutation`/`useAction` handles with an `error` schema now resolve to `Result` (v4's replacement for `Either`).
|
|
14
|
+
- **HTTP** is now mounted through the renamed `HttpRouter` module (formerly `HttpApi`). `HttpRouter.make(routes)` takes a single route-registering `Layer` composed from Effect's own `effect/unstable/http` and `effect/unstable/httpapi` modules — `HttpApiBuilder.layer(api)` (with group handler layers supplied via `Layer.provide`; a missing group is a compile-time error), `HttpApiScalar.layer` for docs, `HttpRouter.add` for plain routes, and `HttpRouter.middleware(fn, { global: true })` for middleware, merged with `Layer.mergeAll`. The per-path-prefix record and its `api`/`apiLive`/`middleware`/`scalar` options are gone; Confect registers one catch-all Convex HTTP action at `/`, and plain Convex routes added to the returned router still take precedence. Handlers, middleware, and route-layer construction all run with Confect's Convex-aware `ConfigProvider` in context.
|
|
15
|
+
- **Node actions** use `effect/unstable/process` (`ChildProcessSpawner`) and `@effect/platform-node`'s `NodeServices` in place of `@effect/platform` `Command`/`NodeContext`.
|
|
16
|
+
- **Configuration**: Confect's Convex-aware `ConfigProvider` treats empty-string environment variables as missing values (matching Effect v4's built-in providers), so `Config.withDefault` and `Config.option` recover from them.
|
|
17
|
+
- **CLI**: a malformed `convex.json` now fails codegen with a descriptive error instead of being silently ignored.
|
|
18
|
+
- Confect queries no longer stub the global `Date.now`. Queries run with a `Clock` whose unsafe accessors return constants, so Effect-internal reads (log timestamps, spans) never evict a query from Convex's cache; explicit time reads — `Clock.currentTimeMillis`/`currentTimeNanos` or a raw `Date.now()` call — opt the query out and evict as they honestly should.
|
|
6
19
|
|
|
7
20
|
## 9.2.1
|
|
8
21
|
|
|
@@ -3,19 +3,19 @@ import type { Schema } from "effect";
|
|
|
3
3
|
import * as Data from "effect/Data";
|
|
4
4
|
export type FunctionProvenance = Data.TaggedEnum<{
|
|
5
5
|
Confect: {
|
|
6
|
-
args: Schema.
|
|
7
|
-
returns: Schema.
|
|
8
|
-
error?: Schema.
|
|
6
|
+
args: Schema.Codec<any, any>;
|
|
7
|
+
returns: Schema.Codec<any, any>;
|
|
8
|
+
error?: Schema.Codec<any, any>;
|
|
9
9
|
};
|
|
10
10
|
Convex: {};
|
|
11
11
|
}>;
|
|
12
|
-
export interface Confect<Args extends Schema.
|
|
12
|
+
export interface Confect<Args extends Schema.Codec<any, any>, Returns extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never> {
|
|
13
13
|
readonly _tag: "Confect";
|
|
14
14
|
readonly args: Args;
|
|
15
15
|
readonly returns: Returns;
|
|
16
16
|
readonly error?: Error;
|
|
17
17
|
}
|
|
18
|
-
export interface AnyConfect extends Confect<Schema.
|
|
18
|
+
export interface AnyConfect extends Confect<Schema.Codec<any, any>, Schema.Codec<any, any>, Schema.Codec<any, any>> {
|
|
19
19
|
}
|
|
20
20
|
export interface Convex<Args extends DefaultFunctionArgs, Returns> {
|
|
21
21
|
readonly _tag: "Convex";
|
|
@@ -25,22 +25,22 @@ export interface Convex<Args extends DefaultFunctionArgs, Returns> {
|
|
|
25
25
|
export interface AnyConvex extends Convex<DefaultFunctionArgs, any> {
|
|
26
26
|
}
|
|
27
27
|
export declare const FunctionProvenance: {
|
|
28
|
-
readonly Confect: Data.
|
|
28
|
+
readonly Confect: Data.TaggedEnum.ConstructorFrom<{
|
|
29
29
|
readonly _tag: "Confect";
|
|
30
|
-
readonly args: Schema.
|
|
31
|
-
readonly returns: Schema.
|
|
32
|
-
readonly error?: Schema.
|
|
30
|
+
readonly args: Schema.Codec<any, any>;
|
|
31
|
+
readonly returns: Schema.Codec<any, any>;
|
|
32
|
+
readonly error?: Schema.Codec<any, any>;
|
|
33
33
|
}, "_tag">;
|
|
34
|
-
readonly Convex: Data.
|
|
34
|
+
readonly Convex: Data.TaggedEnum.ConstructorFrom<{
|
|
35
35
|
readonly _tag: "Convex";
|
|
36
36
|
readonly _args: DefaultFunctionArgs;
|
|
37
37
|
readonly _returns: any;
|
|
38
38
|
}, "_tag">;
|
|
39
39
|
readonly $is: <Tag extends "Confect" | "Convex">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
40
40
|
readonly _tag: "Confect";
|
|
41
|
-
readonly args: Schema.
|
|
42
|
-
readonly returns: Schema.
|
|
43
|
-
readonly error?: Schema.
|
|
41
|
+
readonly args: Schema.Codec<any, any>;
|
|
42
|
+
readonly returns: Schema.Codec<any, any>;
|
|
43
|
+
readonly error?: Schema.Codec<any, any>;
|
|
44
44
|
}, {
|
|
45
45
|
readonly _tag: Tag;
|
|
46
46
|
}> | Extract<{
|
|
@@ -51,34 +51,34 @@ export declare const FunctionProvenance: {
|
|
|
51
51
|
readonly _tag: Tag;
|
|
52
52
|
}>;
|
|
53
53
|
readonly $match: {
|
|
54
|
-
<
|
|
54
|
+
<Cases extends {
|
|
55
55
|
readonly Confect: (args: {
|
|
56
56
|
readonly _tag: "Confect";
|
|
57
|
-
readonly args: Schema.
|
|
58
|
-
readonly returns: Schema.
|
|
59
|
-
readonly error?: Schema.
|
|
57
|
+
readonly args: Schema.Codec<any, any>;
|
|
58
|
+
readonly returns: Schema.Codec<any, any>;
|
|
59
|
+
readonly error?: Schema.Codec<any, any>;
|
|
60
60
|
}) => any;
|
|
61
61
|
readonly Convex: (args: {
|
|
62
62
|
readonly _tag: "Convex";
|
|
63
63
|
readonly _args: DefaultFunctionArgs;
|
|
64
64
|
readonly _returns: any;
|
|
65
65
|
}) => any;
|
|
66
|
-
}>(cases: Cases
|
|
66
|
+
}>(cases: Cases): (value: {
|
|
67
67
|
readonly _tag: "Confect";
|
|
68
|
-
readonly args: Schema.
|
|
69
|
-
readonly returns: Schema.
|
|
70
|
-
readonly error?: Schema.
|
|
68
|
+
readonly args: Schema.Codec<any, any>;
|
|
69
|
+
readonly returns: Schema.Codec<any, any>;
|
|
70
|
+
readonly error?: Schema.Codec<any, any>;
|
|
71
71
|
} | {
|
|
72
72
|
readonly _tag: "Convex";
|
|
73
73
|
readonly _args: DefaultFunctionArgs;
|
|
74
74
|
readonly _returns: any;
|
|
75
75
|
}) => import("effect/Unify").Unify<ReturnType<Cases["Confect" | "Convex"]>>;
|
|
76
|
-
<
|
|
76
|
+
<Cases extends {
|
|
77
77
|
readonly Confect: (args: {
|
|
78
78
|
readonly _tag: "Confect";
|
|
79
|
-
readonly args: Schema.
|
|
80
|
-
readonly returns: Schema.
|
|
81
|
-
readonly error?: Schema.
|
|
79
|
+
readonly args: Schema.Codec<any, any>;
|
|
80
|
+
readonly returns: Schema.Codec<any, any>;
|
|
81
|
+
readonly error?: Schema.Codec<any, any>;
|
|
82
82
|
}) => any;
|
|
83
83
|
readonly Convex: (args: {
|
|
84
84
|
readonly _tag: "Convex";
|
|
@@ -87,14 +87,14 @@ export declare const FunctionProvenance: {
|
|
|
87
87
|
}) => any;
|
|
88
88
|
}>(value: {
|
|
89
89
|
readonly _tag: "Confect";
|
|
90
|
-
readonly args: Schema.
|
|
91
|
-
readonly returns: Schema.
|
|
92
|
-
readonly error?: Schema.
|
|
90
|
+
readonly args: Schema.Codec<any, any>;
|
|
91
|
+
readonly returns: Schema.Codec<any, any>;
|
|
92
|
+
readonly error?: Schema.Codec<any, any>;
|
|
93
93
|
} | {
|
|
94
94
|
readonly _tag: "Convex";
|
|
95
95
|
readonly _args: DefaultFunctionArgs;
|
|
96
96
|
readonly _returns: any;
|
|
97
|
-
}, cases: Cases
|
|
97
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Confect" | "Convex"]>>;
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
@@ -113,7 +113,7 @@ export declare const FunctionProvenance: {
|
|
|
113
113
|
* is observable via `"error" in provenance` without forcing anything; nothing
|
|
114
114
|
* relies on `Data`'s structural `Equal`/`Hash` for provenance values.
|
|
115
115
|
*/
|
|
116
|
-
export declare const Confect: <Args extends Schema.
|
|
116
|
+
export declare const Confect: <Args extends Schema.Codec<any, any>, Returns extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never>(args: () => Args, returns: () => Returns, error?: () => Error) => Confect<Args, Returns, Error>;
|
|
117
117
|
export declare const Convex: <_Args extends DefaultFunctionArgs, _Returns>() => {
|
|
118
118
|
readonly _tag: "Convex";
|
|
119
119
|
readonly _args: DefaultFunctionArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionProvenance.d.ts","sourceRoot":"","sources":["../src/FunctionProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAGpC,MAAM,MAAM,kBAAkB,GAAG,IAAI,C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G,EAAE,GAAG,CAAC;kCACnB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;iCACvB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;;;;gCAIvB,mBAAmB;mCAEhB,GAAG;;;;2BARP,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;8BACnB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;6BACvB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;;;4BAIvB,mBAAmB;+BAEhB,GAAG;;;CA6BsD,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,OAAO,GAClB,IAAI,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACnC,OAAO,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACtC,KAAK,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,EAE5C,MAAM,MAAM,IAAI,EAChB,SAAS,MAAM,OAAO,EACtB,QAAQ,MAAM,KAAK,KAClB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAU9B,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,mBAAmB,EAAE,QAAQ;;oBArEvD,mBAAmB;uBAEhB,GAAG;CAyEd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionProvenance.js","names":[],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Data from \"effect/Data\";\nimport * as Lazy from \"./Lazy\";\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: Schema.
|
|
1
|
+
{"version":3,"file":"FunctionProvenance.js","names":[],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Data from \"effect/Data\";\nimport * as Lazy from \"./Lazy\";\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: Schema.Codec<any, any>;\n returns: Schema.Codec<any, any>;\n error?: Schema.Codec<any, any>;\n };\n Convex: {\n /** @internal */\n _args: DefaultFunctionArgs;\n /** @internal */\n _returns: any;\n };\n}>;\n\nexport interface Confect<\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n> {\n readonly _tag: \"Confect\";\n readonly args: Args;\n readonly returns: Returns;\n readonly error?: Error;\n}\n\nexport interface AnyConfect extends Confect<\n Schema.Codec<any, any>,\n Schema.Codec<any, any>,\n Schema.Codec<any, any>\n> {}\n\nexport interface Convex<Args extends DefaultFunctionArgs, Returns> {\n readonly _tag: \"Convex\";\n readonly _args: Args;\n readonly _returns: Returns;\n}\n\nexport interface AnyConvex extends Convex<DefaultFunctionArgs, any> {}\n\nexport const FunctionProvenance = Data.taggedEnum<FunctionProvenance>();\n\n/**\n * Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,\n * and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})\n * that only evaluate their thunk on first access, mirroring how `Table`\n * defers `Fields`/`Doc`/`tableDefinition`. This keeps importing the assembled\n * `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`\n * work runs at module load; it is deferred to the first invocation that\n * actually compiles validators or runs a codec.\n *\n * The object is built by hand rather than through `FunctionProvenance.Confect`\n * because the `Data` constructor copies its input with `Object.assign`, which\n * would force the getters at construction time and defeat the laziness.\n * `error` is only installed when an `errorThunk` is provided, so its absence\n * is observable via `\"error\" in provenance` without forcing anything; nothing\n * relies on `Data`'s structural `Equal`/`Hash` for provenance values.\n */\nexport const Confect = <\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n args: () => Args,\n returns: () => Returns,\n error?: () => Error,\n): Confect<Args, Returns, Error> => {\n const provenance = { _tag: \"Confect\" as const };\n\n Lazy.defineProperty(provenance, \"args\", args);\n Lazy.defineProperty(provenance, \"returns\", returns);\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return provenance as Confect<Args, Returns, Error>;\n};\n\nexport const Convex = <_Args extends DefaultFunctionArgs, _Returns>() =>\n FunctionProvenance.Convex(\n {} as {\n _args: _Args;\n _returns: _Returns;\n },\n );\n"],"mappings":";;;;;;;;;;AA4CA,MAAa,qBAAqB,KAAK,YAAgC;;;;;;;;;;;;;;;;;AAkBvE,MAAa,WAKX,MACA,SACA,UACkC;CAClC,MAAM,aAAa,EAAE,MAAM,WAAoB;AAE/C,gBAAoB,YAAY,QAAQ,KAAK;AAC7C,gBAAoB,YAAY,WAAW,QAAQ;AACnD,KAAI,UAAU,OACZ,gBAAoB,YAAY,SAAS,MAAM;AAGjD,QAAO;;AAGT,MAAa,eACX,mBAAmB,OACjB,EAAE,CAIH"}
|
package/dist/FunctionSpec.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["name"];
|
|
|
33
33
|
export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
34
34
|
functionProvenance: {
|
|
35
35
|
_tag: "Confect";
|
|
36
|
-
args: infer ArgsSchema_ extends Schema.
|
|
36
|
+
args: infer ArgsSchema_ extends Schema.Codec<any, any>;
|
|
37
37
|
};
|
|
38
38
|
} ? ArgsSchema_["Type"] : FunctionSpec_ extends {
|
|
39
39
|
functionProvenance: {
|
|
@@ -44,7 +44,7 @@ export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
|
44
44
|
export type Returns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
45
45
|
functionProvenance: {
|
|
46
46
|
_tag: "Confect";
|
|
47
|
-
returns: infer ReturnsSchema_ extends Schema.
|
|
47
|
+
returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;
|
|
48
48
|
};
|
|
49
49
|
} ? ReturnsSchema_["Type"] : FunctionSpec_ extends {
|
|
50
50
|
functionProvenance: {
|
|
@@ -55,7 +55,7 @@ export type Returns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends
|
|
|
55
55
|
export type EncodedArgs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
56
56
|
functionProvenance: {
|
|
57
57
|
_tag: "Confect";
|
|
58
|
-
args: infer ArgsSchema_ extends Schema.
|
|
58
|
+
args: infer ArgsSchema_ extends Schema.Codec<any, any>;
|
|
59
59
|
};
|
|
60
60
|
} ? ArgsSchema_["Encoded"] : FunctionSpec_ extends {
|
|
61
61
|
functionProvenance: {
|
|
@@ -66,7 +66,7 @@ export type EncodedArgs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ exte
|
|
|
66
66
|
export type EncodedReturns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
67
67
|
functionProvenance: {
|
|
68
68
|
_tag: "Confect";
|
|
69
|
-
returns: infer ReturnsSchema_ extends Schema.
|
|
69
|
+
returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;
|
|
70
70
|
};
|
|
71
71
|
} ? ReturnsSchema_["Encoded"] : FunctionSpec_ extends {
|
|
72
72
|
functionProvenance: {
|
|
@@ -75,10 +75,10 @@ export type EncodedReturns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ e
|
|
|
75
75
|
};
|
|
76
76
|
} ? Returns_ : never;
|
|
77
77
|
export type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
78
|
-
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.
|
|
78
|
+
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.Codec<any, any>>;
|
|
79
79
|
} ? ErrorSchema_["Type"] : never;
|
|
80
80
|
export type EncodedError<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
81
|
-
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.
|
|
81
|
+
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.Codec<any, any>>;
|
|
82
82
|
} ? ErrorSchema_["Encoded"] : never;
|
|
83
83
|
export type WithName<FunctionSpec_ extends AnyWithProps, Name_ extends string> = Extract<FunctionSpec_, {
|
|
84
84
|
readonly name: Name_;
|
|
@@ -97,7 +97,7 @@ export type WithFunctionProvenance<FunctionSpec_ extends AnyWithProps, FunctionP
|
|
|
97
97
|
export type WithoutName<FunctionSpec_ extends AnyWithProps, Name_ extends Name<FunctionSpec_>> = Exclude<FunctionSpec_, {
|
|
98
98
|
readonly name: Name_;
|
|
99
99
|
}>;
|
|
100
|
-
export declare const publicQuery: <const Name_ extends string, Args_ extends Schema.
|
|
100
|
+
export declare const publicQuery: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
101
101
|
name: Name_;
|
|
102
102
|
args: () => Args_;
|
|
103
103
|
returns: () => Returns_;
|
|
@@ -106,7 +106,7 @@ export declare const publicQuery: <const Name_ extends string, Args_ extends Sch
|
|
|
106
106
|
readonly runtime: "Convex";
|
|
107
107
|
readonly functionType: "query";
|
|
108
108
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
109
|
-
export declare const internalQuery: <const Name_ extends string, Args_ extends Schema.
|
|
109
|
+
export declare const internalQuery: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
110
110
|
name: Name_;
|
|
111
111
|
args: () => Args_;
|
|
112
112
|
returns: () => Returns_;
|
|
@@ -115,7 +115,7 @@ export declare const internalQuery: <const Name_ extends string, Args_ extends S
|
|
|
115
115
|
readonly runtime: "Convex";
|
|
116
116
|
readonly functionType: "query";
|
|
117
117
|
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
118
|
-
export declare const publicMutation: <const Name_ extends string, Args_ extends Schema.
|
|
118
|
+
export declare const publicMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
119
119
|
name: Name_;
|
|
120
120
|
args: () => Args_;
|
|
121
121
|
returns: () => Returns_;
|
|
@@ -124,7 +124,7 @@ export declare const publicMutation: <const Name_ extends string, Args_ extends
|
|
|
124
124
|
readonly runtime: "Convex";
|
|
125
125
|
readonly functionType: "mutation";
|
|
126
126
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
127
|
-
export declare const internalMutation: <const Name_ extends string, Args_ extends Schema.
|
|
127
|
+
export declare const internalMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
128
128
|
name: Name_;
|
|
129
129
|
args: () => Args_;
|
|
130
130
|
returns: () => Returns_;
|
|
@@ -133,7 +133,7 @@ export declare const internalMutation: <const Name_ extends string, Args_ extend
|
|
|
133
133
|
readonly runtime: "Convex";
|
|
134
134
|
readonly functionType: "mutation";
|
|
135
135
|
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
136
|
-
export declare const publicAction: <const Name_ extends string, Args_ extends Schema.
|
|
136
|
+
export declare const publicAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
137
137
|
name: Name_;
|
|
138
138
|
args: () => Args_;
|
|
139
139
|
returns: () => Returns_;
|
|
@@ -142,7 +142,7 @@ export declare const publicAction: <const Name_ extends string, Args_ extends Sc
|
|
|
142
142
|
readonly runtime: "Convex";
|
|
143
143
|
readonly functionType: "action";
|
|
144
144
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
145
|
-
export declare const internalAction: <const Name_ extends string, Args_ extends Schema.
|
|
145
|
+
export declare const internalAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
146
146
|
name: Name_;
|
|
147
147
|
args: () => Args_;
|
|
148
148
|
returns: () => Returns_;
|
|
@@ -151,7 +151,7 @@ export declare const internalAction: <const Name_ extends string, Args_ extends
|
|
|
151
151
|
readonly runtime: "Convex";
|
|
152
152
|
readonly functionType: "action";
|
|
153
153
|
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
154
|
-
export declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.
|
|
154
|
+
export declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
155
155
|
name: Name_;
|
|
156
156
|
args: () => Args_;
|
|
157
157
|
returns: () => Returns_;
|
|
@@ -160,7 +160,7 @@ export declare const publicNodeAction: <const Name_ extends string, Args_ extend
|
|
|
160
160
|
readonly runtime: "Node";
|
|
161
161
|
readonly functionType: "action";
|
|
162
162
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
163
|
-
export declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.
|
|
163
|
+
export declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
164
164
|
name: Name_;
|
|
165
165
|
args: () => Args_;
|
|
166
166
|
returns: () => Returns_;
|
|
@@ -1 +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,MAAM,EACzB,MAAM,KAAK;;;iFAuCd,CAAC;AACF,eAAO,MAAM,oBAAoB,GA9C7B,CAAC,uDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;mFA2Cd,CAAC;AACF,eAAO,MAAM,sBAAsB,GAlD/B,CAAC,qDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;iFA+Cd,CAAC;AACF,eAAO,MAAM,wBAAwB,GAtDjC,CAAC,uDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;mFAmDd,CAAC"}
|
package/dist/FunctionSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type {\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Schema.AnyNoContext;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Schema.AnyNoContext;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Schema.AnyNoContext;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Schema.AnyNoContext;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Schema.AnyNoContext\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Schema.AnyNoContext\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n Error_ extends Schema.Schema.AnyNoContext = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const internalMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const publicAction = make(RuntimeAndFunctionType.ConvexAction, \"public\");\nexport const internalAction = make(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\n\nexport const publicNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const internalNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n\ntype MatchingRegisteredFunction<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n> =\n RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"query\"\n ? RegisteredQuery<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"mutation\"\n ? RegisteredMutation<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"action\"\n ? RegisteredAction<FunctionVisibility_, any, any>\n : never;\n\ntype ExtractArgs<F> =\n F extends RegisteredQuery<any, infer A, any>\n ? A\n : F extends RegisteredMutation<any, infer A, any>\n ? A\n : F extends RegisteredAction<any, infer A, any>\n ? A\n : never;\n\ntype ExtractReturns<F> =\n F extends RegisteredQuery<any, any, infer R>\n ? R\n : F extends RegisteredMutation<any, any, infer R>\n ? R\n : F extends RegisteredAction<any, any, infer R>\n ? R\n : never;\n\nconst makeConvex =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n F extends MatchingRegisteredFunction<\n RuntimeAndFunctionType_,\n FunctionVisibility_\n >,\n >() =>\n <const Name_ extends string>(\n name: Name_,\n ): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Convex<\n ExtractArgs<F>,\n ExtractReturns<F>\n >(),\n }) as any;\n };\n\nexport const convexPublicQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const convexInternalQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const convexPublicMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const convexInternalMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const convexPublicAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"public\",\n);\nexport const convexInternalAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\nexport const convexPublicNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const convexInternalNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,OAAO;AAyLlC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,QAMF,wBACA,wBAOA,EACA,MACA,MACA,SACA,YAWG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBA,QAA2B,MAAM,SAAS,MAAM;EACrE,CAAC;;AAGN,MAAa,cAAc,KAAKC,aAAoC,SAAS;AAC7E,MAAa,gBAAgB,KAC3BA,aACA,WACD;AACD,MAAa,iBAAiB,KAC5BC,gBACA,SACD;AACD,MAAa,mBAAmB,KAC9BA,gBACA,WACD;AACD,MAAa,eAAe,KAAKC,cAAqC,SAAS;AAC/E,MAAa,iBAAiB,KAC5BA,cACA,WACD;AAED,MAAa,mBAAmB,KAC9BC,YACA,SACD;AACD,MAAa,qBAAqB,KAChCA,YACA,WACD;AAgCD,MAAM,cAMF,wBACA,8BASA,SAMG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBC,QAGjB;EACJ,CAAC;;AAGN,MAAa,oBAAoB,WAC/BJ,aACA,SACD;AACD,MAAa,sBAAsB,WACjCA,aACA,WACD;AACD,MAAa,uBAAuB,WAClCC,gBACA,SACD;AACD,MAAa,yBAAyB,WACpCA,gBACA,WACD;AACD,MAAa,qBAAqB,WAChCC,cACA,SACD;AACD,MAAa,uBAAuB,WAClCA,cACA,WACD;AACD,MAAa,yBAAyB,WACpCC,YACA,SACD;AACD,MAAa,2BAA2B,WACtCA,YACA,WACD"}
|
|
1
|
+
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type {\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Codec<any, any>,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const internalMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const publicAction = make(RuntimeAndFunctionType.ConvexAction, \"public\");\nexport const internalAction = make(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\n\nexport const publicNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const internalNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n\ntype MatchingRegisteredFunction<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n> =\n RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"query\"\n ? RegisteredQuery<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"mutation\"\n ? RegisteredMutation<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"action\"\n ? RegisteredAction<FunctionVisibility_, any, any>\n : never;\n\ntype ExtractArgs<F> =\n F extends RegisteredQuery<any, infer A, any>\n ? A\n : F extends RegisteredMutation<any, infer A, any>\n ? A\n : F extends RegisteredAction<any, infer A, any>\n ? A\n : never;\n\ntype ExtractReturns<F> =\n F extends RegisteredQuery<any, any, infer R>\n ? R\n : F extends RegisteredMutation<any, any, infer R>\n ? R\n : F extends RegisteredAction<any, any, infer R>\n ? R\n : never;\n\nconst makeConvex =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n F extends MatchingRegisteredFunction<\n RuntimeAndFunctionType_,\n FunctionVisibility_\n >,\n >() =>\n <const Name_ extends string>(\n name: Name_,\n ): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Convex<\n ExtractArgs<F>,\n ExtractReturns<F>\n >(),\n }) as any;\n };\n\nexport const convexPublicQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const convexInternalQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const convexPublicMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const convexInternalMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const convexPublicAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"public\",\n);\nexport const convexInternalAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\nexport const convexPublicNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const convexInternalNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,OAAO;AAyLlC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,QAMF,wBACA,wBAOA,EACA,MACA,MACA,SACA,YAWG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBA,QAA2B,MAAM,SAAS,MAAM;EACrE,CAAC;;AAGN,MAAa,cAAc,KAAKC,aAAoC,SAAS;AAC7E,MAAa,gBAAgB,KAC3BA,aACA,WACD;AACD,MAAa,iBAAiB,KAC5BC,gBACA,SACD;AACD,MAAa,mBAAmB,KAC9BA,gBACA,WACD;AACD,MAAa,eAAe,KAAKC,cAAqC,SAAS;AAC/E,MAAa,iBAAiB,KAC5BA,cACA,WACD;AAED,MAAa,mBAAmB,KAC9BC,YACA,SACD;AACD,MAAa,qBAAqB,KAChCA,YACA,WACD;AAgCD,MAAM,cAMF,wBACA,8BASA,SAMG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBC,QAGjB;EACJ,CAAC;;AAGN,MAAa,oBAAoB,WAC/BJ,aACA,SACD;AACD,MAAa,sBAAsB,WACjCA,aACA,WACD;AACD,MAAa,uBAAuB,WAClCC,gBACA,SACD;AACD,MAAa,yBAAyB,WACpCA,gBACA,WACD;AACD,MAAa,qBAAqB,WAChCC,cACA,SACD;AACD,MAAa,uBAAuB,WAClCA,cACA,WACD;AACD,MAAa,yBAAyB,WACpCC,YACA,SACD;AACD,MAAa,2BAA2B,WACtCA,YACA,WACD"}
|
package/dist/GenericId.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GenericId as ConvexGenericId } from "convex/values";
|
|
2
|
-
import
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import * as SchemaAST from "effect/SchemaAST";
|
|
5
|
-
export declare const GenericId: <TableName extends string>(tableName: TableName) => Schema.
|
|
5
|
+
export declare const GenericId: <TableName extends string>(tableName: TableName) => Schema.Codec<ConvexGenericId<TableName>>;
|
|
6
6
|
export type GenericId<TableName extends string> = ConvexGenericId<TableName>;
|
|
7
7
|
export declare const tableName: <TableName extends string>(ast: SchemaAST.AST) => Option.Option<TableName>;
|
|
8
8
|
//# sourceMappingURL=GenericId.d.ts.map
|
package/dist/GenericId.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericId.d.ts","sourceRoot":"","sources":["../src/GenericId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"GenericId.d.ts","sourceRoot":"","sources":["../src/GenericId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAI9C,eAAO,MAAM,SAAS,GAAI,SAAS,SAAS,MAAM,EAChD,WAAW,SAAS,KACnB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAGiB,CAAC;AAE5D,MAAM,MAAM,SAAS,CAAC,SAAS,SAAS,MAAM,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;AAE7E,eAAO,MAAM,SAAS,GAAI,SAAS,SAAS,MAAM,EAChD,KAAK,SAAS,CAAC,GAAG,KACjB,MAAM,CAAC,MAAM,CAAC,SAAS,CAC2C,CAAC"}
|
package/dist/GenericId.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
2
3
|
import * as Schema from "effect/Schema";
|
|
3
4
|
import * as SchemaAST from "effect/SchemaAST";
|
|
4
5
|
|
|
@@ -7,9 +8,9 @@ var GenericId_exports = /* @__PURE__ */ __exportAll({
|
|
|
7
8
|
GenericId: () => GenericId,
|
|
8
9
|
tableName: () => tableName
|
|
9
10
|
});
|
|
10
|
-
const ConvexId =
|
|
11
|
-
const GenericId = (tableName) => Schema.String.
|
|
12
|
-
const tableName = (ast) => SchemaAST.
|
|
11
|
+
const ConvexId = "~@confect/core/ConvexId";
|
|
12
|
+
const GenericId = (tableName) => Schema.String.annotate({ [ConvexId]: tableName });
|
|
13
|
+
const tableName = (ast) => Option.fromNullishOr(SchemaAST.resolveAt(ConvexId)(ast));
|
|
13
14
|
|
|
14
15
|
//#endregion
|
|
15
16
|
export { GenericId, GenericId_exports, tableName };
|
package/dist/GenericId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericId.js","names":[],"sources":["../src/GenericId.ts"],"sourcesContent":["import type { GenericId as ConvexGenericId } from \"convex/values\";\nimport
|
|
1
|
+
{"version":3,"file":"GenericId.js","names":[],"sources":["../src/GenericId.ts"],"sourcesContent":["import type { GenericId as ConvexGenericId } from \"convex/values\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\n\nconst ConvexId = \"~@confect/core/ConvexId\";\n\nexport const GenericId = <TableName extends string>(\n tableName: TableName,\n): Schema.Codec<ConvexGenericId<TableName>> =>\n Schema.String.annotate({\n [ConvexId]: tableName,\n }) as unknown as Schema.Codec<ConvexGenericId<TableName>>;\n\nexport type GenericId<TableName extends string> = ConvexGenericId<TableName>;\n\nexport const tableName = <TableName extends string>(\n ast: SchemaAST.AST,\n): Option.Option<TableName> =>\n Option.fromNullishOr(SchemaAST.resolveAt<TableName>(ConvexId)(ast));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,WAAW;AAEjB,MAAa,aACX,cAEA,OAAO,OAAO,SAAS,GACpB,WAAW,WACb,CAAC;AAIJ,MAAa,aACX,QAEA,OAAO,cAAc,UAAU,UAAqB,SAAS,CAAC,IAAI,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
|
-
export declare const PaginationResult: <Doc extends Schema.
|
|
3
|
-
page: Schema.mutable<Schema
|
|
4
|
-
isDone:
|
|
5
|
-
continueCursor:
|
|
6
|
-
splitCursor: Schema.
|
|
7
|
-
|
|
8
|
-
}>;
|
|
9
|
-
pageStatus: Schema.optionalWith<Schema.Union<[Schema.Literal<["SplitRecommended"]>, Schema.Literal<["SplitRequired"]>, typeof Schema.Null]>, {
|
|
10
|
-
exact: true;
|
|
11
|
-
}>;
|
|
2
|
+
export declare const PaginationResult: <Doc extends Schema.Codec<any, any>>(Doc: Doc) => Schema.Struct<{
|
|
3
|
+
readonly page: Schema.mutable<Schema.$Array<Doc>>;
|
|
4
|
+
readonly isDone: Schema.Boolean;
|
|
5
|
+
readonly continueCursor: Schema.String;
|
|
6
|
+
readonly splitCursor: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
7
|
+
readonly pageStatus: Schema.optionalKey<Schema.Union<readonly [Schema.Literal<"SplitRecommended">, Schema.Literal<"SplitRequired">, Schema.Null]>>;
|
|
12
8
|
}>;
|
|
13
9
|
//# sourceMappingURL=PaginationResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACjE,KAAK,GAAG;;;;;;EAcN,CAAC"}
|
package/dist/PaginationResult.js
CHANGED
|
@@ -7,8 +7,12 @@ const PaginationResult = (Doc) => Schema.Struct({
|
|
|
7
7
|
page: Schema.mutable(Schema.Array(Doc)),
|
|
8
8
|
isDone: Schema.Boolean,
|
|
9
9
|
continueCursor: Schema.String,
|
|
10
|
-
splitCursor: Schema.
|
|
11
|
-
pageStatus: Schema.
|
|
10
|
+
splitCursor: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
11
|
+
pageStatus: Schema.optionalKey(Schema.Union([
|
|
12
|
+
Schema.Literal("SplitRecommended"),
|
|
13
|
+
Schema.Literal("SplitRequired"),
|
|
14
|
+
Schema.Null
|
|
15
|
+
]))
|
|
12
16
|
});
|
|
13
17
|
|
|
14
18
|
//#endregion
|
|
@@ -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.
|
|
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":";;;;;AAEA,MAAa,oBACX,QAEA,OAAO,OAAO;CACZ,MAAM,OAAO,QAAQ,OAAO,MAAM,IAAI,CAAC;CACvC,QAAQ,OAAO;CACf,gBAAgB,OAAO;CACvB,aAAa,OAAO,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,KAAK,CAAC,CAAC;CAC3E,YAAY,OAAO,YACjB,OAAO,MAAM;EACX,OAAO,QAAQ,mBAAmB;EAClC,OAAO,QAAQ,gBAAgB;EAC/B,OAAO;EACR,CAAC,CACH;CACF,CAAC"}
|
package/dist/Ref.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { FunctionReference as ConvexFunctionReference, FunctionVisibility } from "convex/server";
|
|
2
2
|
import type { Value } from "convex/values";
|
|
3
3
|
import { ConvexError } from "convex/values";
|
|
4
|
-
import type { ParseResult } from "effect";
|
|
5
4
|
import * as Effect from "effect/Effect";
|
|
6
5
|
import * as Option from "effect/Option";
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
7
|
import type * as FunctionSpec from "./FunctionSpec";
|
|
8
8
|
import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
9
9
|
export interface Ref<_RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType, _FunctionVisibility extends FunctionVisibility, _Args, _Returns, _Error = never> {
|
|
@@ -51,8 +51,8 @@ functionNamespace: string, functionSpec: FunctionSpec_) => FromFunctionSpec<Func
|
|
|
51
51
|
export declare const getConvexFunctionName: (ref: Any) => string;
|
|
52
52
|
export declare const getFunctionReference: <Ref_ extends Any>(ref: Ref_) => FunctionReference<Ref_>;
|
|
53
53
|
export declare const hasErrorSchema: (ref: Any) => boolean;
|
|
54
|
-
export declare const encodeArgs: <Ref_ extends Any>(ref: Ref_, args: Args<Ref_>) => Effect.Effect<unknown,
|
|
55
|
-
export declare const decodeReturns: <Ref_ extends Any>(ref: Ref_, returns: unknown) => Effect.Effect<Returns<Ref_>,
|
|
54
|
+
export declare const encodeArgs: <Ref_ extends Any>(ref: Ref_, args: Args<Ref_>) => Effect.Effect<unknown, Schema.SchemaError>;
|
|
55
|
+
export declare const decodeReturns: <Ref_ extends Any>(ref: Ref_, returns: unknown) => Effect.Effect<Returns<Ref_>, Schema.SchemaError>;
|
|
56
56
|
export declare const encodeArgsSync: <Ref_ extends Any>(ref: Ref_, args: Args<Ref_>) => unknown;
|
|
57
57
|
export declare const decodeArgsSync: <Ref_ extends Any>(ref: Ref_, encodedArgs: unknown) => Args<Ref_>;
|
|
58
58
|
export declare const encodeReturnsSync: <Ref_ extends Any>(ref: Ref_, returns: Returns<Ref_>) => unknown;
|
|
@@ -75,7 +75,7 @@ export declare const decodeErrorOrElse: <Ref_ extends Any, E>(ref: Ref_, mapUnkn
|
|
|
75
75
|
* into, and the caller is responsible for deciding what to do (typically:
|
|
76
76
|
* surface the original value as a defect).
|
|
77
77
|
*/
|
|
78
|
-
export declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option.Option<Error<Ref_>>,
|
|
78
|
+
export declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option.Option<Error<Ref_>>, Schema.SchemaError>;
|
|
79
79
|
/**
|
|
80
80
|
* Synchronous counterpart to `decodeError`. Throws on schema decode failure;
|
|
81
81
|
* returns `None` when the ref doesn't declare a typed error.
|
|
@@ -90,5 +90,5 @@ export declare const maybeDecodeErrorSync: <Ref_ extends Any>(ref: Ref_, error:
|
|
|
90
90
|
* `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when
|
|
91
91
|
* no handler is provided.
|
|
92
92
|
*/
|
|
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_> |
|
|
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_> | Schema.SchemaError>;
|
|
94
94
|
//# sourceMappingURL=Ref.d.ts.map
|
package/dist/Ref.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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