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
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = IgnoreResidualParams;
|
|
6
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7
|
+
function IgnoreResidualParams(ignore) {
|
|
8
|
+
return function(_target, method, descriptor) {
|
|
9
|
+
if (descriptor) {
|
|
10
|
+
var fn_1 = descriptor.value;
|
|
11
|
+
descriptor.value = function() {
|
|
12
|
+
var args = [];
|
|
13
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
14
|
+
args[_i] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
var cfg = Object.assign(this.features(method) || {}, {
|
|
17
|
+
ignoreResidualParams: ignore !== false
|
|
18
|
+
});
|
|
19
|
+
this.features(method, cfg);
|
|
20
|
+
return fn_1.apply(this, args);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = PatchMapping;
|
|
6
|
+
var request_mapping_1 = require("./request-mapping");
|
|
7
|
+
// noinspection JSUnusedGlobalSymbols
|
|
8
|
+
function PatchMapping(path) {
|
|
9
|
+
if (path === void 0) {
|
|
10
|
+
path = "";
|
|
11
|
+
}
|
|
12
|
+
return (0, request_mapping_1["default"])(path, "PATCH");
|
|
13
|
+
}
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = PostMapping;
|
|
6
|
+
var request_mapping_1 = require("./request-mapping");
|
|
7
|
+
// noinspection JSUnusedGlobalSymbols
|
|
8
|
+
function PostMapping(path) {
|
|
9
|
+
if (path === void 0) {
|
|
10
|
+
path = "";
|
|
11
|
+
}
|
|
12
|
+
return (0, request_mapping_1["default"])(path, "POST");
|
|
13
|
+
}
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = PutMapping;
|
|
6
|
+
var request_mapping_1 = require("./request-mapping");
|
|
7
|
+
// noinspection JSUnusedGlobalSymbols
|
|
8
|
+
function PutMapping(path) {
|
|
9
|
+
if (path === void 0) {
|
|
10
|
+
path = "";
|
|
11
|
+
}
|
|
12
|
+
return (0, request_mapping_1["default"])(path, "PUT");
|
|
13
|
+
}
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = RequestBody;
|
|
6
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7
|
+
function RequestBody(name) {
|
|
8
|
+
if (name === void 0) {
|
|
9
|
+
name = "body";
|
|
10
|
+
}
|
|
11
|
+
return function(_target, method, descriptor) {
|
|
12
|
+
if (descriptor) {
|
|
13
|
+
var fn_1 = descriptor.value;
|
|
14
|
+
var cfg_1 = {
|
|
15
|
+
required: false,
|
|
16
|
+
body: true
|
|
17
|
+
};
|
|
18
|
+
descriptor.value = function() {
|
|
19
|
+
var args = [];
|
|
20
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
21
|
+
args[_i] = arguments[_i];
|
|
22
|
+
}
|
|
23
|
+
this.params(method, name, cfg_1);
|
|
24
|
+
return fn_1.apply(this, args);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Config from "../
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export default function RequestConfig(config: ((...args: any[]) => Partial<AxiosRequestConfig>) | Partial<AxiosRequestConfig>): (() => AxiosPromise<any>);
|
|
1
|
+
import { AxiosConfigOptionMappingType } from "../core/service";
|
|
2
|
+
import { Config } from "../index";
|
|
3
|
+
type DecoratorTargetType<D> = D extends Config ? ClassDecorator : PropertyDecorator;
|
|
4
|
+
export default function RequestConfig<T = AxiosConfigOptionMappingType | Config>(config: T): DecoratorTargetType<T>;
|
|
5
|
+
export {};
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = RequestConfig;
|
|
6
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7
|
+
function RequestConfig(config) {
|
|
8
|
+
return function(target, name, descriptor) {
|
|
9
|
+
if (descriptor) {
|
|
10
|
+
var fn_1 = descriptor.value;
|
|
11
|
+
descriptor.value = function() {
|
|
12
|
+
var args = [];
|
|
13
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
14
|
+
args[_i] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
this.configs(name, config);
|
|
17
|
+
return fn_1.apply(this, args);
|
|
18
|
+
};
|
|
19
|
+
} else {
|
|
20
|
+
target.prototype._config = config;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default function RequestHeader(header: string, value: string): (() => AxiosPromise<any>);
|
|
4
|
-
|
|
5
|
-
export default function RequestHeader(header: string, value: ((...args: any[]) => string)): (() => AxiosPromise<any>);
|
|
1
|
+
import { HeaderMappingValueType } from "../core/service";
|
|
2
|
+
export default function RequestHeader(header: string, value: HeaderMappingValueType): MethodDecorator;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = RequestHeader;
|
|
6
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7
|
+
function RequestHeader(header, value) {
|
|
8
|
+
return function(_target, method, descriptor) {
|
|
9
|
+
if (descriptor) {
|
|
10
|
+
var fn_1 = descriptor.value;
|
|
11
|
+
descriptor.value = function() {
|
|
12
|
+
var args = [];
|
|
13
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
14
|
+
args[_i] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
this.headers(method, header, value);
|
|
17
|
+
return fn_1.apply(this, args);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default function RequestMapping(path: string, method: string): (() => AxiosPromise<any>);
|
|
5
|
-
|
|
6
|
-
export default function RequestMapping(path: string): (() => Service);
|
|
1
|
+
type DecoratorTargetType<M> = M extends string ? MethodDecorator : ClassDecorator;
|
|
2
|
+
export default function RequestMapping<M = undefined>(path: string, method?: M): DecoratorTargetType<M>;
|
|
3
|
+
export {};
|
|
@@ -1 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = RequestMapping;
|
|
6
|
+
var config_1 = require("../core/config");
|
|
7
|
+
var common_1 = require("../core/common");
|
|
8
|
+
function RequestMapping(path, method) {
|
|
9
|
+
return function(target, name, descriptor) {
|
|
10
|
+
if (!descriptor) {
|
|
11
|
+
// 注解类
|
|
12
|
+
target.prototype._path = path;
|
|
13
|
+
} else {
|
|
14
|
+
// 不可能为空
|
|
15
|
+
var fn_1 = descriptor.value;
|
|
16
|
+
descriptor.value = function() {
|
|
17
|
+
var _this = this;
|
|
18
|
+
var args = [];
|
|
19
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
20
|
+
args[_i] = arguments[_i];
|
|
21
|
+
}
|
|
22
|
+
var data = fn_1.apply(this, args) || {};
|
|
23
|
+
if (typeof this["for"] !== "function") {
|
|
24
|
+
throw new Error("Make sure your service inherited \"core/Service\".");
|
|
25
|
+
}
|
|
26
|
+
// 当前方法是否重定向到其他配置
|
|
27
|
+
var withConfigName = this["for"](name);
|
|
28
|
+
// 根据名称获取配置
|
|
29
|
+
var withConfig = config_1["default"].forName(withConfigName || "");
|
|
30
|
+
if (data && data.then && typeof data.then === "function") {
|
|
31
|
+
return new Promise(function(resolve, reject) {
|
|
32
|
+
data.then(function(d) {
|
|
33
|
+
var _a = _this.createRequestConfig(name, _this.pathVariable(path || "", d), d, args, args), p = _a.path, body = _a.body, config = _a.config, query = _a.query;
|
|
34
|
+
if (withConfig) {
|
|
35
|
+
withConfig.requestAxiosInstance().then(function(axios) {
|
|
36
|
+
(0, common_1.forward)(axios, withConfig.origin, withConfig.prefix, _this.path, path, (0, common_1.mapToDefaultMethod)(method, "GET"), query, body, config).then(resolve)["catch"](reject);
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
_this.request((0, common_1.mapToDefaultMethod)(method, "GET"), p, body, config).then(resolve)["catch"](reject);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
var _a = this.createRequestConfig(name, this.pathVariable(path || "", data), data, args, args), p = _a.path, body_1 = _a.body, config_2 = _a.config, query_1 = _a.query;
|
|
45
|
+
if (withConfig) {
|
|
46
|
+
return new Promise(function(resolve, reject) {
|
|
47
|
+
withConfig.requestAxiosInstance().then(function(axios) {
|
|
48
|
+
return (0, common_1.forward)(axios, withConfig.origin, withConfig.prefix, _this.path, path, (0, common_1.mapToDefaultMethod)(method, "GET"), query_1, body_1, config_2).then(resolve)["catch"](reject);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
return this.request((0, common_1.mapToDefaultMethod)(method, "GET"), p, body_1, config_2);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = RequestParam;
|
|
6
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7
|
+
function RequestParam(name, required) {
|
|
8
|
+
return function(_target, method, descriptor) {
|
|
9
|
+
if (descriptor) {
|
|
10
|
+
var fn_1 = descriptor.value;
|
|
11
|
+
var cfg_1 = Object.assign({
|
|
12
|
+
required: false,
|
|
13
|
+
body: false
|
|
14
|
+
}, {
|
|
15
|
+
required: required === true
|
|
16
|
+
});
|
|
17
|
+
descriptor.value = function() {
|
|
18
|
+
var args = [];
|
|
19
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
20
|
+
args[_i] = arguments[_i];
|
|
21
|
+
}
|
|
22
|
+
this.params(method, name, cfg_1);
|
|
23
|
+
return fn_1.apply(this, args);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports["default"] = RequestWith;
|
|
6
|
+
function RequestWith(configName) {
|
|
7
|
+
return function(_target, name, descriptor) {
|
|
8
|
+
if (descriptor) {
|
|
9
|
+
var fn_1 = descriptor.value;
|
|
10
|
+
descriptor.value = function() {
|
|
11
|
+
var args = [];
|
|
12
|
+
for(var _i = 0; _i < arguments.length; _i++){
|
|
13
|
+
args[_i] = arguments[_i];
|
|
14
|
+
}
|
|
15
|
+
this["for"](name, configName);
|
|
16
|
+
return fn_1.apply(this, args);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { default as Config } from "./core/config";
|
|
2
|
+
export { config } from "./core/config";
|
|
3
|
+
export { default as URLSearchParamsParser } from "./core/parser";
|
|
4
|
+
export { default as Service } from "./core/service";
|
|
5
|
+
export { default as AbortControllerAdapter } from "./core/cancel";
|
|
6
|
+
export { default as AxiosStaticInstanceProvider } from "./core/provider";
|
|
7
|
+
export { default as AbortSource } from "./decorator/abort-source";
|
|
8
|
+
export { default as DeleteMapping } from "./decorator/delete-mapping";
|
|
9
|
+
export { default as GetMapping } from "./decorator/get-mapping";
|
|
10
|
+
export { default as IgnoreResidualParams } from "./decorator/ignore-residual-params";
|
|
11
|
+
export { default as PatchMapping } from "./decorator/patch-mapping";
|
|
12
|
+
export { default as PostMapping } from "./decorator/post-mapping";
|
|
13
|
+
export { default as PutMapping } from "./decorator/put-mapping";
|
|
14
|
+
export { default as RequestBody } from "./decorator/request-body";
|
|
15
|
+
export { default as RequestConfig } from "./decorator/request-config";
|
|
16
|
+
export { default as RequestHeader } from "./decorator/request-header";
|
|
17
|
+
export { default as RequestMapping } from "./decorator/request-mapping";
|
|
18
|
+
export { default as RequestParam } from "./decorator/request-param";
|
|
19
|
+
export { default as RequestWith } from "./decorator/request-with";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// noinspection JSUnusedGlobalSymbols
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RequestWith = exports.RequestParam = exports.RequestMapping = exports.RequestHeader = exports.RequestConfig = exports.RequestBody = exports.PutMapping = exports.PostMapping = exports.PatchMapping = exports.IgnoreResidualParams = exports.GetMapping = exports.DeleteMapping = exports.AbortSource = exports.AxiosStaticInstanceProvider = exports.AbortControllerAdapter = exports.Service = exports.URLSearchParamsParser = exports.config = exports.Config = void 0;
|
|
7
|
+
var config_1 = require("./core/config");
|
|
8
|
+
Object.defineProperty(exports, "Config", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return config_1["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var config_2 = require("./core/config");
|
|
15
|
+
Object.defineProperty(exports, "config", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return config_2.config;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var parser_1 = require("./core/parser");
|
|
22
|
+
Object.defineProperty(exports, "URLSearchParamsParser", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function get() {
|
|
25
|
+
return parser_1["default"];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var service_1 = require("./core/service");
|
|
29
|
+
Object.defineProperty(exports, "Service", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function get() {
|
|
32
|
+
return service_1["default"];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
var cancel_1 = require("./core/cancel");
|
|
36
|
+
Object.defineProperty(exports, "AbortControllerAdapter", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return cancel_1["default"];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var provider_1 = require("./core/provider");
|
|
43
|
+
Object.defineProperty(exports, "AxiosStaticInstanceProvider", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return provider_1["default"];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var abort_source_1 = require("./decorator/abort-source");
|
|
50
|
+
Object.defineProperty(exports, "AbortSource", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return abort_source_1["default"];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var delete_mapping_1 = require("./decorator/delete-mapping");
|
|
57
|
+
Object.defineProperty(exports, "DeleteMapping", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function get() {
|
|
60
|
+
return delete_mapping_1["default"];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
var get_mapping_1 = require("./decorator/get-mapping");
|
|
64
|
+
Object.defineProperty(exports, "GetMapping", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function get() {
|
|
67
|
+
return get_mapping_1["default"];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var ignore_residual_params_1 = require("./decorator/ignore-residual-params");
|
|
71
|
+
Object.defineProperty(exports, "IgnoreResidualParams", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function get() {
|
|
74
|
+
return ignore_residual_params_1["default"];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var patch_mapping_1 = require("./decorator/patch-mapping");
|
|
78
|
+
Object.defineProperty(exports, "PatchMapping", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return patch_mapping_1["default"];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
var post_mapping_1 = require("./decorator/post-mapping");
|
|
85
|
+
Object.defineProperty(exports, "PostMapping", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function get() {
|
|
88
|
+
return post_mapping_1["default"];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
var put_mapping_1 = require("./decorator/put-mapping");
|
|
92
|
+
Object.defineProperty(exports, "PutMapping", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function get() {
|
|
95
|
+
return put_mapping_1["default"];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var request_body_1 = require("./decorator/request-body");
|
|
99
|
+
Object.defineProperty(exports, "RequestBody", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function get() {
|
|
102
|
+
return request_body_1["default"];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var request_config_1 = require("./decorator/request-config");
|
|
106
|
+
Object.defineProperty(exports, "RequestConfig", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function get() {
|
|
109
|
+
return request_config_1["default"];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var request_header_1 = require("./decorator/request-header");
|
|
113
|
+
Object.defineProperty(exports, "RequestHeader", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function get() {
|
|
116
|
+
return request_header_1["default"];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
var request_mapping_1 = require("./decorator/request-mapping");
|
|
120
|
+
Object.defineProperty(exports, "RequestMapping", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function get() {
|
|
123
|
+
return request_mapping_1["default"];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
var request_param_1 = require("./decorator/request-param");
|
|
127
|
+
Object.defineProperty(exports, "RequestParam", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function get() {
|
|
130
|
+
return request_param_1["default"];
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
var request_with_1 = require("./decorator/request-with");
|
|
134
|
+
Object.defineProperty(exports, "RequestWith", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function get() {
|
|
137
|
+
return request_with_1["default"];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
@@ -1,49 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
import SessionStorage from "./storage";
|
|
2
|
+
import SessionHistory from "./history";
|
|
3
|
+
import type { AxiosResponse, InternalAxiosRequestConfig } from "axios";
|
|
4
|
+
export default class Authorizer {
|
|
5
|
+
private _sessionKey;
|
|
6
|
+
private _sessionStorage;
|
|
7
|
+
private _sessionHistory;
|
|
8
|
+
get sessionKey(): string;
|
|
9
|
+
set sessionKey(value: string);
|
|
10
|
+
get sessionStorage(): SessionStorage;
|
|
11
|
+
set sessionStorage(value: SessionStorage);
|
|
12
|
+
get sessionHistory(): SessionHistory;
|
|
13
|
+
set sessionHistory(value: SessionHistory);
|
|
14
|
+
getSession(): Promise<any>;
|
|
15
|
+
storageSession(session: Record<string, any>): Promise<void>;
|
|
16
|
+
refreshSession(_session: Record<string, any>): Promise<any>;
|
|
17
|
+
withAuthentication(request: InternalAxiosRequestConfig, session: Record<string, any>): void;
|
|
18
|
+
checkSession(request: InternalAxiosRequestConfig, session: Record<string, any>): boolean;
|
|
19
|
+
checkResponse(response: AxiosResponse): boolean;
|
|
20
|
+
onAuthorizedDenied(error: unknown): Promise<void>;
|
|
21
|
+
onSessionInvalidated(): void;
|
|
22
|
+
invalidateSession(): Promise<void>;
|
|
23
|
+
}
|