Skip to content

waygraph / MemPage

Class: MemPage ​

Defined in: src/engine/mem/mem.ts:75

Typed, identity-keyed shared memory for one graph run. Reading a key that was never written throws immediately, naming the key, instead of returning undefined - a misuse fails loud at the read site, not silently downstream.

Constructors ​

Constructor ​

new MemPage(): MemPage

Returns ​

MemPage

Properties ​

trail ​

readonly trail: Trail

Defined in: src/engine/mem/mem.ts:78

What each step of the run saw, for a later step to ask: mem.trail.latest(Cart.read.items).

Methods ​

clone() ​

clone(): MemPage

Defined in: src/engine/mem/mem.ts:168

An independent copy of every key currently set - a later .set() on either the original or the clone never touches the other. For branch-session cloning (runBranchRegression): each explored branch gets its own mem, so one branch's writes can't bleed into a sibling that also gets tried from the same snapshot point. Shallow per value (same as set() always was - MemPage never owned deep-copying the values themselves, only which keys point to which).

Returns ​

MemPage


get() ​

get<T>(k): T

Defined in: src/engine/mem/mem.ts:92

Reads k's value, throwing (naming k) if it was never set - never returns undefined for a genuinely missing key, so a misuse fails loud at the read site instead of surfacing as a confusing error deep in act.

Type Parameters ​

T ​

T

Parameters ​

k ​

MemKey<T>

Returns ​

T

Example ​

ts
const { username, password } = mem.get(SaucedemoKeys.credentials);

has() ​

has<T>(k): boolean

Defined in: src/engine/mem/mem.ts:100

True once k has been set - use before a get that's genuinely optional.

Type Parameters ​

T ​

T

Parameters ​

k ​

MemKey<T>

Returns ​

boolean


keys() ​

keys(): MemKey<unknown>[]

Defined in: src/engine/mem/mem.ts:157

The keys set, in the order they were first set.

Returns ​

MemKey<unknown>[]


set() ​

set<T>(k, value): this

Defined in: src/engine/mem/mem.ts:81

mem.set(SaucedemoKeys.credentials, { ... }). Returns the page, so a test sets several in one line: new MemPage().set(A, 1).set(B, 2).

Type Parameters ​

T ​

T

Parameters ​

k ​

MemKey<T>

value ​

T

Returns ​

this


setAll() ​

Call Signature ​

setAll<A>(p1): void

Defined in: src/engine/mem/mem.ts:122

Sets several keys in one call - mem.setAll([Login.username, "standard_user"], [Login.password, "secret_sauce"]) instead of one .set() per line. Can't take a plain { ... } object literal: MemKey instances are the identity the store is keyed by, and object literals can only have string/symbol property names, not object instances - a [key, value] pair is the shape that keeps that identity-based guarantee.

Overloaded per pair count (2-6, per-arity overloads like the old defineFlow's overloads) rather than one fully-generic variadic signature - each pair binds its own type parameter independently, which TS checks reliably; a single self-referential mapped-tuple-over-a-rest-parameter type was tried first and silently failed to catch a mismatched pair, so it was not trusted over this.

Type Parameters ​
A ​

A

Parameters ​
p1 ​

readonly [MemKey<A>, A]

Returns ​

void

Call Signature ​

setAll<A, B>(p1, p2): void

Defined in: src/engine/mem/mem.ts:123

Sets several keys in one call - mem.setAll([Login.username, "standard_user"], [Login.password, "secret_sauce"]) instead of one .set() per line. Can't take a plain { ... } object literal: MemKey instances are the identity the store is keyed by, and object literals can only have string/symbol property names, not object instances - a [key, value] pair is the shape that keeps that identity-based guarantee.

Overloaded per pair count (2-6, per-arity overloads like the old defineFlow's overloads) rather than one fully-generic variadic signature - each pair binds its own type parameter independently, which TS checks reliably; a single self-referential mapped-tuple-over-a-rest-parameter type was tried first and silently failed to catch a mismatched pair, so it was not trusted over this.

Type Parameters ​
A ​

A

B ​

B

Parameters ​
p1 ​

readonly [MemKey<A>, A]

p2 ​

readonly [MemKey<B>, B]

Returns ​

void

Call Signature ​

setAll<A, B, C>(p1, p2, p3): void

Defined in: src/engine/mem/mem.ts:124

Sets several keys in one call - mem.setAll([Login.username, "standard_user"], [Login.password, "secret_sauce"]) instead of one .set() per line. Can't take a plain { ... } object literal: MemKey instances are the identity the store is keyed by, and object literals can only have string/symbol property names, not object instances - a [key, value] pair is the shape that keeps that identity-based guarantee.

Overloaded per pair count (2-6, per-arity overloads like the old defineFlow's overloads) rather than one fully-generic variadic signature - each pair binds its own type parameter independently, which TS checks reliably; a single self-referential mapped-tuple-over-a-rest-parameter type was tried first and silently failed to catch a mismatched pair, so it was not trusted over this.

Type Parameters ​
A ​

A

B ​

B

C ​

C

Parameters ​
p1 ​

readonly [MemKey<A>, A]

p2 ​

readonly [MemKey<B>, B]

p3 ​

readonly [MemKey<C>, C]

Returns ​

void

Call Signature ​

setAll<A, B, C, D>(p1, p2, p3, p4): void

Defined in: src/engine/mem/mem.ts:129

Sets several keys in one call - mem.setAll([Login.username, "standard_user"], [Login.password, "secret_sauce"]) instead of one .set() per line. Can't take a plain { ... } object literal: MemKey instances are the identity the store is keyed by, and object literals can only have string/symbol property names, not object instances - a [key, value] pair is the shape that keeps that identity-based guarantee.

Overloaded per pair count (2-6, per-arity overloads like the old defineFlow's overloads) rather than one fully-generic variadic signature - each pair binds its own type parameter independently, which TS checks reliably; a single self-referential mapped-tuple-over-a-rest-parameter type was tried first and silently failed to catch a mismatched pair, so it was not trusted over this.

Type Parameters ​
A ​

A

B ​

B

C ​

C

D ​

D

Parameters ​
p1 ​

readonly [MemKey<A>, A]

p2 ​

readonly [MemKey<B>, B]

p3 ​

readonly [MemKey<C>, C]

p4 ​

readonly [MemKey<D>, D]

Returns ​

void

Call Signature ​

setAll<A, B, C, D, E>(p1, p2, p3, p4, p5): void

Defined in: src/engine/mem/mem.ts:135

Sets several keys in one call - mem.setAll([Login.username, "standard_user"], [Login.password, "secret_sauce"]) instead of one .set() per line. Can't take a plain { ... } object literal: MemKey instances are the identity the store is keyed by, and object literals can only have string/symbol property names, not object instances - a [key, value] pair is the shape that keeps that identity-based guarantee.

Overloaded per pair count (2-6, per-arity overloads like the old defineFlow's overloads) rather than one fully-generic variadic signature - each pair binds its own type parameter independently, which TS checks reliably; a single self-referential mapped-tuple-over-a-rest-parameter type was tried first and silently failed to catch a mismatched pair, so it was not trusted over this.

Type Parameters ​
A ​

A

B ​

B

C ​

C

D ​

D

E ​

E

Parameters ​
p1 ​

readonly [MemKey<A>, A]

p2 ​

readonly [MemKey<B>, B]

p3 ​

readonly [MemKey<C>, C]

p4 ​

readonly [MemKey<D>, D]

p5 ​

readonly [MemKey<E>, E]

Returns ​

void

Call Signature ​

setAll<A, B, C, D, E, F>(p1, p2, p3, p4, p5, p6): void

Defined in: src/engine/mem/mem.ts:142

Sets several keys in one call - mem.setAll([Login.username, "standard_user"], [Login.password, "secret_sauce"]) instead of one .set() per line. Can't take a plain { ... } object literal: MemKey instances are the identity the store is keyed by, and object literals can only have string/symbol property names, not object instances - a [key, value] pair is the shape that keeps that identity-based guarantee.

Overloaded per pair count (2-6, per-arity overloads like the old defineFlow's overloads) rather than one fully-generic variadic signature - each pair binds its own type parameter independently, which TS checks reliably; a single self-referential mapped-tuple-over-a-rest-parameter type was tried first and silently failed to catch a mismatched pair, so it was not trusted over this.

Type Parameters ​
A ​

A

B ​

B

C ​

C

D ​

D

E ​

E

F ​

F

Parameters ​
p1 ​

readonly [MemKey<A>, A]

p2 ​

readonly [MemKey<B>, B]

p3 ​

readonly [MemKey<C>, C]

p4 ​

readonly [MemKey<D>, D]

p5 ​

readonly [MemKey<E>, E]

p6 ​

readonly [MemKey<F>, F]

Returns ​

void


update() ​

update<T>(k, fn): void

Defined in: src/engine/mem/mem.ts:105

Covers add/remove/insert/nest generically - MemPage never needs to know the shape of T.

Type Parameters ​

T ​

T

Parameters ​

k ​

MemKey<T>

fn ​

(current) => T

Returns ​

void

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed