From 8118a2e41f6c7bbe952b0f45ffd8cc3ac5fa88a9 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 9 Apr 2024 13:36:03 +0200 Subject: [PATCH 1/3] fix: rpc without exceptions --- package.json | 6 +++--- src/common/msg/rpc.ts | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 16a4f14..be4d316 100644 --- a/package.json +++ b/package.json @@ -65,14 +65,14 @@ "watch": "nr build -- --watch src" }, "devDependencies": { - "@antfu/eslint-config": "^2.12.2", + "@antfu/eslint-config": "^2.13.0", "@antfu/ni": "^0.21.12", - "@types/node": "^20.12.5", + "@types/node": "^20.12.6", "@vitest/coverage-v8": "^1.4.0", "esbuild": "^0.20.2", "eslint": "^9.0.0", "tsup": "^8.0.2", - "typedoc": "^0.25.12", + "typedoc": "^0.25.13", "typescript": "^5.4.4", "vite": "^5.2.8", "vitest": "^1.4.0" diff --git a/src/common/msg/rpc.ts b/src/common/msg/rpc.ts index 156aedf..d3faec2 100644 --- a/src/common/msg/rpc.ts +++ b/src/common/msg/rpc.ts @@ -18,6 +18,8 @@ export interface RPCOptionsBasic extends Pipe { onError?: (error: Error, functionName: string, args: any[]) => boolean | void /** Custom error handler for timeouts */ onTimeoutError?: (functionName: string, args: any[]) => boolean | void + /** Throw execptions. Default: true */ + exceptions?: boolean } export interface RPCOptions extends RPCOptionsBasic { @@ -68,6 +70,7 @@ function setupRPCBasic(options: RPCOptionsBasic, functions: any, eventNames: str onError, onTimeoutError, onlyEvents = false, + exceptions = true, } = options const rpcPromiseMap = new Map Date: Tue, 9 Apr 2024 13:39:04 +0200 Subject: [PATCH 2/3] fix: rpc demo code --- src/common/msg/rpc.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/msg/rpc.ts b/src/common/msg/rpc.ts index d3faec2..50442e6 100644 --- a/src/common/msg/rpc.ts +++ b/src/common/msg/rpc.ts @@ -206,10 +206,12 @@ export function useRPCHub(options: RPCOptionsBasic) { export type UseRPCHubType = ReturnType // Syntax test case -// const hub: UseRPCHubType = {} as any -// const x = hub({ -// test(name: string): string { -// return name -// }, -// }) -// await x.test('dsd') +// async function _demo() { +// const hub: UseRPCHubType = {} as any +// const x = hub({ +// test(name: string): string { +// return name +// }, +// }) +// await x.test('dsd') +// } From 04c628ac0152420913b84963abb216f9eefc5088 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 9 Apr 2024 13:39:07 +0200 Subject: [PATCH 3/3] 0.20.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be4d316..5de0fb6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zeed", "type": "module", - "version": "0.20.1", + "version": "0.20.2", "description": "🌱 Simple foundation library", "author": { "name": "Dirk Holtwick",