everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
74 lines • 3.75 kB
text/typescript
import { Context, Effect, Schema } from "effect";
//#region src/services/hosting/adapter.d.ts
/**
* The deploy console's single substrate coupling (ADR 0035): operating a
* runtime instance — boot an image with identity env, observe it, restart it,
* stop it — expressed in platform vocabulary only. No substrate resource
* types, ports, networks, or machine ids cross this seam; implementations
* return a URL and keep the derivation private.
*/
interface RuntimeDescriptor {
/** Stable logical instance name, unique per hosting namespace. */
readonly instance: string;
/** OCI image reference, digest-pinned in production. */
readonly image: string;
/**
* Identity env forwarded verbatim (BOS_ACCOUNT / BOS_GATEWAY today). The
* adapter never interprets these values.
*/
readonly identityEnv: Readonly<Record<string, string>>;
}
interface DeployedInstance {
readonly instance: string;
/** Where the instance serves traffic after a health-gated boot. */
readonly url: string;
}
interface InstanceSnapshot {
readonly instance: string;
readonly running: boolean;
/** Present only while the instance is running and health-known. */
readonly url: string | undefined;
readonly image: string | undefined;
}
declare const DeployFailed_base: Schema.Class<DeployFailed, Schema.TaggedStruct<"DeployFailed", {
readonly instance: Schema.String;
readonly reason: Schema.String;
}>, import("effect/Cause").YieldableError>;
declare class DeployFailed extends DeployFailed_base {}
declare const HealthTimeout_base: Schema.Class<HealthTimeout, Schema.TaggedStruct<"HealthTimeout", {
readonly instance: Schema.String;
readonly url: Schema.String;
readonly attempts: Schema.Finite;
}>, import("effect/Cause").YieldableError>;
declare class HealthTimeout extends HealthTimeout_base {}
declare const InstanceNotFound_base: Schema.Class<InstanceNotFound, Schema.TaggedStruct<"InstanceNotFound", {
readonly instance: Schema.String;
}>, import("effect/Cause").YieldableError>;
declare class InstanceNotFound extends InstanceNotFound_base {}
declare const HostingOperationFailed_base: Schema.Class<HostingOperationFailed, Schema.TaggedStruct<"HostingOperationFailed", {
readonly instance: Schema.String;
readonly operation: Schema.String;
readonly reason: Schema.String;
}>, import("effect/Cause").YieldableError>;
declare class HostingOperationFailed extends HostingOperationFailed_base {}
declare const HostingAdapter_base: Context.ServiceClass<HostingAdapter, "hosting/HostingAdapter", {
/**
* Converge the instance to the descriptor (idempotent for an unchanged
* descriptor), then health-gate before returning its URL.
*/
deploy(descriptor: RuntimeDescriptor): Effect.Effect<DeployedInstance, DeployFailed | HealthTimeout>;
/** Observe the instance without mutating it. Unknown instances report `running: false`. */
current(instance: string): Effect.Effect<InstanceSnapshot, HostingOperationFailed>;
/**
* Restart the instance (starting it when stopped) and health-gate again.
* Fails for an instance that has never been deployed.
*/
restart(instance: string): Effect.Effect<DeployedInstance, InstanceNotFound | HealthTimeout | HostingOperationFailed>;
/** Stop the instance. Fails for an instance that has never been deployed. */
stop(instance: string): Effect.Effect<void, InstanceNotFound | HostingOperationFailed>;
}>;
declare class HostingAdapter extends HostingAdapter_base {}
type HostingAdapterService = HostingAdapter["Service"];
//#endregion
export { DeployFailed, DeployedInstance, HealthTimeout, HostingAdapter, HostingAdapterService, HostingOperationFailed, InstanceNotFound, InstanceSnapshot, RuntimeDescriptor };
//# sourceMappingURL=adapter.d.mts.map