import { List } from "@tsplus/stdlib/collections/List/definition"; import { Env } from "@tsplus/stdlib/service/Env"; import type { Tag } from "@tsplus/stdlib/service/Tag"; export declare const PatchSym: unique symbol; export type PatchSym = typeof PatchSym; export declare const _Input: unique symbol; export type _Input = typeof _Input; export declare const _Output: unique symbol; export type _Output = typeof _Output; /** * A `Patch` describes an update that transforms a `Env` * to a `Env` as a data structure. This allows combining updates to * different services in the environment in a compositional way. * * @tsplus type Patch */ export interface Patch { readonly [PatchSym]: PatchSym; readonly [_Input]: (input: Input) => void; readonly [_Output]: () => Output; } /** * @tsplus type Patch.Ops */ export interface PatchOps { $: PatchAspects; } export declare const Patch: PatchOps; /** * @tsplus type Patch.Aspects */ export interface PatchAspects { } export declare abstract class BasePatch implements Patch { readonly [PatchSym]: PatchSym; readonly [_Input]: (input: Input) => void; readonly [_Output]: () => Output; } export declare class Empty extends BasePatch { readonly _tag = "Empty"; constructor(); } export declare class AddService extends BasePatch { readonly tag: Tag; readonly service: T; readonly _tag = "AddService"; constructor(tag: Tag, service: T); } export declare class AndThen extends BasePatch { readonly first: Patch; readonly second: Patch; readonly _tag = "AndThen"; constructor(first: Patch, second: Patch); } export declare class RemoveService extends BasePatch { readonly tag: Tag; readonly _tag = "RemoveService"; constructor(tag: Tag); } export declare class UpdateService extends BasePatch { readonly tag: Tag; readonly update: (service: T) => T; readonly _tag = "UpdateService"; constructor(tag: Tag, update: (service: T) => T); } /** * @tsplus macro remove */ export declare function concretePatch(_: Patch): asserts _ is Empty | AddService | AndThen | RemoveService | UpdateService; /** * Applies a `Patch` to the specified `Env` to produce a new patched `Env`. * @tsplus static Patch.Aspects patch * @tsplus pipeable Patch patch * @tsplus location "@tsplus/stdlib/service/Patch" */ export declare function patch(env: Env): (self: Patch) => Env; /** * An empty patch which returns the environment unchanged. * @tsplus static Patch.Ops empty * @tsplus location "@tsplus/stdlib/service/Patch" */ export declare function empty(): Patch; /** * Combines two patches to produce a new patch that describes applying the * updates from this patch and then the updates from the specified patch. * @tsplus static Patch.Aspects combine * @tsplus pipeable Patch combine * @tsplus location "@tsplus/stdlib/service/Patch" */ export declare function combine(that: Patch): (self: Patch) => Patch; /** * @tsplus static Patch.Ops diff * @tsplus location "@tsplus/stdlib/service/Patch" */ export declare function diff(oldValue: Env, newValue: Env): Patch; //# sourceMappingURL=Patch.d.ts.map