{"_id":"@aiwheels/node-extra","_rev":"1-f68d59d8c36828b9029ec4796e594b2b","name":"@aiwheels/node-extra","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@aiwheels/node-extra","version":"0.0.2","description":"> TODO: node 工具扩展","homepage":"","license":"ISC","main":"lib/index.js","module":"esm/index.js","browser":"dist/index.js","typings":"types/index.d.ts","directories":{"lib":"lib","esm":"esm","types":"types","dist":"dist","test":"__tests__"},"publishConfig":{"access":"public","main":"lib/index.js","typings":"types/index.d.ts"},"keywords":[],"dependencies":{"lodash":"^4.17.21"},"devDependencies":{"@babel/plugin-transform-runtime":"^7.16.8","@types/fs-extra":"^2.1.0","@types/lodash":"^4.14.172","@types/lodash-es":"^4.17.3","fs-extra":"^10.0.0","@aiwheels/rollup-plugin-build-config":"0.0.2"},"scripts":{"build:types":"tsc -p ./tsconfig.build.json --emitDeclarationOnly","build:packages":"pnpm run build:pro && pnpm run build:types","build:dev":"cross-env NODE_ENV=development rollup -c -w","build:pro":"cross-env NODE_ENV=production rollup -c","clean:packages":"rimraf -rf node_modules && rimraf -rf pnpm-lock.yaml && rimraf -rf dist && rimraf -rf esm && rimraf -rf lib"},"_resolved":"","_integrity":"","_from":"file:aiwheels-node-extra-0.0.2.tgz","_id":"@aiwheels/node-extra@0.0.2","_nodeVersion":"14.17.2","_npmVersion":"6.14.13","dist":{"integrity":"sha512-SOzJZ/sieKy+GpglIzVtjjLDf0YEalqszzGlJgAmtHrToOWMNSdeQoMXe0lPPJp2aU5X5uKOwPU42Ymw+PDx5w==","shasum":"8ead656c8380a76ffc0f5d505d6e85743266352f","tarball":"https://registry.npmjs.org/@aiwheels/node-extra/-/node-extra-0.0.2.tgz","fileCount":14,"unpackedSize":350315,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh4Vx3CRA9TVsSAnZWagAAqzMP+gJ6pdngr+o/RnJRShx7\n0l9mF6lWUgYLzll/WhOKRxTrkDswULySWq4L7PHBYDX9CviocOIkrYT+vqO/\nrit6vLJOhsi5OiUdJkl/qrd3906SyEPS/rez7h/nhuVuFMF/A7qxnbWIz8wu\nAPKIaYWTRnXR5/t+LRQlm5RgARTo51IazJvge/enr2Hu3kftAUI2fYigiopx\nI9DjMSYir4mvSpCLH5I4QxoaIkApWGd1qqk6MftGktp/SFX7scl+2Zm0mZZY\nPIDbEZenYIvE8Xu0hWelHvX3lYJ3AotjdnlS21Sbh9WjP7hNS2le/AC9TK5r\n8opO8V8oY0LSoPRYX4urnTaM9f0Z+f+ZZo9VLWE+H0DCBft2g8oKrnv4sWU4\npdUcedx2nzHZ0KTC6Av17ag35hSbmWj9dB+St3NwV+iu4Qrb3d9+YWuoh3Kp\nfydQvFOkiA+A1PDlLLTYn98FG6SjuicNeZSqvSSD9lYJhSVas63ezil+s1bn\nKhRRlIki+mIHUY2VRTebKW1QekdhD+jZ4l9RjeEdfSJH/dH4mL6JNImJrynF\nZ7aCB158b9PIPZpBHd1Nro8Mrm9ZmmNBBA3ieOJ/t7o775HaEcNNven3lK1p\nwsVZ7j+iNV9y6tB90DOH/ZscGaW3RaQbPpct3iSldfZeMAfAjiKv2kH9zEav\nFzim\r\n=RVOQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAlpkHb5PJJonS/xmJbQDg6lQth27rXUNvzl4teF24esAiEAhRll3NoKbQ1awYvnZiKoel4Lv2Yz0WtNV8XVWcLvP4c="}]},"_npmUser":{"name":"aaron-zm","email":"xiaochunyan_oo@126.com"},"maintainers":[{"name":"aaron-zm","email":"xiaochunyan_oo@126.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-extra_0.0.2_1642159223307_0.7423449187153273"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-14T11:20:23.266Z","0.0.2":"2022-01-14T11:20:23.421Z","modified":"2022-04-04T12:25:46.646Z"},"maintainers":[{"name":"aaron-zm","email":"xiaochunyan_oo@126.com"}],"description":"> TODO: node 工具扩展","keywords":[],"license":"ISC","readme":"# api-js 工具\n\n## 安装\n\n```shell\n# 通过 npm 安装\nnpm i @aiwheels/axios-api-js -S\n\n# 通过 yarn 安装\nyarn add @aiwheels/axios-api-js -S\n\n# 通过 pnpm 安装\npnpm add @aiwheels/axios-api-js -S\n```\n\n## methods\n\n## 示例代码\n\n```js\nimport { createApiService } from '@aiwheels/axios-api-js';\nimport axios from 'axios';\n\nconst http = axios.create();\n\nconst createApi = createApiService(http);\n\ncreateApi({\n  url: 'xxx',\n  method: 'get',\n}).request({\n  body: {},\n});\n```\n\n## API\n\n### createApiService\n\n```ts\ninterface ApiConfig {\n  url: string | ((path: ApiRequestConfig['path']) => string);\n  method: Method;\n  cache: boolean;\n  cacheTime: number;\n  headers: AxiosRequestConfig['headers'];\n  axiosConfig: AxiosRequestConfig;\n}\n\ninterface ApiRequestConfig<T = any> {\n  headers?: AxiosRequestConfig<T>['headers'];\n  path?: Record<string, string>;\n  query?: Record<string, string>;\n  body?: AxiosRequestConfig<T>['data'];\n  axiosConfig?: AxiosRequestConfig<T>;\n}\n\nclass Api {\n  http: AxiosInstance;\n\n  config: ApiConfig;\n\n  cache: Record<\n    string,\n    {\n      promise: Promise<any>;\n      expireTime: number | null;\n    }\n  >;\n\n  constructor(http: AxiosInstance, config: ApiConfig): Api;\n\n  request<T = never, R = AxiosResponse<T>>(requestConfig?: ApiRequestConfig<T>): Promise<R>;\n\n  clearCache(): void;\n}\n\nfunction createApiService(http: AxiosInstance): (apiConfig: ApiConfig) => Api;\n```\n","readmeFilename":""}