axios-annotations 1.3.4 → 2.0.1
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.md +257 -105
- package/index.d.ts +1 -0
- package/index.js +121 -0
- package/lib/core/cancel.d.ts +30 -0
- package/lib/core/cancel.js +56 -0
- package/lib/core/common.d.ts +6 -0
- package/lib/core/common.js +166 -1
- package/lib/core/config.d.ts +60 -29
- package/lib/core/config.js +332 -1
- package/lib/core/parser.d.ts +19 -15
- package/lib/core/parser.js +79 -1
- package/lib/core/provider.d.ts +6 -0
- package/lib/core/provider.js +172 -0
- package/lib/core/service.d.ts +153 -33
- package/lib/core/service.js +562 -1
- package/lib/decorator/abort-source.d.ts +3 -9
- package/lib/decorator/abort-source.js +25 -1
- package/lib/decorator/delete-mapping.d.ts +1 -3
- package/lib/decorator/delete-mapping.js +13 -1
- package/lib/decorator/get-mapping.d.ts +1 -3
- package/lib/decorator/get-mapping.js +13 -1
- package/lib/decorator/ignore-residual-params.d.ts +1 -3
- package/lib/decorator/ignore-residual-params.js +24 -1
- package/lib/decorator/patch-mapping.d.ts +1 -3
- package/lib/decorator/patch-mapping.js +13 -1
- package/lib/decorator/post-mapping.d.ts +1 -3
- package/lib/decorator/post-mapping.js +13 -1
- package/lib/decorator/put-mapping.d.ts +1 -3
- package/lib/decorator/put-mapping.js +13 -1
- package/lib/decorator/request-body.d.ts +1 -3
- package/lib/decorator/request-body.js +28 -1
- package/lib/decorator/request-config.d.ts +5 -7
- package/lib/decorator/request-config.js +23 -1
- package/lib/decorator/request-header.d.ts +2 -5
- package/lib/decorator/request-header.js +21 -1
- package/lib/decorator/request-mapping.d.ts +3 -6
- package/lib/decorator/request-mapping.js +58 -1
- package/lib/decorator/request-param.d.ts +1 -3
- package/lib/decorator/request-param.js +27 -1
- package/lib/decorator/request-with.d.ts +1 -3
- package/lib/decorator/request-with.js +20 -1
- package/lib/index.d.ts +19 -0
- package/lib/index.js +139 -0
- package/lib/plugins/auth/authorizer.d.ts +23 -49
- package/lib/plugins/auth/authorizer.js +271 -1
- package/lib/plugins/auth/history.d.ts +14 -15
- package/lib/plugins/auth/history.js +96 -1
- package/lib/plugins/auth/index.d.ts +9 -4
- package/lib/plugins/auth/index.js +368 -1
- package/lib/plugins/auth/queue.d.ts +28 -16
- package/lib/plugins/auth/queue.js +270 -1
- package/lib/plugins/auth/storage.d.ts +6 -7
- package/lib/plugins/auth/storage.js +207 -1
- package/package.json +16 -16
- package/plugins/auth/index.d.ts +4 -4
- package/plugins/auth/index.js +26 -1
- package/core/config.d.ts +0 -29
- package/core/config.js +0 -1
- package/core/parser.d.ts +0 -15
- package/core/parser.js +0 -1
- package/core/service.d.ts +0 -33
- package/core/service.js +0 -1
- package/decorator/abort-source.d.ts +0 -9
- package/decorator/abort-source.js +0 -1
- package/decorator/delete-mapping.d.ts +0 -1
- package/decorator/delete-mapping.js +0 -1
- package/decorator/get-mapping.d.ts +0 -1
- package/decorator/get-mapping.js +0 -1
- package/decorator/ignore-residual-params.d.ts +0 -1
- package/decorator/ignore-residual-params.js +0 -1
- package/decorator/patch-mapping.d.ts +0 -1
- package/decorator/patch-mapping.js +0 -1
- package/decorator/post-mapping.d.ts +0 -1
- package/decorator/post-mapping.js +0 -1
- package/decorator/put-mapping.d.ts +0 -3
- package/decorator/put-mapping.js +0 -1
- package/decorator/request-body.d.ts +0 -3
- package/decorator/request-body.js +0 -1
- package/decorator/request-config.d.ts +0 -29
- package/decorator/request-config.js +0 -1
- package/decorator/request-header.d.ts +0 -1
- package/decorator/request-header.js +0 -1
- package/decorator/request-mapping.d.ts +0 -1
- package/decorator/request-mapping.js +0 -1
- package/decorator/request-param.d.ts +0 -1
- package/decorator/request-param.js +0 -1
- package/decorator/request-with.d.ts +0 -1
- package/decorator/request-with.js +0 -1
- package/lib/plugins/cache/index.js +0 -1
- package/plugins/auth/authorizer.d.ts +0 -49
- package/plugins/auth/authorizer.js +0 -1
- package/plugins/auth/history.d.ts +0 -15
- package/plugins/auth/history.js +0 -1
- package/plugins/auth/queue.d.ts +0 -16
- package/plugins/auth/queue.js +0 -1
- package/plugins/auth/storage.d.ts +0 -7
- package/plugins/auth/storage.js +0 -1
- package/plugins/cache/index.js +0 -1
package/core/service.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import Config from "./config";
|
|
2
|
-
import {AxiosPromise, AxiosRequestConfig} from "axios";
|
|
3
|
-
import {AbortControllerAdapter} from "../decorator/abort-source";
|
|
4
|
-
|
|
5
|
-
export interface RequestController {
|
|
6
|
-
ignoreResidualParams: (ignore?: boolean) => RequestController;
|
|
7
|
-
|
|
8
|
-
param: (key: string, required?: boolean) => RequestController;
|
|
9
|
-
|
|
10
|
-
header: (header: string, value: string | ((...args: any[]) => string)) => RequestController;
|
|
11
|
-
|
|
12
|
-
body: (key: string) => RequestController;
|
|
13
|
-
|
|
14
|
-
config: (config: Partial<AxiosRequestConfig>) => RequestController;
|
|
15
|
-
|
|
16
|
-
send: (data?: Record<string, any>) => AxiosPromise<any>;
|
|
17
|
-
|
|
18
|
-
with: (registration: string) => RequestController;
|
|
19
|
-
|
|
20
|
-
abort: (abortController: (AbortController | AbortControllerAdapter) | ((...args: any[]) => (AbortControllerAdapter | AbortController))) => RequestController;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default class Service {
|
|
24
|
-
constructor(path?: string);
|
|
25
|
-
|
|
26
|
-
config: Config;
|
|
27
|
-
|
|
28
|
-
path: string;
|
|
29
|
-
|
|
30
|
-
request(method: string, path: string, data?: any, config?: Partial<AxiosRequestConfig>): AxiosPromise<any>;
|
|
31
|
-
|
|
32
|
-
requestWith(method: string, path?: string): RequestController;
|
|
33
|
-
}
|
package/core/service.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/core/service");
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {CancelToken} from "axios";
|
|
2
|
-
|
|
3
|
-
export class AbortControllerAdapter {
|
|
4
|
-
constructor(CancelToken: CancelToken);
|
|
5
|
-
|
|
6
|
-
abort(reason?: string): void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function AbortSource(abortController: (AbortController | AbortControllerAdapter) | ((...args: any[]) => (AbortController | AbortControllerAdapter))): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/abort-source");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function DeleteMapping(path?: string): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/delete-mapping");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function GetMapping(path?: string): ((target: any) => any);
|
package/decorator/get-mapping.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/get-mapping");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function IgnoreResidualParams(ignore?: boolean): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/ignore-residual-params");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function PatchMapping(path?: string): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/patch-mapping");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function PostMapping(path?: string): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/post-mapping");
|
package/decorator/put-mapping.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/put-mapping");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/request-body");
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {AxiosInstance, AxiosRequestConfig} from "axios";
|
|
2
|
-
|
|
3
|
-
declare class Config {
|
|
4
|
-
constructor(protocol?: string, host?: string, port?: number, prefix?: string, plugins?: ((config: Config) => void)[]);
|
|
5
|
-
|
|
6
|
-
static forName(name: string): Config;
|
|
7
|
-
|
|
8
|
-
host: string;
|
|
9
|
-
|
|
10
|
-
port: number | null | string;
|
|
11
|
-
|
|
12
|
-
protocol: string;
|
|
13
|
-
|
|
14
|
-
prefix: string;
|
|
15
|
-
|
|
16
|
-
origin: string;
|
|
17
|
-
|
|
18
|
-
baseURL: string;
|
|
19
|
-
|
|
20
|
-
axios: AxiosInstance;
|
|
21
|
-
|
|
22
|
-
plugins: ((config: Config) => void)[];
|
|
23
|
-
|
|
24
|
-
register(name: string): Config;
|
|
25
|
-
|
|
26
|
-
unregister(): Config;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default function RequestConfig(config: Config | ((...args: any[]) => Partial<AxiosRequestConfig>) | Partial<AxiosRequestConfig>): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/request-config");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function RequestHeader(header: string, value: string | ((...args: any[]) => string)): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/request-header");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function RequestMapping(path: string, method?: string): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/request-mapping");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function RequestParam(name: string, required?: boolean): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/request-param");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function RequestWith(registration: string): ((target: any) => any);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../lib/decorator/request-with");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function CachePlugin(){return function(e){var t=e.axios.defaults.adapter;e.axios.defaults.adapter=function(e){return t(e)}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=CachePlugin;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {AxiosError, AxiosPromise, AxiosRequestConfig} from "axios";
|
|
2
|
-
import SessionStorage from "./storage";
|
|
3
|
-
import SessionHistory from "./history";
|
|
4
|
-
|
|
5
|
-
export interface Session {
|
|
6
|
-
access_token?: string;
|
|
7
|
-
|
|
8
|
-
refresh_token?: string;
|
|
9
|
-
|
|
10
|
-
token?: string;
|
|
11
|
-
|
|
12
|
-
accessToken?: string;
|
|
13
|
-
|
|
14
|
-
refreshToken?: string;
|
|
15
|
-
|
|
16
|
-
expires_in?: number;
|
|
17
|
-
|
|
18
|
-
expiresIn?: number;
|
|
19
|
-
|
|
20
|
-
scope?: string;
|
|
21
|
-
|
|
22
|
-
token_type?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default class Authorizer {
|
|
26
|
-
sessionKey: string;
|
|
27
|
-
|
|
28
|
-
sessionStorage: SessionStorage;
|
|
29
|
-
|
|
30
|
-
sessionHistory: SessionHistory;
|
|
31
|
-
|
|
32
|
-
getSession(): Promise<Partial<Session>>;
|
|
33
|
-
|
|
34
|
-
storageSession(session: Session): Promise<void>;
|
|
35
|
-
|
|
36
|
-
refreshSession(session: Session): Promise<Partial<Session>> | Promise<Record<string, any>> | Promise<any>;
|
|
37
|
-
|
|
38
|
-
withAuthentication(request: AxiosRequestConfig, session: Partial<Session>): void;
|
|
39
|
-
|
|
40
|
-
checkSession(request: AxiosRequestConfig, session: Partial<Session>): boolean;
|
|
41
|
-
|
|
42
|
-
checkResponse(response: Response): boolean;
|
|
43
|
-
|
|
44
|
-
onAuthorizedDenied(error: AxiosError): Promise<void>;
|
|
45
|
-
|
|
46
|
-
onSessionInvalidated(): void;
|
|
47
|
-
|
|
48
|
-
invalidateSession(): Promise<void>;
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../../lib/plugins/auth/authorizer");
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {Session} from "./authorizer";
|
|
2
|
-
|
|
3
|
-
export default class SessionHistory {
|
|
4
|
-
add(session: Session): void;
|
|
5
|
-
|
|
6
|
-
check(jwt: string): boolean;
|
|
7
|
-
|
|
8
|
-
deprecate(session: Session): void;
|
|
9
|
-
|
|
10
|
-
clean(): void;
|
|
11
|
-
|
|
12
|
-
isDeprecated(session: Session): boolean;
|
|
13
|
-
|
|
14
|
-
size: number;
|
|
15
|
-
}
|
package/plugins/auth/history.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../../lib/plugins/auth/history");
|
package/plugins/auth/queue.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {AxiosError, AxiosPromise} from "axios";
|
|
2
|
-
import Authorizer from "./authorizer";
|
|
3
|
-
|
|
4
|
-
export default class PendingQueue {
|
|
5
|
-
constructor(authorizer: Authorizer);
|
|
6
|
-
|
|
7
|
-
resend(error: AxiosError, retries?: number): AxiosPromise<any>;
|
|
8
|
-
|
|
9
|
-
push(error: AxiosError): AxiosPromise<any>;
|
|
10
|
-
|
|
11
|
-
pop(): void;
|
|
12
|
-
|
|
13
|
-
clear(): void;
|
|
14
|
-
|
|
15
|
-
size: number;
|
|
16
|
-
}
|
package/plugins/auth/queue.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../../lib/plugins/auth/queue");
|
package/plugins/auth/storage.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../../lib/plugins/auth/storage");
|
package/plugins/cache/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../../lib/plugins/cache/index");
|