@confect/core 10.0.0-next.15 → 10.0.0-next.18
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 +246 -0
- package/dist/FunctionProvenance.d.ts +18 -18
- 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 +54 -48
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +23 -5
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GroupPath.d.ts +1 -4
- package/dist/GroupPath.d.ts.map +1 -1
- package/dist/GroupPath.js.map +1 -1
- package/dist/GroupSpec.d.ts +16 -10
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +34 -11
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Lazy.d.ts +2 -3
- package/dist/Lazy.d.ts.map +1 -1
- package/dist/Lazy.js +2 -3
- package/dist/Lazy.js.map +1 -1
- package/dist/MiddlewareSpec.d.ts +184 -0
- package/dist/MiddlewareSpec.d.ts.map +1 -0
- package/dist/MiddlewareSpec.js +55 -0
- package/dist/MiddlewareSpec.js.map +1 -0
- package/dist/Ref.d.ts +53 -37
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +53 -35
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +8 -3
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +3 -3
- package/dist/Refs.js.map +1 -1
- package/dist/SchemaToValidator.d.ts +99 -0
- package/dist/SchemaToValidator.d.ts.map +1 -0
- package/dist/SchemaToValidator.js +156 -0
- package/dist/SchemaToValidator.js.map +1 -0
- package/dist/Spec.d.ts +3 -2
- package/dist/Spec.d.ts.map +1 -1
- package/dist/Spec.js +1 -1
- package/dist/Spec.js.map +1 -1
- package/dist/Table.d.ts +74 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Table.js +77 -0
- package/dist/Table.js.map +1 -0
- package/dist/Types.d.ts +8 -2
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/package.json +9 -8
- package/src/FunctionProvenance.ts +8 -8
- package/src/FunctionSpec.ts +93 -14
- package/src/GroupPath.ts +1 -6
- package/src/GroupSpec.ts +125 -18
- package/src/Lazy.ts +2 -3
- package/src/MiddlewareSpec.ts +356 -0
- package/src/Ref.ts +310 -205
- package/src/Refs.ts +40 -16
- package/src/SchemaToValidator.ts +601 -0
- package/src/Spec.ts +4 -4
- package/src/Table.ts +426 -0
- package/src/Types.ts +9 -3
- package/src/index.ts +3 -1
- package/dist/Registry.d.ts +0 -24
- package/dist/Registry.d.ts.map +0 -1
- package/dist/Registry.js +0 -19
- package/dist/Registry.js.map +0 -1
- package/dist/tsconfig.src.tsbuildinfo +0 -1
- package/src/Registry.ts +0 -30
package/dist/FunctionSpec.d.ts
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
import type { FunctionType, FunctionVisibility, RegisteredAction, RegisteredMutation, RegisteredQuery } from "convex/server";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import * as FunctionProvenance from "./FunctionProvenance";
|
|
4
|
+
import type * as MiddlewareSpec from "./MiddlewareSpec";
|
|
4
5
|
import * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
5
|
-
export declare const TypeId = "
|
|
6
|
+
export declare const TypeId = "~@confect/core/FunctionSpec";
|
|
6
7
|
export type TypeId = typeof TypeId;
|
|
7
8
|
export declare const isFunctionSpec: (u: unknown) => u is AnyWithProps;
|
|
8
|
-
export interface FunctionSpec<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, FunctionProvenance_ extends FunctionProvenance.FunctionProvenance> {
|
|
9
|
+
export interface FunctionSpec<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, FunctionProvenance_ extends FunctionProvenance.FunctionProvenance, MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never> {
|
|
9
10
|
readonly [TypeId]: TypeId;
|
|
10
11
|
readonly runtimeAndFunctionType: RuntimeAndFunctionType_;
|
|
11
12
|
readonly functionVisibility: FunctionVisibility_;
|
|
12
13
|
readonly name: Name_;
|
|
13
14
|
readonly functionProvenance: FunctionProvenance_;
|
|
15
|
+
readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;
|
|
16
|
+
}
|
|
17
|
+
export interface Builder<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, FunctionProvenance_ extends FunctionProvenance.FunctionProvenance, MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility_, Name_, FunctionProvenance_, MiddlewareSpecs_> {
|
|
18
|
+
middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(middlewareSpec: MiddlewareSpec_ & MiddlewareSpec.ValidateFunctionAttach<MiddlewareSpec_, RuntimeAndFunctionType_, FunctionProvenance_, MiddlewareSpecs_>): Builder<RuntimeAndFunctionType_, FunctionVisibility_, Name_, FunctionProvenance_, MiddlewareSpecs_ | MiddlewareSpec_>;
|
|
14
19
|
}
|
|
15
20
|
export interface Any {
|
|
16
21
|
readonly [TypeId]: TypeId;
|
|
17
22
|
}
|
|
18
|
-
export interface AnyWithProps extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.FunctionProvenance> {
|
|
23
|
+
export interface AnyWithProps extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.FunctionProvenance, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
19
24
|
}
|
|
20
|
-
export interface AnyConfect extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConfect> {
|
|
25
|
+
export interface AnyConfect extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConfect, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
21
26
|
}
|
|
22
|
-
export interface AnyConvex extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConvex> {
|
|
27
|
+
export interface AnyConvex extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConvex, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
23
28
|
}
|
|
24
|
-
export interface AnyWithPropsWithRuntime<Runtime extends RuntimeAndFunctionType.Runtime> extends FunctionSpec<RuntimeAndFunctionType.WithRuntime<Runtime>, FunctionVisibility, string, FunctionProvenance.FunctionProvenance> {
|
|
29
|
+
export interface AnyWithPropsWithRuntime<Runtime extends RuntimeAndFunctionType.Runtime> extends FunctionSpec<RuntimeAndFunctionType.WithRuntime<Runtime>, FunctionVisibility, string, FunctionProvenance.FunctionProvenance, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
25
30
|
}
|
|
26
|
-
export interface AnyWithPropsWithFunctionType<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility, string, FunctionProvenance.FunctionProvenance> {
|
|
31
|
+
export interface AnyWithPropsWithFunctionType<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility, string, FunctionProvenance.FunctionProvenance, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
27
32
|
}
|
|
28
|
-
export interface AnyWithPropsWithFunctionProvenance<FunctionProvenance_ extends FunctionProvenance.FunctionProvenance> extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance_> {
|
|
33
|
+
export interface AnyWithPropsWithFunctionProvenance<FunctionProvenance_ extends FunctionProvenance.FunctionProvenance> extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance_, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
29
34
|
}
|
|
30
35
|
export type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["runtimeAndFunctionType"];
|
|
31
36
|
export type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["functionVisibility"];
|
|
32
37
|
export type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["name"];
|
|
38
|
+
export type MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["middlewareSpecs"][number];
|
|
33
39
|
export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
34
40
|
functionProvenance: {
|
|
35
41
|
_tag: "Confect";
|
|
@@ -38,7 +44,7 @@ export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
|
38
44
|
} ? ArgsSchema_["Type"] : FunctionSpec_ extends {
|
|
39
45
|
functionProvenance: {
|
|
40
46
|
_tag: "Convex";
|
|
41
|
-
|
|
47
|
+
"~args": infer Args_;
|
|
42
48
|
};
|
|
43
49
|
} ? Args_ : never;
|
|
44
50
|
export type Returns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
@@ -49,7 +55,7 @@ export type Returns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends
|
|
|
49
55
|
} ? ReturnsSchema_["Type"] : FunctionSpec_ extends {
|
|
50
56
|
functionProvenance: {
|
|
51
57
|
_tag: "Convex";
|
|
52
|
-
|
|
58
|
+
"~returns": infer Returns_;
|
|
53
59
|
};
|
|
54
60
|
} ? Awaited<Returns_> : never;
|
|
55
61
|
export type EncodedArgs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
@@ -60,7 +66,7 @@ export type EncodedArgs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ exte
|
|
|
60
66
|
} ? ArgsSchema_["Encoded"] : FunctionSpec_ extends {
|
|
61
67
|
functionProvenance: {
|
|
62
68
|
_tag: "Convex";
|
|
63
|
-
|
|
69
|
+
"~args": infer Args_;
|
|
64
70
|
};
|
|
65
71
|
} ? Args_ : never;
|
|
66
72
|
export type EncodedReturns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
@@ -71,7 +77,7 @@ export type EncodedReturns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ e
|
|
|
71
77
|
} ? ReturnsSchema_["Encoded"] : FunctionSpec_ extends {
|
|
72
78
|
functionProvenance: {
|
|
73
79
|
_tag: "Convex";
|
|
74
|
-
|
|
80
|
+
"~returns": infer Returns_;
|
|
75
81
|
};
|
|
76
82
|
} ? Returns_ : never;
|
|
77
83
|
export type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
@@ -113,19 +119,19 @@ export declare const publicQuery: <const Name_ extends string, Args_ extends Sch
|
|
|
113
119
|
args: () => Args_;
|
|
114
120
|
returns: () => Returns_;
|
|
115
121
|
error?: () => Error_;
|
|
116
|
-
}) =>
|
|
122
|
+
}) => Builder<{
|
|
117
123
|
readonly runtime: "Convex";
|
|
118
124
|
readonly functionType: "query";
|
|
119
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
125
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
120
126
|
export declare const internalQuery: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
121
127
|
name: Name_;
|
|
122
128
|
args: () => Args_;
|
|
123
129
|
returns: () => Returns_;
|
|
124
130
|
error?: () => Error_;
|
|
125
|
-
}) =>
|
|
131
|
+
}) => Builder<{
|
|
126
132
|
readonly runtime: "Convex";
|
|
127
133
|
readonly functionType: "query";
|
|
128
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
134
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
129
135
|
export declare const publicPaginatedQuery: <const Name_ extends string, Item_ extends Schema.Codec<any, any>, UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>, Error_ extends Schema.Codec<any, any> = never>({ name, args, item, error, }: {
|
|
130
136
|
name: Name_;
|
|
131
137
|
/** User-declared args, without `paginationOpts` — it is added automatically. */
|
|
@@ -133,10 +139,10 @@ export declare const publicPaginatedQuery: <const Name_ extends string, Item_ ex
|
|
|
133
139
|
/** The page element schema. */
|
|
134
140
|
item: () => Item_;
|
|
135
141
|
error?: () => Error_;
|
|
136
|
-
}) =>
|
|
142
|
+
}) => Builder<{
|
|
137
143
|
readonly runtime: "Convex";
|
|
138
144
|
readonly functionType: "query";
|
|
139
|
-
}, "public", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_
|
|
145
|
+
}, "public", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>, never>;
|
|
140
146
|
export declare const internalPaginatedQuery: <const Name_ extends string, Item_ extends Schema.Codec<any, any>, UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>, Error_ extends Schema.Codec<any, any> = never>({ name, args, item, error, }: {
|
|
141
147
|
name: Name_;
|
|
142
148
|
/** User-declared args, without `paginationOpts` — it is added automatically. */
|
|
@@ -144,122 +150,122 @@ export declare const internalPaginatedQuery: <const Name_ extends string, Item_
|
|
|
144
150
|
/** The page element schema. */
|
|
145
151
|
item: () => Item_;
|
|
146
152
|
error?: () => Error_;
|
|
147
|
-
}) =>
|
|
153
|
+
}) => Builder<{
|
|
148
154
|
readonly runtime: "Convex";
|
|
149
155
|
readonly functionType: "query";
|
|
150
|
-
}, "internal", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_
|
|
156
|
+
}, "internal", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>, never>;
|
|
151
157
|
export declare const publicMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
152
158
|
name: Name_;
|
|
153
159
|
args: () => Args_;
|
|
154
160
|
returns: () => Returns_;
|
|
155
161
|
error?: () => Error_;
|
|
156
|
-
}) =>
|
|
162
|
+
}) => Builder<{
|
|
157
163
|
readonly runtime: "Convex";
|
|
158
164
|
readonly functionType: "mutation";
|
|
159
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
165
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
160
166
|
export declare const internalMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
161
167
|
name: Name_;
|
|
162
168
|
args: () => Args_;
|
|
163
169
|
returns: () => Returns_;
|
|
164
170
|
error?: () => Error_;
|
|
165
|
-
}) =>
|
|
171
|
+
}) => Builder<{
|
|
166
172
|
readonly runtime: "Convex";
|
|
167
173
|
readonly functionType: "mutation";
|
|
168
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
174
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
169
175
|
export declare const publicAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
170
176
|
name: Name_;
|
|
171
177
|
args: () => Args_;
|
|
172
178
|
returns: () => Returns_;
|
|
173
179
|
error?: () => Error_;
|
|
174
|
-
}) =>
|
|
180
|
+
}) => Builder<{
|
|
175
181
|
readonly runtime: "Convex";
|
|
176
182
|
readonly functionType: "action";
|
|
177
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
183
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
178
184
|
export declare const internalAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
179
185
|
name: Name_;
|
|
180
186
|
args: () => Args_;
|
|
181
187
|
returns: () => Returns_;
|
|
182
188
|
error?: () => Error_;
|
|
183
|
-
}) =>
|
|
189
|
+
}) => Builder<{
|
|
184
190
|
readonly runtime: "Convex";
|
|
185
191
|
readonly functionType: "action";
|
|
186
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
192
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
187
193
|
export declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
188
194
|
name: Name_;
|
|
189
195
|
args: () => Args_;
|
|
190
196
|
returns: () => Returns_;
|
|
191
197
|
error?: () => Error_;
|
|
192
|
-
}) =>
|
|
198
|
+
}) => Builder<{
|
|
193
199
|
readonly runtime: "Node";
|
|
194
200
|
readonly functionType: "action";
|
|
195
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
201
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
196
202
|
export declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
197
203
|
name: Name_;
|
|
198
204
|
args: () => Args_;
|
|
199
205
|
returns: () => Returns_;
|
|
200
206
|
error?: () => Error_;
|
|
201
|
-
}) =>
|
|
207
|
+
}) => Builder<{
|
|
202
208
|
readonly runtime: "Node";
|
|
203
209
|
readonly functionType: "action";
|
|
204
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
210
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
205
211
|
type MatchingRegisteredFunction<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility> = RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends "query" ? RegisteredQuery<FunctionVisibility_, any, any> : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends "mutation" ? RegisteredMutation<FunctionVisibility_, any, any> : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends "action" ? RegisteredAction<FunctionVisibility_, any, any> : never;
|
|
206
212
|
type ExtractArgs<F> = F extends RegisteredQuery<any, infer A, any> ? A : F extends RegisteredMutation<any, infer A, any> ? A : F extends RegisteredAction<any, infer A, any> ? A : never;
|
|
207
213
|
type ExtractReturns<F> = F extends RegisteredQuery<any, any, infer R> ? R : F extends RegisteredMutation<any, any, infer R> ? R : F extends RegisteredAction<any, any, infer R> ? R : never;
|
|
208
214
|
export declare const convexPublicQuery: <F extends MatchingRegisteredFunction<{
|
|
209
215
|
readonly runtime: "Convex";
|
|
210
216
|
readonly functionType: "query";
|
|
211
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
217
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
212
218
|
readonly runtime: "Convex";
|
|
213
219
|
readonly functionType: "query";
|
|
214
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
220
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
215
221
|
export declare const convexInternalQuery: <F extends MatchingRegisteredFunction<{
|
|
216
222
|
readonly runtime: "Convex";
|
|
217
223
|
readonly functionType: "query";
|
|
218
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
224
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
219
225
|
readonly runtime: "Convex";
|
|
220
226
|
readonly functionType: "query";
|
|
221
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
227
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
222
228
|
export declare const convexPublicMutation: <F extends MatchingRegisteredFunction<{
|
|
223
229
|
readonly runtime: "Convex";
|
|
224
230
|
readonly functionType: "mutation";
|
|
225
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
231
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
226
232
|
readonly runtime: "Convex";
|
|
227
233
|
readonly functionType: "mutation";
|
|
228
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
234
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
229
235
|
export declare const convexInternalMutation: <F extends MatchingRegisteredFunction<{
|
|
230
236
|
readonly runtime: "Convex";
|
|
231
237
|
readonly functionType: "mutation";
|
|
232
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
238
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
233
239
|
readonly runtime: "Convex";
|
|
234
240
|
readonly functionType: "mutation";
|
|
235
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
241
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
236
242
|
export declare const convexPublicAction: <F extends MatchingRegisteredFunction<{
|
|
237
243
|
readonly runtime: "Convex";
|
|
238
244
|
readonly functionType: "action";
|
|
239
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
245
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
240
246
|
readonly runtime: "Convex";
|
|
241
247
|
readonly functionType: "action";
|
|
242
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
248
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
243
249
|
export declare const convexInternalAction: <F extends MatchingRegisteredFunction<{
|
|
244
250
|
readonly runtime: "Convex";
|
|
245
251
|
readonly functionType: "action";
|
|
246
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
252
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
247
253
|
readonly runtime: "Convex";
|
|
248
254
|
readonly functionType: "action";
|
|
249
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
255
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
250
256
|
export declare const convexPublicNodeAction: <F extends MatchingRegisteredFunction<{
|
|
251
257
|
readonly runtime: "Node";
|
|
252
258
|
readonly functionType: "action";
|
|
253
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
259
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
254
260
|
readonly runtime: "Node";
|
|
255
261
|
readonly functionType: "action";
|
|
256
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
262
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
257
263
|
export declare const convexInternalNodeAction: <F extends MatchingRegisteredFunction<{
|
|
258
264
|
readonly runtime: "Node";
|
|
259
265
|
readonly functionType: "action";
|
|
260
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
266
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
261
267
|
readonly runtime: "Node";
|
|
262
268
|
readonly functionType: "action";
|
|
263
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
269
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
264
270
|
export {};
|
|
265
271
|
//# sourceMappingURL=FunctionSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.d.ts","sourceRoot":"","sources":["../src/FunctionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"FunctionSpec.d.ts","sourceRoot":"","sources":["../src/FunctionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EA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S,MAAM;;;0FAqD5B,CAAC"}
|
package/dist/FunctionSpec.js
CHANGED
|
@@ -27,16 +27,32 @@ var FunctionSpec_exports = /* @__PURE__ */ __exportAll({
|
|
|
27
27
|
publicPaginatedQuery: () => publicPaginatedQuery,
|
|
28
28
|
publicQuery: () => publicQuery
|
|
29
29
|
});
|
|
30
|
-
const TypeId = "
|
|
30
|
+
const TypeId = "~@confect/core/FunctionSpec";
|
|
31
31
|
const isFunctionSpec = (u) => Predicate.hasProperty(u, TypeId);
|
|
32
|
-
const Proto = {
|
|
32
|
+
const Proto = {
|
|
33
|
+
[TypeId]: TypeId,
|
|
34
|
+
middleware(middlewareSpec) {
|
|
35
|
+
if (this.functionProvenance._tag === "Convex") throw new Error(`Plain Convex function "${this.name}" cannot have middleware`);
|
|
36
|
+
const functionType = this.runtimeAndFunctionType.functionType;
|
|
37
|
+
if (!middlewareSpec.functionTypes[functionType]) throw new Error(`Middleware "${middlewareSpec.key}" does not declare function type "${functionType}" of function "${this.name}"`);
|
|
38
|
+
if (this.middlewareSpecs.some((existing) => existing.key === middlewareSpec.key)) throw new Error(`Middleware "${middlewareSpec.key}" is already attached to function "${this.name}"`);
|
|
39
|
+
return Object.assign(Object.create(Proto), {
|
|
40
|
+
runtimeAndFunctionType: this.runtimeAndFunctionType,
|
|
41
|
+
functionVisibility: this.functionVisibility,
|
|
42
|
+
name: this.name,
|
|
43
|
+
functionProvenance: this.functionProvenance,
|
|
44
|
+
middlewareSpecs: [...this.middlewareSpecs, middlewareSpec]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
33
48
|
const make = (runtimeAndFunctionType, functionVisibility) => ({ name, args, returns, error }) => {
|
|
34
49
|
validateConfectFunctionIdentifier(name);
|
|
35
50
|
return Object.assign(Object.create(Proto), {
|
|
36
51
|
runtimeAndFunctionType,
|
|
37
52
|
functionVisibility,
|
|
38
53
|
name,
|
|
39
|
-
functionProvenance: Confect(args, returns, error)
|
|
54
|
+
functionProvenance: Confect(args, returns, error),
|
|
55
|
+
middlewareSpecs: []
|
|
40
56
|
});
|
|
41
57
|
};
|
|
42
58
|
const makePaginated = (runtimeAndFunctionType, functionVisibility) => ({ name, args, item, error }) => {
|
|
@@ -45,7 +61,8 @@ const makePaginated = (runtimeAndFunctionType, functionVisibility) => ({ name, a
|
|
|
45
61
|
runtimeAndFunctionType,
|
|
46
62
|
functionVisibility,
|
|
47
63
|
name,
|
|
48
|
-
functionProvenance: ConfectPaginated(args ?? (() => Schema.Struct({})), item, error)
|
|
64
|
+
functionProvenance: ConfectPaginated(args ?? (() => Schema.Struct({})), item, error),
|
|
65
|
+
middlewareSpecs: []
|
|
49
66
|
});
|
|
50
67
|
};
|
|
51
68
|
const publicQuery = make(ConvexQuery, "public");
|
|
@@ -64,7 +81,8 @@ const makeConvex = (runtimeAndFunctionType, functionVisibility) => () => (name)
|
|
|
64
81
|
runtimeAndFunctionType,
|
|
65
82
|
functionVisibility,
|
|
66
83
|
name,
|
|
67
|
-
functionProvenance: Convex()
|
|
84
|
+
functionProvenance: Convex(),
|
|
85
|
+
middlewareSpecs: []
|
|
68
86
|
});
|
|
69
87
|
};
|
|
70
88
|
const convexPublicQuery = makeConvex(ConvexQuery, "public");
|
package/dist/FunctionSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","FunctionProvenance.ConfectPaginated","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 * as Schema from \"effect/Schema\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Codec<any, any>,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\n/**\n * `Schema.Struct` fields that must not declare `paginationOpts`. Used to\n * reject a user args schema that redeclares the field the paginated\n * constructors add themselves; the check reports at the `args` thunk with an\n * unsatisfiable type when violated.\n */\ntype ForbidPaginationOpts<UserArgs extends FunctionProvenance.AnyUserArgs> =\n \"paginationOpts\" extends keyof UserArgs[\"fields\"]\n ? { readonly fields: { readonly paginationOpts: never } }\n : unknown;\n\nconst makePaginated =\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 Item_ extends Schema.Codec<any, any>,\n UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n item,\n error,\n }: {\n name: Name_;\n /** User-declared args, without `paginationOpts` — it is added automatically. */\n args?: (() => UserArgs_) & ForbidPaginationOpts<UserArgs_>;\n /** The page element schema. */\n item: () => Item_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.ConfectPaginated(\n // When `args` is omitted, `UserArgs_` is its `Schema.Struct<{}>` default.\n args ?? ((() => Schema.Struct({})) as unknown as () => UserArgs_),\n item,\n error,\n ),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicPaginatedQuery = makePaginated(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const internalPaginatedQuery = makePaginated(\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,MAAM;AAyLjC,MAAM,QAAQ,GACX,SAAS,OACZ;AAEA,MAAM,QAMF,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YACA,UACF"}
|
|
1
|
+
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","FunctionProvenance.ConfectPaginated","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 * as Schema from \"effect/Schema\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport type * as MiddlewareSpec from \"./MiddlewareSpec\";\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 MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;\n}\n\nexport interface Builder<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance_,\n MiddlewareSpecs_\n> {\n middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(\n middlewareSpec: MiddlewareSpec_ &\n MiddlewareSpec.ValidateFunctionAttach<\n MiddlewareSpec_,\n RuntimeAndFunctionType_,\n FunctionProvenance_,\n MiddlewareSpecs_\n >,\n ): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance_,\n MiddlewareSpecs_ | MiddlewareSpec_\n >;\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 MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex,\n MiddlewareSpec.AnyMiddlewareSpec\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 MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_,\n MiddlewareSpec.AnyMiddlewareSpec\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 MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"middlewareSpecs\"][number];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; \"~args\": infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; \"~returns\": infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; \"~args\": infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; \"~returns\": infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n middleware(\n this: AnyWithProps,\n middlewareSpec: MiddlewareSpec.AnyMiddlewareSpec,\n ) {\n if (this.functionProvenance._tag === \"Convex\") {\n throw new Error(\n `Plain Convex function \"${this.name}\" cannot have middleware`,\n );\n }\n const functionType = this.runtimeAndFunctionType.functionType;\n if (!middlewareSpec.functionTypes[functionType]) {\n throw new Error(\n `Middleware \"${middlewareSpec.key}\" does not declare function type \"${functionType}\" of function \"${this.name}\"`,\n );\n }\n if (\n this.middlewareSpecs.some(\n (existing) => existing.key === middlewareSpec.key,\n )\n ) {\n throw new Error(\n `Middleware \"${middlewareSpec.key}\" is already attached to function \"${this.name}\"`,\n );\n }\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType: this.runtimeAndFunctionType,\n functionVisibility: this.functionVisibility,\n name: this.name,\n functionProvenance: this.functionProvenance,\n middlewareSpecs: [...this.middlewareSpecs, middlewareSpec],\n });\n },\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Codec<any, any>,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): Builder<\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 middlewareSpecs: [],\n });\n };\n\n/**\n * `Schema.Struct` fields that must not declare `paginationOpts`. Used to\n * reject a user args schema that redeclares the field the paginated\n * constructors add themselves; the check reports at the `args` thunk with an\n * unsatisfiable type when violated.\n */\ntype ForbidPaginationOpts<UserArgs extends FunctionProvenance.AnyUserArgs> =\n \"paginationOpts\" extends keyof UserArgs[\"fields\"]\n ? { readonly fields: { readonly paginationOpts: never } }\n : unknown;\n\nconst makePaginated =\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 Item_ extends Schema.Codec<any, any>,\n UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n item,\n error,\n }: {\n name: Name_;\n /** User-declared args, without `paginationOpts` — it is added automatically. */\n args?: (() => UserArgs_) & ForbidPaginationOpts<UserArgs_>;\n /** The page element schema. */\n item: () => Item_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.ConfectPaginated(\n // When `args` is omitted, `UserArgs_` is its `Schema.Struct<{}>` default.\n args ?? ((() => Schema.Struct({})) as unknown as () => UserArgs_),\n item,\n error,\n ),\n middlewareSpecs: [],\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicPaginatedQuery = makePaginated(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const internalPaginatedQuery = makePaginated(\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 ): Builder<\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 middlewareSpecs: [],\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,MAAM;AAkOjC,MAAM,QAAQ;EACX,SAAS;CAEV,WAEE,gBACA;EACA,IAAI,KAAK,mBAAmB,SAAS,UACnC,MAAM,IAAI,MACR,0BAA0B,KAAK,KAAK,yBACtC;EAEF,MAAM,eAAe,KAAK,uBAAuB;EACjD,IAAI,CAAC,eAAe,cAAc,eAChC,MAAM,IAAI,MACR,eAAe,eAAe,IAAI,oCAAoC,aAAa,iBAAiB,KAAK,KAAK,EAChH;EAEF,IACE,KAAK,gBAAgB,MAClB,aAAa,SAAS,QAAQ,eAAe,GAChD,GAEA,MAAM,IAAI,MACR,eAAe,eAAe,IAAI,qCAAqC,KAAK,KAAK,EACnF;EAGF,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;GACzC,wBAAwB,KAAK;GAC7B,oBAAoB,KAAK;GACzB,MAAM,KAAK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,MAAa,yBAAyB,WACpCA,gBACA,UACF;AACA,MAAa,qBAAqB,WAChCC,cACA,QACF;AACA,MAAa,uBAAuB,WAClCA,cACA,UACF;AACA,MAAa,yBAAyB,WACpCC,YACA,QACF;AACA,MAAa,2BAA2B,WACtCA,YACA,UACF"}
|
package/dist/GroupPath.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Record } from "effect";
|
|
2
1
|
import type * as GroupSpec from "./GroupSpec";
|
|
3
2
|
/**
|
|
4
3
|
* Recursively generates paths for a group and its nested groups.
|
|
@@ -19,9 +18,7 @@ type AllHelper<Parent extends GroupSpec.AnyWithProps, Groups_ extends GroupSpec.
|
|
|
19
18
|
*/
|
|
20
19
|
export type GroupAt<Group, Path extends string> = Group extends GroupSpec.AnyWithProps ? Path extends `${infer Head}.${infer Tail}` ? Group extends {
|
|
21
20
|
readonly name: Head;
|
|
22
|
-
} ? Group
|
|
23
|
-
readonly groups: Record.ReadonlyRecord<string, infer SubGroup>;
|
|
24
|
-
} ? GroupAt<SubGroup, Tail> : never : never : GroupSpec.WithName<Group, Path> : never;
|
|
21
|
+
} ? GroupAt<GroupSpec.Groups<Group>, Tail> : never : GroupSpec.WithName<Group, Path> : never;
|
|
25
22
|
export type SubGroupsAt<Group extends GroupSpec.AnyWithProps, GroupPath extends string> = GroupSpec.Groups<GroupAt<Group, GroupPath>> extends infer SubGroups ? SubGroups extends GroupSpec.AnyWithProps ? `${GroupPath}.${GroupSpec.Name<SubGroups>}` : never : never;
|
|
26
23
|
export {};
|
|
27
24
|
//# sourceMappingURL=GroupPath.d.ts.map
|
package/dist/GroupPath.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupPath.d.ts","sourceRoot":"","sources":["../src/GroupPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"GroupPath.d.ts","sourceRoot":"","sources":["../src/GroupPath.ts"],"names":[],"mappings":"A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M,MAAM,WAAW,CACrB,KAAK,SAAS,SAAS,CAAC,YAAY,EACpC,SAAS,SAAS,MAAM,IAExB,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,SAAS,MAAM,SAAS,GAC/D,SAAS,SAAS,SAAS,CAAC,YAAY,GACtC,GAAG,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAC3C,KAAK,GACP,KAAK,CAAC"}
|
package/dist/GroupPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupPath.js","names":[],"sources":["../src/GroupPath.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"GroupPath.js","names":[],"sources":["../src/GroupPath.ts"],"sourcesContent":["import type * as GroupSpec from \"./GroupSpec\";\n\n/**\n * Recursively generates paths for a group and its nested groups.\n *\n * - For a group with no subgroups, returns just the group name.\n * - For a group with subgroups, returns the group name plus all possible paths through its direct subgroups.\n */\nexport type All<\n Group extends GroupSpec.AnyWithProps,\n Depth extends 1[] = [],\n> = Depth[\"length\"] extends 15\n ? string\n : Group extends any\n ? [GroupSpec.Groups<Group>] extends [never]\n ? GroupSpec.Name<Group>\n : GroupSpec.Name<Group> | AllHelper<Group, GroupSpec.Groups<Group>, Depth>\n : never;\n\ntype AllHelper<\n Parent extends GroupSpec.AnyWithProps,\n Groups_ extends GroupSpec.AnyWithProps,\n Depth extends 1[] = [],\n> = Groups_ extends GroupSpec.AnyWithProps\n ? `${GroupSpec.Name<Parent>}.${All<Groups_, [...Depth, 1]>}`\n : never;\n\n/**\n * Recursively extracts the group at the given dot-separated path.\n * Path must match the format defined in `Path` above, e.g. \"group\" or \"group.subgroup\".\n *\n * @example\n * ```ts\n * type G = WithPath<RootGroup, \"group.subgroup\">;\n * ```\n */\nexport type GroupAt<\n Group,\n Path extends string,\n> = Group extends GroupSpec.AnyWithProps\n ? Path extends `${infer Head}.${infer Tail}`\n ? Group extends { readonly name: Head }\n ? GroupAt<GroupSpec.Groups<Group>, Tail>\n : never\n : GroupSpec.WithName<Group, Path>\n : never;\n\nexport type SubGroupsAt<\n Group extends GroupSpec.AnyWithProps,\n GroupPath extends string,\n> =\n GroupSpec.Groups<GroupAt<Group, GroupPath>> extends infer SubGroups\n ? SubGroups extends GroupSpec.AnyWithProps\n ? `${GroupPath}.${GroupSpec.Name<SubGroups>}`\n : never\n : never;\n"],"mappings":""}
|
package/dist/GroupSpec.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type * as FunctionSpec from "./FunctionSpec";
|
|
2
|
+
import type * as MiddlewareSpec from "./MiddlewareSpec";
|
|
2
3
|
import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
3
|
-
export declare const TypeId = "
|
|
4
|
+
export declare const TypeId = "~@confect/core/GroupSpec";
|
|
4
5
|
export type TypeId = typeof TypeId;
|
|
5
6
|
export declare const isGroupSpec: (u: unknown) => u is AnyWithProps;
|
|
6
|
-
export interface GroupSpec<Runtime extends RuntimeAndFunctionType.Runtime, Name_ extends string, Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never, Groups_ extends AnyWithProps = never> {
|
|
7
|
+
export interface GroupSpec<Runtime extends RuntimeAndFunctionType.Runtime, Name_ extends string, Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never, Groups_ extends AnyWithProps = never, MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never> {
|
|
7
8
|
readonly [TypeId]: TypeId;
|
|
8
9
|
readonly runtime: Runtime;
|
|
9
10
|
readonly name: Name_;
|
|
@@ -13,20 +14,25 @@ export interface GroupSpec<Runtime extends RuntimeAndFunctionType.Runtime, Name_
|
|
|
13
14
|
readonly groups: {
|
|
14
15
|
[GroupName in Name<Groups_>]: WithName<Groups_, GroupName>;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;
|
|
18
|
+
readonly "~Functions": Functions_;
|
|
19
|
+
readonly "~Groups": Groups_;
|
|
20
|
+
addFunction<Function extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>>(function_: Function & MiddlewareSpec.ValidateAddedFunction<Function, MiddlewareSpecs_>): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_, MiddlewareSpecs_>;
|
|
21
|
+
addGroup<Group extends AnyWithProps>(group: Group): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group, MiddlewareSpecs_>;
|
|
22
|
+
addGroupAt<const AtName extends string, Group extends AnyWithProps>(name: AtName, group: Group): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>, MiddlewareSpecs_>;
|
|
23
|
+
middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(middlewareSpec: MiddlewareSpec_ & MiddlewareSpec.ValidateAttach<MiddlewareSpec_, Functions_, MiddlewareSpecs_>): GroupSpec<Runtime, Name_, Functions_, Groups_, MiddlewareSpecs_ | MiddlewareSpec_>;
|
|
19
24
|
}
|
|
20
25
|
export interface Any {
|
|
21
26
|
readonly [TypeId]: TypeId;
|
|
22
27
|
}
|
|
23
|
-
export interface AnyWithProps extends GroupSpec<RuntimeAndFunctionType.Runtime, string, FunctionSpec.AnyWithProps, AnyWithProps> {
|
|
28
|
+
export interface AnyWithProps extends GroupSpec<RuntimeAndFunctionType.Runtime, string, FunctionSpec.AnyWithProps, AnyWithProps, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
24
29
|
}
|
|
25
|
-
export interface AnyWithPropsWithRuntime<Runtime extends RuntimeAndFunctionType.Runtime> extends GroupSpec<Runtime, string, FunctionSpec.AnyWithPropsWithRuntime<Runtime>, AnyWithPropsWithRuntime<Runtime
|
|
30
|
+
export interface AnyWithPropsWithRuntime<Runtime extends RuntimeAndFunctionType.Runtime> extends GroupSpec<Runtime, string, FunctionSpec.AnyWithPropsWithRuntime<Runtime>, AnyWithPropsWithRuntime<Runtime>, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
26
31
|
}
|
|
27
32
|
export type Name<Group extends AnyWithProps> = Group["name"];
|
|
28
|
-
export type Functions<Group extends AnyWithProps> = Group["
|
|
29
|
-
export type Groups<Group extends AnyWithProps> = Group["
|
|
33
|
+
export type Functions<Group extends AnyWithProps> = Group["~Functions"];
|
|
34
|
+
export type Groups<Group extends AnyWithProps> = Group["~Groups"];
|
|
35
|
+
export type MiddlewareSpecs<Group extends AnyWithProps> = Group["middlewareSpecs"][number];
|
|
30
36
|
export type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [
|
|
31
37
|
never
|
|
32
38
|
] ? never : Name<Groups<Group>>;
|
|
@@ -37,7 +43,7 @@ export type WithName<Group extends AnyWithProps, Name_ extends Name<Group>> = Ex
|
|
|
37
43
|
export type NamedAt<Group extends Any, Name_ extends string> = Omit<Group, "name"> & {
|
|
38
44
|
readonly name: Name_;
|
|
39
45
|
};
|
|
40
|
-
export type AddGroups<Group extends AnyWithProps, ExtraGroups extends AnyWithProps> = Group extends GroupSpec<infer Runtime, infer Name_, infer Functions_, infer Groups_> ? GroupSpec<Runtime, Name_, Functions_, Groups_ | ExtraGroups> : never;
|
|
46
|
+
export type AddGroups<Group extends AnyWithProps, ExtraGroups extends AnyWithProps> = Group extends GroupSpec<infer Runtime, infer Name_, infer Functions_, infer Groups_, infer MiddlewareSpecs_> ? GroupSpec<Runtime, Name_, Functions_, Groups_ | ExtraGroups, MiddlewareSpecs_> : never;
|
|
41
47
|
export declare const make: () => GroupSpec<"Convex", "">;
|
|
42
48
|
export declare const makeAt: <const Name_ extends string>(name: Name_) => GroupSpec<"Convex", Name_>;
|
|
43
49
|
export declare const makeNode: () => GroupSpec<"Node", "">;
|
package/dist/GroupSpec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSpec.d.ts","sourceRoot":"","sources":["../src/GroupSpec.ts"],"names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