{"_id":"@b-hole/axios","_rev":"5-2739b4fe348a1ee5d991bac3933d38e6","name":"@b-hole/axios","dist-tags":{"latest":"1.1.5"},"versions":{"1.0.1-test-1":{"name":"@b-hole/axios","version":"1.0.1-test-1","description":"封装一下 axios 统一响应体 ","type":"module","private":false,"main":"index.js","scripts":{"start":"node ./bin/index"},"keywords":["axios","RESTful","统一响应","请求延迟发送"],"dependencies":{"chalk":"^5.3.0","commander":"~1.1.1"},"peerDependencies":{"axios":"^1.4.0","pinyin":"^3.0.0-alpha.5"},"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"bin":{"xxl":"bin/index.js"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","gitHead":"cac04e8586f65edf000a1bc14be45bcd95bb72b1","_id":"@b-hole/axios@1.0.1-test-1","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-4dCiewXaQfTdbw1R+E2d+pbliGnV9zscdL2xUJ0n9nnhfAOFrHw4yZpJNaM6IzyMMNAePovPtsdKLEBAayt6DA==","shasum":"5a007c5d45ad5de7f8226565428ac55a02905308","tarball":"https://registry.npmjs.org/@b-hole/axios/-/axios-1.0.1-test-1.tgz","fileCount":9,"unpackedSize":14801,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDermC71WShWWMzUG/KQKawqVMYr8eG4fUQW7b0bX1MFwIgZhx+T3c2+fRpTmgWQ/c/05tSmVzWaIEHS2MWlonfdc4="}]},"_npmUser":{"name":"b-hole","email":"xxl.nice@foxmail.com"},"directories":{},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios_1.0.1-test-1_1695808724881_0.12973212090823139"},"_hasShrinkwrap":false},"1.0.2":{"name":"@b-hole/axios","version":"1.0.2","description":"封装一下 axios 统一响应体 ","type":"module","private":false,"main":"index.js","scripts":{"start":"node ./bin/index"},"keywords":["axios","RESTful","统一响应","请求延迟发送"],"dependencies":{"chalk":"^5.3.0","commander":"^11.0.0"},"peerDependencies":{"axios":"^1.4.0"},"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"bin":{"xxl":"bin/index.js"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","gitHead":"1352e785d393740546ad2f6254a9f5143f19cb4c","_id":"@b-hole/axios@1.0.2","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-GNr+zp074N78YREZHcZBoAol/z/UqcsexP5L508sN6H0Skexk+Fhq/qjUY9Pn7K+Q0hyWaixAfAifQc1iMkDyw==","shasum":"567f319ccbf0ee5f17b65823f593e27c05201d48","tarball":"https://registry.npmjs.org/@b-hole/axios/-/axios-1.0.2.tgz","fileCount":12,"unpackedSize":26498,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFv8sKQHrLwSKy2R6JjEtvJYH2WRaPKCJziZQ1gB56fLAiEAxIEdK+Inb6waW3M4N1aJnqGGsQDty1QtUV0cQ1zq60A="}]},"_npmUser":{"name":"b-hole","email":"xxl.nice@foxmail.com"},"directories":{},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios_1.0.2_1696084140734_0.4219221315485826"},"_hasShrinkwrap":false},"1.1.1":{"name":"@b-hole/axios","version":"1.1.1","description":"封装一下 axios 统一响应体 ","type":"module","private":false,"main":"index.js","scripts":{"start":"node ./bin/index"},"keywords":["axios","RESTful","统一响应","请求延迟发送"],"dependencies":{"chalk":"^5.3.0","commander":"^11.0.0"},"peerDependencies":{"axios":"^1.4.0"},"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"bin":{"xxl":"bin/index.js"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","gitHead":"1352e785d393740546ad2f6254a9f5143f19cb4c","_id":"@b-hole/axios@1.1.1","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-zTZ8dh1/Do86h7qaEEaNSMNonP36MT7a+rXTC9Too/Hkm47Hpj1NkVS0YnHAB25aAyFsjRHFQIocZ1TfB5Za5Q==","shasum":"1ab02c98dabd777bd060cd2156fefa87cb94606b","tarball":"https://registry.npmjs.org/@b-hole/axios/-/axios-1.1.1.tgz","fileCount":12,"unpackedSize":26512,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLdtO6avYc1YCumtRIJcsmsH+NgMC6FhG1Y/Frr574TQIgUDZ3vUUNmOWv0jyqQ+J6hfcNRqRIxiXDGuGLZcU0fGA="}]},"_npmUser":{"name":"b-hole","email":"xxl.nice@foxmail.com"},"directories":{},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios_1.1.1_1696084394961_0.8664962828447162"},"_hasShrinkwrap":false},"1.1.3":{"name":"@b-hole/axios","version":"1.1.3","description":"封装一下 axios 统一响应体 ","type":"module","private":false,"main":"index.js","scripts":{"start":"node ./bin/index"},"keywords":["axios","RESTful","统一响应","请求延迟发送","代码生成器","Promise","http"],"dependencies":{"chalk":"^5.3.0","commander":"^11.0.0"},"peerDependencies":{"axios":"^1.4.0"},"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"bin":{"xxl":"bin/index.js"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","gitHead":"b7194e3e7f2f77be1cd390e0e1e1ea45e26f1062","_id":"@b-hole/axios@1.1.3","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-JIyLYYWBCTnU2KObzrE19BYLBXHycfK02BCy/E0MPnDGi4cwq1VeciuvoapBFNPChCwSbdcOYRUIBNKwmRGMvA==","shasum":"b8ca15df96f662e0be6920d4ff851f212d281414","tarball":"https://registry.npmjs.org/@b-hole/axios/-/axios-1.1.3.tgz","fileCount":15,"unpackedSize":44593,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIMpn6QeqnhOilbSQyK8hniF+RVh0LeKJDOJiTsZQWhwIgRPQnT8jq2K8G5bQ2p2NckWhr5PG9Fy+nv8tWowRY5E0="}]},"_npmUser":{"name":"b-hole","email":"xxl.nice@foxmail.com"},"directories":{},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios_1.1.3_1696641556705_0.30890537718960465"},"_hasShrinkwrap":false},"1.1.4":{"name":"@b-hole/axios","version":"1.1.4","description":"封装一下 axios 统一响应体 ","type":"module","private":false,"main":"./lib/index.js","scripts":{"start":"node ./bin/index"},"keywords":["axios","RESTful","统一响应","请求延迟发送","代码生成器","Promise","http"],"dependencies":{"chalk":"^5.3.0","commander":"^11.0.0"},"peerDependencies":{"axios":"^1.4.0"},"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"bin":{"xxl":"bin/index.js"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","types":"./lib/index.d.ts","gitHead":"b7194e3e7f2f77be1cd390e0e1e1ea45e26f1062","_id":"@b-hole/axios@1.1.4","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-uqMMZdrYk+w/oIj1V0PYSP9pq1YZJggKjBSgwDPYPTII6sp9M+sZZKUBs5qE4q90kfR/1xkmAFpgp9fO8j47eg==","shasum":"94a36e705ac7c74534e6ff782c281c100ff3988c","tarball":"https://registry.npmjs.org/@b-hole/axios/-/axios-1.1.4.tgz","fileCount":17,"unpackedSize":51881,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICaDUKdZ/DSCvjCnJIWmWmS7jbe7qqyqus6NWqcZQ7WzAiEAzODwYeOOKtRasjOIQahsSvPtXXVuzLy2Qh2UN8y7aOc="}]},"_npmUser":{"name":"b-hole","email":"xxl.nice@foxmail.com"},"directories":{},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios_1.1.4_1697680206267_0.869834274643988"},"_hasShrinkwrap":false},"1.1.5":{"name":"@b-hole/axios","version":"1.1.5","description":"封装一下 axios 统一响应体 ","type":"module","private":false,"main":"./lib/index.js","scripts":{"start":"node ./bin/index"},"keywords":["axios","RESTful","统一响应","请求延迟发送","代码生成器","Promise","http"],"dependencies":{"chalk":"^5.3.0","commander":"^11.0.0"},"peerDependencies":{"axios":"^1.4.0"},"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"bin":{"xxl":"bin/index.js"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","types":"./lib/index.d.ts","gitHead":"b7194e3e7f2f77be1cd390e0e1e1ea45e26f1062","_id":"@b-hole/axios@1.1.5","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-OuyFuj6gjyi9lQ/I+f6LmQVTl2oVjAR09BHvEaEONi5ow+BHWJaX/YgfXFw4da2eOfRs/ISDafvYEcA5qCjGrg==","shasum":"c75e91eaf0fb822a35f01e3eb3177e9a8525819f","tarball":"https://registry.npmjs.org/@b-hole/axios/-/axios-1.1.5.tgz","fileCount":15,"unpackedSize":46767,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICjDkKbej8CtzQIE9MwtijL1voj3rffPM9jkaOjbR/8OAiBHrkMus1A2alX5meEwTxuNtLmev0sZTLM7KD9VRbmO2Q=="}]},"_npmUser":{"name":"b-hole","email":"xxl.nice@foxmail.com"},"directories":{},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios_1.1.5_1697680445161_0.9763616902849805"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-27T09:58:44.793Z","1.0.1-test-1":"2023-09-27T09:58:45.087Z","modified":"2023-10-19T01:54:05.552Z","1.0.2":"2023-09-30T14:29:00.948Z","1.1.1":"2023-09-30T14:33:15.187Z","1.1.3":"2023-10-07T01:19:16.933Z","1.1.4":"2023-10-19T01:50:06.509Z","1.1.5":"2023-10-19T01:54:05.352Z"},"maintainers":[{"name":"b-hole","email":"xxl.nice@foxmail.com"}],"description":"封装一下 axios 统一响应体 ","keywords":["axios","RESTful","统一响应","请求延迟发送","代码生成器","Promise","http"],"repository":{"type":"git","url":"https://gitee.com/fan-yanxi/baxios.git"},"author":{"name":"xxl.nice@foxmal.com"},"license":"ISC","readme":"- [axios工具](#axios工具)\r\n  - [介绍](#介绍)\r\n  - [使用](#使用)\r\n    - [下载](#下载)\r\n    - [普通使用](#普通使用)\r\n    - [代码生成器](#代码生成器)\r\n\r\n# axios工具\r\n## 介绍\r\n> 这个库是一个对**axios**的二次封装,让请求能够预先定义好,需要发送的时候再使用对应的方法。更好的支持**RESTful**风格的请求,另外还支持根据自定义响应状态码映射表调用对应的方法。并且能够根据postman的导出生成对应的函数调用。\r\n```ts\r\n  //响应体必须为这种格式\r\n  type Data = {\r\n    data:any\r\n    code:number\r\n    msg:string\r\n  } \r\n  \r\n```\r\n\r\n## 使用\r\n### 下载\r\n```sh\r\n npm i -g @b-hole/axios \r\n```\r\n### 普通使用\r\n> 普世使用\r\n```js\r\nimport { createAxios } form 'baxios'\r\nconst config = {\r\n  baseURL: location.origin + '/api/',\r\n  withCredentials: true,\r\n  timeout: 5000\r\n}\r\n// 响应状态码映射\r\nconst codeMap = {\r\n  '200':\"成功\",\r\n  '404':\"没有查询到数据\"\r\n}\r\nconst request = axios.create(config)\r\nconst baxios = createBAxios({\r\n  ...config\r\n},codeMap)\r\n// 创建请求 未发送 在这里设置完uri 路径过后\r\nlet test = baxios(\"uri\")\r\n\r\n/**\r\n * 另外baxios 上还可以绑定几个事件\r\n *  onErrMsg: (callback: (msg: string) => void) => void;\r\n *  onSuccMsg: (callback: (msg: string) => void) => void;\r\n *  onReqError: (callback: (err: import('axios').AxiosError) => void) => void;\r\n *  onResError: (callback: (err: import('axios').AxiosError) => void) => void;\r\n * **/\r\n// 真实发送 这里的方法不能设置uri 路径\r\n// 返回promise 且若是不报错的话 直接返回response 里的data\r\ntest.get()\r\ntest.post()\r\ntest.postForm()\r\n```\r\n### 代码生成器\r\n> 首先你需要全局安装 **`@b-hole/axios`**\r\n```sh\r\n#生成axios函数文件\r\nxxl p2a [postman导出的json文件地址] [输出文件地址]\r\n#默认生成在命令执行目录下 api文件夹里\r\n```","readmeFilename":"README.MD"}