@nyth/common
Advanced tools
Comparing version 0.1.2 to 0.2.0
export { IRpcRequest, IRpcResult, IRpcExecutor, IRpcAdapter, IRpcAdapterConstructor, IRpcMethodHandler, IExecutor, IApplication, IRouting, IApplicationFactory, } from './typings'; | ||
export { IHttpAdapter } from './http-adapter'; | ||
export { ISerializer, defaultSerializer } from './serializer'; | ||
export { BaseAdapter } from './base-adapter'; |
@@ -0,1 +1,3 @@ | ||
import { BaseAdapter } from './base-adapter'; | ||
import { ISerializer } from './serializer'; | ||
export interface IRpcRequest<T = undefined> { | ||
@@ -11,8 +13,8 @@ readonly method: string; | ||
} | ||
export declare type IRpcExecutor = (rpcCall: IRpcRequest) => Promise<IRpcResult>; | ||
export interface IRpcAdapter { | ||
export type IRpcExecutor = (rpcCall: IRpcRequest) => Promise<IRpcResult>; | ||
export interface IRpcAdapter extends BaseAdapter { | ||
start(executor: IRpcExecutor): void | Promise<void>; | ||
close(): void | Promise<void>; | ||
} | ||
export declare type IRpcAdapterConstructor<O = unknown> = new (options: O) => IRpcAdapter; | ||
export type IRpcAdapterConstructor<O = unknown> = new (options: O, serializer?: ISerializer) => IRpcAdapter; | ||
export interface IRpcMethodHandler<Result = unknown, CallData = undefined> { | ||
@@ -22,3 +24,3 @@ validate(rpcCallPayload: unknown): rpcCallPayload is CallData; | ||
} | ||
export declare type IExecutor<Result = unknown, CallData = undefined> = (handler: IRpcMethodHandler<Result, CallData>) => Promise<Result>; | ||
export type IExecutor<Result = unknown, CallData = undefined> = (handler: IRpcMethodHandler<Result, CallData>) => Promise<Result>; | ||
export interface IApplication { | ||
@@ -28,3 +30,3 @@ start(): Promise<void>; | ||
} | ||
export declare type IRouting = Record<string, IRpcMethodHandler>; | ||
export declare type IApplicationFactory = (handlers: IRouting, adapter: IRpcAdapter) => IApplication; | ||
export type IRouting = Record<string, IRpcMethodHandler>; | ||
export type IApplicationFactory = (handlers: IRouting, adapter: IRpcAdapter) => IApplication; |
{ | ||
"name": "@nyth/common", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "nyth", | ||
@@ -35,4 +35,4 @@ "author": "Andrey Sakharov <caxap_8787@mail.ru> (https://www.linkedin.com/in/andrey-sakharov/)", | ||
"devDependencies": { | ||
"@types/node": "^14.18.12", | ||
"typescript": "^4.6.3" | ||
"@types/node": "^20.2.5", | ||
"typescript": "^5.1.3" | ||
}, | ||
@@ -39,0 +39,0 @@ "publishConfig": { |
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
4564
12
87