Module / v2.0.0-beta.13

@typed/fx/RefSubject

66 unique exports available through this public import path, including their members and aliases.

import * as RefSubject from "@typed/fx/RefSubject";

Accumulation

  • scan

    variable

    Stateful scan over a RefSubject / Computed, producing a Computed of the accumulated state.

    Fx subscriptions follow Fx.scan semantics (emit initial, then fold each source value). Effect sampling accumulates across source versions via a private state ref (do not mix heavy subscribe + sample on the same scan if you need a single shared accumulator).

  • scanEffect

    variable

    Effectful stateful scan over a RefSubject / Computed, producing a Computed of the accumulated state.

Construction options

Constructors

  • make

    function

    Creates a new RefSubject from a value, Effect, or Fx.

Derived queries

  • makeComputed

    function

    Builds a read-only Computed projection from a Versioned source.

  • map

    variable

    Transforms a RefSubject, Computed, or Filtered using a pure function.

  • mapEffect

    variable

    Transforms a RefSubject, Computed, or Filtered using an Effectful function.

  • proxy

    variable

    Extract all values from an object using a Proxy. Allows accessing nested properties of a Computed or Filtered object/array as individual computed values.

Hydration construction

  • hydrate

    function

    Creates a named hydrated RefSubject using a string-encoded Schema codec.

  • hydrateAll

    function

    Combines hydrated refs into one serialization and restoration boundary.

Hydration protocol

Hydration types

Observation policy

  • CurrentComputedBehavior

    variable

    Selects whether a computed Fx observes only its current value or also follows later pushes.

  • slice

    variable

    Limits which pushed versions a RefSubject view observes without changing its state.

Optional queries

  • compact

    variable

    Converts a Computed or Filtered of Option<A> into a Filtered<A>, filtering out None values.

  • filterMap

    variable

    Filters and transforms a RefSubject, Computed, or Filtered using a pure function that returns an Option.

  • filterMapEffect

    variable

    Filters and transforms a RefSubject, Computed, or Filtered using an Effectful function that returns an Option.

  • getOrElse

    variable

    Returns a Computed that yields the value inside the Option, or the fallback when None. Works with Computed<Option<A>> (e.g. from fromOption / fromNullable) and with Filtered<A>.

  • makeFiltered

    function

    Builds a Filtered view from the three channels of a Versioned source.

Read-only state

  • Computed

    interface

    A Computed is a read-only view of a value that can change over time. It is an Fx that emits the current value and subsequent updates. It is also an Effect that samples the current value.

  • Filtered

    interface

    A Filtered is a Computed that may not always have a value. It is essentially a Computed<Option<A>> with helper methods.

Services

  • RefSubject.Class

    interface

    Defines the class state contract.

  • RefSubject.Service

    interface

    Defines the service state contract.

  • Service

    function

    Creates a Context-backed RefSubject service facade and Layer constructors.

  • computedFromService

    function

    Lifts an Effect-provided Computed into a Computed facade.

  • filteredFromService

    function

    Defers retrieval of a Filtered value from Effect Context while preserving Filtered behavior.

Source adapters

  • fromEffect

    function

    Creates a RefSubject from an Effect.

  • fromFx

    function

    Creates a RefSubject from an Fx, tracking the latest emitted value.

  • fromNullable

    function

    Creates Option-valued RefSubject state from a nullable input.

  • fromOption

    function

    Creates a RefSubject from an Option value.

  • fromStream

    function

    Creates a RefSubject that tracks the latest value emitted by an Effect Stream.

State composition

  • struct

    function

    Combines multiple RefSubject, Computed, or Filtered instances into a single struct.

  • tuple

    function

    Combines multiple RefSubject, Computed, or Filtered instances into a single tuple.

State updates

  • decrement

    function

    Decrements a numeric RefSubject by 1.

  • delete

    function · Re-export

    Resets a RefSubject to its initial value, returning the previous value if it existed.

  • increment

    function

    Increments a numeric RefSubject by 1.

  • reset

    function

    Resets a RefSubject to its initial value, returning the previous value if it existed.

  • set

    variable

    Sets the value of a RefSubject.

  • update

    variable

    Updates a RefSubject using a pure function.

  • updateEffect

    variable

    Updates a RefSubject using an Effectful function.

Transactions

  • GetSetDelete

    interface

    Interface for basic RefSubject operations: get, set, delete.

  • modify

    variable

    Modifies a RefSubject using a pure function that returns both a result and a new value.

  • modifyEffect

    variable

    Modifies a RefSubject using an Effectful function that returns both a result and a new value.

  • runUpdates

    variable

    Runs an effect that can modify a RefSubject transactionally, with optional interrupt handling.

Type guards

  • isComputed

    function

    Tests whether a value carries the public Computed TypeId.

  • isHydrationRef

    function

    Tests whether a value carries callable hydration metadata.

  • isRefSubject

    function

    Checks if a value is a RefSubject.

Type identity

  • ComputedTypeId

    variable

    Runtime symbol identifying read-only Computed values.

  • FilteredTypeId

    variable

    Runtime symbol identifying conditionally available Filtered values.

  • RefSubjectTypeId

    variable

    Runtime symbol identifying writable RefSubject values.

Type utilities

Writable state

  • RefSubject

    interface

    A RefSubject is a mutable reference that can be observed as an Fx. It combines the capabilities of a Ref (get/set/update) with a Subject (subscribe).

Writable views

  • transform

    variable

    Transforms a RefSubject invariantly using bidirectional mapping functions.