modality-kit 0.9.3 → 0.9.5
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/dist/index.js +18 -11
- package/dist/types/websocket-client.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -147,28 +147,35 @@ class ModalityLogger {
|
|
|
147
147
|
case "debug":
|
|
148
148
|
console.debug(payload);
|
|
149
149
|
break;
|
|
150
|
-
case "info":
|
|
151
|
-
|
|
152
|
-
console.
|
|
150
|
+
case "info": {
|
|
151
|
+
const { message, ...restPayload } = payload;
|
|
152
|
+
console.info(message);
|
|
153
|
+
console.dir(restPayload, {
|
|
153
154
|
depth: null,
|
|
154
155
|
colors: true,
|
|
155
156
|
maxArrayLength: null
|
|
156
157
|
});
|
|
157
158
|
break;
|
|
158
|
-
|
|
159
|
+
}
|
|
160
|
+
case "warn": {
|
|
161
|
+
const { message, ...restPayload } = payload;
|
|
159
162
|
console.warn(payload);
|
|
160
|
-
console.
|
|
161
|
-
|
|
163
|
+
console.dir(restPayload, {
|
|
164
|
+
depth: null,
|
|
165
|
+
colors: true,
|
|
166
|
+
maxArrayLength: null
|
|
167
|
+
});
|
|
162
168
|
break;
|
|
163
|
-
|
|
169
|
+
}
|
|
170
|
+
case "error": {
|
|
164
171
|
const error = payload.error;
|
|
165
172
|
if (error instanceof Error || error.stack) {
|
|
166
173
|
delete payload.error;
|
|
167
174
|
const { message, stack, ...restError } = error;
|
|
168
175
|
if (stack) {
|
|
169
176
|
if (Object.keys(restError).length) {
|
|
170
|
-
console.error(restError
|
|
171
|
-
|
|
177
|
+
console.error(restError);
|
|
178
|
+
console.log(stack);
|
|
172
179
|
} else {
|
|
173
180
|
console.error(stack);
|
|
174
181
|
}
|
|
@@ -182,6 +189,7 @@ class ModalityLogger {
|
|
|
182
189
|
console.error(payload);
|
|
183
190
|
}
|
|
184
191
|
break;
|
|
192
|
+
}
|
|
185
193
|
case "success":
|
|
186
194
|
console.log(payload);
|
|
187
195
|
break;
|
|
@@ -5797,7 +5805,6 @@ class WebSocketClient {
|
|
|
5797
5805
|
this.isManualDisconnect = false;
|
|
5798
5806
|
this.ws = new WebSocket(this.url);
|
|
5799
5807
|
this.ws.onopen = (event) => {
|
|
5800
|
-
logger3.info("WebSocket connected:", event);
|
|
5801
5808
|
this.reconnectAttempts = 0;
|
|
5802
5809
|
this.reconnectDelay = this.config.initialReconnectDelay;
|
|
5803
5810
|
this.startHeartbeat();
|
|
@@ -5813,7 +5820,7 @@ class WebSocketClient {
|
|
|
5813
5820
|
};
|
|
5814
5821
|
this.ws.onmessage = (event) => {
|
|
5815
5822
|
if (this.config.onReceiveMessage) {
|
|
5816
|
-
|
|
5823
|
+
this.config.onReceiveMessage(event);
|
|
5817
5824
|
}
|
|
5818
5825
|
try {
|
|
5819
5826
|
const message = JSONRPCUtils.deserialize(event.data);
|
|
@@ -7,7 +7,7 @@ interface WebSocketConfig {
|
|
|
7
7
|
heartbeatInterval: number;
|
|
8
8
|
enableKeepAlive: boolean;
|
|
9
9
|
handleMessage: (validMessage: JSONRPCValidationResult, ws: WebSocketClient) => void;
|
|
10
|
-
onReceiveMessage?: (event: any) =>
|
|
10
|
+
onReceiveMessage?: (event: any) => void;
|
|
11
11
|
}
|
|
12
12
|
interface WebSocketInfo {
|
|
13
13
|
url: string;
|
package/package.json
CHANGED