Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axios-use/vue

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axios-use/vue - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5-alpha.0

2

dist/axios-use-vue.umd.js

@@ -1,2 +0,2 @@

(function(s,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","vue","axios"],c):(s=typeof globalThis!="undefined"?globalThis:s||self,c(s.AxiosUseVue={},s.Vue,s.Axios))})(this,function(s,c,f){"use strict";var K=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var v=(s,c,f)=>c in s?K(s,c,{enumerable:!0,configurable:!0,writable:!0,value:f}):s[c]=f,I=(s,c)=>{for(var f in c||(c={}))X.call(c,f)&&v(s,f,c[f]);if(b)for(var f of b(c))Y.call(c,f)&&v(s,f,c[f]);return s},U=(s,c)=>Q(s,W(c));const k="[@axios-use/vue warn]: getUseRequestConfig() can only be used inside setup() or functional components.",S=Symbol("axios_use_vue_config"),w=(n,e)=>{Number(n.version.split(".")[0])===2?n.mixin({beforeCreate(){if(!this._provided){const a={};Object.defineProperty(this,"_provided",{get:()=>a,set:u=>Object.assign(a,u)})}this._provided[S]=e}}):n.provide(S,e)},j=n=>n==null?void 0:n.data,D=()=>{const n=!!c.getCurrentInstance();n||console.warn(k);const{instance:e=f,getResponseItem:t=j}=n?c.inject(S,{}):{};return{instance:e,getResponseItem:t}},E={install(n,e){w(n,e)}};function N(n){return n}const O=n=>n;function q(n){var l,g,h,y,R,i,r;const e=n,t=n,a=(g=(l=e==null?void 0:e.response)==null?void 0:l.data)!=null?g:t==null?void 0:t.data,u=(i=(R=(h=a==null?void 0:a.code)!=null?h:e==null?void 0:e.code)!=null?R:(y=e==null?void 0:e.response)==null?void 0:y.status)!=null?i:t==null?void 0:t.status,m=(e==null?void 0:e.message)||((r=e==null?void 0:e.response)==null?void 0:r.statusText)||(t==null?void 0:t.statusText);return{code:u,data:a,message:m,isCancel:f.isCancel(n),original:n}}function A(n,e){const t=D(),a=(e==null?void 0:e.instance)||t.instance,u=c.shallowRef([]),m=c.computed(()=>c.unref(u).length>0),{onCompleted:l,onError:g}=e||{},h=i=>{const r=c.unref(u);i&&r.length>0&&(u.value=r.filter(d=>d.token!==i))},y=i=>{const r=c.unref(u);r.length>0&&(r.map(d=>d.cancel(i)),u.value=[])};return c.onUnmounted(()=>{y()}),[(...i)=>{const r=n(...i),d=f.CancelToken.source();return{ready:()=>(u.value.push(d),a(U(I({},r),{cancelToken:d.token})).then(o=>{h(d.token);const _=e!=null&&e.getResponseItem?e.getResponseItem(o):t.getResponseItem(o);return l==null||l(_,o),[_,o]}).catch(o=>{h(d.token);const _=q(o);throw g==null||g(_),_})),cancel:d.cancel}},{clear:y,hasPending:m}]}function L(n,e){const t=c.ref(e),a=u=>{t.value=n(t.value,u)};return[c.readonly(t),a]}function C(n){return n&&Array.isArray(n)?n.map(e=>c.unref(e)):[]}function M(n){return n&&Array.isArray(n)?n.some(c.isReactive):!1}const V="A new request has been made before completing the last one";function G(n,e){if(n)return e&&typeof e=="function"?e(...n):!0}function B(n,e){const t=e.type==="success"?e.response:n.response;return{data:e.type==="success"?e.data:n.data,response:t,error:e.type==="error"?e.error:void 0,isLoading:e.type==="start"}}function J(n,e,t){const[a,{clear:u}]=A(n,{onCompleted:t==null?void 0:t.onCompleted,onError:t==null?void 0:t.onError,instance:t==null?void 0:t.instance,getResponseItem:t==null?void 0:t.getResponseItem}),[m,l]=L(B,I({isLoading:G(e&&C(e),t==null?void 0:t.filter)},t==null?void 0:t.defaultState)),g=(...r)=>{u(V);const{ready:d,cancel:T}=a(...r);return l({type:"start"}),d().then(([o,_])=>{l({type:"success",data:o,response:_})}).catch(o=>{const _=o;_.isCancel||l({type:"error",error:_})}),T},h=()=>{const r=C(e||[]);if(typeof(t==null?void 0:t.filter)=="function"?t.filter(...r):!0)return g(...r)},y=r=>{l({type:"reset"}),u(r)},R=c.computed(()=>e&&C(e));return c.watch(R,r=>{r&&h()},{immediate:!0,deep:M(e)}),[c.computed(()=>c.unref(m)),g,h,y]}s._request=N,s.createRequestError=q,s.default=E,s.request=O,s.useRequest=A,s.useResource=J,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(s,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","vue","axios"],c):(s=typeof globalThis!="undefined"?globalThis:s||self,c(s.AxiosUseVue={},s.Vue,s.Axios))})(this,function(s,c,f){"use strict";var K=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var v=(s,c,f)=>c in s?K(s,c,{enumerable:!0,configurable:!0,writable:!0,value:f}):s[c]=f,I=(s,c)=>{for(var f in c||(c={}))X.call(c,f)&&v(s,f,c[f]);if(b)for(var f of b(c))Y.call(c,f)&&v(s,f,c[f]);return s},U=(s,c)=>Q(s,W(c));const k="[@axios-use/vue warn]: getUseRequestConfig() can only be used inside setup() or functional components.",S=Symbol("axios_use_vue_config"),w=(n,e)=>{Number(n.version.split(".")[0])===2?n.mixin({beforeCreate(){if(!this._provided){const a={};Object.defineProperty(this,"_provided",{get:()=>a,set:u=>Object.assign(a,u)})}this._provided[S]=e}}):n.provide(S,e)},j=n=>n==null?void 0:n.data,D=()=>{const n=!!c.getCurrentInstance();n||console.warn(k);const{instance:e=f,getResponseItem:t=j}=n?c.inject(S,{}):{};return{instance:e,getResponseItem:t}},E={install(n,e){w(n,e)}};function N(n){return n}const O=n=>n;function q(n){var l,g,h,y,R,i,r;const e=n,t=n,a=(g=(l=e==null?void 0:e.response)==null?void 0:l.data)!=null?g:t==null?void 0:t.data,u=(i=(R=(h=a==null?void 0:a.code)!=null?h:e==null?void 0:e.code)!=null?R:(y=e==null?void 0:e.response)==null?void 0:y.status)!=null?i:t==null?void 0:t.status,m=(e==null?void 0:e.message)||((r=e==null?void 0:e.response)==null?void 0:r.statusText)||(t==null?void 0:t.statusText);return{code:u,data:a,message:m,isCancel:f.isCancel(n),original:n}}function A(n,e){const t=D(),a=(e==null?void 0:e.instance)||t.instance,u=c.shallowRef([]),m=c.computed(()=>c.unref(u).length>0),{onCompleted:l,onError:g}=e||{},h=i=>{const r=c.unref(u);i&&r.length>0&&(u.value=r.filter(d=>d.token!==i))},y=i=>{const r=c.unref(u);r.length>0&&(r.map(d=>d.cancel(i)),u.value=[])};return c.onUnmounted(()=>{y()}),[(...i)=>{const r=n(...i),d=f.CancelToken.source();return{ready:()=>(u.value=[...c.unref(u),d],a(U(I({},r),{cancelToken:d.token})).then(o=>{h(d.token);const _=e!=null&&e.getResponseItem?e.getResponseItem(o):t.getResponseItem(o);return l==null||l(_,o),[_,o]}).catch(o=>{h(d.token);const _=q(o);throw g==null||g(_),_})),cancel:d.cancel}},{clear:y,hasPending:m}]}function L(n,e){const t=c.ref(e),a=u=>{t.value=n(t.value,u)};return[c.readonly(t),a]}function C(n){return n&&Array.isArray(n)?n.map(e=>c.unref(e)):[]}function M(n){return n&&Array.isArray(n)?n.some(c.isReactive):!1}const V="A new request has been made before completing the last one";function G(n,e){if(n)return e&&typeof e=="function"?e(...n):!0}function B(n,e){const t=e.type==="success"?e.response:n.response;return{data:e.type==="success"?e.data:n.data,response:t,error:e.type==="error"?e.error:void 0,isLoading:e.type==="start"}}function J(n,e,t){const[a,{clear:u}]=A(n,{onCompleted:t==null?void 0:t.onCompleted,onError:t==null?void 0:t.onError,instance:t==null?void 0:t.instance,getResponseItem:t==null?void 0:t.getResponseItem}),[m,l]=L(B,I({isLoading:G(e&&C(e),t==null?void 0:t.filter)},t==null?void 0:t.defaultState)),g=(...r)=>{u(V);const{ready:d,cancel:T}=a(...r);return l({type:"start"}),d().then(([o,_])=>{l({type:"success",data:o,response:_})}).catch(o=>{const _=o;_.isCancel||l({type:"error",error:_})}),T},h=()=>{const r=C(e||[]);if(typeof(t==null?void 0:t.filter)=="function"?t.filter(...r):!0)return g(...r)},y=r=>{l({type:"reset"}),u(r)},R=c.computed(()=>e&&C(e));return c.watch(R,r=>{r&&h()},{immediate:!0,deep:M(e)}),[c.computed(()=>c.unref(m)),g,h,y]}s._request=N,s.createRequestError=q,s.default=E,s.request=O,s.useRequest=A,s.useResource=J,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
//# sourceMappingURL=axios-use-vue.umd.js.map

@@ -13,3 +13,3 @@ var v = Object.defineProperty, I = Object.defineProperties;

}, q = (n, e) => I(n, x(e));
import { shallowRef as w, computed as y, unref as f, onUnmounted as U } from "vue";
import { shallowRef as w, computed as y, unref as l, onUnmounted as U } from "vue";
import P from "axios";

@@ -19,8 +19,8 @@ import { getUseRequestConfig as b } from "./context.js";

function H(n, e) {
const t = b(), d = (e == null ? void 0 : e.instance) || t.instance, s = w([]), i = y(() => f(s).length > 0), { onCompleted: l, onError: m } = e || {}, g = (o) => {
const r = f(s);
o && r.length > 0 && (s.value = r.filter((c) => c.token !== o));
const t = b(), d = (e == null ? void 0 : e.instance) || t.instance, r = w([]), i = y(() => l(r).length > 0), { onCompleted: m, onError: f } = e || {}, g = (o) => {
const s = l(r);
o && s.length > 0 && (r.value = s.filter((c) => c.token !== o));
}, h = (o) => {
const r = f(s);
r.length > 0 && (r.map((c) => c.cancel(o)), s.value = []);
const s = l(r);
s.length > 0 && (s.map((c) => c.cancel(o)), r.value = []);
};

@@ -30,11 +30,11 @@ return U(() => {

}), [(...o) => {
const r = n(...o), c = P.CancelToken.source();
return { ready: () => (s.value.push(c), d(q(k({}, r), { cancelToken: c.token })).then((u) => {
const s = n(...o), c = P.CancelToken.source();
return { ready: () => (r.value = [...l(r), c], d(q(k({}, s), { cancelToken: c.token })).then((a) => {
g(c.token);
const a = e != null && e.getResponseItem ? e.getResponseItem(u) : t.getResponseItem(u);
return l == null || l(a, u), [a, u];
}).catch((u) => {
const u = e != null && e.getResponseItem ? e.getResponseItem(a) : t.getResponseItem(a);
return m == null || m(u, a), [u, a];
}).catch((a) => {
g(c.token);
const a = j(u);
throw m == null || m(a), a;
const u = j(a);
throw f == null || f(u), u;
})), cancel: c.cancel };

@@ -41,0 +41,0 @@ }, { clear: h, hasPending: i }];

{
"name": "@axios-use/vue",
"version": "0.2.4",
"version": "0.2.5-alpha.0",
"description": "A Vue composition utilities for Axios.",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc