@entifix/sql 0.12.0 → 0.13.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.
@@ -1 +1 @@
1
- {"version":3,"file":"unit-of-work.d.ts","sourceRoot":"","sources":["../../src/transactions/unit-of-work.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,UAAU,EAGX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,YAAY,CAAC;AAKtD,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,SAAS,CAAC;CACnC;AAwCD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,SAAS,CAAC,SAAS,KACvB,UAAU,CAAC,OAAO,CAuGpB,CAAC"}
1
+ {"version":3,"file":"unit-of-work.d.ts","sourceRoot":"","sources":["../../src/transactions/unit-of-work.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,UAAU,EAGX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,YAAY,CAAC;AAKtD,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,SAAS,CAAC;CACnC;AAwCD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,SAAS,CAAC,SAAS,KACvB,UAAU,CAAC,OAAO,CA0GpB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Contention, isStoreFault } from '@entifix/core';
2
- import { Data, Effect, Option, Schedule } from 'effect';
2
+ import { Array as Arr, Data, Effect, Option, Schedule } from 'effect';
3
3
  import { SqlError } from 'effect/sql';
4
4
  import { translateSqlError } from '../errors/translate-sql-error.js';
5
5
  import { outboxRow } from './outbox.js';
@@ -48,9 +48,12 @@ const readReplay = (sql, commandId)=>sql`
48
48
  reason: translated
49
49
  });
50
50
  }));
51
- if (emitted.length > 0) {
51
+ // `sql.insert` takes a non-empty array since effect 4.1, which is
52
+ // the guard this always needed: an empty batch is not an INSERT.
53
+ const rows = emitted.map(outboxRow);
54
+ if (Arr.isArrayNonEmpty(rows)) {
52
55
  const written = yield* sql`
53
- INSERT INTO entifix_outbox ${sql.insert(emitted.map(outboxRow))}
56
+ INSERT INTO entifix_outbox ${sql.insert(rows)}
54
57
  ON CONFLICT (event_id) DO NOTHING RETURNING event_id`;
55
58
  // An event id already recorded is the outbox's own idempotency
56
59
  // claim: what it announces committed before.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/transactions/unit-of-work.ts"],"sourcesContent":["import { Contention, isStoreFault, type StoreFault } from '@entifix/core';\nimport type {\n OutboxEvent,\n UnitClaim,\n UnitOfWork,\n UnitOutcome,\n UnitRunOptions,\n} from '@entifix/transactions';\nimport { Data, Effect, Option, Schedule } from 'effect';\nimport { type SqlClient, SqlError } from 'effect/sql';\n\nimport { translateSqlError } from '../errors/translate-sql-error.js';\nimport { outboxRow } from './outbox.js';\n\n/** What a unit's body writes through: the client, inside the unit's transaction. */\nexport interface SqlUnit {\n readonly sql: SqlClient.SqlClient;\n}\n\n/** The claim was taken, or an emitted event was already recorded: roll back. */\nclass Duplicate extends Data.TaggedError('SqlUnitDuplicate') {}\n\n/** The body refused with a business failure: roll back, and answer it. */\nclass Aborted extends Data.TaggedError('SqlUnitAborted')<{\n readonly reason: unknown;\n}> {}\n\n/** A serialization failure or a deadlock: the whole unit runs again. */\nconst ATTEMPTS = 3;\nconst BACK_OFF = Schedule.exponential('20 millis');\n\nconst claimed = (sql: SqlClient.SqlClient, claim: UnitClaim) =>\n claim.kind === 'event'\n ? sql<{ readonly event_id: string }>`\n INSERT INTO entifix_inbox (consumer, event_id)\n VALUES (${claim.consumer}, ${claim.eventId})\n ON CONFLICT DO NOTHING RETURNING event_id`\n : sql<{ readonly command_id: string }>`\n INSERT INTO entifix_command_inbox (command_id)\n VALUES (${claim.commandId})\n ON CONFLICT DO NOTHING RETURNING command_id`;\n\nconst readReplay = (sql: SqlClient.SqlClient, commandId: string) =>\n sql<{ readonly replay: unknown }>`\n SELECT replay FROM entifix_command_inbox WHERE command_id = ${commandId}`.pipe(\n Effect.map(([row]) =>\n row === undefined || row.replay == null\n ? Option.none()\n : Option.some(\n typeof row.replay === 'string'\n ? (JSON.parse(row.replay) as unknown)\n : row.replay,\n ),\n ),\n Effect.mapError(error => translateSqlError(error) as StoreFault),\n );\n\n/**\n * Units of work over one SQL database\n * ([ADR 0009](../../../../../docs/adr/0009-a-unit-of-work-the-outbox-inbox-and-command-claim-join.md)):\n * the body's writes, the events it emitted and its claim are one transaction.\n * A taken claim, or an event id the outbox already holds, rolls back and\n * answers `duplicate`; a business failure rolls back and answers `aborted`; a\n * store failure is an error; a serialization failure runs the whole unit again,\n * body included, which is why the body must be retry-safe.\n */\nexport const makeSqlUnitOfWork = (\n sql: SqlClient.SqlClient,\n): UnitOfWork<SqlUnit> => {\n const attempt = <A, E, R>(\n body: (unit: {\n readonly handle: SqlUnit;\n emit(event: OutboxEvent): void;\n }) => Effect.Effect<A, E, R>,\n options: UnitRunOptions<A, R> | undefined,\n ) =>\n sql\n .withTransaction(\n Effect.gen(function* () {\n const claim = options?.claim;\n if (claim !== undefined) {\n const rows = yield* claimed(sql, claim);\n if (rows.length === 0) return yield* Effect.fail(new Duplicate());\n }\n\n const emitted: OutboxEvent[] = [];\n const value = yield* body({\n handle: { sql },\n emit: event => void emitted.push(event),\n }).pipe(\n // The body's own driver failure is translated first: an outage\n // fails the unit, while a unique violation is the refusal it would\n // be from any adapter, and aborts it.\n Effect.mapError(failure => {\n const translated = SqlError.isSqlError(failure)\n ? translateSqlError(failure)\n : failure;\n return isStoreFault(translated)\n ? translated\n : new Aborted({ reason: translated });\n }),\n );\n\n if (emitted.length > 0) {\n const written = yield* sql<{ readonly event_id: string }>`\n INSERT INTO entifix_outbox ${sql.insert(emitted.map(outboxRow))}\n ON CONFLICT (event_id) DO NOTHING RETURNING event_id`;\n // An event id already recorded is the outbox's own idempotency\n // claim: what it announces committed before.\n if (written.length < emitted.length)\n return yield* Effect.fail(new Duplicate());\n }\n\n if (claim?.kind === 'command' && options?.replay !== undefined)\n yield* sql`\n UPDATE entifix_command_inbox\n SET replay = ${JSON.stringify(options.replay(value))}::jsonb\n WHERE command_id = ${claim.commandId}`;\n return value;\n }),\n )\n .pipe(\n Effect.map(\n value =>\n ({ _tag: 'committed', value }) as UnitOutcome<\n A,\n Exclude<E, StoreFault>\n >,\n ),\n Effect.catch(failure =>\n failure instanceof Duplicate\n ? Effect.map(\n options?.claim?.kind === 'command'\n ? readReplay(sql, options.claim.commandId)\n : Effect.succeed(Option.none()),\n replay =>\n ({ _tag: 'duplicate', replay }) as UnitOutcome<\n A,\n Exclude<E, StoreFault>\n >,\n )\n : failure instanceof Aborted\n ? Effect.succeed({\n _tag: 'aborted',\n reason: failure.reason as Exclude<E, StoreFault>,\n } as UnitOutcome<A, Exclude<E, StoreFault>>)\n : // What reaches here is the transaction's own failure — a\n // connection lost, a serialization conflict at commit. A\n // unique violation cannot: the claim and the outbox insert\n // both read a conflict as a duplicate, and the body's own is\n // aborted above.\n Effect.fail(translateSqlError(failure) as StoreFault),\n ),\n );\n\n return {\n run: (body, options) =>\n Effect.gen(function* () {\n const outcome = yield* attempt(body, options).pipe(\n Effect.retry({\n times: ATTEMPTS - 1,\n while: failure => failure instanceof Contention,\n schedule: BACK_OFF,\n }),\n );\n if (outcome._tag === 'committed' && options?.afterCommit)\n yield* options.afterCommit.pipe(Effect.ignore);\n return outcome;\n }),\n replay: commandId => readReplay(sql, commandId),\n };\n};\n"],"names":["Contention","isStoreFault","Data","Effect","Option","Schedule","SqlError","translateSqlError","outboxRow","Duplicate","TaggedError","Aborted","ATTEMPTS","BACK_OFF","exponential","claimed","sql","claim","kind","consumer","eventId","commandId","readReplay","pipe","map","row","undefined","replay","none","some","JSON","parse","mapError","error","makeSqlUnitOfWork","attempt","body","options","withTransaction","gen","rows","length","fail","emitted","value","handle","emit","event","push","failure","translated","isSqlError","reason","written","insert","stringify","_tag","catch","succeed","run","outcome","retry","times","while","schedule","afterCommit","ignore"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,QAAyB,gBAAgB;AAQ1E,SAASC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,SAAS;AACxD,SAAyBC,QAAQ,QAAQ,aAAa;AAEtD,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,SAASC,SAAS,QAAQ,cAAc;AAOxC,8EAA8E,GAC9E,IAAA,AAAMC,YAAN,MAAMA,kBAAkBP,KAAKQ,WAAW,CAAC;AAAqB;AAE9D,wEAAwE,GACxE,IAAA,AAAMC,UAAN,MAAMA,gBAAgBT,KAAKQ,WAAW,CAAC;AAEnC;AAEJ,sEAAsE,GACtE,MAAME,WAAW;AACjB,MAAMC,WAAWR,SAASS,WAAW,CAAC;AAEtC,MAAMC,UAAU,CAACC,KAA0BC,QACzCA,MAAMC,IAAI,KAAK,UACXF,GAAkC,CAAC;;gBAEzB,EAAEC,MAAME,QAAQ,CAAC,EAAE,EAAEF,MAAMG,OAAO,CAAC;iDACF,CAAC,GAC5CJ,GAAoC,CAAC;;gBAE3B,EAAEC,MAAMI,SAAS,CAAC;mDACiB,CAAC;AAEpD,MAAMC,aAAa,CAACN,KAA0BK,YAC5CL,GAAiC,CAAC;gEAC4B,EAAEK,UAAU,CAAC,CAACE,IAAI,CAC9EpB,OAAOqB,GAAG,CAAC,CAAC,CAACC,IAAI,GACfA,QAAQC,aAAaD,IAAIE,MAAM,IAAI,OAC/BvB,OAAOwB,IAAI,KACXxB,OAAOyB,IAAI,CACT,OAAOJ,IAAIE,MAAM,KAAK,WACjBG,KAAKC,KAAK,CAACN,IAAIE,MAAM,IACtBF,IAAIE,MAAM,IAGtBxB,OAAO6B,QAAQ,CAACC,CAAAA,QAAS1B,kBAAkB0B;AAG/C;;;;;;;;CAQC,GAC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AAC,CAAC;YAC1C,OAAOuB;QACT,IAEDrB,IAAI,CACHpB,OAAOqB,GAAG,CACRoB,CAAAA,QACG,CAAA;gBAAEY,MAAM;gBAAaZ;YAAM,CAAA,IAKhCzC,OAAOsD,KAAK,CAACR,CAAAA;gBAGLZ;mBAFNY,mBAAmBxC,YACfN,OAAOqB,GAAG,CACRa,CAAAA,4BAAAA,iBAAAA,QAASpB,KAAK,qBAAdoB,eAAgBnB,IAAI,MAAK,YACrBI,WAAWN,KAAKqB,QAAQpB,KAAK,CAACI,SAAS,IACvClB,OAAOuD,OAAO,CAACtD,OAAOwB,IAAI,KAC9BD,CAAAA,SACG,CAAA;oBAAE6B,MAAM;oBAAa7B;gBAAO,CAAA,KAKjCsB,mBAAmBtC,UACjBR,OAAOuD,OAAO,CAAC;gBACbF,MAAM;gBACNJ,QAAQH,QAAQG,MAAM;YACxB,KAEA,yDAAyD;YACzD,2DAA2D;YAC3D,6DAA6D;YAC7D,iBAAiB;YACjBjD,OAAOuC,IAAI,CAACnC,kBAAkB0C;;IAI5C,OAAO;QACLU,KAAK,CAACvB,MAAMC,UACVlC,OAAOoC,GAAG,CAAC;gBACT,MAAMqB,UAAU,OAAOzB,QAAQC,MAAMC,SAASd,IAAI,CAChDpB,OAAO0D,KAAK,CAAC;oBACXC,OAAOlD,WAAW;oBAClBmD,OAAOd,CAAAA,UAAWA,mBAAmBjD;oBACrCgE,UAAUnD;gBACZ;gBAEF,IAAI+C,QAAQJ,IAAI,KAAK,gBAAenB,2BAAAA,QAAS4B,WAAW,GACtD,OAAO5B,QAAQ4B,WAAW,CAAC1C,IAAI,CAACpB,OAAO+D,MAAM;gBAC/C,OAAON;YACT;QACFjC,QAAQN,CAAAA,YAAaC,WAAWN,KAAKK;IACvC;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/transactions/unit-of-work.ts"],"sourcesContent":["import { Contention, isStoreFault, type StoreFault } from '@entifix/core';\nimport type {\n OutboxEvent,\n UnitClaim,\n UnitOfWork,\n UnitOutcome,\n UnitRunOptions,\n} from '@entifix/transactions';\nimport { Array as Arr, Data, Effect, Option, Schedule } from 'effect';\nimport { type SqlClient, SqlError } from 'effect/sql';\n\nimport { translateSqlError } from '../errors/translate-sql-error.js';\nimport { outboxRow } from './outbox.js';\n\n/** What a unit's body writes through: the client, inside the unit's transaction. */\nexport interface SqlUnit {\n readonly sql: SqlClient.SqlClient;\n}\n\n/** The claim was taken, or an emitted event was already recorded: roll back. */\nclass Duplicate extends Data.TaggedError('SqlUnitDuplicate') {}\n\n/** The body refused with a business failure: roll back, and answer it. */\nclass Aborted extends Data.TaggedError('SqlUnitAborted')<{\n readonly reason: unknown;\n}> {}\n\n/** A serialization failure or a deadlock: the whole unit runs again. */\nconst ATTEMPTS = 3;\nconst BACK_OFF = Schedule.exponential('20 millis');\n\nconst claimed = (sql: SqlClient.SqlClient, claim: UnitClaim) =>\n claim.kind === 'event'\n ? sql<{ readonly event_id: string }>`\n INSERT INTO entifix_inbox (consumer, event_id)\n VALUES (${claim.consumer}, ${claim.eventId})\n ON CONFLICT DO NOTHING RETURNING event_id`\n : sql<{ readonly command_id: string }>`\n INSERT INTO entifix_command_inbox (command_id)\n VALUES (${claim.commandId})\n ON CONFLICT DO NOTHING RETURNING command_id`;\n\nconst readReplay = (sql: SqlClient.SqlClient, commandId: string) =>\n sql<{ readonly replay: unknown }>`\n SELECT replay FROM entifix_command_inbox WHERE command_id = ${commandId}`.pipe(\n Effect.map(([row]) =>\n row === undefined || row.replay == null\n ? Option.none()\n : Option.some(\n typeof row.replay === 'string'\n ? (JSON.parse(row.replay) as unknown)\n : row.replay,\n ),\n ),\n Effect.mapError(error => translateSqlError(error) as StoreFault),\n );\n\n/**\n * Units of work over one SQL database\n * ([ADR 0009](../../../../../docs/adr/0009-a-unit-of-work-the-outbox-inbox-and-command-claim-join.md)):\n * the body's writes, the events it emitted and its claim are one transaction.\n * A taken claim, or an event id the outbox already holds, rolls back and\n * answers `duplicate`; a business failure rolls back and answers `aborted`; a\n * store failure is an error; a serialization failure runs the whole unit again,\n * body included, which is why the body must be retry-safe.\n */\nexport const makeSqlUnitOfWork = (\n sql: SqlClient.SqlClient,\n): UnitOfWork<SqlUnit> => {\n const attempt = <A, E, R>(\n body: (unit: {\n readonly handle: SqlUnit;\n emit(event: OutboxEvent): void;\n }) => Effect.Effect<A, E, R>,\n options: UnitRunOptions<A, R> | undefined,\n ) =>\n sql\n .withTransaction(\n Effect.gen(function* () {\n const claim = options?.claim;\n if (claim !== undefined) {\n const rows = yield* claimed(sql, claim);\n if (rows.length === 0) return yield* Effect.fail(new Duplicate());\n }\n\n const emitted: OutboxEvent[] = [];\n const value = yield* body({\n handle: { sql },\n emit: event => void emitted.push(event),\n }).pipe(\n // The body's own driver failure is translated first: an outage\n // fails the unit, while a unique violation is the refusal it would\n // be from any adapter, and aborts it.\n Effect.mapError(failure => {\n const translated = SqlError.isSqlError(failure)\n ? translateSqlError(failure)\n : failure;\n return isStoreFault(translated)\n ? translated\n : new Aborted({ reason: translated });\n }),\n );\n\n // `sql.insert` takes a non-empty array since effect 4.1, which is\n // the guard this always needed: an empty batch is not an INSERT.\n const rows = emitted.map(outboxRow);\n if (Arr.isArrayNonEmpty(rows)) {\n const written = yield* sql<{ readonly event_id: string }>`\n INSERT INTO entifix_outbox ${sql.insert(rows)}\n ON CONFLICT (event_id) DO NOTHING RETURNING event_id`;\n // An event id already recorded is the outbox's own idempotency\n // claim: what it announces committed before.\n if (written.length < emitted.length)\n return yield* Effect.fail(new Duplicate());\n }\n\n if (claim?.kind === 'command' && options?.replay !== undefined)\n yield* sql`\n UPDATE entifix_command_inbox\n SET replay = ${JSON.stringify(options.replay(value))}::jsonb\n WHERE command_id = ${claim.commandId}`;\n return value;\n }),\n )\n .pipe(\n Effect.map(\n value =>\n ({ _tag: 'committed', value }) as UnitOutcome<\n A,\n Exclude<E, StoreFault>\n >,\n ),\n Effect.catch(failure =>\n failure instanceof Duplicate\n ? Effect.map(\n options?.claim?.kind === 'command'\n ? readReplay(sql, options.claim.commandId)\n : Effect.succeed(Option.none()),\n replay =>\n ({ _tag: 'duplicate', replay }) as UnitOutcome<\n A,\n Exclude<E, StoreFault>\n >,\n )\n : failure instanceof Aborted\n ? Effect.succeed({\n _tag: 'aborted',\n reason: failure.reason as Exclude<E, StoreFault>,\n } as UnitOutcome<A, Exclude<E, StoreFault>>)\n : // What reaches here is the transaction's own failure — a\n // connection lost, a serialization conflict at commit. A\n // unique violation cannot: the claim and the outbox insert\n // both read a conflict as a duplicate, and the body's own is\n // aborted above.\n Effect.fail(translateSqlError(failure) as StoreFault),\n ),\n );\n\n return {\n run: (body, options) =>\n Effect.gen(function* () {\n const outcome = yield* attempt(body, options).pipe(\n Effect.retry({\n times: ATTEMPTS - 1,\n while: failure => failure instanceof Contention,\n schedule: BACK_OFF,\n }),\n );\n if (outcome._tag === 'committed' && options?.afterCommit)\n yield* options.afterCommit.pipe(Effect.ignore);\n return outcome;\n }),\n replay: commandId => readReplay(sql, commandId),\n };\n};\n"],"names":["Contention","isStoreFault","Array","Arr","Data","Effect","Option","Schedule","SqlError","translateSqlError","outboxRow","Duplicate","TaggedError","Aborted","ATTEMPTS","BACK_OFF","exponential","claimed","sql","claim","kind","consumer","eventId","commandId","readReplay","pipe","map","row","undefined","replay","none","some","JSON","parse","mapError","error","makeSqlUnitOfWork","attempt","body","options","withTransaction","gen","rows","length","fail","emitted","value","handle","emit","event","push","failure","translated","isSqlError","reason","isArrayNonEmpty","written","insert","stringify","_tag","catch","succeed","run","outcome","retry","times","while","schedule","afterCommit","ignore"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,QAAyB,gBAAgB;AAQ1E,SAASC,SAASC,GAAG,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,SAAS;AACtE,SAAyBC,QAAQ,QAAQ,aAAa;AAEtD,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,SAASC,SAAS,QAAQ,cAAc;AAOxC,8EAA8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B,KAAK,CAACI,SAAS,IACvClB,OAAOwD,OAAO,CAACvD,OAAOwB,IAAI,KAC9BD,CAAAA,SACG,CAAA;oBAAE8B,MAAM;oBAAa9B;gBAAO,CAAA,KAKjCsB,mBAAmBtC,UACjBR,OAAOwD,OAAO,CAAC;gBACbF,MAAM;gBACNL,QAAQH,QAAQG,MAAM;YACxB,KAEA,yDAAyD;YACzD,2DAA2D;YAC3D,6DAA6D;YAC7D,iBAAiB;YACjBjD,OAAOuC,IAAI,CAACnC,kBAAkB0C;;IAI5C,OAAO;QACLW,KAAK,CAACxB,MAAMC,UACVlC,OAAOoC,GAAG,CAAC;gBACT,MAAMsB,UAAU,OAAO1B,QAAQC,MAAMC,SAASd,IAAI,CAChDpB,OAAO2D,KAAK,CAAC;oBACXC,OAAOnD,WAAW;oBAClBoD,OAAOf,CAAAA,UAAWA,mBAAmBnD;oBACrCmE,UAAUpD;gBACZ;gBAEF,IAAIgD,QAAQJ,IAAI,KAAK,gBAAepB,2BAAAA,QAAS6B,WAAW,GACtD,OAAO7B,QAAQ6B,WAAW,CAAC3C,IAAI,CAACpB,OAAOgE,MAAM;gBAC/C,OAAON;YACT;QACFlC,QAAQN,CAAAA,YAAaC,WAAWN,KAAKK;IACvC;AACF,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/sql",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "SQL adapter over @effect/sql: an entity repository with RSQL filter and sort translation, and a health probe.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -63,18 +63,18 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@swc/helpers": "0.5.23",
66
- "@entifix/business": "0.12.0",
67
- "@entifix/core": "0.12.0"
66
+ "@entifix/business": "0.13.0",
67
+ "@entifix/core": "0.13.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@effect/sql-pg": "4.0.6",
71
71
  "effect": "4.0.6",
72
- "@entifix/transactions": "0.12.0",
73
- "@entifix/testing-unit": "0.12.0"
72
+ "@entifix/testing-unit": "0.13.0",
73
+ "@entifix/transactions": "0.13.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "effect": "^4.0.6",
77
- "@entifix/transactions": "0.12.0"
77
+ "@entifix/transactions": "0.13.0"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "@entifix/transactions": {