utils-lib-js 1.7.22 → 2.0.0
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/README.en.md +12 -6
- package/README.md +8 -6
- package/dist/bundle/index.d.ts +0 -2
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/types.d.ts +0 -54
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +1 -230
- package/dist/cjs/types.d.ts +0 -54
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.js +2 -230
- package/dist/esm/types.d.ts +0 -54
- package/dist/umd/index.d.ts +0 -2
- package/dist/umd/index.js +1 -230
- package/dist/umd/types.d.ts +0 -54
- package/package.json +48 -49
- package/dist/bundle/request.d.ts +0 -60
- package/dist/cjs/request.d.ts +0 -60
- package/dist/esm/request.d.ts +0 -60
- package/dist/umd/request.d.ts +0 -60
- package/pnpm-lock.yaml +0 -423
package/package.json
CHANGED
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "utils-lib-js",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "JavaScript工具函数,封装的一些常用的js函数",
|
|
5
|
-
"main": "./dist/cjs/index.js",
|
|
6
|
-
"types": "./dist/cjs/index.d.ts",
|
|
7
|
-
"module": "./dist/esm/index.js",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"exports": {
|
|
10
|
-
"import": "./dist/esm/index.js",
|
|
11
|
-
"require": "./dist/cjs/index.js"
|
|
12
|
-
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "utils-lib-js",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "JavaScript工具函数,封装的一些常用的js函数",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"types": "./dist/cjs/index.d.ts",
|
|
7
|
+
"module": "./dist/esm/index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"require": "./dist/cjs/index.js"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://gitee.com/DieHunter/utils-lib-js.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"utils",
|
|
19
|
+
"tools",
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@rollup/plugin-alias": "^4.0.3",
|
|
26
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
27
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
28
|
+
"@types/node": "^18.7.15",
|
|
29
|
+
"rollup": "^3.20.2",
|
|
30
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
31
|
+
"tslib": "^2.5.0",
|
|
32
|
+
"typescript": "^4.9.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"event-message-center": "^1.3.2",
|
|
36
|
+
"task-queue-lib": "^1.2.0"
|
|
37
|
+
},
|
|
38
|
+
"umdModuleName": "UtilsLib",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"debug": "start cmd /k pnpm run build:hot & pnpm run node:hot",
|
|
41
|
+
"node:hot": "nodemon example.js --watch example.js",
|
|
42
|
+
"build:hot": "pnpm rollup -c --watch",
|
|
43
|
+
"build": "pnpm run rollup:build && pnpm run commonjs",
|
|
44
|
+
"rollup:build": "rm -fr dist && pnpm rollup -c",
|
|
45
|
+
"build:publish": "pnpm run build && pnpm publish",
|
|
46
|
+
"commonjs": "cp ./commonjs.json dist/cjs/package.json"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/dist/bundle/request.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions, IRequestBaseFn, IEnv } from "./types";
|
|
2
|
-
declare class Interceptors implements IInterceptors {
|
|
3
|
-
private requestSuccess;
|
|
4
|
-
private responseSuccess;
|
|
5
|
-
private error;
|
|
6
|
-
use(type: "request" | "response" | "error", fn: Function): IInterceptors;
|
|
7
|
-
get reqFn(): Function;
|
|
8
|
-
get resFn(): Function;
|
|
9
|
-
get errFn(): Function;
|
|
10
|
-
}
|
|
11
|
-
declare abstract class RequestBase extends Interceptors implements IRequestBase {
|
|
12
|
-
readonly origin: IUrl;
|
|
13
|
-
constructor(origin: IUrl);
|
|
14
|
-
abstract fetch(url: string, opts: IRequestOptions): Promise<void>;
|
|
15
|
-
abstract http(url: string, opts: IRequestOptions): Promise<void>;
|
|
16
|
-
chackUrl: (url: IUrl) => boolean;
|
|
17
|
-
checkIsHttps: (url: IUrl) => boolean;
|
|
18
|
-
fixOrigin: (fixStr: string) => string;
|
|
19
|
-
envDesc: () => IEnv;
|
|
20
|
-
errorFn: (reject: any) => (err: any) => any;
|
|
21
|
-
clearTimer: (opts: any) => any;
|
|
22
|
-
initAbort: (params: IRequestOptions) => IRequestOptions;
|
|
23
|
-
requestType: () => IRequestBaseFn;
|
|
24
|
-
getDataByType: (type: any, response: any) => any;
|
|
25
|
-
formatBodyString: (bodyString: string) => IObject<Function>;
|
|
26
|
-
}
|
|
27
|
-
declare abstract class RequestInit extends RequestBase implements IRequestInit {
|
|
28
|
-
constructor(origin: any);
|
|
29
|
-
abstract fetch(url: any, opts: any): Promise<void>;
|
|
30
|
-
abstract http(url: any, opts: any): Promise<void>;
|
|
31
|
-
initDefaultParams: (url: IUrl, { method, query, headers, body, timeout, controller, type, ...others }: {
|
|
32
|
-
[x: string]: any;
|
|
33
|
-
method?: string;
|
|
34
|
-
query?: {};
|
|
35
|
-
headers?: {};
|
|
36
|
-
body?: any;
|
|
37
|
-
timeout?: number;
|
|
38
|
-
controller?: any;
|
|
39
|
-
type?: string;
|
|
40
|
-
}) => IRequestOptions;
|
|
41
|
-
initFetchParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
42
|
-
initHttpParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
43
|
-
}
|
|
44
|
-
export declare class Request extends RequestInit implements IRequest {
|
|
45
|
-
private request;
|
|
46
|
-
constructor(origin: any);
|
|
47
|
-
fetch: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
48
|
-
http: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
49
|
-
GET: (url?: IUrl, query?: IObject<any>, _?: IRequestBody | void, opts?: IRequestOptions) => any;
|
|
50
|
-
POST: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
51
|
-
PUT: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
52
|
-
DELETE: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
53
|
-
OPTIONS: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
54
|
-
HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
55
|
-
PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
56
|
-
}
|
|
57
|
-
declare const _default: {
|
|
58
|
-
Request: typeof Request;
|
|
59
|
-
};
|
|
60
|
-
export default _default;
|
package/dist/cjs/request.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions, IRequestBaseFn, IEnv } from "./types";
|
|
2
|
-
declare class Interceptors implements IInterceptors {
|
|
3
|
-
private requestSuccess;
|
|
4
|
-
private responseSuccess;
|
|
5
|
-
private error;
|
|
6
|
-
use(type: "request" | "response" | "error", fn: Function): IInterceptors;
|
|
7
|
-
get reqFn(): Function;
|
|
8
|
-
get resFn(): Function;
|
|
9
|
-
get errFn(): Function;
|
|
10
|
-
}
|
|
11
|
-
declare abstract class RequestBase extends Interceptors implements IRequestBase {
|
|
12
|
-
readonly origin: IUrl;
|
|
13
|
-
constructor(origin: IUrl);
|
|
14
|
-
abstract fetch(url: string, opts: IRequestOptions): Promise<void>;
|
|
15
|
-
abstract http(url: string, opts: IRequestOptions): Promise<void>;
|
|
16
|
-
chackUrl: (url: IUrl) => boolean;
|
|
17
|
-
checkIsHttps: (url: IUrl) => boolean;
|
|
18
|
-
fixOrigin: (fixStr: string) => string;
|
|
19
|
-
envDesc: () => IEnv;
|
|
20
|
-
errorFn: (reject: any) => (err: any) => any;
|
|
21
|
-
clearTimer: (opts: any) => any;
|
|
22
|
-
initAbort: (params: IRequestOptions) => IRequestOptions;
|
|
23
|
-
requestType: () => IRequestBaseFn;
|
|
24
|
-
getDataByType: (type: any, response: any) => any;
|
|
25
|
-
formatBodyString: (bodyString: string) => IObject<Function>;
|
|
26
|
-
}
|
|
27
|
-
declare abstract class RequestInit extends RequestBase implements IRequestInit {
|
|
28
|
-
constructor(origin: any);
|
|
29
|
-
abstract fetch(url: any, opts: any): Promise<void>;
|
|
30
|
-
abstract http(url: any, opts: any): Promise<void>;
|
|
31
|
-
initDefaultParams: (url: IUrl, { method, query, headers, body, timeout, controller, type, ...others }: {
|
|
32
|
-
[x: string]: any;
|
|
33
|
-
method?: string;
|
|
34
|
-
query?: {};
|
|
35
|
-
headers?: {};
|
|
36
|
-
body?: any;
|
|
37
|
-
timeout?: number;
|
|
38
|
-
controller?: any;
|
|
39
|
-
type?: string;
|
|
40
|
-
}) => IRequestOptions;
|
|
41
|
-
initFetchParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
42
|
-
initHttpParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
43
|
-
}
|
|
44
|
-
export declare class Request extends RequestInit implements IRequest {
|
|
45
|
-
private request;
|
|
46
|
-
constructor(origin: any);
|
|
47
|
-
fetch: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
48
|
-
http: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
49
|
-
GET: (url?: IUrl, query?: IObject<any>, _?: IRequestBody | void, opts?: IRequestOptions) => any;
|
|
50
|
-
POST: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
51
|
-
PUT: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
52
|
-
DELETE: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
53
|
-
OPTIONS: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
54
|
-
HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
55
|
-
PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
56
|
-
}
|
|
57
|
-
declare const _default: {
|
|
58
|
-
Request: typeof Request;
|
|
59
|
-
};
|
|
60
|
-
export default _default;
|
package/dist/esm/request.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions, IRequestBaseFn, IEnv } from "./types";
|
|
2
|
-
declare class Interceptors implements IInterceptors {
|
|
3
|
-
private requestSuccess;
|
|
4
|
-
private responseSuccess;
|
|
5
|
-
private error;
|
|
6
|
-
use(type: "request" | "response" | "error", fn: Function): IInterceptors;
|
|
7
|
-
get reqFn(): Function;
|
|
8
|
-
get resFn(): Function;
|
|
9
|
-
get errFn(): Function;
|
|
10
|
-
}
|
|
11
|
-
declare abstract class RequestBase extends Interceptors implements IRequestBase {
|
|
12
|
-
readonly origin: IUrl;
|
|
13
|
-
constructor(origin: IUrl);
|
|
14
|
-
abstract fetch(url: string, opts: IRequestOptions): Promise<void>;
|
|
15
|
-
abstract http(url: string, opts: IRequestOptions): Promise<void>;
|
|
16
|
-
chackUrl: (url: IUrl) => boolean;
|
|
17
|
-
checkIsHttps: (url: IUrl) => boolean;
|
|
18
|
-
fixOrigin: (fixStr: string) => string;
|
|
19
|
-
envDesc: () => IEnv;
|
|
20
|
-
errorFn: (reject: any) => (err: any) => any;
|
|
21
|
-
clearTimer: (opts: any) => any;
|
|
22
|
-
initAbort: (params: IRequestOptions) => IRequestOptions;
|
|
23
|
-
requestType: () => IRequestBaseFn;
|
|
24
|
-
getDataByType: (type: any, response: any) => any;
|
|
25
|
-
formatBodyString: (bodyString: string) => IObject<Function>;
|
|
26
|
-
}
|
|
27
|
-
declare abstract class RequestInit extends RequestBase implements IRequestInit {
|
|
28
|
-
constructor(origin: any);
|
|
29
|
-
abstract fetch(url: any, opts: any): Promise<void>;
|
|
30
|
-
abstract http(url: any, opts: any): Promise<void>;
|
|
31
|
-
initDefaultParams: (url: IUrl, { method, query, headers, body, timeout, controller, type, ...others }: {
|
|
32
|
-
[x: string]: any;
|
|
33
|
-
method?: string;
|
|
34
|
-
query?: {};
|
|
35
|
-
headers?: {};
|
|
36
|
-
body?: any;
|
|
37
|
-
timeout?: number;
|
|
38
|
-
controller?: any;
|
|
39
|
-
type?: string;
|
|
40
|
-
}) => IRequestOptions;
|
|
41
|
-
initFetchParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
42
|
-
initHttpParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
43
|
-
}
|
|
44
|
-
export declare class Request extends RequestInit implements IRequest {
|
|
45
|
-
private request;
|
|
46
|
-
constructor(origin: any);
|
|
47
|
-
fetch: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
48
|
-
http: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
49
|
-
GET: (url?: IUrl, query?: IObject<any>, _?: IRequestBody | void, opts?: IRequestOptions) => any;
|
|
50
|
-
POST: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
51
|
-
PUT: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
52
|
-
DELETE: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
53
|
-
OPTIONS: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
54
|
-
HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
55
|
-
PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
56
|
-
}
|
|
57
|
-
declare const _default: {
|
|
58
|
-
Request: typeof Request;
|
|
59
|
-
};
|
|
60
|
-
export default _default;
|
package/dist/umd/request.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions, IRequestBaseFn, IEnv } from "./types";
|
|
2
|
-
declare class Interceptors implements IInterceptors {
|
|
3
|
-
private requestSuccess;
|
|
4
|
-
private responseSuccess;
|
|
5
|
-
private error;
|
|
6
|
-
use(type: "request" | "response" | "error", fn: Function): IInterceptors;
|
|
7
|
-
get reqFn(): Function;
|
|
8
|
-
get resFn(): Function;
|
|
9
|
-
get errFn(): Function;
|
|
10
|
-
}
|
|
11
|
-
declare abstract class RequestBase extends Interceptors implements IRequestBase {
|
|
12
|
-
readonly origin: IUrl;
|
|
13
|
-
constructor(origin: IUrl);
|
|
14
|
-
abstract fetch(url: string, opts: IRequestOptions): Promise<void>;
|
|
15
|
-
abstract http(url: string, opts: IRequestOptions): Promise<void>;
|
|
16
|
-
chackUrl: (url: IUrl) => boolean;
|
|
17
|
-
checkIsHttps: (url: IUrl) => boolean;
|
|
18
|
-
fixOrigin: (fixStr: string) => string;
|
|
19
|
-
envDesc: () => IEnv;
|
|
20
|
-
errorFn: (reject: any) => (err: any) => any;
|
|
21
|
-
clearTimer: (opts: any) => any;
|
|
22
|
-
initAbort: (params: IRequestOptions) => IRequestOptions;
|
|
23
|
-
requestType: () => IRequestBaseFn;
|
|
24
|
-
getDataByType: (type: any, response: any) => any;
|
|
25
|
-
formatBodyString: (bodyString: string) => IObject<Function>;
|
|
26
|
-
}
|
|
27
|
-
declare abstract class RequestInit extends RequestBase implements IRequestInit {
|
|
28
|
-
constructor(origin: any);
|
|
29
|
-
abstract fetch(url: any, opts: any): Promise<void>;
|
|
30
|
-
abstract http(url: any, opts: any): Promise<void>;
|
|
31
|
-
initDefaultParams: (url: IUrl, { method, query, headers, body, timeout, controller, type, ...others }: {
|
|
32
|
-
[x: string]: any;
|
|
33
|
-
method?: string;
|
|
34
|
-
query?: {};
|
|
35
|
-
headers?: {};
|
|
36
|
-
body?: any;
|
|
37
|
-
timeout?: number;
|
|
38
|
-
controller?: any;
|
|
39
|
-
type?: string;
|
|
40
|
-
}) => IRequestOptions;
|
|
41
|
-
initFetchParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
42
|
-
initHttpParams: (url: IUrl, opts: IRequestOptions) => any;
|
|
43
|
-
}
|
|
44
|
-
export declare class Request extends RequestInit implements IRequest {
|
|
45
|
-
private request;
|
|
46
|
-
constructor(origin: any);
|
|
47
|
-
fetch: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
48
|
-
http: (_url: string, _opts: IRequestOptions) => Promise<any>;
|
|
49
|
-
GET: (url?: IUrl, query?: IObject<any>, _?: IRequestBody | void, opts?: IRequestOptions) => any;
|
|
50
|
-
POST: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
51
|
-
PUT: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
52
|
-
DELETE: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
53
|
-
OPTIONS: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
54
|
-
HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
55
|
-
PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
|
|
56
|
-
}
|
|
57
|
-
declare const _default: {
|
|
58
|
-
Request: typeof Request;
|
|
59
|
-
};
|
|
60
|
-
export default _default;
|