modality-kit 0.15.4 → 0.16.0
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
CHANGED
|
@@ -14644,7 +14644,7 @@ var STANDARD_ERROR_MESSAGES = {
|
|
|
14644
14644
|
|
|
14645
14645
|
// src/JSONRPCUtils.ts
|
|
14646
14646
|
class JSONRPCUtils {
|
|
14647
|
-
static
|
|
14647
|
+
static validateBatchMessage(message) {
|
|
14648
14648
|
if (Array.isArray(message)) {
|
|
14649
14649
|
if (message.length === 0) {
|
|
14650
14650
|
return {
|
|
@@ -14664,8 +14664,9 @@ class JSONRPCUtils {
|
|
|
14664
14664
|
message,
|
|
14665
14665
|
messageType: "batch"
|
|
14666
14666
|
};
|
|
14667
|
+
} else {
|
|
14668
|
+
return this.validateSingleMessage(message);
|
|
14667
14669
|
}
|
|
14668
|
-
return this.validateSingleMessage(message);
|
|
14669
14670
|
}
|
|
14670
14671
|
static validateSingleMessage(message) {
|
|
14671
14672
|
if (!message || typeof message !== "object") {
|
|
@@ -15230,7 +15231,7 @@ class JSONRPCManager extends JSONRPCCall {
|
|
|
15230
15231
|
if (!message) {
|
|
15231
15232
|
throw new ERROR_PARSE_ERROR("Failed to parse JSON-RPC message");
|
|
15232
15233
|
}
|
|
15233
|
-
const validation = JSONRPCUtils.
|
|
15234
|
+
const validation = JSONRPCUtils.validateBatchMessage(message);
|
|
15234
15235
|
if (!validation.valid) {
|
|
15235
15236
|
const errorResponse = JSONRPCUtils.createErrorResponse(validation.error, message.id || null);
|
|
15236
15237
|
return this.sendMessage(errorResponse, options);
|
|
@@ -15470,7 +15471,7 @@ class WebSocketClient {
|
|
|
15470
15471
|
if (!message) {
|
|
15471
15472
|
throw new Error(`deserialize returned null or undefined ${event.data}`);
|
|
15472
15473
|
}
|
|
15473
|
-
const validMessage = JSONRPCUtils.
|
|
15474
|
+
const validMessage = JSONRPCUtils.validateBatchMessage(message);
|
|
15474
15475
|
if (validMessage.valid) {
|
|
15475
15476
|
const message2 = validMessage.message;
|
|
15476
15477
|
if (message2.method === "server.connected") {
|
|
@@ -12,7 +12,7 @@ export declare class JSONRPCUtils {
|
|
|
12
12
|
/**
|
|
13
13
|
* Validate a JSON-RPC message (supports batch requests)
|
|
14
14
|
*/
|
|
15
|
-
static
|
|
15
|
+
static validateBatchMessage(message: any): JSONRPCValidationResult;
|
|
16
16
|
/**
|
|
17
17
|
* Validate a single JSON-RPC message
|
|
18
18
|
*/
|
|
@@ -113,7 +113,7 @@ export declare abstract class JSONRPCManager<TContext> extends JSONRPCCall {
|
|
|
113
113
|
/**
|
|
114
114
|
* Process incoming WebSocket message
|
|
115
115
|
*/
|
|
116
|
-
validateMessage(data: string | Buffer | Record<string, any>, options?: any): Promise<
|
|
116
|
+
validateMessage(data: string | Buffer | Record<string, any>, options?: any): Promise<any>;
|
|
117
117
|
/**
|
|
118
118
|
* Get manager statistics
|
|
119
119
|
*/
|
package/package.json
CHANGED