@confect/test 6.0.0 → 7.0.0

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 CHANGED
@@ -1,5 +1,133 @@
1
1
  # @confect/test
2
2
 
3
+ ## 7.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 90094d0: Add typed errors to Confect functions (queries, mutations, and actions). Declare an optional `error` schema in `FunctionSpec` and recover it as a typed value at every call site—`useQuery`, `useMutation`, `useAction`, `HttpClient`, `WebSocketClient`, and `TestConfect`—without paying for it on functions that don't fail.
8
+
9
+ Typed errors travel across the function boundary as Convex's native [`ConvexError`](https://docs.convex.dev/functions/error-handling/application-errors#throwing-application-errors): the encoded error sits in `ConvexError.data`, leaving the `returns` channel unsullied and preserving native Convex semantics for non-Confect callers of the same API.
10
+
11
+ ### Authoring a function with typed errors
12
+
13
+ `FunctionSpec` constructors now accept an optional `error` schema. To support multiple error shapes, combine them with `Schema.Union`.
14
+
15
+ ```ts
16
+ import { FunctionSpec, GenericId, GroupSpec } from "@confect/core";
17
+ import { Schema } from "effect";
18
+
19
+ export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
20
+ "NoteNotFound",
21
+ { noteId: GenericId.GenericId("notes") },
22
+ ) {}
23
+
24
+ export const notes = GroupSpec.make("notes").addFunction(
25
+ FunctionSpec.publicQuery({
26
+ name: "getOrFail",
27
+ args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
28
+ returns: Notes.Doc,
29
+ error: NoteNotFound,
30
+ }),
31
+ );
32
+ ```
33
+
34
+ The `FunctionImpl` for that ref can now `Effect.fail` (or `mapError` to) any value matching the declared schema. Whichever invocation path the caller takes—`useQuery`/`useMutation`/`useAction`, `HttpClient`, `WebSocketClient`, or `TestConfect`—Confect encodes the failure, transports it via `ConvexError`, and surfaces the decoded value in the appropriate channel for that call site.
35
+
36
+ ```ts
37
+ import { FunctionImpl } from "@confect/server";
38
+ import { Effect } from "effect";
39
+ import api from "../_generated/api";
40
+ import { DatabaseReader } from "../_generated/services";
41
+ import { NoteNotFound } from "./notes.spec";
42
+
43
+ const getOrFail = FunctionImpl.make(api, "notes", "getOrFail", ({ noteId }) =>
44
+ Effect.gen(function* () {
45
+ const reader = yield* DatabaseReader;
46
+ return yield* reader
47
+ .table("notes")
48
+ .get(noteId)
49
+ .pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
50
+ }),
51
+ );
52
+ ```
53
+
54
+ ### Consuming a typed error
55
+
56
+ `@confect/js` (`HttpClient`, `WebSocketClient`) and `@confect/test` (`TestConfect`) surface the decoded error in the `Effect` error channel alongside the existing `HttpClientError`/`WebSocketClientError`/`ParseError`:
57
+
58
+ ```ts
59
+ HttpClient.query(refs.public.notes.getOrFail, { noteId });
60
+ // Effect.Effect<Note, NoteNotFound | HttpClientError | ParseError>
61
+ ```
62
+
63
+ ### `@confect/react`—breaking changes
64
+
65
+ `useQuery`, `useMutation`, and `useAction` now expose typed errors, and `useQuery` returns a tagged result type instead of `Returns | undefined`.
66
+
67
+ **`useQuery` now returns `QueryResult<A, E>`.** Loading and (when an `error` schema is declared) failure are reified as variants alongside success. Match on the result with `QueryResult.match`:
68
+
69
+ Before:
70
+
71
+ ```tsx
72
+ const notes = useQuery(refs.public.notes.list, {});
73
+ if (notes === undefined) return <p>Loading…</p>;
74
+ return <NoteList notes={notes} />;
75
+ ```
76
+
77
+ After:
78
+
79
+ ```tsx
80
+ import { QueryResult, useQuery } from "@confect/react";
81
+
82
+ const notes = useQuery(refs.public.notes.list, {});
83
+ return QueryResult.match(notes, {
84
+ onLoading: (skipped) => (skipped ? null : <p>Loading…</p>),
85
+ onSuccess: (notes) => <NoteList notes={notes} />,
86
+ });
87
+ ```
88
+
89
+ The `Loading` variant carries a `skipped: boolean` flag, exposed as the argument to `onLoading`. It distinguishes a query that is genuinely in flight (`skipped: false`) from one that is sitting idle because `"skip"` was passed as its args (`skipped: true`)—a distinction `convex/react`'s plain `undefined` return value cannot make. Use it to render a loading indicator only when work is actually happening, and an empty/placeholder state otherwise.
90
+
91
+ When the ref declares an `error` schema, `onFailure` becomes required and receives the decoded typed error:
92
+
93
+ ```tsx
94
+ const lookup = useQuery(refs.public.notes.getOrFail, { noteId });
95
+ QueryResult.match(lookup, {
96
+ onLoading: (skipped) => (skipped ? null : "Looking up…"),
97
+ onSuccess: (note) => `Found: ${note.text}`,
98
+ onFailure: (error) => `Note ${error.noteId} not found.`,
99
+ });
100
+ ```
101
+
102
+ `QueryResult` is a Confect-native type exported from `@confect/react`.
103
+
104
+ **`useMutation` and `useAction` return `Promise<Either<A, E>>` when the ref declares an `error` schema.** Refs without an `error` schema continue to resolve to `Promise<A>`, matching the prior shape and `convex/react`'s behavior.
105
+
106
+ ```ts
107
+ const deleteOrFail = useMutation(refs.public.notes.deleteOrFail);
108
+ const result = await deleteOrFail({ noteId });
109
+ // Either.Either<null, NoteNotFound | Forbidden>
110
+ Either.match(result, {
111
+ onLeft: (error) => /* typed error */,
112
+ onRight: (value) => /* success */,
113
+ });
114
+
115
+ const deleteNote = useMutation(refs.public.notes.delete_); // no `error` schema
116
+ await deleteNote({ noteId }); // Promise<null>, as before
117
+ ```
118
+
119
+ Unspecified failures continue to reject the promise.
120
+
121
+ ### Migration
122
+ - For each `useQuery` call site, replace `result === undefined` checks and direct property access with `QueryResult.match` (or the lower-level `QueryResult.isLoading`/`isSuccess`/`isFailure` predicates).
123
+ - For each `useMutation`/`useAction` call site whose ref now declares an `error` schema, unwrap the resolved `Either` (e.g. with `Either.match`); call sites against refs without an `error` schema need no change.
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [90094d0]
128
+ - @confect/core@7.0.0
129
+ - @confect/server@7.0.0
130
+
3
131
  ## 6.0.0
4
132
 
5
133
  ### Minor Changes
@@ -9,9 +9,9 @@ declare namespace TestConfect_d_exports {
9
9
  export { TestConfect, TestConfectWithoutIdentity, layer };
10
10
  }
11
11
  type TestConfectWithoutIdentity<ConfectSchema extends DatabaseSchema.AnyWithProps> = {
12
- query: <QueryRef extends Ref.AnyQuery>(queryRef: QueryRef, ...args: Ref.OptionalArgs<QueryRef>) => Effect.Effect<Ref.Returns<QueryRef>, ParseResult.ParseError>;
13
- mutation: <MutationRef extends Ref.AnyMutation>(mutationRef: MutationRef, ...args: Ref.OptionalArgs<MutationRef>) => Effect.Effect<Ref.Returns<MutationRef>, ParseResult.ParseError>;
14
- action: <ActionRef extends Ref.AnyAction>(actionRef: ActionRef, ...args: Ref.OptionalArgs<ActionRef>) => Effect.Effect<Ref.Returns<ActionRef>, ParseResult.ParseError>;
12
+ query: <QueryRef extends Ref.AnyQuery>(queryRef: QueryRef, ...args: Ref.OptionalArgs<QueryRef>) => Effect.Effect<Ref.Returns<QueryRef>, Ref.Error<QueryRef> | ParseResult.ParseError>;
13
+ mutation: <MutationRef extends Ref.AnyMutation>(mutationRef: MutationRef, ...args: Ref.OptionalArgs<MutationRef>) => Effect.Effect<Ref.Returns<MutationRef>, Ref.Error<MutationRef> | ParseResult.ParseError>;
14
+ action: <ActionRef extends Ref.AnyAction>(actionRef: ActionRef, ...args: Ref.OptionalArgs<ActionRef>) => Effect.Effect<Ref.Returns<ActionRef>, Ref.Error<ActionRef> | ParseResult.ParseError>;
15
15
  run: {
16
16
  <E>(handler: Effect.Effect<void, E, RegisteredConvexFunction.MutationServices<ConfectSchema>>): Effect.Effect<void>;
17
17
  <A, B extends Value, E>(handler: Effect.Effect<A, E, RegisteredConvexFunction.MutationServices<ConfectSchema>>, returns: Schema.Schema<A, B>): Effect.Effect<A, ParseResult.ParseError>;
@@ -1 +1 @@
1
- {"version":3,"file":"TestConfect.d.ts","names":[],"sources":["../src/TestConfect.ts"],"mappings":";;;;;;;;;;KAaY,0BAAA,uBACY,cAAA,CAAe,YAAA;EAErC,KAAA,oBAAyB,GAAA,CAAI,QAAA,EAC3B,QAAA,EAAU,QAAA,KACP,IAAA,EAAM,GAAA,CAAI,YAAA,CAAa,QAAA,MACvB,MAAA,CAAO,MA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gBAAA,CAAiB,aAAA,IAE5C,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,CAAA,EAAG,CAAA,IACzB,MAAA,CAAO,MAAA,CAAO,CAAA,EAAG,WAAA,CAAY,UAAA;EAAA;EAElC,KAAA,GACE,iBAAA,UACA,IAAA,GAAO,WAAA,KACJ,MAAA,CAAO,MAAA,CAAO,QAAA;EACnB,kCAAA,QAA0C,MAAA,CAAO,MAAA;EACjD,2BAAA,GACE,aAAA,iBACG,MAAA,CAAO,MAAA;AAAA;AAAA,KAGF,WAAA,uBAAkC,cAAA,CAAe,YAAA;EAC3D,YAAA,GACE,YAAA,EAAc,OAAA,CAAQ,YAAA,MACnB,0BAAA,CAA2B,aAAA;AAAA,IAC9B,0BAAA,CAA2B,aAAA;AAAA,cAElB,WAAA,yBACW,cAAA,CAAe,YAAA,OAAY,OAAA,CAAA,GAAA,CAAA,WAAA,CAAA,aAAA,GAAA,WAAA,CAAA,aAAA;AAAA,cAmLtC,KAAA,2BACc,cAAA,CAAe,YAAA,EACtC,cAAA,EAAgB,eAAA,EAChB,OAAA,EAAS,MAAA,eAAqB,OAAA,iBAE5B,KAAA,CAAM,KAAA,CAAM,WAAA,CAAY,eAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"TestConfect.js","names":[],"sources":["../src/TestConfect.ts"],"sourcesContent":["import { Ref } from \"@confect/core\";\nimport type { DatabaseSchema, DataModel } from \"@confect/server\";\nimport { RegisteredConvexFunction } from \"@confect/server\";\nimport type {\n TestConvexForDataModel,\n TestConvexForDataModelAndIdentity,\n} from \"convex-test\";\nimport { convexTest } from \"convex-test\";\nimport type { GenericMutationCtx, UserIdentity } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport type { ParseResult } from \"effect\";\nimport { Context, Effect, Layer, Schema } from \"effect\";\n\nexport type TestConfectWithoutIdentity<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> = {\n query: <QueryRef extends Ref.AnyQuery>(\n queryRef: QueryRef,\n ...args: Ref.OptionalArgs<QueryRef>\n ) => Effect.Effect<Ref.Returns<QueryRef>, ParseResult.ParseError>;\n mutation: <MutationRef extends Ref.AnyMutation>(\n mutationRef: MutationRef,\n ...args: Ref.OptionalArgs<MutationRef>\n ) => Effect.Effect<Ref.Returns<MutationRef>, ParseResult.ParseError>;\n action: <ActionRef extends Ref.AnyAction>(\n actionRef: ActionRef,\n ...args: Ref.OptionalArgs<ActionRef>\n ) => Effect.Effect<Ref.Returns<ActionRef>, ParseResult.ParseError>;\n run: {\n <E>(\n handler: Effect.Effect<\n void,\n E,\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >,\n ): Effect.Effect<void>;\n <A, B extends Value, E>(\n handler: Effect.Effect<\n A,\n E,\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >,\n returns: Schema.Schema<A, B>,\n ): Effect.Effect<A, ParseResult.ParseError>;\n };\n fetch: (\n pathQueryFragment: string,\n init?: RequestInit,\n ) => Effect.Effect<Response>;\n finishInProgressScheduledFunctions: () => Effect.Effect<void>;\n finishAllScheduledFunctions: (\n advanceTimers: () => void,\n ) => Effect.Effect<void>;\n};\n\nexport type TestConfect<ConfectSchema extends DatabaseSchema.AnyWithProps> = {\n withIdentity: (\n userIdentity: Partial<UserIdentity>,\n ) => TestConfectWithoutIdentity<ConfectSchema>;\n} & TestConfectWithoutIdentity<ConfectSchema>;\n\nexport const TestConfect = <\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n>() =>\n Context.GenericTag<TestConfect<ConfectSchema>>(\"@confect/test/TestConfect\");\n\nclass TestConfectImplWithoutIdentity<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> implements TestConfectWithoutIdentity<ConfectSchema> {\n constructor(\n private confectSchema: ConfectSchema,\n private testConvex: TestConvexForDataModel<\n DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>\n >,\n ) {}\n\n readonly query = <QueryRef extends Ref.AnyQuery>(\n queryRef: QueryRef,\n ...args: Ref.OptionalArgs<QueryRef>\n ): Effect.Effect<Ref.Returns<QueryRef>, ParseResult.ParseError> =>\n Ref.runWithCodec(\n queryRef,\n (args[0] ?? {}) as Ref.Args<QueryRef>,\n (functionReference, encodedArgs) =>\n this.testConvex.query(functionReference, encodedArgs),\n );\n\n readonly mutation = <MutationRef extends Ref.AnyMutation>(\n mutationRef: MutationRef,\n ...args: Ref.OptionalArgs<MutationRef>\n ): Effect.Effect<Ref.Returns<MutationRef>, ParseResult.ParseError> =>\n Ref.runWithCodec(\n mutationRef,\n (args[0] ?? {}) as Ref.Args<MutationRef>,\n (functionReference, encodedArgs) =>\n this.testConvex.mutation(functionReference, encodedArgs),\n );\n\n readonly action = <ActionRef extends Ref.AnyAction>(\n actionRef: ActionRef,\n ...args: Ref.OptionalArgs<ActionRef>\n ): Effect.Effect<Ref.Returns<ActionRef>, ParseResult.ParseError> =>\n Ref.runWithCodec(\n actionRef,\n (args[0] ?? {}) as Ref.Args<ActionRef>,\n (functionReference, encodedArgs) =>\n this.testConvex.action(functionReference, encodedArgs),\n );\n\n readonly run: TestConfectWithoutIdentity<ConfectSchema>[\"run\"] = (<\n A,\n B extends Value,\n E,\n >(\n handler: Effect.Effect<\n A,\n E,\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >,\n returns?: Schema.Schema<A, B>,\n ): Effect.Effect<void> | Effect.Effect<A, ParseResult.ParseError> => {\n const makeMutationLayer = (\n mutationCtx: GenericMutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>\n >,\n ): Layer.Layer<RegisteredConvexFunction.MutationServices<ConfectSchema>> =>\n RegisteredConvexFunction.mutationLayer(\n this.confectSchema,\n mutationCtx,\n ) as Layer.Layer<\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >;\n\n return returns === undefined\n ? Effect.promise(() =>\n this.testConvex.run((mutationCtx) =>\n Effect.runPromise(\n handler.pipe(\n Effect.asVoid,\n Effect.provide(makeMutationLayer(mutationCtx)),\n ),\n ),\n ),\n )\n : Effect.promise(() =>\n this.testConvex.run((mutationCtx) =>\n Effect.runPromise(\n handler.pipe(\n Effect.andThen(Schema.encode(returns)),\n Effect.provide(makeMutationLayer(mutationCtx)),\n ),\n ),\n ),\n ).pipe(Effect.andThen(Schema.decode(returns)));\n }) as TestConfectWithoutIdentity<ConfectSchema>[\"run\"];\n\n readonly fetch = <PathQueryFragment extends string>(\n pathQueryFragment: PathQueryFragment,\n init?: RequestInit,\n ) => Effect.promise(() => this.testConvex.fetch(pathQueryFragment, init));\n\n readonly finishInProgressScheduledFunctions = () =>\n Effect.promise(() => this.testConvex.finishInProgressScheduledFunctions());\n\n readonly finishAllScheduledFunctions = (advanceTimers: () => void) =>\n Effect.promise(() =>\n this.testConvex.finishAllScheduledFunctions(advanceTimers),\n );\n}\n\nclass TestConfectImpl<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> implements TestConfect<ConfectSchema> {\n private readonly testConfectImplWithoutIdentity: TestConfectImplWithoutIdentity<ConfectSchema>;\n\n constructor(\n private confectSchema: ConfectSchema,\n private testConvex: TestConvexForDataModelAndIdentity<\n DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>\n >,\n ) {\n this.testConvex = testConvex;\n this.testConfectImplWithoutIdentity = new TestConfectImplWithoutIdentity(\n confectSchema,\n testConvex,\n );\n }\n\n readonly withIdentity = (userIdentity: Partial<UserIdentity>) =>\n new TestConfectImplWithoutIdentity(\n this.confectSchema,\n this.testConvex.withIdentity(userIdentity),\n );\n\n readonly query = <QueryRef extends Ref.AnyQuery>(\n queryRef: QueryRef,\n ...args: Ref.OptionalArgs<QueryRef>\n ) => this.testConfectImplWithoutIdentity.query(queryRef, ...args);\n\n readonly mutation = <MutationRef extends Ref.AnyMutation>(\n mutationRef: MutationRef,\n ...args: Ref.OptionalArgs<MutationRef>\n ) => this.testConfectImplWithoutIdentity.mutation(mutationRef, ...args);\n\n readonly action = <ActionRef extends Ref.AnyAction>(\n actionRef: ActionRef,\n ...args: Ref.OptionalArgs<ActionRef>\n ) => this.testConfectImplWithoutIdentity.action(actionRef, ...args);\n\n readonly run: TestConfect<ConfectSchema>[\"run\"] = ((\n handler: any,\n returns?: any,\n ) =>\n this.testConfectImplWithoutIdentity.run(\n handler,\n returns,\n )) as TestConfect<ConfectSchema>[\"run\"];\n\n readonly fetch = <PathQueryFragment extends string>(\n pathQueryFragment: PathQueryFragment,\n init?: RequestInit,\n ) => this.testConfectImplWithoutIdentity.fetch(pathQueryFragment, init);\n\n readonly finishInProgressScheduledFunctions = () =>\n this.testConfectImplWithoutIdentity.finishInProgressScheduledFunctions();\n\n readonly finishAllScheduledFunctions = (advanceTimers: () => void) =>\n this.testConfectImplWithoutIdentity.finishAllScheduledFunctions(\n advanceTimers,\n );\n}\n\nexport const layer =\n <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n modules: Record<string, () => Promise<any>>,\n ) =>\n (): Layer.Layer<TestConfect<DatabaseSchema_>> =>\n Layer.sync(\n TestConfect<DatabaseSchema_>(),\n () =>\n new TestConfectImpl(\n databaseSchema,\n convexTest(\n databaseSchema.convexSchemaDefinition,\n modules,\n ) as unknown as TestConvexForDataModelAndIdentity<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n ),\n );\n"],"mappings":";;;;;;;;;;;AA6DA,MAAa,oBAGX,QAAQ,WAAuC,4BAA4B;AAE7E,IAAM,iCAAN,MAEuD;CACrD,YACE,AAAQ,eACR,AAAQ,YAGR;EAJQ;EACA;;CAKV,AAAS,SACP,UACA,GAAG,SAEH,IAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,KAAK,WAAW,MAAM,mBAAmB,YAAY,CACxD;CAEH,AAAS,YACP,aACA,GAAG,SAEH,IAAI,aACF,aACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,KAAK,WAAW,SAAS,mBAAmB,YAAY,CAC3D;CAEH,AAAS,UACP,WACA,GAAG,SAEH,IAAI,aACF,WACC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AA+B,IAClC,SACA,QACD;CAEH,AAAS,SACP,mBACA,SACG,KAAK,+BAA+B,MAAM,mBAAmB,KAAK;CAEvE,AAAS,2CACP,KAAK,+BAA+B,oCAAoC;CAE1E,AAAS,+BAA+B,kBACtC,KAAK,+BAA+B,4BAClC,cACD;;AAGL,MAAa,SAET,gBACA,kBAGA,MAAM,KACJ,aAA8B,QAE5B,IAAI,gBACF,gBACA,WACE,eAAe,wBACf,QACD,CAGF,CACJ"}
1
+ {"version":3,"file":"TestConfect.js","names":[],"sources":["../src/TestConfect.ts"],"sourcesContent":["import { Ref } from \"@confect/core\";\nimport type { DatabaseSchema, DataModel } from \"@confect/server\";\nimport { RegisteredConvexFunction } from \"@confect/server\";\nimport type {\n TestConvexForDataModel,\n TestConvexForDataModelAndIdentity,\n} from \"convex-test\";\nimport { convexTest } from \"convex-test\";\nimport type { GenericMutationCtx, UserIdentity } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport type { ParseResult } from \"effect\";\nimport { Context, Effect, Layer, Schema } from \"effect\";\n\nexport type TestConfectWithoutIdentity<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> = {\n query: <QueryRef extends Ref.AnyQuery>(\n queryRef: QueryRef,\n ...args: Ref.OptionalArgs<QueryRef>\n ) => Effect.Effect<\n Ref.Returns<QueryRef>,\n Ref.Error<QueryRef> | ParseResult.ParseError\n >;\n mutation: <MutationRef extends Ref.AnyMutation>(\n mutationRef: MutationRef,\n ...args: Ref.OptionalArgs<MutationRef>\n ) => Effect.Effect<\n Ref.Returns<MutationRef>,\n Ref.Error<MutationRef> | ParseResult.ParseError\n >;\n action: <ActionRef extends Ref.AnyAction>(\n actionRef: ActionRef,\n ...args: Ref.OptionalArgs<ActionRef>\n ) => Effect.Effect<\n Ref.Returns<ActionRef>,\n Ref.Error<ActionRef> | ParseResult.ParseError\n >;\n run: {\n <E>(\n handler: Effect.Effect<\n void,\n E,\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >,\n ): Effect.Effect<void>;\n <A, B extends Value, E>(\n handler: Effect.Effect<\n A,\n E,\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >,\n returns: Schema.Schema<A, B>,\n ): Effect.Effect<A, ParseResult.ParseError>;\n };\n fetch: (\n pathQueryFragment: string,\n init?: RequestInit,\n ) => Effect.Effect<Response>;\n finishInProgressScheduledFunctions: () => Effect.Effect<void>;\n finishAllScheduledFunctions: (\n advanceTimers: () => void,\n ) => Effect.Effect<void>;\n};\n\nexport type TestConfect<ConfectSchema extends DatabaseSchema.AnyWithProps> = {\n withIdentity: (\n userIdentity: Partial<UserIdentity>,\n ) => TestConfectWithoutIdentity<ConfectSchema>;\n} & TestConfectWithoutIdentity<ConfectSchema>;\n\nexport const TestConfect = <\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n>() =>\n Context.GenericTag<TestConfect<ConfectSchema>>(\"@confect/test/TestConfect\");\n\nclass TestConfectImplWithoutIdentity<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> implements TestConfectWithoutIdentity<ConfectSchema> {\n constructor(\n private confectSchema: ConfectSchema,\n private testConvex: TestConvexForDataModel<\n DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>\n >,\n ) {}\n\n readonly query = <QueryRef extends Ref.AnyQuery>(\n queryRef: QueryRef,\n ...args: Ref.OptionalArgs<QueryRef>\n ): Effect.Effect<\n Ref.Returns<QueryRef>,\n Ref.Error<QueryRef> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n queryRef,\n (args[0] ?? {}) as Ref.Args<QueryRef>,\n (functionReference, encodedArgs) =>\n this.testConvex.query(functionReference as any, encodedArgs),\n );\n\n readonly mutation = <MutationRef extends Ref.AnyMutation>(\n mutationRef: MutationRef,\n ...args: Ref.OptionalArgs<MutationRef>\n ): Effect.Effect<\n Ref.Returns<MutationRef>,\n Ref.Error<MutationRef> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n mutationRef,\n (args[0] ?? {}) as Ref.Args<MutationRef>,\n (functionReference, encodedArgs) =>\n this.testConvex.mutation(functionReference as any, encodedArgs),\n );\n\n readonly action = <ActionRef extends Ref.AnyAction>(\n actionRef: ActionRef,\n ...args: Ref.OptionalArgs<ActionRef>\n ): Effect.Effect<\n Ref.Returns<ActionRef>,\n Ref.Error<ActionRef> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n actionRef,\n (args[0] ?? {}) as Ref.Args<ActionRef>,\n (functionReference, encodedArgs) =>\n this.testConvex.action(functionReference as any, encodedArgs),\n );\n\n readonly run: TestConfectWithoutIdentity<ConfectSchema>[\"run\"] = (<\n A,\n B extends Value,\n E,\n >(\n handler: Effect.Effect<\n A,\n E,\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >,\n returns?: Schema.Schema<A, B>,\n ): Effect.Effect<void> | Effect.Effect<A, ParseResult.ParseError> => {\n const makeMutationLayer = (\n mutationCtx: GenericMutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>\n >,\n ): Layer.Layer<RegisteredConvexFunction.MutationServices<ConfectSchema>> =>\n RegisteredConvexFunction.mutationLayer(\n this.confectSchema,\n mutationCtx,\n ) as Layer.Layer<\n RegisteredConvexFunction.MutationServices<ConfectSchema>\n >;\n\n return returns === undefined\n ? Effect.promise(() =>\n this.testConvex.run((mutationCtx) =>\n Effect.runPromise(\n handler.pipe(\n Effect.asVoid,\n Effect.provide(makeMutationLayer(mutationCtx)),\n ),\n ),\n ),\n )\n : Effect.promise(() =>\n this.testConvex.run((mutationCtx) =>\n Effect.runPromise(\n handler.pipe(\n Effect.andThen(Schema.encode(returns)),\n Effect.provide(makeMutationLayer(mutationCtx)),\n ),\n ),\n ),\n ).pipe(Effect.andThen(Schema.decode(returns)));\n }) as TestConfectWithoutIdentity<ConfectSchema>[\"run\"];\n\n readonly fetch = <PathQueryFragment extends string>(\n pathQueryFragment: PathQueryFragment,\n init?: RequestInit,\n ) => Effect.promise(() => this.testConvex.fetch(pathQueryFragment, init));\n\n readonly finishInProgressScheduledFunctions = () =>\n Effect.promise(() => this.testConvex.finishInProgressScheduledFunctions());\n\n readonly finishAllScheduledFunctions = (advanceTimers: () => void) =>\n Effect.promise(() =>\n this.testConvex.finishAllScheduledFunctions(advanceTimers),\n );\n}\n\nclass TestConfectImpl<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> implements TestConfect<ConfectSchema> {\n private readonly testConfectImplWithoutIdentity: TestConfectImplWithoutIdentity<ConfectSchema>;\n\n constructor(\n private confectSchema: ConfectSchema,\n private testConvex: TestConvexForDataModelAndIdentity<\n DataModel.ToConvex<DataModel.FromSchema<ConfectSchema>>\n >,\n ) {\n this.testConvex = testConvex;\n this.testConfectImplWithoutIdentity = new TestConfectImplWithoutIdentity(\n confectSchema,\n testConvex,\n );\n }\n\n readonly withIdentity = (userIdentity: Partial<UserIdentity>) =>\n new TestConfectImplWithoutIdentity(\n this.confectSchema,\n this.testConvex.withIdentity(userIdentity),\n );\n\n readonly query = <QueryRef extends Ref.AnyQuery>(\n queryRef: QueryRef,\n ...args: Ref.OptionalArgs<QueryRef>\n ) => this.testConfectImplWithoutIdentity.query(queryRef, ...args);\n\n readonly mutation = <MutationRef extends Ref.AnyMutation>(\n mutationRef: MutationRef,\n ...args: Ref.OptionalArgs<MutationRef>\n ) => this.testConfectImplWithoutIdentity.mutation(mutationRef, ...args);\n\n readonly action = <ActionRef extends Ref.AnyAction>(\n actionRef: ActionRef,\n ...args: Ref.OptionalArgs<ActionRef>\n ) => this.testConfectImplWithoutIdentity.action(actionRef, ...args);\n\n readonly run: TestConfect<ConfectSchema>[\"run\"] = ((\n handler: any,\n returns?: any,\n ) =>\n this.testConfectImplWithoutIdentity.run(\n handler,\n returns,\n )) as TestConfect<ConfectSchema>[\"run\"];\n\n readonly fetch = <PathQueryFragment extends string>(\n pathQueryFragment: PathQueryFragment,\n init?: RequestInit,\n ) => this.testConfectImplWithoutIdentity.fetch(pathQueryFragment, init);\n\n readonly finishInProgressScheduledFunctions = () =>\n this.testConfectImplWithoutIdentity.finishInProgressScheduledFunctions();\n\n readonly finishAllScheduledFunctions = (advanceTimers: () => void) =>\n this.testConfectImplWithoutIdentity.finishAllScheduledFunctions(\n advanceTimers,\n );\n}\n\nexport const layer =\n <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n modules: Record<string, () => Promise<any>>,\n ) =>\n (): Layer.Layer<TestConfect<DatabaseSchema_>> =>\n Layer.sync(\n TestConfect<DatabaseSchema_>(),\n () =>\n new TestConfectImpl(\n databaseSchema,\n convexTest(databaseSchema.convexSchemaDefinition, modules) as any,\n ),\n );\n"],"mappings":";;;;;;;;;;;AAsEA,MAAa,oBAGX,QAAQ,WAAuC,4BAA4B;AAE7E,IAAM,iCAAN,MAEuD;CACrD,YACE,AAAQ,eACR,AAAQ,YAGR;EAJQ;EACA;;CAKV,AAAS,SACP,UACA,GAAG,SAKH,IAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,KAAK,WAAW,MAAM,mBAA0B,YAAY,CAC/D;CAEH,AAAS,YACP,aACA,GAAG,SAKH,IAAI,aACF,aACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,KAAK,WAAW,SAAS,mBAA0B,YAAY,CAClE;CAEH,AAAS,UACP,WACA,GAAG,SAKH,IAAI,aACF,WACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,KAAK,WAAW,OAAO,mBAA0B,YAAY,CAChE;CAEH,AAAS,QAKP,SAKA,YACmE;EACnE,MAAM,qBACJ,gBAIA,yBAAyB,cACvB,KAAK,eACL,YACD;AAIH,SAAO,YAAY,SACf,OAAO,cACL,KAAK,WAAW,KAAK,gBACnB,OAAO,WACL,QAAQ,KACN,OAAO,QACP,OAAO,QAAQ,kBAAkB,YAAY,CAAC,CAC/C,CACF,CACF,CACF,GACD,OAAO,cACL,KAAK,WAAW,KAAK,gBACnB,OAAO,WACL,QAAQ,KACN,OAAO,QAAQ,OAAO,OAA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
  "description": "Utilities for testing Confect apps without a live Convex backend",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,10 +51,10 @@
51
51
  },
52
52
  "peerDependencies": {
53
53
  "convex": "^1.30.0",
54
- "convex-test": "^0.0.38",
54
+ "convex-test": "^0.0.50",
55
55
  "effect": "^3.19.16",
56
- "@confect/core": "6.0.0",
57
- "@confect/server": "6.0.0"
56
+ "@confect/core": "7.0.0",
57
+ "@confect/server": "7.0.0"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=22",
@@ -17,15 +17,24 @@ export type TestConfectWithoutIdentity<
17
17
  query: <QueryRef extends Ref.AnyQuery>(
18
18
  queryRef: QueryRef,
19
19
  ...args: Ref.OptionalArgs<QueryRef>
20
- ) => Effect.Effect<Ref.Returns<QueryRef>, ParseResult.ParseError>;
20
+ ) => Effect.Effect<
21
+ Ref.Returns<QueryRef>,
22
+ Ref.Error<QueryRef> | ParseResult.ParseError
23
+ >;
21
24
  mutation: <MutationRef extends Ref.AnyMutation>(
22
25
  mutationRef: MutationRef,
23
26
  ...args: Ref.OptionalArgs<MutationRef>
24
- ) => Effect.Effect<Ref.Returns<MutationRef>, ParseResult.ParseError>;
27
+ ) => Effect.Effect<
28
+ Ref.Returns<MutationRef>,
29
+ Ref.Error<MutationRef> | ParseResult.ParseError
30
+ >;
25
31
  action: <ActionRef extends Ref.AnyAction>(
26
32
  actionRef: ActionRef,
27
33
  ...args: Ref.OptionalArgs<ActionRef>
28
- ) => Effect.Effect<Ref.Returns<ActionRef>, ParseResult.ParseError>;
34
+ ) => Effect.Effect<
35
+ Ref.Returns<ActionRef>,
36
+ Ref.Error<ActionRef> | ParseResult.ParseError
37
+ >;
29
38
  run: {
30
39
  <E>(
31
40
  handler: Effect.Effect<
@@ -77,34 +86,43 @@ class TestConfectImplWithoutIdentity<
77
86
  readonly query = <QueryRef extends Ref.AnyQuery>(
78
87
  queryRef: QueryRef,
79
88
  ...args: Ref.OptionalArgs<QueryRef>
80
- ): Effect.Effect<Ref.Returns<QueryRef>, ParseResult.ParseError> =>
89
+ ): Effect.Effect<
90
+ Ref.Returns<QueryRef>,
91
+ Ref.Error<QueryRef> | ParseResult.ParseError
92
+ > =>
81
93
  Ref.runWithCodec(
82
94
  queryRef,
83
95
  (args[0] ?? {}) as Ref.Args<QueryRef>,
84
96
  (functionReference, encodedArgs) =>
85
- this.testConvex.query(functionReference, encodedArgs),
97
+ this.testConvex.query(functionReference as any, encodedArgs),
86
98
  );
87
99
 
88
100
  readonly mutation = <MutationRef extends Ref.AnyMutation>(
89
101
  mutationRef: MutationRef,
90
102
  ...args: Ref.OptionalArgs<MutationRef>
91
- ): Effect.Effect<Ref.Returns<MutationRef>, ParseResult.ParseError> =>
103
+ ): Effect.Effect<
104
+ Ref.Returns<MutationRef>,
105
+ Ref.Error<MutationRef> | ParseResult.ParseError
106
+ > =>
92
107
  Ref.runWithCodec(
93
108
  mutationRef,
94
109
  (args[0] ?? {}) as Ref.Args<MutationRef>,
95
110
  (functionReference, encodedArgs) =>
96
- this.testConvex.mutation(functionReference, encodedArgs),
111
+ this.testConvex.mutation(functionReference as any, encodedArgs),
97
112
  );
98
113
 
99
114
  readonly action = <ActionRef extends Ref.AnyAction>(
100
115
  actionRef: ActionRef,
101
116
  ...args: Ref.OptionalArgs<ActionRef>
102
- ): Effect.Effect<Ref.Returns<ActionRef>, ParseResult.ParseError> =>
117
+ ): Effect.Effect<
118
+ Ref.Returns<ActionRef>,
119
+ Ref.Error<ActionRef> | ParseResult.ParseError
120
+ > =>
103
121
  Ref.runWithCodec(
104
122
  actionRef,
105
123
  (args[0] ?? {}) as Ref.Args<ActionRef>,
106
124
  (functionReference, encodedArgs) =>
107
- this.testConvex.action(functionReference, encodedArgs),
125
+ this.testConvex.action(functionReference as any, encodedArgs),
108
126
  );
109
127
 
110
128
  readonly run: TestConfectWithoutIdentity<ConfectSchema>["run"] = (<
@@ -241,11 +259,6 @@ export const layer =
241
259
  () =>
242
260
  new TestConfectImpl(
243
261
  databaseSchema,
244
- convexTest(
245
- databaseSchema.convexSchemaDefinition,
246
- modules,
247
- ) as unknown as TestConvexForDataModelAndIdentity<
248
- DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>
249
- >,
262
+ convexTest(databaseSchema.convexSchemaDefinition, modules) as any,
250
263
  ),
251
264
  );