xjs-common 9.1.1 → 9.1.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.
@@ -72,15 +72,15 @@ var UString;
72
72
  }
73
73
  UString.is_yyyyMMdd = is_yyyyMMdd;
74
74
  function is_yyyyMMddhh(v) {
75
- return !!v?.match(/^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|[3][0-1])(0[1-9]|1\d|2[0-3])$/);
75
+ return !!v?.match(/^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|[3][0-1])([01]\d|2[0-3])$/);
76
76
  }
77
77
  UString.is_yyyyMMddhh = is_yyyyMMddhh;
78
78
  function is_yyyyMMddhhmm(v) {
79
- return !!v?.match(/^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|[3][0-1])(0[1-9]|1\d|2[0-3])[0-5]\d$/);
79
+ return !!v?.match(/^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|[3][0-1])([01]\d|2[0-3])[0-5]\d$/);
80
80
  }
81
81
  UString.is_yyyyMMddhhmm = is_yyyyMMddhhmm;
82
82
  function is_yyyyMMddhhmmss(v) {
83
- return !!v?.match(/^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|[3][0-1])(0[1-9]|1\d|2[0-3])[0-5]\d[0-5]\d$/);
83
+ return !!v?.match(/^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|[3][0-1])([01]\d|2[0-3])[0-5]\d[0-5]\d$/);
84
84
  }
85
85
  UString.is_yyyyMMddhhmmss = is_yyyyMMddhhmmss;
86
86
  })(UString = exports.UString || (exports.UString = {}));
@@ -3,7 +3,7 @@ import { ClientOption, HttpResponse, IHttpClient, RequestOption } from "./i-http
3
3
  import { Loggable } from "../../const/types";
4
4
  export declare const s_clientMode: Record<string, ClientMode>;
5
5
  export declare class HttpResolverContext implements IHttpClient {
6
- private readonly _cmv;
6
+ readonly cmv: number;
7
7
  private _l;
8
8
  private readonly _als;
9
9
  private readonly _mode;
@@ -11,7 +11,8 @@ export declare class HttpResolverContext implements IHttpClient {
11
11
  private readonly _proxyConfig?;
12
12
  private readonly _chHeaders;
13
13
  private _cookies?;
14
- constructor(_cmv: number, op?: ClientOption, _l?: Loggable);
14
+ get clientMode(): string;
15
+ constructor(cmv: number, op?: ClientOption, _l?: Loggable);
15
16
  /**
16
17
  * request GET to the url.
17
18
  * @param url target url.
@@ -83,7 +83,7 @@ const s_mode2headers = new Map([
83
83
  }]
84
84
  ]);
85
85
  class HttpResolverContext {
86
- _cmv;
86
+ cmv;
87
87
  _l;
88
88
  _als = new async_hooks_1.AsyncLocalStorage();
89
89
  _mode;
@@ -91,14 +91,14 @@ class HttpResolverContext {
91
91
  _proxyConfig;
92
92
  _chHeaders;
93
93
  _cookies;
94
- constructor(_cmv, op, _l = console) {
95
- this._cmv = _cmv;
94
+ get clientMode() { return Object.keys(exports.s_clientMode).find((_, i) => i === this._mode.id); }
95
+ constructor(cmv, op, _l = console) {
96
+ this.cmv = cmv;
96
97
  this._l = _l;
97
98
  this._mode = op?.mode ?? u_array_1.UArray.randomPick([exports.s_clientMode.chrome, exports.s_clientMode.firefox]);
98
99
  this._ciphers = this.createCiphers(this._mode);
99
100
  this._proxyConfig = op?.proxy;
100
- this._chHeaders = s_mode2headers.get(this._mode)(this._cmv);
101
- this._l.log(`Context launched with ${Object.keys(exports.s_clientMode).find((_, i) => i === this._mode.id)}:${this._cmv}.`);
101
+ this._chHeaders = s_mode2headers.get(this._mode)(this.cmv);
102
102
  }
103
103
  /**
104
104
  * request GET to the url.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xjs-common",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
4
4
  "description": "library modules for nodejs + typescript that bundled general-purpose implementations.",
5
5
  "repository": {
6
6
  "type": "git",