@appbaseio/reactivecore
Advanced tools
Comparing version 1.2.6 to 1.3.0
@@ -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 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]&×tamp[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};} | ||
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;exports.setHeaders=setHeaders;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 pushToStreamHits(component,hit){return{type:_constants.PUSH_TO_STREAM_HITS,component:component,hit:hit};}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,headers=_getState.headers;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]&×tamp[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(pushToStreamHits(component,response));}};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==='*'?'':config.type,body:finalQuery}).on('data',handleResponse).on('error',handleError);dispatch(setStreaming(component,true,ref));}appbaseRef.setHeaders(headers);appbaseRef.search({type:config.type==='*'?'':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};}function setHeaders(headers){return{type:_constants.SET_HEADERS,headers:headers};} |
@@ -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';var SET_TIMESTAMP=exports.SET_TIMESTAMP='SET_TIMESTAMP'; | ||
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 PUSH_TO_STREAM_HITS=exports.PUSH_TO_STREAM_HITS='PUSH_TO_STREAM_HITS';var SET_TIMESTAMP=exports.SET_TIMESTAMP='SET_TIMESTAMP';var SET_HEADERS=exports.SET_HEADERS='SET_HEADERS'; |
@@ -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.default=hitsReducer;var _constants=require('../constants');function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function hitsReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments[1];if(action.type===_constants.UPDATE_HITS){if(action.append){return _extends({},state,_defineProperty({},action.component,{hits:[].concat(_toConsumableArray(state[action.component].hits),_toConsumableArray(action.hits)),total:action.total,time:action.time}));}return _extends({},state,_defineProperty({},action.component,{hits:action.hits,total:action.total,time:action.time}));}else if(action.type===_constants.SHIFT_HITS){var hits=state[action.component]&&state[action.component].hits||[];if(action.updated){hits=hits.filter(function(item){return item._id!==action.hit._id;});hits=[_extends({},action.hit,{stream:true})].concat(_toConsumableArray(hits));return _extends({},state,_defineProperty({},action.component,_extends({},state[action.component],{hits:hits})));}else if(action.deleted){hits=hits.filter(function(item){return item._id!==action.hit._id;});return _extends({},state,_defineProperty({},action.component,{hits:hits,total:state[action.component].total-1,time:state[action.component].time}));}return _extends({},state,_defineProperty({},action.component,{hits:[_extends({},action.hit,{stream:true})].concat(_toConsumableArray(hits)),total:state[action.component].total+1,time:state[action.component].time}));}else if(action.type===_constants.REMOVE_COMPONENT){var del=state[action.component],obj=_objectWithoutProperties(state,[action.component]);return obj;}return state;} | ||
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.default=hitsReducer;var _constants=require('../constants');function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function hitsReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments[1];if(action.type===_constants.UPDATE_HITS){if(action.append){return _extends({},state,_defineProperty({},action.component,{hits:[].concat(_toConsumableArray(state[action.component].hits),_toConsumableArray(action.hits)),total:action.total,time:action.time}));}return _extends({},state,_defineProperty({},action.component,{hits:action.hits,total:action.total,time:action.time}));}else if(action.type===_constants.PUSH_TO_STREAM_HITS){var total=state[action.component].total;if(action.hit._deleted){total-=1;}else if(!action.hit._updated){total+=1;}return _extends({},state,_defineProperty({},action.component,_extends({},state[action.component],{total:total})));}else if(action.type===_constants.REMOVE_COMPONENT){var del=state[action.component],obj=_objectWithoutProperties(state,[action.component]);return obj;}return state;} |
@@ -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);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}); | ||
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 _streamHitsReducer=require('./streamHitsReducer');var _streamHitsReducer2=_interopRequireDefault(_streamHitsReducer);var _timestampReducer=require('./timestampReducer');var _timestampReducer2=_interopRequireDefault(_timestampReducer);var _headersReducer=require('./headersReducer');var _headersReducer2=_interopRequireDefault(_headersReducer);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,streamHits:_streamHitsReducer2.default,timestamp:_timestampReducer2.default,headers:_headersReducer2.default}); |
@@ -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.isEqual=isEqual;exports.debounce=debounce;exports.getQueryOptions=getQueryOptions;exports.buildQuery=buildQuery;exports.pushToAndClause=pushToAndClause;exports.checkValueChange=checkValueChange;exports.getAggsOrder=getAggsOrder;function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function isEqual(x,y){if(x===y)return true;if(!(x instanceof Object)||!(y instanceof Object))return false;if(x.constructor!==y.constructor)return false;for(var p in x){if(!x.hasOwnProperty(p))continue;if(!y.hasOwnProperty(p))return false;if(x[p]===y[p])continue;if(typeof x[p]!=='object')return false;if(!isEqual(x[p],y[p]))return false;}for(var _p in y){if(y.hasOwnProperty(_p)&&!x.hasOwnProperty(_p))return false;}return true;}function debounce(callback,wait){var context=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this;var timeout=null;var callbackArgs=null;var later=function later(){return callback.apply(context,callbackArgs);};return function(){callbackArgs=arguments;clearTimeout(timeout);timeout=setTimeout(later,wait);};}function getQueryOptions(props){var options={};if(props.size!==undefined){options.size=props.size;}if(props.from!==undefined){options.from=props.from;}return options;}function getOperation(conjunction){if(conjunction==='and'){return'must';}if(conjunction==='or'){return'should';}return'must_not';}function createBoolQuery(operation,query){if(Array.isArray(query)&&query.length||!Array.isArray(query)&&query){return{bool:_defineProperty({},operation,query)};}return null;}function getQuery(react,queryList){var query={};Object.keys(react).forEach(function(conjunction){if(Array.isArray(react[conjunction])){var operation=getOperation(conjunction);var queryArr=react[conjunction].map(function(comp){if(comp in queryList){return queryList[comp];}return null;}).filter(function(item){return!!item;});query=createBoolQuery(operation,queryArr);}else if(typeof react[conjunction]==='string'){var _operation=getOperation(conjunction);query=createBoolQuery(_operation,queryList[react[conjunction]]);}else if(typeof react[conjunction]==='object'&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){query=getQuery(react[conjunction],queryList);}});return query;}function getExternalQueryOptions(react,options,component){var queryOptions={};Object.keys(react).forEach(function(conjunction){if(Array.isArray(react[conjunction])){react[conjunction].forEach(function(comp){if(options[comp]){queryOptions=_extends({},queryOptions,options[comp]);}});}else if(typeof react[conjunction]==='string'){if(options[react[conjunction]]){queryOptions=_extends({},queryOptions,options[react[conjunction]]);}}else if(typeof react[conjunction]==='object'&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){queryOptions=_extends({},queryOptions,getExternalQueryOptions(react[conjunction],options));}});if(options[component]){queryOptions=_extends({},queryOptions,options[component]);}return queryOptions;}function buildQuery(component,dependencyTree,queryList,queryOptions){var queryObj=null;var options=null;if(component in dependencyTree){queryObj=getQuery(dependencyTree[component],queryList);options=getExternalQueryOptions(dependencyTree[component],queryOptions,component);}return{queryObj:queryObj,options:options};}function pushToAndClause(reactProp,component){var react=_extends({},reactProp);if(react.and){if(Array.isArray(react.and)){react.and=[].concat(_toConsumableArray(react.and),[component]);return react;}else if(typeof react.and==='string'){react.and=[react.and,component];return react;}react.and=this.pushToAndClause(react.and,component);return react;}return _extends({},react,{and:component});}function checkValueChange(componentId,value,beforeValueChange,onValueChange,performUpdate){var selectedValue=value;if(Array.isArray(value)&&!value.length){selectedValue=null;}var executeUpdate=function executeUpdate(){performUpdate();if(onValueChange){onValueChange(selectedValue);}};if(beforeValueChange){beforeValueChange(selectedValue).then(executeUpdate).catch(function(e){console.warn(componentId+' - beforeValueChange rejected the promise with ',e);});}else{executeUpdate();}}function getAggsOrder(sortBy){if(sortBy==='count'){return{_count:'desc'};}return{_term:sortBy};}var checkPropChange=exports.checkPropChange=function checkPropChange(prevProp,nextProp,callback){if(!isEqual(prevProp,nextProp)){callback();return true;}return false;};var checkSomePropChange=exports.checkSomePropChange=function checkSomePropChange(prevProps,nextProps,propsList,callback){propsList.some(function(prop){return checkPropChange(prevProps[prop],nextProps[prop],callback);});};var getClassName=exports.getClassName=function getClassName(classMap,component){return classMap&&classMap[component]||'';};var handleA11yAction=exports.handleA11yAction=function handleA11yAction(e,callback){if(e.key==='Enter'||e.key===' '){e.preventDefault();callback();}}; | ||
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.isEqual=isEqual;exports.debounce=debounce;exports.getQueryOptions=getQueryOptions;exports.buildQuery=buildQuery;exports.pushToAndClause=pushToAndClause;exports.checkValueChange=checkValueChange;exports.getAggsOrder=getAggsOrder;function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function isEqual(x,y){if(x===y)return true;if(!(x instanceof Object)||!(y instanceof Object))return false;if(x.constructor!==y.constructor)return false;for(var p in x){if(!x.hasOwnProperty(p))continue;if(!y.hasOwnProperty(p))return false;if(x[p]===y[p])continue;if(typeof x[p]!=='object')return false;if(!isEqual(x[p],y[p]))return false;}for(var _p in y){if(y.hasOwnProperty(_p)&&!x.hasOwnProperty(_p))return false;}return true;}function debounce(callback,wait){var context=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this;var timeout=null;var callbackArgs=null;var later=function later(){return callback.apply(context,callbackArgs);};return function(){callbackArgs=arguments;clearTimeout(timeout);timeout=setTimeout(later,wait);};}function getQueryOptions(props){var options={};if(props.size!==undefined){options.size=props.size;}if(props.from!==undefined){options.from=props.from;}return options;}function getOperation(conjunction){if(conjunction==='and'){return'must';}if(conjunction==='or'){return'should';}return'must_not';}function createBoolQuery(operation,query){if(Array.isArray(query)&&query.length||!Array.isArray(query)&&query){return{bool:_defineProperty({},operation,query)};}return null;}function getQuery(react,queryList){var query={};Object.keys(react).forEach(function(conjunction){if(Array.isArray(react[conjunction])){var operation=getOperation(conjunction);var queryArr=react[conjunction].map(function(comp){if(comp in queryList){return queryList[comp];}return null;}).filter(function(item){return!!item;});query=createBoolQuery(operation,queryArr);}else if(typeof react[conjunction]==='string'){var _operation=getOperation(conjunction);query=createBoolQuery(_operation,queryList[react[conjunction]]);}else if(typeof react[conjunction]==='object'&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){query=getQuery(react[conjunction],queryList);}});return query;}function getExternalQueryOptions(react,options,component){var queryOptions={};Object.keys(react).forEach(function(conjunction){if(Array.isArray(react[conjunction])){react[conjunction].forEach(function(comp){if(options[comp]){queryOptions=_extends({},queryOptions,options[comp]);}});}else if(typeof react[conjunction]==='string'){if(options[react[conjunction]]){queryOptions=_extends({},queryOptions,options[react[conjunction]]);}}else if(typeof react[conjunction]==='object'&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){queryOptions=_extends({},queryOptions,getExternalQueryOptions(react[conjunction],options));}});if(options[component]){queryOptions=_extends({},queryOptions,options[component]);}return queryOptions;}function buildQuery(component,dependencyTree,queryList,queryOptions){var queryObj=null;var options=null;if(component in dependencyTree){queryObj=getQuery(dependencyTree[component],queryList);options=getExternalQueryOptions(dependencyTree[component],queryOptions,component);}return{queryObj:queryObj,options:options};}function pushToAndClause(reactProp,component){var react=_extends({},reactProp);if(react.and){if(Array.isArray(react.and)){react.and=[].concat(_toConsumableArray(react.and),[component]);return react;}else if(typeof react.and==='string'){react.and=[react.and,component];return react;}react.and=this.pushToAndClause(react.and,component);return react;}return _extends({},react,{and:component});}function checkValueChange(componentId,value,beforeValueChange,onValueChange,performUpdate){var selectedValue=value;if(Array.isArray(value)&&!value.length){selectedValue=null;}var executeUpdate=function executeUpdate(){performUpdate();if(onValueChange){onValueChange(selectedValue);}};if(beforeValueChange){beforeValueChange(selectedValue).then(executeUpdate).catch(function(e){console.warn(componentId+' - beforeValueChange rejected the promise with ',e);});}else{executeUpdate();}}function getAggsOrder(sortBy){if(sortBy==='count'){return{_count:'desc'};}return{_term:sortBy};}var checkPropChange=exports.checkPropChange=function checkPropChange(prevProp,nextProp,callback){if(!isEqual(prevProp,nextProp)){callback();return true;}return false;};var checkSomePropChange=exports.checkSomePropChange=function checkSomePropChange(prevProps,nextProps,propsList,callback){propsList.some(function(prop){return checkPropChange(prevProps[prop],nextProps[prop],callback);});};var getClassName=exports.getClassName=function getClassName(classMap,component){return classMap&&classMap[component]||'';};var handleA11yAction=exports.handleA11yAction=function handleA11yAction(e,callback){if(e.key==='Enter'||e.key===' '){e.preventDefault();callback();}};var highlightResults=function highlightResults(result){var data=_extends({},result);if(data.highlight){Object.keys(data.highlight).forEach(function(highlightItem){var highlightValue=data.highlight[highlightItem][0];data._source=_extends({},data._source,_defineProperty({},highlightItem,highlightValue));});}return data;};var parseHits=exports.parseHits=function parseHits(hits){var results=null;if(hits){results=[].concat(_toConsumableArray(hits)).map(function(item){var streamProps={};if(item._updated){streamProps._updated=item._updated;}else if(item._deleted){streamProps._deleted=item._deleted;}var data=highlightResults(item);return _extends({_id:data._id},data._source,streamProps);});}return results;}; |
@@ -1,1 +0,1 @@ | ||
Object.defineProperty(exports,"__esModule",{value:true});var _propTypes=require('prop-types');var _dateFormats=require('./dateFormats');var _dateFormats2=_interopRequireDefault(_dateFormats);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var reactKeyType=(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),_propTypes.object]);var types={any:_propTypes.any,bool:_propTypes.bool,boolRequired:_propTypes.bool.isRequired,components:(0,_propTypes.arrayOf)(_propTypes.string),children:_propTypes.any,data:(0,_propTypes.arrayOf)(_propTypes.object),dataFieldArray:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]).isRequired,dataNumberBox:(0,_propTypes.shape)({label:_propTypes.string,start:_propTypes.number.isRequired,end:_propTypes.number.isRequired}).isRequired,date:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),dateObject:_propTypes.object,dateRange:(0,_propTypes.shape)({start:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),end:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)])}),fieldWeights:(0,_propTypes.arrayOf)(_propTypes.number),filterLabel:_propTypes.string,func:_propTypes.func,funcRequired:_propTypes.func.isRequired,fuzziness:(0,_propTypes.oneOf)([0,1,2,'AUTO']),highlightField:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),hits:(0,_propTypes.arrayOf)(_propTypes.object),iconPosition:(0,_propTypes.oneOf)(['left','right']),labelPosition:(0,_propTypes.oneOf)(['left','right','top','bottom']),number:_propTypes.number,options:(0,_propTypes.oneOfType)([(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object]),paginationAt:(0,_propTypes.oneOf)(['top','bottom','both']),range:(0,_propTypes.shape)({start:_propTypes.number,end:_propTypes.number}),rangeLabels:(0,_propTypes.shape)({start:_propTypes.string,end:_propTypes.string}),react:(0,_propTypes.shape)({and:reactKeyType,or:reactKeyType,not:reactKeyType}),selectedValues:_propTypes.object,selectedValue:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object,_propTypes.number,(0,_propTypes.arrayOf)(_propTypes.number)]),suggestions:(0,_propTypes.arrayOf)(_propTypes.object),supportedOrientations:(0,_propTypes.oneOf)(['portrait','portrait-upside-down','landscape','landscape-left','landscape-right']),sortBy:(0,_propTypes.oneOf)(['asc','desc']),sortOptions:(0,_propTypes.arrayOf)((0,_propTypes.shape)({label:_propTypes.string,dataField:_propTypes.string,sortBy:_propTypes.string})),sortByWithCount:(0,_propTypes.oneOf)(['asc','desc','count']),stats:(0,_propTypes.arrayOf)(_propTypes.object),string:_propTypes.string,stringArray:(0,_propTypes.arrayOf)(_propTypes.string),stringRequired:_propTypes.string.isRequired,style:_propTypes.object,queryFormatDate:(0,_propTypes.oneOf)(Object.keys(_dateFormats2.default)),queryFormatSearch:(0,_propTypes.oneOf)(['and','or']),queryFormatNumberBox:(0,_propTypes.oneOf)(['exact','lte','gte']),params:_propTypes.object.isRequired,props:_propTypes.object,rangeLabelsAlign:(0,_propTypes.oneOf)(['left','right']),title:(0,_propTypes.oneOfType)([_propTypes.string,_propTypes.any])};exports.default=types; | ||
Object.defineProperty(exports,"__esModule",{value:true});var _propTypes=require('prop-types');var _dateFormats=require('./dateFormats');var _dateFormats2=_interopRequireDefault(_dateFormats);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var reactKeyType=(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),_propTypes.object]);var types={any:_propTypes.any,bool:_propTypes.bool,boolRequired:_propTypes.bool.isRequired,components:(0,_propTypes.arrayOf)(_propTypes.string),children:_propTypes.any,data:(0,_propTypes.arrayOf)(_propTypes.object),dataFieldArray:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]).isRequired,dataNumberBox:(0,_propTypes.shape)({label:_propTypes.string,start:_propTypes.number.isRequired,end:_propTypes.number.isRequired}).isRequired,date:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),dateObject:_propTypes.object,dateRange:(0,_propTypes.shape)({start:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),end:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)])}),fieldWeights:(0,_propTypes.arrayOf)(_propTypes.number),filterLabel:_propTypes.string,func:_propTypes.func,funcRequired:_propTypes.func.isRequired,fuzziness:(0,_propTypes.oneOf)([0,1,2,'AUTO']),headers:_propTypes.object,highlightField:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),hits:(0,_propTypes.arrayOf)(_propTypes.object),iconPosition:(0,_propTypes.oneOf)(['left','right']),labelPosition:(0,_propTypes.oneOf)(['left','right','top','bottom']),number:_propTypes.number,options:(0,_propTypes.oneOfType)([(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object]),paginationAt:(0,_propTypes.oneOf)(['top','bottom','both']),range:(0,_propTypes.shape)({start:_propTypes.number,end:_propTypes.number}),rangeLabels:(0,_propTypes.shape)({start:_propTypes.string,end:_propTypes.string}),react:(0,_propTypes.shape)({and:reactKeyType,or:reactKeyType,not:reactKeyType}),selectedValues:_propTypes.object,selectedValue:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object,_propTypes.number,(0,_propTypes.arrayOf)(_propTypes.number)]),suggestions:(0,_propTypes.arrayOf)(_propTypes.object),supportedOrientations:(0,_propTypes.oneOf)(['portrait','portrait-upside-down','landscape','landscape-left','landscape-right']),sortBy:(0,_propTypes.oneOf)(['asc','desc']),sortOptions:(0,_propTypes.arrayOf)((0,_propTypes.shape)({label:_propTypes.string,dataField:_propTypes.string,sortBy:_propTypes.string})),sortByWithCount:(0,_propTypes.oneOf)(['asc','desc','count']),stats:(0,_propTypes.arrayOf)(_propTypes.object),string:_propTypes.string,stringArray:(0,_propTypes.arrayOf)(_propTypes.string),stringRequired:_propTypes.string.isRequired,style:_propTypes.object,queryFormatDate:(0,_propTypes.oneOf)(Object.keys(_dateFormats2.default)),queryFormatSearch:(0,_propTypes.oneOf)(['and','or']),queryFormatNumberBox:(0,_propTypes.oneOf)(['exact','lte','gte']),params:_propTypes.object.isRequired,props:_propTypes.object,rangeLabelsAlign:(0,_propTypes.oneOf)(['left','right']),title:(0,_propTypes.oneOfType)([_propTypes.string,_propTypes.any])};exports.default=types; |
{ | ||
"name": "@appbaseio/reactivecore", | ||
"version": "1.2.6", | ||
"version": "1.3.0", | ||
"description": "Core architecture of reactive UI libraries", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
55330
27
20