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

@appbaseio/reactivecore

Package Overview
Dependencies
Maintainers
4
Versions
289
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appbaseio/reactivecore - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

lib/reducers/timestampReducer.js

2

lib/actions/index.js

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

Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.addComponent=addComponent;exports.removeComponent=removeComponent;exports.setQuery=setQuery;exports.updateAggs=updateAggs;exports.logQuery=logQuery;exports.updateHits=updateHits;exports.setStreaming=setStreaming;exports.executeQuery=executeQuery;exports.watchComponent=watchComponent;exports.setQueryOptions=setQueryOptions;exports.setValue=setValue;exports.updateQuery=updateQuery;exports.loadMore=loadMore;exports.clearValues=clearValues;var _constants=require('../constants');var _helper=require('../utils/helper');function addComponent(component){return{type:_constants.ADD_COMPONENT,component:component};}function removeComponent(component){return{type:_constants.REMOVE_COMPONENT,component:component};}function updateWatchman(component,react){return{type:_constants.WATCH_COMPONENT,component:component,react:react};}function setQuery(component,query){return{type:_constants.SET_QUERY,component:component,query:query};}function updateQueryOptions(component,options){return{type:_constants.SET_QUERY_OPTIONS,component:component,options:options};}function updateAggs(component,aggregations){return{type:_constants.UPDATE_AGGS,component:component,aggregations:aggregations};}function logQuery(component,query){return{type:_constants.LOG_QUERY,component:component,query:query};}function updateHits(component,hits,time){var append=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;return{type:_constants.UPDATE_HITS,component:component,hits:hits.hits,total:hits.total,time:time,append:append};}function setLoading(component,isLoading){return{type:_constants.SET_LOADING,component:component,isLoading:isLoading};}function shiftHits(component,hit){var deleted=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var updated=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;return{type:_constants.SHIFT_HITS,component:component,hit:hit,deleted:deleted,updated:updated};}function setStreaming(component){var status=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var ref=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return{type:_constants.SET_STREAMING,component:component,status:status,ref:ref};}function executeQuery(component,query){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var appendToHits=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var onQueryChange=arguments[4];return function(dispatch,getState){var _getState=getState(),appbaseRef=_getState.appbaseRef,config=_getState.config,queryLog=_getState.queryLog,stream=_getState.stream;var mainQuery=null;if(query){mainQuery={query:query};}var finalQuery=_extends({},mainQuery,options);if(!(0,_helper.isEqual)(finalQuery,queryLog[component])){if(onQueryChange){onQueryChange(queryLog[component],finalQuery);}dispatch(logQuery(component,finalQuery));dispatch(setLoading(component,true));var handleResponse=function handleResponse(response){if(response.hits){dispatch(updateHits(component,response.hits,response.took,appendToHits));dispatch(setLoading(component,false));if('aggregations'in response){dispatch(updateAggs(component,response.aggregations));}}else if(response._id){dispatch(shiftHits(component,response,response._deleted,response._updated));}};var handleError=function handleError(error){console.error(error);dispatch(setLoading(component,false));};if(stream[component]&&stream[component].status){if(stream[component].ref){stream[component].ref.stop();}if(!finalQuery.query){finalQuery.query={match_all:{}};}var ref=appbaseRef.searchStream({type:config.type==='*'?null:config.type,body:finalQuery}).on('data',handleResponse).on('error',handleError);dispatch(setStreaming(component,true,ref));}appbaseRef.search({type:config.type==='*'?null:config.type,body:finalQuery,preference:component}).on('data',handleResponse).on('error',handleError);}};}function watchComponent(component,react){return function(dispatch,getState){dispatch(updateWatchman(component,react));var store=getState();var _buildQuery=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery.queryObj,options=_buildQuery.options;if(queryObj&&Object.keys(queryObj).length||options&&'aggs'in options){dispatch(executeQuery(component,queryObj,options));}};}function setQueryOptions(component,queryOptions){var execute=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return function(dispatch,getState){dispatch(updateQueryOptions(component,queryOptions));if(execute){var store=getState();var _buildQuery2=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery2.queryObj,options=_buildQuery2.options;if(queryObj&&Object.keys(queryObj).length||options&&('aggs'in options||'sort'in options)){dispatch(executeQuery(component,queryObj,options));}var watchList=store.watchMan[component];if(Array.isArray(watchList)){watchList.forEach(function(subscriber){var _buildQuery3=(0,_helper.buildQuery)(subscriber,store.dependencyTree,store.queryList,store.queryOptions),queryObject=_buildQuery3.queryObj,qOptions=_buildQuery3.options;dispatch(executeQuery(subscriber,queryObject,qOptions,false));});}}};}function setValue(component,value,label,showFilter,URLParams){return{type:_constants.SET_VALUE,component:component,value:value,label:label,showFilter:showFilter,URLParams:URLParams};}function updateQuery(_ref){var componentId=_ref.componentId,query=_ref.query,value=_ref.value,_ref$label=_ref.label,label=_ref$label===undefined?null:_ref$label,_ref$showFilter=_ref.showFilter,showFilter=_ref$showFilter===undefined?true:_ref$showFilter,onQueryChange=_ref.onQueryChange,_ref$URLParams=_ref.URLParams,URLParams=_ref$URLParams===undefined?false:_ref$URLParams;return function(dispatch,getState){var queryToDispatch=query;if(query&&query.query){queryToDispatch=query.query;}if(!componentId.endsWith('__internal')){dispatch(setValue(componentId,value,label,showFilter,URLParams));}dispatch(setQuery(componentId,queryToDispatch));var store=getState();var watchList=store.watchMan[componentId];if(Array.isArray(watchList)){watchList.forEach(function(component){var _buildQuery4=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery4.queryObj,options=_buildQuery4.options;dispatch(executeQuery(component,queryObj,options,false,onQueryChange));});}};}function loadMore(component,newOptions){var append=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return function(dispatch,getState){var store=getState();var _buildQuery5=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery5.queryObj,options=_buildQuery5.options;if(!options){options={};}options=_extends({},options,newOptions);dispatch(executeQuery(component,queryObj,options,append));};}function clearValues(){return{type:_constants.CLEAR_VALUES};}
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.addComponent=addComponent;exports.removeComponent=removeComponent;exports.setQuery=setQuery;exports.updateAggs=updateAggs;exports.logQuery=logQuery;exports.updateHits=updateHits;exports.setStreaming=setStreaming;exports.executeQuery=executeQuery;exports.watchComponent=watchComponent;exports.setQueryOptions=setQueryOptions;exports.setValue=setValue;exports.updateQuery=updateQuery;exports.loadMore=loadMore;exports.clearValues=clearValues;var _constants=require('../constants');var _helper=require('../utils/helper');function addComponent(component){return{type:_constants.ADD_COMPONENT,component:component};}function removeComponent(component){return{type:_constants.REMOVE_COMPONENT,component:component};}function updateWatchman(component,react){return{type:_constants.WATCH_COMPONENT,component:component,react:react};}function setQuery(component,query){return{type:_constants.SET_QUERY,component:component,query:query};}function updateQueryOptions(component,options){return{type:_constants.SET_QUERY_OPTIONS,component:component,options:options};}function updateAggs(component,aggregations){return{type:_constants.UPDATE_AGGS,component:component,aggregations:aggregations};}function logQuery(component,query){return{type:_constants.LOG_QUERY,component:component,query:query};}function updateHits(component,hits,time){var append=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;return{type:_constants.UPDATE_HITS,component:component,hits:hits.hits,total:hits.total,time:time,append:append};}function setLoading(component,isLoading){return{type:_constants.SET_LOADING,component:component,isLoading:isLoading};}function shiftHits(component,hit){var deleted=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var updated=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;return{type:_constants.SHIFT_HITS,component:component,hit:hit,deleted:deleted,updated:updated};}function setStreaming(component){var status=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var ref=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return{type:_constants.SET_STREAMING,component:component,status:status,ref:ref};}function setTimestamp(component,timestamp){return{type:_constants.SET_TIMESTAMP,component:component,timestamp:timestamp};}function executeQuery(component,query){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var appendToHits=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var onQueryChange=arguments[4];return function(dispatch,getState){var _getState=getState(),appbaseRef=_getState.appbaseRef,config=_getState.config,queryLog=_getState.queryLog,stream=_getState.stream;var mainQuery=null;if(query){mainQuery={query:query};}var finalQuery=_extends({},mainQuery,options);if(!(0,_helper.isEqual)(finalQuery,queryLog[component])){if(onQueryChange){onQueryChange(queryLog[component],finalQuery);}dispatch(logQuery(component,finalQuery));dispatch(setLoading(component,true));var handleResponse=function handleResponse(response){var _getState2=getState(),timestamp=_getState2.timestamp;if(timestamp[component]&&timestamp[component]>response._timestamp){return;}if(response.hits){dispatch(setTimestamp(component,response._timestamp));dispatch(updateHits(component,response.hits,response.took,appendToHits));dispatch(setLoading(component,false));if('aggregations'in response){dispatch(updateAggs(component,response.aggregations));}}else if(response._id){dispatch(shiftHits(component,response,response._deleted,response._updated));}};var handleError=function handleError(error){console.error(error);dispatch(setLoading(component,false));};if(stream[component]&&stream[component].status){if(stream[component].ref){stream[component].ref.stop();}if(!finalQuery.query){finalQuery.query={match_all:{}};}var ref=appbaseRef.searchStream({type:config.type==='*'?null:config.type,body:finalQuery}).on('data',handleResponse).on('error',handleError);dispatch(setStreaming(component,true,ref));}appbaseRef.search({type:config.type==='*'?null:config.type,body:finalQuery,preference:component}).on('data',handleResponse).on('error',handleError);}};}function watchComponent(component,react){return function(dispatch,getState){dispatch(updateWatchman(component,react));var store=getState();var _buildQuery=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery.queryObj,options=_buildQuery.options;if(queryObj&&Object.keys(queryObj).length||options&&'aggs'in options){dispatch(executeQuery(component,queryObj,options));}};}function setQueryOptions(component,queryOptions){var execute=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return function(dispatch,getState){dispatch(updateQueryOptions(component,queryOptions));if(execute){var store=getState();var _buildQuery2=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery2.queryObj,options=_buildQuery2.options;if(queryObj&&Object.keys(queryObj).length||options&&('aggs'in options||'sort'in options)){dispatch(executeQuery(component,queryObj,options));}var watchList=store.watchMan[component];if(Array.isArray(watchList)){watchList.forEach(function(subscriber){var _buildQuery3=(0,_helper.buildQuery)(subscriber,store.dependencyTree,store.queryList,store.queryOptions),queryObject=_buildQuery3.queryObj,qOptions=_buildQuery3.options;dispatch(executeQuery(subscriber,queryObject,qOptions,false));});}}};}function setValue(component,value,label,showFilter,URLParams){return{type:_constants.SET_VALUE,component:component,value:value,label:label,showFilter:showFilter,URLParams:URLParams};}function updateQuery(_ref){var componentId=_ref.componentId,query=_ref.query,value=_ref.value,_ref$label=_ref.label,label=_ref$label===undefined?null:_ref$label,_ref$showFilter=_ref.showFilter,showFilter=_ref$showFilter===undefined?true:_ref$showFilter,onQueryChange=_ref.onQueryChange,_ref$URLParams=_ref.URLParams,URLParams=_ref$URLParams===undefined?false:_ref$URLParams;return function(dispatch,getState){var queryToDispatch=query;if(query&&query.query){queryToDispatch=query.query;}if(!componentId.endsWith('__internal')){dispatch(setValue(componentId,value,label,showFilter,URLParams));}dispatch(setQuery(componentId,queryToDispatch));var store=getState();var watchList=store.watchMan[componentId];if(Array.isArray(watchList)){watchList.forEach(function(component){var _buildQuery4=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery4.queryObj,options=_buildQuery4.options;dispatch(executeQuery(component,queryObj,options,false,onQueryChange));});}};}function loadMore(component,newOptions){var append=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return function(dispatch,getState){var store=getState();var _buildQuery5=(0,_helper.buildQuery)(component,store.dependencyTree,store.queryList,store.queryOptions),queryObj=_buildQuery5.queryObj,options=_buildQuery5.options;if(!options){options={};}options=_extends({},options,newOptions);dispatch(executeQuery(component,queryObj,options,append));};}function clearValues(){return{type:_constants.CLEAR_VALUES};}

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

Object.defineProperty(exports,"__esModule",{value:true});var ADD_COMPONENT=exports.ADD_COMPONENT='ADD_COMPONENT';var REMOVE_COMPONENT=exports.REMOVE_COMPONENT='REMOVE_COMPONENT';var WATCH_COMPONENT=exports.WATCH_COMPONENT='WATCH_COMPONENT';var SET_QUERY=exports.SET_QUERY='SET_QUERY';var SET_QUERY_OPTIONS=exports.SET_QUERY_OPTIONS='SET_QUERY_OPTIONS';var EXECUTE_QUERY=exports.EXECUTE_QUERY='EXECUTE_QUERY';var UPDATE_HITS=exports.UPDATE_HITS='UPDATE_HITS';var UPDATE_AGGS=exports.UPDATE_AGGS='UPDATE_AGGS';var ADD_CONFIG=exports.ADD_CONFIG='ADD_CONFIG';var ADD_APPBASE_REF=exports.ADD_APPBASE_REF='ADD_APPBASE_REF';var LOG_QUERY=exports.LOG_QUERY='LOG_QUERY';var SET_VALUE=exports.SET_VALUE='SET_VALUE';var CLEAR_VALUES=exports.CLEAR_VALUES='CLEAR_VALUES';var SET_LOADING=exports.SET_LOADING='SET_LOADING';var SET_STREAMING=exports.SET_STREAMING='SET_STREAMING';var SHIFT_HITS=exports.SHIFT_HITS='SHIFT_HITS';
Object.defineProperty(exports,"__esModule",{value:true});var ADD_COMPONENT=exports.ADD_COMPONENT='ADD_COMPONENT';var REMOVE_COMPONENT=exports.REMOVE_COMPONENT='REMOVE_COMPONENT';var WATCH_COMPONENT=exports.WATCH_COMPONENT='WATCH_COMPONENT';var SET_QUERY=exports.SET_QUERY='SET_QUERY';var SET_QUERY_OPTIONS=exports.SET_QUERY_OPTIONS='SET_QUERY_OPTIONS';var EXECUTE_QUERY=exports.EXECUTE_QUERY='EXECUTE_QUERY';var UPDATE_HITS=exports.UPDATE_HITS='UPDATE_HITS';var UPDATE_AGGS=exports.UPDATE_AGGS='UPDATE_AGGS';var ADD_CONFIG=exports.ADD_CONFIG='ADD_CONFIG';var ADD_APPBASE_REF=exports.ADD_APPBASE_REF='ADD_APPBASE_REF';var LOG_QUERY=exports.LOG_QUERY='LOG_QUERY';var SET_VALUE=exports.SET_VALUE='SET_VALUE';var CLEAR_VALUES=exports.CLEAR_VALUES='CLEAR_VALUES';var SET_LOADING=exports.SET_LOADING='SET_LOADING';var SET_STREAMING=exports.SET_STREAMING='SET_STREAMING';var SHIFT_HITS=exports.SHIFT_HITS='SHIFT_HITS';var SET_TIMESTAMP=exports.SET_TIMESTAMP='SET_TIMESTAMP';

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

Object.defineProperty(exports,"__esModule",{value:true});var _redux=require('redux');var _componentsReducer=require('./componentsReducer');var _componentsReducer2=_interopRequireDefault(_componentsReducer);var _watchManReducer=require('./watchManReducer');var _watchManReducer2=_interopRequireDefault(_watchManReducer);var _dependencyTreeReducer=require('./dependencyTreeReducer');var _dependencyTreeReducer2=_interopRequireDefault(_dependencyTreeReducer);var _queryReducer=require('./queryReducer');var _queryReducer2=_interopRequireDefault(_queryReducer);var _queryOptionsReducer=require('./queryOptionsReducer');var _queryOptionsReducer2=_interopRequireDefault(_queryOptionsReducer);var _configReducer=require('./configReducer');var _configReducer2=_interopRequireDefault(_configReducer);var _appbaseRefReducer=require('./appbaseRefReducer');var _appbaseRefReducer2=_interopRequireDefault(_appbaseRefReducer);var _hitsReducer=require('./hitsReducer');var _hitsReducer2=_interopRequireDefault(_hitsReducer);var _aggsReducer=require('./aggsReducer');var _aggsReducer2=_interopRequireDefault(_aggsReducer);var _logsReducer=require('./logsReducer');var _logsReducer2=_interopRequireDefault(_logsReducer);var _valueReducer=require('./valueReducer');var _valueReducer2=_interopRequireDefault(_valueReducer);var _loadingReducer=require('./loadingReducer');var _loadingReducer2=_interopRequireDefault(_loadingReducer);var _streamingReducer=require('./streamingReducer');var _streamingReducer2=_interopRequireDefault(_streamingReducer);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}exports.default=(0,_redux.combineReducers)({components:_componentsReducer2.default,watchMan:_watchManReducer2.default,queryList:_queryReducer2.default,queryOptions:_queryOptionsReducer2.default,dependencyTree:_dependencyTreeReducer2.default,appbaseRef:_appbaseRefReducer2.default,config:_configReducer2.default,hits:_hitsReducer2.default,aggregations:_aggsReducer2.default,queryLog:_logsReducer2.default,selectedValues:_valueReducer2.default,isLoading:_loadingReducer2.default,stream:_streamingReducer2.default});
Object.defineProperty(exports,"__esModule",{value:true});var _redux=require('redux');var _componentsReducer=require('./componentsReducer');var _componentsReducer2=_interopRequireDefault(_componentsReducer);var _watchManReducer=require('./watchManReducer');var _watchManReducer2=_interopRequireDefault(_watchManReducer);var _dependencyTreeReducer=require('./dependencyTreeReducer');var _dependencyTreeReducer2=_interopRequireDefault(_dependencyTreeReducer);var _queryReducer=require('./queryReducer');var _queryReducer2=_interopRequireDefault(_queryReducer);var _queryOptionsReducer=require('./queryOptionsReducer');var _queryOptionsReducer2=_interopRequireDefault(_queryOptionsReducer);var _configReducer=require('./configReducer');var _configReducer2=_interopRequireDefault(_configReducer);var _appbaseRefReducer=require('./appbaseRefReducer');var _appbaseRefReducer2=_interopRequireDefault(_appbaseRefReducer);var _hitsReducer=require('./hitsReducer');var _hitsReducer2=_interopRequireDefault(_hitsReducer);var _aggsReducer=require('./aggsReducer');var _aggsReducer2=_interopRequireDefault(_aggsReducer);var _logsReducer=require('./logsReducer');var _logsReducer2=_interopRequireDefault(_logsReducer);var _valueReducer=require('./valueReducer');var _valueReducer2=_interopRequireDefault(_valueReducer);var _loadingReducer=require('./loadingReducer');var _loadingReducer2=_interopRequireDefault(_loadingReducer);var _streamingReducer=require('./streamingReducer');var _streamingReducer2=_interopRequireDefault(_streamingReducer);var _timestampReducer=require('./timestampReducer');var _timestampReducer2=_interopRequireDefault(_timestampReducer);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}exports.default=(0,_redux.combineReducers)({components:_componentsReducer2.default,watchMan:_watchManReducer2.default,queryList:_queryReducer2.default,queryOptions:_queryOptionsReducer2.default,dependencyTree:_dependencyTreeReducer2.default,appbaseRef:_appbaseRefReducer2.default,config:_configReducer2.default,hits:_hitsReducer2.default,aggregations:_aggsReducer2.default,queryLog:_logsReducer2.default,selectedValues:_valueReducer2.default,isLoading:_loadingReducer2.default,stream:_streamingReducer2.default,timestamp:_timestampReducer2.default});
{
"name": "@appbaseio/reactivecore",
"version": "1.2.5",
"version": "1.2.6",
"description": "Core architecture of reactive UI libraries",

@@ -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