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

rest-hooks

Package Overview
Dependencies
Maintainers
3
Versions
328
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-hooks - npm Package Compare versions

Comparing version 6.2.0-beta.2 to 6.2.0-beta.3

80

dist/index.js

@@ -14,21 +14,9 @@ 'use strict';

function _createRawReactElement(type, props, key, children) {
if (!REACT_ELEMENT_TYPE) {
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
}
var defaultProps = type && type.defaultProps;
var childrenLength = arguments.length - 3;
if (!props && childrenLength !== 0) {
props = {
children: void 0
};
}
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = new Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103);
var defaultProps = type && type.defaultProps,
childrenLength = arguments.length - 3;
if (props || 0 === childrenLength || (props = {
children: void 0
}), 1 === childrenLength) props.children = children;else if (childrenLength > 1) {
for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 3];

@@ -39,17 +27,9 @@ }

}
if (props && defaultProps) {
for (var propName in defaultProps) {
if (props[propName] === void 0) {
props[propName] = defaultProps[propName];
}
}
} else if (!props) {
props = defaultProps || {};
}
if (props && defaultProps) for (var propName in defaultProps) {
void 0 === props[propName] && (props[propName] = defaultProps[propName]);
} else props || (props = defaultProps || {});
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key === undefined ? null : "" + key,
key: void 0 === key ? null : "" + key,
ref: null,

@@ -466,4 +446,6 @@ props: props,

this.middleware = ({
getState
getState,
controller
}) => {
const reducer = core.createReducer(controller);
return next => action => {

@@ -473,3 +455,3 @@ return next(action).then(() => {

const state = getState();
this.devTools.send(action, state.optimistic.reduce(core.reducer, state), undefined, 'REST_HOOKS');
this.devTools.send(action, state.optimistic.reduce(reducer, state), undefined, 'REST_HOOKS');
});

@@ -514,10 +496,11 @@ };

store,
selector
selector,
controller
}) {
React.useRef({
entities: {},
results: {}
});
const [state, setState] = React.useState(() => selector(store.getState()));
const optimisticState = React.useMemo(() => state.optimistic.reduce(core.reducer, state), [state]);
const masterReducer = React.useMemo(() => core.createReducer(controller), [controller]);
const selectState = React.useCallback(() => {
const state = selector(store.getState());
return state.optimistic.reduce(masterReducer, state);
}, [masterReducer, selector, store]);
const [state, setState] = React.useState(selectState);
const isMounted = React.useRef(true);

@@ -529,20 +512,15 @@ React.useEffect(() => () => {

const unsubscribe = store.subscribe(() => {
if (isMounted.current) setState(selector(store.getState()));
if (isMounted.current) setState(selectState());
});
return unsubscribe; // we don't care to recompute if they change selector - only when store updates
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [store]);
return unsubscribe;
}, [selectState, store]);
const dispatch = core.usePromisifiedDispatch(store.dispatch, state);
const controller = React.useRef();
if (!controller.current) controller.current = new core.Controller({
dispatch
});
return /*#__PURE__*/_createRawReactElement(core.DispatchContext.Provider, {
value: dispatch
}, void 0, /*#__PURE__*/_createRawReactElement(core.StateContext.Provider, {
value: optimisticState
value: state
}, void 0, /*#__PURE__*/_createRawReactElement(core.ControllerContext.Provider, {
value: controller.current
value: controller
}, void 0, /*#__PURE__*/_createRawReactElement(core.DenormalizeCacheContext.Provider, {
value: controller.current.globalCache
value: controller.globalCache
}, void 0, children))));

@@ -549,0 +527,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@rest-hooks/core"),require("react")):"function"==typeof define&&define.amd?define(["exports","@rest-hooks/core","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).restHook={},e.core,e.React)}(this,(function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i;function o(e,t,n,r){i||(i="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103);var o=e&&e.defaultProps,s=arguments.length-3;if(t||0===s||(t={children:void 0}),1===s)t.children=r;else if(s>1){for(var u=new Array(s),a=0;a<s;a++)u[a]=arguments[a+3];t.children=u}if(t&&o)for(var c in o)void 0===t[c]&&(t[c]=o[c]);else t||(t=o||{});return{$$typeof:i,type:e,key:void 0===n?null:""+n,ref:null,props:t,_owner:null}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={},t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n),r.getDerivedStateFromError=function(e){if(function(e){return Object.prototype.hasOwnProperty.call(e,"status")}(e))return{error:e};throw e},r.prototype.render=function(){return this.state.error?o(this.props.fallbackComponent,{error:this.state.error}):this.props.children},r}(r(n).default.Component);u.defaultProps={fallbackComponent:function(e){var t,n=e.error;return o("div",{},void 0,n.status," ",null==(t=n.response)?void 0:t.statusText)}};var a=function(){function e(){}var t=e.prototype;return t.isOnline=function(){return void 0===navigator.onLine||navigator.onLine},t.addOnlineListener=function(e){addEventListener("online",e)},t.removeOnlineListener=function(e){removeEventListener("online",e)},t.addOfflineListener=function(e){addEventListener("offline",e)},t.removeOfflineListener=function(e){removeEventListener("offline",e)},e}(),c="undefined"!=typeof navigator&&"function"==typeof addEventListener?a:function(){function e(){}var t=e.prototype;return t.isOnline=function(){return!0},t.addOnlineListener=function(){},t.removeOnlineListener=function(){},t.addOfflineListener=function(){},t.removeOfflineListener=function(){},e}(),f=t.actionTypes.FETCH_TYPE,l=function(){function e(e,t,n){var r=this,i=e.key,o=e.schema,s=e.fetch,u=e.frequency,a=e.getState;if(this.frequencyHistogram=new Map,this.offlineListener=function(){r.cleanup(),r.connectionListener.addOnlineListener(r.onlineListener)},this.onlineListener=function(){r.connectionListener.removeOnlineListener(r.onlineListener);var e=Date.now();r.startId=setTimeout((function(){delete r.startId,r.update(),r.run()}),Math.max(0,r.lastFetchTime()-e+r.frequency)),r.connectionListener.addOfflineListener(r.offlineListener)},void 0===u)throw new Error("frequency needed for polling subscription");this.schema=o,this.fetch=s,this.frequency=u,this.key=i,this.frequencyHistogram.set(this.frequency,1),this.dispatch=t,this.getState=a,this.connectionListener=n||new c,this.connectionListener.isOnline()?this.onlineListener():this.offlineListener()}var t=e.prototype;return t.add=function(e){void 0!==e&&(this.frequencyHistogram.has(e)?this.frequencyHistogram.set(e,this.frequencyHistogram.get(e)+1):(this.frequencyHistogram.set(e,1),e<this.frequency&&(this.frequency=e,this.run())))},t.remove=function(e){if(void 0===e)return!1;if(this.frequencyHistogram.has(e)&&(this.frequencyHistogram.set(e,this.frequencyHistogram.get(e)-1),this.frequencyHistogram.get(e)<1)){if(this.frequencyHistogram.delete(e),0===this.frequencyHistogram.size)return this.cleanup(),!0;e<=this.frequency&&(this.frequency=Math.min.apply(Math,this.frequencyHistogram.keys()),this.run())}return!1},t.cleanup=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.lastIntervalId&&(clearInterval(this.lastIntervalId),this.lastIntervalId=void 0),this.startId&&(clearTimeout(this.startId),delete this.startId),this.connectionListener.removeOnlineListener(this.onlineListener),this.connectionListener.removeOfflineListener(this.offlineListener)},t.update=function(){this.dispatch({type:f,payload:this.fetch,meta:{schema:this.schema,key:this.key,type:"read",throttle:!0,options:{dataExpiryLength:this.frequency/2,errorExpiryLength:this.frequency/10,errorPolicy:function(){return"soft"}},createdAt:new Date,resolve:function(){},reject:function(){}}})},t.run=function(){var e=this;this.startId||(this.lastIntervalId=this.intervalId,this.intervalId=setInterval((function(){e.lastIntervalId&&(clearInterval(e.lastIntervalId),e.lastIntervalId=void 0),e.update()}),this.frequency))},t.lastFetchTime=function(){var e,t;return null!=(e=null==(t=this.getState().meta[this.key])?void 0:t.date)?e:0},e}(),d=t.actionTypes.SUBSCRIBE_TYPE,h=t.actionTypes.UNSUBSCRIBE_TYPE,p=function(){function e(e){var t=this;this.subscriptions={},this.Subscription=e,this.middleware=function(e){var n=e.dispatch,r=e.getState;return function(e){return function(i){switch(i.type){case d:try{t.handleSubscribe(i,n,r)}catch(e){console.error(e)}return Promise.resolve();case h:return t.handleUnsubscribe(i,n),Promise.resolve();default:return e(i)}}}}}var t=e.prototype;return t.cleanup=function(){for(var e in this.subscriptions)this.subscriptions[e].cleanup()},t.handleSubscribe=function(e,t,n){var r,i=e.meta.key,o=null==(r=e.meta.options)?void 0:r.pollFrequency;i in this.subscriptions?this.subscriptions[i].add(o):this.subscriptions[i]=new this.Subscription({schema:e.meta.schema,fetch:e.meta.fetch,frequency:o,key:i,getState:n},t)},t.handleUnsubscribe=function(e,t){var n,r=e.meta.key,i=null==(n=e.meta.options)?void 0:n.pollFrequency;r in this.subscriptions&&(this.subscriptions[r].remove(i)&&delete this.subscriptions[r])},t.getMiddleware=function(){return this.middleware},e}(),v=function(){function e(e,t){var n;void 0===e&&(e={name:"Rest Hooks: "+(null==(n=globalThis.document)?void 0:n.title)});this.devTools="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__.connect(e),this.middleware=function(){return function(e){return function(t){return e(t)}}}}var t=e.prototype;return t.init=function(e){this.devTools&&this.devTools.init(e)},t.cleanup=function(){},t.getMiddleware=function(){return this.middleware},e}(),y=function(e){return function(e){return function(t){return e(t),Promise.resolve()}}};var m=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.map((function(t){return function(n){var r=n.getState,i=n.dispatch;return t({getState:function(){return e(r())},dispatch:i})}}))}},b=function(e){return t.CacheProvider(e)};b.defaultProps=Object.assign({},t.CacheProvider.defaultProps,{managers:[].concat(t.CacheProvider.defaultProps.managers,[new p(l)])});var g=t.__INTERNAL__.inferResults,O=t.__INTERNAL__.RIC,P=Object.freeze({__proto__:null,inferResults:g,RIC:O,initialState:t.initialState,StateContext:t.StateContext,DispatchContext:t.DispatchContext,hasUsableData:t.hasUsableData});Object.defineProperty(e,"Endpoint",{enumerable:!0,get:function(){return t.Endpoint}}),Object.defineProperty(e,"Index",{enumerable:!0,get:function(){return t.Index}}),Object.defineProperty(e,"useCache",{enumerable:!0,get:function(){return t.useCache}}),Object.defineProperty(e,"useController",{enumerable:!0,get:function(){return t.useController}}),Object.defineProperty(e,"useDenormalized",{enumerable:!0,get:function(){return t.useDenormalized}}),Object.defineProperty(e,"useError",{enumerable:!0,get:function(){return t.useError}}),Object.defineProperty(e,"useFetch",{enumerable:!0,get:function(){return t.useFetch}}),Object.defineProperty(e,"useFetcher",{enumerable:!0,get:function(){return t.useFetcher}}),Object.defineProperty(e,"useInvalidator",{enumerable:!0,get:function(){return t.useInvalidator}}),Object.defineProperty(e,"useMeta",{enumerable:!0,get:function(){return t.useMeta}}),Object.defineProperty(e,"usePromisifiedDispatch",{enumerable:!0,get:function(){return t.usePromisifiedDispatch}}),Object.defineProperty(e,"useResetter",{enumerable:!0,get:function(){return t.useResetter}}),Object.defineProperty(e,"useResource",{enumerable:!0,get:function(){return t.useResource}}),Object.defineProperty(e,"useRetrieve",{enumerable:!0,get:function(){return t.useRetrieve}}),Object.defineProperty(e,"useSubscription",{enumerable:!0,get:function(){return t.useSubscription}}),Object.defineProperty(e,"useSuspense",{enumerable:!0,get:function(){return t.useSuspense}}),e.CacheProvider=b,e.DefaultConnectionListener=c,e.DevToolsManager=v,e.ExternalCacheProvider=function(e){var r=e.children,i=e.store,s=e.selector;n.useRef({entities:{},results:{}});var u=n.useState((function(){return s(i.getState())})),a=u[0],c=u[1],f=n.useMemo((function(){return a.optimistic.reduce(t.reducer,a)}),[a]),l=n.useRef(!0);n.useEffect((function(){return function(){l.current=!1}}),[]),n.useEffect((function(){return i.subscribe((function(){l.current&&c(s(i.getState()))}))}),[i]);var d=t.usePromisifiedDispatch(i.dispatch,a),h=n.useRef();return h.current||(h.current=new t.Controller({dispatch:d})),o(t.DispatchContext.Provider,{value:d},void 0,o(t.StateContext.Provider,{value:f},void 0,o(t.ControllerContext.Provider,{value:h.current},void 0,o(t.DenormalizeCacheContext.Provider,{value:h.current.globalCache},void 0,r))))},e.NetworkErrorBoundary=u,e.PollingSubscription=l,e.PromiseifyMiddleware=y,e.SubscriptionManager=p,e.__INTERNAL__=P,e.mapMiddleware=m,e.useSelectionUnstable=function(e,r,i){void 0===i&&(i=function(e){return JSON.stringify(e)});var o=n.useContext(t.StateContext);return n.useMemo((function(){return r&&e(o,r)}),[r&&i(r),e,o])},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@rest-hooks/core"),require("react")):"function"==typeof define&&define.amd?define(["exports","@rest-hooks/core","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).restHook={},e.core,e.React)}(this,(function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i;function o(e,t,n,r){i||(i="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103);var o=e&&e.defaultProps,s=arguments.length-3;if(t||0===s||(t={children:void 0}),1===s)t.children=r;else if(s>1){for(var u=new Array(s),a=0;a<s;a++)u[a]=arguments[a+3];t.children=u}if(t&&o)for(var c in o)void 0===t[c]&&(t[c]=o[c]);else t||(t=o||{});return{$$typeof:i,type:e,key:void 0===n?null:""+n,ref:null,props:t,_owner:null}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={},t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n),r.getDerivedStateFromError=function(e){if(function(e){return Object.prototype.hasOwnProperty.call(e,"status")}(e))return{error:e};throw e},r.prototype.render=function(){return this.state.error?o(this.props.fallbackComponent,{error:this.state.error}):this.props.children},r}(r(n).default.Component);u.defaultProps={fallbackComponent:function(e){var t,n=e.error;return o("div",{},void 0,n.status," ",null==(t=n.response)?void 0:t.statusText)}};var a=function(){function e(){}var t=e.prototype;return t.isOnline=function(){return void 0===navigator.onLine||navigator.onLine},t.addOnlineListener=function(e){addEventListener("online",e)},t.removeOnlineListener=function(e){removeEventListener("online",e)},t.addOfflineListener=function(e){addEventListener("offline",e)},t.removeOfflineListener=function(e){removeEventListener("offline",e)},e}(),c="undefined"!=typeof navigator&&"function"==typeof addEventListener?a:function(){function e(){}var t=e.prototype;return t.isOnline=function(){return!0},t.addOnlineListener=function(){},t.removeOnlineListener=function(){},t.addOfflineListener=function(){},t.removeOfflineListener=function(){},e}(),f=t.actionTypes.FETCH_TYPE,l=function(){function e(e,t,n){var r=this,i=e.key,o=e.schema,s=e.fetch,u=e.frequency,a=e.getState;if(this.frequencyHistogram=new Map,this.offlineListener=function(){r.cleanup(),r.connectionListener.addOnlineListener(r.onlineListener)},this.onlineListener=function(){r.connectionListener.removeOnlineListener(r.onlineListener);var e=Date.now();r.startId=setTimeout((function(){delete r.startId,r.update(),r.run()}),Math.max(0,r.lastFetchTime()-e+r.frequency)),r.connectionListener.addOfflineListener(r.offlineListener)},void 0===u)throw new Error("frequency needed for polling subscription");this.schema=o,this.fetch=s,this.frequency=u,this.key=i,this.frequencyHistogram.set(this.frequency,1),this.dispatch=t,this.getState=a,this.connectionListener=n||new c,this.connectionListener.isOnline()?this.onlineListener():this.offlineListener()}var t=e.prototype;return t.add=function(e){void 0!==e&&(this.frequencyHistogram.has(e)?this.frequencyHistogram.set(e,this.frequencyHistogram.get(e)+1):(this.frequencyHistogram.set(e,1),e<this.frequency&&(this.frequency=e,this.run())))},t.remove=function(e){if(void 0===e)return!1;if(this.frequencyHistogram.has(e)&&(this.frequencyHistogram.set(e,this.frequencyHistogram.get(e)-1),this.frequencyHistogram.get(e)<1)){if(this.frequencyHistogram.delete(e),0===this.frequencyHistogram.size)return this.cleanup(),!0;e<=this.frequency&&(this.frequency=Math.min.apply(Math,this.frequencyHistogram.keys()),this.run())}return!1},t.cleanup=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.lastIntervalId&&(clearInterval(this.lastIntervalId),this.lastIntervalId=void 0),this.startId&&(clearTimeout(this.startId),delete this.startId),this.connectionListener.removeOnlineListener(this.onlineListener),this.connectionListener.removeOfflineListener(this.offlineListener)},t.update=function(){this.dispatch({type:f,payload:this.fetch,meta:{schema:this.schema,key:this.key,type:"read",throttle:!0,options:{dataExpiryLength:this.frequency/2,errorExpiryLength:this.frequency/10,errorPolicy:function(){return"soft"}},createdAt:new Date,resolve:function(){},reject:function(){}}})},t.run=function(){var e=this;this.startId||(this.lastIntervalId=this.intervalId,this.intervalId=setInterval((function(){e.lastIntervalId&&(clearInterval(e.lastIntervalId),e.lastIntervalId=void 0),e.update()}),this.frequency))},t.lastFetchTime=function(){var e,t;return null!=(e=null==(t=this.getState().meta[this.key])?void 0:t.date)?e:0},e}(),d=t.actionTypes.SUBSCRIBE_TYPE,h=t.actionTypes.UNSUBSCRIBE_TYPE,p=function(){function e(e){var t=this;this.subscriptions={},this.Subscription=e,this.middleware=function(e){var n=e.dispatch,r=e.getState;return function(e){return function(i){switch(i.type){case d:try{t.handleSubscribe(i,n,r)}catch(e){console.error(e)}return Promise.resolve();case h:return t.handleUnsubscribe(i,n),Promise.resolve();default:return e(i)}}}}}var t=e.prototype;return t.cleanup=function(){for(var e in this.subscriptions)this.subscriptions[e].cleanup()},t.handleSubscribe=function(e,t,n){var r,i=e.meta.key,o=null==(r=e.meta.options)?void 0:r.pollFrequency;i in this.subscriptions?this.subscriptions[i].add(o):this.subscriptions[i]=new this.Subscription({schema:e.meta.schema,fetch:e.meta.fetch,frequency:o,key:i,getState:n},t)},t.handleUnsubscribe=function(e,t){var n,r=e.meta.key,i=null==(n=e.meta.options)?void 0:n.pollFrequency;r in this.subscriptions&&(this.subscriptions[r].remove(i)&&delete this.subscriptions[r])},t.getMiddleware=function(){return this.middleware},e}(),v=function(){function e(e,t){var n;void 0===e&&(e={name:"Rest Hooks: "+(null==(n=globalThis.document)?void 0:n.title)});this.devTools="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__.connect(e),this.middleware=function(){return function(e){return function(t){return e(t)}}}}var t=e.prototype;return t.init=function(e){this.devTools&&this.devTools.init(e)},t.cleanup=function(){},t.getMiddleware=function(){return this.middleware},e}(),y=function(e){return function(e){return function(t){return e(t),Promise.resolve()}}};var m=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.map((function(t){return function(n){var r=n.getState,i=n.dispatch;return t({getState:function(){return e(r())},dispatch:i})}}))}},b=function(e){return t.CacheProvider(e)};b.defaultProps=Object.assign({},t.CacheProvider.defaultProps,{managers:[].concat(t.CacheProvider.defaultProps.managers,[new p(l)])});var g=t.__INTERNAL__.inferResults,O=t.__INTERNAL__.RIC,P=Object.freeze({__proto__:null,inferResults:g,RIC:O,initialState:t.initialState,StateContext:t.StateContext,DispatchContext:t.DispatchContext,hasUsableData:t.hasUsableData});Object.defineProperty(e,"Endpoint",{enumerable:!0,get:function(){return t.Endpoint}}),Object.defineProperty(e,"Index",{enumerable:!0,get:function(){return t.Index}}),Object.defineProperty(e,"useCache",{enumerable:!0,get:function(){return t.useCache}}),Object.defineProperty(e,"useController",{enumerable:!0,get:function(){return t.useController}}),Object.defineProperty(e,"useDenormalized",{enumerable:!0,get:function(){return t.useDenormalized}}),Object.defineProperty(e,"useError",{enumerable:!0,get:function(){return t.useError}}),Object.defineProperty(e,"useFetch",{enumerable:!0,get:function(){return t.useFetch}}),Object.defineProperty(e,"useFetcher",{enumerable:!0,get:function(){return t.useFetcher}}),Object.defineProperty(e,"useInvalidator",{enumerable:!0,get:function(){return t.useInvalidator}}),Object.defineProperty(e,"useMeta",{enumerable:!0,get:function(){return t.useMeta}}),Object.defineProperty(e,"usePromisifiedDispatch",{enumerable:!0,get:function(){return t.usePromisifiedDispatch}}),Object.defineProperty(e,"useResetter",{enumerable:!0,get:function(){return t.useResetter}}),Object.defineProperty(e,"useResource",{enumerable:!0,get:function(){return t.useResource}}),Object.defineProperty(e,"useRetrieve",{enumerable:!0,get:function(){return t.useRetrieve}}),Object.defineProperty(e,"useSubscription",{enumerable:!0,get:function(){return t.useSubscription}}),Object.defineProperty(e,"useSuspense",{enumerable:!0,get:function(){return t.useSuspense}}),e.CacheProvider=b,e.DefaultConnectionListener=c,e.DevToolsManager=v,e.ExternalCacheProvider=function(e){var r=e.children,i=e.store,s=e.selector,u=e.controller,a=n.useMemo((function(){return t.createReducer(u)}),[u]),c=n.useCallback((function(){var e=s(i.getState());return e.optimistic.reduce(a,e)}),[a,s,i]),f=n.useState(c),l=f[0],d=f[1],h=n.useRef(!0);n.useEffect((function(){return function(){h.current=!1}}),[]),n.useEffect((function(){return i.subscribe((function(){h.current&&d(c())}))}),[c,i]);var p=t.usePromisifiedDispatch(i.dispatch,l);return o(t.DispatchContext.Provider,{value:p},void 0,o(t.StateContext.Provider,{value:l},void 0,o(t.ControllerContext.Provider,{value:u},void 0,o(t.DenormalizeCacheContext.Provider,{value:u.globalCache},void 0,r))))},e.NetworkErrorBoundary=u,e.PollingSubscription=l,e.PromiseifyMiddleware=y,e.SubscriptionManager=p,e.__INTERNAL__=P,e.mapMiddleware=m,e.useSelectionUnstable=function(e,r,i){void 0===i&&(i=function(e){return JSON.stringify(e)});var o=n.useContext(t.StateContext);return n.useMemo((function(){return r&&e(o,r)}),[r&&i(r),e,o])},Object.defineProperty(e,"__esModule",{value:!0})}));

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

import { reducer } from '@rest-hooks/core';
import { createReducer } from '@rest-hooks/core';

@@ -23,4 +23,6 @@ /** Integrates with https://github.com/zalmoxisus/redux-devtools-extension

this.middleware = ({
getState
getState,
controller
}) => {
const reducer = createReducer(controller);
return next => action => {

@@ -59,2 +61,2 @@ return next(action).then(() => {

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tYW5hZ2VyL0RldnRvb2xzTWFuYWdlci50cyJdLCJuYW1lcyI6WyJyZWR1Y2VyIiwiRGV2VG9vbHNNYW5hZ2VyIiwiY29uc3RydWN0b3IiLCJjb25maWciLCJuYW1lIiwiZ2xvYmFsVGhpcyIsImRvY3VtZW50IiwidGl0bGUiLCJza2lwTG9nZ2luZyIsImRldlRvb2xzIiwid2luZG93IiwiX19SRURVWF9ERVZUT09MU19FWFRFTlNJT05fXyIsImNvbm5lY3QiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJtaWRkbGV3YXJlIiwiZ2V0U3RhdGUiLCJuZXh0IiwiYWN0aW9uIiwidGhlbiIsInN0YXRlIiwic2VuZCIsIm9wdGltaXN0aWMiLCJyZWR1Y2UiLCJ1bmRlZmluZWQiLCJpbml0IiwiY2xlYW51cCIsImdldE1pZGRsZXdhcmUiXSwibWFwcGluZ3MiOiJBQUFBLFNBTUVBLE9BTkYsUUFRTyxrQkFSUDs7QUFlQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGVBQWUsTUFBTUMsZUFBTixDQUF5QztBQUl0REMsRUFBQUEsV0FBVyxDQUNUQyxNQUFzQixHQUFHO0FBQ3ZCQyxJQUFBQSxJQUFJLEVBQUcsZUFBRDtBQUFBOztBQUFBLHFDQUFlQyxVQUFVLENBQUNDLFFBQTFCLHFCQUFlLHFCQUFxQkMsS0FBcEM7QUFBQSxRQUEwQztBQUR6QixHQURoQixFQUlUQyxXQUpTLEVBS1Q7QUFDQTtBQUNBLFNBQUtDLFFBQUwsR0FDRSxPQUFPQyxNQUFQLEtBQWtCLFdBQWxCLElBQ0NBLE1BQUQsQ0FBZ0JDLDRCQURoQixJQUVDRCxNQUFELENBQWdCQyw0QkFBaEIsQ0FBNkNDLE9B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IG5leHQgKi9cbiAgICB0aGlzLmRldlRvb2xzID1cbiAgICAgIHR5cGVvZiB3aW5kb3cgIT09ICd1bmRlZmluZWQnICYmXG4gICAgICAod2luZG93IGFzIGFueSkuX19SRURVWF9ERVZUT09MU19FWFRFTlNJT05fXyAmJlxuICAgICAgKHdpbmRvdyBhcyBhbnkpLl9fUkVEVVhfREVWVE9PTFNfRVhURU5TSU9OX18uY29ubmVjdChjb25maWcpO1xuXG4gICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09ICdkZXZlbG9wbWVudCcgJiYgdGhpcy5kZXZUb29scykge1xuICAgICAgdGhpcy5taWRkbGV3YXJlID0gPFIgZXh0ZW5kcyBSZWFjdC5SZWR1Y2VyPGFueSwgYW55Pj4oe1xuICAgICAgICBnZXRTdGF0ZSxcbiAgICAgIH06IE1pZGRsZXdhcmVBUEk8Uj4pID0+IHtcbiAgICAgICAgcmV0dXJuIChuZXh0OiBEaXNwYXRjaDxSPikgPT4gKGFjdGlvbjogUmVhY3QuUmVkdWNlckFjdGlvbjxSPikgPT4ge1xuICAgICAgICAgIHJldHVybiBuZXh0KGFjdGlvbikudGhlbigoKSA9PiB7XG4gICAgICAgICAgICBpZiAoc2tpcExvZ2dpbmc/LihhY3Rpb24pKSByZXR1cm47XG4gICAgICAgICAgICBjb25zdCBzdGF0ZSA9IGdldFN0YXRlKCk7XG4gICAgICAgICAgICB0aGlzLmRldlRvb2xzLnNlbmQoXG4gICAgICAgICAgICAgIGFjdGlvbixcbiAgICAgICAgICAgICAgc3RhdGUub3B0aW1pc3RpYy5yZWR1Y2UocmVkdWNlciwgc3RhdGUpLFxuICAgICAgICAgICAgICB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICdSRVNUX0hPT0tTJyxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfSk7XG4gICAgICAg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ICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICBpZiAodGhpcy5kZXZUb29scykgdGhpcy5kZXZUb29scy5pbml0KHN0YXRlKTtcbiAgfVxuXG4gIC8qKiBFbnN1cmVzIGFsbCBzdWJzY3JpcHRpb25zIGFyZSBjbGVhbmVkIHVwLiAqL1xuICBjbGVhbnVwKCkge31cblxuICAvKiogQXR0YWNoZXMgTWFuYWdlciB0byBzdG9yZVxuICAgKlxuICAgKi9cbiAgZ2V0TWlkZGxld2FyZTxUIGV4dGVuZHMgRGV2VG9vbHNNYW5hZ2VyPih0aGlzOiBUKSB7XG4gICAgcmV0dXJuIHRoaXMubWlkZGxld2FyZTtcbiAgfVxufVxuIl19
import _jsx from "@babel/runtime/helpers/esm/jsx";
import { StateContext, DispatchContext, ControllerContext, reducer, usePromisifiedDispatch, DenormalizeCacheContext, Controller } from '@rest-hooks/core';
import React, { useEffect, useState, useMemo, useRef } from 'react';
import { StateContext, DispatchContext, ControllerContext, createReducer, usePromisifiedDispatch, DenormalizeCacheContext } from '@rest-hooks/core';
import React, { useEffect, useState, useMemo, useRef, useCallback } from 'react';
export default function ExternalCacheProvider({
children,
store,
selector
selector,
controller
}) {
const denormalizeCache = useRef({
entities: {},
results: {}
});
const [state, setState] = useState(() => selector(store.getState()));
const optimisticState = useMemo(() => state.optimistic.reduce(reducer, state), [state]);
const masterReducer = useMemo(() => createReducer(controller), [controller]);
const selectState = useCallback(() => {
const state = selector(store.getState());
return state.optimistic.reduce(masterReducer, state);
}, [masterReducer, selector, store]);
const [state, setState] = useState(selectState);
const isMounted = useRef(true);

@@ -21,22 +22,17 @@ useEffect(() => () => {

const unsubscribe = store.subscribe(() => {
if (isMounted.current) setState(selector(store.getState()));
if (isMounted.current) setState(selectState());
});
return unsubscribe; // we don't care to recompute if they change selector - only when store updates
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [store]);
return unsubscribe;
}, [selectState, store]);
const dispatch = usePromisifiedDispatch(store.dispatch, state);
const controller = useRef();
if (!controller.current) controller.current = new Controller({
dispatch
});
return /*#__PURE__*/_jsx(DispatchContext.Provider, {
value: dispatch
}, void 0, /*#__PURE__*/_jsx(StateContext.Provider, {
value: optimisticState
value: state
}, void 0, /*#__PURE__*/_jsx(ControllerContext.Provider, {
value: controller.current
value: controller
}, void 0, /*#__PURE__*/_jsx(DenormalizeCacheContext.Provider, {
value: controller.current.globalCache
value: controller.globalCache
}, void 0, children))));
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9yZWFjdC1pbnRlZ3JhdGlvbi9wcm92aWRlci9FeHRlcm5hbENhY2hlUHJvdmlkZXIudHN4Il0sIm5hbWVzIjpbIlN0YXRlQ29udGV4dCIsIkRpc3BhdGNoQ29udGV4dCIsIkNvbnRyb2xsZXJDb250ZXh0IiwicmVkdWNlciIsInVzZVByb21pc2lmaWVkRGlzcGF0Y2giLCJEZW5vcm1hbGl6ZUNhY2hlQ29udGV4dCIsIkNvbnRyb2xsZXIiLCJSZWFjdCIsInVzZUVmZmVjdCIsInVzZVN0YXRlIiwidXNlTWVtbyIsInVzZVJlZiIsIkV4dGVybmFsQ2FjaGVQcm92aWRlciIsImNoaWxkcmVuIiwic3RvcmUiLCJzZWxlY3RvciIsImRlbm9ybWFsaXplQ2FjaGUiLCJlbnRpdGllcyIsInJlc3VsdHMiLCJzdGF0ZSIsInNldFN0YXRlIiwiZ2V0U3RhdGUiLCJvcHRpbWlzdGljU3RhdGUiLCJvcHRpbWlzdGljIiwicmVkdWNlIiwiaXNNb3VudGVkIiwiY3VycmVudCIsInVuc3Vic2NyaWJlIiwic3Vic2NyaWJlIiwiZGlzcGF0Y2giLCJjb250cm9sbGVyIiwiZ2xvYmFsQ2FjaGUiXSwibWFwcGluZ3MiOiI7QUFBQSxTQUNFQSxZQURGLEVBRUVDLGVBRkYsRUFHRUMsaUJBSEYsRUFJRUMsT0FKRixFQ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XG4gICAgICAgIDwvQ29udHJvbGxlckNvbnRleHQuUHJvdmlkZXI+XG4gICAgICA8L1N0YXRlQ29udGV4dC5Qcm92aWRlcj5cbiAgICA8L0Rpc3BhdGNoQ29udGV4dC5Qcm92aWRlcj5cbiAgKTtcbn1cbiJdfQ==

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

import { reducer } from '@rest-hooks/core';
import { createReducer } from '@rest-hooks/core';

@@ -23,4 +23,6 @@ /** Integrates with https://github.com/zalmoxisus/redux-devtools-extension

this.middleware = ({
getState
getState,
controller
}) => {
const reducer = createReducer(controller);
return next => action => {

@@ -59,2 +61,2 @@ return next(action).then(() => {

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tYW5hZ2VyL0RldnRvb2xzTWFuYWdlci50cyJdLCJuYW1lcyI6WyJyZWR1Y2VyIiwiRGV2VG9vbHNNYW5hZ2VyIiwiY29uc3RydWN0b3IiLCJjb25maWciLCJuYW1lIiwiZ2xvYmFsVGhpcyIsImRvY3VtZW50IiwidGl0bGUiLCJza2lwTG9nZ2luZyIsImRldlRvb2xzIiwid2luZG93IiwiX19SRURVWF9ERVZUT09MU19FWFRFTlNJT05fXyIsImNvbm5lY3QiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJtaWRkbGV3YXJlIiwiZ2V0U3RhdGUiLCJuZXh0IiwiYWN0aW9uIiwidGhlbiIsInN0YXRlIiwic2VuZCIsIm9wdGltaXN0aWMiLCJyZWR1Y2UiLCJ1bmRlZmluZWQiLCJpbml0IiwiY2xlYW51cCIsImdldE1pZGRsZXdhcmUiXSwibWFwcGluZ3MiOiJBQUFBLFNBTUVBLE9BTkYsUUFRTyxrQkFSUDs7QUFlQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGVBQWUsTUFBTUMsZUFBTixDQUF5QztBQUl0REMsRUFBQUEsV0FBVyxDQUNUQyxNQUFzQixHQUFHO0FBQ3Z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ByZXR1cm47XG4gICAgICAgICAgICBjb25zdCBzdGF0ZSA9IGdldFN0YXRlKCk7XG4gICAgICAgICAgICB0aGlzLmRldlRvb2xzLnNlbmQoXG4gICAgICAgICAgICAgIGFjdGlvbixcbiAgICAgICAgICAgICAgc3RhdGUub3B0aW1pc3RpYy5yZWR1Y2UocmVkdWNlciwgc3RhdGUpLFxuICAgICAgICAgICAgICB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICdSRVNUX0hPT0tTJyxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICB9O1xuICAgIH0gZWxzZSB7XG4gICAgICB0aGlzLm1pZGRsZXdhcmUgPSAoKSA9PiBuZXh0ID0+IGFjdGlvbiA9PiBuZXh0KGFjdGlvbik7XG4gICAgfVxuICB9XG5cbiAgLyoqIENhbGxlZCB3aGVuIGluaXRpYWwgc3RhdGUgaXMgcmVhZHkgKi9cbiAgaW5pdChzdGF0ZTogU3RhdGU8YW55Pikge1xuICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBpZiAqL1xuICAgIGlmICh0aGlzLmRldlRvb2xzKSB0aGlzLmRldlRvb2xzLmluaXQoc3RhdGUpO1xuICB9XG5cbiAgLyoqIEVuc3VyZXMgYWxsIHN1YnNjcmlwdGlvbnMgYXJlIGNsZWFuZWQgdXAuICovXG4gIGNsZWFudXAoKSB7fVxuXG4gIC8qKiBBdHRhY2hlcyBNYW5hZ2VyIHRvIHN0b3JlXG4gICAqXG4gICAqL1xuICBnZXRNaWRkbGV3YXJlPFQgZXh0ZW5kcyBEZXZUb29sc01hbmFnZXI+KHRoaXM6IFQpIHtcbiAgICByZXR1cm4gdGhpcy5taWRkbGV3YXJlO1xuICB9XG59XG4iXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tYW5hZ2VyL0RldnRvb2xzTWFuYWdlci50cyJdLCJuYW1lc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RldlRvb2xzID1cbiAgICAgIHR5cGVvZiB3aW5kb3cgIT09ICd1bmRlZmluZWQnICYmXG4gICAgICAod2luZG93IGFzIGFueSkuX19SRURVWF9ERVZUT09MU19FWFRFTlNJT05fXyAmJlxuICAgICAgKHdpbmRvdyBhcyBhbnkpLl9fUkVEVVhfREVWVE9PTFNfRVhURU5TSU9OX18uY29ubmVjdChjb25maWcpO1xuXG4gICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09ICdkZXZlbG9wbWVudCcgJiYgdGhpcy5kZXZUb29scykge1xuICAgICAgdGhpcy5taWRkbGV3YXJlID0gPFIgZXh0ZW5kcyBSZWFjdC5SZWR1Y2VyPGFueSwgYW55Pj4oe1xuICAgICAgICBnZXRTdGF0ZSxcbiAgICAgICAgY29udHJvbGxlcixcbiAgICAgIH06IE1pZGRsZXdhcmVBUEk8Uj4pID0+IHtcbiAgICAgICAgY29uc3QgcmVkdWNlciA9IGNyZWF0ZVJlZHVjZXIoY29udHJvbGxlcik7XG4gICAgICAgIHJldHVybiAobmV4dDogRGlzcGF0Y2g8Uj4pID0+IChhY3Rpb246IFJlYWN0LlJlZHVjZXJBY3Rpb248Uj4pID0+IHtcbiAgICAgICAgICByZXR1cm4gbmV4dChhY3Rpb24pLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgaWYgKHNraXBMb2dnaW5nPy4oYWN0aW9uKSkgcmV0dXJuO1xuICAgICAgICAgICAgY29uc3Qgc3RhdGUgPSBnZXRTdGF0ZSgpO1xuICAgICAgICAgICAgdGhpcy5kZXZUb29scy5zZW5kKFxuICAgICAgICAgICAgICBhY3Rpb24sXG4gICAgICAgICAgICAgIHN0YXRlLm9wdGltaXN0aWMucmVkdWNlKHJlZHVjZXIsIHN0YXRlKSxcbiAgICAgICAgICAgICAgdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAnUkVTVF9IT09LUycsXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgfTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhpcy5taWRkbGV3YXJlID0gKCkgPT4gbmV4dCA9PiBhY3Rpb24gPT4gbmV4dChhY3Rpb24pO1xuICAgIH1cbiAgfVxuXG4gIC8qKiBDYWxsZWQgd2hlbiBpbml0aWFsIHN0YXRlIGlzIHJlYWR5ICovXG4gIGluaXQoc3RhdGU6IFN0YXRlPGFueT4pIHtcbiAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICBpZiAodGhpcy5kZXZUb29scykgdGhpcy5kZXZUb29scy5pbml0KHN0YXRlKTtcbiAgfVxuXG4gIC8qKiBFbnN1cmVzIGFsbCBzdWJzY3JpcHRpb25zIGFyZSBjbGVhbmVkIHVwLiAqL1xuICBjbGVhbnVwKCkge31cblxuICAvKiogQXR0YWNoZXMgTWFuYWdlciB0byBzdG9yZVxuICAgKlxuICAgKi9cbiAgZ2V0TWlkZGxld2FyZTxUIGV4dGVuZHMgRGV2VG9vbHNNYW5hZ2VyPih0aGlzOiBUKSB7XG4gICAgcmV0dXJuIHRoaXMubWlkZGxld2FyZTtcbiAgfVxufVxuIl19

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

import { State, ActionTypes } from '@rest-hooks/core';
import { State, ActionTypes, Controller } from '@rest-hooks/core';
import React, { ReactNode } from 'react';

@@ -12,5 +12,6 @@ interface Store<S> {

selector: (state: S) => State<unknown>;
controller: Controller;
}
export default function ExternalCacheProvider<S>({ children, store, selector, }: Props<S>): JSX.Element;
export default function ExternalCacheProvider<S>({ children, store, selector, controller, }: Props<S>): JSX.Element;
export {};
//# sourceMappingURL=ExternalCacheProvider.d.ts.map
import _jsx from "@babel/runtime/helpers/esm/jsx";
import { StateContext, DispatchContext, ControllerContext, reducer, usePromisifiedDispatch, DenormalizeCacheContext, Controller } from '@rest-hooks/core';
import React, { useEffect, useState, useMemo, useRef } from 'react';
import { StateContext, DispatchContext, ControllerContext, createReducer, usePromisifiedDispatch, DenormalizeCacheContext } from '@rest-hooks/core';
import React, { useEffect, useState, useMemo, useRef, useCallback } from 'react';
export default function ExternalCacheProvider({
children,
store,
selector
selector,
controller
}) {
const denormalizeCache = useRef({
entities: {},
results: {}
});
const [state, setState] = useState(() => selector(store.getState()));
const optimisticState = useMemo(() => state.optimistic.reduce(reducer, state), [state]);
const masterReducer = useMemo(() => createReducer(controller), [controller]);
const selectState = useCallback(() => {
const state = selector(store.getState());
return state.optimistic.reduce(masterReducer, state);
}, [masterReducer, selector, store]);
const [state, setState] = useState(selectState);
const isMounted = useRef(true);

@@ -21,22 +22,17 @@ useEffect(() => () => {

const unsubscribe = store.subscribe(() => {
if (isMounted.current) setState(selector(store.getState()));
if (isMounted.current) setState(selectState());
});
return unsubscribe; // we don't care to recompute if they change selector - only when store updates
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [store]);
return unsubscribe;
}, [selectState, store]);
const dispatch = usePromisifiedDispatch(store.dispatch, state);
const controller = useRef();
if (!controller.current) controller.current = new Controller({
dispatch
});
return /*#__PURE__*/_jsx(DispatchContext.Provider, {
value: dispatch
}, void 0, /*#__PURE__*/_jsx(StateContext.Provider, {
value: optimisticState
value: state
}, void 0, /*#__PURE__*/_jsx(ControllerContext.Provider, {
value: controller.current
value: controller
}, void 0, /*#__PURE__*/_jsx(DenormalizeCacheContext.Provider, {
value: controller.current.globalCache
value: controller.globalCache
}, void 0, children))));
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9yZWFjdC1pbnRlZ3JhdGlvbi9wcm92aWRlci9FeHRlcm5hbENhY2hlUHJvdmlkZXIudHN4Il0sIm5hbWVzIjpbIlN0YXRlQ29udGV4dCIsIkRpc3BhdGNoQ29udGV4dCIsIkNvbnRyb2xsZXJDb250ZXh0IiwicmVkdWNlci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GVzXG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIHJlYWN0LWhvb2tzL2V4aGF1c3RpdmUtZGVwc1xuICB9LCBbc3RvcmVdKTtcblxuICBjb25zdCBkaXNwYXRjaCA9IHVzZVByb21pc2lmaWVkRGlzcGF0Y2goc3RvcmUuZGlzcGF0Y2gsIHN0YXRlKTtcblxuICBjb25zdCBjb250cm9sbGVyID0gdXNlUmVmPENvbnRyb2xsZXI+KCk7XG4gIGlmICghY29udHJvbGxlci5jdXJyZW50KVxuICAgIGNvbnRyb2xsZXIuY3VycmVudCA9IG5ldyBDb250cm9sbGVyKHtcbiAgICAgIGRpc3BhdGNoLFxuICAgIH0pO1xuXG4gIHJldHVybiAoXG4gICAgPERpc3BhdGNoQ29udGV4dC5Qcm92aWRlciB2YWx1ZT17ZGlzcGF0Y2h9PlxuICAgICAgPFN0YXRlQ29udGV4dC5Qcm92aWRlciB2YWx1ZT17b3B0aW1pc3RpY1N0YXRlfT5cbiAgICAgICAgPENvbnRyb2xsZXJDb250ZXh0LlByb3ZpZGVyIHZhbHVlPXtjb250cm9sbGVyLmN1cnJlbnR9PlxuICAgICAgICAgIDxEZW5vcm1hbGl6ZUNhY2hlQ29udGV4dC5Qcm92aWRlclxuICAgICAgICAgICAgdmFsdWU9e2NvbnRyb2xsZXIuY3VycmVudC5nbG9iYWxDYWNoZX1cbiAgICAgICAgICA+XG4gICAgICAgICAgICB7Y2hpbGRyZW59XG4gICAgICAgICAgPC9EZW5vcm1hbGl6ZUNhY2hlQ29udGV4dC5Qcm92aWRlcj5cbiAgICAgICAgPC9Db250cm9sbGVyQ29udGV4dC5Qcm92aWRlcj5cbiAgICAgIDwvU3RhdGVDb250ZXh0LlByb3ZpZGVyPlxuICAgIDwvRGlzcGF0Y2hDb250ZXh0LlByb3ZpZGVyPlxuICApO1xufVxuIl19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy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TtcbiAgICByZXR1cm4gdW5zdWJzY3JpYmU7XG4gIH0sIFtzZWxlY3RTdGF0ZSwgc3RvcmVdKTtcblxuICBjb25zdCBkaXNwYXRjaCA9IHVzZVByb21pc2lmaWVkRGlzcGF0Y2goc3RvcmUuZGlzcGF0Y2gsIHN0YXRlKTtcblxuICByZXR1cm4gKFxuICAgIDxEaXNwYXRjaENvbnRleHQuUHJvdmlkZXIgdmFsdWU9e2Rpc3BhdGNofT5cbiAgICAgIDxTdGF0ZUNvbnRleHQuUHJvdmlkZXIgdmFsdWU9e3N0YXRlfT5cbiAgICAgICAgPENvbnRyb2xsZXJDb250ZXh0LlByb3ZpZGVyIHZhbHVlPXtjb250cm9sbGVyfT5cbiAgICAgICAgICA8RGVub3JtYWxpemVDYWNoZUNvbnRleHQuUHJvdmlkZXIgdmFsdWU9e2NvbnRyb2xsZXIuZ2xvYmFsQ2FjaGV9PlxuICAgICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICAgIDwvRGVub3JtYWxpemVDYWNoZUNvbnRleHQuUHJvdmlkZXI+XG4gICAgICAgIDwvQ29udHJvbGxlckNvbnRleHQuUHJvdmlkZXI+XG4gICAgICA8L1N0YXRlQ29udGV4dC5Qcm92aWRlcj5cbiAgICA8L0Rpc3BhdGNoQ29udGV4dC5Qcm92aWRlcj5cbiAgKTtcbn1cbiJdfQ==
{
"name": "rest-hooks",
"version": "6.2.0-beta.2",
"version": "6.2.0-beta.3",
"description": "Asynchronous data framework for React",

@@ -109,4 +109,4 @@ "sideEffects": false,

"@babel/runtime": "^7.7.2",
"@rest-hooks/core": "^3.1.0-beta.2",
"@rest-hooks/endpoint": "^2.1.0"
"@rest-hooks/core": "^3.1.0-beta.3",
"@rest-hooks/endpoint": "^2.2.0-beta.0"
},

@@ -122,3 +122,3 @@ "peerDependencies": {

},
"gitHead": "a2251102d7d0a3179e8925634c61ea3fef840a88"
"gitHead": "d52b9f0a70d48a8512cfb9e4d4515d212941dfd7"
}

@@ -7,3 +7,3 @@ import {

State,
reducer,
createReducer,
ActionTypes,

@@ -42,3 +42,5 @@ } from '@rest-hooks/core';

getState,
controller,
}: MiddlewareAPI<R>) => {
const reducer = createReducer(controller);
return (next: Dispatch<R>) => (action: React.ReducerAction<R>) => {

@@ -45,0 +47,0 @@ return next(action).then(() => {

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

import { State, ActionTypes } from '@rest-hooks/core';
import { State, ActionTypes, Controller } from '@rest-hooks/core';
import React, { ReactNode } from 'react';

@@ -12,5 +12,6 @@ interface Store<S> {

selector: (state: S) => State<unknown>;
controller: Controller;
}
export default function ExternalCacheProvider<S>({ children, store, selector, }: Props<S>): JSX.Element;
export default function ExternalCacheProvider<S>({ children, store, selector, controller, }: Props<S>): JSX.Element;
export {};
//# sourceMappingURL=ExternalCacheProvider.d.ts.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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