axios-annotations 1.1.4 → 1.1.7
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 +19 -26
- package/lib/decorator/request-mapping.js +1 -1
- package/package.json +1 -1
- package/plugins/cache/index.js +1 -0
- package/lib/plugins/cache/index.js +0 -1
package/README.md
CHANGED
|
@@ -464,29 +464,20 @@ import {authorizer} from "/path/config.js";
|
|
|
464
464
|
|
|
465
465
|
> #### RequestController
|
|
466
466
|
> + param: (key, required?) : RequestController
|
|
467
|
-
|
|
468
|
-
+ key : string `标记查询串参数`
|
|
467
|
+
> + key : string `标记查询串参数`
|
|
469
468
|
> + required : boolean `默认false,空字符串,null,undefined 将忽略`
|
|
470
469
|
> + header: (header, header) : RequestController
|
|
471
|
-
|
|
472
|
-
+ header : string `url 附加参数键值`
|
|
470
|
+
> + header : string `url 附加参数键值`
|
|
473
471
|
> + header : string | function `字符串,或者接收 send 方法参数的函数,该函数应返回合法值。`
|
|
474
|
-
>
|
|
475
472
|
> + body: (key) : RequestController
|
|
476
|
-
|
|
477
|
-
+ key : string `标记参数中请求体`
|
|
478
|
-
>
|
|
473
|
+
> + key : string `标记参数中请求体`
|
|
479
474
|
> + config: (cfg) : RequestController
|
|
480
|
-
|
|
481
|
-
+ cfg : `AxiosRequestConfig`
|
|
475
|
+
> + cfg : `AxiosRequestConfig`
|
|
482
476
|
>
|
|
483
477
|
> + send: (data) : AxiosPromise<any>
|
|
484
|
-
|
|
485
|
-
+ data : object `参数键值对`
|
|
486
|
-
>
|
|
478
|
+
> + data : object `参数键值对`
|
|
487
479
|
> + with: (name) : RequestController
|
|
488
|
-
|
|
489
|
-
+ name : string `config name : 已注册配置名称`
|
|
480
|
+
> + name : string `config name : 已注册配置名称`
|
|
490
481
|
|
|
491
482
|
### Decorators
|
|
492
483
|
|
|
@@ -579,19 +570,21 @@ npm install axios@0.21.0
|
|
|
579
570
|
npm install axios-miniprogram-adapter
|
|
580
571
|
```
|
|
581
572
|
|
|
582
|
-
+ 编译报错 `module is not defined`, 在`app.js
|
|
573
|
+
+ 编译报错 `module is not defined`, 在`app.js`头部补充缺失组件的声明:
|
|
583
574
|
|
|
584
575
|
```javascript
|
|
585
|
-
import
|
|
586
|
-
import
|
|
587
|
-
import
|
|
588
|
-
import
|
|
589
|
-
import
|
|
590
|
-
import
|
|
591
|
-
import
|
|
592
|
-
import
|
|
593
|
-
import
|
|
594
|
-
import
|
|
576
|
+
import "axios-annotations/core/service";
|
|
577
|
+
import "axios-annotations/decorator/request-mapping";
|
|
578
|
+
import "axios-annotations/decorator/get-mapping";
|
|
579
|
+
import "axios-annotations/decorator/post-mapping";
|
|
580
|
+
import "axios-annotations/decorator/put-mapping";
|
|
581
|
+
import "axios-annotations/decorator/delete-mapping";
|
|
582
|
+
import "axios-annotations/decorator/patch-mapping";
|
|
583
|
+
import "axios-annotations/decorator/request-param";
|
|
584
|
+
import "axios-annotations/decorator/request-body";
|
|
585
|
+
import "axios-annotations/decorator/request-header";
|
|
586
|
+
import "axios-annotations/decorator/request-config";
|
|
587
|
+
import "axios-annotations/decorator/request-with";
|
|
595
588
|
```
|
|
596
589
|
|
|
597
590
|
+ 更新开发工具以支持装饰器语法。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestMapping;var _config=_interopRequireDefault(require("../core/config")),_common=require("../core/common");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function RequestMapping(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestMapping;var _config=_interopRequireDefault(require("../core/config")),_common=require("../core/common");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function RequestMapping(p){var l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return function(e,s,r){var h;r?(l=l||"GET",h=r.value,r.value=function(){for(var a=this,e=arguments.length,u=new Array(e),r=0;r<e;r++)u[r]=arguments[r];var t=h.apply(this,u)||{};if("function"!=typeof this.for)throw new Error('Make sure your service inherited "core/Service".');var o,i,n,f=this.for(s),c=f?_config.default.forName(f):null;return t&&Object.hasOwnProperty.call(t,"then")&&"function"==typeof t.then?new Promise(function(i,n){t.then(function(e){var e=a.createRequestConfig(s,a.pathVariable(p||"",e),e,u,u),r=e.path,t=e.body,o=e.config,e=e.query;(c?(0,_common.forward)(c.axios,c.origin,c.prefix,a.path,p,l,e,t,o):a.request(l,r,t,o)).then(i).catch(n)})}):(o=(f=this.createRequestConfig(s,this.pathVariable(p||"",t),t,u,u)).path,i=f.body,n=f.config,f=f.query,c?(0,_common.forward)(c.axios,c.origin,c.prefix,this.path,p,l,f,i,n):this.request(l,o,i,n))}):e.prototype._path=p}}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../lib/plugins/cache/index");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";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;
|