Open History to see the last commit
1import type { ProviderUsageLimitsUpdate, ServerProvider } from "@t3tools/contracts";
2import type * as Effect from "effect/Effect";
3import type * as Stream from "effect/Stream";
4import type { ProviderMaintenanceCapabilities } from "./maintenance.ts";
5
6export interface ManagedServerProvider {
7 /**
8 * Cached between reads; pass
9 * `{ fresh: true }` before executing an update so it never trusts a
10 * resolution older than the click.
11 */
12 readonly resolveMaintenance: (options?: {
13 readonly fresh?: boolean;
14 }) => Effect.Effect<ProviderMaintenanceCapabilities>;
15 readonly getSnapshot: Effect.Effect<ServerProvider>;
16 readonly refresh: Effect.Effect<ServerProvider>;
17 readonly streamChanges: Stream.Stream<ServerProvider>;
18 /**
19 * Sparse: windows merge by id and an
20 * update with no usable window leaves the snapshot untouched.
21 */
22 readonly applyUsageLimits: (
23 update: ProviderUsageLimitsUpdate & { readonly checkedAt: string },
24 ) => Effect.Effect<void>;
25}