@riordanpawley/effect-prisma-generator 0.5.1 → 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 (3) hide show
  1. package/README.md +40 -0
  2. package/dist/index.js +787 -448
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -343,6 +343,46 @@ const program = Effect.gen(function* () {
343
343
  });
344
344
  ```
345
345
 
346
+ #### Custom Transaction Options
347
+
348
+ For transactions that need custom options (isolation level, timeout, etc.), use `$transactionWith`:
349
+
350
+ ```typescript
351
+ // Custom isolation level
352
+ yield* prisma.$transactionWith(
353
+ Effect.gen(function* () {
354
+ const user = yield* prisma.user.create({ data: { name: "Alice" } });
355
+ return user;
356
+ }),
357
+ { isolationLevel: "Serializable", timeout: 10000 }
358
+ );
359
+
360
+ // Point-free style for cleaner composition
361
+ import { pipe } from "effect";
362
+
363
+ const myEffect = Effect.gen(function* () {
364
+ const prisma = yield* Prisma;
365
+ return yield* prisma.user.findMany();
366
+ });
367
+
368
+ // Clean, functional composition!
369
+ pipe(
370
+ myEffect,
371
+ prisma.$transaction // No options? Use $transaction directly!
372
+ );
373
+
374
+ // With options, use $transactionWith
375
+ const withSerializable = (eff: Effect.Effect<any, any, any>) =>
376
+ prisma.$transactionWith(eff, { isolationLevel: "Serializable" });
377
+
378
+ pipe(myEffect, withSerializable);
379
+ ```
380
+
381
+ Available transaction options:
382
+ - `isolationLevel`: `"ReadUncommitted" | "ReadCommitted" | "RepeatableRead" | "Serializable"`
383
+ - `maxWait`: Maximum time (ms) Prisma Client will wait to acquire a transaction
384
+ - `timeout`: Maximum time (ms) the transaction can run before being canceled
385
+
346
386
  #### Transaction Rollback Behavior
347
387
 
348
388
  **Any uncaught error in the Effect error channel triggers a rollback:**