@evergis/api 5.0.32 → 5.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +12 -12
- package/dist/__generated__/NotificationService.d.ts +69 -0
- package/dist/api.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/services/Notification.d.ts +48 -0
- package/package.json +3 -2
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NotificationService } from '../__generated__/NotificationService';
|
|
2
|
+
import { Api } from '../Api';
|
|
3
|
+
import { IHttpClient } from '../__generated__/HttpClient';
|
|
4
|
+
type NotificationHandler<Data, Result> = (event: NotificationEvent<Data>) => Result;
|
|
5
|
+
export declare enum ConnectionStatus {
|
|
6
|
+
Initialized = "Initialized",
|
|
7
|
+
Connected = "Connected",
|
|
8
|
+
Break = "Break",
|
|
9
|
+
Lost = "Lost",
|
|
10
|
+
SessionClosed = "SessionClosed"
|
|
11
|
+
}
|
|
12
|
+
export declare const enum NotificationTag {
|
|
13
|
+
ConnectionStatus = "ConnectionStatus"
|
|
14
|
+
}
|
|
15
|
+
export declare const enum SubscriptionTag {
|
|
16
|
+
ServerTask = "server_task",
|
|
17
|
+
ServiceUpdate = "service_update"
|
|
18
|
+
}
|
|
19
|
+
export declare class Notification extends NotificationService {
|
|
20
|
+
private api;
|
|
21
|
+
private readonly MAX_WS_RECONNECT_TRIES;
|
|
22
|
+
private readonly emitter;
|
|
23
|
+
private readonly keepAlive;
|
|
24
|
+
private ws?;
|
|
25
|
+
private wsUrl?;
|
|
26
|
+
private reconnectTries;
|
|
27
|
+
private subscriptions;
|
|
28
|
+
private keepAliveTimeout?;
|
|
29
|
+
private _connectStatus;
|
|
30
|
+
get connectStatus(): ConnectionStatus;
|
|
31
|
+
set connectStatus(connectStatus: ConnectionStatus);
|
|
32
|
+
get currentWs(): WebSocket | undefined;
|
|
33
|
+
constructor(http: IHttpClient, api: Api, keepAlive?: boolean);
|
|
34
|
+
on<Data, Result>(tag: string, handler: NotificationHandler<Data, Result>): void;
|
|
35
|
+
off<Data, Result>(tag: string, handler: NotificationHandler<Data, Result>): void;
|
|
36
|
+
subscribe(tag: string): Promise<void>;
|
|
37
|
+
unsubscribe(tag: string): Promise<void>;
|
|
38
|
+
connectWs(url: string): void;
|
|
39
|
+
private connect;
|
|
40
|
+
private onWsConnected;
|
|
41
|
+
private onWsClosed;
|
|
42
|
+
private onWsMessage;
|
|
43
|
+
}
|
|
44
|
+
export declare class NotificationEvent<Data> {
|
|
45
|
+
data: Data;
|
|
46
|
+
constructor(data: Data);
|
|
47
|
+
}
|
|
48
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.0.
|
|
2
|
+
"version": "5.0.34",
|
|
3
3
|
"name": "@evergis/api",
|
|
4
4
|
"author": "Everpoint",
|
|
5
5
|
"license": "MIT",
|
|
@@ -25,5 +25,6 @@
|
|
|
25
25
|
"nanoid": "^5.1.5",
|
|
26
26
|
"query-string": "^6.7.0",
|
|
27
27
|
"swagger-typescript-api": "13.0.23"
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "8d283a9265d233adc59b97f0ce7aaf6e8d47082b"
|
|
29
30
|
}
|