travels3.0
API ReferenceType Aliases

TravelsDeserializeOptions<S, P>

Travels 3.0.1. Travels 3 API reference for TravelsDeserializeOptions.

TravelsDeserializeOptions<S, P> = object

Defined in: src/type.ts:204

Type Parameters

S

S

P

P extends PatchesOption = { }

Properties

fallback?

optional fallback: TravelsSerializedHistory<S, P> | () => TravelsSerializedHistory<S, P>

Defined in: src/type.ts:218

Fallback snapshot used when parsing, migration, or validation fails. Function fallbacks must return synchronously.


migrate?

optional migrate: TravelsMigration<S, P>

Defined in: src/type.ts:213

Migrate old persisted snapshots into the current schema before validation. The callback must return synchronously; perform asynchronous I/O before calling deserialize().


onError()?

optional onError: (error) => void

Defined in: src/type.ts:224

Receive typed persistence errors before a fallback is returned or the error is thrown.

Parameters

error

Error

Returns

void


replayOptions?

optional replayOptions: TravelsReplayOptions

Defined in: src/type.ts:235

Mutative options used while semantically replaying every history entry. Supply the same strict/mark settings that were used to record the history.


validation?

optional validation: TravelsHistoryValidationMode

Defined in: src/type.ts:230

structural validates the encoded schema and patch shapes (default). semantic additionally replays and reverses every entry and is recommended for snapshots that have not crossed a trusted verification boundary.

On this page