import { HttpApiBuilder } from "@effect/platform"; import * as Layer from "effect/Layer"; import { ControlPlaneApi } from "./api"; import { ControlPlaneActorResolver, type ControlPlaneActorResolverShape, } from "./auth/actor-resolver"; import { ControlPlaneExecutionsLive } from "./executions/http"; import { ControlPlaneLocalLive } from "./local/http"; import { ControlPlaneMembershipsLive } from "./memberships/http"; import { ControlPlaneOAuthLive } from "./oauth/http"; import { ControlPlaneOrganizationsLive } from "./organizations/http"; import { ControlPlanePoliciesLive } from "./policies/http"; import { ControlPlaneSourcesLive } from "./sources/http"; import { ControlPlaneWorkspacesLive } from "./workspaces/http"; export const ControlPlaneApiLive = HttpApiBuilder.api(ControlPlaneApi).pipe( Layer.provide(ControlPlaneLocalLive), Layer.provide(ControlPlaneOAuthLive), Layer.provide(ControlPlaneOrganizationsLive), Layer.provide(ControlPlaneMembershipsLive), Layer.provide(ControlPlaneWorkspacesLive), Layer.provide(ControlPlaneSourcesLive), Layer.provide(ControlPlanePoliciesLive), Layer.provide(ControlPlaneExecutionsLive), ); export type ControlPlaneApiRuntimeContext = Layer.Layer.Context; export type BuiltControlPlaneApiLayer = Layer.Layer< Layer.Layer.Success, Layer.Layer.Error, never >; export const createControlPlaneApiLayer = ( runtimeLayer: Layer.Layer, ) => ControlPlaneApiLive.pipe( Layer.provide(runtimeLayer), ); export const ControlPlaneActorResolverLive = ( resolver: ControlPlaneActorResolverShape, ) => Layer.succeed(ControlPlaneActorResolver, resolver);