Comparing version 0.0.0 to 0.0.1
declare type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never; | ||
declare type ReturnType<T> = T extends (...args: any) => infer R ? R : never; | ||
interface BirpcOptions<S> { | ||
interface BirpcOptions<Functions> { | ||
/** | ||
* Local functions implementation. | ||
*/ | ||
functions: S; | ||
functions: Functions; | ||
/** | ||
@@ -29,14 +29,17 @@ * Function to post raw message | ||
} | ||
interface BirpcReturn<RemoteFunctions> { | ||
declare type BirpcFn<T> = { | ||
/** | ||
* Call a remote function and wait for the result. | ||
* Call the remote function and wait for the result. | ||
*/ | ||
call<T extends keyof RemoteFunctions>(method: T, ...args: ArgumentsType<RemoteFunctions[T]>): Promise<Awaited<ReturnType<RemoteFunctions[T]>>>; | ||
(...args: ArgumentsType<T>): Promise<Awaited<ReturnType<T>>>; | ||
/** | ||
* Send events without waiting for response | ||
* Send event without asking for response | ||
*/ | ||
send<T extends keyof RemoteFunctions>(method: T, ...args: ArgumentsType<RemoteFunctions[T]>): void; | ||
} | ||
noReply(...args: ArgumentsType<T>): void; | ||
}; | ||
declare type BirpcReturn<RemoteFunctions> = { | ||
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>; | ||
}; | ||
declare function createBirpc<LocalFunctions = {}, RemoteFunctions = {}>({ functions, post, on, serialize, deserialize, }: BirpcOptions<LocalFunctions>): BirpcReturn<RemoteFunctions>; | ||
export { ArgumentsType, BirpcOptions, BirpcReturn, ReturnType, createBirpc }; | ||
export { ArgumentsType, BirpcFn, BirpcOptions, BirpcReturn, ReturnType, createBirpc }; |
{ | ||
"name": "birpc", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Message based Two-way remote procedure call", | ||
@@ -34,11 +34,2 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "unbuild --stub", | ||
"lint": "eslint --ext .js,.ts .", | ||
"prepublishOnly": "nr build", | ||
"release": "bumpp --commit --push --tag && pnpm publish", | ||
"start": "esno src/index.ts", | ||
"test": "vitest" | ||
}, | ||
"devDependencies": { | ||
@@ -55,3 +46,11 @@ "@antfu/eslint-config": "^0.14.0", | ||
"vite": "^2.7.3" | ||
}, | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "unbuild --stub", | ||
"lint": "eslint --ext .js,.ts .", | ||
"release": "bumpp --commit --push --tag && pnpm publish", | ||
"start": "esno src/index.ts", | ||
"test": "vitest" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7300
155