From f684ddc62fdaf3f3b5718cd5be32c5ac5051b507 Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Tue, 17 Feb 2026 08:07:58 -0500 Subject: [PATCH 1/3] feat(atom): allow custom runtime factories --- packages/atom/src/AtomHttpApi.ts | 4 +++- packages/atom/src/AtomRpc.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/atom/src/AtomHttpApi.ts b/packages/atom/src/AtomHttpApi.ts index a58f1d0..cb622d9 100644 --- a/packages/atom/src/AtomHttpApi.ts +++ b/packages/atom/src/AtomHttpApi.ts @@ -161,6 +161,7 @@ export const Tag = | ((effect: Effect.Effect) => Effect.Effect) | undefined readonly baseUrl?: URL | string | undefined + readonly runtime?: Atom.RuntimeFactory | undefined } ): AtomHttpApiClient => { const self: Mutable> = Context.Tag(id)< @@ -172,7 +173,8 @@ export const Tag = self, HttpApiClient.make(options.api, options) ).pipe(Layer.provide(options.httpClient)) as Layer.Layer - self.runtime = Atom.runtime(self.layer) + const runtimeFactory = options.runtime ?? Atom.runtime + self.runtime = runtimeFactory(self.layer) const mutationFamily = Atom.family(({ endpoint, group, withResponse }: MutationKey) => self.runtime.fn<{ diff --git a/packages/atom/src/AtomRpc.ts b/packages/atom/src/AtomRpc.ts index 91c2ad9..bbec106 100644 --- a/packages/atom/src/AtomRpc.ts +++ b/packages/atom/src/AtomRpc.ts @@ -118,6 +118,7 @@ export const Tag = () => readonly generateRequestId?: (() => RequestId) | undefined readonly disableTracing?: boolean | undefined readonly makeEffect?: Effect.Effect, never, RM> | undefined + readonly runtime?: Atom.RuntimeFactory | undefined } ): AtomRpcClient => { const self: Mutable> = Context.Tag(id)< @@ -133,7 +134,8 @@ export const Tag = () => flatten: true }) as Effect.Effect, never, RM> ).pipe(Layer.provide(options.protocol)) - self.runtime = Atom.runtime(self.layer) + const runtimeFactory = options.runtime ?? Atom.runtime + self.runtime = runtimeFactory(self.layer) self.mutation = Atom.family(>(tag: Tag) => self.runtime.fn<{ From 978cf8048b99a74e1611e88dcb875c3702dc7651 Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Tue, 17 Feb 2026 14:56:22 -0500 Subject: [PATCH 2/3] add changeset --- .changeset/soft-spiders-care.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/soft-spiders-care.md diff --git a/.changeset/soft-spiders-care.md b/.changeset/soft-spiders-care.md new file mode 100644 index 0000000..600e13e --- /dev/null +++ b/.changeset/soft-spiders-care.md @@ -0,0 +1,5 @@ +--- +"@effect-atom/atom": minor +--- + +allow overriding AtomHttpApi & AtomRpc runtime factory From 2dbbffbc122496f01b7065a52fa94aa69ccad675 Mon Sep 17 00:00:00 2001 From: Tim Smart Date: Wed, 18 Feb 2026 09:52:19 +1300 Subject: [PATCH 3/3] docs --- docs/atom/AtomHttpApi.ts.md | 1 + docs/atom/AtomRpc.ts.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/atom/AtomHttpApi.ts.md b/docs/atom/AtomHttpApi.ts.md index 0c04b3c..3e73e47 100644 --- a/docs/atom/AtomHttpApi.ts.md +++ b/docs/atom/AtomHttpApi.ts.md @@ -49,6 +49,7 @@ export declare const Tag: () => < | ((effect: Effect.Effect) => Effect.Effect) | undefined readonly baseUrl?: URL | string | undefined + readonly runtime?: Atom.RuntimeFactory | undefined } ) => AtomHttpApiClient ``` diff --git a/docs/atom/AtomRpc.ts.md b/docs/atom/AtomRpc.ts.md index 06d654e..375540c 100644 --- a/docs/atom/AtomRpc.ts.md +++ b/docs/atom/AtomRpc.ts.md @@ -41,6 +41,7 @@ export declare const Tag: () => < readonly generateRequestId?: (() => RequestId) | undefined readonly disableTracing?: boolean | undefined readonly makeEffect?: Effect.Effect, never, RM> | undefined + readonly runtime?: Atom.RuntimeFactory | undefined } ) => AtomRpcClient ```