Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/cloudflare-runtime/src/remote-bindings/RemoteWorker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Credentials } from "@distilled.cloud/cloudflare/Credentials";
import * as workers from "@distilled.cloud/cloudflare/workers";
import * as Cause from "effect/Cause";
import * as Context from "effect/Context";
Expand All @@ -20,7 +21,17 @@ export class RemoteWorker extends Context.Service<
}
>()("cloudflare-runtime/remote-bindings/RemoteWorker") {}

export const make = Effect.fn(function* (accountId: Effect.Effect<string>) {
// Explicit annotation: the inferred type references `Credentials` from
// `@distilled.cloud/cloudflare`, which the dts bundler cannot name on its
// own — without this it degrades `make`/`layer` (and everything composed
// from them, e.g. `RuntimeServices.layerRuntime`) to `any, any`.
export const make: (
accountId: Effect.Effect<string>,
) => Effect.Effect<
RemoteWorker["Service"],
never,
Access.Access | Credentials | HttpClient.HttpClient
> = Effect.fn(function* (accountId: Effect.Effect<string>) {
const http = yield* HttpClient.HttpClient;
const access = yield* Access.Access;

Expand Down Expand Up @@ -123,7 +134,9 @@ export const make = Effect.fn(function* (accountId: Effect.Effect<string>) {
});
});

export const layer = (accountId: Effect.Effect<string>) =>
export const layer = (
accountId: Effect.Effect<string>,
): Layer.Layer<RemoteWorker, never, Access.Access | Credentials | HttpClient.HttpClient> =>
Layer.effect(RemoteWorker, make(accountId));

/**
Expand Down
Loading