# Versioned.Versioned

A Versioned value is a value that changes over time, and each change is associated with a version number.
It combines the capabilities of an `Fx` (to observe changes) and an `Effect` (to get the current value).

## Signatures

```ts
export interface Versioned<out R1, out E1, out A2, out E2, out R2, out A3, out E3, out R3> extends Fx.Fx<A2, E2, R2>, Effect.Effect<A3, E3, R3> {
    readonly version: Effect.Effect<number, E1, R1>;
    readonly interrupt: Effect.Effect<void, never, R1>;
}
```

```ts
export declare namespace Versioned {
    type Unify<T> = T extends Versioned<infer R1, infer E1, infer A2, infer E2, infer R2, infer A3, infer E3, infer R3> | (infer _) ? Versioned<R1, E1, A2, E2, R2, A3, E3, R3> : never;
    type VersionContext<T> = T extends Versioned<infer R, any, any, any, any, any, any, any> ? R : never;
    type VersionError<T> = T extends Versioned<any, infer E, any, any, any, any, any, any> ? E : never;
    interface Service<Self, Id extends string, E1, A2, E2, A3, E3> extends Versioned<Self, E1, A2, E2, Self, A3, E3, Self> {
        readonly id: Id;
        readonly service: Context.Service<Self, Versioned<never, E1, A2, E2, never, A3, E3, never>>;
        readonly make: <R1 = never, R2 = never, R3 = never>(version: Effect.Effect<number, E1, R1>, fx: Fx.Fx<A2, E2, R2>, effect: Effect.Effect<A3, E3, R3>) => Layer.Layer<Self, never, Exclude<R1 | R2 | R3, Scope.Scope>>;
    }
    interface Class<Self, Id extends string, E1, A2, E2, A3, E3> extends Service<Self, Id, E1, A2, E2, A3, E3> {
        new (): Service<Self, Id, E1, A2, E2, A3, E3>;
    }
}
```

## Why

Keeps a current-value Effect, pushed Fx updates, and an invalidation version together so
consumers can avoid stale work without hiding errors or services.

## Ownership and lifetime

Versioned is a contract and performs no acquisition. Implementations retain the errors,
services, interruption, and Scope requirements expressed by its members.

## Property: interrupt

Interrupts shared in-flight current-value work.

## Property: interrupt: Why

Returns an Effect that interrupts shared in-flight current-value work and completes with
`void`; it does not complete or take ownership of the independently supplied Fx update channel.

## Property: interrupt: Ownership and lifetime

Nothing happens until the Effect is run. It cannot fail, requires the version channel's `R1`,
and does not start a read or subscription merely by being accessed.

## Property: version

Samples the current invalidation version.

## Property: version: Why

Samples the input's invalidation token independently of reading the current value or observing
pushed updates.

## Property: version: Ownership and lifetime

version does not own its inputs. Observation and current reads retain upstream lifetime,
typed failures, services, and interruption behavior.
