@andbridge/glowpod 1.1.8 → 1.1.10

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.
@@ -4,8 +4,8 @@ export declare class Core {
4
4
  protected instance: AxiosInstance;
5
5
  constructor(options: CreateAxiosDefaults);
6
6
  getInstance: () => AxiosInstance;
7
- Get: <T>(options: Options) => T;
8
- Put: <T>(options: Options) => T;
9
- Delete: <T>(options: Options) => T;
10
- Post: <T>(options: Options) => T;
7
+ Get: <T>(options: Options) => Promise<T>;
8
+ Put: <T>(options: Options) => Promise<T>;
9
+ Delete: <T>(options: Options) => Promise<T>;
10
+ Post: <T>(options: Options) => Promise<T>;
11
11
  }
@@ -1 +1 @@
1
- import e from"axios";class a{constructor(a){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(a)}}const t=200,s=299,r=({instance:e,authFailedCaller:a=()=>{},networkSuccessCode:r=200,authFailedCode:o=401,networkFailedCaller:d=()=>{},serverKillCaller:n=()=>{},responseStruct:i={codeName:"code",messageName:"message",dataName:"data"},setHeaders:h=e=>{}})=>{let l=null,c=!0;const u=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(c)return e.status<=t&&e.status>=s?n(e):e.data?.[i.codeName]==o?a(e.data):e.data?.[i.codeName]!=r?d(e.data):void 0},0),()=>c=!1);e.interceptors.request.use(async e=>(e.headers&&h?.(e.headers),e),e=>(console.log("请求错误拦截器:",e),u(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[i.codeName]===r)return e.data?.[i.dataName];{const a=u(e);throw{...e,hiddenDefaultErrorHandler:a}}},e=>{const a=u(e);throw{...e,hiddenDefaultErrorHandler:a}})};export{a as GlowPod,r as setupInterceptors};
1
+ import e from"axios";class a{constructor(a){this.getInstance=()=>this.instance,this.Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(a)}}const s=200,t=299,r=({instance:e,authFailedCaller:a=()=>{},networkSuccessCode:r=200,authFailedCode:o=401,networkFailedCaller:d=()=>{},serverKillCaller:n=()=>{},responseStruct:i={codeName:"code",messageName:"message",dataName:"data"},setHeaders:c=async e=>{}})=>{let h=null,l=!0;const u=e=>(h&&clearTimeout(h),h=setTimeout(()=>{if(l)return e.status<=s&&e.status>=t?n(e):e.data?.[i.codeName]==o?a(e.data):e.data?.[i.codeName]!=r?d(e.data):void 0},0),()=>l=!1);e.interceptors.request.use(async e=>(e.headers&&await(c?.(e.headers)),e),e=>(console.log("请求错误拦截器:",e),u(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[i.codeName]===r)return e.data?.[i.dataName];{const a=u(e);throw{...e,hiddenDefaultErrorHandler:a}}},e=>{const a=u(e);throw{...e,hiddenDefaultErrorHandler:a}})};export{a as GlowPod,r as setupInterceptors};
package/build/glowpod.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("axios");const t=200,a=299;exports.GlowPod=class{constructor(t){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(t)}},exports.setupInterceptors=({instance:e,authFailedCaller:s=()=>{},networkSuccessCode:r=200,authFailedCode:o=401,networkFailedCaller:d=()=>{},serverKillCaller:n=()=>{},responseStruct:i={codeName:"code",messageName:"message",dataName:"data"},setHeaders:h=e=>{}})=>{let c=null,l=!0;const u=e=>(c&&clearTimeout(c),c=setTimeout(()=>{if(l)return e.status<=t&&e.status>=a?n(e):e.data?.[i.codeName]==o?s(e.data):e.data?.[i.codeName]!=r?d(e.data):void 0},0),()=>l=!1);e.interceptors.request.use(async e=>(e.headers&&h?.(e.headers),e),e=>(console.log("请求错误拦截器:",e),u(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[i.codeName]===r)return e.data?.[i.dataName];{const t=u(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=u(e);throw{...e,hiddenDefaultErrorHandler:t}})};
1
+ "use strict";var e=require("axios");const a=200,s=299;exports.GlowPod=class{constructor(a){this.getInstance=()=>this.instance,this.Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(a)}},exports.setupInterceptors=({instance:e,authFailedCaller:t=()=>{},networkSuccessCode:r=200,authFailedCode:o=401,networkFailedCaller:n=()=>{},serverKillCaller:d=()=>{},responseStruct:c={codeName:"code",messageName:"message",dataName:"data"},setHeaders:i=async e=>{}})=>{let h=null,l=!0;const u=e=>(h&&clearTimeout(h),h=setTimeout(()=>{if(l)return e.status<=a&&e.status>=s?d(e):e.data?.[c.codeName]==o?t(e.data):e.data?.[c.codeName]!=r?n(e.data):void 0},0),()=>l=!1);e.interceptors.request.use(async e=>(e.headers&&await(i?.(e.headers)),e),e=>(console.log("请求错误拦截器:",e),u(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[c.codeName]===r)return e.data?.[c.dataName];{const a=u(e);throw{...e,hiddenDefaultErrorHandler:a}}},e=>{const a=u(e);throw{...e,hiddenDefaultErrorHandler:a}})};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GlowPod={},e.axios)}(this,function(e,t){"use strict";const s=200,a=299;e.GlowPod=class{constructor(e){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=t.create(e)}},e.setupInterceptors=({instance:e,authFailedCaller:t=()=>{},networkSuccessCode:r=200,authFailedCode:o=401,networkFailedCaller:d=()=>{},serverKillCaller:n=()=>{},responseStruct:i={codeName:"code",messageName:"message",dataName:"data"},setHeaders:l=e=>{}})=>{let h=null,c=!0;const u=e=>(h&&clearTimeout(h),h=setTimeout(()=>{if(c)return e.status<=s&&e.status>=a?n(e):e.data?.[i.codeName]==o?t(e.data):e.data?.[i.codeName]!=r?d(e.data):void 0},0),()=>c=!1);e.interceptors.request.use(async e=>(e.headers&&l?.(e.headers),e),e=>(console.log("请求错误拦截器:",e),u(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[i.codeName]===r)return e.data?.[i.dataName];{const t=u(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=u(e);throw{...e,hiddenDefaultErrorHandler:t}})}});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GlowPod={},e.axios)}(this,function(e,t){"use strict";const s=200,a=299;e.GlowPod=class{constructor(e){this.getInstance=()=>this.instance,this.Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=t.create(e)}},e.setupInterceptors=({instance:e,authFailedCaller:t=()=>{},networkSuccessCode:r=200,authFailedCode:o=401,networkFailedCaller:n=()=>{},serverKillCaller:d=()=>{},responseStruct:i={codeName:"code",messageName:"message",dataName:"data"},setHeaders:c=async e=>{}})=>{let l=null,h=!0;const u=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(h)return e.status<=s&&e.status>=a?d(e):e.data?.[i.codeName]==o?t(e.data):e.data?.[i.codeName]!=r?n(e.data):void 0},0),()=>h=!1);e.interceptors.request.use(async e=>(e.headers&&await(c?.(e.headers)),e),e=>(console.log("请求错误拦截器:",e),u(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[i.codeName]===r)return e.data?.[i.dataName];{const t=u(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=u(e);throw{...e,hiddenDefaultErrorHandler:t}})}});
@@ -19,6 +19,6 @@ import { InterceptorsOptions } from "../model/model";
19
19
  */
20
20
  export declare const setupInterceptors: ({ instance, authFailedCaller, networkSuccessCode, authFailedCode, networkFailedCaller, serverKillCaller, responseStruct, setHeaders, }: InterceptorsOptions & {
21
21
  instance: AxiosInstance;
22
- setHeaders?: (headers: AxiosRequestHeaders) => void;
22
+ setHeaders?: (headers: AxiosRequestHeaders) => Promise<void>;
23
23
  networkFailedCaller?: (error: AxiosResponse["data"]) => void;
24
24
  }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andbridge/glowpod",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "A axios-based HTTP client library",
5
5
  "main": "build/glowpod.js",
6
6
  "module": "build/glowpod.esm.js",