@confect/core 9.0.0-next.6 → 9.0.0-next.8
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 +39 -0
- package/dist/FunctionProvenance.d.ts +32 -31
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +1 -1
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +1 -1
- package/dist/FunctionSpec.js +1 -1
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GenericId.d.ts +4 -2
- package/dist/GenericId.d.ts.map +1 -1
- package/dist/GenericId.js +2 -1
- package/dist/GenericId.js.map +1 -1
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +2 -1
- package/dist/GroupSpec.js.map +1 -1
- package/dist/PaginationResult.d.ts +1 -1
- package/dist/PaginationResult.js +1 -1
- package/dist/PaginationResult.js.map +1 -1
- package/dist/Ref.d.ts +5 -3
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +13 -2
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +2 -2
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +4 -1
- package/dist/Refs.js.map +1 -1
- package/dist/Registry.d.ts +2 -1
- package/dist/Registry.d.ts.map +1 -1
- package/dist/Registry.js +2 -1
- package/dist/Registry.js.map +1 -1
- package/dist/Spec.d.ts.map +1 -1
- package/dist/Spec.js +4 -1
- package/dist/Spec.js.map +1 -1
- package/dist/SystemFields.d.ts +1 -1
- package/dist/SystemFields.js +1 -1
- package/dist/SystemFields.js.map +1 -1
- package/dist/Types.d.ts +1 -1
- package/dist/UserIdentity.d.ts +1 -1
- package/dist/UserIdentity.js +1 -1
- package/dist/UserIdentity.js.map +1 -1
- package/package.json +1 -1
- package/src/FunctionProvenance.ts +1 -1
- package/src/FunctionSpec.ts +1 -1
- package/src/GenericId.ts +3 -1
- package/src/GroupSpec.ts +2 -1
- package/src/PaginationResult.ts +1 -1
- package/src/Ref.ts +19 -3
- package/src/Refs.ts +4 -1
- package/src/Registry.ts +2 -1
- package/src/Spec.ts +4 -1
- package/src/SystemFields.ts +1 -1
- package/src/UserIdentity.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @confect/core
|
|
2
2
|
|
|
3
|
+
## 9.0.0-next.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3fec285: Import Effect from its submodule paths internally to shrink per-function cold-start bundles.
|
|
8
|
+
|
|
9
|
+
Confect's packages now import Effect modules from their submodule paths (`import * as Schema from "effect/Schema"`) instead of the `"effect"` barrel (`import { Schema } from "effect"`).
|
|
10
|
+
|
|
11
|
+
### Why
|
|
12
|
+
|
|
13
|
+
A barrel import of a namespace re-export defeats esbuild's tree-shaking: accessing `Schema.X` from `import { Schema } from "effect"` retains the _entire_ `Schema` namespace, because the bundler can't prune property access on the barrel's `export * as Schema`. So every Convex function's cold-start bundle was pulling all of `effect/Schema` and `effect/Stream` — and, transitively through Schema's `Arbitrary`, `fast-check` — whether the function used them or not.
|
|
14
|
+
|
|
15
|
+
Importing from the submodule path tree-shakes normally. On a minimal function this cut the bundle esbuild produces by ~54% (the `effect/Schema` module alone by ~75%) and its cold-start module-evaluation time by ~35%, with `fast-check` dropped entirely. This is also the import style Effect v4 recommends, so it's forward-compatible. A `no-restricted-imports` ESLint rule now enforces it across the codebase (type-only imports and `@effect/vitest` are exempt).
|
|
16
|
+
|
|
17
|
+
No API changes — your existing code keeps working.
|
|
18
|
+
|
|
19
|
+
### Getting the full win in your own code
|
|
20
|
+
|
|
21
|
+
This change shrinks the Confect code in every function bundle, but a function's bundle also includes your own `confect/tables/*` and `*.spec.ts` files. esbuild retains the union across all importers, so a single barrel import anywhere in a function's module graph re-pins the whole `effect/Schema` namespace and undoes the reduction. To get the full bundle/cold-start savings, import Effect from its submodule paths in your own Confect files too:
|
|
22
|
+
|
|
23
|
+
```diff
|
|
24
|
+
- import { Schema } from "effect";
|
|
25
|
+
+ import * as Schema from "effect/Schema";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Bare helpers (`pipe`, `flow`, `identity`) come from `"effect/Function"`.
|
|
29
|
+
|
|
30
|
+
## 9.0.0-next.7
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 5d19484: Stabilize the identity of `@confect/react` hook results across renders.
|
|
35
|
+
|
|
36
|
+
`useQuery` previously decoded and wrapped the Convex result on every render, handing consumers a brand new `QueryResult` even when the underlying Convex data was unchanged. Effects and memoization that depend on the result's identity (e.g. `useEffect(..., [user])` derived via `QueryResult.match`) would re-run on every render, which could escalate into `Maximum update depth exceeded`. The decoded `QueryResult` is now memoized by the (referentially stable) Convex result, so unchanged data keeps a stable identity.
|
|
37
|
+
|
|
38
|
+
`useMutation` and `useAction` now return a stable callback via `useCallback`, matching the identity contract of Convex's own hooks, instead of allocating a fresh function each render.
|
|
39
|
+
|
|
40
|
+
`Ref.getFunctionReference` now caches the Convex function reference by function name, so repeated calls for the same ref return the same reference.
|
|
41
|
+
|
|
3
42
|
## 9.0.0-next.6
|
|
4
43
|
|
|
5
44
|
### Major Changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
2
|
import { DefaultFunctionArgs } from "convex/server";
|
|
3
3
|
import * as effect_Unify0 from "effect/Unify";
|
|
4
|
+
import { Schema } from "effect";
|
|
4
5
|
|
|
5
6
|
//#region src/FunctionProvenance.d.ts
|
|
6
7
|
declare namespace FunctionProvenance_d_exports {
|
|
@@ -28,76 +29,76 @@ interface Convex<Args extends DefaultFunctionArgs, Returns> {
|
|
|
28
29
|
}
|
|
29
30
|
interface AnyConvex extends Convex<DefaultFunctionArgs, any> {}
|
|
30
31
|
declare const FunctionProvenance: {
|
|
32
|
+
readonly Convex: Data.Case.Constructor<{
|
|
33
|
+
readonly _tag: "Convex";
|
|
34
|
+
readonly _args: DefaultFunctionArgs;
|
|
35
|
+
readonly _returns: any;
|
|
36
|
+
}, "_tag">;
|
|
31
37
|
readonly Confect: Data.Case.Constructor<{
|
|
32
38
|
readonly _tag: "Confect";
|
|
33
39
|
readonly args: Schema.Schema.AnyNoContext;
|
|
34
40
|
readonly returns: Schema.Schema.AnyNoContext;
|
|
35
41
|
readonly error?: Schema.Schema.AnyNoContext;
|
|
36
42
|
}, "_tag">;
|
|
37
|
-
readonly Convex:
|
|
43
|
+
readonly $is: <Tag extends "Convex" | "Confect">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
38
44
|
readonly _tag: "Convex";
|
|
39
45
|
readonly _args: DefaultFunctionArgs;
|
|
40
46
|
readonly _returns: any;
|
|
41
|
-
},
|
|
42
|
-
|
|
47
|
+
}, {
|
|
48
|
+
readonly _tag: Tag;
|
|
49
|
+
}> | Extract<{
|
|
43
50
|
readonly _tag: "Confect";
|
|
44
51
|
readonly args: Schema.Schema.AnyNoContext;
|
|
45
52
|
readonly returns: Schema.Schema.AnyNoContext;
|
|
46
53
|
readonly error?: Schema.Schema.AnyNoContext;
|
|
47
54
|
}, {
|
|
48
55
|
readonly _tag: Tag;
|
|
49
|
-
}> | Extract<{
|
|
50
|
-
readonly _tag: "Convex";
|
|
51
|
-
readonly _args: DefaultFunctionArgs;
|
|
52
|
-
readonly _returns: any;
|
|
53
|
-
}, {
|
|
54
|
-
readonly _tag: Tag;
|
|
55
56
|
}>;
|
|
56
57
|
readonly $match: {
|
|
57
58
|
<const Cases extends {
|
|
59
|
+
readonly Convex: (args: {
|
|
60
|
+
readonly _tag: "Convex";
|
|
61
|
+
readonly _args: DefaultFunctionArgs;
|
|
62
|
+
readonly _returns: any;
|
|
63
|
+
}) => any;
|
|
58
64
|
readonly Confect: (args: {
|
|
59
65
|
readonly _tag: "Confect";
|
|
60
66
|
readonly args: Schema.Schema.AnyNoContext;
|
|
61
67
|
readonly returns: Schema.Schema.AnyNoContext;
|
|
62
68
|
readonly error?: Schema.Schema.AnyNoContext;
|
|
63
69
|
}) => any;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}>(cases: Cases & { [K in Exclude<keyof Cases, "Confect" | "Convex">]: never }): (value: {
|
|
70
|
+
}>(cases: Cases & { [K in Exclude<keyof Cases, "Convex" | "Confect">]: never }): (value: {
|
|
71
|
+
readonly _tag: "Convex";
|
|
72
|
+
readonly _args: DefaultFunctionArgs;
|
|
73
|
+
readonly _returns: any;
|
|
74
|
+
} | {
|
|
70
75
|
readonly _tag: "Confect";
|
|
71
76
|
readonly args: Schema.Schema.AnyNoContext;
|
|
72
77
|
readonly returns: Schema.Schema.AnyNoContext;
|
|
73
78
|
readonly error?: Schema.Schema.AnyNoContext;
|
|
74
|
-
} |
|
|
75
|
-
readonly _tag: "Convex";
|
|
76
|
-
readonly _args: DefaultFunctionArgs;
|
|
77
|
-
readonly _returns: any;
|
|
78
|
-
}) => effect_Unify0.Unify<ReturnType<Cases["Confect" | "Convex"]>>;
|
|
79
|
+
}) => effect_Unify0.Unify<ReturnType<Cases["Convex" | "Confect"]>>;
|
|
79
80
|
<const Cases extends {
|
|
81
|
+
readonly Convex: (args: {
|
|
82
|
+
readonly _tag: "Convex";
|
|
83
|
+
readonly _args: DefaultFunctionArgs;
|
|
84
|
+
readonly _returns: any;
|
|
85
|
+
}) => any;
|
|
80
86
|
readonly Confect: (args: {
|
|
81
87
|
readonly _tag: "Confect";
|
|
82
88
|
readonly args: Schema.Schema.AnyNoContext;
|
|
83
89
|
readonly returns: Schema.Schema.AnyNoContext;
|
|
84
90
|
readonly error?: Schema.Schema.AnyNoContext;
|
|
85
91
|
}) => any;
|
|
86
|
-
readonly Convex: (args: {
|
|
87
|
-
readonly _tag: "Convex";
|
|
88
|
-
readonly _args: DefaultFunctionArgs;
|
|
89
|
-
readonly _returns: any;
|
|
90
|
-
}) => any;
|
|
91
92
|
}>(value: {
|
|
93
|
+
readonly _tag: "Convex";
|
|
94
|
+
readonly _args: DefaultFunctionArgs;
|
|
95
|
+
readonly _returns: any;
|
|
96
|
+
} | {
|
|
92
97
|
readonly _tag: "Confect";
|
|
93
98
|
readonly args: Schema.Schema.AnyNoContext;
|
|
94
99
|
readonly returns: Schema.Schema.AnyNoContext;
|
|
95
100
|
readonly error?: Schema.Schema.AnyNoContext;
|
|
96
|
-
} |
|
|
97
|
-
readonly _tag: "Convex";
|
|
98
|
-
readonly _args: DefaultFunctionArgs;
|
|
99
|
-
readonly _returns: any;
|
|
100
|
-
}, cases: Cases & { [K in Exclude<keyof Cases, "Confect" | "Convex">]: never }): effect_Unify0.Unify<ReturnType<Cases["Confect" | "Convex"]>>;
|
|
101
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Convex" | "Confect">]: never }): effect_Unify0.Unify<ReturnType<Cases["Convex" | "Confect"]>>;
|
|
101
102
|
};
|
|
102
103
|
};
|
|
103
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionProvenance.d.ts","names":[],"sources":["../src/FunctionProvenance.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunctionProvenance.d.ts","names":[],"sources":["../src/FunctionProvenance.ts"],"mappings":";;;;;;;;;KAKY,kBAAA,GAAqB,IAAA,CAAK,UAAA;EACpC,OAAA;IACE,IAAA,EAAM,MAAA,CAAO,MAAA,CAAO,YAAA;IACpB,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,YAAA;IACvB,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,YAAA;EAAA;EAExB,MAAA;AAAA;AAAA,UAQe,OAAA,cACF,MAAA,CAAO,MAAA,CAAO,YAAA,kBACX,MAAA,CAAO,MAAA,CAAO,YAAA,gBAChB,MAAA,CAAO,MAAA,CAAO,YAAA;EAAA,SAEnB,IAAA;EAAA,SACA,IAAA,EAAM,IAAA;EAAA,SACN,OAAA,EAAS,OAAA;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AO,MAAA,CAAO,YAAA;MAAA,iBACf,MAAA,CAAO,MAAA,CAAO,YAAA;IAAA;;;;;;;;;;;;;;;;AAiC1B;;;cAoBa,OAAA,gBACE,MAAA,CAAO,MAAA,CAAO,YAAA,kBACX,MAAA,CAAO,MAAA,CAAO,YAAA,gBAChB,MAAA,CAAO,MAAA,CAAO,YAAA,UAE5B,IAAA,QAAY,IAAA,EACZ,OAAA,QAAe,OAAA,EACf,KAAA,SAAc,KAAA,KACb,OAAA,CAAQ,IAAA,EAAM,OAAA,EAAS,KAAA;AAAA,cAYb,MAAA,iBAAwB,mBAAA;EAAA;kBArE1B,mBAAA;EAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { defineProperty } from "./Lazy.js";
|
|
3
|
-
import
|
|
3
|
+
import * as Data from "effect/Data";
|
|
4
4
|
|
|
5
5
|
//#region src/FunctionProvenance.ts
|
|
6
6
|
var FunctionProvenance_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -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
|
|
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.Schema.AnyNoContext;\n returns: Schema.Schema.AnyNoContext;\n error?: Schema.Schema.AnyNoContext;\n };\n Convex: {\n /** @internal */\n _args: DefaultFunctionArgs;\n /** @internal */\n _returns: any;\n };\n}>;\n\nexport interface Confect<\n Args extends Schema.Schema.AnyNoContext,\n Returns extends Schema.Schema.AnyNoContext,\n Error extends Schema.Schema.AnyNoContext = 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.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\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.Schema.AnyNoContext,\n Returns extends Schema.Schema.AnyNoContext,\n Error extends Schema.Schema.AnyNoContext = 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyConfect as AnyConfect$1, AnyConvex as AnyConvex$1, Confect, Convex, FunctionProvenance } from "./FunctionProvenance.js";
|
|
2
2
|
import { Runtime, RuntimeAndFunctionType, WithRuntime } from "./RuntimeAndFunctionType.js";
|
|
3
|
-
import { Schema } from "effect";
|
|
4
3
|
import { FunctionType, FunctionVisibility, RegisteredAction, RegisteredMutation, RegisteredQuery } from "convex/server";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/FunctionSpec.d.ts
|
|
7
7
|
declare namespace FunctionSpec_d_exports {
|
package/dist/FunctionSpec.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { Confect, Convex } from "./FunctionProvenance.js";
|
|
3
3
|
import { validateConfectFunctionIdentifier } from "./Identifier.js";
|
|
4
4
|
import { ConvexAction, ConvexMutation, ConvexQuery, NodeAction } from "./RuntimeAndFunctionType.js";
|
|
5
|
-
import
|
|
5
|
+
import * as Predicate from "effect/Predicate";
|
|
6
6
|
|
|
7
7
|
//#region src/FunctionSpec.ts
|
|
8
8
|
var FunctionSpec_exports = /* @__PURE__ */ __exportAll({
|
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 { Predicate } from \"effect\";\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.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"}
|
package/dist/GenericId.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Schema$1 from "effect/Schema";
|
|
2
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
2
3
|
import { GenericId as GenericId$1 } from "convex/values";
|
|
4
|
+
import { Option } from "effect";
|
|
3
5
|
|
|
4
6
|
//#region src/GenericId.d.ts
|
|
5
7
|
declare namespace GenericId_d_exports {
|
|
6
8
|
export { GenericId, tableName };
|
|
7
9
|
}
|
|
8
|
-
declare const GenericId: <TableName extends string>(tableName: TableName) => Schema.Schema<GenericId$1<TableName>>;
|
|
10
|
+
declare const GenericId: <TableName extends string>(tableName: TableName) => Schema$1.Schema<GenericId$1<TableName>>;
|
|
9
11
|
type GenericId<TableName extends string> = GenericId$1<TableName>;
|
|
10
12
|
declare const tableName: <TableName extends string>(ast: SchemaAST.AST) => Option.Option<TableName>;
|
|
11
13
|
//#endregion
|
package/dist/GenericId.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericId.d.ts","names":[],"sources":["../src/GenericId.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenericId.d.ts","names":[],"sources":["../src/GenericId.ts"],"mappings":";;;;;;;;;cAOa,SAAA,6BACX,SAAA,EAAW,SAAA,KACV,QAAA,CAAO,MAAA,CAAO,WAAA,CAAgB,SAAA;AAAA,KAKrB,SAAA,6BAAsC,WAAA,CAAgB,SAAA;AAAA,cAErD,SAAA,6BACX,GAAA,EAAK,SAAA,CAAU,GAAA,KACd,MAAA,CAAO,MAAA,CAAO,SAAA"}
|
package/dist/GenericId.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
3
4
|
|
|
4
5
|
//#region src/GenericId.ts
|
|
5
6
|
var GenericId_exports = /* @__PURE__ */ __exportAll({
|
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 type { Option } from \"effect\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\n\nconst ConvexId = Symbol.for(\"ConvexId\");\n\nexport const GenericId = <TableName extends string>(\n tableName: TableName,\n): Schema.Schema<ConvexGenericId<TableName>> =>\n Schema.String.pipe(\n Schema.annotations({ [ConvexId]: tableName }),\n ) as unknown as Schema.Schema<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 SchemaAST.getAnnotation<TableName>(ConvexId)(ast);\n"],"mappings":";;;;;;;;;AAKA,MAAM,WAAW,OAAO,IAAI,WAAW;AAEvC,MAAa,aACX,cAEA,OAAO,OAAO,KACZ,OAAO,YAAY,GAAG,WAAW,WAAW,CAAC,CAC9C;AAIH,MAAa,aACX,QAEA,UAAU,cAAyB,SAAS,CAAC,IAAI"}
|
package/dist/GroupSpec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSpec.d.ts","names":[],"sources":["../src/GroupSpec.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"GroupSpec.d.ts","names":[],"sources":["../src/GroupSpec.ts"],"mappings":";;;;;;;cAMa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,WAAA,GAAe,CAAA,cAAa,CAAA,IAAK,YAAA;AAAA,UAG7B,SAAA,mBACC,OAAA,2CAEG,yBAAA,CAAqC,SAAA,2BACxC,uBAAA,CAAwB,SAAA;EAAA,UAE9B,MAAA,GAAS,MAAA;EAAA,SACV,OAAA,EAAS,SAAA;EAAA,SACT,IAAA,EAAM,KAAA;EAAA,SACN,SAAA,qBACU,MAAA,CACf,yBAAA,CAAqC,SAAA,KACnC,UAAA,CAAsB,UAAA,EAAY,YAAA;EAAA,SAE/B,MAAA,kBACO,IAAA,CAAK,OAAA,IAAW,QAAA,CAAS,OAAA,EAAS,SAAA;EAGlD,WAAA,kBAA6B,yBAAA,CAAqC,SAAA,GAChE,SAAA,EAAW,QAAA,GACV,SAAA,CAAU,SAAA,EAAS,KAAA,EAAO,UAAA,GAAa,QAAA,EAAU,OAAA;EAEpD,QAAA,eAAuB,uBAAA,CAAwB,SAAA,GAC7C,KAAA,EAAO,KAAA,GACN,SAAA,CAAU,SAAA,EAAS,KAAA,EAAO,UAAA,EAAY,OAAA,GAAU,KAAA;EAEnD,UAAA,4CAEgB,uBAAA,CAAwB,SAAA,GAEtC,IAAA,EAAM,MAAA,EACN,KAAA,EAAO,KAAA,GACN,SAAA,CAAU,SAAA,EAAS,KAAA,EAAO,UAAA,EAAY,OAAA,GAAU,OAAA,CAAQ,KAAA,EAAO,MAAA;AAAA;AAAA,UAGnD,GAAA;EAAA,UACL,MAAA,GAAS,MAAA;AAAA;AAAA,UAGJ,YAAA,SAAqB,SAAA,CACpC,OAAA,UAEA,cAAA,EACA,YAAA;AAAA,UAGe,uBAAA,mBACC,OAAA,UACR,SAAA,CACR,SAAA,UAEA,yBAAA,CAAqC,SAAA,GACrC,uBAAA,CAAwB,SAAA;AAAA,KAGd,IAAA,eAAmB,YAAA,IAAgB,KAAA;AAAA,KAEnC,SAAA,eAAwB,YAAA,IAClC,KAAA,oBAAyB,KAAA;AAAA,KAEf,MAAA,eAAqB,YAAA,IAC/B,KAAA,iBAAsB,KAAA;AAAA,KAEZ,UAAA,eAAyB,YAAA,KAAiB,MAAA,CAAO,KAAA,6BAIzD,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,KAEJ,QAAA,eACI,YAAA,gBACA,IAAA,CAAK,KAAA,KACjB,OAAA,CAAQ,KAAA;EAAA,SAAkB,IAAA,EAAM,KAAA;AAAA;;KAGxB,OAAA,eAAsB,GAAA,0BAA6B,IAAA,CAC7D,KAAA;EAAA,SAGS,IAAA,EAAM,KAAA;AAAA;AAAA,cAoEJ,IAAA,QAAW,SAAA;AAAA,cAQX,MAAA,+BACX,IAAA,EAAM,KAAA,KACL,SAAA,WAAoB,KAAA;AAAA,cAWV,QAAA,QAAe,SAAA;AAAA,cAQf,UAAA,+BACX,IAAA,EAAM,KAAA,KACL,SAAA,SAAkB,KAAA;AAAA,cAWR,QAAA,+BACX,IAAA,EAAM,KAAA,EACN,KAAA,EAAO,GAAA,KACN,YAAA"}
|
package/dist/GroupSpec.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { validateConfectFunctionIdentifier } from "./Identifier.js";
|
|
3
|
-
import
|
|
3
|
+
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as Record from "effect/Record";
|
|
4
5
|
|
|
5
6
|
//#region src/GroupSpec.ts
|
|
6
7
|
var GroupSpec_exports = /* @__PURE__ */ __exportAll({
|
package/dist/GroupSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\n\nexport const TypeId = \"@confect/core/GroupSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isGroupSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface GroupSpec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never,\n Groups_ extends AnyWithPropsWithRuntime<Runtime> = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly name: Name_;\n readonly functions: {\n [FunctionName in FunctionSpec.Name<\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>\n >]: FunctionSpec.WithName<Functions_, FunctionName>;\n };\n readonly groups: {\n [GroupName in Name<Groups_>]: WithName<Groups_, GroupName>;\n };\n\n addFunction<Function extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>>(\n function_: Function,\n ): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_>;\n\n addGroup<Group extends AnyWithPropsWithRuntime<Runtime>>(\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group>;\n\n addGroupAt<\n const AtName extends string,\n Group extends AnyWithPropsWithRuntime<Runtime>,\n >(\n name: AtName,\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends GroupSpec<\n RuntimeAndFunctionType.Runtime,\n string,\n FunctionSpec.AnyWithProps,\n AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends GroupSpec<\n Runtime,\n string,\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n AnyWithPropsWithRuntime<Runtime>\n> {}\n\nexport type Name<Group extends AnyWithProps> = Group[\"name\"];\n\nexport type Functions<Group extends AnyWithProps> =\n Group[\"functions\"][keyof Group[\"functions\"]];\n\nexport type Groups<Group extends AnyWithProps> =\n Group[\"groups\"][keyof Group[\"groups\"]];\n\nexport type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [\n never,\n]\n ? never\n : Name<Groups<Group>>;\n\nexport type WithName<\n Group extends AnyWithProps,\n Name_ extends Name<Group>,\n> = Extract<Group, { readonly name: Name_ }>;\n\n/** Assigns a segment name to a leaf group created with {@link make} for typing and refs. */\nexport type NamedAt<Group extends Any, Name_ extends string> = Omit<\n Group,\n \"name\"\n> & {\n readonly name: Name_;\n};\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addFunction<Function extends FunctionSpec.AnyWithProps>(\n this: Any,\n function_: Function,\n ) {\n const this_ = this as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: Record.set(this_.functions, function_.name, function_),\n groups: this_.groups,\n });\n },\n\n addGroup<Group extends Any>(this: Any, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, group_.name, group_),\n });\n },\n\n addGroupAt<Group extends Any>(this: Any, name: string, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, name, withName(name, group_)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n Groups_ extends AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n name,\n functions,\n groups,\n}: {\n runtime: Runtime;\n name: Name_;\n functions: Record.ReadonlyRecord<string, Functions_>;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): GroupSpec<Runtime, Name_, Functions_, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n name,\n functions,\n groups,\n });\n\nexport const make = (): GroupSpec<\"Convex\", \"\"> =>\n makeProto({\n runtime: \"Convex\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Convex\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Convex\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const makeNode = (): GroupSpec<\"Node\", \"\"> =>\n makeProto({\n runtime: \"Node\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeNodeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Node\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Node\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const withName = <const Name_ extends string>(\n name: Name_,\n group: Any,\n): AnyWithProps => {\n validateConfectFunctionIdentifier(name);\n const group_ = group as AnyWithProps;\n\n if (group_.name === name) {\n return group_;\n }\n\n return makeProto({\n runtime: group_.runtime,\n name,\n functions: group_.functions,\n groups: group_.groups,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAa,SAAS;AAGtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,OAAO;AAoFlC,MAAM,QAAQ;EACX,SAAS;CAEV,YAEE,WACA;EACA,MAAM,QAAQ;AAEd,SAAO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,OAAO,SAAS,KAClB,QAAO;AAGT,QAAO,UAAU;EACf,SAAS,OAAO;EAChB;EACA,WAAW,OAAO;EAClB,QAAQ,OAAO;EAChB,CAAC"}
|
package/dist/PaginationResult.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
3
|
|
|
4
4
|
//#region src/PaginationResult.ts
|
|
5
5
|
var PaginationResult_exports = /* @__PURE__ */ __exportAll({ PaginationResult: () => PaginationResult });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import
|
|
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.Schema.AnyNoContext>(\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.optionalWith(Schema.Union(Schema.String, Schema.Null), {\n exact: true,\n }),\n pageStatus: Schema.optionalWith(\n Schema.Union(\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ),\n { exact: true },\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,aAAa,OAAO,MAAM,OAAO,QAAQ,OAAO,KAAK,EAAE,EACzE,OAAO,MACR,CAAC;CACF,YAAY,OAAO,aACjB,OAAO,MACL,OAAO,QAAQ,mBAAmB,EAClC,OAAO,QAAQ,gBAAgB,EAC/B,OAAO,KACR,EACD,EAAE,OAAO,MAAM,CAChB;CACF,CAAC"}
|
package/dist/Ref.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AnyAction as AnyAction$1, AnyMutation as AnyMutation$1, AnyQuery as AnyQuery$1, GetFunctionType as GetFunctionType$1, GetRuntime as GetRuntime$1, RuntimeAndFunctionType } from "./RuntimeAndFunctionType.js";
|
|
2
2
|
import { AnyWithProps, Args as Args$1, Error as Error$1, GetFunctionVisibility as GetFunctionVisibility$1, GetRuntimeAndFunctionType as GetRuntimeAndFunctionType$1, Returns as Returns$1 } from "./FunctionSpec.js";
|
|
3
|
-
import { Effect, Option, ParseResult } from "effect";
|
|
4
3
|
import { FunctionReference as FunctionReference$1, FunctionVisibility } from "convex/server";
|
|
5
4
|
import { ConvexError, Value } from "convex/values";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Option$1 from "effect/Option";
|
|
7
|
+
import { ParseResult } from "effect";
|
|
6
8
|
|
|
7
9
|
//#region src/Ref.d.ts
|
|
8
10
|
declare namespace Ref_d_exports {
|
|
@@ -67,12 +69,12 @@ declare const decodeErrorOrElse: <Ref_ extends Any, E>(ref: Ref_, mapUnknownErro
|
|
|
67
69
|
* into, and the caller is responsible for deciding what to do (typically:
|
|
68
70
|
* surface the original value as a defect).
|
|
69
71
|
*/
|
|
70
|
-
declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option.Option<Error<Ref_>>, ParseResult.ParseError>;
|
|
72
|
+
declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option$1.Option<Error<Ref_>>, ParseResult.ParseError>;
|
|
71
73
|
/**
|
|
72
74
|
* Synchronous counterpart to `decodeError`. Throws on schema decode failure;
|
|
73
75
|
* returns `None` when the ref doesn't declare a typed error.
|
|
74
76
|
*/
|
|
75
|
-
declare const decodeErrorSync: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Option.Option<Error<Ref_>>;
|
|
77
|
+
declare const decodeErrorSync: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Option$1.Option<Error<Ref_>>;
|
|
76
78
|
declare const maybeDecodeErrorSync: <Ref_ extends Any>(ref: Ref_, error: unknown) => unknown;
|
|
77
79
|
/**
|
|
78
80
|
* Encode args via the ref's args schema, invoke `call`, decode returns via the
|
package/dist/Ref.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","names":[],"sources":["../src/Ref.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Ref.d.ts","names":[],"sources":["../src/Ref.ts"],"mappings":";;;;;;;;;;;;UAeiB,GAAA,iCACiB,sBAAA,8BACJ,kBAAA;EAAA,SAKnB,uBAAA,GAA0B,uBAAA;EAAA,SAC1B,mBAAA,GAAsB,mBAAA;EAAA,SACtB,KAAA,GAAQ,KAAA;EAAA,SACR,QAAA,GAAW,QAAA;EAAA,SACX,MAAA,GAAS,MAAA;AAAA;AAAA,UAOH,GAAA,SAAY,GAAA;AAAA,UAEZ,WAAA,SAAoB,GAAA;AAAA,UAEpB,SAAA,SAAkB,GAAA;AAAA,UAElB,QAAA,SAAiB,GAAA,CAChC,UAAA,EACA,kBAAA;AAAA,UAMe,WAAA,SAAoB,GAAA,CACnC,aAAA,EACA,kBAAA;AAAA,UAMe,SAAA,SAAkB,GAAA,CACjC,WAAA,EACA,kBAAA;AAAA,UAMe,cAAA,SAAuB,GAAA,CACtC,UAAA;AAAA,UAOe,iBAAA,SAA0B,GAAA,CACzC,aAAA;AAAA,UAOe,eAAA,SAAwB,GAAA,CACvC,WAAA;AAAA,KAOU,yBAAA,SACV,IAAA,SAAa,GAAA,wGAOT,uBAAA;AAAA,KAGM,UAAA,SACV,IAAA,SAAa,GAAA,wGAOT,YAAA,CAAkC,uBAAA;AAAA,KAG5B,eAAA,SACV,IAAA,SAAa,GAAA,wGAOT,iBAAA,CAAuC,uBAAA;AAAA,KAGjC,qBAAA,SACV,IAAA,SAAa,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AK,IAAA;AAAA,cAUA,iBAAA,gBAAkC,GAAA,EAC7C,GAAA,EAAK,IAAA,EACL,cAAA,cACC,OAAA,CAAQ,IAAA;AAAA,cAWE,aAAA,GAAiB,KAAA,cAAiB,KAAA,IAAS,WAAA,CAAY,KAAA;;;;;;;;;;cAevD,iBAAA,gBACG,GAAA,KAAQ,GAAA,EAAK,IAAA,EAAM,eAAA,GAAkB,KAAA,cAAmB,CAAA,MACrE,KAAA,cAAiB,KAAA,CAAM,IAAA,IAAQ,CAAA;;;;;;;;cAiBrB,WAAA,gBAA4B,GAAA,EACvC,GAAA,EAAK,IAAA,EACL,YAAA,cACC,MAAA,CAAO,MAAA,CAAO,QAAA,CAAO,MAAA,CAAO,KAAA,CAAM,IAAA,IAAQ,WAAA,CAAY,UAAA;;;AArRzD;;cAuSa,eAAA,gBAAgC,GAAA,EAC3C,GAAA,EAAK,IAAA,EACL,YAAA,cACC,QAAA,CAAO,MAAA,CAAO,KAAA,CAAM,IAAA;AAAA,cAeV,oBAAA,gBAAqC,GAAA,EAChD,GAAA,EAAK,IAAA,EACL,KAAA;;AAzTF;;;;;AAEA;;cA6Ua,YAAA,gBAA6B,GAAA,aACxC,GAAA,EAAK,IAAA,EACL,IAAA,EAAM,IAAA,CAAK,IAAA,GACX,IAAA,GACE,iBAAA,EAAmB,iBAAA,CAAkB,IAAA,GACrC,WAAA,cACG,WAAA,WACL,eAAA,IAAmB,KAAA,cAAmB,CAAA,KACrC,MAAA,CAAO,MAAA,CAAO,OAAA,CAAQ,IAAA,GAAO,CAAA,GAAI,KAAA,CAAM,IAAA,IAAQ,WAAA,CAAY,UAAA"}
|
package/dist/Ref.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
3
|
import { makeFunctionReference } from "convex/server";
|
|
4
4
|
import { ConvexError } from "convex/values";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Match from "effect/Match";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
5
8
|
|
|
6
9
|
//#region src/Ref.ts
|
|
7
10
|
var Ref_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -25,7 +28,15 @@ const make = (functionNamespace, functionSpec) => ({
|
|
|
25
28
|
functionNamespace
|
|
26
29
|
});
|
|
27
30
|
const getConvexFunctionName = (ref) => `${ref.functionNamespace}:${ref.functionSpec.name}`;
|
|
28
|
-
const
|
|
31
|
+
const functionReferenceCache = /* @__PURE__ */ new Map();
|
|
32
|
+
const getFunctionReference = (ref) => {
|
|
33
|
+
const functionName = getConvexFunctionName(ref);
|
|
34
|
+
const cached = functionReferenceCache.get(functionName);
|
|
35
|
+
if (cached !== void 0) return cached;
|
|
36
|
+
const functionReference = makeFunctionReference(functionName);
|
|
37
|
+
functionReferenceCache.set(functionName, functionReference);
|
|
38
|
+
return functionReference;
|
|
39
|
+
};
|
|
29
40
|
const hasErrorSchema = (ref) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance), Match.tag("Convex", () => false), Match.exhaustive);
|
|
30
41
|
const encodeArgs = (ref, args) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.encode(confectFunctionProvenance.args)(args)), Match.tag("Convex", () => Effect.succeed(args)), Match.exhaustive);
|
|
31
42
|
const decodeReturns = (ref, returns) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.decode(confectFunctionProvenance.returns)(returns)), Match.tag("Convex", () => Effect.succeed(returns)), Match.exhaustive);
|
package/dist/Ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {\n FunctionReference as ConvexFunctionReference,\n FunctionVisibility,\n} from \"convex/server\";\nimport { makeFunctionReference } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { ConvexError } from \"convex/values\";\nimport type { ParseResult } from \"effect\";\nimport { Effect, Match, Option, Schema } from \"effect\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport interface Ref<\n _RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args,\n _Returns,\n _Error = never,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n readonly _Error?: _Error;\n /** @internal */\n readonly functionSpec: FunctionSpec.AnyWithProps;\n /** @internal */\n readonly functionNamespace: string;\n}\n\nexport interface Any extends Ref<any, any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType_\n : never;\n\nexport type GetRuntime<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetRuntime<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns,\n infer _Error\n >\n ? Args_\n : never;\n\nexport type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never\n ? [args?: Args<Ref_>]\n : [args: Args<Ref_>];\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_,\n infer _Error\n >\n ? Returns_\n : never;\n\nexport type Error<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer Error_\n >\n ? Error_\n : never;\n\nexport type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>\n>;\n\nexport type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n FunctionSpec.Args<FunctionSpec_>,\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>\n >;\n\nexport const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(\n /**\n * The namespace portion of a Convex function name, i.e. the part before the\n * colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be\n * `myGroupDir/myGroupMod`.\n */\n functionNamespace: string,\n functionSpec: FunctionSpec_,\n): FromFunctionSpec<FunctionSpec_> => ({ functionSpec, functionNamespace });\n\nexport const getConvexFunctionName = (ref: Any): string =>\n `${ref.functionNamespace}:${ref.functionSpec.name}`;\n\nexport const getFunctionReference = <Ref_ extends Any>(\n ref: Ref_,\n): FunctionReference<Ref_> =>\n makeFunctionReference(getConvexFunctionName(ref)) as FunctionReference<Ref_>;\n\nexport const hasErrorSchema = (ref: Any): boolean =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\n \"Confect\",\n (confectFunctionProvenance) => \"error\" in confectFunctionProvenance,\n ),\n Match.tag(\"Convex\", () => false),\n Match.exhaustive,\n );\n\nexport const encodeArgs = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): Effect.Effect<unknown, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encode(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(args)),\n Match.exhaustive,\n );\n\nexport const decodeReturns = <Ref_ extends Any>(\n ref: Ref_,\n returns: unknown,\n): Effect.Effect<Returns<Ref_>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decode(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(returns)),\n Match.exhaustive,\n );\n\nexport const encodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\nexport const decodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedReturns: unknown,\n): Returns<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeSync(confectFunctionProvenance.returns)(encodedReturns),\n ),\n Match.tag(\"Convex\", () => encodedReturns),\n Match.exhaustive,\n ) as Returns<Ref_>;\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nexport const isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\n/**\n * Build a callback-style handler that decodes the ref's typed error from a\n * caught `ConvexError`, or else forwards the value to `mapUnknownError`. The\n * fallback is also invoked when the input *is* a `ConvexError` but the ref\n * doesn't declare a typed-error schema—by definition such a value falls\n * outside the ref's error contract. Useful when adapting non-Effect APIs (e.g.\n * emitter callbacks for streamed subscriptions) to the same error semantics\n * that `runWithCodec` provides.\n */\nexport const decodeErrorOrElse =\n <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) =>\n (error: unknown): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n return mapUnknownError(error);\n };\n\n/**\n * Decode `encodedError` against the ref's error schema. Returns `None` if the\n * ref doesn't declare a typed error (Confect ref without an `error` schema, or\n * a Convex-provenance ref)—by definition there's nothing to decode the value\n * into, and the caller is responsible for deciding what to do (typically:\n * surface the original value as a defect).\n */\nexport const decodeError = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Effect.Effect<Option.Option<Error<Ref_>>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Effect.map(\n Schema.decode(confectFunctionProvenance.error)(encodedError),\n Option.some,\n )\n : Effect.succeed(Option.none<Error<Ref_>>()),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(Option.none<Error<Ref_>>())),\n Match.exhaustive,\n );\n\n/**\n * Synchronous counterpart to `decodeError`. Throws on schema decode failure;\n * returns `None` when the ref doesn't declare a typed error.\n */\nexport const decodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Option.Option<Error<Ref_>> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Option.some(\n Schema.decodeSync(confectFunctionProvenance.error)(\n encodedError,\n ) as Error<Ref_>,\n )\n : Option.none<Error<Ref_>>(),\n ),\n Match.tag(\"Convex\", () => Option.none<Error<Ref_>>()),\n Match.exhaustive,\n );\n\nexport const maybeDecodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n error: unknown,\n): unknown =>\n isConvexError(error)\n ? Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Schema.decodeSync(confectFunctionProvenance.error)(error.data)\n : error,\n ),\n Match.tag(\"Convex\", () => error),\n Match.exhaustive,\n )\n : error;\n\n/**\n * Encode args via the ref's args schema, invoke `call`, decode returns via the\n * ref's returns schema, and translate any thrown `ConvexError` into the ref's\n * typed error. Anything else the Promise rejects with—network failures,\n * server-side runtime errors, validation failures, etc.—is passed to\n * `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when\n * no handler is provided.\n */\nexport const runWithCodec = <Ref_ extends Any, E = never>(\n ref: Ref_,\n args: Args<Ref_>,\n call: (\n functionReference: FunctionReference<Ref_>,\n encodedArgs: unknown,\n ) => PromiseLike<unknown>,\n mapUnknownError?: (error: unknown) => E,\n): Effect.Effect<Returns<Ref_>, E | Error<Ref_> | ParseResult.ParseError> =>\n Effect.gen(function* () {\n const functionReference = getFunctionReference(ref);\n const functionProvenance = ref.functionSpec.functionProvenance;\n const invoke = (\n encodedArgs: unknown,\n ): Effect.Effect<unknown, Error<Ref_> | E> =>\n Effect.tryPromise({\n try: () => Promise.resolve(call(functionReference, encodedArgs)),\n catch: (error): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n if (mapUnknownError !== undefined) {\n return mapUnknownError(error);\n }\n throw error;\n },\n });\n return yield* Match.value(functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Effect.gen(function* () {\n const encodedArgs = yield* Schema.encode(\n confectFunctionProvenance.args,\n )(args);\n const encodedReturns = yield* invoke(encodedArgs);\n return yield* Schema.decode(confectFunctionProvenance.returns)(\n encodedReturns,\n );\n }),\n ),\n Match.tag(\"Convex\", () => invoke(args)),\n Match.exhaustive,\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmLA,MAAa,QAMX,mBACA,kBACqC;CAAE;CAAc;CAAmB;AAE1E,MAAa,yBAAyB,QACpC,GAAG,IAAI,kBAAkB,GAAG,IAAI,aAAa;AAE/C,MAAa,wBACX,QAEA,sBAAsB,sBAAsB,IAAI,CAAC;AAEnD,MAAa,kBAAkB,QAC7B,MAAM,MAAM,IAAI,aAAa,mBAAmB,CAAC,KAC/C,MAAM,IACJ,YACC,8BAA8B,WAAW,0BAC3C,EACD,MAAM,IAAI,gBAAgB,MAAM,EAChC,MAAM,WACP;AAEH,MAAa,cACX,KACA,SAEA,MAAM,MAAM,IAAI,aAAa,mBAAmB,CAAC,KAC/C,MAAM,IAAI,YAAY,8BACpB,OAAO,OAAO,0BAA0B,KAAK,CAAC,KAAK,CACpD,EACD,MAAM,IAAI,gBAAgB,OAAO,QAAQ,KAAK,CAAC,EAC/C,MAAM,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B,OAAO,KAAK,CAAC,EACvC,MAAM,WACP;EACD"}
|
|
1
|
+
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {\n FunctionReference as ConvexFunctionReference,\n FunctionVisibility,\n} from \"convex/server\";\nimport { makeFunctionReference } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { ConvexError } from \"convex/values\";\nimport type { ParseResult } from \"effect\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport interface Ref<\n _RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args,\n _Returns,\n _Error = never,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n readonly _Error?: _Error;\n /** @internal */\n readonly functionSpec: FunctionSpec.AnyWithProps;\n /** @internal */\n readonly functionNamespace: string;\n}\n\nexport interface Any extends Ref<any, any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType_\n : never;\n\nexport type GetRuntime<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetRuntime<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns,\n infer _Error\n >\n ? Args_\n : never;\n\nexport type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never\n ? [args?: Args<Ref_>]\n : [args: Args<Ref_>];\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_,\n infer _Error\n >\n ? Returns_\n : never;\n\nexport type Error<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer Error_\n >\n ? Error_\n : never;\n\nexport type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>\n>;\n\nexport type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n FunctionSpec.Args<FunctionSpec_>,\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>\n >;\n\nexport const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(\n /**\n * The namespace portion of a Convex function name, i.e. the part before the\n * colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be\n * `myGroupDir/myGroupMod`.\n */\n functionNamespace: string,\n functionSpec: FunctionSpec_,\n): FromFunctionSpec<FunctionSpec_> => ({ functionSpec, functionNamespace });\n\nexport const getConvexFunctionName = (ref: Any): string =>\n `${ref.functionNamespace}:${ref.functionSpec.name}`;\n\nconst functionReferenceCache = new Map<string, FunctionReference<Any>>();\n\nexport const getFunctionReference = <Ref_ extends Any>(\n ref: Ref_,\n): FunctionReference<Ref_> => {\n const functionName = getConvexFunctionName(ref);\n\n const cached = functionReferenceCache.get(functionName);\n if (cached !== undefined) {\n return cached as FunctionReference<Ref_>;\n }\n\n const functionReference = makeFunctionReference(functionName);\n functionReferenceCache.set(functionName, functionReference);\n\n return functionReference as FunctionReference<Ref_>;\n};\n\nexport const hasErrorSchema = (ref: Any): boolean =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\n \"Confect\",\n (confectFunctionProvenance) => \"error\" in confectFunctionProvenance,\n ),\n Match.tag(\"Convex\", () => false),\n Match.exhaustive,\n );\n\nexport const encodeArgs = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): Effect.Effect<unknown, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encode(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(args)),\n Match.exhaustive,\n );\n\nexport const decodeReturns = <Ref_ extends Any>(\n ref: Ref_,\n returns: unknown,\n): Effect.Effect<Returns<Ref_>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decode(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(returns)),\n Match.exhaustive,\n );\n\nexport const encodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\nexport const decodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedReturns: unknown,\n): Returns<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeSync(confectFunctionProvenance.returns)(encodedReturns),\n ),\n Match.tag(\"Convex\", () => encodedReturns),\n Match.exhaustive,\n ) as Returns<Ref_>;\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nexport const isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\n/**\n * Build a callback-style handler that decodes the ref's typed error from a\n * caught `ConvexError`, or else forwards the value to `mapUnknownError`. The\n * fallback is also invoked when the input *is* a `ConvexError` but the ref\n * doesn't declare a typed-error schema—by definition such a value falls\n * outside the ref's error contract. Useful when adapting non-Effect APIs (e.g.\n * emitter callbacks for streamed subscriptions) to the same error semantics\n * that `runWithCodec` provides.\n */\nexport const decodeErrorOrElse =\n <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) =>\n (error: unknown): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n return mapUnknownError(error);\n };\n\n/**\n * Decode `encodedError` against the ref's error schema. Returns `None` if the\n * ref doesn't declare a typed error (Confect ref without an `error` schema, or\n * a Convex-provenance ref)—by definition there's nothing to decode the value\n * into, and the caller is responsible for deciding what to do (typically:\n * surface the original value as a defect).\n */\nexport const decodeError = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Effect.Effect<Option.Option<Error<Ref_>>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Effect.map(\n Schema.decode(confectFunctionProvenance.error)(encodedError),\n Option.some,\n )\n : Effect.succeed(Option.none<Error<Ref_>>()),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(Option.none<Error<Ref_>>())),\n Match.exhaustive,\n );\n\n/**\n * Synchronous counterpart to `decodeError`. Throws on schema decode failure;\n * returns `None` when the ref doesn't declare a typed error.\n */\nexport const decodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Option.Option<Error<Ref_>> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Option.some(\n Schema.decodeSync(confectFunctionProvenance.error)(\n encodedError,\n ) as Error<Ref_>,\n )\n : Option.none<Error<Ref_>>(),\n ),\n Match.tag(\"Convex\", () => Option.none<Error<Ref_>>()),\n Match.exhaustive,\n );\n\nexport const maybeDecodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n error: unknown,\n): unknown =>\n isConvexError(error)\n ? Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Schema.decodeSync(confectFunctionProvenance.error)(error.data)\n : error,\n ),\n Match.tag(\"Convex\", () => error),\n Match.exhaustive,\n )\n : error;\n\n/**\n * Encode args via the ref's args schema, invoke `call`, decode returns via the\n * ref's returns schema, and translate any thrown `ConvexError` into the ref's\n * typed error. Anything else the Promise rejects with—network failures,\n * server-side runtime errors, validation failures, etc.—is passed to\n * `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when\n * no handler is provided.\n */\nexport const runWithCodec = <Ref_ extends Any, E = never>(\n ref: Ref_,\n args: Args<Ref_>,\n call: (\n functionReference: FunctionReference<Ref_>,\n encodedArgs: unknown,\n ) => PromiseLike<unknown>,\n mapUnknownError?: (error: unknown) => E,\n): Effect.Effect<Returns<Ref_>, E | Error<Ref_> | ParseResult.ParseError> =>\n Effect.gen(function* () {\n const functionReference = getFunctionReference(ref);\n const functionProvenance = ref.functionSpec.functionProvenance;\n const invoke = (\n encodedArgs: unknown,\n ): Effect.Effect<unknown, Error<Ref_> | E> =>\n Effect.tryPromise({\n try: () => Promise.resolve(call(functionReference, encodedArgs)),\n catch: (error): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n if (mapUnknownError !== undefined) {\n return mapUnknownError(error);\n }\n throw error;\n },\n });\n return yield* Match.value(functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Effect.gen(function* () {\n const encodedArgs = yield* Schema.encode(\n confectFunctionProvenance.args,\n )(args);\n const encodedReturns = yield* invoke(encodedArgs);\n return yield* Schema.decode(confectFunctionProvenance.returns)(\n encodedReturns,\n );\n }),\n ),\n Match.tag(\"Convex\", () => invoke(args)),\n Match.exhaustive,\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsLA,MAAa,QAMX,mBACA,kBACqC;CAAE;CAAc;CAAmB;AAE1E,MAAa,yBAAyB,QACpC,GAAG,IAAI,kBAAkB,GAAG,IAAI,aAAa;AAE/C,MAAM,yC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AAqB,IAAI,aAAa;CAC5C,MAAM,UACJ,gBAEA,OAAO,WAAW;EAChB,WAAW,QAAQ,QAAQ,KAAK,mBAAmB,YAAY,CAAC;EAChE,QAAQ,UAA2B;AACjC,OAAI,cAAc,MAAM,EAAE;IACxB,MAAM,UAAU,gBAAgB,KAAK,MAAM,KAAK;AAChD,QAAI,OAAO,OAAO,QAAQ,CACxB,QAAO,QAAQ;;AAGnB,OAAI,oBAAoB,OACtB,QAAO,gBAAgB,MAAM;AAE/B,SAAM;;EAET,CAAC;AACJ,QAAO,OAAO,MAAM,MAAM,mBAAmB,CAAC,KAC5C,MAAM,IAAI,YAAY,8BACpB,OAAO,IAAI,aAAa;EAItB,MAAM,iBAAiB,OAAO,OAHV,OAAO,OAAO,OAChC,0BAA0B,KAC3B,CAAC,KAAK,CAC0C;AACjD,SAAO,OAAO,OAAO,OAAO,0BAA0B,QAAQ,CAC5D,eACD;GACD,CACH,EACD,MAAM,IAAI,gBAAgB,OAAO,KAAK,CAAC,EACvC,MAAM,WACP;EACD"}
|
package/dist/Refs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyWithProps, GetFunctionVisibility, GetRuntimeAndFunctionType, Name as Name$1, WithName } from "./FunctionSpec.js";
|
|
2
2
|
import { AnyWithProps as AnyWithProps$1, Functions, GroupSpec, Groups, Name as Name$2, WithName as WithName$1 } from "./GroupSpec.js";
|
|
3
|
-
import { Any, AnyInternal, AnyPublic, FromFunctionSpec, Ref
|
|
3
|
+
import { Any, AnyInternal, AnyPublic, FromFunctionSpec, Ref } from "./Ref.js";
|
|
4
4
|
import { AnyWithPropsWithRuntime, Groups as Groups$1 } from "./Spec.js";
|
|
5
5
|
import { Types } from "effect";
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ declare namespace Refs_d_exports {
|
|
|
11
11
|
type Refs<ConvexSpec extends AnyWithPropsWithRuntime<"Convex">, NodeSpec extends AnyWithPropsWithRuntime<"Node"> = never, Predicate extends Any = Any> = Types.Simplify<OmitEmpty<Helper<Groups$1<ConvexSpec> | (NodeSpec extends never ? never : GroupSpec<"Node", "node", never, NodeSpec["groups"][keyof NodeSpec["groups"]]>), Predicate>>>;
|
|
12
12
|
type GroupRefs<Group extends AnyWithProps$1, Predicate extends Any> = Types.Simplify<OmitEmpty<Helper<Groups<Group>, Predicate>> & FilteredFunctions<Functions<Group>, Predicate>>;
|
|
13
13
|
type OmitEmpty<T> = { [K in keyof T as keyof T[K] extends never ? never : K]: T[K] };
|
|
14
|
-
type FunctionSpecMatchesPredicate<FunctionSpec_ extends AnyWithProps, Predicate extends Any> = Ref
|
|
14
|
+
type FunctionSpecMatchesPredicate<FunctionSpec_ extends AnyWithProps, Predicate extends Any> = Ref<GetRuntimeAndFunctionType<FunctionSpec_>, GetFunctionVisibility<FunctionSpec_>, any, any> extends Predicate ? true : false;
|
|
15
15
|
type FilteredFunctions<FunctionSpecs extends AnyWithProps, Predicate extends Any> = { [Name in Name$1<FunctionSpecs> as WithName<FunctionSpecs, Name> extends infer FunctionSpec_ extends AnyWithProps ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true ? Name : never : never]: WithName<FunctionSpecs, Name> extends infer F extends AnyWithProps ? FromFunctionSpec<F> : never };
|
|
16
16
|
type Helper<Groups extends AnyWithProps$1, Predicate extends Any> = { [GroupName in Name$2<Groups>]: WithName$1<Groups, GroupName> extends infer Group extends AnyWithProps$1 ? GroupRefs<Group, Predicate> : never };
|
|
17
17
|
declare const make: <ConvexSpec extends AnyWithPropsWithRuntime<"Convex">, NodeSpec extends AnyWithPropsWithRuntime<"Node"> = never>(convexSpec: ConvexSpec, nodeSpec?: NodeSpec) => {
|
package/dist/Refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"mappings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;AAAA"}
|
package/dist/Refs.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { makeNodeAt } from "./GroupSpec.js";
|
|
3
3
|
import { getConvexFunctionName, make as make$1 } from "./Ref.js";
|
|
4
|
-
import
|
|
4
|
+
import * as Record from "effect/Record";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import { pipe } from "effect/Function";
|
|
7
|
+
import * as Array from "effect/Array";
|
|
5
8
|
|
|
6
9
|
//#region src/Refs.ts
|
|
7
10
|
var Refs_exports = /* @__PURE__ */ __exportAll({ make: () => make });
|
package/dist/Refs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refs.js","names":["GroupSpec.makeNodeAt","Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { Array
|
|
1
|
+
{"version":3,"file":"Refs.js","names":["GroupSpec.makeNodeAt","Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Option from \"effect/Option\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport * as GroupSpec from \"./GroupSpec\";\nimport * as Ref from \"./Ref\";\nimport type * as Spec from \"./Spec\";\n\nexport type Refs<\n ConvexSpec extends Spec.AnyWithPropsWithRuntime<\"Convex\">,\n NodeSpec extends Spec.AnyWithPropsWithRuntime<\"Node\"> = never,\n Predicate extends Ref.Any = Ref.Any,\n> = Types.Simplify<\n OmitEmpty<\n Helper<\n | Spec.Groups<ConvexSpec>\n | (NodeSpec extends never\n ? never\n : GroupSpec.GroupSpec<\n \"Node\",\n \"node\",\n never,\n NodeSpec[\"groups\"][keyof NodeSpec[\"groups\"]]\n >),\n Predicate\n >\n >\n>;\n\ntype GroupRefs<\n Group extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = Types.Simplify<\n OmitEmpty<Helper<GroupSpec.Groups<Group>, Predicate>> &\n FilteredFunctions<GroupSpec.Functions<Group>, Predicate>\n>;\n\ntype OmitEmpty<T> = {\n [K in keyof T as keyof T[K] extends never ? never : K]: T[K];\n};\n\ntype FunctionSpecMatchesPredicate<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> =\n Ref.Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n any,\n any\n > extends Predicate\n ? true\n : false;\n\ntype FilteredFunctions<\n FunctionSpecs extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [Name in FunctionSpec.Name<FunctionSpecs> as FunctionSpec.WithName<\n FunctionSpecs,\n Name\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true\n ? Name\n : never\n : never]: FunctionSpec.WithName<FunctionSpecs, Name> extends infer F extends\n FunctionSpec.AnyWithProps\n ? Ref.FromFunctionSpec<F>\n : never;\n};\n\ntype Helper<\n Groups extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? GroupRefs<Group, Predicate>\n : never;\n};\n\ntype Any =\n | {\n readonly [key: string]: Any;\n }\n | Ref.Any;\n\nexport const make = <\n ConvexSpec extends Spec.AnyWithPropsWithRuntime<\"Convex\">,\n NodeSpec extends Spec.AnyWithPropsWithRuntime<\"Node\"> = never,\n>(\n convexSpec: ConvexSpec,\n nodeSpec?: NodeSpec,\n): {\n public: Refs<ConvexSpec, NodeSpec, Ref.AnyPublic>;\n internal: Refs<ConvexSpec, NodeSpec, Ref.AnyInternal>;\n} => {\n const groups = Option.fromNullable(nodeSpec).pipe(\n Option.map((nodeSpec_) =>\n Array.reduce(\n Record.toEntries(nodeSpec_.groups),\n GroupSpec.makeNodeAt(\"node\"),\n (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group),\n ),\n ),\n Option.match({\n onNone: () => convexSpec.groups,\n onSome: (nodeGroup) => ({ ...convexSpec.groups, node: nodeGroup }),\n }),\n );\n const refs = makeHelper(groups);\n return {\n public: refs as Refs<ConvexSpec, NodeSpec, Ref.AnyPublic>,\n internal: refs as Refs<ConvexSpec, NodeSpec, Ref.AnyInternal>,\n };\n};\n\nconst makeHelper = (\n groups: Record.ReadonlyRecord<string, GroupSpec.Any>,\n functionNamespace: Option.Option<string> = Option.none(),\n): Any =>\n pipe(\n groups as Record.ReadonlyRecord<string, GroupSpec.AnyWithProps>,\n Record.map((group, name) => {\n const currentFunctionNamespace = Option.match(functionNamespace, {\n onNone: () => name,\n onSome: (parentNamespace) => `${parentNamespace}/${name}`,\n });\n\n return Record.union(\n makeHelper(group.groups, Option.some(currentFunctionNamespace)),\n Record.map(group.functions, (function_) =>\n Ref.make(currentFunctionNamespace, function_),\n ),\n (_subGroup, _function) => {\n throw new Error(\n `Group and function at same level have same name ('${Ref.getConvexFunctionName(_function)}')`,\n );\n },\n );\n }),\n );\n"],"mappings":";;;;;;;;;;AA2FA,MAAa,QAIX,YACA,aAIG;CAcH,MAAM,OAAO,WAbE,OAAO,aAAa,SAAS,CAAC,KAC3C,OAAO,KAAK,cACV,MAAM,OACJ,OAAO,UAAU,UAAU,OAAO,EAClCA,WAAqB,OAAO,GAC3B,eAAe,CAAC,MAAM,WAAW,cAAc,WAAW,MAAM,MAAM,CACxE,CACF,EACD,OAAO,MAAM;EACX,cAAc,WAAW;EACzB,SAAS,eAAe;GAAE,GAAG,WAAW;GAAQ,MAAM;GAAW;EAClE,CAAC,CACH,CAC8B;AAC/B,QAAO;EACL,QAAQ;EACR,UAAU;EACX;;AAGH,MAAM,cACJ,QACA,oBAA2C,OAAO,MAAM,KAExD,KACE,QACA,OAAO,KAAK,OAAO,SAAS;CAC1B,MAAM,2BAA2B,OAAO,MAAM,mBAAmB;EAC/D,cAAc;EACd,SAAS,oBAAoB,GAAG,gBAAgB,GAAG;EACpD,CAAC;AAEF,QAAO,OAAO,MACZ,WAAW,MAAM,QAAQ,OAAO,KAAK,yBAAyB,CAAC,EAC/D,OAAO,IAAI,MAAM,YAAY,cAC3BC,OAAS,0BAA0B,UAAU,CAC9C,GACA,WAAW,cAAc;AACxB,QAAM,IAAI,MACR,qDAAqDC,sBAA0B,UAAU,CAAC,IAC3F;GAEJ;EACD,CACH"}
|
package/dist/Registry.d.ts
CHANGED
package/dist/Registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.d.ts","names":[],"sources":["../src/Registry.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Registry.d.ts","names":[],"sources":["../src/Registry.ts"],"mappings":";;;;;;;;;;;;;;AAWA;UAAiB,aAAA;EAAA,UACL,GAAA,qBAAwB,aAAA;AAAA;AAAA,cACnC,aAAA;AAAA;;;;;;;;;AAAA,cAWY,QAAA,SAAiB,aAAA"}
|
package/dist/Registry.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Ref from "effect/Ref";
|
|
3
4
|
|
|
4
5
|
//#region src/Registry.ts
|
|
5
6
|
var Registry_exports = /* @__PURE__ */ __exportAll({ Registry: () => Registry });
|
package/dist/Registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Ref from \"effect/Ref\";\n\n/**\n * Recursive tree that mirrors a `Spec`'s group structure. Leaves are the\n * per-function items written by each `FunctionImpl`'s layer initializer. The\n * leaf type is intentionally `unknown` here so `@confect/core` does not need\n * to know about `@confect/server`'s `RegistryItem` shape; producers and\n * consumers (the server runtime and the CLI's `implValidation`) narrow as\n * needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown | RegistryItems;\n}\n\n/**\n * Effect `Context.Reference` keyed by `@confect/core/Registry`. Lives in\n * `@confect/core` so `@confect/server` (which writes to it from\n * `FunctionImpl` initializers and reads it from `RegisteredFunctions`) and\n * `@confect/cli` (which inspects it during impl validation) can share the\n * exact same `Ref` instance by importing the same tag — without relying on\n * Effect's global default-value cache to align two separately-defined tags\n * by string key.\n */\nexport class Registry extends Context.Reference<Registry>()(\n \"@confect/core/Registry\",\n {\n defaultValue: () => Ref.unsafeMake<RegistryItems>({}),\n },\n) {}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,WAAb,cAA8B,QAAQ,WAAqB,CACzD,0BACA,EACE,oBAAoB,IAAI,WAA0B,EAAE,CAAC,EACtD,CACF,CAAC"}
|
package/dist/Spec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spec.d.ts","names":[],"sources":["../src/Spec.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Spec.d.ts","names":[],"sources":["../src/Spec.ts"],"mappings":";;;;;;;cAOa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,MAAA,GAAU,CAAA,cAAa,CAAA,IAAK,YAAA;AAAA,cAG5B,YAAA,GACX,CAAA,cACC,CAAA,IAAK,uBAAA;AAAA,cAKK,UAAA,GAAc,CAAA,cAAa,CAAA,IAAK,uBAAA;AAAA,UAK5B,IAAA,mBACC,OAAA,kBACA,yBAAA,CAAkC,SAAA;EAAA,UAExC,MAAA,GAAS,MAAA;EAAA,SACV,OAAA,EAAS,SAAA;EAAA,SACT,MAAA,kBACO,IAAA,CAAe,OAAA,IAAW,QAAA,CACtC,OAAA,EACA,SAAA;EAIJ,GAAA,eAAkB,yBAAA,CAAkC,SAAA,GAClD,KAAA,EAAO,KAAA,GACN,IAAA,CAAK,SAAA,EAAS,OAAA,GAAU,KAAA;EAE3B,KAAA,4CAEgB,yBAAA,CAAkC,SAAA,GAEhD,IAAA,EAAM,MAAA,EACN,KAAA,EAAO,KAAA,GACN,IAAA,CAAK,SAAA,EAAS,OAAA,GAAU,OAAA,CAAkB,KAAA,EAAO,MAAA;AAAA;AAAA,UAGrC,GAAA;EAAA,UACL,MAAA,GAAS,MAAA;AAAA;AAAA,UAGJ,YAAA,SAAqB,IAAA,CACpC,OAAA,EACA,cAAA;AAAA,UAGe,uBAAA,mBACC,OAAA,UACR,IAAA,CAAK,SAAA,EAAS,yBAAA,CAAkC,SAAA;AAAA,KAE9C,MAAA,eAAqB,YAAA,IAC/B,KAAA,iBAAsB,KAAA;AAAA,cAuCX,IAAA,QAAW,IAAA;AAAA,cAGX,QAAA,QAAe,IAAA;;;;AAjG5B;;;cA0Ga,KAAA,sBACQ,uBAAA,6BACF,uBAAA,UAEjB,UAAA,EAAY,UAAA,EACZ,QAAA,GAAW,QAAA,KACV,YAAA"}
|
package/dist/Spec.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { makeNodeAt, withName } from "./GroupSpec.js";
|
|
3
|
-
import
|
|
3
|
+
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as Record from "effect/Record";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Array from "effect/Array";
|
|
4
7
|
|
|
5
8
|
//#region src/Spec.ts
|
|
6
9
|
var Spec_exports = /* @__PURE__ */ __exportAll({
|
package/dist/Spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spec.js","names":["GroupSpec.withName","GroupSpec.makeNodeAt"],"sources":["../src/Spec.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Spec.js","names":["GroupSpec.withName","GroupSpec.makeNodeAt"],"sources":["../src/Spec.ts"],"sourcesContent":["import * as Array from \"effect/Array\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as GroupSpec from \"./GroupSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/Spec\";\nexport type TypeId = typeof TypeId;\n\nexport const isSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport const isConvexSpec = (\n u: unknown,\n): u is AnyWithPropsWithRuntime<\"Convex\"> =>\n Predicate.hasProperty(u, TypeId) &&\n Predicate.hasProperty(u, \"runtime\") &&\n u.runtime === \"Convex\";\n\nexport const isNodeSpec = (u: unknown): u is AnyWithPropsWithRuntime<\"Node\"> =>\n Predicate.hasProperty(u, TypeId) &&\n Predicate.hasProperty(u, \"runtime\") &&\n u.runtime === \"Node\";\n\nexport interface Spec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Groups_ extends GroupSpec.AnyWithPropsWithRuntime<Runtime> = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly groups: {\n [GroupName in GroupSpec.Name<Groups_>]: GroupSpec.WithName<\n Groups_,\n GroupName\n >;\n };\n\n add<Group extends GroupSpec.AnyWithPropsWithRuntime<Runtime>>(\n group: Group,\n ): Spec<Runtime, Groups_ | Group>;\n\n addAt<\n const Name extends string,\n Group extends GroupSpec.AnyWithPropsWithRuntime<Runtime>,\n >(\n name: Name,\n group: Group,\n ): Spec<Runtime, Groups_ | GroupSpec.NamedAt<Group, Name>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Spec<\n RuntimeAndFunctionType.Runtime,\n GroupSpec.AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends Spec<Runtime, GroupSpec.AnyWithPropsWithRuntime<Runtime>> {}\n\nexport type Groups<Spec_ extends AnyWithProps> =\n Spec_[\"groups\"][keyof Spec_[\"groups\"]];\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add<Group extends GroupSpec.AnyWithProps>(this: AnyWithProps, group: Group) {\n return makeProto({\n runtime: this.runtime,\n groups: Record.set(this.groups, group.name, group),\n });\n },\n\n addAt<Group extends GroupSpec.AnyWithProps>(\n this: AnyWithProps,\n name: string,\n group: Group,\n ) {\n return makeProto({\n runtime: this.runtime,\n groups: Record.set(this.groups, name, GroupSpec.withName(name, group)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Groups_ extends GroupSpec.AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n groups,\n}: {\n runtime: Runtime;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): Spec<Runtime, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n groups,\n });\n\nexport const make = (): Spec<\"Convex\"> =>\n makeProto({ runtime: \"Convex\", groups: {} });\n\nexport const makeNode = (): Spec<\"Node\"> =>\n makeProto({ runtime: \"Node\", groups: {} });\n\n/**\n * Merges a Convex spec with an optional Node spec into a single assembled\n * spec (used by codegen to build `Refs.make` and to enumerate function paths).\n * When `nodeSpec` is provided, its groups are merged under a \"node\" namespace,\n * mirroring the structure used by `Refs.make`.\n */\nexport const merge = <\n ConvexSpec extends AnyWithPropsWithRuntime<\"Convex\">,\n NodeSpec extends AnyWithPropsWithRuntime<\"Node\">,\n>(\n convexSpec: ConvexSpec,\n nodeSpec?: NodeSpec,\n): AnyWithProps => {\n const groups = Option.fromNullable(nodeSpec).pipe(\n Option.map((nodeSpec_) =>\n Array.reduce(\n Record.toEntries(nodeSpec_.groups),\n GroupSpec.makeNodeAt(\"node\"),\n (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group),\n ),\n ),\n Option.match({\n onNone: () => convexSpec.groups,\n onSome: (nodeGroup) => ({ ...convexSpec.groups, node: nodeGroup }),\n }),\n );\n\n return Object.assign(Object.create(Proto), {\n runtime: \"Convex\" as const,\n groups,\n }) as AnyWithProps;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAOA,MAAa,SAAS;AAGtB,MAAa,UAAU,MACrB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAa,gBACX,MAEA,UAAU,YAAY,GAAG,OAAO,IAChC,UAAU,YAAY,GAAG,UAAU,IACnC,EAAE,YAAY;AAEhB,MAAa,cAAc,MACzB,UAAU,YAAY,GAAG,OAAO,IAChC,UAAU,YAAY,GAAG,UAAU,IACnC,EAAE,YAAY;AA4ChB,MAAM,QAAQ;EACX,SAAS;CAEV,IAA8D,OAAc;AAC1E,SAAO,UAAU;GACf,SAAS,KAAK;GACd,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAM,MAAM,MAAM;GACnD,CAAC;;CAGJ,MAEE,MACA,OACA;AACA,SAAO,UAAU;GACf,SAAS,KAAK;GACd,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAMA,SAAmB,MAAM,MAAM,CAAC;GACvE,CAAC;;CAEL;AAED,MAAM,aAGJ,EACA,SACA,aAKA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACD,CAAC;AAEJ,MAAa,aACX,UAAU;CAAE,SAAS;CAAU,QAAQ,EAAE;CAAE,CAAC;AAE9C,MAAa,iBACX,UAAU;CAAE,SAAS;CAAQ,QAAQ,EAAE;CAAE,CAAC;;;;;;;AAQ5C,MAAa,SAIX,YACA,aACiB;CACjB,MAAM,SAAS,OAAO,aAAa,SAAS,CAAC,KAC3C,OAAO,KAAK,cACV,MAAM,OACJ,OAAO,UAAU,UAAU,OAAO,EAClCC,WAAqB,OAAO,GAC3B,eAAe,CAAC,MAAM,WAAW,cAAc,WAAW,MAAM,MAAM,CACxE,CACF,EACD,OAAO,MAAM;EACX,cAAc,WAAW;EACzB,SAAS,eAAe;GAAE,GAAG,WAAW;GAAQ,MAAM;GAAW;EAClE,CAAC,CACH;AAED,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC,SAAS;EACT;EACD,CAAC"}
|
package/dist/SystemFields.d.ts
CHANGED
package/dist/SystemFields.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { GenericId } from "./GenericId.js";
|
|
3
|
-
import
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
4
|
|
|
5
5
|
//#region src/SystemFields.ts
|
|
6
6
|
var SystemFields_exports = /* @__PURE__ */ __exportAll({
|
package/dist/SystemFields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemFields.js","names":["GenericId.GenericId"],"sources":["../src/SystemFields.ts"],"sourcesContent":["import type {\n Expand,\n IdField,\n SystemFields as NonIdSystemFields,\n} from \"convex/server\";\nimport
|
|
1
|
+
{"version":3,"file":"SystemFields.js","names":["GenericId.GenericId"],"sources":["../src/SystemFields.ts"],"sourcesContent":["import type {\n Expand,\n IdField,\n SystemFields as NonIdSystemFields,\n} from \"convex/server\";\nimport * as Schema from \"effect/Schema\";\nimport * as GenericId from \"./GenericId\";\n\ntype SystemFieldsSchema<TableName extends string> = Schema.Struct<{\n _id: Schema.Schema<\n GenericId.GenericId<TableName>,\n GenericId.GenericId<TableName>,\n never\n >;\n _creationTime: typeof Schema.Number;\n}>;\n\n/**\n * Produces a schema for Convex system fields.\n */\nexport const SystemFields = <TableName extends string>(\n tableName: TableName,\n): SystemFieldsSchema<TableName> =>\n Schema.Struct({\n _id: GenericId.GenericId(tableName),\n _creationTime: Schema.Number,\n });\n\n/**\n * Extend a table schema with Convex system fields.\n */\nexport const extendWithSystemFields = <\n TableName extends string,\n TableSchema extends Schema.Schema.AnyNoContext,\n>(\n tableName: TableName,\n schema: TableSchema,\n): ExtendWithSystemFields<TableName, TableSchema> =>\n Schema.extend(SystemFields(tableName), schema);\n\n/**\n * Extend a table schema with Convex system fields at the type level.\n */\nexport type ExtendWithSystemFields<\n TableName extends string,\n TableSchema extends Schema.Schema.AnyNoContext,\n> = Schema.extend<SystemFieldsSchema<TableName>, TableSchema>;\n\nexport type WithSystemFields<TableName extends string, Document> = Expand<\n Readonly<IdField<TableName>> & Readonly<NonIdSystemFields> & Document\n>;\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,gBACX,cAEA,OAAO,OAAO;CACZ,KAAKA,UAAoB,UAAU;CACnC,eAAe,OAAO;CACvB,CAAC;;;;AAKJ,MAAa,0BAIX,WACA,WAEA,OAAO,OAAO,aAAa,UAAU,EAAE,OAAO"}
|
package/dist/Types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Brand } from "effect";
|
|
2
1
|
import { DocumentByName, FieldTypeFromFieldPath, GenericDataModel, GenericDatabaseReader, TableNamesInDataModel } from "convex/server";
|
|
3
2
|
import { GenericId } from "convex/values";
|
|
3
|
+
import { Brand } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region src/Types.d.ts
|
|
6
6
|
declare namespace Types_d_exports {
|
package/dist/UserIdentity.d.ts
CHANGED
package/dist/UserIdentity.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
3
|
|
|
4
4
|
//#region src/UserIdentity.ts
|
|
5
5
|
var UserIdentity_exports = /* @__PURE__ */ __exportAll({ UserIdentity: () => UserIdentity });
|
package/dist/UserIdentity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserIdentity.js","names":[],"sources":["../src/UserIdentity.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"UserIdentity.js","names":[],"sources":["../src/UserIdentity.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const UserIdentity = <CustomClaimsFields extends Schema.Struct.Fields>(\n customClaimsFields: CustomClaimsFields,\n) =>\n Schema.Struct({\n ...customClaimsFields,\n tokenIdentifier: Schema.String,\n subject: Schema.String,\n issuer: Schema.String,\n name: Schema.optionalWith(Schema.String, { exact: true }),\n givenName: Schema.optionalWith(Schema.String, { exact: true }),\n familyName: Schema.optionalWith(Schema.String, { exact: true }),\n nickname: Schema.optionalWith(Schema.String, { exact: true }),\n preferredUsername: Schema.optionalWith(Schema.String, { exact: true }),\n profileUrl: Schema.optionalWith(Schema.String, { exact: true }),\n pictureUrl: Schema.optionalWith(Schema.String, { exact: true }),\n email: Schema.optionalWith(Schema.String, { exact: true }),\n emailVerified: Schema.optionalWith(Schema.Boolean, { exact: true }),\n gender: Schema.optionalWith(Schema.String, { exact: true }),\n birthday: Schema.optionalWith(Schema.String, { exact: true }),\n timezone: Schema.optionalWith(Schema.String, { exact: true }),\n language: Schema.optionalWith(Schema.String, { exact: true }),\n phoneNumber: Schema.optionalWith(Schema.String, { exact: true }),\n phoneNumberVerified: Schema.optionalWith(Schema.Boolean, { exact: true }),\n address: Schema.optionalWith(Schema.String, { exact: true }),\n updatedAt: Schema.optionalWith(Schema.String, { exact: true }),\n });\n"],"mappings":";;;;;AAEA,MAAa,gBACX,uBAEA,OAAO,OAAO;CACZ,GAAG;CACH,iBAAiB,OAAO;CACxB,SAAS,OAAO;CAChB,QAAQ,OAAO;CACf,MAAM,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CACzD,WAAW,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC9D,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,mBAAmB,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CACtE,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,OAAO,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC1D,eAAe,OAAO,aAAa,OAAO,SAAS,EAAE,OAAO,MAAM,CAAC;CACnE,QAAQ,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC3D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,aAAa,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAChE,qBAAqB,OAAO,aAAa,OAAO,SAAS,EAAE,OAAO,MAAM,CAAC;CACzE,SAAS,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC5D,WAAW,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,CAAC"}
|
package/package.json
CHANGED
package/src/FunctionSpec.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
RegisteredQuery,
|
|
7
7
|
} from "convex/server";
|
|
8
8
|
import type { Schema } from "effect";
|
|
9
|
-
import
|
|
9
|
+
import * as Predicate from "effect/Predicate";
|
|
10
10
|
import * as FunctionProvenance from "./FunctionProvenance";
|
|
11
11
|
import { validateConfectFunctionIdentifier } from "./Identifier";
|
|
12
12
|
import * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
package/src/GenericId.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GenericId as ConvexGenericId } from "convex/values";
|
|
2
|
-
import {
|
|
2
|
+
import type { Option } from "effect";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
3
5
|
|
|
4
6
|
const ConvexId = Symbol.for("ConvexId");
|
|
5
7
|
|
package/src/GroupSpec.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Predicate from "effect/Predicate";
|
|
2
|
+
import * as Record from "effect/Record";
|
|
2
3
|
import type * as FunctionSpec from "./FunctionSpec";
|
|
3
4
|
import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
4
5
|
import { validateConfectFunctionIdentifier } from "./Identifier";
|
package/src/PaginationResult.ts
CHANGED
package/src/Ref.ts
CHANGED
|
@@ -6,7 +6,10 @@ import { makeFunctionReference } from "convex/server";
|
|
|
6
6
|
import type { Value } from "convex/values";
|
|
7
7
|
import { ConvexError } from "convex/values";
|
|
8
8
|
import type { ParseResult } from "effect";
|
|
9
|
-
import
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Match from "effect/Match";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
10
13
|
import type * as FunctionSpec from "./FunctionSpec";
|
|
11
14
|
import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
12
15
|
|
|
@@ -190,10 +193,23 @@ export const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(
|
|
|
190
193
|
export const getConvexFunctionName = (ref: Any): string =>
|
|
191
194
|
`${ref.functionNamespace}:${ref.functionSpec.name}`;
|
|
192
195
|
|
|
196
|
+
const functionReferenceCache = new Map<string, FunctionReference<Any>>();
|
|
197
|
+
|
|
193
198
|
export const getFunctionReference = <Ref_ extends Any>(
|
|
194
199
|
ref: Ref_,
|
|
195
|
-
): FunctionReference<Ref_> =>
|
|
196
|
-
|
|
200
|
+
): FunctionReference<Ref_> => {
|
|
201
|
+
const functionName = getConvexFunctionName(ref);
|
|
202
|
+
|
|
203
|
+
const cached = functionReferenceCache.get(functionName);
|
|
204
|
+
if (cached !== undefined) {
|
|
205
|
+
return cached as FunctionReference<Ref_>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const functionReference = makeFunctionReference(functionName);
|
|
209
|
+
functionReferenceCache.set(functionName, functionReference);
|
|
210
|
+
|
|
211
|
+
return functionReference as FunctionReference<Ref_>;
|
|
212
|
+
};
|
|
197
213
|
|
|
198
214
|
export const hasErrorSchema = (ref: Any): boolean =>
|
|
199
215
|
Match.value(ref.functionSpec.functionProvenance).pipe(
|
package/src/Refs.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Types } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import { pipe } from "effect/Function";
|
|
3
|
+
import * as Array from "effect/Array";
|
|
4
|
+
import * as Option from "effect/Option";
|
|
5
|
+
import * as Record from "effect/Record";
|
|
3
6
|
import type * as FunctionSpec from "./FunctionSpec";
|
|
4
7
|
import * as GroupSpec from "./GroupSpec";
|
|
5
8
|
import * as Ref from "./Ref";
|
package/src/Registry.ts
CHANGED
package/src/Spec.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Array from "effect/Array";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as Record from "effect/Record";
|
|
2
5
|
import * as GroupSpec from "./GroupSpec";
|
|
3
6
|
import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
4
7
|
|
package/src/SystemFields.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
IdField,
|
|
4
4
|
SystemFields as NonIdSystemFields,
|
|
5
5
|
} from "convex/server";
|
|
6
|
-
import
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
7
|
import * as GenericId from "./GenericId";
|
|
8
8
|
|
|
9
9
|
type SystemFieldsSchema<TableName extends string> = Schema.Struct<{
|
package/src/UserIdentity.ts
CHANGED