prisma-generator-effect 1.1.0-beta.0 → 1.1.2-beta.1
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 +8 -8
- package/dist/src/index.js +1976 -0
- package/package.json +15 -17
package/dist/index.js
CHANGED
|
@@ -566,7 +566,7 @@ async function generateUnifiedService(models, outputDir, clientImportPath, error
|
|
|
566
566
|
function generateCustomErrorService(customError, clientImportPath, rawSqlOperations, modelTypeAliases, prismaInterface, modelOperations, enableTelemetry) {
|
|
567
567
|
const _errorType = customError.className;
|
|
568
568
|
return `${header}
|
|
569
|
-
import { Effect, Exit, Layer, Option, Scope,
|
|
569
|
+
import { Effect, Exit, Layer, Option, Scope, Context } from "effect"
|
|
570
570
|
import type { Effect as EffectType, Error as EffectError, Services as EffectServices, Success as EffectSuccess } from "effect/Effect"
|
|
571
571
|
import { Prisma as PrismaNamespace, PrismaClient as BasePrismaClient } from "${clientImportPath}"
|
|
572
572
|
import { ${customError.className}, mapPrismaError } from "${customError.path}"
|
|
@@ -609,7 +609,7 @@ type TransactionOptions = {
|
|
|
609
609
|
* transactionOptions: { isolationLevel: "Serializable", timeout: 10000 }
|
|
610
610
|
* })
|
|
611
611
|
*/
|
|
612
|
-
export class PrismaClient extends
|
|
612
|
+
export class PrismaClient extends Context.Service<PrismaClient, BasePrismaClient>()("PrismaClient") {
|
|
613
613
|
/**
|
|
614
614
|
* Create a PrismaClient layer with the given options.
|
|
615
615
|
* The client will be automatically disconnected when the layer scope ends.
|
|
@@ -679,7 +679,7 @@ export class PrismaClient extends ServiceMap.Service<PrismaClient, BasePrismaCli
|
|
|
679
679
|
* This service is only available inside \`$transaction\` calls.
|
|
680
680
|
* Use \`Effect.serviceOption(PrismaTransactionClientService)\` to check if you're in a transaction.
|
|
681
681
|
*/
|
|
682
|
-
export class PrismaTransactionClientService extends
|
|
682
|
+
export class PrismaTransactionClientService extends Context.Service<PrismaTransactionClientService, PrismaNamespace.TransactionClient>()("PrismaTransactionClientService") {}
|
|
683
683
|
|
|
684
684
|
// Re-export the custom error type for convenience
|
|
685
685
|
export { ${customError.className} }
|
|
@@ -1023,7 +1023,7 @@ const makePrismaService = Effect.gen(function* () {
|
|
|
1023
1023
|
return prismaService;
|
|
1024
1024
|
});
|
|
1025
1025
|
|
|
1026
|
-
export class Prisma extends
|
|
1026
|
+
export class Prisma extends Context.Service<Prisma, IPrismaService>()("Prisma") {
|
|
1027
1027
|
/**
|
|
1028
1028
|
* Effect that constructs the Prisma service.
|
|
1029
1029
|
* Used internally by layer constructors.
|
|
@@ -1097,7 +1097,7 @@ export class Prisma extends ServiceMap.Service<Prisma, IPrismaService>()("Prisma
|
|
|
1097
1097
|
function generateDefaultErrorService(clientImportPath, rawSqlOperations, modelTypeAliases, prismaInterface, modelOperations, enableTelemetry) {
|
|
1098
1098
|
const _errorType = "PrismaError";
|
|
1099
1099
|
return `${header}
|
|
1100
|
-
import { Data, Effect, Exit, Layer, Option, Scope,
|
|
1100
|
+
import { Data, Effect, Exit, Layer, Option, Scope, Context } from "effect"
|
|
1101
1101
|
import type { Effect as EffectType, Error as EffectError, Services as EffectServices, Success as EffectSuccess } from "effect/Effect"
|
|
1102
1102
|
import { Prisma as PrismaNamespace, PrismaClient as BasePrismaClient } from "${clientImportPath}"
|
|
1103
1103
|
|
|
@@ -1148,7 +1148,7 @@ type TransactionOptions = {
|
|
|
1148
1148
|
* transactionOptions: { isolationLevel: "Serializable", timeout: 10000 }
|
|
1149
1149
|
* })
|
|
1150
1150
|
*/
|
|
1151
|
-
export class PrismaClient extends
|
|
1151
|
+
export class PrismaClient extends Context.Service<PrismaClient, BasePrismaClient>()("PrismaClient") {
|
|
1152
1152
|
/**
|
|
1153
1153
|
* Create a PrismaClient layer with the given options.
|
|
1154
1154
|
* The client will be automatically disconnected when the layer scope ends.
|
|
@@ -1219,7 +1219,7 @@ export class PrismaClient extends ServiceMap.Service<PrismaClient, BasePrismaCli
|
|
|
1219
1219
|
* This service is only available inside \`$transaction\` calls.
|
|
1220
1220
|
* Use \`Effect.serviceOption(PrismaTransactionClientService)\` to check if you're in a transaction.
|
|
1221
1221
|
*/
|
|
1222
|
-
export class PrismaTransactionClientService extends
|
|
1222
|
+
export class PrismaTransactionClientService extends Context.Service<PrismaTransactionClientService, PrismaNamespace.TransactionClient>()("PrismaTransactionClientService") {}
|
|
1223
1223
|
|
|
1224
1224
|
export class PrismaUniqueConstraintError extends Data.TaggedError("PrismaUniqueConstraintError")<{
|
|
1225
1225
|
cause: PrismaNamespace.PrismaClientKnownRequestError
|
|
@@ -1907,7 +1907,7 @@ const makePrismaService = Effect.gen(function* () {
|
|
|
1907
1907
|
return prismaService;
|
|
1908
1908
|
});
|
|
1909
1909
|
|
|
1910
|
-
export class Prisma extends
|
|
1910
|
+
export class Prisma extends Context.Service<Prisma, IPrismaService>()("Prisma") {
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Effect that constructs the Prisma service.
|
|
1913
1913
|
* Used internally by layer constructors.
|