Skip to content

Commit d2bc956

Browse files
author
PR Batch Tester
committed
refactor(client-runtime): use service module imports for environment HTTP auth
1 parent 3f155f9 commit d2bc956

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

‎packages/client-runtime/src/state/environmentHttpAuth.ts‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import * as SubscriptionRef from "effect/SubscriptionRef";
99
import { withRelayClientTracing } from "@t3tools/shared/relayTracing";
1010
import { FetchHttpClient, type HttpMethod } from "effect/http";
1111

12-
import { RemoteEnvironmentAuthorization } from "../authorization/service.ts";
12+
import * as RemoteEnvironmentAuthorization from "../authorization/service.ts";
1313
import type { PreparedConnection, PreparedHttpAuthorization } from "../connection/model.ts";
14-
import { EnvironmentSupervisor } from "../connection/supervisor.ts";
15-
import { ManagedRelayDpopSigner } from "../relay/managedRelay.ts";
14+
import * as EnvironmentSupervisor from "../connection/supervisor.ts";
15+
import * as ManagedRelay from "../relay/managedRelay.ts";
1616
import {
1717
executeEnvironmentHttpRequest,
1818
makeEnvironmentHttpApiGroupClient,
@@ -55,7 +55,7 @@ const buildEnvironmentAuthHeaders = Effect.fn("environmentHttpAuth.buildEnvironm
5555
authorization: PreparedHttpAuthorization | null,
5656
method: HttpMethod.HttpMethod,
5757
url: string,
58-
signer: Option.Option<ManagedRelayDpopSigner["Service"]>,
58+
signer: Option.Option<ManagedRelay.ManagedRelayDpopSigner["Service"]>,
5959
): Effect.fn.Return<EnvironmentHttpAuthHeaders, RemoteEnvironmentAuthFetchError> {
6060
if (authorization === null) {
6161
return {};
@@ -113,7 +113,7 @@ export const executeConnectedEnvironmentHttpRequest = Effect.fn(
113113
"prepared" | "signer" | "remoteAuthorization"
114114
>,
115115
) {
116-
const supervisor = yield* EnvironmentSupervisor;
116+
const supervisor = yield* EnvironmentSupervisor.EnvironmentSupervisor;
117117
const prepared = yield* SubscriptionRef.get(supervisor.prepared);
118118
if (Option.isNone(prepared)) {
119119
return yield* new RemoteEnvironmentAuthFetchError({
@@ -124,8 +124,10 @@ export const executeConnectedEnvironmentHttpRequest = Effect.fn(
124124
return yield* executeAuthenticatedEnvironmentHttpRequest({
125125
...input,
126126
prepared: prepared.value,
127-
signer: yield* Effect.serviceOption(ManagedRelayDpopSigner),
128-
remoteAuthorization: yield* Effect.serviceOption(RemoteEnvironmentAuthorization),
127+
signer: yield* Effect.serviceOption(ManagedRelay.ManagedRelayDpopSigner),
128+
remoteAuthorization: yield* Effect.serviceOption(
129+
RemoteEnvironmentAuthorization.RemoteEnvironmentAuthorization,
130+
),
129131
});
130132
});
131133

@@ -138,8 +140,10 @@ const executeEnvironmentRequest = Effect.fnUntraced(function* <
138140
R,
139141
>(input: {
140142
readonly prepared: PreparedConnection;
141-
readonly signer: Option.Option<ManagedRelayDpopSigner["Service"]>;
142-
readonly remoteAuthorization?: Option.Option<RemoteEnvironmentAuthorization["Service"]>;
143+
readonly signer: Option.Option<ManagedRelay.ManagedRelayDpopSigner["Service"]>;
144+
readonly remoteAuthorization?: Option.Option<
145+
RemoteEnvironmentAuthorization.RemoteEnvironmentAuthorization["Service"]
146+
>;
143147
readonly method: HttpMethod.HttpMethod;
144148
/**
145149
* The URL to sign, from the group's contract URL builder. It encodes path

0 commit comments

Comments
 (0)