utils-lib-js 1.7.0 → 1.7.2
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/bundle/array.d.ts +10 -10
- package/dist/bundle/base.d.ts +14 -14
- package/dist/bundle/element.d.ts +6 -6
- package/dist/bundle/event.d.ts +14 -14
- package/dist/bundle/function.d.ts +12 -12
- package/dist/bundle/index.d.ts +55 -55
- package/dist/bundle/object.d.ts +30 -30
- package/dist/bundle/request.d.ts +60 -60
- package/dist/bundle/static.d.ts +16 -16
- package/dist/bundle/storage.d.ts +9 -9
- package/dist/bundle/types.d.ts +103 -103
- package/dist/cjs/array.d.ts +10 -10
- package/dist/cjs/base.d.ts +14 -14
- package/dist/cjs/element.d.ts +6 -6
- package/dist/cjs/event.d.ts +14 -14
- package/dist/cjs/function.d.ts +12 -12
- package/dist/cjs/index.d.ts +55 -55
- package/dist/cjs/index.js +567 -567
- package/dist/cjs/object.d.ts +30 -30
- package/dist/cjs/request.d.ts +60 -60
- package/dist/cjs/static.d.ts +16 -16
- package/dist/cjs/storage.d.ts +9 -9
- package/dist/cjs/types.d.ts +103 -103
- package/dist/esm/array.d.ts +10 -10
- package/dist/esm/base.d.ts +14 -14
- package/dist/esm/element.d.ts +6 -6
- package/dist/esm/event.d.ts +14 -14
- package/dist/esm/function.d.ts +12 -12
- package/dist/esm/index.d.ts +55 -55
- package/dist/esm/index.js +567 -567
- package/dist/esm/object.d.ts +30 -30
- package/dist/esm/request.d.ts +60 -60
- package/dist/esm/static.d.ts +16 -16
- package/dist/esm/storage.d.ts +9 -9
- package/dist/esm/types.d.ts +103 -103
- package/dist/umd/array.d.ts +10 -10
- package/dist/umd/base.d.ts +14 -14
- package/dist/umd/element.d.ts +6 -6
- package/dist/umd/event.d.ts +14 -14
- package/dist/umd/function.d.ts +12 -12
- package/dist/umd/index.d.ts +55 -55
- package/dist/umd/index.js +567 -567
- package/dist/umd/object.d.ts +30 -30
- package/dist/umd/request.d.ts +60 -60
- package/dist/umd/static.d.ts +16 -16
- package/dist/umd/storage.d.ts +9 -9
- package/dist/umd/types.d.ts +103 -103
- package/example.js +2 -0
- package/package.json +49 -54
- package/pnpm-lock.yaml +11 -116
- package/rollup.config.js +2 -5
package/dist/bundle/array.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IArrayRandom, IArrayUniq, IArrayDemote, IDemoteArray } from "./index";
|
|
2
|
-
export declare const arrayRandom: IArrayRandom<any[]>;
|
|
3
|
-
export declare const arrayUniq: IArrayUniq<any[]>;
|
|
4
|
-
export declare const arrayDemote: IArrayDemote<IDemoteArray<any>>;
|
|
5
|
-
declare const _default: {
|
|
6
|
-
arrayRandom: IArrayRandom<any[]>;
|
|
7
|
-
arrayUniq: IArrayUniq<any[]>;
|
|
8
|
-
arrayDemote: IArrayDemote<IDemoteArray<any>>;
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
1
|
+
import { IArrayRandom, IArrayUniq, IArrayDemote, IDemoteArray } from "./index";
|
|
2
|
+
export declare const arrayRandom: IArrayRandom<any[]>;
|
|
3
|
+
export declare const arrayUniq: IArrayUniq<any[]>;
|
|
4
|
+
export declare const arrayDemote: IArrayDemote<IDemoteArray<any>>;
|
|
5
|
+
declare const _default: {
|
|
6
|
+
arrayRandom: IArrayRandom<any[]>;
|
|
7
|
+
arrayUniq: IArrayUniq<any[]>;
|
|
8
|
+
arrayDemote: IArrayDemote<IDemoteArray<any>>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
package/dist/bundle/base.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IRandomNum, IUrlSplit, IUrlJoin, IGetType, IGetTypeByList, types } from "./index";
|
|
2
|
-
export declare const randomNum: IRandomNum;
|
|
3
|
-
export declare const urlSplit: IUrlSplit;
|
|
4
|
-
export declare const urlJoin: IUrlJoin;
|
|
5
|
-
export declare const getType: IGetType<types>;
|
|
6
|
-
export declare const getTypeByList: IGetTypeByList;
|
|
7
|
-
declare const _default: {
|
|
8
|
-
randomNum: IRandomNum;
|
|
9
|
-
urlSplit: IUrlSplit;
|
|
10
|
-
urlJoin: IUrlJoin;
|
|
11
|
-
getType: IGetType<types>;
|
|
12
|
-
getTypeByList: IGetTypeByList;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
|
1
|
+
import { IRandomNum, IUrlSplit, IUrlJoin, IGetType, IGetTypeByList, types } from "./index";
|
|
2
|
+
export declare const randomNum: IRandomNum;
|
|
3
|
+
export declare const urlSplit: IUrlSplit;
|
|
4
|
+
export declare const urlJoin: IUrlJoin;
|
|
5
|
+
export declare const getType: IGetType<types>;
|
|
6
|
+
export declare const getTypeByList: IGetTypeByList;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
randomNum: IRandomNum;
|
|
9
|
+
urlSplit: IUrlSplit;
|
|
10
|
+
urlJoin: IUrlJoin;
|
|
11
|
+
getType: IGetType<types>;
|
|
12
|
+
getTypeByList: IGetTypeByList;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
package/dist/bundle/element.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ICreateElement } from "./index";
|
|
2
|
-
export declare const createElement: ICreateElement;
|
|
3
|
-
declare const _default: {
|
|
4
|
-
createElement: ICreateElement
|
|
5
|
-
};
|
|
6
|
-
export default _default;
|
|
1
|
+
import { ICreateElement } from "./index";
|
|
2
|
+
export declare const createElement: ICreateElement;
|
|
3
|
+
declare const _default: {
|
|
4
|
+
createElement: ICreateElement<HTMLElement>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
package/dist/bundle/event.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IAddHandler, IStopBubble, IStopDefault, IRemoveHandler, IDispatchEvent } from "./index";
|
|
2
|
-
export declare const addHandler: IAddHandler;
|
|
3
|
-
export declare const stopBubble: IStopBubble;
|
|
4
|
-
export declare const stopDefault: IStopDefault;
|
|
5
|
-
export declare const removeHandler: IRemoveHandler;
|
|
6
|
-
export declare const dispatchEvent: IDispatchEvent;
|
|
7
|
-
declare const _default: {
|
|
8
|
-
addHandler: IAddHandler;
|
|
9
|
-
stopBubble: IStopBubble;
|
|
10
|
-
stopDefault: IStopDefault;
|
|
11
|
-
removeHandler: IRemoveHandler;
|
|
12
|
-
dispatchEvent: IDispatchEvent;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
|
1
|
+
import { IAddHandler, IStopBubble, IStopDefault, IRemoveHandler, IDispatchEvent } from "./index";
|
|
2
|
+
export declare const addHandler: IAddHandler;
|
|
3
|
+
export declare const stopBubble: IStopBubble;
|
|
4
|
+
export declare const stopDefault: IStopDefault;
|
|
5
|
+
export declare const removeHandler: IRemoveHandler;
|
|
6
|
+
export declare const dispatchEvent: IDispatchEvent;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
addHandler: IAddHandler;
|
|
9
|
+
stopBubble: IStopBubble;
|
|
10
|
+
stopDefault: IStopDefault;
|
|
11
|
+
removeHandler: IRemoveHandler;
|
|
12
|
+
dispatchEvent: IDispatchEvent;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ICatchAwait, IThrottle, IDebounce, IDefer } from "./index";
|
|
2
|
-
export declare const throttle: IThrottle;
|
|
3
|
-
export declare const debounce: IDebounce;
|
|
4
|
-
export declare const defer: IDefer;
|
|
5
|
-
export declare const catchAwait: ICatchAwait<Promise<any>>;
|
|
6
|
-
declare const _default: {
|
|
7
|
-
throttle: IThrottle;
|
|
8
|
-
debounce: IDebounce;
|
|
9
|
-
defer: IDefer;
|
|
10
|
-
catchAwait: ICatchAwait<Promise<any>>;
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
1
|
+
import { ICatchAwait, IThrottle, IDebounce, IDefer } from "./index";
|
|
2
|
+
export declare const throttle: IThrottle;
|
|
3
|
+
export declare const debounce: IDebounce;
|
|
4
|
+
export declare const defer: IDefer;
|
|
5
|
+
export declare const catchAwait: ICatchAwait<Promise<any>>;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
throttle: IThrottle;
|
|
8
|
+
debounce: IDebounce;
|
|
9
|
+
defer: IDefer;
|
|
10
|
+
catchAwait: ICatchAwait<Promise<any>>;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
package/dist/bundle/index.d.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
export * from "./object";
|
|
2
|
-
export * from "./base";
|
|
3
|
-
export * from "./array";
|
|
4
|
-
export * from "./function";
|
|
5
|
-
export * from "./element";
|
|
6
|
-
export * from "./static";
|
|
7
|
-
export * from "./types";
|
|
8
|
-
export * from "./request";
|
|
9
|
-
export * from "./event";
|
|
10
|
-
export * from "./storage";
|
|
11
|
-
export * from "event-message-center";
|
|
12
|
-
export * from "task-queue-lib";
|
|
13
|
-
import eventMessageCenter from "event-message-center";
|
|
14
|
-
import taskQueueLib from "task-queue-lib";
|
|
15
|
-
declare const _default: {
|
|
16
|
-
eventMessageCenter: typeof eventMessageCenter;
|
|
17
|
-
taskQueueLib: typeof taskQueueLib;
|
|
18
|
-
setStorage: (key: string, val: any) => void;
|
|
19
|
-
getStorage: (key: string) => any;
|
|
20
|
-
clearStorage: (key: string) => void;
|
|
21
|
-
addHandler: import("./types").IAddHandler;
|
|
22
|
-
stopBubble: import("./types").IStopBubble;
|
|
23
|
-
stopDefault: import("./types").IStopDefault;
|
|
24
|
-
removeHandler: import("./types").IRemoveHandler;
|
|
25
|
-
dispatchEvent: import("./types").IDispatchEvent;
|
|
26
|
-
Request: typeof import("./request").Request;
|
|
27
|
-
types: typeof import("./static").types;
|
|
28
|
-
createElement: import("./types").ICreateElement
|
|
29
|
-
throttle: import("./types").IThrottle;
|
|
30
|
-
debounce: import("./types").IDebounce;
|
|
31
|
-
defer: import("./types").IDefer;
|
|
32
|
-
catchAwait: import("./types").ICatchAwait<Promise<any>>;
|
|
33
|
-
arrayRandom: import("./types").IArrayRandom<any[]>;
|
|
34
|
-
arrayUniq: import("./types").IArrayUniq<any[]>;
|
|
35
|
-
arrayDemote: import("./types").IArrayDemote<import("./types").IDemoteArray<any>>;
|
|
36
|
-
randomNum: import("./types").IRandomNum;
|
|
37
|
-
urlSplit: import("./types").IUrlSplit;
|
|
38
|
-
urlJoin: import("./types").IUrlJoin;
|
|
39
|
-
getType: import("./types").IGetType<import("./static").types>;
|
|
40
|
-
getTypeByList: import("./types").IGetTypeByList;
|
|
41
|
-
getValue: import("./types").IGetValue;
|
|
42
|
-
setValue: import("./types").ISetValue;
|
|
43
|
-
mixIn: import("./types").IMixIn;
|
|
44
|
-
enumInversion: import("./types").IEnumInversion;
|
|
45
|
-
isNotObject: (source: any, type: any) => boolean;
|
|
46
|
-
cloneDeep: import("./types").ICloneDeep;
|
|
47
|
-
createObjectVariable: import("./types").ICreateObjectVariable;
|
|
48
|
-
createObject: import("./types").ICreateObject;
|
|
49
|
-
inherit: import("./types").IInherit;
|
|
50
|
-
getInstance: import("./types").IGetInstance;
|
|
51
|
-
classDecorator: import("./types").IClassDecorator;
|
|
52
|
-
stringToJson: import("./types").IStringToJson;
|
|
53
|
-
jsonToString: import("./types").IJsonToString;
|
|
54
|
-
};
|
|
55
|
-
export default _default;
|
|
1
|
+
export * from "./object";
|
|
2
|
+
export * from "./base";
|
|
3
|
+
export * from "./array";
|
|
4
|
+
export * from "./function";
|
|
5
|
+
export * from "./element";
|
|
6
|
+
export * from "./static";
|
|
7
|
+
export * from "./types";
|
|
8
|
+
export * from "./request";
|
|
9
|
+
export * from "./event";
|
|
10
|
+
export * from "./storage";
|
|
11
|
+
export * from "event-message-center";
|
|
12
|
+
export * from "task-queue-lib";
|
|
13
|
+
import eventMessageCenter from "event-message-center";
|
|
14
|
+
import taskQueueLib from "task-queue-lib";
|
|
15
|
+
declare const _default: {
|
|
16
|
+
eventMessageCenter: typeof eventMessageCenter;
|
|
17
|
+
taskQueueLib: typeof taskQueueLib;
|
|
18
|
+
setStorage: (key: string, val: any) => void;
|
|
19
|
+
getStorage: (key: string) => any;
|
|
20
|
+
clearStorage: (key: string) => void;
|
|
21
|
+
addHandler: import("./types").IAddHandler;
|
|
22
|
+
stopBubble: import("./types").IStopBubble;
|
|
23
|
+
stopDefault: import("./types").IStopDefault;
|
|
24
|
+
removeHandler: import("./types").IRemoveHandler;
|
|
25
|
+
dispatchEvent: import("./types").IDispatchEvent;
|
|
26
|
+
Request: typeof import("./request").Request;
|
|
27
|
+
types: typeof import("./static").types;
|
|
28
|
+
createElement: import("./types").ICreateElement<HTMLElement>;
|
|
29
|
+
throttle: import("./types").IThrottle;
|
|
30
|
+
debounce: import("./types").IDebounce;
|
|
31
|
+
defer: import("./types").IDefer;
|
|
32
|
+
catchAwait: import("./types").ICatchAwait<Promise<any>>;
|
|
33
|
+
arrayRandom: import("./types").IArrayRandom<any[]>;
|
|
34
|
+
arrayUniq: import("./types").IArrayUniq<any[]>;
|
|
35
|
+
arrayDemote: import("./types").IArrayDemote<import("./types").IDemoteArray<any>>;
|
|
36
|
+
randomNum: import("./types").IRandomNum;
|
|
37
|
+
urlSplit: import("./types").IUrlSplit;
|
|
38
|
+
urlJoin: import("./types").IUrlJoin;
|
|
39
|
+
getType: import("./types").IGetType<import("./static").types>;
|
|
40
|
+
getTypeByList: import("./types").IGetTypeByList;
|
|
41
|
+
getValue: import("./types").IGetValue;
|
|
42
|
+
setValue: import("./types").ISetValue;
|
|
43
|
+
mixIn: import("./types").IMixIn;
|
|
44
|
+
enumInversion: import("./types").IEnumInversion;
|
|
45
|
+
isNotObject: (source: any, type: any) => boolean;
|
|
46
|
+
cloneDeep: import("./types").ICloneDeep;
|
|
47
|
+
createObjectVariable: import("./types").ICreateObjectVariable;
|
|
48
|
+
createObject: import("./types").ICreateObject;
|
|
49
|
+
inherit: import("./types").IInherit;
|
|
50
|
+
getInstance: import("./types").IGetInstance;
|
|
51
|
+
classDecorator: import("./types").IClassDecorator;
|
|
52
|
+
stringToJson: import("./types").IStringToJson;
|
|
53
|
+
jsonToString: import("./types").IJsonToString;
|
|
54
|
+
};
|
|
55
|
+
export default _default;
|
package/dist/bundle/object.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { IGetValue, ISetValue, IMixIn, ICloneDeep, ICreateObjectVariable, IEnumInversion, IInherit, ICreateObject, IGetInstance, IClassDecorator, IStringToJson, IJsonToString } from "./index";
|
|
2
|
-
export declare const getValue: IGetValue;
|
|
3
|
-
export declare const setValue: ISetValue;
|
|
4
|
-
export declare const mixIn: IMixIn;
|
|
5
|
-
export declare const enumInversion: IEnumInversion;
|
|
6
|
-
export declare const isNotObject: (source: any, type: any) => boolean;
|
|
7
|
-
export declare const cloneDeep: ICloneDeep;
|
|
8
|
-
export declare const createObjectVariable: ICreateObjectVariable;
|
|
9
|
-
export declare const createObject: ICreateObject;
|
|
10
|
-
export declare const inherit: IInherit;
|
|
11
|
-
export declare const getInstance: IGetInstance;
|
|
12
|
-
export declare const classDecorator: IClassDecorator;
|
|
13
|
-
export declare const stringToJson: IStringToJson;
|
|
14
|
-
export declare const jsonToString: IJsonToString;
|
|
15
|
-
declare const _default: {
|
|
16
|
-
getValue: IGetValue;
|
|
17
|
-
setValue: ISetValue;
|
|
18
|
-
mixIn: IMixIn;
|
|
19
|
-
enumInversion: IEnumInversion;
|
|
20
|
-
isNotObject: (source: any, type: any) => boolean;
|
|
21
|
-
cloneDeep: ICloneDeep;
|
|
22
|
-
createObjectVariable: ICreateObjectVariable;
|
|
23
|
-
createObject: ICreateObject;
|
|
24
|
-
inherit: IInherit;
|
|
25
|
-
getInstance: IGetInstance;
|
|
26
|
-
classDecorator: IClassDecorator;
|
|
27
|
-
stringToJson: IStringToJson;
|
|
28
|
-
jsonToString: IJsonToString;
|
|
29
|
-
};
|
|
30
|
-
export default _default;
|
|
1
|
+
import { IGetValue, ISetValue, IMixIn, ICloneDeep, ICreateObjectVariable, IEnumInversion, IInherit, ICreateObject, IGetInstance, IClassDecorator, IStringToJson, IJsonToString } from "./index";
|
|
2
|
+
export declare const getValue: IGetValue;
|
|
3
|
+
export declare const setValue: ISetValue;
|
|
4
|
+
export declare const mixIn: IMixIn;
|
|
5
|
+
export declare const enumInversion: IEnumInversion;
|
|
6
|
+
export declare const isNotObject: (source: any, type: any) => boolean;
|
|
7
|
+
export declare const cloneDeep: ICloneDeep;
|
|
8
|
+
export declare const createObjectVariable: ICreateObjectVariable;
|
|
9
|
+
export declare const createObject: ICreateObject;
|
|
10
|
+
export declare const inherit: IInherit;
|
|
11
|
+
export declare const getInstance: IGetInstance;
|
|
12
|
+
export declare const classDecorator: IClassDecorator;
|
|
13
|
+
export declare const stringToJson: IStringToJson;
|
|
14
|
+
export declare const jsonToString: IJsonToString;
|
|
15
|
+
declare const _default: {
|
|
16
|
+
getValue: IGetValue;
|
|
17
|
+
setValue: ISetValue;
|
|
18
|
+
mixIn: IMixIn;
|
|
19
|
+
enumInversion: IEnumInversion;
|
|
20
|
+
isNotObject: (source: any, type: any) => boolean;
|
|
21
|
+
cloneDeep: ICloneDeep;
|
|
22
|
+
createObjectVariable: ICreateObjectVariable;
|
|
23
|
+
createObject: ICreateObject;
|
|
24
|
+
inherit: IInherit;
|
|
25
|
+
getInstance: IGetInstance;
|
|
26
|
+
classDecorator: IClassDecorator;
|
|
27
|
+
stringToJson: IStringToJson;
|
|
28
|
+
jsonToString: IJsonToString;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
package/dist/bundle/request.d.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions, IRequestBaseFn, IEnv } from "./index";
|
|
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;
|
|
1
|
+
import { IRequest, IRequestBase, IRequestInit, IInterceptors, IUrl, IObject, IRequestBody, IRequestOptions, IRequestBaseFn, IEnv } from "./index";
|
|
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/bundle/static.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export declare enum types {
|
|
2
|
-
"[object Array]" = "array",
|
|
3
|
-
"[object Object]" = "object",
|
|
4
|
-
"[object Function]" = "function",
|
|
5
|
-
"[object Set]" = "set",
|
|
6
|
-
"[object Map]" = "map",
|
|
7
|
-
"[object WeakMap]" = "weakMap",
|
|
8
|
-
"[object WeakSet]" = "weakSet",
|
|
9
|
-
"[object Date]" = "date",
|
|
10
|
-
"[object RegExp]" = "regExp",
|
|
11
|
-
"[object Math]" = "math"
|
|
12
|
-
}
|
|
13
|
-
declare const _default: {
|
|
14
|
-
types: typeof types;
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
1
|
+
export declare enum types {
|
|
2
|
+
"[object Array]" = "array",
|
|
3
|
+
"[object Object]" = "object",
|
|
4
|
+
"[object Function]" = "function",
|
|
5
|
+
"[object Set]" = "set",
|
|
6
|
+
"[object Map]" = "map",
|
|
7
|
+
"[object WeakMap]" = "weakMap",
|
|
8
|
+
"[object WeakSet]" = "weakSet",
|
|
9
|
+
"[object Date]" = "date",
|
|
10
|
+
"[object RegExp]" = "regExp",
|
|
11
|
+
"[object Math]" = "math"
|
|
12
|
+
}
|
|
13
|
+
declare const _default: {
|
|
14
|
+
types: typeof types;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
package/dist/bundle/storage.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const setStorage: (key: string, val: any) => void;
|
|
2
|
-
export declare const getStorage: (key: string) => any;
|
|
3
|
-
export declare const clearStorage: (key: string) => void;
|
|
4
|
-
declare const _default: {
|
|
5
|
-
setStorage: (key: string, val: any) => void;
|
|
6
|
-
getStorage: (key: string) => any;
|
|
7
|
-
clearStorage: (key: string) => void;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
1
|
+
export declare const setStorage: (key: string, val: any) => void;
|
|
2
|
+
export declare const getStorage: (key: string) => any;
|
|
3
|
+
export declare const clearStorage: (key: string) => void;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
setStorage: (key: string, val: any) => void;
|
|
6
|
+
getStorage: (key: string) => any;
|
|
7
|
+
clearStorage: (key: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|