Skip to content

Commit

Permalink
fix type test for JSONRPC response (v0.1.10)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeOShannessy committed Dec 26, 2024
1 parent c5589d8 commit 98349ea
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smoke-cloud/smv-rpc",
"version": "0.1.9",
"version": "0.1.10",
"license": "GPL",
"exports": "./mod.ts",
"lint": {
Expand Down
3 changes: 1 addition & 2 deletions jsonrpccommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ export interface JsonRpcResponse {
};
}
export function isJsonRpcResponse(o: object): o is JsonRpcResponse {
return "jsonrpc" in o && o["jsonrpc"] === "2.0" && "id" in o &&
"result" in o;
return "jsonrpc" in o && o["jsonrpc"] === "2.0" && "id" in o;
}
6 changes: 1 addition & 5 deletions jsonrpcunix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,20 @@ export class JsonRpcClientUnix {
// const { value, done } = await reader.read();
// if (value) {
// // const s = decoder.decode(value);
// console.log("s:", value);
// for (const c of value) {
// singleObj += c;
// if (c == "}") {
// objectStrings.push(singleObj);
// singleObj = "";
// // break;
// }
// // console.log(c);
// }
// console.log(objectStrings);
// response += value;
// }
// // if (done) {
// // break;
// // }
// // }
// // console.log(response);
// const t: object[] = objectStrings.map((s) => JSON.parse(s));
},

Expand Down Expand Up @@ -103,7 +99,7 @@ export class JsonRpcClientUnix {
}
return r.result;
} else {
console.error(r);
console.error("Error:", r);
}
}
async notify(method: string, params?: JsonRpcParams) {
Expand Down
2 changes: 1 addition & 1 deletion jsonrpcwin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class JsonRpcClientWin {
}
return r.result;
} else {
console.error(r);
console.error("Error:", r);
}
}
async notify(method: string, params?: JsonRpcParams) {
Expand Down
7 changes: 0 additions & 7 deletions rstream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ const transformContent = {
chunk: string | null,
controller: TransformStreamDefaultController,
) {
// console.log("this.buffer:", this.buffer);
// console.log("chunk:", chunk);
if (chunk === null) {
controller.terminate();
return;
Expand All @@ -28,10 +26,6 @@ const transformContent = {
case "}":
this.objectDepth--;
if (this.objectDepth === 0) done = true;
// console.log(
// " this.objectDepth",
// this.objectDepth,
// );
break;

default:
Expand All @@ -44,7 +38,6 @@ const transformContent = {
this.buffer = "";
}
}
// console.log("controller.buffer:", this.buffer);
},
flush() {
/* do any destructor work here */
Expand Down

0 comments on commit 98349ea

Please sign in to comment.