@actyx/sdk
Version:
Actyx SDK
163 lines (162 loc) • 5.32 kB
TypeScript
import { Ord } from 'fp-ts/lib/Ord';
import { Ordering } from 'fp-ts/lib/Ordering';
import * as t from 'io-ts';
export declare class EnumType<A> extends t.Type<A> {
readonly _tag: 'EnumType';
enumObject: object;
constructor(e: object, name?: string);
}
export declare const createEnumType: <T>(e: object, name?: string | undefined) => EnumType<T>;
/**
* Basically adds -infinity and +infinity to a PSN
*/
declare const PsnOrLimit: t.UnionC<[t.NumberC, t.LiteralC<"min">, t.LiteralC<"max">]>;
export declare type PsnOrLimit = t.TypeOf<typeof PsnOrLimit>;
/**
* A psn map with a default value, so it is a tabulated total function from source to PsnOrLimit
*/
export declare const OffsetMapWithDefault: t.ReadonlyC<t.TypeC<{
psns: t.ReadonlyC<t.RecordC<t.StringC, t.NumberC>>;
default: t.UnionC<[t.NumberC, t.LiteralC<"min">, t.LiteralC<"max">]>;
}>>;
export declare type OffsetMapWithDefault = t.TypeOf<typeof OffsetMapWithDefault>;
declare type Tags = string[];
declare type TagsOnWire = string[] | undefined;
declare const Tags: t.Type<Tags, TagsOnWire, unknown>;
export declare const EventIO: t.TypeC<{
psn: t.NumberC;
semantics: t.StringC;
sourceId: t.StringC;
name: t.StringC;
timestamp: t.NumberC;
lamport: t.NumberC;
tags: t.Type<Tags, TagsOnWire, unknown>;
payload: t.UnknownC;
}>;
/** A single Actyx Event */
export declare type Event = t.TypeOf<typeof EventIO>;
export declare const _compareEvents: (a: Event, b: Event) => Ordering;
/** Event-related constants */
export declare const Event: {
ord: Ord<{
psn: number;
semantics: string;
sourceId: string;
name: string;
timestamp: number;
lamport: number;
tags: Tags;
payload: unknown;
}>;
};
/**
* A number of events, not necessarily from the same source.
*/
export declare const Events: t.ArrayC<t.TypeC<{
psn: t.NumberC;
semantics: t.StringC;
sourceId: t.StringC;
name: t.StringC;
timestamp: t.NumberC;
lamport: t.NumberC;
tags: t.Type<Tags, TagsOnWire, unknown>;
payload: t.UnknownC;
}>>;
/**
* A number of events, not necessarily from the same source.
*/
export declare type Events = t.TypeOf<typeof Events>;
/**
* A number of generated events, that are going to be written to the store.
*/
export declare const UnstoredEvent: t.ReadonlyC<t.TypeC<{
/**
* the sequence nr of the first element in this chunk
*/
semantics: t.StringC;
name: t.StringC;
timestamp: t.NumberC;
tags: t.Type<Tags, TagsOnWire, unknown>;
payload: t.UnknownC;
}>>;
export declare type UnstoredEvent = t.TypeOf<typeof UnstoredEvent>;
export declare const UnstoredEvents: t.ReadonlyArrayC<t.ReadonlyC<t.TypeC<{
/**
* the sequence nr of the first element in this chunk
*/
semantics: t.StringC;
name: t.StringC;
timestamp: t.NumberC;
tags: t.Type<Tags, TagsOnWire, unknown>;
payload: t.UnknownC;
}>>>;
export declare type UnstoredEvents = t.TypeOf<typeof UnstoredEvents>;
/**
* Sort order for perstisted events
*/
export declare enum PersistedEventsSortOrders {
EventKey = "eventKey",
ReverseEventKey = "reverseEventKey",
Unsorted = "unsorted"
}
export declare const PersistedEventsSortOrder: EnumType<PersistedEventsSortOrders>;
export declare type PersistedEventsSortOrder = t.TypeOf<typeof PersistedEventsSortOrder>;
/**
* Sort order for events
*/
export declare enum AllEventsSortOrders {
EventKey = "eventKey",
Unsorted = "unsorted"
}
export declare const AllEventsSortOrder: EnumType<AllEventsSortOrders>;
export declare type AllEventsSortOrder = t.TypeOf<typeof AllEventsSortOrder>;
/**
* Connectivity status type.
* @public
*/
export declare enum ConnectivityStatusType {
FullyConnected = "FullyConnected",
PartiallyConnected = "PartiallyConnected",
NotConnected = "NotConnected"
}
/**
* The IO-TS type parser for ConnectivityStatus.
* @public
*/
export declare const ConnectivityStatus: t.UnionC<[t.ReadonlyC<t.TypeC<{
status: t.LiteralC<ConnectivityStatusType.FullyConnected>;
inCurrentStatusForMs: t.NumberC;
}>>, t.ReadonlyC<t.TypeC<{
status: t.LiteralC<ConnectivityStatusType.PartiallyConnected>;
inCurrentStatusForMs: t.NumberC;
specialsDisconnected: t.ReadonlyArrayC<t.StringC>;
swarmConnectivityLevel: t.NumberC;
eventsToRead: t.NumberC;
eventsToSend: t.NumberC;
}>>, t.ReadonlyC<t.TypeC<{
status: t.LiteralC<ConnectivityStatusType.NotConnected>;
inCurrentStatusForMs: t.NumberC;
eventsToRead: t.NumberC;
eventsToSend: t.NumberC;
}>>]>;
/**
* Current connectivity of the underlying ActyxOS node.
* @public
*/
export declare type ConnectivityStatus = t.TypeOf<typeof ConnectivityStatus>;
/** Hook to run on store connection being closed.
* @public */
export declare type StoreConnectionClosedHook = () => void;
/** Configuration for the WebSocket store connection.
* @public */
export declare type WsStoreConfig = {
/** url of the destination */
url: string;
/** protocol of the destination */
protocol?: string;
/** Hook, when the connection to the store is closed */
onStoreConnectionClosed?: StoreConnectionClosedHook;
/** retry interval to establish the connection */
reconnectTimeout?: number;
};
export {};