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

@ahooksjs/use-request

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahooksjs/use-request - npm Package Compare versions

Comparing version 1.0.1-beta.1 to 1.0.1

2

dist/ahooks-use-request.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define(["React"],e):"object"==typeof exports?exports.ahooksUseRequest=e(require("React")):t.ahooksUseRequest=e(t.React)}(this,(function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(e,n){e.exports=t},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){var n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt,a="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,s=a||c||Function("return this")(),f=Object.prototype.toString,l=Math.max,d=Math.min,h=function(){return s.Date.now()};function v(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function p(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(v(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=v(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var a=r.test(t);return a||o.test(t)?u(t.slice(2),a?2:8):i.test(t)?NaN:+t}t.exports=function(t,e,n){var i,r,o,u,a,c,s=0,f=!1,g=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=i,o=r;return i=r=void 0,s=e,u=t.apply(o,n)}function m(t){return s=t,a=setTimeout(O,e),f?y(t):u}function j(t){var n=t-c;return void 0===c||n>=e||n<0||g&&t-s>=o}function O(){var t=h();if(j(t))return w(t);a=setTimeout(O,function(t){var n=e-(t-c);return g?d(n,o-(t-s)):n}(t))}function w(t){return a=void 0,b&&i?y(t):(i=r=void 0,u)}function T(){var t=h(),n=j(t);if(i=arguments,r=this,c=t,n){if(void 0===a)return m(c);if(g)return a=setTimeout(O,e),y(c)}return void 0===a&&(a=setTimeout(O,e)),u}return e=p(e)||0,v(n)&&(f=!!n.leading,o=(g="maxWait"in n)?l(p(n.maxWait)||0,e):o,b="trailing"in n?!!n.trailing:b),T.cancel=function(){void 0!==a&&clearTimeout(a),s=0,i=c=r=a=void 0},T.flush=function(){return void 0===a?u:w(h())},T}}).call(this,n(1))},function(t,e,n){(function(e){var n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt,a="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,s=a||c||Function("return this")(),f=Object.prototype.toString,l=Math.max,d=Math.min,h=function(){return s.Date.now()};function v(t,e,n){var i,r,o,u,a,c,s=0,f=!1,v=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=i,o=r;return i=r=void 0,s=e,u=t.apply(o,n)}function m(t){return s=t,a=setTimeout(O,e),f?y(t):u}function j(t){var n=t-c;return void 0===c||n>=e||n<0||v&&t-s>=o}function O(){var t=h();if(j(t))return w(t);a=setTimeout(O,function(t){var n=e-(t-c);return v?d(n,o-(t-s)):n}(t))}function w(t){return a=void 0,b&&i?y(t):(i=r=void 0,u)}function T(){var t=h(),n=j(t);if(i=arguments,r=this,c=t,n){if(void 0===a)return m(c);if(v)return a=setTimeout(O,e),y(c)}return void 0===a&&(a=setTimeout(O,e)),u}return e=g(e)||0,p(n)&&(f=!!n.leading,o=(v="maxWait"in n)?l(g(n.maxWait)||0,e):o,b="trailing"in n?!!n.trailing:b),T.cancel=function(){void 0!==a&&clearTimeout(a),s=0,i=c=r=a=void 0},T.flush=function(){return void 0===a?u:w(h())},T}function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function g(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(p(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=p(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var a=r.test(t);return a||o.test(t)?u(t.slice(2),a?2:8):i.test(t)?NaN:+t}t.exports=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),v(t,e,{leading:i,maxWait:e,trailing:r})}}).call(this,n(1))},function(t,e,n){"use strict";n.r(e),n.d(e,"useAsync",(function(){return T})),n.d(e,"usePaginated",(function(){return E})),n.d(e,"useLoadMore",(function(){return S})),n.d(e,"UseRequestProvider",(function(){return D}));function i(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}var r=n(0),o=n.n(r),u=n(2),a=n.n(u),c=n(3),s=n.n(c);function f(){return"undefined"==typeof document||void 0===document.visibilityState||"hidden"!==document.visibilityState}var l={};var d=function(t,e){void 0===e&&(e=[]);var n=Object(r.useRef)((function(){throw new Error("Cannot call an event handler while rendering.")}));Object(r.useEffect)((function(){n.current=t}),[t].concat(e));var i=Object(r.useCallback)((function(){var t=n.current;if(t)return t.apply(void 0,arguments)}),[n]);if("function"==typeof t)return i},h=function(t,e){var n=Object(r.useRef)(!1);Object(r.useEffect)((function(){if(n.current)return t();n.current=!0}),e)},v=[];var p=!1;if("undefined"!=typeof window&&window.addEventListener&&!p){var g=function(){if(f()&&(void 0===navigator.onLine||navigator.onLine))for(var t=0;t<v.length;t++){(0,v[t])()}};window.addEventListener("visibilitychange",g,!1),window.addEventListener("focus",g,!1),p=!0}var b=function(t){return v.push(t),function(){var e=v.indexOf(t);v.splice(e,1)}},y=[];var m=!1;if("undefined"!=typeof window&&window.addEventListener&&!m){window.addEventListener("visibilitychange",(function(){if(f())for(var t=0;t<y.length;t++){(0,y[t])()}}),!1),m=!0}var j=function(t){return y.push(t),function(){var e=y.indexOf(t);y.splice(e,1)}},O="AHOOKS_USE_REQUEST_DEFAULT_KEY",w=function(){function t(t,e,n,i){var r,o,u;this.count=0,this.unmountedFlag=!1,this.pollingWhenVisibleFlag=!1,this.pollingTimer=void 0,this.loadingDelayTimer=void 0,this.unsubscribe=[],this.that=this,this.state={loading:!1,params:[],data:void 0,error:void 0,run:this.run.bind(this.that),mutate:this.mutate.bind(this.that),refresh:this.refresh.bind(this.that),cancel:this.cancel.bind(this.that),unmount:this.unmount.bind(this.that)},this.service=t,this.config=e,this.subscribe=n,i&&(this.state=Object.assign(Object.assign({},this.state),i)),this.debounceRun=this.config.debounceInterval?a()(this._run,this.config.debounceInterval):void 0,this.throttleRun=this.config.throttleInterval?s()(this._run,this.config.throttleInterval):void 0,this.limitRefresh=(r=this.refresh.bind(this),o=this.config.focusTimespan,u=!1,function(){u||(u=!0,r.apply(void 0,arguments),setTimeout((function(){u=!1}),o))}),this.config.pollingInterval&&this.unsubscribe.push(j(this.rePolling.bind(this))),this.config.refreshOnWindowFocus&&this.unsubscribe.push(b(this.limitRefresh.bind(this)))}var e=t.prototype;return e.setState=function(t){void 0===t&&(t={}),this.state=Object.assign(Object.assign({},this.state),t),this.subscribe(this.state)},e._run=function(){for(var t=this,e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];this.pollingTimer&&clearTimeout(this.pollingTimer),this.loadingDelayTimer&&clearTimeout(this.loadingDelayTimer),this.count+=1;var r=this.count;return this.setState({loading:!this.config.loadingDelay,params:n}),this.config.loadingDelay&&(this.loadingDelayTimer=setTimeout((function(){t.setState({loading:!0})}),this.config.loadingDelay)),this.service.apply(this,n).then((function(e){if(!t.unmountedFlag&&r===t.count){t.loadingDelayTimer&&clearTimeout(t.loadingDelayTimer);var i=t.config.formatResult?t.config.formatResult(e):e;return t.setState({data:i,error:void 0,loading:!1}),t.config.onSuccess&&t.config.onSuccess(i,n),i}})).catch((function(e){if(!t.unmountedFlag&&r===t.count)return t.loadingDelayTimer&&clearTimeout(t.loadingDelayTimer),t.setState({data:void 0,error:e,loading:!1}),t.config.onError&&t.config.onError(e,n),console.error(e),e})).finally((function(){if(!t.unmountedFlag&&r===t.count&&t.config.pollingInterval){if(!f()&&!t.config.pollingWhenHidden)return void(t.pollingWhenVisibleFlag=!0);t.pollingTimer=setTimeout((function(){t._run.apply(t,n)}),t.config.pollingInterval)}}))},e.run=function(){return this.debounceRun?(this.debounceRun.apply(this,arguments),Promise.resolve(null)):this.throttleRun?(this.throttleRun.apply(this,arguments),Promise.resolve(null)):this._run.apply(this,arguments)},e.cancel=function(){this.debounceRun&&this.debounceRun.cancel(),this.throttleRun&&this.throttleRun.cancel(),this.loadingDelayTimer&&clearTimeout(this.loadingDelayTimer),this.pollingTimer&&clearTimeout(this.pollingTimer),this.pollingWhenVisibleFlag=!1,this.count+=1,this.setState({loading:!1})},e.refresh=function(){return this.run.apply(this,this.state.params)},e.rePolling=function(){this.pollingWhenVisibleFlag&&(this.pollingWhenVisibleFlag=!1,this.refresh())},e.mutate=function(t){"function"==typeof t?this.setState({data:t(this.state.data)||{}}):this.setState({data:t})},e.unmount=function(){this.unmountedFlag=!0,this.cancel(),this.unsubscribe.forEach((function(t){t()}))},t}();var T=function(t,e){var n,i=e||{},o=i.refreshDeps,u=void 0===o?[]:o,a=i.manual,c=void 0!==a&&a,s=i.onSuccess,f=void 0===s?function(){}:s,v=i.onError,p=void 0===v?function(){}:v,g=i.defaultLoading,b=void 0!==g&&g,y=i.loadingDelay,m=i.pollingInterval,j=void 0===m?0:m,T=i.pollingWhenHidden,S=void 0===T||T,E=i.defaultParams,R=void 0===E?[]:E,x=i.refreshOnWindowFocus,D=void 0!==x&&x,P=i.focusTimespan,M=void 0===P?5e3:P,C=i.fetchKey,F=i.cacheKey,k=i.debounceInterval,I=i.throttleInterval,W=i.initialData,_=i.ready,K=void 0===_||_,L=Object(r.useRef)(O),N=d(t),z=d(f),q=d(p),$=d(C);"formatResult"in i&&(n=i.formatResult);var U={formatResult:d(n),onSuccess:z,onError:q,loadingDelay:y,pollingInterval:j,pollingWhenHidden:S,refreshOnWindowFocus:D,focusTimespan:M,debounceInterval:k,throttleInterval:I},A=d((function(t,e){Y((function(n){return n[t]=e,Object.assign({},n)}))}),[]),H=Object(r.useState)((function(){if(F){var t=null===(n=l[F])||void 0===n?void 0:n.data;if(t){L.current=t.newstFetchKey;var e={};return Object.keys(t.fetches).forEach((function(n){var i=t.fetches[n],r=new w(N,U,A.bind(null,n),{loading:i.loading,params:i.params,data:i.data,error:i.error});e[n]=r.state})),e}}var n;return[]})),V=H[0],Y=H[1],Q=Object(r.useRef)(V);Q.current=V;var B=Object(r.useRef)(),G=Object(r.useCallback)((function(){for(var t,e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(K){if($){var r=$.apply(void 0,n);L.current=void 0===r?O:r}var o=L.current,u=Q.current[o];if(!u){var a=new w(N,U,A.bind(null,o),{data:W});u=a.state,Y((function(t){return t[o]=u,Object.assign({},t)}))}return(t=u).run.apply(t,n)}B.current=n}),[C,A,K]),J=Object(r.useRef)(G);J.current=G,Object(r.useEffect)((function(){F&&function(t,e){l[t]&&clearTimeout(l[t].timer);var n=setTimeout((function(){delete l[t]}),3e5);l[t]={data:e,timer:n}}(F,{fetches:V,newstFetchKey:L.current})}),[F,V]);var X=Object(r.useRef)(!1);h((function(){K&&(!X.current&&B.current&&J.current.apply(J,B.current),X.current=!0)}),[K]),Object(r.useEffect)((function(){c||(Object.keys(V).length>0?Object.values(V).forEach((function(t){t.refresh()})):J.current.apply(J,R))}),[]);var Z=Object(r.useCallback)((function(){Object.values(Q.current).forEach((function(t){t.unmount()})),L.current=O,Y({}),Q.current={}}),[Y]);h((function(){c||Object.values(Q.current).forEach((function(t){t.refresh()}))}),[].concat(u)),Object(r.useEffect)((function(){return function(){Object.values(Q.current).forEach((function(t){t.unmount()}))}}),[]);var tt=Object(r.useCallback)((function(t){return function(){throw new Error("Cannot call "+t+" when service not executed once.")}}),[]);return Object.assign(Object.assign({loading:K&&!c||b,data:W,error:void 0,params:[],cancel:tt("cancel"),refresh:tt("refresh"),mutate:tt("mutate")},V[L.current]||{}),{run:G,fetches:V,reset:Z})};var S=function(t,e){var n=e.refreshDeps,o=void 0===n?[]:n,u=e.ref,a=e.isNoMore,c=e.threshold,s=void 0===c?100:c,f=(e.fetchKey,i(e,["refreshDeps","ref","isNoMore","threshold","fetchKey"])),l=Object(r.useState)(!1),d=l[0],v=l[1];Object(r.useEffect)((function(){e.fetchKey&&console.warn("useRequest loadMore mode don't need fetchKey!")}),[]);var p=T(t,Object.assign(Object.assign({},f),{fetchKey:function(t){var e;return(null===(e=null==t?void 0:t.list)||void 0===e?void 0:e.length)||0},onSuccess:function(){v(!1),e.onSuccess&&e.onSuccess.apply(e,arguments)}})),g=p.data,b=p.run,y=p.params,m=p.reset,j=p.loading,O=p.fetches,w=Object(r.useCallback)((function(){m();var t=y.slice(1);b.apply(void 0,[void 0].concat(t))}),[b,m,y]),S=Object(r.useRef)(w);S.current=w,h((function(){e.manual||S.current()}),[].concat(o));var E=Object(r.useMemo)((function(){var t=[],e=g;return Object.values(O).forEach((function(n){var i,r;(null===(i=n.data)||void 0===i?void 0:i.list)&&(t=t.concat(null===(r=n.data)||void 0===r?void 0:r.list)),n.loading||(e=n.data)})),Object.assign(Object.assign({},e),{list:t})}),[O,g]),R=!!a&&(!j&&!d&&a(E)),x=Object(r.useCallback)((function(){if(!R){v(!0);var t=y.slice(1);b.apply(void 0,[E].concat(t))}}),[R,b,E,y]),D=Object(r.useCallback)((function(){!j&&!d&&u&&u.current&&u.current.scrollHeight-u.current.scrollTop<=u.current.clientHeight+s&&x()}),[j,u,x]);return Object(r.useEffect)((function(){return u&&u.current?(u.current.addEventListener("scroll",D),function(){u&&u.current&&u.current.removeEventListener("scroll",D)}):function(){}}),[D]),Object.assign(Object.assign({},p),{data:E,reload:w,loading:j&&0===E.list.length,loadMore:x,loadingMore:d,noMore:R})};var E=function(t,e){e.paginated;var n=e.defaultPageSize,o=void 0===n?10:n,u=e.refreshDeps,a=void 0===u?[]:u,c=e.fetchKey,s=i(e,["paginated","defaultPageSize","refreshDeps","fetchKey"]);Object(r.useEffect)((function(){c&&console.error("useRequest pagination's fetchKey will not work!")}),[]);var f=T(t,Object.assign({defaultParams:[{current:1,pageSize:o}]},s)),l=f.data,d=f.params,v=f.run,p=f.loading,g=i(f,["data","params","run","loading"]),b=d&&d[0]?d[0]:{},y=b.current,m=void 0===y?1:y,j=b.pageSize,O=void 0===j?o:j,w=b.sorter,S=void 0===w?{}:w,E=b.filters,R=void 0===E?{}:E,x=Object(r.useCallback)((function(t){var e=d[0],n=d.slice(1);v.apply(void 0,[Object.assign(Object.assign({},e),t)].concat(n))}),[v,d]),D=(null==l?void 0:l.total)||0,P=Object(r.useMemo)((function(){return Math.ceil(D/O)}),[O,D]),M=Object(r.useCallback)((function(t,e){var n=t<=0?1:t,i=e<=0?1:e,r=Math.ceil(D/i);n>r&&(n=r),x({current:t,pageSize:e})}),[D,x]),C=Object(r.useCallback)((function(t){M(t,O)}),[M,O]),F=Object(r.useCallback)((function(t){M(m,t)}),[M,m]),k=Object(r.useRef)(C);k.current=C,h((function(){e.manual||k.current(1)}),[].concat(a));var I=Object(r.useCallback)((function(t,e,n){x({current:t.current,pageSize:t.pageSize||o,filters:e,sorter:n})}),[R,S,x]);return Object.assign({loading:p,data:l,params:d,run:v,pagination:{current:m,pageSize:O,total:D,totalPage:P,onChange:M,changeCurrent:C,changePageSize:F},tableProps:{dataSource:(null==l?void 0:l.list)||[],loading:p,onChange:I,pagination:{current:m,pageSize:O,total:D}},sorter:S,filters:R},g)},R=o.a.createContext({});R.displayName="UseRequestConfigContext";var x=R;var D=x.Provider;e.default=function(t,e){void 0===e&&(e={});var n=Object(r.useContext)(x),o=Object.assign(Object.assign({},n),e),u=o.paginated,a=o.loadMore,c=o.requestMethod,s=Object(r.useRef)(u),f=Object(r.useRef)(a);if(s.current!==u)throw Error("You should not modify the paginated of options");if(f.current!==a)throw Error("You should not modify the loadMore of options");s.current=u,f.current=a;var l,d=function(){return fetch.apply(void 0,arguments).then((function(t){if(t.ok)return t.json();throw new Error(t.statusText)}))},h=c||d;if("string"==typeof t)l=function(){return h(t)};else if("object"==typeof t){var v=t.url,p=i(t,["url"]);l=function(){return c?c(t):d(v,p)}}else l=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return new Promise((function(e,r){var o=t.apply(void 0,n);if(o.then)o.then((function(t){return e(t)})).catch((function(t){return r(t)}));else if("string"==typeof o)h(o).then((function(t){e(t)})).catch((function(t){return r(t)}));else if("object"==typeof o)if(c)c(o).then((function(t){e(t)})).catch((function(t){return r(t)}));else{var u=o.url,a=i(o,["url"]);d(u,a).then((function(t){e(t)})).catch((function(t){return r(t)}))}}))};return a?S(l,o):u?E(l,o):T(l,o)}}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define(["React"],e):"object"==typeof exports?exports.ahooksUseRequest=e(require("React")):t.ahooksUseRequest=e(t.React)}(this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(e,n){e.exports=t},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt,a="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,s=a||c||Function("return this")(),f=Object.prototype.toString,l=Math.max,d=Math.min,h=function(){return s.Date.now()};function v(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function p(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(v(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=v(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var a=i.test(t);return a||o.test(t)?u(t.slice(2),a?2:8):r.test(t)?NaN:+t}t.exports=function(t,e,n){var r,i,o,u,a,c,s=0,f=!1,g=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=r,o=i;return r=i=void 0,s=e,u=t.apply(o,n)}function m(t){return s=t,a=setTimeout(j,e),f?y(t):u}function O(t){var n=t-c;return void 0===c||n>=e||n<0||g&&t-s>=o}function j(){var t=h();if(O(t))return w(t);a=setTimeout(j,function(t){var n=e-(t-c);return g?d(n,o-(t-s)):n}(t))}function w(t){return a=void 0,b&&r?y(t):(r=i=void 0,u)}function T(){var t=h(),n=O(t);if(r=arguments,i=this,c=t,n){if(void 0===a)return m(c);if(g)return a=setTimeout(j,e),y(c)}return void 0===a&&(a=setTimeout(j,e)),u}return e=p(e)||0,v(n)&&(f=!!n.leading,o=(g="maxWait"in n)?l(p(n.maxWait)||0,e):o,b="trailing"in n?!!n.trailing:b),T.cancel=function(){void 0!==a&&clearTimeout(a),s=0,r=c=i=a=void 0},T.flush=function(){return void 0===a?u:w(h())},T}}).call(this,n(1))},function(t,e,n){(function(e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt,a="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,s=a||c||Function("return this")(),f=Object.prototype.toString,l=Math.max,d=Math.min,h=function(){return s.Date.now()};function v(t,e,n){var r,i,o,u,a,c,s=0,f=!1,v=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=r,o=i;return r=i=void 0,s=e,u=t.apply(o,n)}function m(t){return s=t,a=setTimeout(j,e),f?y(t):u}function O(t){var n=t-c;return void 0===c||n>=e||n<0||v&&t-s>=o}function j(){var t=h();if(O(t))return w(t);a=setTimeout(j,function(t){var n=e-(t-c);return v?d(n,o-(t-s)):n}(t))}function w(t){return a=void 0,b&&r?y(t):(r=i=void 0,u)}function T(){var t=h(),n=O(t);if(r=arguments,i=this,c=t,n){if(void 0===a)return m(c);if(v)return a=setTimeout(j,e),y(c)}return void 0===a&&(a=setTimeout(j,e)),u}return e=g(e)||0,p(n)&&(f=!!n.leading,o=(v="maxWait"in n)?l(g(n.maxWait)||0,e):o,b="trailing"in n?!!n.trailing:b),T.cancel=function(){void 0!==a&&clearTimeout(a),s=0,r=c=i=a=void 0},T.flush=function(){return void 0===a?u:w(h())},T}function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function g(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(p(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=p(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var a=i.test(t);return a||o.test(t)?u(t.slice(2),a?2:8):r.test(t)?NaN:+t}t.exports=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),v(t,e,{leading:r,maxWait:e,trailing:i})}}).call(this,n(1))},function(t,e,n){"use strict";n.r(e),n.d(e,"useAsync",(function(){return T})),n.d(e,"usePaginated",(function(){return S})),n.d(e,"useLoadMore",(function(){return E})),n.d(e,"UseRequestProvider",(function(){return D}));function r(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}var i=n(0),o=n.n(i),u=n(2),a=n.n(u),c=n(3),s=n.n(c);function f(){return"undefined"==typeof document||void 0===document.visibilityState||"hidden"!==document.visibilityState}var l={};var d=function(t,e){void 0===e&&(e=[]);var n=Object(i.useRef)((function(){throw new Error("Cannot call an event handler while rendering.")}));Object(i.useEffect)((function(){n.current=t}),[t].concat(e));var r=Object(i.useCallback)((function(){var t=n.current;if(t)return t.apply(void 0,arguments)}),[n]);if("function"==typeof t)return r},h=function(t,e){var n=Object(i.useRef)(!1);Object(i.useEffect)((function(){if(n.current)return t();n.current=!0}),e)},v=[];var p=!1;if("undefined"!=typeof window&&window.addEventListener&&!p){var g=function(){if(f()&&(void 0===navigator.onLine||navigator.onLine))for(var t=0;t<v.length;t++){(0,v[t])()}};window.addEventListener("visibilitychange",g,!1),window.addEventListener("focus",g,!1),p=!0}var b=function(t){return v.push(t),function(){var e=v.indexOf(t);v.splice(e,1)}},y=[];var m=!1;if("undefined"!=typeof window&&window.addEventListener&&!m){window.addEventListener("visibilitychange",(function(){if(f())for(var t=0;t<y.length;t++){(0,y[t])()}}),!1),m=!0}var O=function(t){return y.push(t),function(){var e=y.indexOf(t);y.splice(e,1)}},j="AHOOKS_USE_REQUEST_DEFAULT_KEY",w=function(){function t(t,e,n,r){var i,o,u;this.count=0,this.unmountedFlag=!1,this.pollingWhenVisibleFlag=!1,this.pollingTimer=void 0,this.loadingDelayTimer=void 0,this.unsubscribe=[],this.that=this,this.state={loading:!1,params:[],data:void 0,error:void 0,run:this.run.bind(this.that),mutate:this.mutate.bind(this.that),refresh:this.refresh.bind(this.that),cancel:this.cancel.bind(this.that),unmount:this.unmount.bind(this.that)},this.service=t,this.config=e,this.subscribe=n,r&&(this.state=Object.assign(Object.assign({},this.state),r)),this.debounceRun=this.config.debounceInterval?a()(this._run,this.config.debounceInterval):void 0,this.throttleRun=this.config.throttleInterval?s()(this._run,this.config.throttleInterval):void 0,this.limitRefresh=(i=this.refresh.bind(this),o=this.config.focusTimespan,u=!1,function(){u||(u=!0,i.apply(void 0,arguments),setTimeout((function(){u=!1}),o))}),this.config.pollingInterval&&this.unsubscribe.push(O(this.rePolling.bind(this))),this.config.refreshOnWindowFocus&&this.unsubscribe.push(b(this.limitRefresh.bind(this)))}var e=t.prototype;return e.setState=function(t){void 0===t&&(t={}),this.state=Object.assign(Object.assign({},this.state),t),this.subscribe(this.state)},e._run=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];this.pollingTimer&&clearTimeout(this.pollingTimer),this.loadingDelayTimer&&clearTimeout(this.loadingDelayTimer),this.count+=1;var i=this.count;return this.setState({loading:!this.config.loadingDelay,params:n}),this.config.loadingDelay&&(this.loadingDelayTimer=setTimeout((function(){t.setState({loading:!0})}),this.config.loadingDelay)),this.service.apply(this,n).then((function(e){if(!t.unmountedFlag&&i===t.count){t.loadingDelayTimer&&clearTimeout(t.loadingDelayTimer);var r=t.config.formatResult?t.config.formatResult(e):e;return t.setState({data:r,error:void 0,loading:!1}),t.config.onSuccess&&t.config.onSuccess(r,n),r}})).catch((function(e){if(!t.unmountedFlag&&i===t.count){if(t.loadingDelayTimer&&clearTimeout(t.loadingDelayTimer),t.setState({data:void 0,error:e,loading:!1}),t.config.onError&&t.config.onError(e,n),t.config.throwOnError)throw e;console.error(e)}})).finally((function(){if(!t.unmountedFlag&&i===t.count&&t.config.pollingInterval){if(!f()&&!t.config.pollingWhenHidden)return void(t.pollingWhenVisibleFlag=!0);t.pollingTimer=setTimeout((function(){t._run.apply(t,n)}),t.config.pollingInterval)}}))},e.run=function(){return this.debounceRun?(this.debounceRun.apply(this,arguments),Promise.resolve(null)):this.throttleRun?(this.throttleRun.apply(this,arguments),Promise.resolve(null)):this._run.apply(this,arguments)},e.cancel=function(){this.debounceRun&&this.debounceRun.cancel(),this.throttleRun&&this.throttleRun.cancel(),this.loadingDelayTimer&&clearTimeout(this.loadingDelayTimer),this.pollingTimer&&clearTimeout(this.pollingTimer),this.pollingWhenVisibleFlag=!1,this.count+=1,this.setState({loading:!1})},e.refresh=function(){return this.run.apply(this,this.state.params)},e.rePolling=function(){this.pollingWhenVisibleFlag&&(this.pollingWhenVisibleFlag=!1,this.refresh())},e.mutate=function(t){"function"==typeof t?this.setState({data:t(this.state.data)||{}}):this.setState({data:t})},e.unmount=function(){this.unmountedFlag=!0,this.cancel(),this.unsubscribe.forEach((function(t){t()}))},t}();var T=function(t,e){var n,r=e||{},o=r.refreshDeps,u=void 0===o?[]:o,a=r.manual,c=void 0!==a&&a,s=r.onSuccess,f=void 0===s?function(){}:s,v=r.onError,p=void 0===v?function(){}:v,g=r.defaultLoading,b=void 0!==g&&g,y=r.loadingDelay,m=r.pollingInterval,O=void 0===m?0:m,T=r.pollingWhenHidden,E=void 0===T||T,S=r.defaultParams,R=void 0===S?[]:S,x=r.refreshOnWindowFocus,D=void 0!==x&&x,P=r.focusTimespan,M=void 0===P?5e3:P,C=r.fetchKey,F=r.cacheKey,k=r.debounceInterval,I=r.throttleInterval,W=r.initialData,_=r.ready,K=void 0===_||_,L=r.throwOnError,N=void 0!==L&&L,z=Object(i.useRef)(j),q=d(t),$=d(f),U=d(p),A=d(C);"formatResult"in r&&(n=r.formatResult);var H={formatResult:d(n),onSuccess:$,onError:U,loadingDelay:y,pollingInterval:O,pollingWhenHidden:E,refreshOnWindowFocus:D,focusTimespan:M,debounceInterval:k,throttleInterval:I,throwOnError:N},V=d((function(t,e){B((function(n){return n[t]=e,Object.assign({},n)}))}),[]),Y=Object(i.useState)((function(){if(F){var t=null===(n=l[F])||void 0===n?void 0:n.data;if(t){z.current=t.newstFetchKey;var e={};return Object.keys(t.fetches).forEach((function(n){var r=t.fetches[n],i=new w(q,H,V.bind(null,n),{loading:r.loading,params:r.params,data:r.data,error:r.error});e[n]=i.state})),e}}var n;return[]})),Q=Y[0],B=Y[1],G=Object(i.useRef)(Q);G.current=Q;var J=Object(i.useRef)(),X=Object(i.useCallback)((function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(K){if(A){var i=A.apply(void 0,n);z.current=void 0===i?j:i}var o=z.current,u=G.current[o];if(!u){var a=new w(q,H,V.bind(null,o),{data:W});u=a.state,B((function(t){return t[o]=u,Object.assign({},t)}))}return(t=u).run.apply(t,n)}J.current=n}),[C,V,K]),Z=Object(i.useRef)(X);Z.current=X,Object(i.useEffect)((function(){F&&function(t,e){l[t]&&clearTimeout(l[t].timer);var n=setTimeout((function(){delete l[t]}),3e5);l[t]={data:e,timer:n}}(F,{fetches:Q,newstFetchKey:z.current})}),[F,Q]);var tt=Object(i.useRef)(!1);h((function(){K&&(!tt.current&&J.current&&Z.current.apply(Z,J.current),tt.current=!0)}),[K]),Object(i.useEffect)((function(){c||(Object.keys(Q).length>0?Object.values(Q).forEach((function(t){t.refresh()})):Z.current.apply(Z,R))}),[]);var et=Object(i.useCallback)((function(){Object.values(G.current).forEach((function(t){t.unmount()})),z.current=j,B({}),G.current={}}),[B]);h((function(){c||Object.values(G.current).forEach((function(t){t.refresh()}))}),[].concat(u)),Object(i.useEffect)((function(){return function(){Object.values(G.current).forEach((function(t){t.unmount()}))}}),[]);var nt=Object(i.useCallback)((function(t){return function(){throw new Error("Cannot call "+t+" when service not executed once.")}}),[]);return Object.assign(Object.assign({loading:K&&!c||b,data:W,error:void 0,params:[],cancel:nt("cancel"),refresh:nt("refresh"),mutate:nt("mutate")},Q[z.current]||{}),{run:X,fetches:Q,reset:et})};var E=function(t,e){var n=e.refreshDeps,o=void 0===n?[]:n,u=e.ref,a=e.isNoMore,c=e.threshold,s=void 0===c?100:c,f=(e.fetchKey,r(e,["refreshDeps","ref","isNoMore","threshold","fetchKey"])),l=Object(i.useState)(!1),d=l[0],v=l[1];Object(i.useEffect)((function(){e.fetchKey&&console.warn("useRequest loadMore mode don't need fetchKey!")}),[]);var p=T(t,Object.assign(Object.assign({},f),{fetchKey:function(t){var e;return(null===(e=null==t?void 0:t.list)||void 0===e?void 0:e.length)||0},onSuccess:function(){v(!1),e.onSuccess&&e.onSuccess.apply(e,arguments)}})),g=p.data,b=p.run,y=p.params,m=p.reset,O=p.loading,j=p.fetches,w=Object(i.useCallback)((function(){m();var t=y.slice(1);b.apply(void 0,[void 0].concat(t))}),[b,m,y]),E=Object(i.useRef)(w);E.current=w,h((function(){e.manual||E.current()}),[].concat(o));var S=Object(i.useMemo)((function(){var t=[],e=g;return Object.values(j).forEach((function(n){var r,i;(null===(r=n.data)||void 0===r?void 0:r.list)&&(t=t.concat(null===(i=n.data)||void 0===i?void 0:i.list)),n.loading||(e=n.data)})),Object.assign(Object.assign({},e),{list:t})}),[j,g]),R=!!a&&(!O&&!d&&a(S)),x=Object(i.useCallback)((function(){if(!R){v(!0);var t=y.slice(1);b.apply(void 0,[S].concat(t))}}),[R,b,S,y]),D=Object(i.useCallback)((function(){!O&&!d&&u&&u.current&&u.current.scrollHeight-u.current.scrollTop<=u.current.clientHeight+s&&x()}),[O,u,x]);return Object(i.useEffect)((function(){return u&&u.current?(u.current.addEventListener("scroll",D),function(){u&&u.current&&u.current.removeEventListener("scroll",D)}):function(){}}),[D]),Object.assign(Object.assign({},p),{data:S,reload:w,loading:O&&0===S.list.length,loadMore:x,loadingMore:d,noMore:R})};var S=function(t,e){e.paginated;var n=e.defaultPageSize,o=void 0===n?10:n,u=e.refreshDeps,a=void 0===u?[]:u,c=e.fetchKey,s=r(e,["paginated","defaultPageSize","refreshDeps","fetchKey"]);Object(i.useEffect)((function(){c&&console.error("useRequest pagination's fetchKey will not work!")}),[]);var f=T(t,Object.assign({defaultParams:[{current:1,pageSize:o}]},s)),l=f.data,d=f.params,v=f.run,p=f.loading,g=r(f,["data","params","run","loading"]),b=d&&d[0]?d[0]:{},y=b.current,m=void 0===y?1:y,O=b.pageSize,j=void 0===O?o:O,w=b.sorter,E=void 0===w?{}:w,S=b.filters,R=void 0===S?{}:S,x=Object(i.useCallback)((function(t){var e=d[0],n=d.slice(1);v.apply(void 0,[Object.assign(Object.assign({},e),t)].concat(n))}),[v,d]),D=(null==l?void 0:l.total)||0,P=Object(i.useMemo)((function(){return Math.ceil(D/j)}),[j,D]),M=Object(i.useCallback)((function(t,e){var n=t<=0?1:t,r=e<=0?1:e,i=Math.ceil(D/r);n>i&&(n=i),x({current:t,pageSize:e})}),[D,x]),C=Object(i.useCallback)((function(t){M(t,j)}),[M,j]),F=Object(i.useCallback)((function(t){M(m,t)}),[M,m]),k=Object(i.useRef)(C);k.current=C,h((function(){e.manual||k.current(1)}),[].concat(a));var I=Object(i.useCallback)((function(t,e,n){x({current:t.current,pageSize:t.pageSize||o,filters:e,sorter:n})}),[R,E,x]);return Object.assign({loading:p,data:l,params:d,run:v,pagination:{current:m,pageSize:j,total:D,totalPage:P,onChange:M,changeCurrent:C,changePageSize:F},tableProps:{dataSource:(null==l?void 0:l.list)||[],loading:p,onChange:I,pagination:{current:m,pageSize:j,total:D}},sorter:E,filters:R},g)},R=o.a.createContext({});R.displayName="UseRequestConfigContext";var x=R;var D=x.Provider;e.default=function(t,e){void 0===e&&(e={});var n=Object(i.useContext)(x),o=Object.assign(Object.assign({},n),e),u=o.paginated,a=o.loadMore,c=o.requestMethod,s=Object(i.useRef)(u),f=Object(i.useRef)(a);if(s.current!==u)throw Error("You should not modify the paginated of options");if(f.current!==a)throw Error("You should not modify the loadMore of options");s.current=u,f.current=a;var l,d=function(){return fetch.apply(void 0,arguments).then((function(t){if(t.ok)return t.json();throw new Error(t.statusText)}))},h=c||d;if("string"==typeof t)l=function(){return h(t)};else if("object"==typeof t){var v=t.url,p=r(t,["url"]);l=function(){return c?c(t):d(v,p)}}else l=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return new Promise((function(e,i){var o=t.apply(void 0,n);if(o.then)o.then((function(t){return e(t)})).catch((function(t){return i(t)}));else if("string"==typeof o)h(o).then((function(t){e(t)})).catch((function(t){return i(t)}));else if("object"==typeof o)if(c)c(o).then((function(t){e(t)})).catch((function(t){return i(t)}));else{var u=o.url,a=r(o,["url"]);d(u,a).then((function(t){e(t)})).catch((function(t){return i(t)}))}}))};return a?E(l,o):u?S(l,o):T(l,o)}}])}));
import { DependencyList, RefObject } from 'react';
import { PaginationConfig, Filter, Sorter } from './antdTypes';
import { cachedKeyType } from './utils/cache';
export declare type noop = (...args: any[]) => void;

@@ -36,2 +37,3 @@ export declare type Service<R, P extends any[]> = (...args: P) => Promise<R>;

throttleInterval?: number;
throwOnError?: boolean;
}

@@ -59,3 +61,3 @@ export interface BaseResult<R, P extends any[]> extends FetchResult<R, P> {

focusTimespan?: number;
cacheKey?: string;
cacheKey?: cachedKeyType;
debounceInterval?: number;

@@ -66,2 +68,3 @@ throttleInterval?: number;

ready?: boolean;
throwOnError?: boolean;
};

@@ -68,0 +71,0 @@ export declare type OptionsWithFormat<R, P extends any[], U, UU extends U> = {

@@ -135,6 +135,11 @@ import debounce from 'lodash.debounce';

_this.config.onError(error, args);
} // If throwOnError, user should catch the error self,
// or the page will crash
if (_this.config.throwOnError) {
throw error;
}
console.error(error);
return error; // throw error;
}

@@ -262,3 +267,5 @@ })["finally"](function () {

_options$ready = _options.ready,
ready = _options$ready === void 0 ? true : _options$ready;
ready = _options$ready === void 0 ? true : _options$ready,
_options$throwOnError = _options.throwOnError,
throwOnError = _options$throwOnError === void 0 ? false : _options$throwOnError;
var newstFetchKey = useRef(DEFAULT_KEY); // 持久化一些函数

@@ -288,3 +295,4 @@

debounceInterval: debounceInterval,
throttleInterval: throttleInterval
throttleInterval: throttleInterval,
throwOnError: throwOnError
};

@@ -291,0 +299,0 @@ var subscribe = usePersistFn(function (key, data) {

@@ -1,3 +0,4 @@

declare const setCache: (key: string, data: any) => void;
declare const getCache: (key: string) => any;
export declare type cachedKeyType = string | number;
declare const setCache: (key: cachedKeyType, data: any) => void;
declare const getCache: (key: cachedKeyType) => any;
export { getCache, setCache };
import { DependencyList, RefObject } from 'react';
import { PaginationConfig, Filter, Sorter } from './antdTypes';
import { cachedKeyType } from './utils/cache';
export declare type noop = (...args: any[]) => void;

@@ -36,2 +37,3 @@ export declare type Service<R, P extends any[]> = (...args: P) => Promise<R>;

throttleInterval?: number;
throwOnError?: boolean;
}

@@ -59,3 +61,3 @@ export interface BaseResult<R, P extends any[]> extends FetchResult<R, P> {

focusTimespan?: number;
cacheKey?: string;
cacheKey?: cachedKeyType;
debounceInterval?: number;

@@ -66,2 +68,3 @@ throttleInterval?: number;

ready?: boolean;
throwOnError?: boolean;
};

@@ -68,0 +71,0 @@ export declare type OptionsWithFormat<R, P extends any[], U, UU extends U> = {

@@ -153,6 +153,11 @@ "use strict";

_this.config.onError(error, args);
} // If throwOnError, user should catch the error self,
// or the page will crash
if (_this.config.throwOnError) {
throw error;
}
console.error(error);
return error; // throw error;
}

@@ -280,3 +285,5 @@ })["finally"](function () {

_options$ready = _options.ready,
ready = _options$ready === void 0 ? true : _options$ready;
ready = _options$ready === void 0 ? true : _options$ready,
_options$throwOnError = _options.throwOnError,
throwOnError = _options$throwOnError === void 0 ? false : _options$throwOnError;
var newstFetchKey = react_1.useRef(DEFAULT_KEY); // 持久化一些函数

@@ -306,3 +313,4 @@

debounceInterval: debounceInterval,
throttleInterval: throttleInterval
throttleInterval: throttleInterval,
throwOnError: throwOnError
};

@@ -309,0 +317,0 @@ var subscribe = usePersistFn_1["default"](function (key, data) {

@@ -1,3 +0,4 @@

declare const setCache: (key: string, data: any) => void;
declare const getCache: (key: string) => any;
export declare type cachedKeyType = string | number;
declare const setCache: (key: cachedKeyType, data: any) => void;
declare const getCache: (key: cachedKeyType) => any;
export { getCache, setCache };
{
"name": "@ahooksjs/use-request",
"version": "1.0.1-beta.1",
"version": "1.0.1",
"description": "React Hooks for fetching, caching and updating asynchronous data",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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