oc-server 2.0.1 → 2.0.3

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.
package/dist/Server.js CHANGED
@@ -64,7 +64,9 @@ class HandledServer {
64
64
  return;
65
65
  }
66
66
  const stream = !!this._options.stream;
67
- res[context.streamSymbol] = stream;
67
+ if (res && context.streamSymbol) {
68
+ res[context.streamSymbol] = stream;
69
+ }
68
70
  cb(null, res);
69
71
  };
70
72
  }
@@ -4,8 +4,11 @@ type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
4
4
  type IsAny<T> = IfAny<T, true, never>;
5
5
  type InferInput<R> = R extends Action<infer I, any, any, any, any> ? I : any;
6
6
  type InferOutput<R> = R extends Action<any, infer O, any, any, any> ? ToPrettyJson<O> : never;
7
+ type IsEmptyObject<T> = keyof T extends never ? true : false;
7
8
  type ServerClient<TServer extends AnyServer> = {
8
- readonly [Property in keyof TServer['actions']]: (input: Prettify<InferInput<TServer['actions'][Property]> & (IsAny<GetMiddlewareInput<TServer>> extends never ? GetMiddlewareInput<TServer> : {})>) => Promise<InferOutput<TServer['actions'][Property]>>;
9
+ readonly [Property in keyof TServer['actions']]: (...args: IsEmptyObject<Prettify<InferInput<TServer['actions'][Property]> & (IsAny<GetMiddlewareInput<TServer>> extends never ? GetMiddlewareInput<TServer> : {})>> extends true ? [] : [
10
+ Prettify<InferInput<TServer['actions'][Property]> & (IsAny<GetMiddlewareInput<TServer>> extends never ? GetMiddlewareInput<TServer> : {})>
11
+ ]) => Promise<InferOutput<TServer['actions'][Property]>>;
9
12
  };
10
13
  export declare const serverClient: ServerClient<RegisteredServer>;
11
14
  export type ActionOutput<K extends keyof typeof serverClient> = Awaited<ReturnType<(typeof serverClient)[K]>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-server",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",