Socket
Socket
Sign inDemoInstall

@nyth/common

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nyth/common - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

dist/errors.d.ts

7

dist/index.d.ts

@@ -1,4 +0,7 @@

export { IRpcRequest, IRpcResult, IRpcExecutor, IRpcAdapter, IRpcAdapterConstructor, IRpcMethodHandler, IExecutor, IApplication, IRouting, IApplicationFactory, } from './typings';
export { BaseAdapter } from './base-adapter';
export { INTERNAL_ERROR_MESSAGE, PERMISSIONS_DENIED_MESSAGE, AppError, ScenarioError, PermissionsDeniedError, SystemError, } from './errors';
export { HandlerValidationSuccess, HANDLER_VALIDATION_SUCCESS, HandlerValidationFail, } from './handler-validation-result';
export { IHttpAdapter } from './http-adapter';
export { EScenarioStatus, IRpcResult, RpcResult, ScenarioSuccessResult, PermissionsDeniedResult, ScenarioFailResult, SystemErrorResult, } from './responses';
export { ISerializer, defaultSerializer } from './serializer';
export { BaseAdapter } from './base-adapter';
export { IRpcRequest, IRpcExecutor, IRpcAdapter, IRpcAdapterConstructor, IHandlerValidationSuccess, IHandlerValidationFail, THandlerValidationResult, IRpcMethodHandler, IExecutor, IApplication, IRouting, IApplicationFactory, } from './typings';

@@ -1,6 +0,7 @@

import { IRpcRequest, IRpcResult } from './typings';
import { RpcResult } from './responses';
import { IRpcRequest } from './typings';
export interface ISerializer {
deserialize(req: string): IRpcRequest;
serialize(res: IRpcResult): string;
serialize(res: RpcResult): string;
}
export declare const defaultSerializer: ISerializer;
import { BaseAdapter } from './base-adapter';
import { RpcResult } from './responses';
import { ISerializer } from './serializer';
export interface IRpcRequest<T = undefined> {
export interface IRpcRequest<Payload = unknown> {
readonly method: string;
readonly payload: T;
readonly payload: Payload;
readonly correlationId?: string | number | null;
readonly requestId?: string | number | null;

@@ -10,6 +12,3 @@ readonly version?: number | null;

}
export interface IRpcResult<Payload = unknown> {
readonly payload: Payload;
}
export type IRpcExecutor = (rpcCall: IRpcRequest) => Promise<IRpcResult>;
export type IRpcExecutor = (rpcCall: IRpcRequest) => Promise<RpcResult>;
export interface IRpcAdapter extends BaseAdapter {

@@ -20,7 +19,16 @@ start(executor: IRpcExecutor): void | Promise<void>;

export type IRpcAdapterConstructor<O = unknown> = new (options: O, serializer?: ISerializer) => IRpcAdapter;
export interface IRpcMethodHandler<Result = unknown, CallData = undefined> {
validate(rpcCallPayload: unknown): rpcCallPayload is CallData;
export interface IHandlerValidationSuccess {
readonly isValidCallData: true;
readonly validationErrorMessage?: null;
}
export interface IHandlerValidationFail {
readonly isValidCallData: false;
readonly validationErrorMessage: string;
}
export type THandlerValidationResult = IHandlerValidationSuccess | IHandlerValidationFail;
export interface IRpcMethodHandler<Result = unknown, CallData = unknown> {
validate(rpcCallPayload: CallData): THandlerValidationResult;
run(rpcCall: IRpcRequest<CallData>): Result | Promise<Result>;
}
export type IExecutor<Result = unknown, CallData = undefined> = (handler: IRpcMethodHandler<Result, CallData>) => Promise<Result>;
export type IExecutor<Result = unknown, CallData = unknown> = (handler: IRpcMethodHandler<Result, CallData>) => Promise<Result>;
export interface IApplication {

@@ -27,0 +35,0 @@ start(): Promise<void>;

{
"name": "@nyth/common",
"version": "0.2.1",
"version": "0.3.0",
"description": "nyth",

@@ -5,0 +5,0 @@ "author": "Andrey Sakharov <caxap_8787@mail.ru> (https://www.linkedin.com/in/andrey-sakharov/)",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc