@shivaedev/effect-prisma 0.5.3 → 0.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +25 -7
  3. package/dist/database.d.ts +6 -6
  4. package/dist/database.d.ts.map +1 -1
  5. package/dist/database.js +9 -2
  6. package/dist/database.js.map +1 -1
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/internal/database-factory.d.ts +20 -22
  11. package/dist/internal/database-factory.d.ts.map +1 -1
  12. package/dist/internal/database-factory.js +83 -24
  13. package/dist/internal/database-factory.js.map +1 -1
  14. package/dist/internal/executor.d.ts +9 -7
  15. package/dist/internal/executor.d.ts.map +1 -1
  16. package/dist/internal/query-execution.d.ts +3 -4
  17. package/dist/internal/query-execution.d.ts.map +1 -1
  18. package/dist/internal/query-execution.js +9 -3
  19. package/dist/internal/query-execution.js.map +1 -1
  20. package/dist/internal/recipe.d.ts +1 -1
  21. package/dist/internal/recipe.d.ts.map +1 -1
  22. package/dist/internal/recipe.js +22 -9
  23. package/dist/internal/recipe.js.map +1 -1
  24. package/dist/internal/relation-plan.d.ts +6 -1
  25. package/dist/internal/relation-plan.d.ts.map +1 -1
  26. package/dist/internal/relation-plan.js +6 -5
  27. package/dist/internal/relation-plan.js.map +1 -1
  28. package/dist/internal/relation-runtime.d.ts +4 -3
  29. package/dist/internal/relation-runtime.d.ts.map +1 -1
  30. package/dist/internal/relation-runtime.js +38 -19
  31. package/dist/internal/relation-runtime.js.map +1 -1
  32. package/dist/internal/relation-stream.d.ts +3 -4
  33. package/dist/internal/relation-stream.d.ts.map +1 -1
  34. package/dist/internal/relation-stream.js +23 -21
  35. package/dist/internal/relation-stream.js.map +1 -1
  36. package/dist/internal/testing.d.ts +5 -5
  37. package/dist/internal/testing.d.ts.map +1 -1
  38. package/dist/internal/testing.js.map +1 -1
  39. package/dist/internal/transaction.d.ts +6 -3
  40. package/dist/internal/transaction.d.ts.map +1 -1
  41. package/dist/internal/transaction.js +14 -4
  42. package/dist/internal/transaction.js.map +1 -1
  43. package/dist/internal/vitest-database.d.ts +2 -2
  44. package/dist/internal/vitest-database.d.ts.map +1 -1
  45. package/dist/internal/vitest-database.js.map +1 -1
  46. package/dist/relation/include.d.ts +10 -8
  47. package/dist/relation/include.d.ts.map +1 -1
  48. package/dist/relation/prisma-methods.d.ts +20 -20
  49. package/dist/relation/prisma-methods.d.ts.map +1 -1
  50. package/dist/relation.d.ts +8 -7
  51. package/dist/relation.d.ts.map +1 -1
  52. package/dist/sqlite.d.ts +6 -6
  53. package/dist/sqlite.d.ts.map +1 -1
  54. package/dist/sqlite.js +10 -2
  55. package/dist/sqlite.js.map +1 -1
  56. package/dist/testing/transaction.d.ts +3 -3
  57. package/dist/testing/transaction.d.ts.map +1 -1
  58. package/dist/testing/transaction.js.map +1 -1
  59. package/dist/testing/types.d.ts +1 -1
  60. package/dist/testing/types.d.ts.map +1 -1
  61. package/dist/testing/vitest.d.ts +3 -3
  62. package/dist/testing/vitest.d.ts.map +1 -1
  63. package/dist/testing/vitest.js.map +1 -1
  64. package/dist/testing.d.ts +1 -1
  65. package/dist/testing.d.ts.map +1 -1
  66. package/dist/testing.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/database.ts +53 -47
  69. package/src/index.ts +0 -1
  70. package/src/internal/database-factory.ts +221 -98
  71. package/src/internal/executor.ts +9 -15
  72. package/src/internal/query-execution.ts +14 -6
  73. package/src/internal/recipe.ts +46 -7
  74. package/src/internal/relation-plan.ts +11 -11
  75. package/src/internal/relation-runtime.ts +67 -65
  76. package/src/internal/relation-stream.ts +54 -48
  77. package/src/internal/testing.ts +8 -8
  78. package/src/internal/transaction.ts +80 -56
  79. package/src/internal/vitest-database.ts +3 -12
  80. package/src/relation/include.ts +31 -22
  81. package/src/relation/prisma-methods.ts +27 -31
  82. package/src/relation.ts +19 -27
  83. package/src/sqlite.ts +61 -54
  84. package/src/testing/transaction.ts +16 -6
  85. package/src/testing/types.ts +1 -1
  86. package/src/testing/vitest.ts +3 -10
  87. package/src/testing.ts +0 -1
@@ -18,19 +18,17 @@ type AnyPostgresContract = PrismaContract<SqlStorage>;
18
18
  type FieldTuple<Row> = readonly [keyof Row & string, ...(keyof Row & string)[]];
19
19
  type Simplify<Value> = { [Key in keyof Value]: Value[Key] };
20
20
 
21
- type TerminalMethod<Method, Requirement> = Method extends (
21
+ type TerminalMethod<Method> = Method extends (
22
22
  ...arguments_: infer Arguments
23
23
  ) => PromiseLike<infer Value>
24
- ? (
25
- ...arguments_: Arguments
26
- ) => Effect.Effect<Awaited<Value>, PrismaError, Requirement>
24
+ ? (...arguments_: Arguments) => Effect.Effect<Awaited<Value>, PrismaError>
27
25
  : never;
28
26
 
29
27
  type SelectMethod<
30
28
  Collection,
31
- Requirement,
32
29
  Contract,
33
30
  Model extends string,
31
+ DatabaseId,
34
32
  > = Contract extends AnyPostgresContract
35
33
  ? Collection extends PrismaCollection<
36
34
  Contract,
@@ -48,9 +46,9 @@ type SelectMethod<
48
46
  Pick<DefaultModelRow<Contract, Model>, Fields[number]>,
49
47
  State
50
48
  >,
51
- Requirement,
52
49
  Contract,
53
- Model
50
+ Model,
51
+ DatabaseId
54
52
  >;
55
53
  }
56
54
  : Record<never, never>
@@ -60,7 +58,7 @@ type SelectMethod<
60
58
  ? (
61
59
  ...arguments_: Arguments
62
60
  ) => Result extends object
63
- ? Relation<Result, Requirement, Contract, Model>
61
+ ? Relation<Result, Contract, Model, DatabaseId>
64
62
  : never
65
63
  : never;
66
64
  }
@@ -93,7 +91,6 @@ type AggregateSuccess<
93
91
 
94
92
  type AggregateMethod<
95
93
  Collection,
96
- Requirement,
97
94
  Contract,
98
95
  Model extends string,
99
96
  > = Contract extends AnyPostgresContract
@@ -104,8 +101,7 @@ type AggregateMethod<
104
101
  configure?: AggregateConfigure<Collection>,
105
102
  ): Effect.Effect<
106
103
  AggregateSuccess<Collection, Contract, Model, Spec>,
107
- PrismaError,
108
- Requirement
104
+ PrismaError
109
105
  >;
110
106
  }
111
107
  : Record<never, never>
@@ -113,9 +109,9 @@ type AggregateMethod<
113
109
 
114
110
  type CollectionMethods<
115
111
  Collection,
116
- Requirement,
117
112
  Contract,
118
113
  Model extends string,
114
+ DatabaseId,
119
115
  > = Contract extends AnyPostgresContract
120
116
  ? Collection extends PrismaCollection<
121
117
  Contract,
@@ -128,9 +124,9 @@ type CollectionMethods<
128
124
  ...fields: Fields
129
125
  ): Relation<
130
126
  GroupedCollection<Contract, Model, Fields>,
131
- Requirement,
132
127
  Contract,
133
- Model
128
+ Model,
129
+ DatabaseId
134
130
  >;
135
131
  cursor(
136
132
  values: State extends { readonly hasOrderBy: true }
@@ -138,21 +134,21 @@ type CollectionMethods<
138
134
  Record<keyof DefaultModelRow<Contract, Model> & string, unknown>
139
135
  >
140
136
  : never,
141
- ): Relation<Collection, Requirement, Contract, Model>;
137
+ ): Relation<Collection, Contract, Model, DatabaseId>;
142
138
  distinct<Fields extends FieldTuple<DefaultModelRow<Contract, Model>>>(
143
139
  ...fields: Fields
144
- ): Relation<Collection, Requirement, Contract, Model>;
140
+ ): Relation<Collection, Contract, Model, DatabaseId>;
145
141
  distinctOn<Fields extends FieldTuple<DefaultModelRow<Contract, Model>>>(
146
142
  ...fields: State extends { readonly hasOrderBy: true }
147
143
  ? Fields
148
144
  : never
149
- ): Relation<Collection, Requirement, Contract, Model>;
145
+ ): Relation<Collection, Contract, Model, DatabaseId>;
150
146
  } & (State extends { readonly hasWhere: true }
151
147
  ? {
152
148
  readonly [Key in
153
149
  | "delete"
154
150
  | "deleteAll"
155
- | "deleteCount"]: TerminalMethod<Collection[Key], Requirement>;
151
+ | "deleteCount"]: TerminalMethod<Collection[Key]>;
156
152
  }
157
153
  : Record<never, never>)
158
154
  : Record<never, never>
@@ -160,9 +156,9 @@ type CollectionMethods<
160
156
 
161
157
  type CollectionConveniences<
162
158
  Collection,
163
- Requirement,
164
159
  Contract,
165
160
  Model extends string,
161
+ DatabaseId,
166
162
  > = Contract extends AnyPostgresContract
167
163
  ? Collection extends PrismaCollection<
168
164
  Contract,
@@ -171,26 +167,26 @@ type CollectionConveniences<
171
167
  infer _State
172
168
  >
173
169
  ? {
174
- readonly stream: Stream.Stream<Row, PrismaError, Requirement>;
175
- count(): RelationQuery<number, Requirement, Contract, Model>;
176
- exists(): Effect.Effect<boolean, PrismaError, Requirement>;
170
+ readonly stream: Stream.Stream<Row, PrismaError>;
171
+ count(): RelationQuery<number, Contract, Model, DatabaseId>;
172
+ exists(): Effect.Effect<boolean, PrismaError>;
177
173
  }
178
174
  : Record<never, never>
179
175
  : CollectionResult<Collection> extends ReadonlyArray<infer Row>
180
176
  ? {
181
- readonly stream: Stream.Stream<Row, PrismaError, Requirement>;
182
- count(): Effect.Effect<number, PrismaError, Requirement>;
183
- exists(): Effect.Effect<boolean, PrismaError, Requirement>;
177
+ readonly stream: Stream.Stream<Row, PrismaError>;
178
+ count(): Effect.Effect<number, PrismaError>;
179
+ exists(): Effect.Effect<boolean, PrismaError>;
184
180
  }
185
181
  : Record<never, never>;
186
182
 
187
183
  export type PrismaRelationMethods<
188
184
  Collection,
189
- Requirement,
190
185
  Contract,
191
186
  Model extends string,
192
- > = SelectMethod<Collection, Requirement, Contract, Model> &
193
- IncludeMethod<Collection, Requirement, Contract, Model> &
194
- AggregateMethod<Collection, Requirement, Contract, Model> &
195
- CollectionMethods<Collection, Requirement, Contract, Model> &
196
- CollectionConveniences<Collection, Requirement, Contract, Model>;
187
+ DatabaseId,
188
+ > = SelectMethod<Collection, Contract, Model, DatabaseId> &
189
+ IncludeMethod<Collection, Contract, Model, DatabaseId> &
190
+ AggregateMethod<Collection, Contract, Model> &
191
+ CollectionMethods<Collection, Contract, Model, DatabaseId> &
192
+ CollectionConveniences<Collection, Contract, Model, DatabaseId>;
package/src/relation.ts CHANGED
@@ -14,23 +14,19 @@ type NormalizeTerminal<Name, Result> = Name extends "first"
14
14
  ? import("effect").Option.Option<Exclude<Result, null>>
15
15
  : Result;
16
16
 
17
- type WrapReturn<Name, Result, Requirement, Contract, Model extends string> =
17
+ type WrapReturn<Name, Result, Contract, Model extends string, DatabaseId> =
18
18
  Result extends PromiseLike<infer Value>
19
- ? Effect.Effect<
20
- NormalizeTerminal<Name, Awaited<Value>>,
21
- PrismaError,
22
- Requirement
23
- >
19
+ ? Effect.Effect<NormalizeTerminal<Name, Awaited<Value>>, PrismaError>
24
20
  : Result extends object
25
- ? Relation<Result, Requirement, Contract, Model>
21
+ ? Relation<Result, Contract, Model, DatabaseId>
26
22
  : never;
27
23
 
28
24
  type WrapFunction<
29
25
  Name,
30
26
  Function_,
31
- Requirement,
32
27
  Contract,
33
28
  Model extends string,
29
+ DatabaseId,
34
30
  > = Function_ extends {
35
31
  (...arguments_: infer Arguments1): infer Result1;
36
32
  (...arguments_: infer Arguments2): infer Result2;
@@ -41,22 +37,22 @@ type WrapFunction<
41
37
  }
42
38
  ? ((
43
39
  ...arguments_: Arguments1
44
- ) => WrapReturn<Name, Result1, Requirement, Contract, Model>) &
40
+ ) => WrapReturn<Name, Result1, Contract, Model, DatabaseId>) &
45
41
  ((
46
42
  ...arguments_: Arguments2
47
- ) => WrapReturn<Name, Result2, Requirement, Contract, Model>) &
43
+ ) => WrapReturn<Name, Result2, Contract, Model, DatabaseId>) &
48
44
  ((
49
45
  ...arguments_: Arguments3
50
- ) => WrapReturn<Name, Result3, Requirement, Contract, Model>) &
46
+ ) => WrapReturn<Name, Result3, Contract, Model, DatabaseId>) &
51
47
  ((
52
48
  ...arguments_: Arguments4
53
- ) => WrapReturn<Name, Result4, Requirement, Contract, Model>) &
49
+ ) => WrapReturn<Name, Result4, Contract, Model, DatabaseId>) &
54
50
  ((
55
51
  ...arguments_: Arguments5
56
- ) => WrapReturn<Name, Result5, Requirement, Contract, Model>) &
52
+ ) => WrapReturn<Name, Result5, Contract, Model, DatabaseId>) &
57
53
  ((
58
54
  ...arguments_: Arguments6
59
- ) => WrapReturn<Name, Result6, Requirement, Contract, Model>)
55
+ ) => WrapReturn<Name, Result6, Contract, Model, DatabaseId>)
60
56
  : never;
61
57
 
62
58
  type FunctionKeys<Value> = {
@@ -82,37 +78,33 @@ type ExplicitPrismaMethod =
82
78
  | "sum"
83
79
  | "variant";
84
80
 
85
- type RelationMethods<
86
- Collection,
87
- Requirement,
88
- Contract,
89
- Model extends string,
90
- > = {
81
+ type RelationMethods<Collection, Contract, Model extends string, DatabaseId> = {
91
82
  readonly [Key in Exclude<
92
83
  FunctionKeys<Collection>,
93
84
  ExplicitPrismaMethod
94
- >]: WrapFunction<Key, Collection[Key], Requirement, Contract, Model>;
85
+ >]: WrapFunction<Key, Collection[Key], Contract, Model, DatabaseId>;
95
86
  };
96
87
 
97
88
  declare const RelationQueryTypeId: unique symbol;
98
89
 
99
90
  export type RelationQuery<
100
91
  Value,
101
- Requirement,
102
92
  Contract,
103
93
  Model extends string,
104
- > = Effect.Effect<Value, PrismaError, Requirement> & {
94
+ DatabaseId,
95
+ > = Effect.Effect<Value, PrismaError> & {
105
96
  readonly [RelationQueryTypeId]: {
106
97
  readonly contract: Contract;
98
+ readonly database: (database: DatabaseId) => DatabaseId;
107
99
  readonly model: Model;
108
100
  };
109
101
  };
110
102
 
111
103
  export type Relation<
112
104
  Collection,
113
- Requirement,
114
105
  Contract = undefined,
115
106
  Model extends string = string,
116
- > = RelationQuery<CollectionResult<Collection>, Requirement, Contract, Model> &
117
- RelationMethods<Collection, Requirement, Contract, Model> &
118
- PrismaRelationMethods<Collection, Requirement, Contract, Model>;
107
+ DatabaseId = undefined,
108
+ > = RelationQuery<CollectionResult<Collection>, Contract, Model, DatabaseId> &
109
+ RelationMethods<Collection, Contract, Model, DatabaseId> &
110
+ PrismaRelationMethods<Collection, Contract, Model, DatabaseId>;
package/src/sqlite.ts CHANGED
@@ -2,7 +2,7 @@ import sqlite, {
2
2
  type SqliteClient,
3
3
  type SqliteOptionsBase,
4
4
  } from "@prisma-next/sqlite/runtime";
5
- import type { Layer } from "effect";
5
+ import { type Layer, Semaphore } from "effect";
6
6
  import type { PrismaError } from "./error.js";
7
7
  import {
8
8
  acquireConnectedClient,
@@ -10,14 +10,12 @@ import {
10
10
  } from "./internal/client-lifecycle.js";
11
11
  import {
12
12
  type DatabaseIdentifier,
13
+ type DatabaseIdentifierLiteral,
13
14
  type DatabaseServiceHolder,
14
15
  type DefaultModels,
15
16
  makeSqlDatabase,
16
17
  } from "./internal/database-factory.js";
17
- import type {
18
- AnySqlContract,
19
- ExecutorIdentifier,
20
- } from "./internal/executor.js";
18
+ import type { AnySqlContract } from "./internal/executor.js";
21
19
  import { fromPrismaPromise } from "./internal/promise.js";
22
20
  import { decodeSqliteDatetimesAsUtc } from "./internal/sqlite-datetime.js";
23
21
  import {
@@ -49,60 +47,69 @@ type SqliteFactoryOptions<Contract extends AnySqlContract> =
49
47
 
50
48
  export interface SqliteDatabaseDefinition<
51
49
  Contract extends AnySqlContract,
52
- Requirement = ExecutorIdentifier<DefaultModels<Contract>>,
53
- > extends DatabaseServiceHolder<Contract, Requirement> {
50
+ Identifier extends string,
51
+ > extends DatabaseServiceHolder<Contract, Identifier> {
54
52
  readonly layer: (
55
53
  options: SqliteDatabaseLayerOptions,
56
- ) => Layer.Layer<DatabaseIdentifier<Contract> | Requirement, PrismaError>;
54
+ ) => Layer.Layer<DatabaseIdentifier<Contract, Identifier>, PrismaError>;
57
55
  }
58
56
 
59
- export const makeSqliteDatabase = <const Contract extends AnySqlContract>(
60
- identifier: string,
61
- options: SqliteFactoryOptions<Contract>,
62
- ): SqliteDatabaseDefinition<Contract> => {
63
- type Models = DefaultModels<Contract>;
57
+ export const makeSqliteDatabase =
58
+ <const Contract extends AnySqlContract>() =>
59
+ <const Identifier extends string>(
60
+ identifier: DatabaseIdentifierLiteral<Identifier>,
61
+ options: SqliteFactoryOptions<Contract>,
62
+ ): SqliteDatabaseDefinition<Contract, Identifier> => {
63
+ type Models = DefaultModels<Contract>;
64
64
 
65
- return makeSqlDatabase<Contract, SqliteDatabaseLayerOptions>(
66
- identifier,
67
- (layerOptions) => {
68
- assertFileBackedPath(layerOptions.path);
69
- applySqlitePragmas(
70
- layerOptions.path,
71
- layerOptions.pragmas ?? defaultSqlitePragmas,
72
- );
65
+ return makeSqlDatabase<Contract, Identifier, SqliteDatabaseLayerOptions>(
66
+ identifier,
67
+ (layerOptions) => {
68
+ assertFileBackedPath(layerOptions.path);
69
+ applySqlitePragmas(
70
+ layerOptions.path,
71
+ layerOptions.pragmas ?? defaultSqlitePragmas,
72
+ );
73
73
 
74
- const clientOptions = {
75
- path: layerOptions.path,
76
- extensions: layerOptions.extensions,
77
- middleware: layerOptions.middleware,
78
- verifyMarker: layerOptions.verifyMarker,
79
- };
80
- const client: SqliteClient<Contract> =
81
- options.contract === undefined
82
- ? sqlite<Contract>({
83
- ...clientOptions,
84
- contractJson: options.contractJson,
85
- })
86
- : sqlite<Contract>({
87
- ...clientOptions,
88
- contract: options.contract,
89
- });
74
+ const clientOptions = {
75
+ path: layerOptions.path,
76
+ extensions: layerOptions.extensions,
77
+ middleware: layerOptions.middleware,
78
+ verifyMarker: layerOptions.verifyMarker,
79
+ };
80
+ const client: SqliteClient<Contract> =
81
+ options.contract === undefined
82
+ ? sqlite<Contract>({
83
+ ...clientOptions,
84
+ contractJson: options.contractJson,
85
+ })
86
+ : sqlite<Contract>({
87
+ ...clientOptions,
88
+ contract: options.contract,
89
+ });
90
90
 
91
- decodeSqliteDatetimesAsUtc(client.context);
91
+ decodeSqliteDatetimesAsUtc(client.context);
92
92
 
93
- return fromPrismaPromise(() =>
94
- acquireConnectedClient(client, () => {
95
- // The SQLite client already exposes the unbound namespace.
96
- const models = client.orm as Models;
97
- assertAvailableModelNames(Object.keys(models));
98
- return {
99
- client,
100
- models,
101
- querySemaphore: undefined,
102
- transactional: false,
103
- };
104
- }),
105
- );
106
- },
107
- ) as SqliteDatabaseDefinition<Contract>;
108
- };
93
+ return fromPrismaPromise(() =>
94
+ acquireConnectedClient(client, () => {
95
+ // The SQLite client already exposes the unbound namespace.
96
+ const models = client.orm as Models;
97
+ assertAvailableModelNames(Object.keys(models));
98
+ return {
99
+ client,
100
+ identity: {},
101
+ liveness: {
102
+ closedCode: "RUNTIME.DATABASE_CLOSED",
103
+ open: true,
104
+ },
105
+ mode: "root",
106
+ models,
107
+ querySemaphore: undefined,
108
+ transactionIdentity: undefined,
109
+ transactionSemaphore: Semaphore.makeUnsafe(1),
110
+ };
111
+ }),
112
+ );
113
+ },
114
+ ) as SqliteDatabaseDefinition<Contract, Identifier>;
115
+ };
@@ -1,18 +1,28 @@
1
1
  import type { Effect } from "effect";
2
2
  import type { PrismaError } from "../error.js";
3
3
  import { getDatabaseTesting } from "../internal/testing.js";
4
- import type { AnyDatabase, DatabaseRequirement } from "./types.js";
4
+ import type { AnyDatabase } from "./types.js";
5
5
 
6
6
  type WithTestTransaction = {
7
7
  <Database extends AnyDatabase>(
8
8
  database: Database,
9
9
  ): <A, E, R>(
10
- program: Effect.Effect<A, E, R>,
11
- ) => Effect.Effect<A, E | PrismaError, R | DatabaseRequirement<Database>>;
10
+ program: Effect.Effect<A, E, R> &
11
+ (Effect.Services<Database> extends R ? unknown : never),
12
+ ) => Effect.Effect<
13
+ A,
14
+ E | PrismaError,
15
+ Effect.Services<Database> | Exclude<R, Effect.Services<Database>>
16
+ >;
12
17
  <Database extends AnyDatabase, A, E, R>(
13
18
  database: Database,
14
- program: Effect.Effect<A, E, R>,
15
- ): Effect.Effect<A, E | PrismaError, R | DatabaseRequirement<Database>>;
19
+ program: Effect.Effect<A, E, R> &
20
+ (Effect.Services<Database> extends R ? unknown : never),
21
+ ): Effect.Effect<
22
+ A,
23
+ E | PrismaError,
24
+ Effect.Services<Database> | Exclude<R, Effect.Services<Database>>
25
+ >;
16
26
  };
17
27
 
18
28
  export const withTestTransaction: WithTestTransaction = ((
@@ -20,7 +30,7 @@ export const withTestTransaction: WithTestTransaction = ((
20
30
  program?: Effect.Effect<unknown, unknown, unknown>,
21
31
  ) => {
22
32
  const run = (effect: Effect.Effect<unknown, unknown, unknown>) =>
23
- getDatabaseTesting<DatabaseRequirement<typeof database>>(
33
+ getDatabaseTesting<Effect.Services<typeof database>>(
24
34
  database,
25
35
  ).withTestTransaction(effect);
26
36
 
@@ -2,7 +2,7 @@ import type { TestContext, TestOptions, Vitest } from "@effect/vitest";
2
2
  import type { Effect, Layer } from "effect";
3
3
  import type { AnyDatabase, DatabaseServiceOf } from "../database.js";
4
4
 
5
- export type { AnyDatabase, DatabaseRequirement } from "../database.js";
5
+ export type { AnyDatabase } from "../database.js";
6
6
  export type DatabaseService<Database extends AnyDatabase> =
7
7
  DatabaseServiceOf<Database>;
8
8
 
@@ -8,7 +8,6 @@ import {
8
8
  import type {
9
9
  AnyDatabase,
10
10
  DatabaseIt,
11
- DatabaseRequirement,
12
11
  MakeDatabaseItOptions,
13
12
  } from "./types.js";
14
13
 
@@ -19,18 +18,12 @@ export const makeDatabaseIt = <
19
18
  >(
20
19
  options: MakeDatabaseItOptions<Database, Provided, LayerError> & {
21
20
  readonly layer: Layer.Layer<
22
- Provided | DatabaseRequirement<Database> | Effect.Services<Database>,
21
+ Provided | Effect.Services<Database>,
23
22
  LayerError
24
23
  >;
25
24
  },
26
- ): DatabaseIt<
27
- Database,
28
- Provided | DatabaseRequirement<Database> | Effect.Services<Database>
29
- > => {
30
- type Services =
31
- | Provided
32
- | DatabaseRequirement<Database>
33
- | Effect.Services<Database>;
25
+ ): DatabaseIt<Database, Provided | Effect.Services<Database>> => {
26
+ type Services = Provided | Effect.Services<Database>;
34
27
 
35
28
  const fixtureIt = effectIt.extend(
36
29
  fixtureName,
package/src/testing.ts CHANGED
@@ -2,7 +2,6 @@ export { withTestTransaction } from "./testing/transaction.js";
2
2
  export type {
3
3
  AnyDatabase,
4
4
  DatabaseIt,
5
- DatabaseRequirement,
6
5
  DatabaseService,
7
6
  DatabaseTest,
8
7
  DatabaseTester,