| 1 | import type * as cf from "@cloudflare/workers-types"; |
| 2 | import * as Context from "effect/Context"; |
| 3 | import type * as Fiber from "effect/Fiber"; |
| 4 | |
| 5 | export interface ActiveStorageTransaction { |
| 6 | readonly transaction: cf.DurableObjectTransaction; |
| 7 | owner: Fiber.Fiber<unknown, unknown> | undefined; |
| 8 | active: boolean; |
| 9 | rolledBack: boolean; |
| 10 | alarmTablesEnsured: boolean; |
| 11 | alarmDirty: boolean; |
| 12 | } |
| 13 | |
| 14 | export const ActiveStorageTransactions = Context.Reference< |
| 15 | ReadonlyMap<cf.DurableObjectStorage, ActiveStorageTransaction> |
| 16 | >("alchemy/Cloudflare/ActiveStorageTransactions", { |
| 17 | defaultValue: () => new Map(), |
| 18 | }); |