utils-lib-js 1.0.8 → 1.0.9

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,4 +1,4 @@
1
- import { IRequest, IRequestBase, IRequestInit, IInterceptors } from "./index.js";
1
+ import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions } from "./index.js";
2
2
  declare class Interceptors implements IInterceptors {
3
3
  private requestSuccess;
4
4
  private responseSuccess;
@@ -54,12 +54,12 @@ export declare class Request extends RequestInit implements IRequest {
54
54
  constructor(origin: any);
55
55
  fetch: (_url: any, _opts: any) => Promise<void>;
56
56
  http: (_url: any, _opts: any) => Promise<void>;
57
- GET: (url: any, query: {}, _: any, opts: any) => any;
58
- POST: (url: any, query: {}, body: any, opts: any) => any;
59
- PUT: (url: any, query: {}, body: any, opts: any) => any;
60
- DELETE: (url: any, query: {}, body: any, opts: any) => any;
61
- OPTIONS: (url: any, query: {}, body: any, opts: any) => any;
62
- HEAD: (url: any, query: {}, body: any, opts: any) => any;
63
- PATCH: (url: any, query: {}, body: any, opts: any) => any;
57
+ GET: (url?: IUrl, query?: IObject<any>, _?: IRequestBody | void, opts?: IRequestOptions) => any;
58
+ POST: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
59
+ PUT: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
60
+ DELETE: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
61
+ OPTIONS: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
62
+ HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
63
+ PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
64
64
  }
65
65
  export {};
@@ -232,45 +232,24 @@ var Request = function (_super) {
232
232
  return promise;
233
233
  };
234
234
  _this.GET = function (url, query, _, opts) {
235
- if (query === void 0) {
236
- query = {};
237
- }
238
235
  return _this.request(url, __assign({ query: query, method: "GET" }, opts));
239
236
  };
240
237
  _this.POST = function (url, query, body, opts) {
241
- if (query === void 0) {
242
- query = {};
243
- }
244
238
  return _this.request(url, __assign({ query: query, method: "POST", body: body }, opts));
245
239
  };
246
240
  _this.PUT = function (url, query, body, opts) {
247
- if (query === void 0) {
248
- query = {};
249
- }
250
241
  return _this.request(url, __assign({ query: query, method: "PUT", body: body }, opts));
251
242
  };
252
243
  _this.DELETE = function (url, query, body, opts) {
253
- if (query === void 0) {
254
- query = {};
255
- }
256
244
  return _this.request(url, __assign({ query: query, method: "DELETE", body: body }, opts));
257
245
  };
258
246
  _this.OPTIONS = function (url, query, body, opts) {
259
- if (query === void 0) {
260
- query = {};
261
- }
262
247
  return _this.request(url, __assign({ query: query, method: "OPTIONS", body: body }, opts));
263
248
  };
264
249
  _this.HEAD = function (url, query, body, opts) {
265
- if (query === void 0) {
266
- query = {};
267
- }
268
250
  return _this.request(url, __assign({ query: query, method: "HEAD", body: body }, opts));
269
251
  };
270
252
  _this.PATCH = function (url, query, body, opts) {
271
- if (query === void 0) {
272
- query = {};
273
- }
274
253
  return _this.request(url, __assign({ query: query, method: "PATCH", body: body }, opts));
275
254
  };
276
255
  _this.request = _this.requestType();
@@ -55,7 +55,7 @@ export declare type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTIO
55
55
  export declare type IRequestBody = IRequestParams<BodyInit>;
56
56
  export declare type IRequestHeaders = IRequestParams<HeadersInit>;
57
57
  export declare type IRequestBaseFn = (url: IUrl, opts: IRequestOptions) => Promise<any>;
58
- export declare type IRequestFn = (url?: IUrl, params?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => Promise<any>;
58
+ export declare type IRequestFn = (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => Promise<any>;
59
59
  export declare type IRequestOptions = {
60
60
  method?: IRequestMethods;
61
61
  query?: IRequestParams<IObject<any>>;
@@ -1,4 +1,4 @@
1
- import { IRequest, IRequestBase, IRequestInit, IInterceptors } from "./index.js";
1
+ import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions } from "./index.js";
2
2
  declare class Interceptors implements IInterceptors {
3
3
  private requestSuccess;
4
4
  private responseSuccess;
@@ -54,12 +54,12 @@ export declare class Request extends RequestInit implements IRequest {
54
54
  constructor(origin: any);
55
55
  fetch: (_url: any, _opts: any) => Promise<void>;
56
56
  http: (_url: any, _opts: any) => Promise<void>;
57
- GET: (url: any, query: {}, _: any, opts: any) => any;
58
- POST: (url: any, query: {}, body: any, opts: any) => any;
59
- PUT: (url: any, query: {}, body: any, opts: any) => any;
60
- DELETE: (url: any, query: {}, body: any, opts: any) => any;
61
- OPTIONS: (url: any, query: {}, body: any, opts: any) => any;
62
- HEAD: (url: any, query: {}, body: any, opts: any) => any;
63
- PATCH: (url: any, query: {}, body: any, opts: any) => any;
57
+ GET: (url?: IUrl, query?: IObject<any>, _?: IRequestBody | void, opts?: IRequestOptions) => any;
58
+ POST: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
59
+ PUT: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
60
+ DELETE: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
61
+ OPTIONS: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
62
+ HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
63
+ PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
64
64
  }
65
65
  export {};
@@ -228,45 +228,24 @@ var Request = function (_super) {
228
228
  return promise;
229
229
  };
230
230
  _this.GET = function (url, query, _, opts) {
231
- if (query === void 0) {
232
- query = {};
233
- }
234
231
  return _this.request(url, __assign({ query: query, method: "GET" }, opts));
235
232
  };
236
233
  _this.POST = function (url, query, body, opts) {
237
- if (query === void 0) {
238
- query = {};
239
- }
240
234
  return _this.request(url, __assign({ query: query, method: "POST", body: body }, opts));
241
235
  };
242
236
  _this.PUT = function (url, query, body, opts) {
243
- if (query === void 0) {
244
- query = {};
245
- }
246
237
  return _this.request(url, __assign({ query: query, method: "PUT", body: body }, opts));
247
238
  };
248
239
  _this.DELETE = function (url, query, body, opts) {
249
- if (query === void 0) {
250
- query = {};
251
- }
252
240
  return _this.request(url, __assign({ query: query, method: "DELETE", body: body }, opts));
253
241
  };
254
242
  _this.OPTIONS = function (url, query, body, opts) {
255
- if (query === void 0) {
256
- query = {};
257
- }
258
243
  return _this.request(url, __assign({ query: query, method: "OPTIONS", body: body }, opts));
259
244
  };
260
245
  _this.HEAD = function (url, query, body, opts) {
261
- if (query === void 0) {
262
- query = {};
263
- }
264
246
  return _this.request(url, __assign({ query: query, method: "HEAD", body: body }, opts));
265
247
  };
266
248
  _this.PATCH = function (url, query, body, opts) {
267
- if (query === void 0) {
268
- query = {};
269
- }
270
249
  return _this.request(url, __assign({ query: query, method: "PATCH", body: body }, opts));
271
250
  };
272
251
  _this.request = _this.requestType();
@@ -55,7 +55,7 @@ export declare type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTIO
55
55
  export declare type IRequestBody = IRequestParams<BodyInit>;
56
56
  export declare type IRequestHeaders = IRequestParams<HeadersInit>;
57
57
  export declare type IRequestBaseFn = (url: IUrl, opts: IRequestOptions) => Promise<any>;
58
- export declare type IRequestFn = (url?: IUrl, params?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => Promise<any>;
58
+ export declare type IRequestFn = (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => Promise<any>;
59
59
  export declare type IRequestOptions = {
60
60
  method?: IRequestMethods;
61
61
  query?: IRequestParams<IObject<any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utils-lib-js",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "JavaScript工具函数,封装的一些常用的js函数",
5
5
  "main": "./dist/common/index.js",
6
6
  "types": "./dist/common/index.d.ts",