@jayfong/x-server 2.108.2 → 2.108.4

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.
@@ -58,10 +58,7 @@ class JwtService {
58
58
  if (!authorization) {
59
59
  throw new _http_error.HttpError.Unauthorized('header');
60
60
  }
61
- const [scheme, token] = authorization.split(' ');
62
- if (scheme.toLowerCase() !== 'bearer') {
63
- throw new _http_error.HttpError.Unauthorized('bearer');
64
- }
61
+ const [scheme, token = scheme] = authorization.split(' ');
65
62
  return this.verify(token);
66
63
  }
67
64
  }
@@ -13,7 +13,10 @@ export declare namespace defineHandler {
13
13
  }; }, void, "WS">) => Handler<{ [K in keyof TReqData]: {
14
14
  request: TReqData[K][0];
15
15
  response: TReqData[K][1];
16
- }; }, void, "WS">;
16
+ }; }, void, "WS", import("vtils/types").RequiredDeep<{ [K in keyof TReqData]: {
17
+ request: TReqData[K][0];
18
+ response: TReqData[K][1];
19
+ }; }>>;
17
20
  var XML: typeof defineHandlerXML;
18
21
  var ANY: typeof defineHandlerANY;
19
22
  }
@@ -1,10 +1,11 @@
1
+ import type { RequiredDeep } from 'vtils/types';
1
2
  import * as vae from 'vtils/vae';
2
3
  import type { XHandler } from './types';
3
4
  export type { HandlerMethodMap, HandlerPath, HandlerPayloadMap, HandlerResultMap, } from '.x/routes';
4
- export declare class Handler<TReqData extends any = void, TResData extends any = void, TReqMethod extends XHandler.Method = XHandler.Method> {
5
+ export declare class Handler<TReqData extends any = void, TResData extends any = void, TReqMethod extends XHandler.Method = XHandler.Method, TReqDataRequired = RequiredDeep<TReqData>> {
5
6
  readonly options: XHandler.Options<TReqData, TResData, TReqMethod>;
6
7
  private requestDataSchema;
7
- readonly requestDataSchemaVae: vae.VaeSchemaOf<TReqData> | undefined;
8
+ readonly requestDataSchemaVae: vae.VaeSchemaOf<TReqDataRequired>;
8
9
  constructor(options: XHandler.Options<TReqData, TResData, TReqMethod>);
9
10
  handle: XHandler.Handle<TReqData, TResData, TReqMethod>;
10
11
  private handleHttp;
@@ -1,6 +1,6 @@
1
1
  import { HTTPError as GotHTTPError, ParseError as GotParseError, RequestError as GotRequestError, TimeoutError as GotTimeoutError } from 'got';
2
2
  import LZString from 'lz-string';
3
- import { DataPacker, base64UrlEncode, rot13, toSingleLineString } from 'vtils';
3
+ import { base64UrlEncode, DataPacker, rot13, toSingleLineString } from 'vtils';
4
4
  import * as vae from 'vtils/vae';
5
5
  import { getZhCN, yup } from 'vtils/validator';
6
6
  import { HttpError } from "../core/http_error";
@@ -53,10 +53,7 @@ export class JwtService {
53
53
  if (!authorization) {
54
54
  throw new HttpError.Unauthorized('header');
55
55
  }
56
- const [scheme, token] = authorization.split(' ');
57
- if (scheme.toLowerCase() !== 'bearer') {
58
- throw new HttpError.Unauthorized('bearer');
59
- }
56
+ const [scheme, token = scheme] = authorization.split(' ');
60
57
  return this.verify(token);
61
58
  }
62
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.108.2",
3
+ "version": "2.108.4",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",