@andbridge/glowpod 1.2.3 → 1.2.4

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/build/glowpod.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("axios");const a=200,s=299;exports.GlowPod=class{instance;constructor(a){this.instance=e.create(a)}getInstance=()=>this.instance;Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others});Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others});Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others});Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others})},exports.setupInterceptors=({instance:e,authFailedCaller:t=()=>{},networkSuccessCode:r=200,authFailedCode:n=401,networkFailedCaller:o=()=>{},serverKillCaller:d=()=>{},responseStruct:c={codeName:"code",messageName:"message",dataName:"data"},setHeaders:i=async e=>{}})=>{let l=null,h=!0;const u=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(h)return e.status<=a&&e.status>=s?d(e):e.data?.[c.codeName]==n?t(e.data):e.data?.[c.codeName]!=r?o(e.data):d(e)},0),()=>h=!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
+ "use strict";var e=require("axios");const a=200,s=299;exports.GlowPod=class{instance;constructor(a){this.instance=e.create(a)}getInstance=()=>this.instance;Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others});Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others});Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others});Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others})},exports.setupInterceptors=({instance:e,authFailedCaller:t=()=>{},networkSuccessCode:r=200,authFailedCode:n=401,networkFailedCaller:o=()=>{},serverKillCaller:d=()=>{},responseStruct:c={codeName:"code",messageName:"message",dataName:"data"},setHeaders:i=async e=>{}})=>{let l=null,h=!0;const u=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(h)return e.status<=a&&e.status>=s?d(e):e.data?.[c.codeName]==n?t(e.data):e.data?.[c.codeName]!=r?o(e.data):d(e)},0),()=>h=!1);e.interceptors.request.use(async e=>(e.headers&&await(i?.(e.headers)),e),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}})};
package/build/glowpod.mjs CHANGED
@@ -1,76 +1 @@
1
- import e from "axios";
2
-
3
- class a {
4
- instance;
5
- constructor(a) {
6
- this.instance = e.create(a);
7
- }
8
- getInstance=() => this.instance;
9
- Get=async e => this.instance({
10
- method: "GET",
11
- url: e.url,
12
- params: e.params,
13
- headers: {
14
- ...e.headers
15
- },
16
- ...e.others
17
- });
18
- Put=async e => this.instance({
19
- method: "PUT",
20
- url: e.url,
21
- data: e.params,
22
- headers: {
23
- ...e.headers
24
- },
25
- ...e.others
26
- });
27
- Delete=async e => this.instance({
28
- method: "DELETE",
29
- url: e.url,
30
- params: e.params,
31
- headers: {
32
- ...e.headers
33
- },
34
- ...e.others
35
- });
36
- Post=async e => this.instance({
37
- method: "POST",
38
- url: e.url,
39
- data: e.params,
40
- headers: {
41
- ...e.headers
42
- },
43
- ...e.others
44
- });
45
- }
46
-
47
- const s = 200, t = 299, r = ({instance: e, authFailedCaller: a = () => {}, networkSuccessCode: r = 200, authFailedCode: o = 401, networkFailedCaller: n = () => {}, serverKillCaller: d = () => {}, responseStruct: c = {
48
- codeName: "code",
49
- messageName: "message",
50
- dataName: "data"
51
- }, setHeaders: l = async e => {}}) => {
52
- let i = null, h = !0;
53
- const u = e => (i && clearTimeout(i), i = setTimeout(() => {
54
- if (h) return e.status <= s && e.status >= t ? d(e) : e.data?.[c.codeName] == o ? a(e.data) : e.data?.[c.codeName] != r ? n(e.data) : d(e);
55
- }, 0), () => h = !1);
56
- e.interceptors.request.use(async e => (e.headers && await (l?.(e.headers)), e), e => (console.log("请求错误拦截器:", e),
57
- u(e), Promise.reject(e))), e.interceptors.response.use(e => {
58
- if ("blob" === e.config.responseType) return e;
59
- if (e.data?.[c.codeName] === r) return e.data?.[c.dataName];
60
- {
61
- const a = u(e);
62
- throw {
63
- ...e,
64
- hiddenDefaultErrorHandler: a
65
- };
66
- }
67
- }, e => {
68
- const a = u(e);
69
- throw {
70
- ...e,
71
- hiddenDefaultErrorHandler: a
72
- };
73
- });
74
- };
75
-
76
- export { a as GlowPod, r as setupInterceptors };
1
+ import e from"axios";class a{instance;constructor(a){this.instance=e.create(a)}getInstance=()=>this.instance;Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others});Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others});Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others});Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others})}const s=200,t=299,r=({instance:e,authFailedCaller:a=()=>{},networkSuccessCode:r=200,authFailedCode:n=401,networkFailedCaller:o=()=>{},serverKillCaller:d=()=>{},responseStruct:c={codeName:"code",messageName:"message",dataName:"data"},setHeaders:i=async e=>{}})=>{let l=null,h=!0;const u=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(h)return e.status<=s&&e.status>=t?d(e):e.data?.[c.codeName]==n?a(e.data):e.data?.[c.codeName]!=r?o(e.data):d(e)},0),()=>h=!1);e.interceptors.request.use(async e=>(e.headers&&await(i?.(e.headers)),e),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}})};export{a as GlowPod,r as setupInterceptors};
@@ -1 +1 @@
1
- !function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],a):a((e="undefined"!=typeof globalThis?globalThis:e||self).GlowPod={},e.axios)}(this,function(e,a){"use strict";const t=200,s=299;e.GlowPod=class{instance;constructor(e){this.instance=a.create(e)}getInstance=()=>this.instance;Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others});Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others});Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others});Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others})},e.setupInterceptors=({instance:e,authFailedCaller:a=()=>{},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,u=!0;const h=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(u)return e.status<=t&&e.status>=s?d(e):e.data?.[i.codeName]==o?a(e.data):e.data?.[i.codeName]!=r?n(e.data):d(e)},0),()=>u=!1);e.interceptors.request.use(async e=>(e.headers&&await(c?.(e.headers)),e),e=>(console.log("请求错误拦截器:",e),h(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=h(e);throw{...e,hiddenDefaultErrorHandler:a}}},e=>{const a=h(e);throw{...e,hiddenDefaultErrorHandler:a}})}});
1
+ !function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],a):a((e="undefined"!=typeof globalThis?globalThis:e||self).GlowPod={},e.axios)}(this,function(e,a){"use strict";const t=200,s=299;e.GlowPod=class{instance;constructor(e){this.instance=a.create(e)}getInstance=()=>this.instance;Get=async e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others});Put=async e=>this.instance({method:"PUT",url:e.url,data:e.params,headers:{...e.headers},...e.others});Delete=async e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others});Post=async e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others})},e.setupInterceptors=({instance:e,authFailedCaller:a=()=>{},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,u=!0;const h=e=>(l&&clearTimeout(l),l=setTimeout(()=>{if(u)return e.status<=t&&e.status>=s?d(e):e.data?.[i.codeName]==o?a(e.data):e.data?.[i.codeName]!=r?n(e.data):d(e)},0),()=>u=!1);e.interceptors.request.use(async e=>(e.headers&&await(c?.(e.headers)),e),e=>(h(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=h(e);throw{...e,hiddenDefaultErrorHandler:a}}},e=>{const a=h(e);throw{...e,hiddenDefaultErrorHandler:a}})}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andbridge/glowpod",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "A axios-based HTTP client library",
5
5
  "main": "build/glowpod.js",
6
6
  "module": "build/glowpod.mjs",
@@ -29,7 +29,6 @@
29
29
  "license": "ISC",
30
30
  "packageManager": "pnpm@10.15.0",
31
31
  "devDependencies": {
32
- "@rollup/plugin-babel": "^6.1.0",
33
32
  "@rollup/plugin-commonjs": "^29.0.0",
34
33
  "@rollup/plugin-node-resolve": "^16.0.3",
35
34
  "@rollup/plugin-terser": "^1.0.0",