lixnet 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
- import type { DebugLogger, FunctionInput, LXNServerHandler, LXN_ServerClient_EventType, LXN_ServerClient_Request } from "./types";
2
+ import type { DebugLogger, FunctionInput, FunctionOutput, LXNServerHandler, LXN_ServerClient_EventType, LXN_ServerClient_Request } from "./types";
3
3
  type LXNServerEventInput<Events extends LXN_ServerClient_EventType, TName extends keyof Events> = {
4
4
  event: TName;
5
5
  handler: LXNServerHandler<FunctionInput<Events[TName]> & {
6
6
  request: LXN_ServerClient_Request;
7
- }>;
7
+ }, FunctionOutput<Events[TName]>>;
8
8
  schema?: z.ZodSchema<any>;
9
9
  };
10
10
  export default class LixnetServer<Events extends LXN_ServerClient_EventType> {
@@ -5,7 +5,10 @@ export type DebugLogger = ({ error, message, }: {
5
5
  export type FunctionInput<T> = T extends (input: infer TInput) => any ? TInput : {
6
6
  _TYPE_ERROR_: "Event definition must be a function type";
7
7
  };
8
- export type LXNServerHandler<Input> = (input: Input) => Promise<any> | any;
8
+ export type FunctionOutput<T> = T extends (...args: any) => infer R ? Awaited<R> : {
9
+ _TYPE_ERROR_: "Event definition must be a function type";
10
+ };
11
+ export type LXNServerHandler<Input, Output> = (input: Input) => Promise<Output> | Output;
9
12
  export type LXN_ServerClient_EventType = object;
10
13
  export type LXN_ServerClient_Request = Request & {
11
14
  setAdditionalInit: (init: ResponseInit) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lixnet",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "author": "Nitlix",
5
5
  "license": "MIT",
6
6
  "repository": {