1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.DiagnosticsResult = exports.DiagnosticsEndpoint = exports.PingResult = exports.PingEndpoint = exports.PingState = exports.EndpointState = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var EndpointState;
|
10 | (function (EndpointState) {
|
11 | |
12 |
|
13 |
|
14 | EndpointState[EndpointState["Disconnected"] = 0] = "Disconnected";
|
15 | |
16 |
|
17 |
|
18 | EndpointState[EndpointState["Connecting"] = 1] = "Connecting";
|
19 | |
20 |
|
21 |
|
22 | EndpointState[EndpointState["Connected"] = 2] = "Connected";
|
23 | |
24 |
|
25 |
|
26 | EndpointState[EndpointState["Disconnecting"] = 3] = "Disconnecting";
|
27 | })(EndpointState || (exports.EndpointState = EndpointState = {}));
|
28 |
|
29 |
|
30 |
|
31 | var PingState;
|
32 | (function (PingState) {
|
33 | |
34 |
|
35 |
|
36 | PingState[PingState["Ok"] = 0] = "Ok";
|
37 | |
38 |
|
39 |
|
40 | PingState[PingState["Timeout"] = 1] = "Timeout";
|
41 | |
42 |
|
43 |
|
44 | PingState[PingState["Error"] = 2] = "Error";
|
45 | })(PingState || (exports.PingState = PingState = {}));
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | class PingEndpoint {
|
52 | |
53 |
|
54 |
|
55 | constructor(data) {
|
56 | this.type = data.type;
|
57 | this.id = data.id;
|
58 | this.latency = data.latency;
|
59 | this.remote = data.remote;
|
60 | this.local = data.local;
|
61 | this.state = data.state;
|
62 | this.bucket = data.bucket;
|
63 | this.error = data.error;
|
64 | }
|
65 | }
|
66 | exports.PingEndpoint = PingEndpoint;
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | class PingResult {
|
73 | |
74 |
|
75 |
|
76 | constructor(data) {
|
77 | this.version = data.version;
|
78 | this.id = data.id;
|
79 | this.sdk = data.sdk;
|
80 | this.services = data.services;
|
81 | }
|
82 | |
83 |
|
84 |
|
85 | toJSON() {
|
86 | return {
|
87 | version: this.version,
|
88 | id: this.id,
|
89 | sdk: this.sdk,
|
90 | services: Object.fromEntries(Object.entries(this.services).map(([serviceType, services]) => {
|
91 | return [
|
92 | serviceType,
|
93 | services.map((svc) => {
|
94 | return {
|
95 | latency_us: svc.latency * 1000000,
|
96 | remote: svc.remote,
|
97 | local: svc.local,
|
98 | id: svc.id,
|
99 | state: svc.state,
|
100 | namespace: svc.bucket,
|
101 | error: svc.error,
|
102 | };
|
103 | }),
|
104 | ];
|
105 | })),
|
106 | };
|
107 | }
|
108 | }
|
109 | exports.PingResult = PingResult;
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | class DiagnosticsEndpoint {
|
117 | |
118 |
|
119 |
|
120 | constructor(data) {
|
121 | this.type = data.type;
|
122 | this.id = data.id;
|
123 | this.local = data.local;
|
124 | this.remote = data.remote;
|
125 | this.lastActivity = data.lastActivity;
|
126 | this.state = data.state;
|
127 | }
|
128 | }
|
129 | exports.DiagnosticsEndpoint = DiagnosticsEndpoint;
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | class DiagnosticsResult {
|
136 | |
137 |
|
138 |
|
139 | constructor(data) {
|
140 | this.version = data.version;
|
141 | this.id = data.id;
|
142 | this.sdk = data.sdk;
|
143 | this.services = data.services;
|
144 | }
|
145 | |
146 |
|
147 |
|
148 | toJSON() {
|
149 | return {
|
150 | version: this.version,
|
151 | id: this.id,
|
152 | sdk: this.sdk,
|
153 | services: Object.fromEntries(Object.entries(this.services).map(([serviceType, services]) => {
|
154 | return [
|
155 | serviceType,
|
156 | services.map((svc) => {
|
157 | return {
|
158 | last_activity_us: svc.lastActivity * 1000000,
|
159 | remote: svc.remote,
|
160 | local: svc.local,
|
161 | id: svc.id,
|
162 | state: svc.state,
|
163 | namespace: svc.bucket,
|
164 | details: svc.details,
|
165 | };
|
166 | }),
|
167 | ];
|
168 | })),
|
169 | };
|
170 | }
|
171 | }
|
172 | exports.DiagnosticsResult = DiagnosticsResult;
|