@riordanpawley/effect-prisma-generator 0.6.6 → 0.6.8
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/dist/index.js +20 -19
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -550,7 +550,7 @@ async function generateUnifiedService(models, outputDir, clientImportPath, error
|
|
|
550
550
|
function generateCustomErrorService(customError, clientImportPath, rawSqlOperations, modelTypeAliases, prismaInterface, modelOperations, enableTelemetry) {
|
|
551
551
|
const _errorType = customError.className;
|
|
552
552
|
return `${header}
|
|
553
|
-
import { Context, Effect, Exit, Layer, Option } from "effect"
|
|
553
|
+
import { Context, Effect, Exit, Layer, Option, Scope } from "effect"
|
|
554
554
|
import { Prisma as PrismaNamespace, PrismaClient as BasePrismaClient } from "${clientImportPath}"
|
|
555
555
|
import { ${customError.className}, mapPrismaError } from "${customError.path}"
|
|
556
556
|
|
|
@@ -622,10 +622,10 @@ export class PrismaClient extends Context.Tag("PrismaClient")<
|
|
|
622
622
|
*/
|
|
623
623
|
static layer = (
|
|
624
624
|
...args: ConstructorParameters<typeof BasePrismaClient>
|
|
625
|
-
) => Layer.scoped(
|
|
625
|
+
): Layer.Layer<PrismaClient, never, never> => Layer.scoped(
|
|
626
626
|
PrismaClient,
|
|
627
627
|
Effect.gen(function* () {
|
|
628
|
-
const prisma = new BasePrismaClient(...args)
|
|
628
|
+
const prisma: BasePrismaClient = new BasePrismaClient(...args)
|
|
629
629
|
yield* Effect.addFinalizer(() => Effect.promise(() => prisma.$disconnect()))
|
|
630
630
|
return prisma
|
|
631
631
|
})
|
|
@@ -657,11 +657,11 @@ export class PrismaClient extends Context.Tag("PrismaClient")<
|
|
|
657
657
|
*/
|
|
658
658
|
static layerEffect = <R, E>(
|
|
659
659
|
optionsEffect: Effect.Effect<ConstructorParameters<typeof BasePrismaClient>[0], E, R>
|
|
660
|
-
) => Layer.scoped(
|
|
660
|
+
): Layer.Layer<PrismaClient, E, Exclude<R, Scope.Scope>> => Layer.scoped(
|
|
661
661
|
PrismaClient,
|
|
662
662
|
Effect.gen(function* () {
|
|
663
|
-
const options = yield* optionsEffect
|
|
664
|
-
const prisma = new BasePrismaClient(options)
|
|
663
|
+
const options: ConstructorParameters<typeof BasePrismaClient>[0] = yield* optionsEffect
|
|
664
|
+
const prisma: BasePrismaClient = new BasePrismaClient(options)
|
|
665
665
|
yield* Effect.addFinalizer(() => Effect.promise(() => prisma.$disconnect()))
|
|
666
666
|
return prisma
|
|
667
667
|
})
|
|
@@ -1026,7 +1026,7 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1026
1026
|
* Used internally by layer constructors.
|
|
1027
1027
|
*/
|
|
1028
1028
|
static make: Effect.Effect<IPrismaService, never, PrismaClient> = makePrismaService;
|
|
1029
|
-
static Default = Layer.effect(Prisma, this.make);
|
|
1029
|
+
static Default: Layer.Layer<Prisma, never, PrismaClient> = Layer.effect(Prisma, this.make);
|
|
1030
1030
|
|
|
1031
1031
|
/**
|
|
1032
1032
|
* Create a complete Prisma layer with the given PrismaClient options.
|
|
@@ -1055,7 +1055,7 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1055
1055
|
*/
|
|
1056
1056
|
static layer = (
|
|
1057
1057
|
...args: ConstructorParameters<typeof BasePrismaClient>
|
|
1058
|
-
) => this.Default.pipe(
|
|
1058
|
+
): Layer.Layer<Prisma | PrismaClient, never, never> => this.Default.pipe(
|
|
1059
1059
|
Layer.provideMerge(PrismaClient.layer(...args))
|
|
1060
1060
|
);
|
|
1061
1061
|
|
|
@@ -1084,7 +1084,7 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1084
1084
|
*/
|
|
1085
1085
|
static layerEffect = <R, E>(
|
|
1086
1086
|
optionsEffect: Effect.Effect<ConstructorParameters<typeof BasePrismaClient>[0], E, R>
|
|
1087
|
-
) => this.Default.pipe(
|
|
1087
|
+
): Layer.Layer<Prisma | PrismaClient, E, Exclude<R, Scope.Scope>> => this.Default.pipe(
|
|
1088
1088
|
Layer.provideMerge(PrismaClient.layerEffect(optionsEffect))
|
|
1089
1089
|
);
|
|
1090
1090
|
}
|
|
@@ -1098,7 +1098,7 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1098
1098
|
function generateDefaultErrorService(clientImportPath, rawSqlOperations, modelTypeAliases, prismaInterface, modelOperations, enableTelemetry) {
|
|
1099
1099
|
const _errorType = "PrismaError";
|
|
1100
1100
|
return `${header}
|
|
1101
|
-
import { Context, Data, Effect, Exit, Layer, Option } from "effect"
|
|
1101
|
+
import { Context, Data, Effect, Exit, Layer, Option, Scope } from "effect"
|
|
1102
1102
|
import { Prisma as PrismaNamespace, PrismaClient as BasePrismaClient } from "${clientImportPath}"
|
|
1103
1103
|
|
|
1104
1104
|
// Create local reference to error class for proper type narrowing
|
|
@@ -1178,10 +1178,10 @@ export class PrismaClient extends Context.Tag("PrismaClient")<
|
|
|
1178
1178
|
*/
|
|
1179
1179
|
static layer = (
|
|
1180
1180
|
...args: ConstructorParameters<typeof BasePrismaClient>
|
|
1181
|
-
) => Layer.scoped(
|
|
1181
|
+
): Layer.Layer<PrismaClient, never, never> => Layer.scoped(
|
|
1182
1182
|
PrismaClient,
|
|
1183
1183
|
Effect.gen(function* () {
|
|
1184
|
-
const prisma = new BasePrismaClient(...args)
|
|
1184
|
+
const prisma: BasePrismaClient = new BasePrismaClient(...args)
|
|
1185
1185
|
yield* Effect.addFinalizer(() => Effect.promise(() => prisma.$disconnect()))
|
|
1186
1186
|
return prisma
|
|
1187
1187
|
})
|
|
@@ -1213,11 +1213,11 @@ export class PrismaClient extends Context.Tag("PrismaClient")<
|
|
|
1213
1213
|
*/
|
|
1214
1214
|
static layerEffect = <R, E>(
|
|
1215
1215
|
optionsEffect: Effect.Effect<ConstructorParameters<typeof BasePrismaClient>[0], E, R>
|
|
1216
|
-
) => Layer.scoped(
|
|
1216
|
+
): Layer.Layer<PrismaClient, E, Exclude<R, Scope.Scope>> => Layer.scoped(
|
|
1217
1217
|
PrismaClient,
|
|
1218
1218
|
Effect.gen(function* () {
|
|
1219
|
-
const options = yield* optionsEffect
|
|
1220
|
-
const prisma = new BasePrismaClient(options)
|
|
1219
|
+
const options: ConstructorParameters<typeof BasePrismaClient>[0] = yield* optionsEffect
|
|
1220
|
+
const prisma: BasePrismaClient = new BasePrismaClient(options)
|
|
1221
1221
|
yield* Effect.addFinalizer(() => Effect.promise(() => prisma.$disconnect()))
|
|
1222
1222
|
return prisma
|
|
1223
1223
|
})
|
|
@@ -1926,6 +1926,7 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1926
1926
|
* Used internally by layer constructors.
|
|
1927
1927
|
*/
|
|
1928
1928
|
static make: Effect.Effect<IPrismaService, never, PrismaClient> = makePrismaService;
|
|
1929
|
+
static Default: Layer.Layer<Prisma, never, PrismaClient> = Layer.effect(Prisma, this.make);
|
|
1929
1930
|
|
|
1930
1931
|
/**
|
|
1931
1932
|
* Create a complete Prisma layer with the given PrismaClient options.
|
|
@@ -1954,8 +1955,8 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1954
1955
|
*/
|
|
1955
1956
|
static layer = (
|
|
1956
1957
|
...args: ConstructorParameters<typeof BasePrismaClient>
|
|
1957
|
-
)
|
|
1958
|
-
Layer.
|
|
1958
|
+
): Layer.Layer<Prisma | PrismaClient, never, never> => this.Default.pipe(
|
|
1959
|
+
Layer.provideMerge(PrismaClient.layer(...args))
|
|
1959
1960
|
);
|
|
1960
1961
|
|
|
1961
1962
|
/**
|
|
@@ -1983,8 +1984,8 @@ export class Prisma extends Context.Tag("Prisma")<Prisma, IPrismaService>() {
|
|
|
1983
1984
|
*/
|
|
1984
1985
|
static layerEffect = <R, E>(
|
|
1985
1986
|
optionsEffect: Effect.Effect<ConstructorParameters<typeof BasePrismaClient>[0], E, R>
|
|
1986
|
-
)
|
|
1987
|
-
Layer.
|
|
1987
|
+
): Layer.Layer<Prisma | PrismaClient, E, Exclude<R, Scope.Scope>> => this.Default.pipe(
|
|
1988
|
+
Layer.provideMerge(PrismaClient.layerEffect(optionsEffect))
|
|
1988
1989
|
);
|
|
1989
1990
|
}
|
|
1990
1991
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riordanpawley/effect-prisma-generator",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Prisma generator for Effect (fork with Prisma 7 support)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,11 +10,6 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsc && chmod +x dist/index.js",
|
|
15
|
-
"test": "tsx scripts/runTests.ts",
|
|
16
|
-
"prepublishOnly": "pnpm run build"
|
|
17
|
-
},
|
|
18
13
|
"repository": {
|
|
19
14
|
"type": "git",
|
|
20
15
|
"url": "git+https://github.com/riordanpawley/effect-prisma-generator.git"
|
|
@@ -43,5 +38,9 @@
|
|
|
43
38
|
"prisma": "^6.19.0",
|
|
44
39
|
"tsx": "^4.20.6",
|
|
45
40
|
"vitest": "^3.0.7"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc && chmod +x dist/index.js",
|
|
44
|
+
"test": "tsx scripts/runTests.ts"
|
|
46
45
|
}
|
|
47
|
-
}
|
|
46
|
+
}
|