@confect/core 1.0.0-next.3 → 1.0.0-next.4
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 +6 -0
- package/dist/FunctionSpec.d.ts +69 -20
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +15 -10
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GroupSpec.d.ts +14 -10
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +18 -4
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Ref.d.ts +25 -22
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +6 -6
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +8 -3
- package/dist/Refs.js.map +1 -1
- package/dist/RuntimeAndFunctionType.d.ts +54 -0
- package/dist/RuntimeAndFunctionType.d.ts.map +1 -0
- package/dist/RuntimeAndFunctionType.js +21 -0
- package/dist/RuntimeAndFunctionType.js.map +1 -0
- package/dist/Spec.d.ts +20 -8
- package/dist/Spec.d.ts.map +1 -1
- package/dist/Spec.js +43 -7
- package/dist/Spec.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/src/FunctionSpec.ts +73 -25
- package/src/GroupSpec.ts +47 -15
- package/src/Ref.ts +50 -24
- package/src/Refs.ts +42 -11
- package/src/RuntimeAndFunctionType.ts +57 -0
- package/src/Spec.ts +75 -10
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
package/dist/FunctionSpec.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { GetFunctionType, Runtime, RuntimeAndFunctionType, WithRuntime } from "./RuntimeAndFunctionType.js";
|
|
1
2
|
import { Schema } from "effect";
|
|
2
3
|
import { FunctionType, FunctionVisibility, RegisteredAction, RegisteredMutation, RegisteredQuery } from "convex/server";
|
|
3
4
|
|
|
4
5
|
//#region src/FunctionSpec.d.ts
|
|
5
6
|
declare namespace FunctionSpec_d_exports {
|
|
6
|
-
export { Any, AnyWithProps, AnyWithPropsWithFunctionType,
|
|
7
|
+
export { Any, AnyWithProps, AnyWithPropsWithFunctionType, AnyWithPropsWithRuntime, Args, FunctionSpec, GetFunctionVisibility, GetRuntimeAndFunctionType, Name, RegisteredFunction, Returns, TypeId, WithFunctionType, WithName, WithRuntimeAndFunctionType, WithoutName, internalAction, internalMutation, internalNodeAction, internalQuery, isFunctionSpec, publicAction, publicMutation, publicNodeAction, publicQuery };
|
|
7
8
|
}
|
|
8
|
-
declare const TypeId = "@confect/core/
|
|
9
|
+
declare const TypeId = "@confect/core/FunctionSpec";
|
|
9
10
|
type TypeId = typeof TypeId;
|
|
10
11
|
declare const isFunctionSpec: (u: unknown) => u is AnyWithProps;
|
|
11
|
-
interface FunctionSpec<
|
|
12
|
+
interface FunctionSpec<RuntimeAndFunctionType_ extends RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext> {
|
|
12
13
|
readonly [TypeId]: TypeId;
|
|
13
|
-
readonly
|
|
14
|
+
readonly runtimeAndFunctionType: RuntimeAndFunctionType_;
|
|
14
15
|
readonly functionVisibility: FunctionVisibility_;
|
|
15
16
|
readonly name: Name_;
|
|
16
17
|
readonly args: Args_;
|
|
@@ -19,9 +20,10 @@ interface FunctionSpec<FunctionType_ extends FunctionType, FunctionVisibility_ e
|
|
|
19
20
|
interface Any {
|
|
20
21
|
readonly [TypeId]: TypeId;
|
|
21
22
|
}
|
|
22
|
-
interface AnyWithProps extends FunctionSpec<
|
|
23
|
-
interface
|
|
24
|
-
|
|
23
|
+
interface AnyWithProps extends FunctionSpec<RuntimeAndFunctionType, FunctionVisibility, string, Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
24
|
+
interface AnyWithPropsWithRuntime<Runtime$1 extends Runtime> extends FunctionSpec<WithRuntime<Runtime$1>, FunctionVisibility, string, Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
25
|
+
interface AnyWithPropsWithFunctionType<RuntimeAndFunctionType_ extends RuntimeAndFunctionType> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility, string, Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
26
|
+
type GetRuntimeAndFunctionType<Function extends AnyWithProps> = Function["runtimeAndFunctionType"];
|
|
25
27
|
type GetFunctionVisibility<Function extends AnyWithProps> = Function["functionVisibility"];
|
|
26
28
|
type Name<Function extends AnyWithProps> = Function["name"];
|
|
27
29
|
type Args<Function extends AnyWithProps> = Function["args"];
|
|
@@ -29,13 +31,30 @@ type Returns<Function extends AnyWithProps> = Function["returns"];
|
|
|
29
31
|
type WithName<Function extends AnyWithProps, Name_ extends string> = Extract<Function, {
|
|
30
32
|
readonly name: Name_;
|
|
31
33
|
}>;
|
|
34
|
+
type WithRuntimeAndFunctionType<Function extends AnyWithProps, RuntimeAndFunctionType_ extends RuntimeAndFunctionType> = Extract<Function, {
|
|
35
|
+
readonly runtimeAndFunctionType: RuntimeAndFunctionType_;
|
|
36
|
+
}>;
|
|
32
37
|
type WithFunctionType<Function extends AnyWithProps, FunctionType_ extends FunctionType> = Extract<Function, {
|
|
33
|
-
readonly
|
|
38
|
+
readonly runtimeAndFunctionType: {
|
|
39
|
+
readonly functionType: FunctionType_;
|
|
40
|
+
};
|
|
34
41
|
}>;
|
|
35
|
-
type
|
|
42
|
+
type WithoutName<Function extends AnyWithProps, Name_ extends Name<Function>> = Exclude<Function, {
|
|
36
43
|
readonly name: Name_;
|
|
37
44
|
}>;
|
|
38
|
-
type RegisteredFunction<Function extends AnyWithProps> = Function["
|
|
45
|
+
type RegisteredFunction<Function extends AnyWithProps> = GetFunctionType<Function["runtimeAndFunctionType"]> extends "Convex" ? RegisteredQuery<GetFunctionVisibility<Function>, Args<Function>["Encoded"], Promise<Returns<Function>["Encoded"]>> : GetFunctionType<Function["runtimeAndFunctionType"]> extends "mutation" ? RegisteredMutation<GetFunctionVisibility<Function>, Args<Function>["Encoded"], Promise<Returns<Function>["Encoded"]>> : GetFunctionType<Function["runtimeAndFunctionType"]> extends "action" ? RegisteredAction<GetFunctionVisibility<Function>, Args<Function>["Encoded"], Promise<Returns<Function>["Encoded"]>> : never;
|
|
46
|
+
declare const publicQuery: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
47
|
+
name,
|
|
48
|
+
args,
|
|
49
|
+
returns
|
|
50
|
+
}: {
|
|
51
|
+
name: Name_;
|
|
52
|
+
args: Args_;
|
|
53
|
+
returns: Returns_;
|
|
54
|
+
}) => FunctionSpec<{
|
|
55
|
+
readonly runtime: "Convex";
|
|
56
|
+
readonly functionType: "query";
|
|
57
|
+
}, "public", Name_, Args_, Returns_>;
|
|
39
58
|
declare const internalQuery: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
40
59
|
name,
|
|
41
60
|
args,
|
|
@@ -44,8 +63,11 @@ declare const internalQuery: <const Name_ extends string, Args_ extends Schema.S
|
|
|
44
63
|
name: Name_;
|
|
45
64
|
args: Args_;
|
|
46
65
|
returns: Returns_;
|
|
47
|
-
}) => FunctionSpec<
|
|
48
|
-
|
|
66
|
+
}) => FunctionSpec<{
|
|
67
|
+
readonly runtime: "Convex";
|
|
68
|
+
readonly functionType: "query";
|
|
69
|
+
}, "internal", Name_, Args_, Returns_>;
|
|
70
|
+
declare const publicMutation: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
49
71
|
name,
|
|
50
72
|
args,
|
|
51
73
|
returns
|
|
@@ -53,7 +75,10 @@ declare const publicQuery: <const Name_ extends string, Args_ extends Schema.Sch
|
|
|
53
75
|
name: Name_;
|
|
54
76
|
args: Args_;
|
|
55
77
|
returns: Returns_;
|
|
56
|
-
}) => FunctionSpec<
|
|
78
|
+
}) => FunctionSpec<{
|
|
79
|
+
readonly runtime: "Convex";
|
|
80
|
+
readonly functionType: "mutation";
|
|
81
|
+
}, "public", Name_, Args_, Returns_>;
|
|
57
82
|
declare const internalMutation: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
58
83
|
name,
|
|
59
84
|
args,
|
|
@@ -62,8 +87,11 @@ declare const internalMutation: <const Name_ extends string, Args_ extends Schem
|
|
|
62
87
|
name: Name_;
|
|
63
88
|
args: Args_;
|
|
64
89
|
returns: Returns_;
|
|
65
|
-
}) => FunctionSpec<
|
|
66
|
-
|
|
90
|
+
}) => FunctionSpec<{
|
|
91
|
+
readonly runtime: "Convex";
|
|
92
|
+
readonly functionType: "mutation";
|
|
93
|
+
}, "internal", Name_, Args_, Returns_>;
|
|
94
|
+
declare const publicAction: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
67
95
|
name,
|
|
68
96
|
args,
|
|
69
97
|
returns
|
|
@@ -71,7 +99,10 @@ declare const publicMutation: <const Name_ extends string, Args_ extends Schema.
|
|
|
71
99
|
name: Name_;
|
|
72
100
|
args: Args_;
|
|
73
101
|
returns: Returns_;
|
|
74
|
-
}) => FunctionSpec<
|
|
102
|
+
}) => FunctionSpec<{
|
|
103
|
+
readonly runtime: "Convex";
|
|
104
|
+
readonly functionType: "action";
|
|
105
|
+
}, "public", Name_, Args_, Returns_>;
|
|
75
106
|
declare const internalAction: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
76
107
|
name,
|
|
77
108
|
args,
|
|
@@ -80,8 +111,23 @@ declare const internalAction: <const Name_ extends string, Args_ extends Schema.
|
|
|
80
111
|
name: Name_;
|
|
81
112
|
args: Args_;
|
|
82
113
|
returns: Returns_;
|
|
83
|
-
}) => FunctionSpec<
|
|
84
|
-
|
|
114
|
+
}) => FunctionSpec<{
|
|
115
|
+
readonly runtime: "Convex";
|
|
116
|
+
readonly functionType: "action";
|
|
117
|
+
}, "internal", Name_, Args_, Returns_>;
|
|
118
|
+
declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
119
|
+
name,
|
|
120
|
+
args,
|
|
121
|
+
returns
|
|
122
|
+
}: {
|
|
123
|
+
name: Name_;
|
|
124
|
+
args: Args_;
|
|
125
|
+
returns: Returns_;
|
|
126
|
+
}) => FunctionSpec<{
|
|
127
|
+
readonly runtime: "Node";
|
|
128
|
+
readonly functionType: "action";
|
|
129
|
+
}, "public", Name_, Args_, Returns_>;
|
|
130
|
+
declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>({
|
|
85
131
|
name,
|
|
86
132
|
args,
|
|
87
133
|
returns
|
|
@@ -89,7 +135,10 @@ declare const publicAction: <const Name_ extends string, Args_ extends Schema.Sc
|
|
|
89
135
|
name: Name_;
|
|
90
136
|
args: Args_;
|
|
91
137
|
returns: Returns_;
|
|
92
|
-
}) => FunctionSpec<
|
|
138
|
+
}) => FunctionSpec<{
|
|
139
|
+
readonly runtime: "Node";
|
|
140
|
+
readonly functionType: "action";
|
|
141
|
+
}, "internal", Name_, Args_, Returns_>;
|
|
93
142
|
//#endregion
|
|
94
|
-
export { Any, AnyWithProps, AnyWithPropsWithFunctionType,
|
|
143
|
+
export { Any, AnyWithProps, AnyWithPropsWithFunctionType, AnyWithPropsWithRuntime, Args, FunctionSpec, FunctionSpec_d_exports, GetFunctionVisibility, GetRuntimeAndFunctionType, Name, RegisteredFunction, Returns, TypeId, WithFunctionType, WithName, WithRuntimeAndFunctionType, WithoutName, internalAction, internalMutation, internalNodeAction, internalQuery, isFunctionSpec, publicAction, publicMutation, publicNodeAction, publicQuery };
|
|
95
144
|
//# sourceMappingURL=FunctionSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.d.ts","names":[],"sources":["../src/FunctionSpec.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunctionSpec.d.ts","names":[],"sources":["../src/FunctionSpec.ts"],"mappings":";;;;;;;;cAYa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,cAAA,GAAkB,CAAA,cAAa,CAAA,IAAK,YAAA;AAAA,UAGhC,YAAA,iCACiB,sBAAA,8BACJ,kBAAA,sCAEd,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAA,UAErB,MAAA,GAAS,MAAA;EAAA,SACV,sBAAA,EAAwB,uBAAA;EAAA,SACxB,kBAAA,EAAoB,mBAAA;EAAA,SACpB,IAAA,EAAM,KAAA;EAAA,SACN,IAAA,EAAM,KAAA;EAAA,SACN,OAAA,EAAS,QAAA;AAAA;AAAA,UAGH,GAAA;EAAA,UACL,MAAA,GAAS,MAAA;AAAA;AAAA,UAGJ,YAAA,SAAqB,YAAA,CACpC,sBAAA,EACA,kBAAA,UAEA,MAAA,CAAO,MAAA,CAAO,YAAA,EACd,MAAA,CAAO,MAAA,CAAO,YAAA;AAAA,UAGC,uBAAA,mBACC,OAAA,UACR,YAAA,CACR,WAAA,CAAmC,SAAA,GACnC,kBAAA,UAEA,MAAA,CAAO,MAAA,CAAO,YAAA,EACd,MAAA,CAAO,MAAA,CAAO,YAAA;AAAA,UAGC,4BAAA,iCACiB,sBAAA,UACxB,YAAA,CACR,uBAAA,EACA,kBAAA,UAEA,MAAA,CAAO,MAAA,CAAO,YAAA,EACd,MAAA,CAAO,MAAA,CAAO,YAAA;AAAA,KAGJ,yBAAA,kBAA2C,YAAA,IACrD,QAAA;AAAA,KAEU,qBAAA,kBAAuC,YAAA,IACjD,QAAA;AAAA,KAEU,IAAA,kBAAsB,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AAA;;;;;;;;cAgClC,cAAA,6CAjCK,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAY,IAAA;EAAA,IAAA;EAAA;AAAA;;;;;;;;cAoClC,gBAAA,6CArCK,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAY,IAAA;EAAA,IAAA;EAAA;AAAA;;;;;;;;cAwClC,YAAA,6CAzCK,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAY,IAAA;EAAA,IAAA;EAAA;AAAA;;;;;;;;cAyClC,cAAA,6CA1CK,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAY,IAAA;EAAA,IAAA;EAAA;AAAA;;;;;;;;cA8ClC,gBAAA,6CA/CK,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAY,IAAA;EAAA,IAAA;EAAA;AAAA;;;;;;;;cAkDlC,kBAAA,6CAnDK,MAAA,CAAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA;EAAY,IAAA;EAAA,IAAA;EAAA;AAAA"}
|
package/dist/FunctionSpec.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { validateConfectFunctionIdentifier } from "./internal/utils.js";
|
|
3
|
+
import { ConvexAction, ConvexMutation, ConvexQuery, NodeAction } from "./RuntimeAndFunctionType.js";
|
|
3
4
|
import { Predicate } from "effect";
|
|
4
5
|
|
|
5
6
|
//#region src/FunctionSpec.ts
|
|
@@ -7,32 +8,36 @@ var FunctionSpec_exports = /* @__PURE__ */ __exportAll({
|
|
|
7
8
|
TypeId: () => TypeId,
|
|
8
9
|
internalAction: () => internalAction,
|
|
9
10
|
internalMutation: () => internalMutation,
|
|
11
|
+
internalNodeAction: () => internalNodeAction,
|
|
10
12
|
internalQuery: () => internalQuery,
|
|
11
13
|
isFunctionSpec: () => isFunctionSpec,
|
|
12
14
|
publicAction: () => publicAction,
|
|
13
15
|
publicMutation: () => publicMutation,
|
|
16
|
+
publicNodeAction: () => publicNodeAction,
|
|
14
17
|
publicQuery: () => publicQuery
|
|
15
18
|
});
|
|
16
|
-
const TypeId = "@confect/core/
|
|
19
|
+
const TypeId = "@confect/core/FunctionSpec";
|
|
17
20
|
const isFunctionSpec = (u) => Predicate.hasProperty(u, TypeId);
|
|
18
21
|
const Proto = { [TypeId]: TypeId };
|
|
19
|
-
const make = (
|
|
22
|
+
const make = (runtimeAndFunctionType, functionVisibility) => ({ name, args, returns }) => {
|
|
20
23
|
validateConfectFunctionIdentifier(name);
|
|
21
24
|
return Object.assign(Object.create(Proto), {
|
|
22
|
-
|
|
25
|
+
runtimeAndFunctionType,
|
|
23
26
|
functionVisibility,
|
|
24
27
|
name,
|
|
25
28
|
args,
|
|
26
29
|
returns
|
|
27
30
|
});
|
|
28
31
|
};
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const publicQuery = make(ConvexQuery, "public");
|
|
33
|
+
const internalQuery = make(ConvexQuery, "internal");
|
|
34
|
+
const publicMutation = make(ConvexMutation, "public");
|
|
35
|
+
const internalMutation = make(ConvexMutation, "internal");
|
|
36
|
+
const publicAction = make(ConvexAction, "public");
|
|
37
|
+
const internalAction = make(ConvexAction, "internal");
|
|
38
|
+
const publicNodeAction = make(NodeAction, "public");
|
|
39
|
+
const internalNodeAction = make(NodeAction, "internal");
|
|
35
40
|
|
|
36
41
|
//#endregion
|
|
37
|
-
export { FunctionSpec_exports, TypeId, internalAction, internalMutation, internalQuery, isFunctionSpec, publicAction, publicMutation, publicQuery };
|
|
42
|
+
export { FunctionSpec_exports, TypeId, internalAction, internalMutation, internalNodeAction, internalQuery, isFunctionSpec, publicAction, publicMutation, publicNodeAction, publicQuery };
|
|
38
43
|
//# sourceMappingURL=FunctionSpec.js.map
|
package/dist/FunctionSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.js","names":[],"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 { validateConfectFunctionIdentifier } from \"./internal/utils\";\n\nexport const TypeId = \"@confect/core/
|
|
1
|
+
{"version":3,"file":"FunctionSpec.js","names":["RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction"],"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 { validateConfectFunctionIdentifier } from \"./internal/utils\";\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 Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly args: Args_;\n readonly returns: Returns_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport type GetRuntimeAndFunctionType<Function extends AnyWithProps> =\n Function[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<Function extends AnyWithProps> =\n Function[\"functionVisibility\"];\n\nexport type Name<Function extends AnyWithProps> = Function[\"name\"];\n\nexport type Args<Function extends AnyWithProps> = Function[\"args\"];\n\nexport type Returns<Function extends AnyWithProps> = Function[\"returns\"];\n\nexport type WithName<\n Function extends AnyWithProps,\n Name_ extends string,\n> = Extract<Function, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n Function extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n Function,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n Function extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n Function,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithoutName<\n Function extends AnyWithProps,\n Name_ extends Name<Function>,\n> = Exclude<Function, { readonly name: Name_ }>;\n\nexport type RegisteredFunction<Function extends AnyWithProps> =\n RuntimeAndFunctionType.GetFunctionType<\n Function[\"runtimeAndFunctionType\"]\n > extends \"Convex\"\n ? RegisteredQuery<\n GetFunctionVisibility<Function>,\n Args<Function>[\"Encoded\"],\n Promise<Returns<Function>[\"Encoded\"]>\n >\n : RuntimeAndFunctionType.GetFunctionType<\n Function[\"runtimeAndFunctionType\"]\n > extends \"mutation\"\n ? RegisteredMutation<\n GetFunctionVisibility<Function>,\n Args<Function>[\"Encoded\"],\n Promise<Returns<Function>[\"Encoded\"]>\n >\n : RuntimeAndFunctionType.GetFunctionType<\n Function[\"runtimeAndFunctionType\"]\n > extends \"action\"\n ? RegisteredAction<\n GetFunctionVisibility<Function>,\n Args<Function>[\"Encoded\"],\n Promise<Returns<Function>[\"Encoded\"]>\n >\n : never;\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 >({\n name,\n args,\n returns,\n }: {\n name: Name_;\n args: Args_;\n returns: Returns_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n Args_,\n Returns_\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n args,\n returns,\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"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,OAAO;AAkHlC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,QAMF,wBACA,wBAMA,EACA,MACA,MACA,cAWG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA;EACA;EACD,CAAC;;AAGN,MAAa,cAAc,KAAKA,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"}
|
package/dist/GroupSpec.d.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Runtime } from "./RuntimeAndFunctionType.js";
|
|
2
|
+
import { AnyWithProps as AnyWithProps$1, AnyWithPropsWithRuntime as AnyWithPropsWithRuntime$1, Name as Name$1, WithName as WithName$1 } from "./FunctionSpec.js";
|
|
2
3
|
|
|
3
4
|
//#region src/GroupSpec.d.ts
|
|
4
5
|
declare namespace GroupSpec_d_exports {
|
|
5
|
-
export { Any, AnyWithProps, Functions, GroupNames, GroupSpec, Groups, Name, TypeId, WithName, isGroupSpec, make };
|
|
6
|
+
export { Any, AnyWithProps, AnyWithPropsWithRuntime, Functions, GroupNames, GroupSpec, Groups, Name, TypeId, WithName, isGroupSpec, make, makeNode };
|
|
6
7
|
}
|
|
7
|
-
declare const TypeId = "@confect/core/
|
|
8
|
+
declare const TypeId = "@confect/core/GroupSpec";
|
|
8
9
|
type TypeId = typeof TypeId;
|
|
9
10
|
declare const isGroupSpec: (u: unknown) => u is Any;
|
|
10
|
-
interface GroupSpec<Name_ extends string, Functions_ extends
|
|
11
|
+
interface GroupSpec<Runtime$2 extends Runtime, Name_ extends string, Functions_ extends AnyWithPropsWithRuntime$1<Runtime$2> = never, Groups_ extends AnyWithPropsWithRuntime<Runtime$2> = never> {
|
|
11
12
|
readonly [TypeId]: TypeId;
|
|
13
|
+
readonly runtime: Runtime$2;
|
|
12
14
|
readonly name: Name_;
|
|
13
|
-
readonly functions: { [FunctionName in Name$1<
|
|
15
|
+
readonly functions: { [FunctionName in Name$1<AnyWithPropsWithRuntime$1<Runtime$2>>]: WithName$1<Functions_, FunctionName> };
|
|
14
16
|
readonly groups: { [GroupName in Name<Groups_>]: WithName<Groups_, GroupName> };
|
|
15
|
-
addFunction<Function extends
|
|
16
|
-
addGroup<Group extends
|
|
17
|
+
addFunction<Function extends AnyWithPropsWithRuntime$1<Runtime$2>>(function_: Function): GroupSpec<Runtime$2, Name_, Functions_ | Function, Groups_>;
|
|
18
|
+
addGroup<Group extends AnyWithPropsWithRuntime<Runtime$2>>(group: Group): GroupSpec<Runtime$2, Name_, Functions_, Groups_ | Group>;
|
|
17
19
|
}
|
|
18
20
|
interface Any {
|
|
19
21
|
readonly [TypeId]: TypeId;
|
|
20
22
|
}
|
|
21
|
-
interface AnyWithProps extends GroupSpec<string, AnyWithProps$1, AnyWithProps> {}
|
|
23
|
+
interface AnyWithProps extends GroupSpec<Runtime, string, AnyWithProps$1, AnyWithProps> {}
|
|
24
|
+
interface AnyWithPropsWithRuntime<Runtime$1 extends Runtime> extends GroupSpec<Runtime$1, string, AnyWithPropsWithRuntime$1<Runtime$1>, AnyWithPropsWithRuntime<Runtime$1>> {}
|
|
22
25
|
type Name<Group extends AnyWithProps> = Group["name"];
|
|
23
26
|
type Functions<Group extends AnyWithProps> = Group["functions"][keyof Group["functions"]];
|
|
24
27
|
type Groups<Group extends AnyWithProps> = Group["groups"][keyof Group["groups"]];
|
|
@@ -26,7 +29,8 @@ type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [never] ?
|
|
|
26
29
|
type WithName<Group extends AnyWithProps, Name_ extends Name<Group>> = Extract<Group, {
|
|
27
30
|
readonly name: Name_;
|
|
28
31
|
}>;
|
|
29
|
-
declare const make: <const Name_ extends string>(name: Name_) => GroupSpec<Name_>;
|
|
32
|
+
declare const make: <const Name_ extends string>(name: Name_) => GroupSpec<"Convex", Name_>;
|
|
33
|
+
declare const makeNode: <const Name_ extends string>(name: Name_) => GroupSpec<"Node", Name_>;
|
|
30
34
|
//#endregion
|
|
31
|
-
export { Any, AnyWithProps, Functions, GroupNames, GroupSpec, GroupSpec_d_exports, Groups, Name, TypeId, WithName, isGroupSpec, make };
|
|
35
|
+
export { Any, AnyWithProps, AnyWithPropsWithRuntime, Functions, GroupNames, GroupSpec, GroupSpec_d_exports, Groups, Name, TypeId, WithName, isGroupSpec, make, makeNode };
|
|
32
36
|
//# sourceMappingURL=GroupSpec.d.ts.map
|
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":";;;;;;;cAKa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,WAAA,GAAe,CAAA,cAAa,CAAA,IAAK,GAAA;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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6,15 +6,17 @@ import { Predicate, Record } from "effect";
|
|
|
6
6
|
var GroupSpec_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
TypeId: () => TypeId,
|
|
8
8
|
isGroupSpec: () => isGroupSpec,
|
|
9
|
-
make: () => make
|
|
9
|
+
make: () => make,
|
|
10
|
+
makeNode: () => makeNode
|
|
10
11
|
});
|
|
11
|
-
const TypeId = "@confect/core/
|
|
12
|
+
const TypeId = "@confect/core/GroupSpec";
|
|
12
13
|
const isGroupSpec = (u) => Predicate.hasProperty(u, TypeId);
|
|
13
14
|
const Proto = {
|
|
14
15
|
[TypeId]: TypeId,
|
|
15
16
|
addFunction(function_) {
|
|
16
17
|
const this_ = this;
|
|
17
18
|
return makeProto({
|
|
19
|
+
runtime: this_.runtime,
|
|
18
20
|
name: this_.name,
|
|
19
21
|
functions: Record.set(this_.functions, function_.name, function_),
|
|
20
22
|
groups: this_.groups
|
|
@@ -24,13 +26,15 @@ const Proto = {
|
|
|
24
26
|
const this_ = this;
|
|
25
27
|
const group_ = group;
|
|
26
28
|
return makeProto({
|
|
29
|
+
runtime: this_.runtime,
|
|
27
30
|
name: this_.name,
|
|
28
31
|
functions: this_.functions,
|
|
29
32
|
groups: Record.set(this_.groups, group_.name, group_)
|
|
30
33
|
});
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
|
-
const makeProto = ({ name, functions, groups }) => Object.assign(Object.create(Proto), {
|
|
36
|
+
const makeProto = ({ runtime, name, functions, groups }) => Object.assign(Object.create(Proto), {
|
|
37
|
+
runtime,
|
|
34
38
|
name,
|
|
35
39
|
functions,
|
|
36
40
|
groups
|
|
@@ -38,6 +42,16 @@ const makeProto = ({ name, functions, groups }) => Object.assign(Object.create(P
|
|
|
38
42
|
const make = (name) => {
|
|
39
43
|
validateConfectFunctionIdentifier(name);
|
|
40
44
|
return makeProto({
|
|
45
|
+
runtime: "Convex",
|
|
46
|
+
name,
|
|
47
|
+
functions: Record.empty(),
|
|
48
|
+
groups: Record.empty()
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const makeNode = (name) => {
|
|
52
|
+
validateConfectFunctionIdentifier(name);
|
|
53
|
+
return makeProto({
|
|
54
|
+
runtime: "Node",
|
|
41
55
|
name,
|
|
42
56
|
functions: Record.empty(),
|
|
43
57
|
groups: Record.empty()
|
|
@@ -45,5 +59,5 @@ const make = (name) => {
|
|
|
45
59
|
};
|
|
46
60
|
|
|
47
61
|
//#endregion
|
|
48
|
-
export { GroupSpec_exports, TypeId, isGroupSpec, make };
|
|
62
|
+
export { GroupSpec_exports, TypeId, isGroupSpec, make, makeNode };
|
|
49
63
|
//# sourceMappingURL=GroupSpec.js.map
|
package/dist/GroupSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import { Predicate, Record } from \"effect\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport { validateConfectFunctionIdentifier } from \"./internal/utils\";\n\nexport const TypeId = \"@confect/core/
|
|
1
|
+
{"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import { Predicate, Record } from \"effect\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\nimport { validateConfectFunctionIdentifier } from \"./internal/utils\";\n\nexport const TypeId = \"@confect/core/GroupSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isGroupSpec = (u: unknown): u is Any =>\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\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\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\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 = <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 = <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"],"mappings":";;;;;;;;;;;AAKA,MAAa,SAAS;AAGtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,OAAO;AAoElC,MAAM,QAAQ;EACX,SAAS;CAEV,YAEE,WACA;EACA,MAAM,QAAQ;AAEd,SAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,OAAO,IAAI,MAAM,WAAW,UAAU,MAAM,UAAU;GACjE,QAAQ,MAAM;GACf,CAAC;;CAGJ,SAAuC,OAAc;EACnD,MAAM,QAAQ;EACd,MAAM,SAAS;AAEf,SAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,MAAM;GACjB,QAAQ,OAAO,IAAI,MAAM,QAAQ,OAAO,MAAM,OAAO;GACtD,CAAC;;CAEL;AAED,MAAM,aAKJ,EACA,SACA,MACA,WACA,aAOA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACA;CACA;CACD,CAAC;AAEJ,MAAa,QACX,SAC+B;AAC/B,mCAAkC,KAAK;AAEvC,QAAO,UAAU;EACf,SAAS;EACT;EACA,WAAW,OAAO,OAAO;EACzB,QAAQ,OAAO,OAAO;EACvB,CAAC;;AAGJ,MAAa,YACX,SAC6B;AAC7B,mCAAkC,KAAK;AAEvC,QAAO,UAAU;EACf,SAAS;EACT;EACA,WAAW,OAAO,OAAO;EACzB,QAAQ,OAAO,OAAO;EACvB,CAAC"}
|
package/dist/Ref.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
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
|
+
import { AnyWithProps, Args as Args$1, FunctionSpec, GetFunctionVisibility as GetFunctionVisibility$1, GetRuntimeAndFunctionType as GetRuntimeAndFunctionType$1, Returns as Returns$1 } from "./FunctionSpec.js";
|
|
2
3
|
import { Schema } from "effect";
|
|
3
|
-
import {
|
|
4
|
+
import { FunctionVisibility } from "convex/server";
|
|
4
5
|
|
|
5
6
|
//#region src/Ref.d.ts
|
|
6
7
|
declare namespace Ref_d_exports {
|
|
7
|
-
export { Any, AnyAction, AnyInternal, AnyMutation, AnyPublic, AnyPublicAction, AnyPublicMutation, AnyPublicQuery, AnyQuery, Args, FromFunctionSpec, GetFunctionType, GetFunctionVisibility, Ref, Returns, getConvexFunctionName, getFunction, make };
|
|
8
|
+
export { Any, AnyAction, AnyInternal, AnyMutation, AnyPublic, AnyPublicAction, AnyPublicMutation, AnyPublicQuery, AnyQuery, Args, FromFunctionSpec, GetFunctionType, GetFunctionVisibility, GetRuntime, GetRuntimeAndFunctionType, Ref, Returns, getConvexFunctionName, getFunction, make };
|
|
8
9
|
}
|
|
9
|
-
interface Ref<
|
|
10
|
-
readonly
|
|
10
|
+
interface Ref<_RuntimeAndFunctionType extends RuntimeAndFunctionType, _FunctionVisibility extends FunctionVisibility, _Args extends Schema.Schema.AnyNoContext, _Returns extends Schema.Schema.AnyNoContext> {
|
|
11
|
+
readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;
|
|
11
12
|
readonly _FunctionVisibility?: _FunctionVisibility;
|
|
12
13
|
readonly _Args?: _Args;
|
|
13
14
|
readonly _Returns?: _Returns;
|
|
@@ -15,27 +16,29 @@ interface Ref<_FunctionType extends FunctionType, _FunctionVisibility extends Fu
|
|
|
15
16
|
interface Any extends Ref<any, any, any, any> {}
|
|
16
17
|
interface AnyInternal extends Ref<any, "internal", any, any> {}
|
|
17
18
|
interface AnyPublic extends Ref<any, "public", any, any> {}
|
|
18
|
-
interface AnyQuery extends Ref<
|
|
19
|
-
interface AnyMutation extends Ref<
|
|
20
|
-
interface AnyAction extends Ref<
|
|
21
|
-
interface AnyPublicQuery extends Ref<
|
|
22
|
-
interface AnyPublicMutation extends Ref<
|
|
23
|
-
interface AnyPublicAction extends Ref<
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
type
|
|
29
|
-
|
|
19
|
+
interface AnyQuery extends Ref<AnyQuery$1, FunctionVisibility, Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
20
|
+
interface AnyMutation extends Ref<AnyMutation$1, FunctionVisibility, Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
21
|
+
interface AnyAction extends Ref<AnyAction$1, FunctionVisibility, Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
22
|
+
interface AnyPublicQuery extends Ref<AnyQuery$1, "public", Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
23
|
+
interface AnyPublicMutation extends Ref<AnyMutation$1, "public", Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
24
|
+
interface AnyPublicAction extends Ref<AnyAction$1, "public", Schema.Schema.AnyNoContext, Schema.Schema.AnyNoContext> {}
|
|
25
|
+
type GetRuntimeAndFunctionType<Ref_> = Ref_ extends Ref<infer RuntimeAndFunctionType_, infer _FunctionVisibility, infer _Args, infer _Returns> ? RuntimeAndFunctionType_ : never;
|
|
26
|
+
type GetRuntime<Ref_> = Ref_ extends Ref<infer RuntimeAndFunctionType_, infer _FunctionVisibility, infer _Args, infer _Returns> ? GetRuntime$1<RuntimeAndFunctionType_> : never;
|
|
27
|
+
type GetFunctionType<Ref_> = Ref_ extends Ref<infer RuntimeAndFunctionType_, infer _FunctionVisibility, infer _Args, infer _Returns> ? GetFunctionType$1<RuntimeAndFunctionType_> : never;
|
|
28
|
+
type GetFunctionVisibility<Ref_> = Ref_ extends Ref<infer _RuntimeAndFunctionType, infer FunctionVisibility_, infer _Args, infer _Returns> ? FunctionVisibility_ : never;
|
|
29
|
+
type Args<Ref_> = Ref_ extends Ref<infer _RuntimeAndFunctionType, infer _FunctionVisibility, infer Args_, infer _Returns> ? Args_ : never;
|
|
30
|
+
type Returns<Ref_> = Ref_ extends Ref<infer _RuntimeAndFunctionType, infer _FunctionVisibility, infer _Args, infer Returns_> ? Returns_ : never;
|
|
31
|
+
type FromFunctionSpec<F extends AnyWithProps> = Ref<GetRuntimeAndFunctionType$1<F>, GetFunctionVisibility$1<F>, Args$1<F>, Returns$1<F>>;
|
|
32
|
+
declare const make: <RuntimeAndFunctionType_ extends RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>(
|
|
30
33
|
/**
|
|
31
34
|
* This is a Convex "function name" of the format "myGroupDir/myGroupMod:myFunc".
|
|
32
35
|
*/
|
|
33
36
|
|
|
34
|
-
convexFunctionName: string, function_: FunctionSpec<
|
|
35
|
-
type HiddenFunction<Ref_ extends Any> = FunctionSpec<
|
|
36
|
-
declare const getFunction: <
|
|
37
|
+
convexFunctionName: string, function_: FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility_, string, Args_, Returns_>) => Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_>;
|
|
38
|
+
type HiddenFunction<Ref_ extends Any> = FunctionSpec<GetRuntimeAndFunctionType<Ref_>, GetFunctionVisibility<Ref_>, string, Args<Ref_>, Returns<Ref_>>;
|
|
39
|
+
declare const getFunction: <RuntimeAndFunctionType_ extends RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext, Ref_ extends Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_>>(ref: Ref_) => HiddenFunction<Ref_>;
|
|
37
40
|
type HiddenConvexFunctionName = string;
|
|
38
|
-
declare const getConvexFunctionName: <
|
|
41
|
+
declare const getConvexFunctionName: <RuntimeAndFunctionType_ extends RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Args_ extends Schema.Schema.AnyNoContext, Returns_ extends Schema.Schema.AnyNoContext>(ref: Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_>) => HiddenConvexFunctionName;
|
|
39
42
|
//#endregion
|
|
40
|
-
export { Any, AnyAction, AnyInternal, AnyMutation, AnyPublic, AnyPublicAction, AnyPublicMutation, AnyPublicQuery, AnyQuery, Args, FromFunctionSpec, GetFunctionType, GetFunctionVisibility, Ref, Ref_d_exports, Returns, getConvexFunctionName, getFunction, make };
|
|
43
|
+
export { Any, AnyAction, AnyInternal, AnyMutation, AnyPublic, AnyPublicAction, AnyPublicMutation, AnyPublicQuery, AnyQuery, Args, FromFunctionSpec, GetFunctionType, GetFunctionVisibility, GetRuntime, GetRuntimeAndFunctionType, Ref, Ref_d_exports, Returns, getConvexFunctionName, getFunction, make };
|
|
41
44
|
//# sourceMappingURL=Ref.d.ts.map
|
package/dist/Ref.d.ts.map
CHANGED
|
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AAO,MAAA,CAAO,YAAA,mBACX,MAAA,CAAO,MAAA,CAAO,YAAA,EAE/B,GAAA,EAAK,GAAA,CAAI,uBAAA,EAAyB,mBAAA,EAAqB,KAAA,EAAO,QAAA,MAC7D,wBAAA"}
|
package/dist/Ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type { FunctionVisibility } from \"convex/server\";\nimport type { 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 extends Schema.Schema.AnyNoContext,\n _Returns extends Schema.Schema.AnyNoContext,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n}\n\nexport interface Any extends Ref<any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns\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 >\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 >\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 >\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 >\n ? Args_\n : never;\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_\n >\n ? Returns_\n : never;\n\nexport type FromFunctionSpec<F extends FunctionSpec.AnyWithProps> = Ref<\n FunctionSpec.GetRuntimeAndFunctionType<F>,\n FunctionSpec.GetFunctionVisibility<F>,\n FunctionSpec.Args<F>,\n FunctionSpec.Returns<F>\n>;\n\nexport const make = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n>(\n /**\n * This is a Convex \"function name\" of the format \"myGroupDir/myGroupMod:myFunc\".\n */\n convexFunctionName: string,\n function_: FunctionSpec.FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n string,\n Args_,\n Returns_\n >,\n): Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_> =>\n ({\n [HiddenFunctionKey]: function_,\n [HiddenConvexFunctionNameKey]: convexFunctionName,\n }) as Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_>;\n\nconst HiddenFunctionKey = \"@confect/core/api/HiddenFunctionKey\";\ntype HiddenFunctionKey = typeof HiddenFunctionKey;\ntype HiddenFunction<Ref_ extends Any> = FunctionSpec.FunctionSpec<\n GetRuntimeAndFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>,\n string,\n Args<Ref_>,\n Returns<Ref_>\n>;\n\nexport const getFunction = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n Ref_ extends Ref<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Args_,\n Returns_\n >,\n>(\n ref: Ref_,\n): HiddenFunction<Ref_> => (ref as any)[HiddenFunctionKey];\n\nconst HiddenConvexFunctionNameKey =\n \"@confect/core/api/HiddenConvexFunctionNameKey\";\ntype HiddenConvexFunctionNameKey = typeof HiddenConvexFunctionNameKey;\ntype HiddenConvexFunctionName = string;\n\nexport const getConvexFunctionName = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n>(\n ref: Ref<RuntimeAndFunctionType_, FunctionVisibility_, Args_, Returns_>,\n): HiddenConvexFunctionName => (ref as any)[HiddenConvexFunctionNameKey];\n"],"mappings":";;;;;;;;AAoIA,MAAa,QASX,oBACA,eAQC;EACE,oBAAoB;EACpB,8BAA8B;CAChC;AAEH,MAAM,oBAAoB;AAU1B,MAAa,eAYX,QAC0B,IAAY;AAExC,MAAM,8BACJ;AAIF,MAAa,yBAMX,QAC8B,IAAY"}
|
package/dist/Refs.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { AnyWithProps, Name as Name$1, WithName } from "./FunctionSpec.js";
|
|
2
|
-
import { AnyWithProps as AnyWithProps$1, Functions, Groups, Name as Name$2, WithName as WithName$1 } from "./GroupSpec.js";
|
|
2
|
+
import { AnyWithProps as AnyWithProps$1, Functions, GroupSpec, Groups, Name as Name$2, WithName as WithName$1 } from "./GroupSpec.js";
|
|
3
3
|
import { Any, AnyInternal, AnyPublic, FromFunctionSpec } from "./Ref.js";
|
|
4
|
-
import {
|
|
4
|
+
import { AnyWithPropsWithRuntime, Groups as Groups$1 } from "./Spec.js";
|
|
5
5
|
import { Types } from "effect";
|
|
6
6
|
|
|
7
7
|
//#region src/Refs.d.ts
|
|
8
8
|
declare namespace Refs_d_exports {
|
|
9
9
|
export { Refs, make };
|
|
10
10
|
}
|
|
11
|
-
type Refs<
|
|
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
14
|
type FilteredFunctions<Functions extends AnyWithProps, Predicate extends Any> = { [Name in Name$1<Functions> as WithName<Functions, Name> extends infer F extends AnyWithProps ? FromFunctionSpec<F> extends Predicate ? Name : never : never]: WithName<Functions, Name> extends infer F extends AnyWithProps ? FromFunctionSpec<F> : never };
|
|
15
15
|
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 };
|
|
16
|
-
declare const make: <
|
|
17
|
-
public: Refs<
|
|
18
|
-
internal: Refs<
|
|
16
|
+
declare const make: <ConvexSpec extends AnyWithPropsWithRuntime<"Convex">, NodeSpec extends AnyWithPropsWithRuntime<"Node"> = never>(convexSpec: ConvexSpec, nodeSpec?: NodeSpec) => {
|
|
17
|
+
public: Refs<ConvexSpec, NodeSpec, AnyPublic>;
|
|
18
|
+
internal: Refs<ConvexSpec, NodeSpec, AnyInternal>;
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
21
|
export { Refs, Refs_d_exports, make };
|
package/dist/Refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"mappings":";;;;;;;;;;KAOY,IAAA,
|
|
1
|
+
{"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"mappings":";;;;;;;;;;KAOY,IAAA,oBACS,uBAAA,6BACF,uBAAA,oCACC,GAAA,GAAU,GAAA,IAC1B,KAAA,CAAM,QAAA,CACR,SAAA,CACE,MAAA,CACI,QAAA,CAAY,UAAA,KACX,QAAA,yBAEG,SAAA,wBAIE,QAAA,iBAAyB,QAAA,eAEjC,SAAA;AAAA,KAKD,SAAA,eACW,cAAA,oBACI,GAAA,IAChB,KAAA,CAAM,QAAA,CACR,SAAA,CAAU,MAAA,CAAO,MAAA,CAAiB,KAAA,GAAQ,SAAA,KACxC,iBAAA,CAAkB,SAAA,CAAoB,KAAA,GAAQ,SAAA;AAAA,KAG7C,SAAA,oBACS,CAAA,UAAW,CAAA,CAAE,CAAA,0BAA2B,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KAGvD,iBAAA,mBACe,YAAA,oBACA,GAAA,eAET,MAAA,CAAkB,SAAA,KAAc,QAAA,CACvC,SAAA,EACA,IAAA,0BACwB,YAAA,GACtB,gBAAA,CAAqB,CAAA,UAAW,SAAA,GAC9B,IAAA,mBAEM,QAAA,CAAsB,SAAA,EAAW,IAAA,0BAC3C,YAAA,GACE,gBAAA,CAAqB,CAAA;AAAA,KAItB,MAAA,gBACY,cAAA,oBACG,GAAA,oBAEJ,MAAA,CAAe,MAAA,IAAU,UAAA,CACrC,MAAA,EACA,SAAA,8BAC4B,cAAA,GAC1B,SAAA,CAAU,KAAA,EAAO,SAAA;AAAA,cAUV,IAAA,sBACQ,uBAAA,6BACF,uBAAA,kBAEjB,UAAA,EAAY,UAAA,EACZ,QAAA,GAAW,QAAA;EAEX,MAAA,EAAQ,IAAA,CAAK,UAAA,EAAY,QAAA,EAAU,SAAA;EACnC,QAAA,EAAU,IAAA,CAAK,UAAA,EAAY,QAAA,EAAU,WAAA;AAAA"}
|
package/dist/Refs.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { makeNode } from "./GroupSpec.js";
|
|
2
3
|
import { getConvexFunctionName, make as make$1 } from "./Ref.js";
|
|
3
|
-
import { Record, pipe } from "effect";
|
|
4
|
+
import { Array, Record, pipe } from "effect";
|
|
4
5
|
|
|
5
6
|
//#region src/Refs.ts
|
|
6
7
|
var Refs_exports = /* @__PURE__ */ __exportAll({ make: () => make });
|
|
7
|
-
const make = (
|
|
8
|
-
const
|
|
8
|
+
const make = (convexSpec, nodeSpec) => {
|
|
9
|
+
const nodeGroup = nodeSpec ? Array.reduce(Record.values(nodeSpec.groups), makeNode("node"), (nodeGroupSpec, group) => nodeGroupSpec.addGroup(group)) : null;
|
|
10
|
+
const refs = makeHelper(nodeGroup ? {
|
|
11
|
+
...convexSpec.groups,
|
|
12
|
+
node: nodeGroup
|
|
13
|
+
} : convexSpec.groups);
|
|
9
14
|
return {
|
|
10
15
|
public: refs,
|
|
11
16
|
internal: refs
|