@shivaedev/effect-prisma 0.1.0 → 0.3.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 +22 -0
- package/README.md +44 -5
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +1 -0
- package/dist/database.js.map +1 -1
- package/dist/internal/executor.d.ts +2 -1
- package/dist/internal/executor.d.ts.map +1 -1
- package/dist/internal/query-execution.d.ts +6 -0
- package/dist/internal/query-execution.d.ts.map +1 -0
- package/dist/internal/query-execution.js +5 -0
- package/dist/internal/query-execution.js.map +1 -0
- package/dist/internal/recipe.d.ts.map +1 -1
- package/dist/internal/recipe.js +66 -11
- package/dist/internal/recipe.js.map +1 -1
- package/dist/internal/relation-plan.d.ts +8 -0
- package/dist/internal/relation-plan.d.ts.map +1 -0
- package/dist/internal/relation-plan.js +10 -0
- package/dist/internal/relation-plan.js.map +1 -0
- package/dist/internal/relation-runtime.d.ts.map +1 -1
- package/dist/internal/relation-runtime.js +24 -18
- package/dist/internal/relation-runtime.js.map +1 -1
- package/dist/internal/relation-stream.d.ts +7 -0
- package/dist/internal/relation-stream.d.ts.map +1 -0
- package/dist/internal/relation-stream.js +28 -0
- package/dist/internal/relation-stream.js.map +1 -0
- package/dist/internal/transaction.d.ts.map +1 -1
- package/dist/internal/transaction.js +2 -1
- package/dist/internal/transaction.js.map +1 -1
- package/dist/relation/include-metadata.d.ts +34 -0
- package/dist/relation/include-metadata.d.ts.map +1 -0
- package/dist/relation/include-metadata.js +2 -0
- package/dist/relation/include-metadata.js.map +1 -0
- package/dist/relation/include.d.ts +25 -0
- package/dist/relation/include.d.ts.map +1 -0
- package/dist/relation/include.js +2 -0
- package/dist/relation/include.js.map +1 -0
- package/dist/relation/prisma-methods.d.ts +5 -2
- package/dist/relation/prisma-methods.d.ts.map +1 -1
- package/dist/relation.d.ts +8 -1
- package/dist/relation.d.ts.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js.map +1 -1
- package/package.json +5 -5
- package/src/database.ts +1 -0
- package/src/internal/executor.ts +2 -1
- package/src/internal/query-execution.ts +10 -0
- package/src/internal/recipe.ts +96 -19
- package/src/internal/relation-plan.ts +22 -0
- package/src/internal/relation-runtime.ts +50 -43
- package/src/internal/relation-stream.ts +66 -0
- package/src/internal/transaction.ts +2 -1
- package/src/relation/include-metadata.ts +102 -0
- package/src/relation/include.ts +169 -0
- package/src/relation/prisma-methods.ts +5 -1
- package/src/relation.ts +15 -1
- package/src/testing.ts +3 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DefaultModelRow, Collection as PrismaCollection, RelationNames } from "@prisma-next/sql-orm-client";
|
|
2
|
+
import type { Relation, RelationQuery } from "../relation.js";
|
|
3
|
+
import type { AnyPostgresContract, IncludedRelationValue, IsToManyRelation, RelatedModelNameOf } from "./include-metadata.js";
|
|
4
|
+
type Simplify<Value> = {
|
|
5
|
+
[Key in keyof Value]: Value[Key];
|
|
6
|
+
};
|
|
7
|
+
type QueryValue<Query> = Query extends RelationQuery<infer Value, infer _Requirement, infer _Contract, infer _Model> ? Value : never;
|
|
8
|
+
type AcceptRelatedQuery<Query, Contract extends AnyPostgresContract, Model extends string> = Query extends RelationQuery<infer _Value, infer _Requirement, infer QueryContract, infer QueryModel> ? [QueryContract] extends [Contract] ? [Contract] extends [QueryContract] ? QueryModel extends Model ? unknown : never : never : never : never;
|
|
9
|
+
type IncludedQueryValue<Query, Contract extends AnyPostgresContract, Model extends string, RelationName extends string> = QueryValue<Query> extends ReadonlyArray<infer Row> ? IncludedRelationValue<Contract, Model, RelationName, Row> : QueryValue<Query>;
|
|
10
|
+
type QueryShapeValue<Shape extends Readonly<Record<string, unknown>>> = {
|
|
11
|
+
readonly [Key in keyof Shape]: QueryValue<Shape[Key]>;
|
|
12
|
+
};
|
|
13
|
+
type AcceptRelatedQueryShape<Shape extends Readonly<Record<string, unknown>>, Contract extends AnyPostgresContract, Model extends string> = {
|
|
14
|
+
readonly [Key in keyof Shape]: Shape[Key] & AcceptRelatedQuery<Shape[Key], Contract, Model>;
|
|
15
|
+
};
|
|
16
|
+
type WithIncludedRelation<Collection, Contract extends AnyPostgresContract, Model extends string, RelationName extends string, Value> = Collection extends PrismaCollection<Contract, Model, infer Row, infer State> ? PrismaCollection<Contract, Model, Simplify<Row & {
|
|
17
|
+
readonly [Key in RelationName]: Value;
|
|
18
|
+
}>, State> : never;
|
|
19
|
+
export type IncludeMethod<Collection, Requirement, Contract, Model extends string> = Contract extends AnyPostgresContract ? Collection extends PrismaCollection<Contract, Model, infer _Row, infer _State> ? {
|
|
20
|
+
include<RelationName extends RelationNames<Contract, Model>>(relationName: RelationName): Relation<WithIncludedRelation<Collection, Contract, Model, RelationName, IncludedRelationValue<Contract, Model, RelationName, DefaultModelRow<Contract, RelatedModelNameOf<Contract, Model, RelationName>>>>, Requirement, Contract, Model>;
|
|
21
|
+
include<RelationName extends RelationNames<Contract, Model>, Query>(relationName: RelationName, query: Query & AcceptRelatedQuery<Query, Contract, RelatedModelNameOf<Contract, Model, RelationName>>): Relation<WithIncludedRelation<Collection, Contract, Model, RelationName, IncludedQueryValue<Query, Contract, Model, RelationName>>, Requirement, Contract, Model>;
|
|
22
|
+
include<RelationName extends RelationNames<Contract, Model>, Shape extends Readonly<Record<string, unknown>>>(relationName: RelationName, shape: IsToManyRelation<Contract, Model, RelationName> extends true ? keyof Shape extends never ? never : Shape & AcceptRelatedQueryShape<Shape, Contract, RelatedModelNameOf<Contract, Model, RelationName>> : never): Relation<WithIncludedRelation<Collection, Contract, Model, RelationName, QueryShapeValue<Shape>>, Requirement, Contract, Model>;
|
|
23
|
+
} : Record<never, never> : Record<never, never>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=include.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../../src/relation/include.ts"],"names":[],"mappings":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,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.js","sourceRoot":"","sources":["../../src/relation/include.ts"],"names":[],"mappings":""}
|
|
@@ -3,7 +3,8 @@ import type { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
|
3
3
|
import type { AggregateBuilder, AggregateResult, AggregateSpec, DefaultModelRow, GroupedCollection, Collection as PrismaCollection } from "@prisma-next/sql-orm-client";
|
|
4
4
|
import type { Effect, Stream } from "effect";
|
|
5
5
|
import type { PrismaError } from "../error.js";
|
|
6
|
-
import type { CollectionResult, Relation } from "../relation.js";
|
|
6
|
+
import type { CollectionResult, Relation, RelationQuery } from "../relation.js";
|
|
7
|
+
import type { IncludeMethod } from "./include.js";
|
|
7
8
|
type AnyFunction = (...arguments_: ReadonlyArray<never>) => unknown;
|
|
8
9
|
type AnyPostgresContract = PrismaContract<SqlStorage>;
|
|
9
10
|
type FieldTuple<Row> = readonly [keyof Row & string, ...(keyof Row & string)[]];
|
|
@@ -43,11 +44,13 @@ type CollectionMethods<Collection, Requirement, Contract, Model extends string>
|
|
|
43
44
|
} : Record<never, never>) : Record<never, never> : Record<never, never>;
|
|
44
45
|
type CollectionConveniences<Collection, Requirement, Contract, Model extends string> = Contract extends AnyPostgresContract ? Collection extends PrismaCollection<Contract, Model, infer Row, infer _State> ? {
|
|
45
46
|
readonly stream: Stream.Stream<Row, PrismaError, Requirement>;
|
|
47
|
+
count(): RelationQuery<number, Requirement, Contract, Model>;
|
|
46
48
|
exists(): Effect.Effect<boolean, PrismaError, Requirement>;
|
|
47
49
|
} : Record<never, never> : CollectionResult<Collection> extends ReadonlyArray<infer Row> ? {
|
|
48
50
|
readonly stream: Stream.Stream<Row, PrismaError, Requirement>;
|
|
51
|
+
count(): Effect.Effect<number, PrismaError, Requirement>;
|
|
49
52
|
exists(): Effect.Effect<boolean, PrismaError, Requirement>;
|
|
50
53
|
} : Record<never, never>;
|
|
51
|
-
export type PrismaRelationMethods<Collection, Requirement, Contract, Model extends string> = SelectMethod<Collection, Requirement, Contract, Model> & AggregateMethod<Collection, Requirement, Contract, Model> & CollectionMethods<Collection, Requirement, Contract, Model> & CollectionConveniences<Collection, Requirement, Contract, Model>;
|
|
54
|
+
export type PrismaRelationMethods<Collection, Requirement, Contract, Model extends string> = SelectMethod<Collection, Requirement, Contract, Model> & IncludeMethod<Collection, Requirement, Contract, Model> & AggregateMethod<Collection, Requirement, Contract, Model> & CollectionMethods<Collection, Requirement, Contract, Model> & CollectionConveniences<Collection, Requirement, Contract, Model>;
|
|
52
55
|
export {};
|
|
53
56
|
//# sourceMappingURL=prisma-methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-methods.d.ts","sourceRoot":"","sources":["../../src/relation/prisma-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,UAAU,IAAI,gBAAgB,EAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"prisma-methods.d.ts","sourceRoot":"","sources":["../../src/relation/prisma-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EACX,gBAAgB,EAChB,eA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AE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC9D,KAAK,IAAI,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7D,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;CAC3D,GACA,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GACrB,gBAAgB,CAAC,UAAU,CAAC,SAAS,aAAa,CAAC,MAAM,GAAG,CAAC,GAC5D;IACA,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC9D,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACzD,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;CAC3D,GACA,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEzB,MAAM,MAAM,qBAAqB,CAChC,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,SAAS,MAAM,IACjB,YAAY,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,GACzD,aAAa,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,GACvD,eAAe,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,GACzD,iBAAiB,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,GAC3D,sBAAsB,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/relation.d.ts
CHANGED
|
@@ -22,6 +22,13 @@ type ExplicitPrismaMethod = "aggregate" | "avg" | "combine" | "count" | "cursor"
|
|
|
22
22
|
type RelationMethods<Collection, Requirement, Contract, Model extends string> = {
|
|
23
23
|
readonly [Key in Exclude<FunctionKeys<Collection>, ExplicitPrismaMethod>]: WrapFunction<Key, Collection[Key], Requirement, Contract, Model>;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
declare const RelationQueryTypeId: unique symbol;
|
|
26
|
+
export type RelationQuery<Value, Requirement, Contract, Model extends string> = Effect.Effect<Value, PrismaError, Requirement> & {
|
|
27
|
+
readonly [RelationQueryTypeId]: {
|
|
28
|
+
readonly contract: Contract;
|
|
29
|
+
readonly model: Model;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type Relation<Collection, Requirement, Contract = undefined, Model extends string = string> = RelationQuery<CollectionResult<Collection>, Requirement, Contract, Model> & RelationMethods<Collection, Requirement, Contract, Model> & PrismaRelationMethods<Collection, Requirement, Contract, Model>;
|
|
26
33
|
export {};
|
|
27
34
|
//# sourceMappingURL=relation.d.ts.map
|
package/dist/relation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,KAAK,WAAW,GAAG,CAAC,GAAG,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;AAEpE,MAAM,MAAM,gBAAgB,CAAC,UAAU,IAAI,UAAU,SAAS;IAC7D,GAAG,IAAI,MAAM,MAAM,CAAC;CACpB,GACE,OAAO,CAAC,MAAM,CAAC,GACf,KAAK,CAAC;AAET,KAAK,iBAAiB,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI,SAAS,OAAO,GACxD,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,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AK,CAAC,CAAC"}
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { withTestTransaction } from "./testing/transaction.js";
|
|
2
|
-
export type { DatabaseIt, DatabaseTest, DatabaseTester, MakeDatabaseItOptions, } from "./testing/types.js";
|
|
2
|
+
export type { AnyDatabase, DatabaseIt, DatabaseRequirement, DatabaseService, DatabaseTest, DatabaseTester, MakeDatabaseItOptions, } from "./testing/types.js";
|
|
3
3
|
export { makeDatabaseIt } from "./testing/vitest.js";
|
|
4
4
|
//# sourceMappingURL=testing.d.ts.map
|
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACX,UAAU,EACV,YAAY,EACZ,cAAc,EACd,qBAAqB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACX,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,qBAAqB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAU/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/effect-prisma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Effect-native PostgreSQL queries and transactions for Prisma Next",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@prisma-next/sql-runtime": "0.15.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@effect/vitest": "4.0.0-beta.
|
|
55
|
-
"effect": "4.0.0-beta.
|
|
54
|
+
"@effect/vitest": "4.0.0-beta.102",
|
|
55
|
+
"effect": "4.0.0-beta.102"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@effect/vitest": {
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@effect/vitest": "4.0.0-beta.
|
|
63
|
+
"@effect/vitest": "4.0.0-beta.102",
|
|
64
64
|
"@prisma-next/adapter-postgres": "0.15.0",
|
|
65
65
|
"@prisma-next/cli": "0.15.0",
|
|
66
66
|
"@prisma-next/target-postgres": "0.15.0",
|
|
67
67
|
"@types/node": "24.10.1",
|
|
68
68
|
"@types/pg": "8.20.0",
|
|
69
69
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
70
|
-
"effect": "4.0.0-beta.
|
|
70
|
+
"effect": "4.0.0-beta.102",
|
|
71
71
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
72
72
|
"vitest": "4.1.9"
|
|
73
73
|
},
|
package/src/database.ts
CHANGED
|
@@ -210,6 +210,7 @@ export const makeDatabase = <const Contract extends AnyPostgresContract>(
|
|
|
210
210
|
acquireConnectedClient(client, () => ({
|
|
211
211
|
client,
|
|
212
212
|
models: defaultModels<Contract, Models>(client),
|
|
213
|
+
querySemaphore: undefined,
|
|
213
214
|
transactional: false,
|
|
214
215
|
})),
|
|
215
216
|
);
|
package/src/internal/executor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Contract as PrismaContract } from "@prisma-next/contract/types";
|
|
2
2
|
import type { PostgresClient } from "@prisma-next/postgres/runtime";
|
|
3
3
|
import type { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
4
|
-
import type { Context } from "effect";
|
|
4
|
+
import type { Context, Semaphore } from "effect";
|
|
5
5
|
|
|
6
6
|
export type AnyPostgresContract = PrismaContract<SqlStorage>;
|
|
7
7
|
|
|
@@ -11,6 +11,7 @@ export interface DatabaseExecutor<
|
|
|
11
11
|
> {
|
|
12
12
|
readonly client: PostgresClient<Contract>;
|
|
13
13
|
readonly models: Models;
|
|
14
|
+
readonly querySemaphore: Semaphore.Semaphore | undefined;
|
|
14
15
|
readonly transactional: boolean;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Semaphore } from "effect";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
|
|
4
|
+
export const executeQuery = <A, E, R>(
|
|
5
|
+
executor: { readonly querySemaphore: Semaphore.Semaphore | undefined },
|
|
6
|
+
effect: Effect.Effect<A, E, R>,
|
|
7
|
+
): Effect.Effect<A, E, R> =>
|
|
8
|
+
executor.querySemaphore === undefined
|
|
9
|
+
? effect
|
|
10
|
+
: executor.querySemaphore.withPermit(Effect.uninterruptible(effect));
|
package/src/internal/recipe.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getRelationPlan, type RelationPlan } from "./relation-plan.js";
|
|
2
|
+
|
|
1
3
|
export interface RelationOperation {
|
|
2
4
|
readonly name: PropertyKey;
|
|
3
5
|
readonly arguments: ReadonlyArray<unknown>;
|
|
@@ -40,32 +42,107 @@ const operations = (
|
|
|
40
42
|
return reversed.reverse();
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
const applyMethod = (
|
|
46
|
+
current: unknown,
|
|
47
|
+
name: PropertyKey,
|
|
48
|
+
arguments_: ReadonlyArray<unknown>,
|
|
49
|
+
model: string,
|
|
50
|
+
): unknown => {
|
|
51
|
+
if (
|
|
52
|
+
typeof current !== "object" ||
|
|
53
|
+
current === null ||
|
|
54
|
+
typeof Reflect.get(current, name) !== "function"
|
|
55
|
+
) {
|
|
56
|
+
throw new TypeError(`Cannot call ${String(name)} while replaying ${model}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const method = Reflect.get(current, name) as (
|
|
60
|
+
...arguments_: ReadonlyArray<unknown>
|
|
61
|
+
) => unknown;
|
|
62
|
+
return Reflect.apply(method, current, arguments_);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const replayPlan = (collection: unknown, plan: RelationPlan): unknown => {
|
|
66
|
+
const relatedModel =
|
|
67
|
+
typeof collection === "object" && collection !== null
|
|
68
|
+
? Reflect.get(collection, "modelName")
|
|
69
|
+
: undefined;
|
|
70
|
+
if (typeof relatedModel === "string" && relatedModel !== plan.recipe.model) {
|
|
71
|
+
throw new TypeError(
|
|
72
|
+
`Included relation expects ${relatedModel}, received ${plan.recipe.model}`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const refined = replayRecipeFrom(collection, plan.recipe);
|
|
77
|
+
if (plan.terminal !== "count") {
|
|
78
|
+
return refined;
|
|
79
|
+
}
|
|
80
|
+
return applyMethod(refined, "count", [], plan.recipe.model);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const includeRefinement = (
|
|
84
|
+
value: unknown,
|
|
85
|
+
): ((collection: unknown) => unknown) => {
|
|
86
|
+
const plan = getRelationPlan(value);
|
|
87
|
+
if (plan !== undefined) {
|
|
88
|
+
return (collection) => replayPlan(collection, plan);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
92
|
+
throw new TypeError(
|
|
93
|
+
"An included relation must be a Relation or query record",
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const entries = Object.entries(value);
|
|
98
|
+
if (entries.length === 0) {
|
|
99
|
+
throw new TypeError("An included query record cannot be empty");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const plans = entries.map(([name, query]) => {
|
|
103
|
+
const queryPlan = getRelationPlan(query);
|
|
104
|
+
if (queryPlan === undefined) {
|
|
105
|
+
throw new TypeError(`Included query "${name}" is not a Relation`);
|
|
106
|
+
}
|
|
107
|
+
return [name, queryPlan] as const;
|
|
108
|
+
});
|
|
109
|
+
const model = plans[0]?.[1].recipe.model;
|
|
110
|
+
if (plans.some(([, queryPlan]) => queryPlan.recipe.model !== model)) {
|
|
111
|
+
throw new TypeError("Included queries must use the same related model");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (collection) => {
|
|
115
|
+
const branches = Object.fromEntries(
|
|
116
|
+
plans.map(([name, queryPlan]) => [
|
|
117
|
+
name,
|
|
118
|
+
replayPlan(collection, queryPlan),
|
|
119
|
+
]),
|
|
120
|
+
);
|
|
121
|
+
return applyMethod(collection, "combine", [branches], model ?? "relation");
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const replayRecipeFrom = (root: unknown, recipe: RelationRecipe): unknown => {
|
|
126
|
+
let current = root;
|
|
127
|
+
for (const operation of operations(recipe)) {
|
|
128
|
+
const arguments_ =
|
|
129
|
+
operation.name === "include" && operation.arguments.length === 2
|
|
130
|
+
? [operation.arguments[0], includeRefinement(operation.arguments[1])]
|
|
131
|
+
: operation.arguments;
|
|
132
|
+
current = applyMethod(current, operation.name, arguments_, recipe.model);
|
|
133
|
+
}
|
|
134
|
+
return current;
|
|
135
|
+
};
|
|
136
|
+
|
|
43
137
|
export const replayRecipe = (
|
|
44
138
|
models: object,
|
|
45
139
|
recipe: RelationRecipe,
|
|
46
140
|
): unknown => {
|
|
47
|
-
|
|
141
|
+
const current: unknown = Reflect.get(models, recipe.model);
|
|
48
142
|
|
|
49
143
|
if (current === undefined) {
|
|
50
144
|
throw new TypeError(`Unknown Prisma model: ${recipe.model}`);
|
|
51
145
|
}
|
|
52
146
|
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
typeof current !== "object" ||
|
|
56
|
-
current === null ||
|
|
57
|
-
typeof Reflect.get(current, operation.name) !== "function"
|
|
58
|
-
) {
|
|
59
|
-
throw new TypeError(
|
|
60
|
-
`Cannot call ${String(operation.name)} while replaying ${recipe.model}`,
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const method = Reflect.get(current, operation.name) as (
|
|
65
|
-
...arguments_: ReadonlyArray<unknown>
|
|
66
|
-
) => unknown;
|
|
67
|
-
current = Reflect.apply(method, current, operation.arguments);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return current;
|
|
147
|
+
return replayRecipeFrom(current, recipe);
|
|
71
148
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RelationRecipe } from "./recipe.js";
|
|
2
|
+
|
|
3
|
+
export const RelationPlanTypeId = Symbol.for(
|
|
4
|
+
"@shivaedev/effect-prisma/RelationPlan",
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
export interface RelationPlan {
|
|
8
|
+
readonly recipe: RelationRecipe;
|
|
9
|
+
readonly terminal?: PropertyKey;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const getRelationPlan = (value: unknown): RelationPlan | undefined => {
|
|
13
|
+
if (
|
|
14
|
+
typeof value !== "object" ||
|
|
15
|
+
value === null ||
|
|
16
|
+
!Reflect.has(value, RelationPlanTypeId)
|
|
17
|
+
) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return Reflect.get(value, RelationPlanTypeId) as RelationPlan;
|
|
22
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from "effect";
|
|
2
|
-
import { Effect, Effectable, Option, Stream } from "effect";
|
|
3
|
-
import {
|
|
2
|
+
import { Effect, Effectable, Option, type Stream } from "effect";
|
|
3
|
+
import type { PrismaError } from "../error.js";
|
|
4
4
|
import type { Relation } from "../relation.js";
|
|
5
5
|
import type {
|
|
6
6
|
AnyPostgresContract,
|
|
@@ -8,12 +8,15 @@ import type {
|
|
|
8
8
|
ExecutorIdentifier,
|
|
9
9
|
} from "./executor.js";
|
|
10
10
|
import { fromPrismaPromise } from "./promise.js";
|
|
11
|
+
import { executeQuery } from "./query-execution.js";
|
|
11
12
|
import {
|
|
12
13
|
appendOperation,
|
|
13
14
|
type RelationRecipe,
|
|
14
15
|
replayRecipe,
|
|
15
16
|
rootRecipe,
|
|
16
17
|
} from "./recipe.js";
|
|
18
|
+
import { RelationPlanTypeId } from "./relation-plan.js";
|
|
19
|
+
import { makeRelationStream } from "./relation-stream.js";
|
|
17
20
|
|
|
18
21
|
type AnyFunction = (...arguments_: ReadonlyArray<never>) => unknown;
|
|
19
22
|
|
|
@@ -33,6 +36,22 @@ const evaluateResult = (
|
|
|
33
36
|
value: unknown,
|
|
34
37
|
terminal: PropertyKey | undefined,
|
|
35
38
|
): Effect.Effect<unknown, PrismaError> => {
|
|
39
|
+
if (
|
|
40
|
+
terminal === "count" &&
|
|
41
|
+
typeof value === "object" &&
|
|
42
|
+
value !== null &&
|
|
43
|
+
typeof Reflect.get(value, "aggregate") === "function"
|
|
44
|
+
) {
|
|
45
|
+
const aggregate = Reflect.apply(
|
|
46
|
+
Reflect.get(value, "aggregate") as AnyFunction,
|
|
47
|
+
value,
|
|
48
|
+
[(summary: { count(): unknown }) => ({ count: summary.count() })],
|
|
49
|
+
);
|
|
50
|
+
return fromPrismaPromise(
|
|
51
|
+
() => aggregate as PromiseLike<{ count: number }>,
|
|
52
|
+
).pipe(Effect.map((result) => result.count));
|
|
53
|
+
}
|
|
54
|
+
|
|
36
55
|
if (
|
|
37
56
|
terminal === "exists" &&
|
|
38
57
|
typeof value === "object" &&
|
|
@@ -75,6 +94,10 @@ interface RelationValue<
|
|
|
75
94
|
Models extends object,
|
|
76
95
|
Contract extends AnyPostgresContract,
|
|
77
96
|
> extends Effect.Effect<unknown, PrismaError, ExecutorIdentifier<Models>> {
|
|
97
|
+
readonly [RelationPlanTypeId]: {
|
|
98
|
+
readonly recipe: RelationRecipe;
|
|
99
|
+
readonly terminal?: PropertyKey;
|
|
100
|
+
};
|
|
78
101
|
readonly runtime: RelationRuntime<Models, Contract>;
|
|
79
102
|
readonly stream: Stream.Stream<
|
|
80
103
|
unknown,
|
|
@@ -90,10 +113,13 @@ const relationEffect = <
|
|
|
90
113
|
self: RelationValue<Models, Contract>,
|
|
91
114
|
): Effect.Effect<unknown, PrismaError, ExecutorIdentifier<Models>> =>
|
|
92
115
|
Effect.flatMap(self.runtime.executor, (executor) =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
116
|
+
executeQuery(
|
|
117
|
+
executor,
|
|
118
|
+
Effect.suspend(() =>
|
|
119
|
+
evaluateResult(
|
|
120
|
+
replayRecipe(executor.models, self.runtime.recipe),
|
|
121
|
+
self.runtime.terminal,
|
|
122
|
+
),
|
|
97
123
|
),
|
|
98
124
|
),
|
|
99
125
|
).pipe(
|
|
@@ -110,41 +136,6 @@ const relationEffect = <
|
|
|
110
136
|
),
|
|
111
137
|
);
|
|
112
138
|
|
|
113
|
-
const relationStream = <
|
|
114
|
-
Models extends object,
|
|
115
|
-
Contract extends AnyPostgresContract,
|
|
116
|
-
>(
|
|
117
|
-
self: RelationValue<Models, Contract>,
|
|
118
|
-
): Stream.Stream<unknown, PrismaError, ExecutorIdentifier<Models>> => {
|
|
119
|
-
const result = Effect.map(self.runtime.executor, (executor) => {
|
|
120
|
-
const collection = replayRecipe(executor.models, self.runtime.recipe);
|
|
121
|
-
if (
|
|
122
|
-
typeof collection !== "object" ||
|
|
123
|
-
collection === null ||
|
|
124
|
-
typeof Reflect.get(collection, "all") !== "function"
|
|
125
|
-
) {
|
|
126
|
-
throw new TypeError("Only collection Relations can be streamed");
|
|
127
|
-
}
|
|
128
|
-
return Reflect.apply(
|
|
129
|
-
Reflect.get(collection, "all") as AnyFunction,
|
|
130
|
-
collection,
|
|
131
|
-
[],
|
|
132
|
-
) as AsyncIterable<unknown>;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return Stream.unwrap(
|
|
136
|
-
Effect.map(result, (iterable) =>
|
|
137
|
-
Stream.fromAsyncIterable(iterable, (error) => error).pipe(
|
|
138
|
-
Stream.catch((error) =>
|
|
139
|
-
isPrismaFailure(error)
|
|
140
|
-
? Stream.fail(toPrismaError(error))
|
|
141
|
-
: Stream.die(error),
|
|
142
|
-
),
|
|
143
|
-
),
|
|
144
|
-
),
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
139
|
const RelationPrototype = {
|
|
149
140
|
...Effectable.Prototype<
|
|
150
141
|
RelationValue<Record<string, unknown>, AnyPostgresContract>
|
|
@@ -159,8 +150,13 @@ const RelationPrototype = {
|
|
|
159
150
|
PrismaError,
|
|
160
151
|
ExecutorIdentifier<Record<string, unknown>>
|
|
161
152
|
> {
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
const relation = this as RelationValue<
|
|
154
|
+
Record<string, unknown>,
|
|
155
|
+
AnyPostgresContract
|
|
156
|
+
>;
|
|
157
|
+
return makeRelationStream(
|
|
158
|
+
relation.runtime.executor,
|
|
159
|
+
relation.runtime.recipe,
|
|
164
160
|
);
|
|
165
161
|
},
|
|
166
162
|
};
|
|
@@ -172,6 +168,10 @@ const makeRelationProxy = <
|
|
|
172
168
|
runtime: RelationRuntime<Models, Contract>,
|
|
173
169
|
): unknown => {
|
|
174
170
|
const target = Object.assign(Object.create(RelationPrototype), {
|
|
171
|
+
[RelationPlanTypeId]: {
|
|
172
|
+
recipe: runtime.recipe,
|
|
173
|
+
...(runtime.terminal === undefined ? {} : { terminal: runtime.terminal }),
|
|
174
|
+
},
|
|
175
175
|
runtime,
|
|
176
176
|
}) as RelationValue<Models, Contract>;
|
|
177
177
|
|
|
@@ -190,6 +190,13 @@ const makeRelationProxy = <
|
|
|
190
190
|
terminal: "exists",
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
+
if (property === "count") {
|
|
194
|
+
return () =>
|
|
195
|
+
makeRelationProxy({
|
|
196
|
+
...runtime,
|
|
197
|
+
terminal: "count",
|
|
198
|
+
});
|
|
199
|
+
}
|
|
193
200
|
return (...arguments_: ReadonlyArray<unknown>) =>
|
|
194
201
|
makeRelationProxy({
|
|
195
202
|
...runtime,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Context } from "effect";
|
|
2
|
+
import { Effect, Stream } from "effect";
|
|
3
|
+
import { isPrismaFailure, type PrismaError, toPrismaError } from "../error.js";
|
|
4
|
+
import type {
|
|
5
|
+
AnyPostgresContract,
|
|
6
|
+
DatabaseExecutor,
|
|
7
|
+
ExecutorIdentifier,
|
|
8
|
+
} from "./executor.js";
|
|
9
|
+
import { fromPrismaPromise } from "./promise.js";
|
|
10
|
+
import { executeQuery } from "./query-execution.js";
|
|
11
|
+
import { type RelationRecipe, replayRecipe } from "./recipe.js";
|
|
12
|
+
|
|
13
|
+
type AnyFunction = (...arguments_: ReadonlyArray<never>) => unknown;
|
|
14
|
+
|
|
15
|
+
export const makeRelationStream = <
|
|
16
|
+
Models extends object,
|
|
17
|
+
Contract extends AnyPostgresContract,
|
|
18
|
+
>(
|
|
19
|
+
executorService: Context.Service<
|
|
20
|
+
ExecutorIdentifier<Models>,
|
|
21
|
+
DatabaseExecutor<Models, Contract>
|
|
22
|
+
>,
|
|
23
|
+
recipe: RelationRecipe,
|
|
24
|
+
): Stream.Stream<unknown, PrismaError, ExecutorIdentifier<Models>> =>
|
|
25
|
+
Stream.unwrap(
|
|
26
|
+
Effect.map(executorService, (executor) => {
|
|
27
|
+
const collection = replayRecipe(executor.models, recipe);
|
|
28
|
+
if (
|
|
29
|
+
typeof collection !== "object" ||
|
|
30
|
+
collection === null ||
|
|
31
|
+
typeof Reflect.get(collection, "all") !== "function"
|
|
32
|
+
) {
|
|
33
|
+
throw new TypeError("Only collection Relations can be streamed");
|
|
34
|
+
}
|
|
35
|
+
const iterable = Reflect.apply(
|
|
36
|
+
Reflect.get(collection, "all") as AnyFunction,
|
|
37
|
+
collection,
|
|
38
|
+
[],
|
|
39
|
+
) as AsyncIterable<unknown>;
|
|
40
|
+
|
|
41
|
+
if (executor.querySemaphore === undefined) {
|
|
42
|
+
return Stream.fromAsyncIterable(iterable, (error) => error).pipe(
|
|
43
|
+
Stream.catch((error) =>
|
|
44
|
+
isPrismaFailure(error)
|
|
45
|
+
? Stream.fail(toPrismaError(error))
|
|
46
|
+
: Stream.die(error),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const buffered = executeQuery(
|
|
52
|
+
executor,
|
|
53
|
+
fromPrismaPromise(async () => {
|
|
54
|
+
const rows: Array<unknown> = [];
|
|
55
|
+
for await (const row of iterable) {
|
|
56
|
+
rows.push(row);
|
|
57
|
+
}
|
|
58
|
+
return rows;
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return Stream.unwrap(
|
|
63
|
+
Effect.map(buffered, (rows) => Stream.fromIterable(rows)),
|
|
64
|
+
);
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
RuntimeConnection,
|
|
5
5
|
RuntimeTransaction,
|
|
6
6
|
} from "@prisma-next/sql-runtime";
|
|
7
|
-
import { Effect, Exit } from "effect";
|
|
7
|
+
import { Effect, Exit, Semaphore } from "effect";
|
|
8
8
|
import type { PrismaError } from "../error.js";
|
|
9
9
|
import type { AnyPostgresContract, DatabaseExecutor } from "./executor.js";
|
|
10
10
|
import { fromPrismaPromise } from "./promise.js";
|
|
@@ -48,6 +48,7 @@ export const acquireTransaction = <
|
|
|
48
48
|
executor: {
|
|
49
49
|
client: current.client,
|
|
50
50
|
models: models(transactionOrm),
|
|
51
|
+
querySemaphore: Semaphore.makeUnsafe(1),
|
|
51
52
|
transactional: true,
|
|
52
53
|
},
|
|
53
54
|
};
|