@confect/test 10.4.1 → 10.6.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,16 @@
1
1
  # @confect/test
2
2
 
3
+ ## 10.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 49cbbfc: Support `Storage.get` and `Storage.store` in mutations and mutation/action middleware, with file writes committed or rolled back alongside the database transaction. Upgrade `convex` to 1.48.0 or later and, when using `@confect/test`, `convex-test` to 0.0.67 or later.
8
+ - d087214: Add `MutationAuth.signJwt()` for signing deployment JWTs in mutations and mutation-only middleware, and export `MutationAuth` from generated services. Add `TestConfect.jwks()` to verify test-issued tokens with the same test instance's public keys.
9
+
10
+ ## 10.5.0
11
+
12
+ No changes in this release.
13
+
3
14
  ## 10.4.1
4
15
 
5
16
  No changes in this release.
@@ -1,13 +1,16 @@
1
1
  import { Ref } from "@confect/core";
2
2
  import type { DatabaseSchema } from "@confect/server";
3
3
  import { RegisteredConvexFunction } from "@confect/server";
4
+ import type { DeploymentJwks } from "convex-test";
4
5
  import type { GenericSchema, SchemaDefinition, UserIdentity } from "convex/server";
5
6
  import type { Value } from "convex/values";
6
7
  import * as Context from "effect/Context";
7
8
  import * as Effect from "effect/Effect";
8
9
  import * as Layer from "effect/Layer";
9
10
  import * as Schema from "effect/Schema";
11
+ export type { DeploymentJwk, DeploymentJwks } from "convex-test";
10
12
  export type TestConfectWithoutIdentity<ConfectSchema extends DatabaseSchema.AnyWithProps> = {
13
+ jwks: () => Effect.Effect<DeploymentJwks>;
11
14
  query: <QueryRef extends Ref.AnyQuery>(queryRef: QueryRef, ...args: Ref.OptionalArgs<QueryRef>) => Effect.Effect<Ref.Returns<QueryRef>, Ref.Error<QueryRef> | Schema.SchemaError>;
12
15
  mutation: <MutationRef extends Ref.AnyMutation>(mutationRef: MutationRef, ...args: Ref.OptionalArgs<MutationRef>) => Effect.Effect<Ref.Returns<MutationRef>, Ref.Error<MutationRef> | Schema.SchemaError>;
13
16
  action: <ActionRef extends Ref.AnyAction>(actionRef: ActionRef, ...args: Ref.OptionalArgs<ActionRef>) => Effect.Effect<Ref.Returns<ActionRef>, Ref.Error<ActionRef> | Schema.SchemaError>;
@@ -1 +1 @@
1
- {"version":3,"file":"TestConfect.d.ts","sourceRoot":"","sources":["../src/TestConfect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAM3D,OAAO,KAAK,EAEV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,0BAA0B,CACpC,aAAa,SAAS,cAAc,CAAC,YAAY,IAC/C;IACF,KAAK,EAAE,CAAC,QAAQ,SAAS,GAAG,CAAC,QAAQ,EACnC,QAAQ,EAAE,QAAQ,EAClB,GAAG,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,KAChC,MAAM,CAAC,MAAM,CAChB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,WAAW,CACzC,CAAC;IACF,QAAQ,EAAE,CAAC,WAAW,SAAS,GAAG,CAAC,WAAW,EAC5C,WAAW,EAAE,WAAW,EACxB,GAAG,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,WAAW,CAAC,KACnC,MAAM,CAAC,M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ACD,CAAC,EACD,wBAAwB,CAAC,gBAAgB,CAAC,aAAa,CAAC,CACzD,EACD,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;KACzC,CAAC;IACF,KAAK,EAAE,CACL,iBAAiB,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,WAAW,KACf,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7B,kCAAkC,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9D,2BAA2B,EAAE,CAC3B,aAAa,EAAE,MAAM,IAAI,KACtB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,aAAa,SAAS,cAAc,CAAC,YAAY,IAAI;IAC3E,YAAY,EAAE,CACZ,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,KAChC,0BAA0B,CAAC,aAAa,CAAC,CAAC;CAChD,GAAG,0BAA0B,CAAC,aAAa,CAAC,CAAC;AAE9C,eAAO,MAAM,WAAW,GACtB,aAAa,SAAS,cAAc,CAAC,YAAY,8EAC4B,CAAC;AAsLhF,eAAO,MAAM,KAAK,GAAI,eAAe,SAAS,cAAc,CAAC,YAAY,kBACvD,eAAe,0BACP,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,WACpD,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,KAC1C,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,CAQxC,CAAC"}
@@ -6,7 +6,7 @@ import * as Context from "effect/Context";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Layer from "effect/Layer";
8
8
  import * as Schema from "effect/Schema";
9
- //#region src/TestConfect.ts
9
+ // src/TestConfect.ts
10
10
  var TestConfect_exports = /* @__PURE__ */ __exportAll({
11
11
  TestConfect: () => TestConfect,
12
12
  layer: () => layer
@@ -19,6 +19,7 @@ var TestConfectImplWithoutIdentity = class {
19
19
  this.confectSchema = confectSchema;
20
20
  this.testConvex = testConvex;
21
21
  }
22
+ jwks = Effect.fn("TestConfect.jwks")(() => Effect.promise(() => this.testConvex.jwks()));
22
23
  query = (queryRef, ...args) => Ref.runWithCodec(queryRef, args[0] ?? {}, (functionReference, encodedArgs) => this.testConvex.query(functionReference, encodedArgs));
23
24
  mutation = (mutationRef, ...args) => Ref.runWithCodec(mutationRef, args[0] ?? {}, (functionReference, encodedArgs) => this.testConvex.mutation(functionReference, encodedArgs));
24
25
  action = (actionRef, ...args) => Ref.runWithCodec(actionRef, args[0] ?? {}, (functionReference, encodedArgs) => this.testConvex.action(functionReference, encodedArgs));
@@ -40,6 +41,7 @@ var TestConfectImpl = class {
40
41
  this.testConfectImplWithoutIdentity = new TestConfectImplWithoutIdentity(confectSchema, testConvex);
41
42
  }
42
43
  withIdentity = (userIdentity) => new TestConfectImplWithoutIdentity(this.confectSchema, this.testConvex.withIdentity(userIdentity));
44
+ jwks = () => this.testConfectImplWithoutIdentity.jwks();
43
45
  query = (queryRef, ...args) => this.testConfectImplWithoutIdentity.query(queryRef, ...args);
44
46
  mutation = (mutationRef, ...args) => this.testConfectImplWithoutIdentity.mutation(mutationRef, ...args);
45
47
  action = (actionRef, ...args) => this.testConfectImplWithoutIdentity.action(actionRef, ...args);
@@ -49,7 +51,6 @@ var TestConfectImpl = class {
49
51
  finishAllScheduledFunctions = (advanceTimers) => this.testConfectImplWithoutIdentity.finishAllScheduledFunctions(advanceTimers);
50
52
  };
51
53
  const layer = (databaseSchema, convexSchemaDefinition, modules) => Layer.sync(TestConfect(), () => new TestConfectImpl(databaseSchema, convexTest(convexSchemaDefinition, modules)));
52
- //#endregion
53
54
  export { TestConfect, TestConfect_exports, layer };
54
55
 
55
56
  //# sourceMappingURL=TestConfect.js.map
@@ -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 {\n GenericMutationCtx,\n GenericSchema,\n SchemaDefinition,\n UserIdentity,\n} from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\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> | Schema.SchemaError\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> | Schema.SchemaError\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> | Schema.SchemaError\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.Codec<A, B>,\n ): Effect.Effect<A, Schema.SchemaError>;\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>() => Context.Service<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> | Schema.SchemaError\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> | Schema.SchemaError\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> | Schema.SchemaError\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.Codec<A, B>,\n ): Effect.Effect<void> | Effect.Effect<A, Schema.SchemaError> => {\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.encodeEffect(returns)),\n Effect.provide(makeMutationLayer(mutationCtx)),\n ),\n ),\n ),\n ).pipe(Effect.andThen(Schema.decodeEffect(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.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 = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexSchemaDefinition: SchemaDefinition<GenericSchema, true>,\n modules: Record<string, () => Promise<any>>,\n): Layer.Layer<TestConfect<DatabaseSchema_>> =>\n Layer.sync(\n TestConfect<DatabaseSchema_>(),\n () =>\n new TestConfectImpl(\n databaseSchema,\n convexTest(convexSchemaDefinition, modules) as any,\n ),\n );\n"],"mappings":";;;;;;;;;;;;;AA6EA,MAAa,oBAEN,QAAQ,QAAoC,2BAA2B;AAE9E,IAAM,iCAAN,MAEuD;CAE3C;CACA;CAFV,YACE,eACA,YAGA;EAJQ,KAAA,gBAAA;EACA,KAAA,aAAA;CAGP;CAEH,SACE,UACA,GAAG,SAKH,IAAI,aACF,UACC,KAAK,MAAM,CAAC,IACZ,mBAAmB,gBAClB,KAAK,WAAW,MAAM,mBAA0B,WAAW,CAC/D;CAEF,YACE,aACA,GAAG,SAKH,IAAI,aACF,aACC,KAAK,MAAM,CAAC,IACZ,mBAAmB,gBAClB,KAAK,WAAW,SAAS,mBAA0B,WAAW,CAClE;CAEF,UACE,WACA,GAAG,SAKH,IAAI,aACF,WACC,KAAK,MAAM,CAAC,IACZ,mBAAmB,gBAClB,KAAK,WAAW,OAAO,mBAA0B,WAAW,CAChE;CAEF,QAKE,SAKA,YAC+D;EAC/D,MAAM,qBACJ,gBAIA,yBAAyB,cACvB,KAAK,eACL,WACF;EAIF,OAAO,YAAY,KAAA,IACf,OAAO,cACL,KAAK,WAAW,KAAK,gBACnB,OAAO,WACL,QAAQ,KACN,OAAO,QACP,OAAO,QAAQ,kBAAkB,WAAW,CAAC,CAC/C,CACF,CACF,CACF,IACA,OAAO,cACL,KAAK,WAAW,KAAK,gBACnB,OAAO,WACL,QAAQ,KACN,OAAO,QAAQ,OAAO,aAAa,OAAO,CAAC,GAC3C,OAAO,QAAQ,kBAAkB,WAAW,CAAC,CAC/C,CACF,CACF,CACF,CAAC,CAAC,KAAK,OAAO,QAAQ,OAAO,aAAa,OAAO,CAAC,CAAC;CACzD;CAEA,SACE,mBACA,SACG,OAAO,cAAc,KAAK,WAAW,MAAM,mBAAmB,IAAI,CAAC;CAExE,2CACE,OAAO,cAAc,KAAK,WAAW,mCAAmC,CAAC;CAE3E,+BAAwC,kBACtC,OAAO,cACL,KAAK,WAAW,4BAA4B,aAAa,CAC3D;AACJ;AAEA,IAAM,kBAAN,MAEwC;CAI5B;CACA;CAJV;CAEA,YACE,eACA,YAGA;EAJQ,KAAA,gBAAA;EACA,KAAA,aAAA;EAIR,KAAK,iCAAiC,IAAI,+BACxC,eACA,UACF;CACF;CAEA,gBAAyB,iBACvB,IAAI,+BACF,KAAK,eACL,KAAK,WAAW,aAAa,YAAY,CAC3C;CAEF,SACE,UACA,GAAG,SACA,KAAK,+BAA+B,MAAM,UAAU,GAAG,IAAI;CAEhE,YACE,aACA,GAAG,SACA,KAAK,+BAA+B,SAAS,aAAa,GAAG,IAAI;CAEtE,UACE,WACA,GAAG,SACA,KAAK,+BAA+B,OAAO,WAAW,GAAG,IAAI;CAElE,QACE,SACA,YAEA,KAAK,+BAA+B,IAClC,SACA,OACF;CAEF,SACE,mBACA,SACG,KAAK,+BAA+B,MAAM,mBAAmB,IAAI;CAEtE,2CACE,KAAK,+BAA+B,mCAAmC;CAEzE,+BAAwC,kBACtC,KAAK,+BAA+B,4BAClC,aACF;AACJ;AAEA,MAAa,SACX,gBACA,wBACA,YAEA,MAAM,KACJ,YAA6B,SAE3B,IAAI,gBACF,gBACA,WAAW,wBAAwB,OAAO,CAC5C,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 DeploymentJwks,\n TestConvexForDataModel,\n TestConvexForDataModelAndIdentity,\n} from \"convex-test\";\nimport { convexTest } from \"convex-test\";\nimport type {\n GenericMutationCtx,\n GenericSchema,\n SchemaDefinition,\n UserIdentity,\n} from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\n\nexport type { DeploymentJwk, DeploymentJwks } from \"convex-test\";\n\nexport type TestConfectWithoutIdentity<\n ConfectSchema extends DatabaseSchema.AnyWithProps,\n> = {\n jwks: () => Effect.Effect<DeploymentJwks>;\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> | Schema.SchemaError\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> | Schema.SchemaError\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> | Schema.SchemaError\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.Codec<A, B>,\n ): Effect.Effect<A, Schema.SchemaError>;\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>() => Context.Service<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 jwks = Effect.fn(\"TestConfect.jwks\")(() =>\n Effect.promise(() => this.testConvex.jwks()),\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> | Schema.SchemaError\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> | Schema.SchemaError\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> | Schema.SchemaError\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.Codec<A, B>,\n ): Effect.Effect<void> | Effect.Effect<A, Schema.SchemaError> => {\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.encodeEffect(returns)),\n Effect.provide(makeMutationLayer(mutationCtx)),\n ),\n ),\n ),\n ).pipe(Effect.andThen(Schema.decodeEffect(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.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 jwks = () => this.testConfectImplWithoutIdentity.jwks();\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 = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexSchemaDefinition: SchemaDefinition<GenericSchema, true>,\n modules: Record<string, () => Promise<any>>,\n): Layer.Layer<TestConfect<DatabaseSchema_>> =>\n Layer.sync(\n TestConfect<DatabaseSchema_>(),\n () =>\n new TestConfectImpl(\n databaseSchema,\n convexTest(convexSchemaDefinition, modules) as any,\n ),\n );\n"],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kBACtC,OAAO,cACL,KAAK,WAAW,4BAA4B,aAAa,CAC3D;AACJ;AAEA,IAAM,kBAAN,MAEwC;CAI5B;CACA;CAJV;CAEA,YACE,eACA,YAGA;EAJQ,KAAA,gBAAA;EACA,KAAA,aAAA;EAIR,KAAK,iCAAiC,IAAI,+BACxC,eACA,UACF;CACF;CAEA,gBAAyB,iBACvB,IAAI,+BACF,KAAK,eACL,KAAK,WAAW,aAAa,YAAY,CAC3C;CAEF,aAAsB,KAAK,+BAA+B,KAAK;CAE/D,SACE,UACA,GAAG,SACA,KAAK,+BAA+B,MAAM,UAAU,GAAG,IAAI;CAEhE,YACE,aACA,GAAG,SACA,KAAK,+BAA+B,SAAS,aAAa,GAAG,IAAI;CAEtE,UACE,WACA,GAAG,SACA,KAAK,+BAA+B,OAAO,WAAW,GAAG,IAAI;CAElE,QACE,SACA,YAEA,KAAK,+BAA+B,IAClC,SACA,OACF;CAEF,SACE,mBACA,SACG,KAAK,+BAA+B,MAAM,mBAAmB,IAAI;CAEtE,2CACE,KAAK,+BAA+B,mCAAmC;CAEzE,+BAAwC,kBACtC,KAAK,+BAA+B,4BAClC,aACF;AACJ;AAEA,MAAa,SACX,gBACA,wBACA,YAEA,MAAM,KACJ,YAA6B,SAE3B,IAAI,gBACF,gBACA,WAAW,wBAAwB,OAAO,CAC5C,CACJ"}
@@ -1,13 +1,12 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
3
+ var __exportAll = (all, flags) => {
4
+ let target = Object.setPrototypeOf({}, null);
5
5
  for (var name in all) __defProp(target, name, {
6
6
  get: all[name],
7
7
  enumerable: true
8
8
  });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
9
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return flags & 2 ? target : Object.preventExtensions(target);
11
11
  };
12
- //#endregion
13
12
  export { __exportAll };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@confect/test",
3
3
  "description": "Utilities for testing Confect apps without a live Convex backend",
4
- "version": "10.4.1",
4
+ "version": "10.6.0",
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": "26.6.5",
11
- "effect": "4.0.4",
12
- "tsdown": "0.23.1",
13
- "typescript": "7.0.2",
10
+ "@types/node": "26.6.6",
11
+ "effect": "4.1.0",
12
+ "tsdown": "0.23.7",
13
+ "tsrs": "0.23.0-ts7.1.0-beta",
14
14
  "unrun": "0.3.1"
15
15
  },
16
16
  "engines": {
@@ -47,10 +47,10 @@
47
47
  "main": "./dist/index.js",
48
48
  "module": "./dist/index.js",
49
49
  "peerDependencies": {
50
- "@confect/core": "^10.4.1",
51
- "@confect/server": "^10.4.1",
50
+ "@confect/core": "^10.6.0",
51
+ "@confect/server": "^10.6.0",
52
52
  "convex": "^1.32.0",
53
- "convex-test": ">=0.0.50 <0.1.0",
53
+ "convex-test": ">=0.0.67 <0.1.0",
54
54
  "effect": "^4.0.0"
55
55
  },
56
56
  "repository": {
@@ -63,7 +63,7 @@
63
63
  "scripts": {
64
64
  "clean": "shx rm -rf dist coverage node_modules",
65
65
  "dev": "tsdown --watch --no-clean --config-loader unrun",
66
- "typecheck": "tsc -b tsconfig.src.json",
67
- "typecheck:inexact": "tsc --noEmit --project tsconfig.json --exactOptionalPropertyTypes false"
66
+ "typecheck": "tsrs -b tsconfig.src.json",
67
+ "typecheck:inexact": "tsrs --noEmit --project tsconfig.json --exactOptionalPropertyTypes false"
68
68
  }
69
69
  }
@@ -2,6 +2,7 @@ import { Ref } from "@confect/core";
2
2
  import type { DatabaseSchema, DataModel } from "@confect/server";
3
3
  import { RegisteredConvexFunction } from "@confect/server";
4
4
  import type {
5
+ DeploymentJwks,
5
6
  TestConvexForDataModel,
6
7
  TestConvexForDataModelAndIdentity,
7
8
  } from "convex-test";
@@ -18,9 +19,12 @@ import * as Effect from "effect/Effect";
18
19
  import * as Layer from "effect/Layer";
19
20
  import * as Schema from "effect/Schema";
20
21
 
22
+ export type { DeploymentJwk, DeploymentJwks } from "convex-test";
23
+
21
24
  export type TestConfectWithoutIdentity<
22
25
  ConfectSchema extends DatabaseSchema.AnyWithProps,
23
26
  > = {
27
+ jwks: () => Effect.Effect<DeploymentJwks>;
24
28
  query: <QueryRef extends Ref.AnyQuery>(
25
29
  queryRef: QueryRef,
26
30
  ...args: Ref.OptionalArgs<QueryRef>
@@ -89,6 +93,10 @@ class TestConfectImplWithoutIdentity<
89
93
  >,
90
94
  ) {}
91
95
 
96
+ readonly jwks = Effect.fn("TestConfect.jwks")(() =>
97
+ Effect.promise(() => this.testConvex.jwks()),
98
+ );
99
+
92
100
  readonly query = <QueryRef extends Ref.AnyQuery>(
93
101
  queryRef: QueryRef,
94
102
  ...args: Ref.OptionalArgs<QueryRef>
@@ -215,6 +223,8 @@ class TestConfectImpl<
215
223
  this.testConvex.withIdentity(userIdentity),
216
224
  );
217
225
 
226
+ readonly jwks = () => this.testConfectImplWithoutIdentity.jwks();
227
+
218
228
  readonly query = <QueryRef extends Ref.AnyQuery>(
219
229
  queryRef: QueryRef,
220
230
  ...args: Ref.OptionalArgs<QueryRef>