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.
- package/dist/common/request.d.ts +8 -8
- package/dist/common/request.js +0 -21
- package/dist/common/types.d.ts +1 -1
- package/dist/esm/request.d.ts +8 -8
- package/dist/esm/request.js +0 -21
- package/dist/esm/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/common/request.d.ts
CHANGED
|
@@ -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
|
|
58
|
-
POST: (url
|
|
59
|
-
PUT: (url
|
|
60
|
-
DELETE: (url
|
|
61
|
-
OPTIONS: (url
|
|
62
|
-
HEAD: (url
|
|
63
|
-
PATCH: (url
|
|
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 {};
|
package/dist/common/request.js
CHANGED
|
@@ -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();
|
package/dist/common/types.d.ts
CHANGED
|
@@ -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,
|
|
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/dist/esm/request.d.ts
CHANGED
|
@@ -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
|
|
58
|
-
POST: (url
|
|
59
|
-
PUT: (url
|
|
60
|
-
DELETE: (url
|
|
61
|
-
OPTIONS: (url
|
|
62
|
-
HEAD: (url
|
|
63
|
-
PATCH: (url
|
|
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 {};
|
package/dist/esm/request.js
CHANGED
|
@@ -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();
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -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,
|
|
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>>;
|