interface / @typed/navigation

InitialMemoryOptions

Configures an in-memory provider from one initial URL.

Package version
1.0.0-beta.13
Category
Memory history configuration
Since
1.0.0

Import

import { InitialMemoryOptions } from "@typed/navigation";

Signatures

export interface InitialMemoryOptions {
    readonly url: string | URL;
    readonly origin?: string | undefined;
    readonly base?: string | undefined;
    readonly maxEntries?: number | undefined;
    readonly state?: unknown;
}

Why

Most SSR and tests begin from one location and should not manufacture destination identity by hand; this form creates its key and id through Uuid7State.

Ownership and lifetime

The resulting Layer allocates one initial entry and delegates ownership to {@link memory} for the lifetime of the provided Navigation service.

Property: base

The structural base path exposed by the active provider.

Property: base: Why

Routers can establish a stable mount root separately from the changing current URL.

Property: base: Ownership and lifetime

The string is read during acquisition and retained on the Navigation service.

Property: maxEntries

The positive maximum number of history entries retained by the provider.

Property: maxEntries: Why

A positive bound makes eviction deterministic while the one generated initial entry always remains inside the retained tail.

Property: maxEntries: Ownership and lifetime

The number is forwarded to {@link memory} and must be greater than zero. No validation enforces that contract. 0 currently retains all entries because slice(-0) is slice(0), so it does not disable history retention.

Property: origin

The absolute origin used to resolve relative destinations.

Property: origin: Why

A single origin makes same-document classification and URL normalization consistent across providers.

Property: origin: Ownership and lifetime

The string is read during acquisition and retained on the Navigation service.

Property: state

Application state stored with a committed destination.

Property: state: Why

Persistent entry data stays distinct from transient handler information.

Property: state: Ownership and lifetime

The value is retained by reference on the initial Destination. Callers own any mutable object placed here and should replace rather than mutate it when deterministic history snapshots matter.

Property: url

The initial URL or path for a one-entry memory provider.

Property: url: Why

Callers can start SSR or tests without constructing destination identity manually.

Property: url: Ownership and lifetime

Layer acquisition resolves this value and stores the resulting URL object on the initial Destination.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source