@zwa73/utils 1.0.256 → 1.0.257

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.
@@ -45,5 +45,5 @@ declare class _UtilFunc {
45
45
  /**获取当前公网ipv4 */
46
46
  static getPublicIpv4(): Promise<string>;
47
47
  }
48
- export declare const UtilFunc: import("@zwa73/modular-mixer").ComposedClass<typeof _UtilFunc, typeof JsFunc, "__jsUtils", "match" | "failed" | "success" | "prototype" | "genUUID" | "range" | "preset" | "getTime" | "initField" | "initObject" | "afterward" | "sleep" | "getNeverResolvedPromise" | "retryPromise" | "timelimitPromise" | "mapEntries" | "eachField" | "stringifyJToken" | "assertType" | "assertLiteral" | "deepClone" | "isSafeNumber" | "dedent" | "throwError" | "getFuncLoc" | "cachePool" | "memoize" | "asyncize" | "lazyFunction" | "splitToChunk" | "mergeFromChunk" | "structEqual" | "concurrent" | "dynamicImport" | "createInjectable" | "checkSharpSchema" | "outcome" | "extractOutcome" | "isStatus" | "eitherize" | "parseSrtTime" | "formatSrtTime" | "parseSrt" | "createSrt" | "ivk" | "s2l" | "l2s">;
48
+ export declare const UtilFunc: import("@zwa73/modular-mixer").ComposedClass<typeof _UtilFunc, typeof JsFunc, "__jsUtils", "match" | "failed" | "success" | "prototype" | "genUUID" | "range" | "preset" | "mergeOption" | "getTime" | "initField" | "initObject" | "afterward" | "sleep" | "getNeverResolvedPromise" | "retryPromise" | "timelimitPromise" | "mapEntries" | "eachField" | "stringifyJToken" | "assertType" | "assertLiteral" | "deepClone" | "isSafeNumber" | "dedent" | "throwError" | "getFuncLoc" | "cachePool" | "memoize" | "asyncize" | "lazyFunction" | "splitToChunk" | "mergeFromChunk" | "structEqual" | "concurrent" | "dynamicImport" | "createInjectable" | "checkSharpSchema" | "outcome" | "extractOutcome" | "isStatus" | "eitherize" | "parseSrtTime" | "formatSrtTime" | "parseSrt" | "createSrt" | "ivk" | "s2l" | "l2s">;
49
49
  export type UtilFunc = typeof UtilFunc;
package/dist/UtilHttp.js CHANGED
@@ -16,6 +16,10 @@ const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
16
16
  const js_utils_1 = require("@zwa73/js-utils");
17
17
  const fs_1 = __importDefault(require("fs"));
18
18
  const pathe_1 = __importDefault(require("pathe"));
19
+ const RequestDefOption = {
20
+ logLevel: 'http',
21
+ timeout: 0,
22
+ };
19
23
  const SendNoneProc = {
20
24
  proc: req => void req.end()
21
25
  };
@@ -352,7 +356,7 @@ class UtilHttp {
352
356
  * @param datas - 数据对象
353
357
  */
354
358
  async once(arg) {
355
- const fullopt = { ...this._data, ...arg.option ?? {} };
359
+ const fullopt = UtilFunctions_1.UtilFunc.mergeOption(RequestDefOption, { ...this._data, ...arg.option ?? {} });
356
360
  const sendProc = typeof this._send === 'function'
357
361
  ? await this._send(fullopt, arg)
358
362
  : this._send;
@@ -384,7 +388,7 @@ class UtilHttp {
384
388
  static async request(option, sendProc, acceptProc) {
385
389
  const { reduce: reqReduce, init: reqInit } = acceptProc;
386
390
  const { proc: reqProc } = sendProc;
387
- const { protocol, logLevel = 'http', timeout = 0, ...baseReqOpt } = option;
391
+ const { protocol, logLevel, timeout, ...baseReqOpt } = UtilFunctions_1.UtilFunc.mergeOption(RequestDefOption, option);
388
392
  const plusTimeout = timeout + 1000;
389
393
  const hasTimeLimit = timeout >= 10_000;
390
394
  const flagName = `UtilCom.request ${protocol}${baseReqOpt.method} ${UtilFunctions_1.UtilFunc.genUUID()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.256",
3
+ "version": "1.0.257",
4
4
  "description": "my utils",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {