@confect/test 9.2.4 → 10.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 +27 -9
- package/dist/TestConfect.d.ts +5 -6
- package/dist/TestConfect.d.ts.map +1 -1
- package/dist/TestConfect.js +4 -7
- package/dist/TestConfect.js.map +1 -1
- package/dist/_virtual/_rolldown/runtime.js +11 -6
- package/dist/index.js +2 -1
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +8 -9
- package/src/TestConfect.ts +13 -15
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@confect/test",
|
|
3
3
|
"description": "Utilities for testing Confect apps without a live Convex backend",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "10.0.0-next.1",
|
|
5
5
|
"author": "RJ Dellecese",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/rjdellecese/confect/issues"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@types/node": "
|
|
11
|
-
"effect": "
|
|
12
|
-
"tsdown": "0.
|
|
13
|
-
"typescript": "
|
|
14
|
-
"unrun": "0.3.1"
|
|
10
|
+
"@types/node": "25.3.3",
|
|
11
|
+
"effect": "4.0.0-beta.98",
|
|
12
|
+
"tsdown": "0.20.3",
|
|
13
|
+
"typescript": "5.9.3"
|
|
15
14
|
},
|
|
16
15
|
"engines": {
|
|
17
16
|
"node": ">=22"
|
|
@@ -48,9 +47,9 @@
|
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"convex": "^1.32.0",
|
|
50
49
|
"convex-test": ">=0.0.50 <0.1.0",
|
|
51
|
-
"effect": "^
|
|
52
|
-
"@confect/
|
|
53
|
-
"@confect/
|
|
50
|
+
"effect": "^4.0.0-beta.98",
|
|
51
|
+
"@confect/core": "^10.0.0-next.1",
|
|
52
|
+
"@confect/server": "^10.0.0-next.1"
|
|
54
53
|
},
|
|
55
54
|
"repository": {
|
|
56
55
|
"type": "git",
|
package/src/TestConfect.ts
CHANGED
|
@@ -13,7 +13,6 @@ import type {
|
|
|
13
13
|
UserIdentity,
|
|
14
14
|
} from "convex/server";
|
|
15
15
|
import type { Value } from "convex/values";
|
|
16
|
-
import type { ParseResult } from "effect";
|
|
17
16
|
import * as Context from "effect/Context";
|
|
18
17
|
import * as Effect from "effect/Effect";
|
|
19
18
|
import * as Layer from "effect/Layer";
|
|
@@ -27,21 +26,21 @@ export type TestConfectWithoutIdentity<
|
|
|
27
26
|
...args: Ref.OptionalArgs<QueryRef>
|
|
28
27
|
) => Effect.Effect<
|
|
29
28
|
Ref.Returns<QueryRef>,
|
|
30
|
-
Ref.Error<QueryRef> |
|
|
29
|
+
Ref.Error<QueryRef> | Schema.SchemaError
|
|
31
30
|
>;
|
|
32
31
|
mutation: <MutationRef extends Ref.AnyMutation>(
|
|
33
32
|
mutationRef: MutationRef,
|
|
34
33
|
...args: Ref.OptionalArgs<MutationRef>
|
|
35
34
|
) => Effect.Effect<
|
|
36
35
|
Ref.Returns<MutationRef>,
|
|
37
|
-
Ref.Error<MutationRef> |
|
|
36
|
+
Ref.Error<MutationRef> | Schema.SchemaError
|
|
38
37
|
>;
|
|
39
38
|
action: <ActionRef extends Ref.AnyAction>(
|
|
40
39
|
actionRef: ActionRef,
|
|
41
40
|
...args: Ref.OptionalArgs<ActionRef>
|
|
42
41
|
) => Effect.Effect<
|
|
43
42
|
Ref.Returns<ActionRef>,
|
|
44
|
-
Ref.Error<ActionRef> |
|
|
43
|
+
Ref.Error<ActionRef> | Schema.SchemaError
|
|
45
44
|
>;
|
|
46
45
|
run: {
|
|
47
46
|
<E>(
|
|
@@ -57,8 +56,8 @@ export type TestConfectWithoutIdentity<
|
|
|
57
56
|
E,
|
|
58
57
|
RegisteredConvexFunction.MutationServices<ConfectSchema>
|
|
59
58
|
>,
|
|
60
|
-
returns: Schema.
|
|
61
|
-
): Effect.Effect<A,
|
|
59
|
+
returns: Schema.Codec<A, B>,
|
|
60
|
+
): Effect.Effect<A, Schema.SchemaError>;
|
|
62
61
|
};
|
|
63
62
|
fetch: (
|
|
64
63
|
pathQueryFragment: string,
|
|
@@ -78,8 +77,7 @@ export type TestConfect<ConfectSchema extends DatabaseSchema.AnyWithProps> = {
|
|
|
78
77
|
|
|
79
78
|
export const TestConfect = <
|
|
80
79
|
ConfectSchema extends DatabaseSchema.AnyWithProps,
|
|
81
|
-
>() =>
|
|
82
|
-
Context.GenericTag<TestConfect<ConfectSchema>>("@confect/test/TestConfect");
|
|
80
|
+
>() => Context.Service<TestConfect<ConfectSchema>>("@confect/test/TestConfect");
|
|
83
81
|
|
|
84
82
|
class TestConfectImplWithoutIdentity<
|
|
85
83
|
ConfectSchema extends DatabaseSchema.AnyWithProps,
|
|
@@ -96,7 +94,7 @@ class TestConfectImplWithoutIdentity<
|
|
|
96
94
|
...args: Ref.OptionalArgs<QueryRef>
|
|
97
95
|
): Effect.Effect<
|
|
98
96
|
Ref.Returns<QueryRef>,
|
|
99
|
-
Ref.Error<QueryRef> |
|
|
97
|
+
Ref.Error<QueryRef> | Schema.SchemaError
|
|
100
98
|
> =>
|
|
101
99
|
Ref.runWithCodec(
|
|
102
100
|
queryRef,
|
|
@@ -110,7 +108,7 @@ class TestConfectImplWithoutIdentity<
|
|
|
110
108
|
...args: Ref.OptionalArgs<MutationRef>
|
|
111
109
|
): Effect.Effect<
|
|
112
110
|
Ref.Returns<MutationRef>,
|
|
113
|
-
Ref.Error<MutationRef> |
|
|
111
|
+
Ref.Error<MutationRef> | Schema.SchemaError
|
|
114
112
|
> =>
|
|
115
113
|
Ref.runWithCodec(
|
|
116
114
|
mutationRef,
|
|
@@ -124,7 +122,7 @@ class TestConfectImplWithoutIdentity<
|
|
|
124
122
|
...args: Ref.OptionalArgs<ActionRef>
|
|
125
123
|
): Effect.Effect<
|
|
126
124
|
Ref.Returns<ActionRef>,
|
|
127
|
-
Ref.Error<ActionRef> |
|
|
125
|
+
Ref.Error<ActionRef> | Schema.SchemaError
|
|
128
126
|
> =>
|
|
129
127
|
Ref.runWithCodec(
|
|
130
128
|
actionRef,
|
|
@@ -143,8 +141,8 @@ class TestConfectImplWithoutIdentity<
|
|
|
143
141
|
E,
|
|
144
142
|
RegisteredConvexFunction.MutationServices<ConfectSchema>
|
|
145
143
|
>,
|
|
146
|
-
returns?: Schema.
|
|
147
|
-
): Effect.Effect<void> | Effect.Effect<A,
|
|
144
|
+
returns?: Schema.Codec<A, B>,
|
|
145
|
+
): Effect.Effect<void> | Effect.Effect<A, Schema.SchemaError> => {
|
|
148
146
|
const makeMutationLayer = (
|
|
149
147
|
mutationCtx: GenericMutationCtx<
|
|
150
148
|
DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>
|
|
@@ -172,12 +170,12 @@ class TestConfectImplWithoutIdentity<
|
|
|
172
170
|
this.testConvex.run((mutationCtx) =>
|
|
173
171
|
Effect.runPromise(
|
|
174
172
|
handler.pipe(
|
|
175
|
-
Effect.andThen(Schema.
|
|
173
|
+
Effect.andThen(Schema.encodeEffect(returns)),
|
|
176
174
|
Effect.provide(makeMutationLayer(mutationCtx)),
|
|
177
175
|
),
|
|
178
176
|
),
|
|
179
177
|
),
|
|
180
|
-
).pipe(Effect.andThen(Schema.
|
|
178
|
+
).pipe(Effect.andThen(Schema.decodeEffect(returns)));
|
|
181
179
|
}) as TestConfectWithoutIdentity<ConfectSchema>["run"];
|
|
182
180
|
|
|
183
181
|
readonly fetch = <PathQueryFragment extends string>(
|