@confect/server 8.0.0 → 9.0.0-next.1
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 +47 -0
- package/dist/Auth.d.ts +1 -1
- package/dist/DatabaseReader.d.ts +4 -4
- package/dist/DatabaseSchema.d.ts +9 -4
- package/dist/DatabaseSchema.d.ts.map +1 -1
- package/dist/DatabaseSchema.js +4 -3
- package/dist/DatabaseSchema.js.map +1 -1
- package/dist/DatabaseWriter.d.ts +4 -4
- package/dist/DatabaseWriter.d.ts.map +1 -1
- package/dist/FunctionImpl.d.ts +10 -7
- package/dist/FunctionImpl.d.ts.map +1 -1
- package/dist/FunctionImpl.js +8 -8
- package/dist/FunctionImpl.js.map +1 -1
- package/dist/GroupImpl.d.ts +51 -12
- package/dist/GroupImpl.d.ts.map +1 -1
- package/dist/GroupImpl.js +72 -4
- package/dist/GroupImpl.js.map +1 -1
- package/dist/GroupPath.d.ts +8 -0
- package/dist/GroupPath.d.ts.map +1 -0
- package/dist/GroupPath.js +10 -0
- package/dist/GroupPath.js.map +1 -0
- package/dist/QueryInitializer.d.ts +1 -1
- package/dist/QueryInitializer.d.ts.map +1 -1
- package/dist/RegisteredConvexFunction.d.ts +8 -8
- package/dist/RegisteredConvexFunction.d.ts.map +1 -1
- package/dist/RegisteredFunction.d.ts +3 -3
- package/dist/RegisteredFunction.d.ts.map +1 -1
- package/dist/RegisteredFunctions.d.ts +15 -4
- package/dist/RegisteredFunctions.d.ts.map +1 -1
- package/dist/RegisteredFunctions.js +20 -11
- package/dist/RegisteredFunctions.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/package.json +4 -6
- package/src/DatabaseSchema.ts +10 -7
- package/src/FunctionImpl.ts +27 -36
- package/src/GroupImpl.ts +168 -32
- package/src/GroupPath.ts +43 -0
- package/src/RegisteredFunctions.ts +78 -28
- package/src/index.ts +0 -2
- package/dist/Impl.d.ts +0 -24
- package/dist/Impl.d.ts.map +0 -1
- package/dist/Impl.js +0 -28
- package/dist/Impl.js.map +0 -1
- package/dist/Registry.d.ts +0 -15
- package/dist/Registry.d.ts.map +0 -1
- package/dist/Registry.js +0 -10
- package/dist/Registry.js.map +0 -1
- package/src/Impl.ts +0 -59
- package/src/Registry.ts +0 -13
package/src/GroupImpl.ts
CHANGED
|
@@ -1,60 +1,196 @@
|
|
|
1
|
-
import type * as GroupPath from "@confect/core/GroupPath";
|
|
2
1
|
import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
3
|
-
import
|
|
2
|
+
import * as Registry from "@confect/core/Registry";
|
|
3
|
+
import {
|
|
4
|
+
Array,
|
|
5
|
+
Context,
|
|
6
|
+
Effect,
|
|
7
|
+
Layer,
|
|
8
|
+
Option,
|
|
9
|
+
pipe,
|
|
10
|
+
Predicate,
|
|
11
|
+
Record,
|
|
12
|
+
Ref,
|
|
13
|
+
String,
|
|
14
|
+
} from "effect";
|
|
4
15
|
import type * as Api from "./Api";
|
|
5
16
|
import type * as FunctionImpl from "./FunctionImpl";
|
|
17
|
+
import { resolveGroupPathUnsafe } from "./GroupPath";
|
|
6
18
|
|
|
7
|
-
export
|
|
19
|
+
export const TypeId = "@confect/server/GroupImpl";
|
|
20
|
+
export type TypeId = typeof TypeId;
|
|
21
|
+
|
|
22
|
+
export type FinalizationStatus = "Unfinalized" | "Finalized";
|
|
23
|
+
|
|
24
|
+
export interface GroupImpl<
|
|
25
|
+
GroupPath_ extends string,
|
|
26
|
+
FinalizationStatus_ extends FinalizationStatus = "Unfinalized",
|
|
27
|
+
> {
|
|
28
|
+
readonly [TypeId]: TypeId;
|
|
8
29
|
readonly groupPath: GroupPath_;
|
|
30
|
+
readonly finalizationStatus: FinalizationStatus_;
|
|
31
|
+
/**
|
|
32
|
+
* Names of every function registered into this group's layer scope by
|
|
33
|
+
* `FunctionImpl.make`. Authoritative only when `finalizationStatus` is
|
|
34
|
+
* `"Finalized"`; the `"Unfinalized"` value is set to `[]` at `make`-time
|
|
35
|
+
* since the list is only known once `finalize` snapshots the registry.
|
|
36
|
+
*/
|
|
37
|
+
readonly registeredFunctionNames: ReadonlyArray<string>;
|
|
9
38
|
}
|
|
10
39
|
|
|
11
|
-
export
|
|
40
|
+
export interface Any extends GroupImpl<string, FinalizationStatus> {}
|
|
41
|
+
|
|
42
|
+
export const isGroupImpl = (u: unknown): u is Any =>
|
|
43
|
+
Predicate.hasProperty(u, TypeId);
|
|
44
|
+
|
|
45
|
+
export interface AnyFinalized extends GroupImpl<string, "Finalized"> {}
|
|
46
|
+
export interface AnyUnfinalized extends GroupImpl<string, "Unfinalized"> {}
|
|
47
|
+
|
|
48
|
+
export const isFinalizedGroupImpl = (u: unknown): u is AnyFinalized =>
|
|
49
|
+
isGroupImpl(u) && u.finalizationStatus === "Finalized";
|
|
50
|
+
|
|
51
|
+
export const isUnfinalizedGroupImpl = (u: unknown): u is AnyUnfinalized =>
|
|
52
|
+
isGroupImpl(u) && u.finalizationStatus === "Unfinalized";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Build the runtime tag for a `GroupImpl` service. The finalization status is
|
|
56
|
+
* embedded in the tag string so that `Unfinalized` and `Finalized` are distinct
|
|
57
|
+
* services at runtime; consumers of a finalized layer (the server's
|
|
58
|
+
* `RegisteredFunctions.buildForGroup` and the CLI's `implValidation`) retrieve
|
|
59
|
+
* the typed `Finalized` service directly rather than scanning the context.
|
|
60
|
+
*/
|
|
61
|
+
export const GroupImpl = <
|
|
62
|
+
GroupPath_ extends string,
|
|
63
|
+
FinalizationStatus_ extends FinalizationStatus,
|
|
64
|
+
>({
|
|
12
65
|
groupPath,
|
|
66
|
+
finalizationStatus,
|
|
13
67
|
}: {
|
|
14
68
|
groupPath: GroupPath_;
|
|
69
|
+
finalizationStatus: FinalizationStatus_;
|
|
15
70
|
}) =>
|
|
16
|
-
Context.GenericTag<GroupImpl<GroupPath_>>(
|
|
17
|
-
`@confect/server/GroupImpl/${groupPath}`,
|
|
71
|
+
Context.GenericTag<GroupImpl<GroupPath_, FinalizationStatus_>>(
|
|
72
|
+
`@confect/server/GroupImpl/${finalizationStatus}/${groupPath}`,
|
|
18
73
|
);
|
|
19
74
|
|
|
20
75
|
export const make = <
|
|
21
76
|
Api_ extends Api.AnyWithProps,
|
|
22
|
-
|
|
77
|
+
Group extends GroupSpec.AnyWithProps,
|
|
23
78
|
>(
|
|
24
|
-
|
|
25
|
-
|
|
79
|
+
api: Api_,
|
|
80
|
+
group: Group,
|
|
26
81
|
): Layer.Layer<
|
|
27
|
-
GroupImpl<
|
|
82
|
+
GroupImpl<string, "Unfinalized">,
|
|
28
83
|
never,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
84
|
+
FunctionImpl.FromGroupSpec<Group>
|
|
85
|
+
> => {
|
|
86
|
+
const groupPath = resolveGroupPathUnsafe(api.spec, group);
|
|
87
|
+
|
|
88
|
+
return Layer.succeed(
|
|
89
|
+
GroupImpl<string, "Unfinalized">({
|
|
34
90
|
groupPath,
|
|
91
|
+
finalizationStatus: "Unfinalized",
|
|
35
92
|
}),
|
|
36
93
|
{
|
|
94
|
+
[TypeId]: TypeId,
|
|
37
95
|
groupPath,
|
|
96
|
+
finalizationStatus: "Unfinalized" as const,
|
|
97
|
+
registeredFunctionNames: [],
|
|
38
98
|
},
|
|
39
99
|
) as Layer.Layer<
|
|
40
|
-
GroupImpl<
|
|
100
|
+
GroupImpl<string, "Unfinalized">,
|
|
41
101
|
never,
|
|
42
|
-
|
|
43
|
-
| FunctionImpl.FromGroupAtPath<GroupPath_, Api.Groups<Api_>>
|
|
102
|
+
FunctionImpl.FromGroupSpec<Group>
|
|
44
103
|
>;
|
|
104
|
+
};
|
|
45
105
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
: Groups extends GroupSpec.AnyWithProps
|
|
49
|
-
? GroupImpl<GroupSpec.Name<Groups>>
|
|
50
|
-
: never;
|
|
106
|
+
const isFunctionShaped = (value: unknown): boolean =>
|
|
107
|
+
Predicate.isRecord(value) && "functionSpec" in value;
|
|
51
108
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Walk a `RegistryItems` tree to the entries at `groupPath` and return the
|
|
111
|
+
* names of the function-shaped leaves directly underneath.
|
|
112
|
+
*/
|
|
113
|
+
const collectFunctionNamesAtPath = (
|
|
114
|
+
items: Registry.RegistryItems,
|
|
115
|
+
groupPath: string,
|
|
116
|
+
): ReadonlyArray<string> =>
|
|
117
|
+
pipe(
|
|
118
|
+
String.split(groupPath, "."),
|
|
119
|
+
Array.reduce(Option.some<unknown>(items), (acc, segment) =>
|
|
120
|
+
acc.pipe(
|
|
121
|
+
Option.filter(Predicate.isRecord),
|
|
122
|
+
Option.flatMap((node) =>
|
|
123
|
+
segment in node ? Option.some(node[segment]) : Option.none(),
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
Option.filter(Predicate.isRecord),
|
|
128
|
+
Option.map(Record.toEntries),
|
|
129
|
+
Option.map(
|
|
130
|
+
Array.filterMap(([name, value]) =>
|
|
131
|
+
isFunctionShaped(value) ? Option.some(name) : Option.none(),
|
|
132
|
+
),
|
|
133
|
+
),
|
|
134
|
+
Option.getOrElse((): ReadonlyArray<string> => []),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const findUnfinalizedGroupImpl = <S>(
|
|
138
|
+
context: Context.Context<S>,
|
|
139
|
+
): Option.Option<AnyUnfinalized> =>
|
|
140
|
+
Array.findFirst(context.unsafeMap.values(), isUnfinalizedGroupImpl);
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Mark a `GroupImpl` layer as fully implemented. The parameter type defaults
|
|
144
|
+
* `RIn = never`, so passing a layer that still requires any `FunctionImpl`
|
|
145
|
+
* service produces a type error at the impl author's site. The codegen
|
|
146
|
+
* boundary requires the resulting `"Finalized"` brand, so omitting this call
|
|
147
|
+
* is also rejected downstream.
|
|
148
|
+
*
|
|
149
|
+
* As a side effect of finalization, the names of every `FunctionImpl` that
|
|
150
|
+
* registered into this group's scope are snapshotted onto the produced
|
|
151
|
+
* service value's `registeredFunctionNames` field, so consumers can verify
|
|
152
|
+
* impl completeness against a `GroupSpec`'s expected functions without
|
|
153
|
+
* having to inspect the `Registry` themselves.
|
|
154
|
+
*/
|
|
155
|
+
export const finalize = <GroupPath_ extends string>(
|
|
156
|
+
group: Layer.Layer<GroupImpl<GroupPath_, "Unfinalized">>,
|
|
157
|
+
): Layer.Layer<GroupImpl<GroupPath_, "Finalized">> =>
|
|
158
|
+
Layer.flatMap(
|
|
159
|
+
group,
|
|
160
|
+
(context): Layer.Layer<GroupImpl<GroupPath_, "Finalized">> =>
|
|
161
|
+
findUnfinalizedGroupImpl(context).pipe(
|
|
162
|
+
Option.match({
|
|
163
|
+
onNone: () =>
|
|
164
|
+
Layer.die(
|
|
165
|
+
new Error(
|
|
166
|
+
"GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context.",
|
|
167
|
+
),
|
|
168
|
+
),
|
|
169
|
+
onSome: (unfinalized) => {
|
|
170
|
+
const groupPath = unfinalized.groupPath as GroupPath_;
|
|
171
|
+
return Layer.effect(
|
|
172
|
+
GroupImpl<GroupPath_, "Finalized">({
|
|
173
|
+
groupPath,
|
|
174
|
+
finalizationStatus: "Finalized",
|
|
175
|
+
}),
|
|
176
|
+
Effect.gen(function* () {
|
|
177
|
+
const registry = yield* Registry.Registry;
|
|
178
|
+
const items = yield* Ref.get(registry);
|
|
179
|
+
return {
|
|
180
|
+
[TypeId]: TypeId,
|
|
181
|
+
groupPath,
|
|
182
|
+
finalizationStatus: "Finalized" as const,
|
|
183
|
+
registeredFunctionNames: collectFunctionNamesAtPath(
|
|
184
|
+
items,
|
|
185
|
+
groupPath,
|
|
186
|
+
),
|
|
187
|
+
};
|
|
188
|
+
}),
|
|
189
|
+
);
|
|
190
|
+
},
|
|
191
|
+
}),
|
|
192
|
+
),
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
export type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =
|
|
196
|
+
FunctionImpl.FromGroupSpec<Group>;
|
package/src/GroupPath.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
2
|
+
import type * as Spec from "@confect/core/Spec";
|
|
3
|
+
import { Array, Option, pipe, Record } from "effect";
|
|
4
|
+
|
|
5
|
+
const resolveGroupPathInGroup = (
|
|
6
|
+
group: GroupSpec.AnyWithProps,
|
|
7
|
+
target: GroupSpec.AnyWithProps,
|
|
8
|
+
pathSegments: ReadonlyArray<string>,
|
|
9
|
+
): Option.Option<string> =>
|
|
10
|
+
pipe(
|
|
11
|
+
Record.toEntries(group.groups),
|
|
12
|
+
Array.findFirst(([name, child]) =>
|
|
13
|
+
child === target
|
|
14
|
+
? Option.some(Array.join([...pathSegments, name], "."))
|
|
15
|
+
: resolveGroupPathInGroup(child, target, [...pathSegments, name]),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const resolveGroupPath = (
|
|
20
|
+
spec: Spec.AnyWithProps,
|
|
21
|
+
target: GroupSpec.AnyWithProps,
|
|
22
|
+
): Option.Option<string> =>
|
|
23
|
+
pipe(
|
|
24
|
+
Record.toEntries(spec.groups),
|
|
25
|
+
Array.findFirst(([name, group]) =>
|
|
26
|
+
group === target
|
|
27
|
+
? Option.some(name)
|
|
28
|
+
: resolveGroupPathInGroup(group, target, [name]),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const resolveGroupPathUnsafe = (
|
|
33
|
+
spec: Spec.AnyWithProps,
|
|
34
|
+
target: GroupSpec.AnyWithProps,
|
|
35
|
+
): string =>
|
|
36
|
+
resolveGroupPath(spec, target).pipe(
|
|
37
|
+
Option.getOrThrowWith(
|
|
38
|
+
() =>
|
|
39
|
+
new Error(
|
|
40
|
+
"Could not resolve group path for the provided GroupSpec. Ensure the spec is part of the assembled API spec tree.",
|
|
41
|
+
),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type * as FunctionSpec from "@confect/core/FunctionSpec";
|
|
2
2
|
import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
3
|
+
import * as Registry from "@confect/core/Registry";
|
|
3
4
|
import type * as Spec from "@confect/core/Spec";
|
|
4
|
-
import
|
|
5
|
-
|
|
5
|
+
import {
|
|
6
|
+
Array,
|
|
7
|
+
Effect,
|
|
8
|
+
type Layer,
|
|
9
|
+
Option,
|
|
10
|
+
pipe,
|
|
11
|
+
Predicate,
|
|
12
|
+
Ref,
|
|
13
|
+
String,
|
|
14
|
+
type Types,
|
|
15
|
+
} from "effect";
|
|
6
16
|
import type * as Api from "./Api";
|
|
7
|
-
import * as
|
|
17
|
+
import type * as GroupImpl from "./GroupImpl";
|
|
8
18
|
import { mapLeaves } from "./internal/utils";
|
|
9
19
|
import type * as RegisteredFunction from "./RegisteredFunction";
|
|
10
|
-
import * as Registry from "./Registry";
|
|
11
20
|
import * as RegistryItem from "./RegistryItem";
|
|
12
21
|
|
|
13
22
|
export type RegisteredFunctions<Spec_ extends Spec.AnyWithProps> =
|
|
@@ -49,34 +58,75 @@ export interface AnyWithProps {
|
|
|
49
58
|
readonly [key: string]: RegisteredFunction.Any | AnyWithProps;
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
type RegisteredFunctionsAtPath<
|
|
62
|
+
Tree,
|
|
63
|
+
Path extends string,
|
|
64
|
+
> = Path extends `${infer Head}.${infer Tail}`
|
|
65
|
+
? Head extends keyof Tree
|
|
66
|
+
? Tree[Head] extends AnyWithProps
|
|
67
|
+
? RegisteredFunctionsAtPath<Tree[Head], Tail>
|
|
68
|
+
: never
|
|
69
|
+
: never
|
|
70
|
+
: Path extends keyof Tree
|
|
71
|
+
? Tree[Path]
|
|
72
|
+
: never;
|
|
73
|
+
|
|
74
|
+
export type ForGroupPath<
|
|
75
|
+
Spec_ extends Spec.AnyWithProps,
|
|
76
|
+
Path extends string,
|
|
77
|
+
> = RegisteredFunctionsAtPath<RegisteredFunctions<Spec_>, Path>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Build the registered Convex functions for a single group from its finalized
|
|
81
|
+
* `GroupImpl` layer.
|
|
82
|
+
*
|
|
83
|
+
* The `groupLayer` parameter requires `GroupImpl<string, "Finalized">`, so
|
|
84
|
+
* impls that were never piped through `GroupImpl.finalize` (and impls with
|
|
85
|
+
* unmet `FunctionImpl` requirements, which cannot be finalized) are rejected
|
|
86
|
+
* at the codegen boundary, not just deep inside Convex at runtime.
|
|
87
|
+
*/
|
|
88
|
+
export const buildForGroup = <
|
|
89
|
+
Api_ extends Api.AnyWithProps,
|
|
90
|
+
const GroupPath_ extends string,
|
|
91
|
+
>(
|
|
92
|
+
api: Api_,
|
|
93
|
+
groupPath: GroupPath_,
|
|
94
|
+
groupLayer: Layer.Layer<GroupImpl.GroupImpl<string, "Finalized">>,
|
|
54
95
|
makeRegisteredFunction: (
|
|
55
96
|
api: Api_,
|
|
56
97
|
registryItem: RegistryItem.AnyWithProps,
|
|
57
98
|
) => RegisteredFunction.Any,
|
|
58
|
-
) =>
|
|
59
|
-
Effect.gen(function* () {
|
|
99
|
+
): ForGroupPath<Api_["spec"], GroupPath_> => {
|
|
100
|
+
const registryItems = Effect.gen(function* () {
|
|
60
101
|
const registry = yield* Registry.Registry;
|
|
61
|
-
|
|
62
|
-
|
|
102
|
+
return yield* Ref.get(registry);
|
|
103
|
+
}).pipe(Effect.provide(groupLayer), Effect.runSync);
|
|
63
104
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
const registeredFunctions = mapLeaves<
|
|
106
|
+
RegistryItem.AnyWithProps,
|
|
107
|
+
RegisteredFunction.Any
|
|
108
|
+
>(
|
|
109
|
+
registryItems as { [key: string]: RegistryItem.AnyWithProps },
|
|
110
|
+
RegistryItem.isRegistryItem,
|
|
111
|
+
(registryItem) => makeRegisteredFunction(api, registryItem),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
return pipe(
|
|
115
|
+
String.split(groupPath, "."),
|
|
116
|
+
Array.reduce(
|
|
117
|
+
Option.some<unknown>(registeredFunctions),
|
|
118
|
+
(currentNode, segment) =>
|
|
119
|
+
currentNode.pipe(
|
|
120
|
+
Option.filter(Predicate.isRecord),
|
|
121
|
+
Option.flatMap((nodeRecord) =>
|
|
122
|
+
segment in nodeRecord
|
|
123
|
+
? Option.some(nodeRecord[segment])
|
|
124
|
+
: Option.none(),
|
|
125
|
+
),
|
|
78
126
|
),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
127
|
+
),
|
|
128
|
+
Option.getOrThrowWith(
|
|
129
|
+
() => new Error(`No functions registered for group path "${groupPath}"`),
|
|
130
|
+
),
|
|
131
|
+
) as ForGroupPath<Api_["spec"], GroupPath_>;
|
|
132
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,6 @@ export * as FunctionImpl from "./FunctionImpl";
|
|
|
15
15
|
export * as GroupImpl from "./GroupImpl";
|
|
16
16
|
export * as Handler from "./Handler";
|
|
17
17
|
export * as HttpApi from "./HttpApi";
|
|
18
|
-
export * as Impl from "./Impl";
|
|
19
18
|
export * as MutationCtx from "./MutationCtx";
|
|
20
19
|
export * as MutationRunner from "./MutationRunner";
|
|
21
20
|
export * as OrderedQuery from "./OrderedQuery";
|
|
@@ -25,7 +24,6 @@ export * as QueryRunner from "./QueryRunner";
|
|
|
25
24
|
export * as RegisteredConvexFunction from "./RegisteredConvexFunction";
|
|
26
25
|
export * as RegisteredFunction from "./RegisteredFunction";
|
|
27
26
|
export * as RegisteredFunctions from "./RegisteredFunctions";
|
|
28
|
-
export * as Registry from "./Registry";
|
|
29
27
|
export * as RegistryItem from "./RegistryItem";
|
|
30
28
|
export * as Scheduler from "./Scheduler";
|
|
31
29
|
export * as SchemaToValidator from "./SchemaToValidator";
|
package/dist/Impl.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AnyWithProps as AnyWithProps$1, Groups } from "./Api.js";
|
|
2
|
-
import { FromGroups } from "./GroupImpl.js";
|
|
3
|
-
import { Context, Layer } from "effect";
|
|
4
|
-
|
|
5
|
-
//#region src/Impl.d.ts
|
|
6
|
-
declare namespace Impl_d_exports {
|
|
7
|
-
export { AnyWithProps, FinalizationStatus, Impl, TypeId, finalize, isImpl, make };
|
|
8
|
-
}
|
|
9
|
-
declare const TypeId = "@confect/server/Impl";
|
|
10
|
-
type TypeId = typeof TypeId;
|
|
11
|
-
declare const isImpl: (u: unknown) => u is AnyWithProps;
|
|
12
|
-
interface Impl<Api_ extends AnyWithProps$1, FinalizationStatus_ extends FinalizationStatus> {
|
|
13
|
-
readonly [TypeId]: TypeId;
|
|
14
|
-
readonly api: Api_;
|
|
15
|
-
readonly finalizationStatus: FinalizationStatus_;
|
|
16
|
-
}
|
|
17
|
-
type FinalizationStatus = "Unfinalized" | "Finalized";
|
|
18
|
-
interface AnyWithProps extends Impl<AnyWithProps$1, FinalizationStatus> {}
|
|
19
|
-
declare const Impl: <Api_ extends AnyWithProps$1, FinalizationStatus_ extends FinalizationStatus>() => Context.Tag<Impl<Api_, FinalizationStatus_>, Impl<Api_, FinalizationStatus_>>;
|
|
20
|
-
declare const make: <Api_ extends AnyWithProps$1>(api: Api_) => Layer.Layer<Impl<Api_, "Unfinalized">, never, FromGroups<Groups<Api_>>>;
|
|
21
|
-
declare const finalize: <Api_ extends AnyWithProps$1>(impl: Layer.Layer<Impl<Api_, "Unfinalized">>) => Layer.Layer<Impl<Api_, "Finalized">>;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { AnyWithProps, FinalizationStatus, Impl, Impl_d_exports, TypeId, finalize, isImpl, make };
|
|
24
|
-
//# sourceMappingURL=Impl.d.ts.map
|
package/dist/Impl.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Impl.d.ts","names":[],"sources":["../src/Impl.ts"],"mappings":";;;;;;;;cAKa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,MAAA,GAAU,CAAA,cAAa,CAAA,IAAK,YAAA;AAAA,UAGxB,IAAA,cACF,cAAA,8BACe,kBAAA;EAAA,UAElB,MAAA,GAAS,MAAA;EAAA,SACV,GAAA,EAAK,IAAA;EAAA,SACL,kBAAA,EAAoB,mBAAA;AAAA;AAAA,KAGnB,kBAAA;AAAA,UAEK,YAAA,SAAqB,IAAA,CACpC,cAAA,EACA,kBAAA;AAAA,cAGW,IAAA,gBACE,cAAA,8BACe,kBAAA,OAAkB,OAAA,CAAA,GAAA,CAAA,IAAA,CAAA,IAAA,EAAA,mBAAA,GAAA,IAAA,CAAA,IAAA,EAAA,mBAAA;AAAA,cAInC,IAAA,gBAAqB,cAAA,EAChC,GAAA,EAAK,IAAA,KACJ,KAAA,CAAM,KAAA,CACP,IAAA,CAAK,IAAA,yBAEL,UAAA,CAAqB,MAAA,CAAU,IAAA;AAAA,cAWpB,QAAA,gBAAyB,cAAA,EACpC,IAAA,EAAM,KAAA,CAAM,KAAA,CAAM,IAAA,CAAK,IAAA,sBACtB,KAAA,CAAM,KAAA,CAAM,IAAA,CAAK,IAAA"}
|
package/dist/Impl.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { Context, Effect, Layer, Predicate } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region src/Impl.ts
|
|
5
|
-
var Impl_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
-
Impl: () => Impl,
|
|
7
|
-
TypeId: () => TypeId,
|
|
8
|
-
finalize: () => finalize,
|
|
9
|
-
isImpl: () => isImpl,
|
|
10
|
-
make: () => make
|
|
11
|
-
});
|
|
12
|
-
const TypeId = "@confect/server/Impl";
|
|
13
|
-
const isImpl = (u) => Predicate.hasProperty(u, TypeId);
|
|
14
|
-
const Impl = () => Context.GenericTag(`@confect/server/Impl`);
|
|
15
|
-
const make = (api) => Layer.effect(Impl(), Effect.succeed({
|
|
16
|
-
[TypeId]: TypeId,
|
|
17
|
-
api,
|
|
18
|
-
finalizationStatus: "Unfinalized"
|
|
19
|
-
}));
|
|
20
|
-
const finalize = (impl) => Layer.map(impl, (context) => Context.make(Impl(), {
|
|
21
|
-
[TypeId]: TypeId,
|
|
22
|
-
api: Context.get(context, Impl()).api,
|
|
23
|
-
finalizationStatus: "Finalized"
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { Impl, Impl_exports, TypeId, finalize, isImpl, make };
|
|
28
|
-
//# sourceMappingURL=Impl.js.map
|
package/dist/Impl.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Impl.js","names":[],"sources":["../src/Impl.ts"],"sourcesContent":["import { Context, Effect, Layer, Predicate } from \"effect\";\nimport type * as Api from \"./Api\";\nimport type { Groups as ApiGroups } from \"./Api\";\nimport type * as GroupImpl from \"./GroupImpl\";\n\nexport const TypeId = \"@confect/server/Impl\";\nexport type TypeId = typeof TypeId;\n\nexport const isImpl = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface Impl<\n Api_ extends Api.AnyWithProps,\n FinalizationStatus_ extends FinalizationStatus,\n> {\n readonly [TypeId]: TypeId;\n readonly api: Api_;\n readonly finalizationStatus: FinalizationStatus_;\n}\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface AnyWithProps extends Impl<\n Api.AnyWithProps,\n FinalizationStatus\n> {}\n\nexport const Impl = <\n Api_ extends Api.AnyWithProps,\n FinalizationStatus_ extends FinalizationStatus,\n>() =>\n Context.GenericTag<Impl<Api_, FinalizationStatus_>>(`@confect/server/Impl`);\n\nexport const make = <Api_ extends Api.AnyWithProps>(\n api: Api_,\n): Layer.Layer<\n Impl<Api_, \"Unfinalized\">,\n never,\n GroupImpl.FromGroups<ApiGroups<Api_>>\n> =>\n Layer.effect(\n Impl<Api_, \"Unfinalized\">(),\n Effect.succeed({\n [TypeId]: TypeId,\n api,\n finalizationStatus: \"Unfinalized\" as const,\n }),\n );\n\nexport const finalize = <Api_ extends Api.AnyWithProps>(\n impl: Layer.Layer<Impl<Api_, \"Unfinalized\">>,\n): Layer.Layer<Impl<Api_, \"Finalized\">> =>\n Layer.map(impl, (context) =>\n Context.make(Impl<Api_, \"Finalized\">(), {\n [TypeId]: TypeId,\n api: Context.get(context, Impl<Api_, \"Unfinalized\">()).api,\n finalizationStatus: \"Finalized\",\n }),\n );\n"],"mappings":";;;;;;;;;;;AAKA,MAAa,SAAS;AAGtB,MAAa,UAAU,MACrB,UAAU,YAAY,GAAG,OAAO;AAkBlC,MAAa,aAIX,QAAQ,WAA4C,uBAAuB;AAE7E,MAAa,QACX,QAMA,MAAM,OACJ,MAA2B,EAC3B,OAAO,QAAQ;EACZ,SAAS;CACV;CACA,oBAAoB;CACrB,CAAC,CACH;AAEH,MAAa,YACX,SAEA,MAAM,IAAI,OAAO,YACf,QAAQ,KAAK,MAAyB,EAAE;EACrC,SAAS;CACV,KAAK,QAAQ,IAAI,SAAS,MAA2B,CAAC,CAAC;CACvD,oBAAoB;CACrB,CAAC,CACH"}
|
package/dist/Registry.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AnyWithProps } from "./RegistryItem.js";
|
|
2
|
-
import { Context, Ref } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region src/Registry.d.ts
|
|
5
|
-
declare namespace Registry_d_exports {
|
|
6
|
-
export { Registry, RegistryItems };
|
|
7
|
-
}
|
|
8
|
-
interface RegistryItems {
|
|
9
|
-
readonly [key: string]: AnyWithProps | RegistryItems;
|
|
10
|
-
}
|
|
11
|
-
declare const Registry_base: Context.ReferenceClass<Registry, "@confect/server/Registry", Ref.Ref<RegistryItems>>;
|
|
12
|
-
declare class Registry extends Registry_base {}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { Registry, RegistryItems, Registry_d_exports };
|
|
15
|
-
//# sourceMappingURL=Registry.d.ts.map
|
package/dist/Registry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.d.ts","names":[],"sources":["../src/Registry.ts"],"mappings":";;;;;;;UAGiB,aAAA;EAAA,UACL,GAAA,WAAc,YAAA,GAA4B,aAAA;AAAA;AAAA,cACrD,aAAA;cAEY,QAAA,SAAiB,aAAA"}
|
package/dist/Registry.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { Context, Ref } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region src/Registry.ts
|
|
5
|
-
var Registry_exports = /* @__PURE__ */ __exportAll({ Registry: () => Registry });
|
|
6
|
-
var Registry = class extends Context.Reference()("@confect/server/Registry", { defaultValue: () => Ref.unsafeMake({}) }) {};
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { Registry, Registry_exports };
|
|
10
|
-
//# sourceMappingURL=Registry.js.map
|
package/dist/Registry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import { Context, Ref } from \"effect\";\nimport type * as RegistryItem from \"./RegistryItem\";\n\nexport interface RegistryItems {\n readonly [key: string]: RegistryItem.AnyWithProps | RegistryItems;\n}\n\nexport class Registry extends Context.Reference<Registry>()(\n \"@confect/server/Registry\",\n {\n defaultValue: () => Ref.unsafeMake<RegistryItems>({}),\n },\n) {}\n"],"mappings":";;;;;AAOA,IAAa,WAAb,cAA8B,QAAQ,WAAqB,CACzD,4BACA,EACE,oBAAoB,IAAI,WAA0B,EAAE,CAAC,EACtD,CACF,CAAC"}
|
package/src/Impl.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Predicate } from "effect";
|
|
2
|
-
import type * as Api from "./Api";
|
|
3
|
-
import type { Groups as ApiGroups } from "./Api";
|
|
4
|
-
import type * as GroupImpl from "./GroupImpl";
|
|
5
|
-
|
|
6
|
-
export const TypeId = "@confect/server/Impl";
|
|
7
|
-
export type TypeId = typeof TypeId;
|
|
8
|
-
|
|
9
|
-
export const isImpl = (u: unknown): u is AnyWithProps =>
|
|
10
|
-
Predicate.hasProperty(u, TypeId);
|
|
11
|
-
|
|
12
|
-
export interface Impl<
|
|
13
|
-
Api_ extends Api.AnyWithProps,
|
|
14
|
-
FinalizationStatus_ extends FinalizationStatus,
|
|
15
|
-
> {
|
|
16
|
-
readonly [TypeId]: TypeId;
|
|
17
|
-
readonly api: Api_;
|
|
18
|
-
readonly finalizationStatus: FinalizationStatus_;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type FinalizationStatus = "Unfinalized" | "Finalized";
|
|
22
|
-
|
|
23
|
-
export interface AnyWithProps extends Impl<
|
|
24
|
-
Api.AnyWithProps,
|
|
25
|
-
FinalizationStatus
|
|
26
|
-
> {}
|
|
27
|
-
|
|
28
|
-
export const Impl = <
|
|
29
|
-
Api_ extends Api.AnyWithProps,
|
|
30
|
-
FinalizationStatus_ extends FinalizationStatus,
|
|
31
|
-
>() =>
|
|
32
|
-
Context.GenericTag<Impl<Api_, FinalizationStatus_>>(`@confect/server/Impl`);
|
|
33
|
-
|
|
34
|
-
export const make = <Api_ extends Api.AnyWithProps>(
|
|
35
|
-
api: Api_,
|
|
36
|
-
): Layer.Layer<
|
|
37
|
-
Impl<Api_, "Unfinalized">,
|
|
38
|
-
never,
|
|
39
|
-
GroupImpl.FromGroups<ApiGroups<Api_>>
|
|
40
|
-
> =>
|
|
41
|
-
Layer.effect(
|
|
42
|
-
Impl<Api_, "Unfinalized">(),
|
|
43
|
-
Effect.succeed({
|
|
44
|
-
[TypeId]: TypeId,
|
|
45
|
-
api,
|
|
46
|
-
finalizationStatus: "Unfinalized" as const,
|
|
47
|
-
}),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export const finalize = <Api_ extends Api.AnyWithProps>(
|
|
51
|
-
impl: Layer.Layer<Impl<Api_, "Unfinalized">>,
|
|
52
|
-
): Layer.Layer<Impl<Api_, "Finalized">> =>
|
|
53
|
-
Layer.map(impl, (context) =>
|
|
54
|
-
Context.make(Impl<Api_, "Finalized">(), {
|
|
55
|
-
[TypeId]: TypeId,
|
|
56
|
-
api: Context.get(context, Impl<Api_, "Unfinalized">()).api,
|
|
57
|
-
finalizationStatus: "Finalized",
|
|
58
|
-
}),
|
|
59
|
-
);
|
package/src/Registry.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Context, Ref } from "effect";
|
|
2
|
-
import type * as RegistryItem from "./RegistryItem";
|
|
3
|
-
|
|
4
|
-
export interface RegistryItems {
|
|
5
|
-
readonly [key: string]: RegistryItem.AnyWithProps | RegistryItems;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class Registry extends Context.Reference<Registry>()(
|
|
9
|
-
"@confect/server/Registry",
|
|
10
|
-
{
|
|
11
|
-
defaultValue: () => Ref.unsafeMake<RegistryItems>({}),
|
|
12
|
-
},
|
|
13
|
-
) {}
|