import { Subject, TeardownLogic } from 'rxjs'; import { Id } from '../shared'; import { DataValue, Mapping } from './types'; import { ResourceInstance, ResourceSpecials } from './resource'; import { ResourceValue } from './client'; import { LayerProfile, LayerToken } from './access'; import { BooleanFormatType, FieldType, FormatType, NumberFormatType, StringFormatType } from '../modeling'; export interface NameEvent { id: Id; old?: string; new?: string; } export interface DataEvent { id: Id; old?: T; new?: T; } export interface SpecialEvent { id: Id; added?: Id[]; removed?: Id[]; } export interface ValueEvent { id: Id; old?: T; new?: T; } export interface ResourceEvent { id: Id; type: 'update' | 'add' | 'remove'; removed?: ResourceValue; added?: ResourceValue; } export interface StreamOptions { payload?: boolean; instant?: boolean; specials?: boolean; interval?: number; } export declare class SystemSubject extends Subject { protected _subscriptionId?: Id; constructor(subscribe: (subscriber: Subject) => TeardownLogic, subscriptionId: Id); get subscriptionId(): Id | undefined; } export declare class SystemValueSubject extends SystemSubject { protected _value: U | undefined; constructor(subscribe: (subscriber: Subject) => TeardownLogic, subscriptionId: Id); get value(): U | undefined; } export declare class ResourceStreamInstance extends SystemSubject { protected _value: T | undefined; private readonly _resource; constructor(resource: ResourceInstance, subscribe: (subscriber: Subject) => TeardownLogic, subscriptionId: Id); get resource(): ResourceInstance; get value(): T | undefined; } export declare class ResourceStreamSpecials extends SystemSubject { private _values; private _valueIds; private _valueIndexes; private readonly _resource; constructor(resource: ResourceSpecials, subscribe: (subscriber: Subject) => TeardownLogic, subscriptionId: Id); get resource(): ResourceSpecials; reorder(): void; get values(): T[]; getIndex(id: Id): number; getValue(id: Id): T | undefined; } /** * The stream version of `SystemClient`. * * Differences include that this client maintains an active session with the Vyze System and stores its state at the * server side. * * This includes space tokens and the currently used space. * A new concept this client introduces are subscriptions: * Most methods provided by `SystemClient` have an observable version of it, allowing for reacting upon changes in the * Vyze System. * * When a method from this client is used and its `instant` flag is `true`, an instant update should be given whose * `new` value is identical with the current response of the analogous method in `SystemClient`. * * ``` * const name1 = await systemClient.getName('id...'); * const name2 = firstValueFrom(systemStreamClient.getName('id...')); * // name1 and name2.new should have the same value. * ``` */ export declare class SystemStreamClient { private url; private ws?; private subscriptions; constructor(url?: string); connect(): Promise; disconnect(): Promise; getInfo(): Promise; registerLayerToken(token: LayerToken): Promise; registerLayerProfile(profile: LayerProfile): Promise; getLayerTokens(): Promise; getName(objectId: Id, options?: StreamOptions): SystemValueSubject; getData(objectId: Id, formatType: StringFormatType, options?: StreamOptions): SystemValueSubject, string>; getData(objectId: Id, formatType: NumberFormatType, options?: StreamOptions): SystemValueSubject, number>; getData(objectId: Id, formatType: BooleanFormatType, options?: StreamOptions): SystemValueSubject, boolean>; getData(objectId: Id, formatType: 'raw', options?: StreamOptions): SystemValueSubject, ArrayBuffer>; getSpecials(objectId: Id, includeSelf?: boolean, includeDirect?: boolean, includeIndirect?: boolean, options?: StreamOptions): SystemValueSubject; getValue(originId: Id, relationId: Id, fieldType: FieldType, formatType: FormatType, mapping: Mapping, options?: StreamOptions): SystemValueSubject, T>; getResourceInstance(res: ResourceInstance, options?: StreamOptions): ResourceStreamInstance; getResourceSpecials(res: ResourceSpecials, options?: StreamOptions): ResourceStreamSpecials; unsubscribe(observable: SystemValueSubject): Promise; private subscribeMessage; private unsubscribeMessage; } export declare function newSystemStreamClient(url?: string): SystemStreamClient; //# sourceMappingURL=client-stream.d.ts.map