@actyx/pond
Enumerations
Classes
Interfaces
Type aliases
Actyx
Ƭ Actyx: EventFns
& { nodeId
: NodeId
; snapshotStore
: SnapshotStore
; dispose
: () => void
; nodeInfo
: (maxAgeMillis
: number
) => Promise
<NodeInfo
> ; waitForSync
: () => Promise
<void
> }
Access all sorts of functionality related to the Actyx system!
ActyxEvent
Ƭ ActyxEvent<E
>: Object
An event with its metadata.
Type parameters
Name | Type |
---|---|
E | unknown |
Type declaration
Name | Type |
---|---|
meta | Metadata |
payload | E |
ActyxOpts
Ƭ ActyxOpts: Object
Options used when creating a new Actyx
instance.
Type declaration
Name | Type | Description |
---|---|---|
actyxHost? | string | Host of the Actxy service. This defaults to localhost and should stay localhost in almost all cases. |
actyxPort? | number | API port of the Actyx service. Defaults to 4454. |
onConnectionEstablished? | () => void | Hook, when the connection to the store has been established. |
onConnectionLost? | () => void | Hook, when the connection to the store is closed |
ActyxTestOpts
Ƭ ActyxTestOpts: Object
Options used when creating a new TEST Actyx
instance.
Type declaration
Name | Type | Description |
---|---|---|
nodeId? | NodeId | Local node id to use |
timeInjector? | TimeInjector | Install the given time source for test purposes beta |
AddEmission
Ƭ AddEmission<EWrite
>: <E>(...args
: [Tags
<E
>, E
] | [TaggedTypedEvent
<E
>]) => void
Type parameters
Name |
---|
EWrite |
Type declaration
▸ <E
>(...args
): void
Queue emission of an event whose type is covered by EWrite
.
Type parameters
Name | Type |
---|---|
E | extends EWrite |
Parameters
Name | Type |
---|---|
...args | [Tags <E >, E ] | [TaggedTypedEvent <E >] |
Returns
void
AppId
Ƭ AppId: string
An Actyx app id.
AppManifest
Ƭ AppManifest: Object
Manifest describing an Actyx application. Used for authorizing API access.
Type declaration
Name | Type | Description |
---|---|---|
appId | string | Structured application id. For testing and development purposes, you can always pass 'com.example.somestring' For production, you will buy a license from Actyx for your specific app id like com.my-company.my-app. |
displayName | string | Arbitrary string describing the app. |
signature? | string | Manifest signature, if it’s not an example app. |
version | string | Arbitrary version string |
AqlDiagnosticMessage
Ƭ AqlDiagnosticMessage: Object
AQL diagnostic output describing an error that occured during query evaluation.
beta
Type declaration
Name | Type | Description |
---|---|---|
message | string | - |
severity | string | - |
type | "diagnostic" | A problem occured |
AqlEventMessage
Ƭ AqlEventMessage: Object
AQL message conveying a raw event or a record created by mapping an event via SELECT.
beta
Type declaration
Name | Type | Description |
---|---|---|
meta | Metadata | Metadata of the event that yielded this record. |
payload | unknown | Payload data generated by the AQL query via SELECT statements. |
type | "event" | A simply-mapped event |
AqlFutureCompat
Ƭ AqlFutureCompat: Object
Future versions of AQL will know additional response message types.
beta
Type declaration
Name | Type | Description |
---|---|---|
meta | Record <string , unknown > | Consult AQL documentation to find out about future metadata contents. |
payload | unknown | - |
type | Exclude <"event" | "offsets" | "diagnostic" , string > | Consult AQL documentation to find out about future available types. |
AqlOffsetsMsg
Ƭ AqlOffsetsMsg: Object
AQL message describing the offsets at the current state of the response stream.
beta
Type declaration
Name | Type |
---|---|
offsets | OffsetMap |
type | "offsets" |
AqlQuery
Ƭ AqlQuery: string
| { order?
: EventsSortOrder
; query
: string
}
An aql query is either a plain string, or an object containing the string and the desired order.
beta
AqlResponse
Ƭ AqlResponse: AqlEventMessage
| AqlOffsetsMsg
| AqlDiagnosticMessage
| AqlFutureCompat
Response message returned by running AQL query.
beta
AutoCappedQuery
Ƭ AutoCappedQuery: Object
Query for a set of events which is automatically capped at the latest available upperBound.
Type declaration
Name | Type | Description |
---|---|---|
horizon? | string | Earliest event ID to consider in the result |
lowerBound? | OffsetMap | Starting point for the query. Everything up-to-and-including lowerBound will be omitted from the result. Defaults to empty map, which means no lower bound at all. Sources not listed in the lowerBound will be delivered in full. |
order? | EventsSortOrder | Desired order of delivery. Defaults to 'Asc' |
query? | Where <unknown > | Statement to select specific events. Defaults to allEvents . |
Caching
Ƭ Caching: NoCaching
| InProcessCaching
Caching indicator for pond.observeAll().
beta
CancelSubscription
Ƭ CancelSubscription: () => void
Type declaration
▸ (): void
Cancel an ongoing aggregation (the provided callback will stop being called).
Returns
void
Counters
Ƭ Counters: Readonly
<CountersMut
>
Immutable swarm counters information.
CountersMut
Ƭ CountersMut: Object
Mutable swarm counters information.
Type declaration
Name | Type | Description |
---|---|---|
both | number | Both the pond and the swarm have it |
own | number | The pond has it, the swarm doesn't |
swarm | number | The swarm has it, the pond does not |
EarliestQuery
Ƭ EarliestQuery<E
>: Object
Query for observeEarliest.
beta
Type parameters
Name |
---|
E |
Type declaration
Name | Type | Description |
---|---|---|
eventOrder? | EventOrder | The order to find min/max for. Defaults to Lamport . |
lowerBound? | OffsetMap | Starting point for the query. Everything up-to-and-including lowerBound will be omitted from the result. Defaults to empty map, which means no lower bound at all. Sources not listed in the lowerBound will be delivered in full. |
query | Where <E > | Statement to select specific events. |
EventChunk
Ƭ EventChunk: Object
A chunk of events, with lower and upper bound.
A call to queryKnownRange
with the included bounds is guaranteed to return exactly the contained set of events.
A call to subscribe
with the included lowerBound
, however, may find new events from sources not included in the bounds.
Type declaration
Name | Type | Description |
---|---|---|
events | ActyxEvent [] | The event data. Sorting depends on the request which produced this chunk. |
lowerBound | OffsetMap | The lower bound of the event chunk, independent of its sorting in memory. |
upperBound | OffsetMap | The upper bound of the event chunk, independent of its sorting in memory. |
EventKey
Ƭ EventKey: Object
Triple that Actyx events are sorted and identified by.
Type declaration
Name | Type |
---|---|
lamport | Lamport |
offset | Offset |
stream | StreamId |
EventSubscription
Ƭ EventSubscription: Object
Subscription to a set of events that may still grow.
Type declaration
Name | Type | Description |
---|---|---|
lowerBound? | OffsetMap | Starting point for the query. Everything up-to-and-including lowerBound will be omitted from the result. Defaults to empty map, which means no lower bound at all. Sources not listed in the lowerBound will be delivered in full. |
query? | Where <unknown > | Statement to select specific events. Defaults to allEvents . |
EventsMsg
Ƭ EventsMsg<E
>: Object
Implies consumer should apply the given events to its latest local state.
alpha
Type parameters
Name |
---|
E |
Type declaration
Name | Type |
---|---|
caughtUp | boolean |
events | ActyxEvent <E >[] |
type | events |
EventsOrTimetravel
Ƭ EventsOrTimetravel<E
>: StateMsg
| EventsMsg
<E
> | TimeTravelMsg
<E
>
Possible subscribe_monotonic message types.
alpha
Type parameters
Name |
---|
E |
Fish
Ƭ Fish<S
, E
>: Object
A Fish<S, E>
describes an ongoing aggregration (fold) of events of type E
into state of type S
.
A Fish always sees events in the correct order, even though event delivery on Actyx is only eventually consistent:
To this effect, arrival of an hitherto unknown event "from the past" will cause a replay of the aggregation
from an earlier state, instead of passing that event to the Fish out of order.
Type parameters
Name |
---|
S |
E |
Type declaration
Name | Type | Description |
---|---|---|
fishId | FishId | - |
initialState | S | - |
isReset? | IsReset <E > | - |
onEvent | Reduce <S , E > | Function to create the next state from previous state and next event. It works similar to Array.reduce . Do note however that — while it may modify the passed-in state — this function must be pure: - It should not cause any side-effects (except logging) - It should not reference dynamic outside state like random numbers or the current time. The result must depend purely on the input parameters. |
where | Where <E > | Selection of events to aggregate in this Fish. You may specify plain strings inline: where: Tags('my', 'tag', 'selection') (which requires all three tags) Or refer to typed static tags: where: myFirstTag.and(mySecondTag).or(myThirdTag) In both cases you would select events which contain all three given tags. |
deserializeState? | (jsonState : unknown ) => S | - |
FishErrorContext
Ƭ FishErrorContext: { event
: unknown
; metadata
: Metadata
; occuredIn
: "onEvent"
; state
: unknown
} | { event
: unknown
; metadata
: Metadata
; occuredIn
: "isReset"
} | { jsonState
: unknown
; occuredIn
: "deserializeState"
}
Context for an error thrown by a Fish’s functions.
FishErrorReporter
Ƭ FishErrorReporter: (err
: unknown
, fishId
: FishId
, detail
: FishErrorContext
) => void
Type declaration
▸ (err
, fishId
, detail
): void
Error reporter for when Fish functions throw exceptions.
Parameters
Name | Type |
---|---|
err | unknown |
fishId | FishId |
detail | FishErrorContext |
Returns
void
FishId
Ƭ FishId: Object
Unique identifier for a fish.
Type declaration
Name | Type |
---|---|
entityType | string |
name | string |
version | number |
FishProcessInfo
Ƭ FishProcessInfo: Object
How many Fish are active, and of which entityTypes?
Type declaration
Name | Type |
---|---|
fish | Object |
numBeingProcessed | number |
FixedStart
Ƭ FixedStart: Object
Sent by the client to indicate it wants event delivery to start from this point. Implies that a state was cached in-process by the client and so it does not want to start from a snapshot known to Actyx.
alpha
Type declaration
Name | Type |
---|---|
from | OffsetMap |
horizon? | EventKey |
latestEventKey | EventKey |
FullWaitForSwarmConfig
Ƭ FullWaitForSwarmConfig: Object
Configure how to wait for swarm.
Type declaration
Name | Type | Description |
---|---|---|
allowSkip | boolean | True if we allow the user to skip the splash screen |
enabled | boolean | Splash screen enabled |
minSources | number | Minimum number of sources until we consider that we got the swarm state |
waitForSwarmMs | number | Delay until we consider that we got the swarm state |
waitForSyncMs? | number | Delay that we allow to sync with the swarm state (leave undefined to wait indefinitely) |
GetNodeConnectivityParams
Ƭ GetNodeConnectivityParams: Object
Parameter object for the Pond.getNodeConnectivity
call.
Type declaration
Name | Type |
---|---|
specialSources? | NodeId [] |
callback | (newState : unknown ) => void |
HasOffsetAndStream
Ƭ HasOffsetAndStream: Object
Anything with offset on a stream.
Type declaration
Name | Type |
---|---|
offset | number |
stream | string |
HasTags
Ƭ HasTags: Object
Anything that has tags. @alpha
Type declaration
Name | Type |
---|---|
tags | string [] |
InProcessCaching
Ƭ InProcessCaching: Object
Indicate in-process (nonpersistent) Caching.
beta
Type declaration
Name | Type |
---|---|
key | string |
type | "in-process" |
InvalidateAllSnapshots
Ƭ InvalidateAllSnapshots: () => Promise
<void
>
Type declaration
▸ (): Promise
<void
>
The signature of the function to invalidate all stored snapshots.
beta
Returns
Promise
<void
>
InvalidateSnapshots
Ƭ InvalidateSnapshots: (semantics
: string
, name
: string
, key
: EventKey
) => Promise
<void
>
Type declaration
▸ (semantics
, name
, key
): Promise
<void
>
The signature of the function to invalidate snapshots for a given fish.
beta
Parameters
Name | Type |
---|---|
semantics | string |
name | string |
key | EventKey |
Returns
Promise
<void
>
IsReset
Ƭ IsReset<E
>: (event
: E
, metadata
: Metadata
) => boolean
Type parameters
Name |
---|
E |
Type declaration
▸ (event
, metadata
): boolean
A function indicating events which completely determine the state. Any event for which isReset returns true will be applied to the initial state, all earlier events discarded.
Parameters
Name | Type |
---|---|
event | E |
metadata | Metadata |
Returns
boolean
Lamport
Ƭ Lamport: number
Lamport timestamp, cf. https://en.wikipedia.org/wiki/Lamport_timestamp
LatestQuery
Ƭ LatestQuery<E
>: EarliestQuery
<E
>
Query for observeLatest.
beta
Type parameters
Name |
---|
E |
LocalSnapshot
Ƭ LocalSnapshot<S
>: StateWithProvenance
<S
> & { cycle
: number
; eventKey
: EventKey
; horizon
: EventKey
| undefined
}
A local snapshot of state.
beta
Type parameters
Name |
---|
S |
LocalSnapshotFromIndex
Ƭ LocalSnapshotFromIndex: LocalSnapshot
<string
>
The format of snapshots coming back from the store.
beta
Metadata
Ƭ Metadata: Object
Generic Metadata attached to every event.
Type declaration
Name | Type |
---|---|
appId | AppId |
eventId | string |
isLocalEvent | boolean |
lamport | Lamport |
offset | Offset |
stream | StreamId |
tags | string [] |
timestampMicros | Timestamp |
timestampAsDate | () => Date |
Milliseconds
Ƭ Milliseconds: number
Some number of milliseconds.
MonotonicSubscription
Ƭ MonotonicSubscription<E
>: Object
Subscribe to a stream of events that will never go backwards in time, but rather terminate with a timetravel-message.
alpha
Type parameters
Name |
---|
E |
Type declaration
Name | Type | Description |
---|---|---|
attemptStartFrom | FixedStart | Sending 'attemptStartFrom' means we DONT want a snapshot sent as initial message. |
query | Where <E > | Statement to select specific events. |
sessionId | string | User-chosen session id, used to find cached intermediate states aka local snapshots. |
NoCaching
Ƭ NoCaching: Object
Indicator for disabled caching of pond.observeAll().
beta
Type declaration
Name | Type |
---|---|
type | "none" |
NodeId
Ƭ NodeId: string
An Actyx source id.
NodeInfoEntry
Ƭ NodeInfoEntry: Object
All the info we got for a single node
This might grow in the future to include things like timestamps
Type declaration
Name | Type |
---|---|
own? | number |
swarm? | number |
ObserveAllOpts
Ƭ ObserveAllOpts: Partial
<{ caching
: Caching
; expireAfterFirst
: Milliseconds
; expireAfterSeed
: Milliseconds
}>
Optional parameters to pond.observeAll
beta
Offset
Ƭ Offset: number
Offset within an Actyx event stream.
OffsetMap
Ƭ OffsetMap: Record
<StreamId
, Offset
>
A offset map stores the high water mark for each source.
The value in the psn map is the highest psn seen for this source. Since sequence numbers start with 0, the default value for sources that are not present is -1
OffsetMapBuilder
Ƭ OffsetMapBuilder: Record
<string
, Offset
>
Relatively pointless attempt to distinguish between mutable and immutable psnmap See https://github.com/Microsoft/TypeScript/issues/13347 for why this does not help much.
OffsetMapCompanion
Ƭ OffsetMapCompanion: Object
OffsetMap companion functions.
Type declaration
Name | Type |
---|---|
empty | OffsetMap |
isEmpty | (m : OffsetMap ) => boolean |
lookup | (m : OffsetMap , s : string ) => number |
lookupOrUndefined | (m : OffsetMap , s : string ) => undefined | number |
update | (m : OffsetMapBuilder , ev : HasOffsetAndStream ) => OffsetMapBuilder |
OffsetsResponse
Ƭ OffsetsResponse: Object
Response to an offsets() call
Type declaration
Name | Type | Description |
---|---|---|
present | OffsetMap | The current local present, i.e. offsets up to which we can provide events without any gaps. |
toReplicate | Record <StreamId , number > | For each stream we still need to download events from, the number of pending events. |
OnCompleteOrErr
Ƭ OnCompleteOrErr: (err?
: unknown
) => void
Type declaration
▸ (err?
): void
Handler for a streaming operation ending, either normally or with an error.
If the err
argument is defined, the operation completed due to an error.
Otherwise, it completed normally.
Parameters
Name | Type |
---|---|
err? | unknown |
Returns
void
PendingCommand
Ƭ PendingCommand: Object
Pending command application.
Type declaration
Name | Type |
---|---|
subscribe | (whenEmitted : () => void ) => void |
toPromise | () => Promise <void > |
PendingEmission
Ƭ PendingEmission: Object
Allows you to register actions for when event emission has completed.
Type declaration
Name | Type |
---|---|
subscribe | (whenEmitted : (meta : Metadata []) => void ) => void |
toPromise | () => Promise <Metadata []> |
Pond
Ƭ Pond: Object
Main interface for interaction with the Actyx event system.
New instances are created via Pond.default()
or Pond.of(options)
.
Acquire a Pond for testing (which uses a simulated clean Event Store) via Pond.test()
.
Type declaration
Name | Type |
---|---|
currentState | <S, E>(fish : Fish <S , E >) => Promise <S > |
dispose | () => void |
emit | <E>(tags : Tags <E >, event : E ) => PendingEmission |
events | () => Actyx |
getPondState | (callback : (newState : PondState ) => void ) => CancelSubscription |
info | () => PondInfo |
keepRunning | <S, EWrite>(fish : Fish <S , any >, fn : StateEffect <S , EWrite >, autoCancel? : (state : S ) => boolean ) => CancelSubscription |
nodeInfo | (maxAgeMillis : number ) => Promise <NodeInfo > |
observe | <S, E>(fish : Fish <S , E >, callback : (newState : S ) => void , stoppedByError? : (err : unknown ) => void ) => CancelSubscription |
observeAll | <ESeed, S>(seedEventsSelector : Where <ESeed >, makeFish : (seedEvent : ESeed ) => undefined | Fish <S , any >, opts : Partial <{ caching : Caching ; expireAfterFirst : Milliseconds ; expireAfterSeed : Milliseconds }>, callback : (states : S []) => void ) => CancelSubscription |
observeOne | <ESeed, S>(seedEventSelector : Where <ESeed >, makeFish : (seedEvent : ESeed ) => Fish <S , any >, callback : (newState : S ) => void , stoppedByError? : (err : unknown ) => void ) => CancelSubscription |
publish | (event : TaggedEvent ) => Promise <Metadata >(events : TaggedEvent []) => Promise <Metadata []> |
run | <S, EWrite>(fish : Fish <S , any >, fn : StateEffect <S , EWrite >) => PendingCommand |
waitForSwarmSync | (params : WaitForSwarmSyncParams ) => void |
PondInfo
Ƭ PondInfo: Object
Information concerning the running Pond.
Type declaration
Name | Type |
---|---|
nodeId | NodeId |
PondOptions
Ƭ PondOptions: Object
Advanced configuration options for the Pond.
Type declaration
Name | Type | Description |
---|---|---|
fishErrorReporter? | FishErrorReporter | Callback that is invoked whenever Fish execution encounters an error. If none is supplied, errors will be logged to the console. |
PondState
Ƭ PondState: Object
What sort of activity is currently going on in the Pond?
Type declaration
Name | Type |
---|---|
commands | FishProcessInfo |
eventsFromOtherSources | FishProcessInfo |
hydration | FishProcessInfo |
Progress
Ƭ Progress: Object
Sync progress in terms of event numbers.
Type declaration
Name | Type |
---|---|
current | number |
max | number |
min | number |
RangeQuery
Ƭ RangeQuery: Object
Query for a fixed set of known events.
Type declaration
Name | Type | Description |
---|---|---|
horizon? | string | Earliest event ID to consider in the result |
lowerBound? | OffsetMap | Starting point (exclusive) for the query. Everything up-to-and-including lowerBound will be omitted from the result. Defaults empty record. Events from sources not included in the lowerBound will be delivered from start, IF they are included in upperBound . Events from sources missing from both lowerBound and upperBound will not be delivered at all. |
order? | EventsSortOrder | Desired order of delivery. Defaults to 'Asc' |
query? | Where <unknown > | Statement to select specific events. Defaults to allEvents . |
upperBound | OffsetMap | Ending point (inclusive) for the query. Everything covered by upperBound (inclusive) will be part of the result. If a source is not included in upperBound , its events will not be included in the result. |
Reduce
Ƭ Reduce<S
, E
>: (state
: S
, event
: E
, metadata
: Metadata
) => S
Type parameters
Name |
---|
S |
E |
Type declaration
▸ (state
, event
, metadata
): S
Combine the existing ("old") state and next event into a new state. The returned value may be something completely new, or a mutated version of the input state.
Parameters
Name | Type |
---|---|
state | S |
event | E |
metadata | Metadata |
Returns
S
RetrieveSnapshot
Ƭ RetrieveSnapshot: (semantics
: string
, name
: string
, version
: number
) => Promise
<LocalSnapshotFromIndex
| undefined
>
Type declaration
▸ (semantics
, name
, version
): Promise
<LocalSnapshotFromIndex
| undefined
>
The signature of the function to retrieve a snapshot.
beta
Parameters
Name | Type |
---|---|
semantics | string |
name | string |
version | number |
Returns
Promise
<LocalSnapshotFromIndex
| undefined
>
SerializedStateSnap
Ƭ SerializedStateSnap: LocalSnapshot
<string
>
A local snapshot where the state has already been serialised.
beta
SplashState
Ƭ SplashState: SplashStateDiscovery
| SplashStateSync
Current state of swarm synchronization procedure.
SplashStateDiscovery
Ƭ SplashStateDiscovery: Object
Discovering swarm state.
Type declaration
Name | Type |
---|---|
current | SwarmSummary |
mode | "discovery" |
skip? | () => void |
SplashStateSync
Ƭ SplashStateSync: Object
Synchronizing up to the discovered swarm state.
Type declaration
Name | Type |
---|---|
current | SwarmSummary |
mode | "sync" |
progress | SyncProgress |
reference | SwarmSummary |
skip? | () => void |
StateEffect
Ƭ StateEffect<S
, EWrite
>: (state
: S
, enqueue
: AddEmission
<EWrite
>, pond
: Pond
) => void
| Promise
<void
>
Type parameters
Name |
---|
S |
EWrite |
Type declaration
▸ (state
, enqueue
, pond
): void
| Promise
<void
>
Enqueue event emissions based on currently known local state.
Parameters
Name | Type |
---|---|
state | S |
enqueue | AddEmission <EWrite > |
pond | Pond |
Returns
void
| Promise
<void
>
StateMsg
Ƭ StateMsg: Object
Implies consumer should apply the given state.
alpha
Type declaration
Name | Type |
---|---|
snapshot | SerializedStateSnap |
type | state |
StateWithProvenance
Ƭ StateWithProvenance<S
>: Object
A state and its corresponding psn map.
beta
Type parameters
Name |
---|
S |
Type declaration
Name | Type | Description |
---|---|---|
offsets | OffsetMap | Minimum psn map that allow to reconstruct the state. Only contains sources that contain events matching the filter. |
state | S | - |
StoreSnapshot
Ƭ StoreSnapshot: (semantics
: string
, name
: string
, key
: EventKey
, offsets
: OffsetMap
, horizon
: EventKey
| undefined
, cycle
: number
, version
: number
, tag
: string
, serializedBlob
: string
) => Promise
<boolean
>
Type declaration
▸ (semantics
, name
, key
, offsets
, horizon
, cycle
, version
, tag
, serializedBlob
): Promise
<boolean
>
The signature of the function to store a snapshot.
beta
Parameters
Name | Type |
---|---|
semantics | string |
name | string |
key | EventKey |
offsets | OffsetMap |
horizon | EventKey | undefined |
cycle | number |
version | number |
tag | string |
serializedBlob | string |
Returns
Promise
<boolean
>
StreamId
Ƭ StreamId: string
An Actyx stream id.
SwarmInfo
Ƭ SwarmInfo: Object
All the info we got for our device in relation to the swarm
Type declaration
Name | Type |
---|---|
nodes | immutable.Map <string , NodeInfoEntry > |
SwarmSummary
Ƭ SwarmSummary: Object
Summary of swarm info
Type declaration
Name | Type |
---|---|
events | Counters |
info | SwarmInfo |
sources | Counters |
SyncProgress
Ƭ SyncProgress: Object
Sync progress per source, and overall.
Type declaration
Name | Type |
---|---|
events | Progress |
sources | Progress |
TaggedEvent
Ƭ TaggedEvent: Object
An event with tags attached.
Type declaration
Name | Type |
---|---|
event | unknown |
tags | string [] |
TestActyx
Ƭ TestActyx: TestEventFns
& { nodeId
: NodeId
; snapshotStore
: SnapshotStore
; dispose
: () => void
; waitForSync
: () => Promise
<void
> }
An instance of Actyx
that is not talking to any Actyx instance, but mocks all functionality within TypeScript.
Very useful for unit-testing.
TestEvent
Ƭ TestEvent: Object
A raw Actyx event to be emitted by the TestEventStore, as if it really arrived from the outside.
Type declaration
Name | Type |
---|---|
lamport | Lamport |
offset | number |
payload | unknown |
stream | string |
tags | string [] |
timestamp | Timestamp |
TestEventFns
Ƭ TestEventFns: EventFns
& { directlyPushEvents
: (events
: TestEvent
[]) => void
}
EventFns for unit-tests.
TestPond
Ƭ TestPond: Pond
& { directlyPushEvents
: (events
: TestEvent
[]) => void
}
A Pond with extensions for testing.
TestPondOptions
Ƭ TestPondOptions: PondOptions
& { timeInjector?
: TimeInjector
}
Extended options for TestPond.
TimeInjector
Ƭ TimeInjector: (tags
: string
[], events
: unknown
) => Timestamp
Type declaration
▸ (tags
, events
): Timestamp
Test tool.
beta
Parameters
Name | Type |
---|---|
tags | string [] |
events | unknown |
Returns
TimeTravelMsg
Ƭ TimeTravelMsg<E
>: Object
Implies consumer should re-subscribe starting from trigger
or earlier.
alpha
Type parameters
Name |
---|
E |
Type declaration
Name | Type |
---|---|
trigger | EventKey |
type | timetravel |
Timestamp
Ƭ Timestamp: number
Timestamp (UNIX epoch), MICROseconds resolution.
WaitForSwarmConfig
Ƭ WaitForSwarmConfig: Partial
<FullWaitForSwarmConfig
>
Partially configure waiting for the swarm.
WaitForSwarmSyncParams
Ƭ WaitForSwarmSyncParams: WaitForSwarmConfig
& { onProgress?
: (newState
: SplashState
) => void
; onSyncComplete
: () => void
}
Parameter object for the Pond.waitForSwarmSync
call.
Variables
Actyx
• Actyx: Object
Function for creating Actyx
instances.
Type declaration
Name | Type |
---|---|
of | (manifest : AppManifest , opts? : ActyxOpts ) => Promise <Actyx > |
test | (opts? : ActyxTestOpts ) => TestActyx |
ActyxEvent
• ActyxEvent: Object
Things related to ActyxEvent.
Type declaration
Name | Type |
---|---|
ord | Ord <ActyxEvent <unknown >> |
AppId
• AppId: Object
AppId
associated functions.
Type declaration
Name | Type |
---|---|
of | (text : string ) => string |
Caching
• Caching: Object
Caching related functions
beta
Type declaration
Name | Type |
---|---|
inProcess | (key : string ) => Caching |
isEnabled | (c : undefined | Caching ) => c is InProcessCaching |
none | Object |
none.type | "none" |
EventKey
• EventKey: Object
Functions related to EventKey.
Type declaration
Name | Type |
---|---|
ord | Ord <EventKey > |
zero | EventKey |
format | (key : EventKey ) => string |
Fish
• Fish: Object
Fish generic generator methods.
Type declaration
Name | Type |
---|---|
eventsAscending | <E>(where : Where <E >, capacity : number ) => Fish <E [], E > |
eventsDescending | <E>(where : Where <E >, capacity : number ) => Fish <E [], E > |
latestEvent | <E>(where : Where <E >) => Fish <undefined | E , E > |
FishId
• FishId: Object
FishId associated functions.
Type declaration
Name | Type |
---|---|
canonical | (v : FishId ) => string |
of | (entityType : string , name : string , version : number ) => { entityType : string ; name : string ; version : number } |
Lamport
• Lamport: Object
Type declaration
Name | Type |
---|---|
zero | number |
of | (value : number ) => number |
Milliseconds
• Milliseconds: Object
Helper functions for making sense of and converting Milliseconds.
Type declaration
Name | Type |
---|---|
zero | number |
fromAny | (value : number ) => number |
fromDate | (date : Date ) => number |
fromMinutes | (value : number ) => number |
fromSeconds | (value : number ) => number |
now | (now? : number ) => number |
of | (time : number ) => number |
toSeconds | (value : number ) => number |
toTimestamp | (value : number ) => number |
NodeId
• NodeId: Object
SourceId
associated functions.
Type declaration
Name | Type |
---|---|
of | (text : string ) => string |
random | (digits? : number ) => string |
streamNo | (nodeId : string , num : number ) => string |
Offset
• Offset: Object
Functions related to Offsets.
Type declaration
Name | Type | Description |
---|---|---|
max | number | A value that is above any valid Offset |
min | number | A value that is below any valid Offset |
zero | number | - |
of | (n : number ) => number | - |
OffsetMap
• OffsetMap: OffsetMapCompanion
OffsetMap companion functions.
Pond
• Pond: Object
Static methods for constructing Pond instances.
Type declaration
Name | Type |
---|---|
default | (manifest : AppManifest ) => Promise <Pond > |
from | (actyx : Actyx , opts : PondOptions ) => Pond |
of | (manifest : AppManifest , connectionOpts : ActyxOpts , opts : PondOptions ) => Promise <Pond > |
test | (opts? : TestPondOptions ) => TestPond |
PondState
• PondState: Object
PondState
associated functions.
Type declaration
Name | Type |
---|---|
isBusy | (state : PondState ) => boolean |
isHydrating | (state : PondState ) => boolean |
isProcessingCommands | (state : PondState ) => boolean |
isProcessingEventsFromOtherSources | (state : PondState ) => boolean |
SnapshotStore
• SnapshotStore: Object
Interface to the snapshot store.
beta
Type declaration
Name | Type |
---|---|
noop | SnapshotStore |
inMem | () => SnapshotStore |
StreamId
• StreamId: Object
SourceId
associated functions.
Type declaration
Name | Type |
---|---|
of | (text : string ) => string |
random | () => string |
SwarmSummary
• SwarmSummary: Object
SwarmSummary associated functions.
Type declaration
Name | Type |
---|---|
empty | SwarmSummary |
fromSwarmInfo | (info : SwarmInfo ) => SwarmSummary |
Timestamp
• Timestamp: Object
Helper functions for making sense of and converting Timestamps.
Type declaration
Name | Type |
---|---|
maxSafe | number |
zero | number |
format | (timestamp : number ) => string |
fromDate | (date : Date ) => number |
fromDays | (value : number ) => number |
fromMilliseconds | (value : number ) => number |
fromSeconds | (value : number ) => number |
max | (values : number []) => number |
min | (...values : number []) => number |
now | (now? : number ) => number |
of | (time : number ) => number |
toDate | (value : number ) => Date |
toMilliseconds | (value : number ) => number |
toSeconds | (value : number ) => number |
WaitForSwarmConfig
• WaitForSwarmConfig: Object
WaitForSwarmConfig
associated functions.
Type declaration
Name | Type |
---|---|
defaults | FullWaitForSwarmConfig |
allEvents
• allEvents: Tags
<unknown
>
A Where
expression that selects all events.
Functions
Tag
▸ Const
Tag<E
>(rawTagString
, extractId?
): Tag
<E
>
Create a new tag from the given string.
(Tag factory function. Call WITHOUT new, e.g. const myTag = Tag<MyType>('my-tag')
)
Type parameters
Name | Type |
---|---|
E | unknown |
Parameters
Name | Type | Description |
---|---|---|
rawTagString | string | The raw tag string |
extractId? | (e : E ) => string | If supplied, this function will be used to automatically call withId for events this tag is being attached to. The automatism is disabled if there is a manual withId call. |
Returns
Tag
<E
>
Tags
▸ Const
Tags<E
>(...requiredTags
): Tags
<E
>
Declare a set of tags.
This is a generator function to be called WITHOUT new, e.g. const required = Tags('a', 'b', 'c')
Type parameters
Name | Type |
---|---|
E | unknown |
Parameters
Name | Type |
---|---|
...requiredTags | string [] |
Returns
Tags
<E
>
isBoolean
▸ Const
isBoolean(x
): x is boolean
Refinement that checks whether typeof x === 'number'
Parameters
Name | Type |
---|---|
x | any |
Returns
x is boolean
isNumber
▸ Const
isNumber(x
): x is number
Refinement that checks whether typeof x === 'number'
Parameters
Name | Type |
---|---|
x | any |
Returns
x is number
isString
▸ Const
isString(x
): x is string
Refinement that checks whether typeof x === 'string'
Parameters
Name | Type |
---|---|
x | any |
Returns
x is string
toEventPredicate
▸ Const
toEventPredicate(where
): (event
: HasTags
) => boolean
Turn a Where
into a function that can decide whether a locally emitted event matches the clause.
We can ignore the 'local' flag since it will never exclude our local events, and this method is used solely to decide whether locally emitted events are relevant.
TODO: This will be removed once we support other means of 'I got events up to X' feedback
alpha
Parameters
Name | Type |
---|---|
where | Where <unknown > |
Returns
fn
▸ (event
): boolean
Parameters
Name | Type |
---|---|
event | HasTags |
Returns
boolean
unreachable
▸ Const
unreachable(x?
): never
Assert that from the type information, a piece of code can never be reached. If it’s still reached at runtime, this throws an Error.
Parameters
Name | Type |
---|---|
x? | undefined |
Returns
never
unreachableOrElse
▸ unreachableOrElse<T
>(_
, t
): T
Assert that from the type information, a certain statement can never be reached, while installing a default value to return in case the type information was wrong and the statement was in fact reached.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
_ | never |
t | T |
Returns
T