Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@dxfeed/dxlink-core

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxfeed/dxlink-core - npm Package Compare versions

Comparing version
0.6.1
to
0.7.0
+5
-0
build/client.d.ts
import type { DXLinkAuthState, DXLinkAuthStateChangeListener } from './auth';
import type { DXLinkChannel } from './channel';
import type { DXLinkErrorListener } from './error';
import type { DXLinkScheduler } from './scheduler';
/**

@@ -95,2 +96,6 @@ * Connection state that can be used to check if connection is established and ready to use.

/**
* Get scheduler used by the client and services.
*/
getScheduler(): DXLinkScheduler;
/**
* Add a listener for connection state changes.

@@ -97,0 +102,0 @@ */

+1
-1

@@ -1,2 +0,2 @@

var DXLinkAuthState,DXLinkConnectionState,DXLinkChannelState,DXLinkLogLevel;exports.DXLinkAuthState=void 0,(DXLinkAuthState=exports.DXLinkAuthState||(exports.DXLinkAuthState={})).UNAUTHORIZED="UNAUTHORIZED",DXLinkAuthState.AUTHORIZING="AUTHORIZING",DXLinkAuthState.AUTHORIZED="AUTHORIZED",exports.DXLinkConnectionState=void 0,(DXLinkConnectionState=exports.DXLinkConnectionState||(exports.DXLinkConnectionState={})).NOT_CONNECTED="NOT_CONNECTED",DXLinkConnectionState.CONNECTING="CONNECTING",DXLinkConnectionState.CONNECTED="CONNECTED",exports.DXLinkChannelState=void 0,(DXLinkChannelState=exports.DXLinkChannelState||(exports.DXLinkChannelState={})).REQUESTED="REQUESTED",DXLinkChannelState.OPENED="OPENED",DXLinkChannelState.CLOSED="CLOSED",exports.DXLinkLogLevel=void 0,(DXLinkLogLevel=exports.DXLinkLogLevel||(exports.DXLinkLogLevel={}))[DXLinkLogLevel.DEBUG=0]="DEBUG",DXLinkLogLevel[DXLinkLogLevel.INFO=1]="INFO",DXLinkLogLevel[DXLinkLogLevel.WARN=2]="WARN",DXLinkLogLevel[DXLinkLogLevel.ERROR=3]="ERROR",exports.Logger=class{constructor(prefix,level){this.prefix=void 0,this.level=void 0,this.prefix=prefix,this.level=level}debug(message){this.level<=exports.DXLinkLogLevel.DEBUG&&console.debug(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}info(message){this.level<=exports.DXLinkLogLevel.INFO&&console.info(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}warn(message){this.level<=exports.DXLinkLogLevel.WARN&&console.warn(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}error(message){this.level<=exports.DXLinkLogLevel.ERROR&&console.error(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}},exports.Scheduler=class{constructor(){this.timeoutIds={},this.schedule=(callback,timeout,key)=>(this.cancel(key),this.timeoutIds[key]=setTimeout(()=>{delete this.timeoutIds[key],callback()},timeout),key),this.cancel=key=>{void 0!==this.timeoutIds[key]&&(clearTimeout(this.timeoutIds[key]),delete this.timeoutIds[key])},this.clear=()=>{for(const key of Object.keys(this.timeoutIds))this.cancel(key)},this.has=key=>void 0!==this.timeoutIds[key]}};
var DXLinkAuthState,DXLinkConnectionState,DXLinkChannelState,DXLinkLogLevel;exports.DXLinkAuthState=void 0,(DXLinkAuthState=exports.DXLinkAuthState||(exports.DXLinkAuthState={})).UNAUTHORIZED="UNAUTHORIZED",DXLinkAuthState.AUTHORIZING="AUTHORIZING",DXLinkAuthState.AUTHORIZED="AUTHORIZED",exports.DXLinkConnectionState=void 0,(DXLinkConnectionState=exports.DXLinkConnectionState||(exports.DXLinkConnectionState={})).NOT_CONNECTED="NOT_CONNECTED",DXLinkConnectionState.CONNECTING="CONNECTING",DXLinkConnectionState.CONNECTED="CONNECTED",exports.DXLinkChannelState=void 0,(DXLinkChannelState=exports.DXLinkChannelState||(exports.DXLinkChannelState={})).REQUESTED="REQUESTED",DXLinkChannelState.OPENED="OPENED",DXLinkChannelState.CLOSED="CLOSED",exports.DXLinkLogLevel=void 0,(DXLinkLogLevel=exports.DXLinkLogLevel||(exports.DXLinkLogLevel={}))[DXLinkLogLevel.DEBUG=0]="DEBUG",DXLinkLogLevel[DXLinkLogLevel.INFO=1]="INFO",DXLinkLogLevel[DXLinkLogLevel.WARN=2]="WARN",DXLinkLogLevel[DXLinkLogLevel.ERROR=3]="ERROR";class DefaultDXLinkScheduler{constructor(){this.timeoutIds={},this.schedule=(callback,timeout,key)=>(this.cancel(key),this.timeoutIds[key]=setTimeout(()=>{delete this.timeoutIds[key],callback()},timeout),key),this.cancel=key=>{void 0!==this.timeoutIds[key]&&(clearTimeout(this.timeoutIds[key]),delete this.timeoutIds[key])},this.clear=()=>{for(const key of Object.keys(this.timeoutIds))this.cancel(key)},this.has=key=>void 0!==this.timeoutIds[key]}}exports.DefaultDXLinkScheduler=DefaultDXLinkScheduler,exports.Logger=class{constructor(prefix,level){this.prefix=void 0,this.level=void 0,this.prefix=prefix,this.level=level}debug(message){this.level<=exports.DXLinkLogLevel.DEBUG&&console.debug(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}info(message){this.level<=exports.DXLinkLogLevel.INFO&&console.info(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}warn(message){this.level<=exports.DXLinkLogLevel.WARN&&console.warn(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}error(message){this.level<=exports.DXLinkLogLevel.ERROR&&console.error(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}},exports.Scheduler=class extends DefaultDXLinkScheduler{};
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sources":["../src/auth.ts","../src/client.ts","../src/channel.ts","../src/logger.ts","../src/scheduler.ts"],"sourcesContent":["/**\n * Authentication state that can be used to check if user is authorized on the remote endpoint.\n */\nexport enum DXLinkAuthState {\n /**\n * User is unauthorized on the remote endpoint.\n */\n UNAUTHORIZED = 'UNAUTHORIZED',\n /**\n * User in the process of authorization, but not yet authorized.\n */\n AUTHORIZING = 'AUTHORIZING',\n /**\n * User is authorized on the remote endpoint and can use it.\n */\n AUTHORIZED = 'AUTHORIZED',\n}\n\n/**\n * Listener for authentication state changes.\n */\nexport type DXLinkAuthStateChangeListener = (state: DXLinkAuthState, prev: DXLinkAuthState) => void\n","import type { DXLinkAuthState, DXLinkAuthStateChangeListener } from './auth'\nimport type { DXLinkChannel } from './channel'\nimport type { DXLinkErrorListener } from './error'\n\n/**\n * Connection state that can be used to check if connection is established and ready to use.\n * @see {DXLinkClient.getConnectionState}\n */\nexport enum DXLinkConnectionState {\n /**\n * Client was created and not connected to remote endpoint.\n * @see {DXLinkClient.connect}\n */\n NOT_CONNECTED = 'NOT_CONNECTED',\n /**\n * The {@link DXLinkClient.connect} method was called to establish connection or {@link DXLinkClient.reconnect} is in progress.\n * The connection is not ready to use yet.\n */\n CONNECTING = 'CONNECTING',\n /**\n * The connection to remote endpoint is established.\n * The connection is ready to use.\n */\n CONNECTED = 'CONNECTED',\n}\n\n/**\n * Connection details that can be used for debugging or logging.\n */\nexport interface DXLinkConnectionDetails {\n /**\n * Protocol version used for connection to the remote endpoint.\n */\n readonly protocolVersion: string\n /**\n * Version of the client library.\n */\n readonly clientVersion: string\n /**\n * Version of the server which the client is connected to.\n */\n readonly serverVersion?: string\n /**\n * Timeout in seconds for server to detect that client is disconnected.\n * If no keepalive message received from client during this time, server will close connection.\n */\n readonly clientKeepaliveTimeout?: number\n /**\n * Timeout in seconds in for client to detect that server is disconnected.\n * If no keepalive message received from server during this time, client will close connection.\n */\n readonly serverKeepaliveTimeout?: number\n}\n\n/**\n * Listener for connection state changes.\n */\nexport type DXLinkConnectionStateChangeListener = (\n state: DXLinkConnectionState,\n prev: DXLinkConnectionState\n) => void\n\n/**\n * dxLink client that can be used to connect to the remote dxLink endpoint and open channels to services.\n */\nexport interface DXLinkClient {\n /**\n * Connect to the remote endpoint.\n * Connects to the specified remote address. Previously established connections are closed if the new address is different from the old one.\n * This method does nothing if address does not change.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n *\n * For connection with the authorization token, use {@link DXLinkClient.setAuthToken} before calling this method.\n * If the token is not set, the connection will be established without authorization.\n *\n * @param url WebSocket URL to connect to.\n */\n connect(url: string): void\n /**\n * Reconnect to the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n * @see {DXLinkClient.connect}\n */\n reconnect(): void\n /**\n * Disconnect from the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#NOT_CONNECTED NOT_CONNECTED}.\n * @see {DXLinkClient.connect}\n */\n disconnect(): void\n\n /**\n * Get connection details that can be used for debugging or logging.\n */\n getConnectionDetails(): DXLinkConnectionDetails\n\n /**\n * Get connection state that can be used to check if connection is established and ready to use.\n */\n getConnectionState(): DXLinkConnectionState\n /**\n * Add a listener for connection state changes.\n */\n addConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n /**\n * Remove a listener for connection state changes.\n */\n removeConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n\n /**\n * Set authorization token to be used for connection to the remote endpoint.\n * This method does nothing if the client is connected.\n * @param token Authorization token to be used for connection.\n */\n setAuthToken(token: string): void\n /**\n * Get authentication state that can be used to check if user is authorized on the remote endpoint.\n */\n getAuthState(): DXLinkAuthState\n /**\n * Add a listener for authentication state changes.\n * When auth state is {@link DXLinkAuthState.UNAUTHORIZED}, you can call {@link DXLinkClient.setAuthToken} to authorize the client.\n */\n addAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n /**\n * Remove a listener for authentication state changes.\n */\n removeAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n\n /**\n * Error listener that can be used to handle errors from the server.\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Open a isolated channel to service withing single {@link DXLinkClient} connection to remote endpoint.\n * @param service Name of the service to open channel to.\n * @param parameters Parameters of the service to open channel to.\n * @see {DXLinkChannel}\n */\n openChannel(service: string, parameters: Record<string, unknown>): DXLinkChannel\n\n /**\n * Close the client and free all resources.\n * This method works the same as {@link DXLinkClient.disconnect}.\n */\n close(): void\n}\n","import type { DXLinkErrorListener } from './error'\n\n/**\n * Message that can be sent to or received from the channel.\n * @see {DXLinkChannel.send} and {@link DXLinkChannel.addMessageListener}\n */\nexport interface DXLinkChannelMessage {\n /**\n * Type of the message.\n */\n readonly type: string\n /**\n * Payload of the message.\n */\n readonly [key: string]: any // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Listener for messages from the channel.\n * @see {DXLinkChannel.addMessageListener}\n */\nexport type DXLinkChannelMessageListener = (message: DXLinkChannelMessage) => void\n\n/**\n * Listener for channel state changes.\n * @see {DXLinkChannel.addStateChangeListener}\n */\nexport type DXLinkChannelStateChangeListener = (\n state: DXLinkChannelState,\n prev: DXLinkChannelState\n) => void\n\n/**\n * Channel state that can be used to check if channel is available for sending messages.\n * @see {DXLinkChannel.getState}\n */\nexport enum DXLinkChannelState {\n /**\n * Channel is requested and cannot be used to {@link DXLinkChannel.send} messages yet.\n */\n REQUESTED = 'REQUESTED',\n /**\n * Channel is opened and can be used to {@link DXLinkChannel.send} messages.\n */\n OPENED = 'OPENED',\n /**\n * Channel was closed by {@link DXLinkChannel.close} or by server.\n * Channel cannot be used anymore.\n */\n CLOSED = 'CLOSED',\n}\n\n/**\n * Isolated channel to service withing single {@link DXLinkWebSocketClient} connection to remote endpoint.\n * @see DXLinkWebSocketClient.openChannel\n */\nexport interface DXLinkChannel {\n /**\n * Unique identifier of the channel.\n */\n readonly id: number\n /**\n * Name of the service that channel is opened to.\n */\n readonly service: string\n /**\n * Parameters of the service that channel is opened to.\n */\n readonly parameters: Record<string, unknown>\n\n /**\n * Send a message to the channel.\n */\n send(message: DXLinkChannelMessage): void\n\n /**\n * Add a listener for messages from the channel.\n */\n addMessageListener(listener: DXLinkChannelMessageListener): void\n /**\n * Remove a listener for messages from the channel.\n */\n removeMessageListener(listener: DXLinkChannelMessageListener): void\n\n /**\n * Get channel state that can be used to check if channel is available for sending messages.\n */\n getState(): DXLinkChannelState\n /**\n * Add a listener for channel state changes.\n * If channel is ready to use, listener will be called immediately with {@link DXLinkChannelState.OPENED} state.\n * @see {DXLinkChannelState}\n * Note: when remote endpoint reconnects, channel will be reopened and listener will be called with {@link DXLinkChannelState.OPENED} state again.\n * @see {DXLinkWebSocketClient.getConnectionState}\n */\n addStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n /**\n * Remove a listener for channel state changes.\n */\n removeStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n\n /**\n * Add a listener for errors from the server.\n * @see {DXLinkError}\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n * @see {DXLinkError}\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Close the channel and free all resources.\n * This method does nothing if the channel is already closed.\n * The channel {@see DXLinkChannel.getStatus} immediately becomes {@link State#CLOSED CLOSED}.\n * @see {DXLinkChannelState}\n */\n close(): void\n}\n","/**\n * A logger interface that can be used to log messages.\n */\nexport interface DXLinkLogger {\n debug(message: string, ...args: unknown[]): void\n info(message: string, ...args: unknown[]): void\n warn(message: string, ...args: unknown[]): void\n error(message: string, ...args: unknown[]): void\n}\n\n/**\n * Level of logging that can be used to filter out messages.\n */\nexport enum DXLinkLogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n}\n\n/**\n * A logger that uses the console to log messages.\n */\nexport class Logger implements DXLinkLogger {\n constructor(\n private readonly prefix: string,\n private readonly level: DXLinkLogLevel\n ) {}\n\n debug(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.DEBUG) {\n console.debug(`[${this.prefix}] ${message}`, ...args)\n }\n }\n info(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.INFO) {\n console.info(`[${this.prefix}] ${message}`, ...args)\n }\n }\n warn(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.WARN) {\n console.warn(`[${this.prefix}] ${message}`, ...args)\n }\n }\n error(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.ERROR) {\n console.error(`[${this.prefix}] ${message}`, ...args)\n }\n }\n}\n","/**\n * Scheduler for scheduling callbacks.\n */\nexport class Scheduler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private timeoutIds: Record<string, any> = {}\n\n schedule = (callback: () => void, timeout: number, key: string) => {\n this.cancel(key)\n this.timeoutIds[key] = setTimeout(() => {\n delete this.timeoutIds[key]\n callback()\n }, timeout)\n\n return key\n }\n\n cancel = (key: string) => {\n if (this.timeoutIds[key] !== undefined) {\n clearTimeout(this.timeoutIds[key])\n delete this.timeoutIds[key]\n }\n }\n\n clear = () => {\n for (const key of Object.keys(this.timeoutIds)) {\n this.cancel(key)\n }\n }\n\n has = (key: string) => {\n return this.timeoutIds[key] !== undefined\n }\n}\n"],"names":["DXLinkAuthState","DXLinkConnectionState","DXLinkChannelState","DXLinkLogLevel","constructor","prefix","level","this","debug","message","DEBUG","console","slice","call","arguments","info","INFO","warn","WARN","error","ERROR","timeoutIds","schedule","callback","timeout","key","cancel","setTimeout","undefined","clearTimeout","clear","Object","keys","has"],"mappings":"AAGA,IAAYA,gBCKAC,sBC2BAC,mBCtBAC,eHVAH,QAAAA,qBAAAA,GAAAA,gBAAAA,0BAAAA,QAAAA,gBAaX,CAAA,IATC,aAAA,eAIAA,gBAAA,YAAA,cAIAA,gBAAA,WAAA,aCPUC,QAAAA,2BAAAA,GAAAA,sBAAAA,gCAAAA,QAAAA,sBAgBX,CAAA,IAXC,cAAA,gBAKAA,sBAAA,WAAA,aAKAA,sBAAA,UAAA,YCYUC,QAAAA,wBAAAA,GAAAA,mBAAAA,6BAAAA,QAAAA,mBAcX,CAAA,IAVC,UAAA,YAIAA,mBAAA,OAAA,SAKAA,mBAAA,OAAA,SCnCUC,QAAAA,oBAAAA,GAAAA,eAAAA,QAAAA,iBAAAA,QAAAA,eAKX,CAAA,IAJCA,eAAA,MAAA,GAAA,QACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,MAAA,GAAA,uBAMW,MACXC,WAAAA,CACmBC,OACAC,OADAD,KAAAA,YACAC,EAAAA,KAAAA,WADA,EAAAC,KAAMF,OAANA,OACAE,KAAKD,MAALA,KAChB,CAEHE,KAAAA,CAAMC,SACAF,KAAKD,OAASH,QAAcA,eAACO,OAC/BC,QAAQH,MAAM,IAAID,KAAKF,WAAWI,aAAWG,GAAAA,MAAAC,KAAAC,UAAO,GAExD,CACAC,IAAAA,CAAKN,SACCF,KAAKD,OAASH,uBAAea,MAC/BL,QAAQI,KAAK,IAAIR,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAG,IAAAA,CAAKR,SACCF,KAAKD,OAASH,QAAcA,eAACe,MAC/BP,QAAQM,KAAK,IAAIV,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAK,KAAAA,CAAMV,SACAF,KAAKD,OAASH,QAAAA,eAAeiB,OAC/BT,QAAQQ,MAAM,IAAIZ,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEjD,qBC7CW,MAASV,WAAAA,GAEZiB,KAAAA,WAAkC,CAAE,EAAAd,KAE5Ce,SAAW,CAACC,SAAsBC,QAAiBC,OACjDlB,KAAKmB,OAAOD,KACZlB,KAAKc,WAAWI,KAAOE,WAAW,iBACpBN,WAAWI,KACvBF,YACCC,SAEIC,KAGTC,KAAAA,OAAUD,WACqBG,IAAzBrB,KAAKc,WAAWI,OAClBI,aAAatB,KAAKc,WAAWI,aACtBlB,KAAKc,WAAWI,KACxB,EAGHK,KAAAA,MAAQ,KACN,IAAK,MAAML,OAAOM,OAAOC,KAAKzB,KAAKc,YACjCd,KAAKmB,OAAOD,IACb,EAGHQ,KAAAA,IAAOR,UAC2BG,IAArBrB,KAACc,WAAWI,IACxB"}
{"version":3,"file":"index.js","sources":["../src/auth.ts","../src/client.ts","../src/channel.ts","../src/logger.ts","../src/scheduler.ts"],"sourcesContent":["/**\n * Authentication state that can be used to check if user is authorized on the remote endpoint.\n */\nexport enum DXLinkAuthState {\n /**\n * User is unauthorized on the remote endpoint.\n */\n UNAUTHORIZED = 'UNAUTHORIZED',\n /**\n * User in the process of authorization, but not yet authorized.\n */\n AUTHORIZING = 'AUTHORIZING',\n /**\n * User is authorized on the remote endpoint and can use it.\n */\n AUTHORIZED = 'AUTHORIZED',\n}\n\n/**\n * Listener for authentication state changes.\n */\nexport type DXLinkAuthStateChangeListener = (state: DXLinkAuthState, prev: DXLinkAuthState) => void\n","import type { DXLinkAuthState, DXLinkAuthStateChangeListener } from './auth'\nimport type { DXLinkChannel } from './channel'\nimport type { DXLinkErrorListener } from './error'\nimport type { DXLinkScheduler } from './scheduler'\n\n/**\n * Connection state that can be used to check if connection is established and ready to use.\n * @see {DXLinkClient.getConnectionState}\n */\nexport enum DXLinkConnectionState {\n /**\n * Client was created and not connected to remote endpoint.\n * @see {DXLinkClient.connect}\n */\n NOT_CONNECTED = 'NOT_CONNECTED',\n /**\n * The {@link DXLinkClient.connect} method was called to establish connection or {@link DXLinkClient.reconnect} is in progress.\n * The connection is not ready to use yet.\n */\n CONNECTING = 'CONNECTING',\n /**\n * The connection to remote endpoint is established.\n * The connection is ready to use.\n */\n CONNECTED = 'CONNECTED',\n}\n\n/**\n * Connection details that can be used for debugging or logging.\n */\nexport interface DXLinkConnectionDetails {\n /**\n * Protocol version used for connection to the remote endpoint.\n */\n readonly protocolVersion: string\n /**\n * Version of the client library.\n */\n readonly clientVersion: string\n /**\n * Version of the server which the client is connected to.\n */\n readonly serverVersion?: string\n /**\n * Timeout in seconds for server to detect that client is disconnected.\n * If no keepalive message received from client during this time, server will close connection.\n */\n readonly clientKeepaliveTimeout?: number\n /**\n * Timeout in seconds in for client to detect that server is disconnected.\n * If no keepalive message received from server during this time, client will close connection.\n */\n readonly serverKeepaliveTimeout?: number\n}\n\n/**\n * Listener for connection state changes.\n */\nexport type DXLinkConnectionStateChangeListener = (\n state: DXLinkConnectionState,\n prev: DXLinkConnectionState\n) => void\n\n/**\n * dxLink client that can be used to connect to the remote dxLink endpoint and open channels to services.\n */\nexport interface DXLinkClient {\n /**\n * Connect to the remote endpoint.\n * Connects to the specified remote address. Previously established connections are closed if the new address is different from the old one.\n * This method does nothing if address does not change.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n *\n * For connection with the authorization token, use {@link DXLinkClient.setAuthToken} before calling this method.\n * If the token is not set, the connection will be established without authorization.\n *\n * @param url WebSocket URL to connect to.\n */\n connect(url: string): void\n /**\n * Reconnect to the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n * @see {DXLinkClient.connect}\n */\n reconnect(): void\n /**\n * Disconnect from the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#NOT_CONNECTED NOT_CONNECTED}.\n * @see {DXLinkClient.connect}\n */\n disconnect(): void\n\n /**\n * Get connection details that can be used for debugging or logging.\n */\n getConnectionDetails(): DXLinkConnectionDetails\n\n /**\n * Get connection state that can be used to check if connection is established and ready to use.\n */\n getConnectionState(): DXLinkConnectionState\n /**\n * Get scheduler used by the client and services.\n */\n getScheduler(): DXLinkScheduler\n /**\n * Add a listener for connection state changes.\n */\n addConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n /**\n * Remove a listener for connection state changes.\n */\n removeConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n\n /**\n * Set authorization token to be used for connection to the remote endpoint.\n * This method does nothing if the client is connected.\n * @param token Authorization token to be used for connection.\n */\n setAuthToken(token: string): void\n /**\n * Get authentication state that can be used to check if user is authorized on the remote endpoint.\n */\n getAuthState(): DXLinkAuthState\n /**\n * Add a listener for authentication state changes.\n * When auth state is {@link DXLinkAuthState.UNAUTHORIZED}, you can call {@link DXLinkClient.setAuthToken} to authorize the client.\n */\n addAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n /**\n * Remove a listener for authentication state changes.\n */\n removeAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n\n /**\n * Error listener that can be used to handle errors from the server.\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Open a isolated channel to service withing single {@link DXLinkClient} connection to remote endpoint.\n * @param service Name of the service to open channel to.\n * @param parameters Parameters of the service to open channel to.\n * @see {DXLinkChannel}\n */\n openChannel(service: string, parameters: Record<string, unknown>): DXLinkChannel\n\n /**\n * Close the client and free all resources.\n * This method works the same as {@link DXLinkClient.disconnect}.\n */\n close(): void\n}\n","import type { DXLinkErrorListener } from './error'\n\n/**\n * Message that can be sent to or received from the channel.\n * @see {DXLinkChannel.send} and {@link DXLinkChannel.addMessageListener}\n */\nexport interface DXLinkChannelMessage {\n /**\n * Type of the message.\n */\n readonly type: string\n /**\n * Payload of the message.\n */\n readonly [key: string]: any // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Listener for messages from the channel.\n * @see {DXLinkChannel.addMessageListener}\n */\nexport type DXLinkChannelMessageListener = (message: DXLinkChannelMessage) => void\n\n/**\n * Listener for channel state changes.\n * @see {DXLinkChannel.addStateChangeListener}\n */\nexport type DXLinkChannelStateChangeListener = (\n state: DXLinkChannelState,\n prev: DXLinkChannelState\n) => void\n\n/**\n * Channel state that can be used to check if channel is available for sending messages.\n * @see {DXLinkChannel.getState}\n */\nexport enum DXLinkChannelState {\n /**\n * Channel is requested and cannot be used to {@link DXLinkChannel.send} messages yet.\n */\n REQUESTED = 'REQUESTED',\n /**\n * Channel is opened and can be used to {@link DXLinkChannel.send} messages.\n */\n OPENED = 'OPENED',\n /**\n * Channel was closed by {@link DXLinkChannel.close} or by server.\n * Channel cannot be used anymore.\n */\n CLOSED = 'CLOSED',\n}\n\n/**\n * Isolated channel to service withing single {@link DXLinkWebSocketClient} connection to remote endpoint.\n * @see DXLinkWebSocketClient.openChannel\n */\nexport interface DXLinkChannel {\n /**\n * Unique identifier of the channel.\n */\n readonly id: number\n /**\n * Name of the service that channel is opened to.\n */\n readonly service: string\n /**\n * Parameters of the service that channel is opened to.\n */\n readonly parameters: Record<string, unknown>\n\n /**\n * Send a message to the channel.\n */\n send(message: DXLinkChannelMessage): void\n\n /**\n * Add a listener for messages from the channel.\n */\n addMessageListener(listener: DXLinkChannelMessageListener): void\n /**\n * Remove a listener for messages from the channel.\n */\n removeMessageListener(listener: DXLinkChannelMessageListener): void\n\n /**\n * Get channel state that can be used to check if channel is available for sending messages.\n */\n getState(): DXLinkChannelState\n /**\n * Add a listener for channel state changes.\n * If channel is ready to use, listener will be called immediately with {@link DXLinkChannelState.OPENED} state.\n * @see {DXLinkChannelState}\n * Note: when remote endpoint reconnects, channel will be reopened and listener will be called with {@link DXLinkChannelState.OPENED} state again.\n * @see {DXLinkWebSocketClient.getConnectionState}\n */\n addStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n /**\n * Remove a listener for channel state changes.\n */\n removeStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n\n /**\n * Add a listener for errors from the server.\n * @see {DXLinkError}\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n * @see {DXLinkError}\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Close the channel and free all resources.\n * This method does nothing if the channel is already closed.\n * The channel {@see DXLinkChannel.getStatus} immediately becomes {@link State#CLOSED CLOSED}.\n * @see {DXLinkChannelState}\n */\n close(): void\n}\n","/**\n * A logger interface that can be used to log messages.\n */\nexport interface DXLinkLogger {\n debug(message: string, ...args: unknown[]): void\n info(message: string, ...args: unknown[]): void\n warn(message: string, ...args: unknown[]): void\n error(message: string, ...args: unknown[]): void\n}\n\n/**\n * Level of logging that can be used to filter out messages.\n */\nexport enum DXLinkLogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n}\n\n/**\n * A logger that uses the console to log messages.\n */\nexport class Logger implements DXLinkLogger {\n constructor(\n private readonly prefix: string,\n private readonly level: DXLinkLogLevel\n ) {}\n\n debug(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.DEBUG) {\n console.debug(`[${this.prefix}] ${message}`, ...args)\n }\n }\n info(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.INFO) {\n console.info(`[${this.prefix}] ${message}`, ...args)\n }\n }\n warn(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.WARN) {\n console.warn(`[${this.prefix}] ${message}`, ...args)\n }\n }\n error(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.ERROR) {\n console.error(`[${this.prefix}] ${message}`, ...args)\n }\n }\n}\n","/**\n * Scheduler for scheduling callbacks.\n */\nexport interface DXLinkScheduler {\n schedule(callback: () => void, timeout: number, key: string): string\n cancel(key: string): void\n clear(): void\n has(key: string): boolean\n}\n\n/**\n * Default scheduler implementation based on browser timers.\n */\nexport class DefaultDXLinkScheduler implements DXLinkScheduler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private timeoutIds: Record<string, any> = {}\n\n schedule = (callback: () => void, timeout: number, key: string): string => {\n this.cancel(key)\n this.timeoutIds[key] = setTimeout(() => {\n delete this.timeoutIds[key]\n callback()\n }, timeout)\n\n return key\n }\n\n cancel = (key: string) => {\n if (this.timeoutIds[key] !== undefined) {\n clearTimeout(this.timeoutIds[key])\n delete this.timeoutIds[key]\n }\n }\n\n clear = () => {\n for (const key of Object.keys(this.timeoutIds)) {\n this.cancel(key)\n }\n }\n\n has = (key: string) => {\n return this.timeoutIds[key] !== undefined\n }\n}\n\n/**\n * @deprecated Use {@link DefaultDXLinkScheduler} instead.\n */\nexport class Scheduler extends DefaultDXLinkScheduler {}\n"],"names":["DXLinkAuthState","DXLinkConnectionState","DXLinkChannelState","DXLinkLogLevel","DefaultDXLinkScheduler","constructor","timeoutIds","schedule","callback","timeout","key","this","cancel","setTimeout","undefined","clearTimeout","clear","Object","keys","has","prefix","level","debug","message","DEBUG","console","slice","call","arguments","info","INFO","warn","WARN","error","ERROR"],"mappings":"AAGA,IAAYA,gBCMAC,sBC0BAC,mBCtBAC,eHVAH,QAAAA,qBAAAA,GAAAA,gBAAAA,0BAAAA,QAAAA,gBAaX,CAAA,IATC,aAAA,eAIAA,gBAAA,YAAA,cAIAA,gBAAA,WAAA,aCNUC,QAAAA,2BAAAA,GAAAA,sBAAAA,gCAAAA,QAAAA,sBAgBX,CAAA,IAXC,cAAA,gBAKAA,sBAAA,WAAA,aAKAA,sBAAA,UAAA,YCWUC,QAAAA,wBAAAA,GAAAA,mBAAAA,6BAAAA,QAAAA,mBAcX,CAAA,IAVC,UAAA,YAIAA,mBAAA,OAAA,SAKAA,mBAAA,OAAA,SCnCUC,QAAAA,oBAAAA,GAAAA,eAAAA,QAAAA,iBAAAA,QAAAA,eAKX,CAAA,IAJCA,eAAA,MAAA,GAAA,QACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,MAAA,GAAA,QCJW,MAAAC,uBAAsBC,WAAAA,GAEzBC,KAAAA,WAAkC,GAE1CC,KAAAA,SAAW,CAACC,SAAsBC,QAAiBC,OACjDC,KAAKC,OAAOF,KACZC,KAAKL,WAAWI,KAAOG,WAAW,YACrBF,KAACL,WAAWI,KACvBF,UACF,EAAGC,SAEIC,KAGTE,KAAAA,OAAUF,WACqBI,IAAzBH,KAAKL,WAAWI,OAClBK,aAAaJ,KAAKL,WAAWI,aACtBC,KAAKL,WAAWI,KACxB,EAGHM,KAAAA,MAAQ,KACN,IAAK,MAAMN,OAAOO,OAAOC,KAAKP,KAAKL,YACjCK,KAAKC,OAAOF,IACb,EAGHS,KAAAA,IAAOT,UAC2BI,IAArBH,KAACL,WAAWI,IACxB,uEDnBU,MACXL,WAAAA,CACmBe,OACAC,OADAD,KAAAA,YACAC,EAAAA,KAAAA,WADA,EAAAV,KAAMS,OAANA,OACAT,KAAKU,MAALA,KAChB,CAEHC,KAAAA,CAAMC,SACAZ,KAAKU,OAASlB,QAAcA,eAACqB,OAC/BC,QAAQH,MAAM,IAAIX,KAAKS,WAAWG,aAAWG,GAAAA,MAAAC,KAAAC,UAAO,GAExD,CACAC,IAAAA,CAAKN,SACCZ,KAAKU,OAASlB,uBAAe2B,MAC/BL,QAAQI,KAAK,IAAIlB,KAAKS,WAAWG,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAG,IAAAA,CAAKR,SACCZ,KAAKU,OAASlB,QAAcA,eAAC6B,MAC/BP,QAAQM,KAAK,IAAIpB,KAAKS,WAAWG,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAK,KAAAA,CAAMV,SACAZ,KAAKU,OAASlB,QAAAA,eAAe+B,OAC/BT,QAAQQ,MAAM,IAAItB,KAAKS,WAAWG,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEjD,qBCAW,cAAkBxB"}

@@ -1,2 +0,2 @@

var DXLinkAuthState,DXLinkConnectionState,DXLinkChannelState,DXLinkLogLevel;!function(DXLinkAuthState){DXLinkAuthState.UNAUTHORIZED="UNAUTHORIZED",DXLinkAuthState.AUTHORIZING="AUTHORIZING",DXLinkAuthState.AUTHORIZED="AUTHORIZED"}(DXLinkAuthState||(DXLinkAuthState={})),function(DXLinkConnectionState){DXLinkConnectionState.NOT_CONNECTED="NOT_CONNECTED",DXLinkConnectionState.CONNECTING="CONNECTING",DXLinkConnectionState.CONNECTED="CONNECTED"}(DXLinkConnectionState||(DXLinkConnectionState={})),function(DXLinkChannelState){DXLinkChannelState.REQUESTED="REQUESTED",DXLinkChannelState.OPENED="OPENED",DXLinkChannelState.CLOSED="CLOSED"}(DXLinkChannelState||(DXLinkChannelState={})),function(DXLinkLogLevel){DXLinkLogLevel[DXLinkLogLevel.DEBUG=0]="DEBUG",DXLinkLogLevel[DXLinkLogLevel.INFO=1]="INFO",DXLinkLogLevel[DXLinkLogLevel.WARN=2]="WARN",DXLinkLogLevel[DXLinkLogLevel.ERROR=3]="ERROR"}(DXLinkLogLevel||(DXLinkLogLevel={}));class Logger{constructor(prefix,level){this.prefix=void 0,this.level=void 0,this.prefix=prefix,this.level=level}debug(message){this.level<=DXLinkLogLevel.DEBUG&&console.debug(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}info(message){this.level<=DXLinkLogLevel.INFO&&console.info(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}warn(message){this.level<=DXLinkLogLevel.WARN&&console.warn(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}error(message){this.level<=DXLinkLogLevel.ERROR&&console.error(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}}class Scheduler{constructor(){this.timeoutIds={},this.schedule=(callback,timeout,key)=>(this.cancel(key),this.timeoutIds[key]=setTimeout(()=>{delete this.timeoutIds[key],callback()},timeout),key),this.cancel=key=>{void 0!==this.timeoutIds[key]&&(clearTimeout(this.timeoutIds[key]),delete this.timeoutIds[key])},this.clear=()=>{for(const key of Object.keys(this.timeoutIds))this.cancel(key)},this.has=key=>void 0!==this.timeoutIds[key]}}export{DXLinkAuthState,DXLinkChannelState,DXLinkConnectionState,DXLinkLogLevel,Logger,Scheduler};
var DXLinkAuthState,DXLinkConnectionState,DXLinkChannelState,DXLinkLogLevel;!function(DXLinkAuthState){DXLinkAuthState.UNAUTHORIZED="UNAUTHORIZED",DXLinkAuthState.AUTHORIZING="AUTHORIZING",DXLinkAuthState.AUTHORIZED="AUTHORIZED"}(DXLinkAuthState||(DXLinkAuthState={})),function(DXLinkConnectionState){DXLinkConnectionState.NOT_CONNECTED="NOT_CONNECTED",DXLinkConnectionState.CONNECTING="CONNECTING",DXLinkConnectionState.CONNECTED="CONNECTED"}(DXLinkConnectionState||(DXLinkConnectionState={})),function(DXLinkChannelState){DXLinkChannelState.REQUESTED="REQUESTED",DXLinkChannelState.OPENED="OPENED",DXLinkChannelState.CLOSED="CLOSED"}(DXLinkChannelState||(DXLinkChannelState={})),function(DXLinkLogLevel){DXLinkLogLevel[DXLinkLogLevel.DEBUG=0]="DEBUG",DXLinkLogLevel[DXLinkLogLevel.INFO=1]="INFO",DXLinkLogLevel[DXLinkLogLevel.WARN=2]="WARN",DXLinkLogLevel[DXLinkLogLevel.ERROR=3]="ERROR"}(DXLinkLogLevel||(DXLinkLogLevel={}));class Logger{constructor(prefix,level){this.prefix=void 0,this.level=void 0,this.prefix=prefix,this.level=level}debug(message){this.level<=DXLinkLogLevel.DEBUG&&console.debug(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}info(message){this.level<=DXLinkLogLevel.INFO&&console.info(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}warn(message){this.level<=DXLinkLogLevel.WARN&&console.warn(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}error(message){this.level<=DXLinkLogLevel.ERROR&&console.error(`[${this.prefix}] ${message}`,...[].slice.call(arguments,1))}}class DefaultDXLinkScheduler{constructor(){this.timeoutIds={},this.schedule=(callback,timeout,key)=>(this.cancel(key),this.timeoutIds[key]=setTimeout(()=>{delete this.timeoutIds[key],callback()},timeout),key),this.cancel=key=>{void 0!==this.timeoutIds[key]&&(clearTimeout(this.timeoutIds[key]),delete this.timeoutIds[key])},this.clear=()=>{for(const key of Object.keys(this.timeoutIds))this.cancel(key)},this.has=key=>void 0!==this.timeoutIds[key]}}class Scheduler extends DefaultDXLinkScheduler{}export{DXLinkAuthState,DXLinkChannelState,DXLinkConnectionState,DXLinkLogLevel,DefaultDXLinkScheduler,Logger,Scheduler};
//# sourceMappingURL=index.module.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.module.js","sources":["../src/auth.ts","../src/client.ts","../src/channel.ts","../src/logger.ts","../src/scheduler.ts"],"sourcesContent":["/**\n * Authentication state that can be used to check if user is authorized on the remote endpoint.\n */\nexport enum DXLinkAuthState {\n /**\n * User is unauthorized on the remote endpoint.\n */\n UNAUTHORIZED = 'UNAUTHORIZED',\n /**\n * User in the process of authorization, but not yet authorized.\n */\n AUTHORIZING = 'AUTHORIZING',\n /**\n * User is authorized on the remote endpoint and can use it.\n */\n AUTHORIZED = 'AUTHORIZED',\n}\n\n/**\n * Listener for authentication state changes.\n */\nexport type DXLinkAuthStateChangeListener = (state: DXLinkAuthState, prev: DXLinkAuthState) => void\n","import type { DXLinkAuthState, DXLinkAuthStateChangeListener } from './auth'\nimport type { DXLinkChannel } from './channel'\nimport type { DXLinkErrorListener } from './error'\n\n/**\n * Connection state that can be used to check if connection is established and ready to use.\n * @see {DXLinkClient.getConnectionState}\n */\nexport enum DXLinkConnectionState {\n /**\n * Client was created and not connected to remote endpoint.\n * @see {DXLinkClient.connect}\n */\n NOT_CONNECTED = 'NOT_CONNECTED',\n /**\n * The {@link DXLinkClient.connect} method was called to establish connection or {@link DXLinkClient.reconnect} is in progress.\n * The connection is not ready to use yet.\n */\n CONNECTING = 'CONNECTING',\n /**\n * The connection to remote endpoint is established.\n * The connection is ready to use.\n */\n CONNECTED = 'CONNECTED',\n}\n\n/**\n * Connection details that can be used for debugging or logging.\n */\nexport interface DXLinkConnectionDetails {\n /**\n * Protocol version used for connection to the remote endpoint.\n */\n readonly protocolVersion: string\n /**\n * Version of the client library.\n */\n readonly clientVersion: string\n /**\n * Version of the server which the client is connected to.\n */\n readonly serverVersion?: string\n /**\n * Timeout in seconds for server to detect that client is disconnected.\n * If no keepalive message received from client during this time, server will close connection.\n */\n readonly clientKeepaliveTimeout?: number\n /**\n * Timeout in seconds in for client to detect that server is disconnected.\n * If no keepalive message received from server during this time, client will close connection.\n */\n readonly serverKeepaliveTimeout?: number\n}\n\n/**\n * Listener for connection state changes.\n */\nexport type DXLinkConnectionStateChangeListener = (\n state: DXLinkConnectionState,\n prev: DXLinkConnectionState\n) => void\n\n/**\n * dxLink client that can be used to connect to the remote dxLink endpoint and open channels to services.\n */\nexport interface DXLinkClient {\n /**\n * Connect to the remote endpoint.\n * Connects to the specified remote address. Previously established connections are closed if the new address is different from the old one.\n * This method does nothing if address does not change.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n *\n * For connection with the authorization token, use {@link DXLinkClient.setAuthToken} before calling this method.\n * If the token is not set, the connection will be established without authorization.\n *\n * @param url WebSocket URL to connect to.\n */\n connect(url: string): void\n /**\n * Reconnect to the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n * @see {DXLinkClient.connect}\n */\n reconnect(): void\n /**\n * Disconnect from the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#NOT_CONNECTED NOT_CONNECTED}.\n * @see {DXLinkClient.connect}\n */\n disconnect(): void\n\n /**\n * Get connection details that can be used for debugging or logging.\n */\n getConnectionDetails(): DXLinkConnectionDetails\n\n /**\n * Get connection state that can be used to check if connection is established and ready to use.\n */\n getConnectionState(): DXLinkConnectionState\n /**\n * Add a listener for connection state changes.\n */\n addConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n /**\n * Remove a listener for connection state changes.\n */\n removeConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n\n /**\n * Set authorization token to be used for connection to the remote endpoint.\n * This method does nothing if the client is connected.\n * @param token Authorization token to be used for connection.\n */\n setAuthToken(token: string): void\n /**\n * Get authentication state that can be used to check if user is authorized on the remote endpoint.\n */\n getAuthState(): DXLinkAuthState\n /**\n * Add a listener for authentication state changes.\n * When auth state is {@link DXLinkAuthState.UNAUTHORIZED}, you can call {@link DXLinkClient.setAuthToken} to authorize the client.\n */\n addAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n /**\n * Remove a listener for authentication state changes.\n */\n removeAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n\n /**\n * Error listener that can be used to handle errors from the server.\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Open a isolated channel to service withing single {@link DXLinkClient} connection to remote endpoint.\n * @param service Name of the service to open channel to.\n * @param parameters Parameters of the service to open channel to.\n * @see {DXLinkChannel}\n */\n openChannel(service: string, parameters: Record<string, unknown>): DXLinkChannel\n\n /**\n * Close the client and free all resources.\n * This method works the same as {@link DXLinkClient.disconnect}.\n */\n close(): void\n}\n","import type { DXLinkErrorListener } from './error'\n\n/**\n * Message that can be sent to or received from the channel.\n * @see {DXLinkChannel.send} and {@link DXLinkChannel.addMessageListener}\n */\nexport interface DXLinkChannelMessage {\n /**\n * Type of the message.\n */\n readonly type: string\n /**\n * Payload of the message.\n */\n readonly [key: string]: any // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Listener for messages from the channel.\n * @see {DXLinkChannel.addMessageListener}\n */\nexport type DXLinkChannelMessageListener = (message: DXLinkChannelMessage) => void\n\n/**\n * Listener for channel state changes.\n * @see {DXLinkChannel.addStateChangeListener}\n */\nexport type DXLinkChannelStateChangeListener = (\n state: DXLinkChannelState,\n prev: DXLinkChannelState\n) => void\n\n/**\n * Channel state that can be used to check if channel is available for sending messages.\n * @see {DXLinkChannel.getState}\n */\nexport enum DXLinkChannelState {\n /**\n * Channel is requested and cannot be used to {@link DXLinkChannel.send} messages yet.\n */\n REQUESTED = 'REQUESTED',\n /**\n * Channel is opened and can be used to {@link DXLinkChannel.send} messages.\n */\n OPENED = 'OPENED',\n /**\n * Channel was closed by {@link DXLinkChannel.close} or by server.\n * Channel cannot be used anymore.\n */\n CLOSED = 'CLOSED',\n}\n\n/**\n * Isolated channel to service withing single {@link DXLinkWebSocketClient} connection to remote endpoint.\n * @see DXLinkWebSocketClient.openChannel\n */\nexport interface DXLinkChannel {\n /**\n * Unique identifier of the channel.\n */\n readonly id: number\n /**\n * Name of the service that channel is opened to.\n */\n readonly service: string\n /**\n * Parameters of the service that channel is opened to.\n */\n readonly parameters: Record<string, unknown>\n\n /**\n * Send a message to the channel.\n */\n send(message: DXLinkChannelMessage): void\n\n /**\n * Add a listener for messages from the channel.\n */\n addMessageListener(listener: DXLinkChannelMessageListener): void\n /**\n * Remove a listener for messages from the channel.\n */\n removeMessageListener(listener: DXLinkChannelMessageListener): void\n\n /**\n * Get channel state that can be used to check if channel is available for sending messages.\n */\n getState(): DXLinkChannelState\n /**\n * Add a listener for channel state changes.\n * If channel is ready to use, listener will be called immediately with {@link DXLinkChannelState.OPENED} state.\n * @see {DXLinkChannelState}\n * Note: when remote endpoint reconnects, channel will be reopened and listener will be called with {@link DXLinkChannelState.OPENED} state again.\n * @see {DXLinkWebSocketClient.getConnectionState}\n */\n addStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n /**\n * Remove a listener for channel state changes.\n */\n removeStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n\n /**\n * Add a listener for errors from the server.\n * @see {DXLinkError}\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n * @see {DXLinkError}\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Close the channel and free all resources.\n * This method does nothing if the channel is already closed.\n * The channel {@see DXLinkChannel.getStatus} immediately becomes {@link State#CLOSED CLOSED}.\n * @see {DXLinkChannelState}\n */\n close(): void\n}\n","/**\n * A logger interface that can be used to log messages.\n */\nexport interface DXLinkLogger {\n debug(message: string, ...args: unknown[]): void\n info(message: string, ...args: unknown[]): void\n warn(message: string, ...args: unknown[]): void\n error(message: string, ...args: unknown[]): void\n}\n\n/**\n * Level of logging that can be used to filter out messages.\n */\nexport enum DXLinkLogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n}\n\n/**\n * A logger that uses the console to log messages.\n */\nexport class Logger implements DXLinkLogger {\n constructor(\n private readonly prefix: string,\n private readonly level: DXLinkLogLevel\n ) {}\n\n debug(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.DEBUG) {\n console.debug(`[${this.prefix}] ${message}`, ...args)\n }\n }\n info(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.INFO) {\n console.info(`[${this.prefix}] ${message}`, ...args)\n }\n }\n warn(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.WARN) {\n console.warn(`[${this.prefix}] ${message}`, ...args)\n }\n }\n error(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.ERROR) {\n console.error(`[${this.prefix}] ${message}`, ...args)\n }\n }\n}\n","/**\n * Scheduler for scheduling callbacks.\n */\nexport class Scheduler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private timeoutIds: Record<string, any> = {}\n\n schedule = (callback: () => void, timeout: number, key: string) => {\n this.cancel(key)\n this.timeoutIds[key] = setTimeout(() => {\n delete this.timeoutIds[key]\n callback()\n }, timeout)\n\n return key\n }\n\n cancel = (key: string) => {\n if (this.timeoutIds[key] !== undefined) {\n clearTimeout(this.timeoutIds[key])\n delete this.timeoutIds[key]\n }\n }\n\n clear = () => {\n for (const key of Object.keys(this.timeoutIds)) {\n this.cancel(key)\n }\n }\n\n has = (key: string) => {\n return this.timeoutIds[key] !== undefined\n }\n}\n"],"names":["DXLinkAuthState","DXLinkConnectionState","DXLinkChannelState","DXLinkLogLevel","Logger","constructor","prefix","level","this","debug","message","DEBUG","console","slice","call","arguments","info","INFO","warn","WARN","error","ERROR","Scheduler","timeoutIds","schedule","callback","timeout","key","cancel","setTimeout","undefined","clearTimeout","clear","Object","keys","has"],"mappings":"AAGY,IAAAA,gBCKAC,sBC2BAC,mBCtBAC,gBHVZ,SAAYH,iBAIVA,gBAAA,aAAA,eAIAA,gBAAA,YAAA,cAIAA,gBAAA,WAAA,YACD,CAbD,CAAYA,kBAAAA,gBAaX,CAAA,ICRD,SAAYC,uBAKVA,sBAAA,cAAA,gBAKAA,sBAAA,WAAA,aAKAA,sBAAA,UAAA,WACD,CAhBD,CAAYA,wBAAAA,sBAgBX,CAAA,ICWD,SAAYC,oBAIVA,mBAAA,UAAA,YAIAA,mBAAA,OAAA,SAKAA,mBAAA,OAAA,QACD,CAdD,CAAYA,qBAAAA,mBAcX,CAAA,ICpCD,SAAYC,gBACVA,eAAAA,eAAA,MAAA,GAAA,QACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,MAAA,GAAA,OACD,CALD,CAAYA,iBAAAA,eAKX,CAAA,IAKY,MAAAC,OACXC,WAAAA,CACmBC,OACAC,OADAD,KAAAA,YACAC,EAAAA,KAAAA,WADA,EAAAC,KAAMF,OAANA,OACAE,KAAKD,MAALA,KAChB,CAEHE,KAAAA,CAAMC,SACAF,KAAKD,OAASJ,eAAeQ,OAC/BC,QAAQH,MAAM,IAAID,KAAKF,WAAWI,aAAWG,GAAAA,MAAAC,KAAAC,UAAO,GAExD,CACAC,IAAAA,CAAKN,SACCF,KAAKD,OAASJ,eAAec,MAC/BL,QAAQI,KAAK,IAAIR,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAG,IAAAA,CAAKR,SACCF,KAAKD,OAASJ,eAAegB,MAC/BP,QAAQM,KAAK,IAAIV,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAK,KAAAA,CAAMV,SACAF,KAAKD,OAASJ,eAAekB,OAC/BT,QAAQQ,MAAM,IAAIZ,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEjD,EC7CW,MAAAO,UAASjB,WAAAA,GAEZkB,KAAAA,WAAkC,CAAE,EAAAf,KAE5CgB,SAAW,CAACC,SAAsBC,QAAiBC,OACjDnB,KAAKoB,OAAOD,KACZnB,KAAKe,WAAWI,KAAOE,WAAW,iBACpBN,WAAWI,KACvBF,YACCC,SAEIC,KAGTC,KAAAA,OAAUD,WACqBG,IAAzBtB,KAAKe,WAAWI,OAClBI,aAAavB,KAAKe,WAAWI,aACtBnB,KAAKe,WAAWI,KACxB,EAGHK,KAAAA,MAAQ,KACN,IAAK,MAAML,OAAOM,OAAOC,KAAK1B,KAAKe,YACjCf,KAAKoB,OAAOD,IACb,EAGHQ,KAAAA,IAAOR,UAC2BG,IAArBtB,KAACe,WAAWI,IACxB"}
{"version":3,"file":"index.module.js","sources":["../src/auth.ts","../src/client.ts","../src/channel.ts","../src/logger.ts","../src/scheduler.ts"],"sourcesContent":["/**\n * Authentication state that can be used to check if user is authorized on the remote endpoint.\n */\nexport enum DXLinkAuthState {\n /**\n * User is unauthorized on the remote endpoint.\n */\n UNAUTHORIZED = 'UNAUTHORIZED',\n /**\n * User in the process of authorization, but not yet authorized.\n */\n AUTHORIZING = 'AUTHORIZING',\n /**\n * User is authorized on the remote endpoint and can use it.\n */\n AUTHORIZED = 'AUTHORIZED',\n}\n\n/**\n * Listener for authentication state changes.\n */\nexport type DXLinkAuthStateChangeListener = (state: DXLinkAuthState, prev: DXLinkAuthState) => void\n","import type { DXLinkAuthState, DXLinkAuthStateChangeListener } from './auth'\nimport type { DXLinkChannel } from './channel'\nimport type { DXLinkErrorListener } from './error'\nimport type { DXLinkScheduler } from './scheduler'\n\n/**\n * Connection state that can be used to check if connection is established and ready to use.\n * @see {DXLinkClient.getConnectionState}\n */\nexport enum DXLinkConnectionState {\n /**\n * Client was created and not connected to remote endpoint.\n * @see {DXLinkClient.connect}\n */\n NOT_CONNECTED = 'NOT_CONNECTED',\n /**\n * The {@link DXLinkClient.connect} method was called to establish connection or {@link DXLinkClient.reconnect} is in progress.\n * The connection is not ready to use yet.\n */\n CONNECTING = 'CONNECTING',\n /**\n * The connection to remote endpoint is established.\n * The connection is ready to use.\n */\n CONNECTED = 'CONNECTED',\n}\n\n/**\n * Connection details that can be used for debugging or logging.\n */\nexport interface DXLinkConnectionDetails {\n /**\n * Protocol version used for connection to the remote endpoint.\n */\n readonly protocolVersion: string\n /**\n * Version of the client library.\n */\n readonly clientVersion: string\n /**\n * Version of the server which the client is connected to.\n */\n readonly serverVersion?: string\n /**\n * Timeout in seconds for server to detect that client is disconnected.\n * If no keepalive message received from client during this time, server will close connection.\n */\n readonly clientKeepaliveTimeout?: number\n /**\n * Timeout in seconds in for client to detect that server is disconnected.\n * If no keepalive message received from server during this time, client will close connection.\n */\n readonly serverKeepaliveTimeout?: number\n}\n\n/**\n * Listener for connection state changes.\n */\nexport type DXLinkConnectionStateChangeListener = (\n state: DXLinkConnectionState,\n prev: DXLinkConnectionState\n) => void\n\n/**\n * dxLink client that can be used to connect to the remote dxLink endpoint and open channels to services.\n */\nexport interface DXLinkClient {\n /**\n * Connect to the remote endpoint.\n * Connects to the specified remote address. Previously established connections are closed if the new address is different from the old one.\n * This method does nothing if address does not change.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n *\n * For connection with the authorization token, use {@link DXLinkClient.setAuthToken} before calling this method.\n * If the token is not set, the connection will be established without authorization.\n *\n * @param url WebSocket URL to connect to.\n */\n connect(url: string): void\n /**\n * Reconnect to the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#CONNECTING CONNECTING}.\n * @see {DXLinkClient.connect}\n */\n reconnect(): void\n /**\n * Disconnect from the remote endpoint.\n * This method does nothing if the client is not connected.\n * The endpoint {@see DXLinkWebSocketClient.getConnectionState} immediately becomes {@link State#NOT_CONNECTED NOT_CONNECTED}.\n * @see {DXLinkClient.connect}\n */\n disconnect(): void\n\n /**\n * Get connection details that can be used for debugging or logging.\n */\n getConnectionDetails(): DXLinkConnectionDetails\n\n /**\n * Get connection state that can be used to check if connection is established and ready to use.\n */\n getConnectionState(): DXLinkConnectionState\n /**\n * Get scheduler used by the client and services.\n */\n getScheduler(): DXLinkScheduler\n /**\n * Add a listener for connection state changes.\n */\n addConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n /**\n * Remove a listener for connection state changes.\n */\n removeConnectionStateChangeListener(listener: DXLinkConnectionStateChangeListener): void\n\n /**\n * Set authorization token to be used for connection to the remote endpoint.\n * This method does nothing if the client is connected.\n * @param token Authorization token to be used for connection.\n */\n setAuthToken(token: string): void\n /**\n * Get authentication state that can be used to check if user is authorized on the remote endpoint.\n */\n getAuthState(): DXLinkAuthState\n /**\n * Add a listener for authentication state changes.\n * When auth state is {@link DXLinkAuthState.UNAUTHORIZED}, you can call {@link DXLinkClient.setAuthToken} to authorize the client.\n */\n addAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n /**\n * Remove a listener for authentication state changes.\n */\n removeAuthStateChangeListener(listener: DXLinkAuthStateChangeListener): void\n\n /**\n * Error listener that can be used to handle errors from the server.\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Open a isolated channel to service withing single {@link DXLinkClient} connection to remote endpoint.\n * @param service Name of the service to open channel to.\n * @param parameters Parameters of the service to open channel to.\n * @see {DXLinkChannel}\n */\n openChannel(service: string, parameters: Record<string, unknown>): DXLinkChannel\n\n /**\n * Close the client and free all resources.\n * This method works the same as {@link DXLinkClient.disconnect}.\n */\n close(): void\n}\n","import type { DXLinkErrorListener } from './error'\n\n/**\n * Message that can be sent to or received from the channel.\n * @see {DXLinkChannel.send} and {@link DXLinkChannel.addMessageListener}\n */\nexport interface DXLinkChannelMessage {\n /**\n * Type of the message.\n */\n readonly type: string\n /**\n * Payload of the message.\n */\n readonly [key: string]: any // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Listener for messages from the channel.\n * @see {DXLinkChannel.addMessageListener}\n */\nexport type DXLinkChannelMessageListener = (message: DXLinkChannelMessage) => void\n\n/**\n * Listener for channel state changes.\n * @see {DXLinkChannel.addStateChangeListener}\n */\nexport type DXLinkChannelStateChangeListener = (\n state: DXLinkChannelState,\n prev: DXLinkChannelState\n) => void\n\n/**\n * Channel state that can be used to check if channel is available for sending messages.\n * @see {DXLinkChannel.getState}\n */\nexport enum DXLinkChannelState {\n /**\n * Channel is requested and cannot be used to {@link DXLinkChannel.send} messages yet.\n */\n REQUESTED = 'REQUESTED',\n /**\n * Channel is opened and can be used to {@link DXLinkChannel.send} messages.\n */\n OPENED = 'OPENED',\n /**\n * Channel was closed by {@link DXLinkChannel.close} or by server.\n * Channel cannot be used anymore.\n */\n CLOSED = 'CLOSED',\n}\n\n/**\n * Isolated channel to service withing single {@link DXLinkWebSocketClient} connection to remote endpoint.\n * @see DXLinkWebSocketClient.openChannel\n */\nexport interface DXLinkChannel {\n /**\n * Unique identifier of the channel.\n */\n readonly id: number\n /**\n * Name of the service that channel is opened to.\n */\n readonly service: string\n /**\n * Parameters of the service that channel is opened to.\n */\n readonly parameters: Record<string, unknown>\n\n /**\n * Send a message to the channel.\n */\n send(message: DXLinkChannelMessage): void\n\n /**\n * Add a listener for messages from the channel.\n */\n addMessageListener(listener: DXLinkChannelMessageListener): void\n /**\n * Remove a listener for messages from the channel.\n */\n removeMessageListener(listener: DXLinkChannelMessageListener): void\n\n /**\n * Get channel state that can be used to check if channel is available for sending messages.\n */\n getState(): DXLinkChannelState\n /**\n * Add a listener for channel state changes.\n * If channel is ready to use, listener will be called immediately with {@link DXLinkChannelState.OPENED} state.\n * @see {DXLinkChannelState}\n * Note: when remote endpoint reconnects, channel will be reopened and listener will be called with {@link DXLinkChannelState.OPENED} state again.\n * @see {DXLinkWebSocketClient.getConnectionState}\n */\n addStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n /**\n * Remove a listener for channel state changes.\n */\n removeStateChangeListener(listener: DXLinkChannelStateChangeListener): void\n\n /**\n * Add a listener for errors from the server.\n * @see {DXLinkError}\n */\n addErrorListener(listener: DXLinkErrorListener): void\n /**\n * Remove a listener for errors from the server.\n * @see {DXLinkError}\n */\n removeErrorListener(listener: DXLinkErrorListener): void\n\n /**\n * Close the channel and free all resources.\n * This method does nothing if the channel is already closed.\n * The channel {@see DXLinkChannel.getStatus} immediately becomes {@link State#CLOSED CLOSED}.\n * @see {DXLinkChannelState}\n */\n close(): void\n}\n","/**\n * A logger interface that can be used to log messages.\n */\nexport interface DXLinkLogger {\n debug(message: string, ...args: unknown[]): void\n info(message: string, ...args: unknown[]): void\n warn(message: string, ...args: unknown[]): void\n error(message: string, ...args: unknown[]): void\n}\n\n/**\n * Level of logging that can be used to filter out messages.\n */\nexport enum DXLinkLogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n}\n\n/**\n * A logger that uses the console to log messages.\n */\nexport class Logger implements DXLinkLogger {\n constructor(\n private readonly prefix: string,\n private readonly level: DXLinkLogLevel\n ) {}\n\n debug(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.DEBUG) {\n console.debug(`[${this.prefix}] ${message}`, ...args)\n }\n }\n info(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.INFO) {\n console.info(`[${this.prefix}] ${message}`, ...args)\n }\n }\n warn(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.WARN) {\n console.warn(`[${this.prefix}] ${message}`, ...args)\n }\n }\n error(message: string, ...args: unknown[]): void {\n if (this.level <= DXLinkLogLevel.ERROR) {\n console.error(`[${this.prefix}] ${message}`, ...args)\n }\n }\n}\n","/**\n * Scheduler for scheduling callbacks.\n */\nexport interface DXLinkScheduler {\n schedule(callback: () => void, timeout: number, key: string): string\n cancel(key: string): void\n clear(): void\n has(key: string): boolean\n}\n\n/**\n * Default scheduler implementation based on browser timers.\n */\nexport class DefaultDXLinkScheduler implements DXLinkScheduler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private timeoutIds: Record<string, any> = {}\n\n schedule = (callback: () => void, timeout: number, key: string): string => {\n this.cancel(key)\n this.timeoutIds[key] = setTimeout(() => {\n delete this.timeoutIds[key]\n callback()\n }, timeout)\n\n return key\n }\n\n cancel = (key: string) => {\n if (this.timeoutIds[key] !== undefined) {\n clearTimeout(this.timeoutIds[key])\n delete this.timeoutIds[key]\n }\n }\n\n clear = () => {\n for (const key of Object.keys(this.timeoutIds)) {\n this.cancel(key)\n }\n }\n\n has = (key: string) => {\n return this.timeoutIds[key] !== undefined\n }\n}\n\n/**\n * @deprecated Use {@link DefaultDXLinkScheduler} instead.\n */\nexport class Scheduler extends DefaultDXLinkScheduler {}\n"],"names":["DXLinkAuthState","DXLinkConnectionState","DXLinkChannelState","DXLinkLogLevel","Logger","constructor","prefix","level","this","debug","message","DEBUG","console","slice","call","arguments","info","INFO","warn","WARN","error","ERROR","DefaultDXLinkScheduler","timeoutIds","schedule","callback","timeout","key","cancel","setTimeout","undefined","clearTimeout","clear","Object","keys","has","Scheduler"],"mappings":"AAGY,IAAAA,gBCMAC,sBC0BAC,mBCtBAC,gBHVZ,SAAYH,iBAIVA,gBAAA,aAAA,eAIAA,gBAAA,YAAA,cAIAA,gBAAA,WAAA,YACD,CAbD,CAAYA,kBAAAA,gBAaX,CAAA,ICPD,SAAYC,uBAKVA,sBAAA,cAAA,gBAKAA,sBAAA,WAAA,aAKAA,sBAAA,UAAA,WACD,CAhBD,CAAYA,wBAAAA,sBAgBX,CAAA,ICUD,SAAYC,oBAIVA,mBAAA,UAAA,YAIAA,mBAAA,OAAA,SAKAA,mBAAA,OAAA,QACD,CAdD,CAAYA,qBAAAA,mBAcX,CAAA,ICpCD,SAAYC,gBACVA,eAAAA,eAAA,MAAA,GAAA,QACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,KAAA,GAAA,OACAA,eAAAA,eAAA,MAAA,GAAA,OACD,CALD,CAAYA,iBAAAA,eAKX,CAAA,IAKY,MAAAC,OACXC,WAAAA,CACmBC,OACAC,OADAD,KAAAA,YACAC,EAAAA,KAAAA,WADA,EAAAC,KAAMF,OAANA,OACAE,KAAKD,MAALA,KAChB,CAEHE,KAAAA,CAAMC,SACAF,KAAKD,OAASJ,eAAeQ,OAC/BC,QAAQH,MAAM,IAAID,KAAKF,WAAWI,aAAWG,GAAAA,MAAAC,KAAAC,UAAO,GAExD,CACAC,IAAAA,CAAKN,SACCF,KAAKD,OAASJ,eAAec,MAC/BL,QAAQI,KAAK,IAAIR,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAG,IAAAA,CAAKR,SACCF,KAAKD,OAASJ,eAAegB,MAC/BP,QAAQM,KAAK,IAAIV,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEhD,CACAK,KAAAA,CAAMV,SACAF,KAAKD,OAASJ,eAAekB,OAC/BT,QAAQQ,MAAM,IAAIZ,KAAKF,WAAWI,aAAW,GAAAG,MAAAC,KAAAC,UAAA,GAEjD,ECnCW,MAAAO,uBAAsBjB,WAAAA,GAEzBkB,KAAAA,WAAkC,GAE1CC,KAAAA,SAAW,CAACC,SAAsBC,QAAiBC,OACjDnB,KAAKoB,OAAOD,KACZnB,KAAKe,WAAWI,KAAOE,WAAW,YACrBrB,KAACe,WAAWI,KACvBF,UACF,EAAGC,SAEIC,KAGTC,KAAAA,OAAUD,WACqBG,IAAzBtB,KAAKe,WAAWI,OAClBI,aAAavB,KAAKe,WAAWI,aACtBnB,KAAKe,WAAWI,KACxB,EAGHK,KAAAA,MAAQ,KACN,IAAK,MAAML,OAAOM,OAAOC,KAAK1B,KAAKe,YACjCf,KAAKoB,OAAOD,IACb,EAGHQ,KAAAA,IAAOR,UAC2BG,IAArBtB,KAACe,WAAWI,IACxB,EAMU,MAAAS,kBAAkBd"}
/**
* Scheduler for scheduling callbacks.
*/
export declare class Scheduler {
export interface DXLinkScheduler {
schedule(callback: () => void, timeout: number, key: string): string;
cancel(key: string): void;
clear(): void;
has(key: string): boolean;
}
/**
* Default scheduler implementation based on browser timers.
*/
export declare class DefaultDXLinkScheduler implements DXLinkScheduler {
private timeoutIds;

@@ -11,1 +20,6 @@ schedule: (callback: () => void, timeout: number, key: string) => string;

}
/**
* @deprecated Use {@link DefaultDXLinkScheduler} instead.
*/
export declare class Scheduler extends DefaultDXLinkScheduler {
}
{
"name": "@dxfeed/dxlink-core",
"version": "0.6.1",
"version": "0.7.0",
"private": false,

@@ -5,0 +5,0 @@ "sideEffects": false,