Interface: AmnesiaProviderOptions
Defined in: types.ts:378
Configuration for AmnesiaProvider.
Extends AmnesiaStoreOptions but exposes scopeId-aware lifecycle hooks so the same handler can serve every scope under one provider.
Extends
Omit<AmnesiaStoreOptions,"onPush"|"onAmend"|"onUndo"|"onRedo"|"onClear">
Properties
capacity?
optionalcapacity?:number
Defined in: types.ts:312
Maximum number of entries retained on the past stack. When the limit is reached, the oldest entry is dropped on every new push.
Defaults to 100. Set to Infinity to disable, but be aware closures
may retain large amounts of memory.
Inherited from
coalesceWindowMs?
optionalcoalesceWindowMs?:number
Defined in: types.ts:320
Maximum time (in milliseconds) between two pushes that share a
non-empty coalesceKey for them to merge into a single entry.
Defaults to 400.
Inherited from
AmnesiaStoreOptions.coalesceWindowMs
metaTransform?
optionalmetaTransform?: (meta) =>Record<string,unknown> |undefined
Defined in: types.ts:369
Sanitizer applied to meta before it is exposed in the public
snapshot or passed to lifecycle hooks. Use this to redact sensitive
fields without forcing every call site to remember the rule.
Only invoked when meta is defined. The return value replaces meta
in the public HistoryEntry; returning undefined strips it.
The transform should be pure and stable — it runs every time the snapshot is rebuilt and every time a hook is fired.
Parameters
| Parameter | Type |
|---|---|
meta | Record<string, unknown> |
Returns
Record<string, unknown> | undefined
Inherited from
AmnesiaStoreOptions.metaTransform
onAmend?
optionalonAmend?: (entry,scopeId) =>void
Defined in: types.ts:401
Lifecycle hook fired after a successful amend on scopeId. The
entry is the updated top-of-past entry.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
onClear?
optionalonClear?: (scopeId) =>void
Defined in: types.ts:420
Lifecycle hook fired after clear() on scopeId (and only when the
call actually cleared something). When the provider's clear()
clears all scopes, this fires once per cleared scope.
Parameters
| Parameter | Type |
|---|---|
scopeId | string |
Returns
void
onError?
optionalonError?:AmnesiaErrorHandler
Defined in: types.ts:326
Custom error reporter for failures inside redo / undo. See
AmnesiaErrorHandler.
Inherited from
onPush?
optionalonPush?: (entry,scopeId) =>void
Defined in: types.ts:395
Lifecycle hook fired after a successful push commits a new entry to
the past stack of scopeId. Coalesce-merges do not fire this —
only the first push of a coalesce burst counts as a logical user
action.
Hook payloads are dispatched after the snapshot is updated and after subscribers have been notified, so handlers see a quiescent store. A throw inside the handler is caught and ignored.
The entry's meta (when present) has already been passed through
the scope's metaTransform.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
onRedo?
optionalonRedo?: (entry,scopeId) =>void
Defined in: types.ts:413
Lifecycle hook fired after a successful redo on scopeId. The
entry is the one that was moved from future to past.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
onUndo?
optionalonUndo?: (entry,scopeId) =>void
Defined in: types.ts:407
Lifecycle hook fired after a successful undo on scopeId. The
entry is the one that was moved from past to future.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void