Merge pull request woocommerce/woocommerce-admin#1006 from woocommerce/fix/856-typeerror-interval-over-100-days

Use `wc-api` for Reports.
This commit is contained in:
Jeff Stieler 2018-12-10 08:26:42 -07:00 committed by GitHub
commit 4cd01a3b3b
15 changed files with 325 additions and 59 deletions

View File

@ -5,7 +5,6 @@
import { Component } from '@wordpress/element'; import { Component } from '@wordpress/element';
import { compose } from '@wordpress/compose'; import { compose } from '@wordpress/compose';
import { format as formatDate } from '@wordpress/date'; import { format as formatDate } from '@wordpress/date';
import { withSelect } from '@wordpress/data';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { find, get } from 'lodash'; import { find, get } from 'lodash';
@ -28,6 +27,7 @@ import { Chart } from '@woocommerce/components';
*/ */
import { getReportChartData, getTooltipValueFormat } from 'store/reports/utils'; import { getReportChartData, getTooltipValueFormat } from 'store/reports/utils';
import ReportError from 'analytics/components/report-error'; import ReportError from 'analytics/components/report-error';
import withSelect from 'wc-api/with-select';
export const DEFAULT_FILTER = 'all'; export const DEFAULT_FILTER = 'all';

View File

@ -5,7 +5,6 @@
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element'; import { Component } from '@wordpress/element';
import { compose } from '@wordpress/compose'; import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
/** /**
@ -21,6 +20,7 @@ import { SummaryList, SummaryListPlaceholder, SummaryNumber } from '@woocommerce
import { getSummaryNumbers } from 'store/reports/utils'; import { getSummaryNumbers } from 'store/reports/utils';
import ReportError from 'analytics/components/report-error'; import ReportError from 'analytics/components/report-error';
import { calculateDelta, formatValue } from './utils'; import { calculateDelta, formatValue } from './utils';
import withSelect from 'wc-api/with-select';
export class ReportSummary extends Component { export class ReportSummary extends Component {
render() { render() {

View File

@ -5,7 +5,6 @@
import { applyFilters } from '@wordpress/hooks'; import { applyFilters } from '@wordpress/hooks';
import { Component } from '@wordpress/element'; import { Component } from '@wordpress/element';
import { compose } from '@wordpress/compose'; import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import { get, orderBy } from 'lodash'; import { get, orderBy } from 'lodash';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -20,6 +19,7 @@ import { onQueryChange } from '@woocommerce/navigation';
*/ */
import ReportError from 'analytics/components/report-error'; import ReportError from 'analytics/components/report-error';
import { getReportChartData, getReportTableData } from 'store/reports/utils'; import { getReportChartData, getReportTableData } from 'store/reports/utils';
import withSelect from 'wc-api/with-select';
const TABLE_FILTER = 'woocommerce_admin_report_table'; const TABLE_FILTER = 'woocommerce_admin_report_table';

View File

@ -224,7 +224,7 @@ export default compose(
withSelect( ( select, props ) => { withSelect( ( select, props ) => {
const { query } = props; const { query } = props;
const datesFromQuery = getCurrentDates( query ); const datesFromQuery = getCurrentDates( query );
const { getReportStats, isReportStatsRequesting, isReportStatsError } = select( 'wc-admin' ); const { getReportStats, isReportStatsRequesting, isReportStatsError } = select( 'wc-api' );
// TODO Support hour here when viewing a single day // TODO Support hour here when viewing a single day
const tableQuery = { const tableQuery = {

View File

@ -62,29 +62,29 @@ describe( 'getReportChartData()', () => {
}; };
beforeAll( () => { beforeAll( () => {
select( 'wc-admin' ).getReportStats = jest.fn().mockReturnValue( {} ); select( 'wc-api' ).getReportStats = jest.fn().mockReturnValue( {} );
select( 'wc-admin' ).isReportStatsRequesting = jest.fn().mockReturnValue( false ); select( 'wc-api' ).isReportStatsRequesting = jest.fn().mockReturnValue( false );
select( 'wc-admin' ).isReportStatsError = jest.fn().mockReturnValue( false ); select( 'wc-api' ).isReportStatsError = jest.fn().mockReturnValue( false );
} ); } );
afterAll( () => { afterAll( () => {
select( 'wc-admin' ).getReportStats.mockRestore(); select( 'wc-api' ).getReportStats.mockRestore();
select( 'wc-admin' ).isReportStatsRequesting.mockRestore(); select( 'wc-api' ).isReportStatsRequesting.mockRestore();
select( 'wc-admin' ).isReportStatsError.mockRestore(); select( 'wc-api' ).isReportStatsError.mockRestore();
} ); } );
function setGetReportStats( func ) { function setGetReportStats( func ) {
select( 'wc-admin' ).getReportStats.mockImplementation( ( ...args ) => func( ...args ) ); select( 'wc-api' ).getReportStats.mockImplementation( ( ...args ) => func( ...args ) );
} }
function setIsReportStatsRequesting( func ) { function setIsReportStatsRequesting( func ) {
select( 'wc-admin' ).isReportStatsRequesting.mockImplementation( ( ...args ) => select( 'wc-api' ).isReportStatsRequesting.mockImplementation( ( ...args ) =>
func( ...args ) func( ...args )
); );
} }
function setIsReportStatsError( func ) { function setIsReportStatsError( func ) {
select( 'wc-admin' ).isReportStatsError.mockImplementation( ( ...args ) => func( ...args ) ); select( 'wc-api' ).isReportStatsError.mockImplementation( ( ...args ) => func( ...args ) );
} }
it( 'returns isRequesting if first request is in progress', () => { it( 'returns isRequesting if first request is in progress', () => {
@ -262,29 +262,29 @@ describe( 'getSummaryNumbers()', () => {
}; };
beforeAll( () => { beforeAll( () => {
select( 'wc-admin' ).getReportStats = jest.fn().mockReturnValue( {} ); select( 'wc-api' ).getReportStats = jest.fn().mockReturnValue( {} );
select( 'wc-admin' ).isReportStatsRequesting = jest.fn().mockReturnValue( false ); select( 'wc-api' ).isReportStatsRequesting = jest.fn().mockReturnValue( false );
select( 'wc-admin' ).isReportStatsError = jest.fn().mockReturnValue( false ); select( 'wc-api' ).isReportStatsError = jest.fn().mockReturnValue( false );
} ); } );
afterAll( () => { afterAll( () => {
select( 'wc-admin' ).getReportStats.mockRestore(); select( 'wc-api' ).getReportStats.mockRestore();
select( 'wc-admin' ).isReportStatsRequesting.mockRestore(); select( 'wc-api' ).isReportStatsRequesting.mockRestore();
select( 'wc-admin' ).isReportStatsError.mockRestore(); select( 'wc-api' ).isReportStatsError.mockRestore();
} ); } );
function setGetReportStats( func ) { function setGetReportStats( func ) {
select( 'wc-admin' ).getReportStats.mockImplementation( ( ...args ) => func( ...args ) ); select( 'wc-api' ).getReportStats.mockImplementation( ( ...args ) => func( ...args ) );
} }
function setIsReportStatsRequesting( func ) { function setIsReportStatsRequesting( func ) {
select( 'wc-admin' ).isReportStatsRequesting.mockImplementation( ( ...args ) => select( 'wc-api' ).isReportStatsRequesting.mockImplementation( ( ...args ) =>
func( ...args ) func( ...args )
); );
} }
function setIsReportStatsError( func ) { function setIsReportStatsError( func ) {
select( 'wc-admin' ).isReportStatsError.mockImplementation( ( ...args ) => func( ...args ) ); select( 'wc-api' ).isReportStatsError.mockImplementation( ( ...args ) => func( ...args ) );
} }
it( 'returns isRequesting if a request is in progress', () => { it( 'returns isRequesting if a request is in progress', () => {
@ -460,58 +460,58 @@ describe( 'getReportTableData()', () => {
}; };
beforeAll( () => { beforeAll( () => {
select( 'wc-admin' ).getReportItems = jest.fn().mockReturnValue( {} ); select( 'wc-api' ).getReportItems = jest.fn().mockReturnValue( {} );
select( 'wc-admin' ).isGetReportItemsRequesting = jest.fn().mockReturnValue( false ); select( 'wc-api' ).isReportItemsRequesting = jest.fn().mockReturnValue( false );
select( 'wc-admin' ).isGetReportItemsError = jest.fn().mockReturnValue( false ); select( 'wc-api' ).isReportItemsError = jest.fn().mockReturnValue( false );
} ); } );
afterAll( () => { afterAll( () => {
select( 'wc-admin' ).getReportItems.mockRestore(); select( 'wc-api' ).getReportItems.mockRestore();
select( 'wc-admin' ).isGetReportItemsRequesting.mockRestore(); select( 'wc-api' ).isReportItemsRequesting.mockRestore();
select( 'wc-admin' ).isGetReportItemsError.mockRestore(); select( 'wc-api' ).isReportItemsError.mockRestore();
} ); } );
function setGetReportItems( func ) { function setGetReportItems( func ) {
select( 'wc-admin' ).getReportItems.mockImplementation( ( ...args ) => func( ...args ) ); select( 'wc-api' ).getReportItems.mockImplementation( ( ...args ) => func( ...args ) );
} }
function setIsGetReportItemsRequesting( func ) { function setisReportItemsRequesting( func ) {
select( 'wc-admin' ).isGetReportItemsRequesting.mockImplementation( ( ...args ) => select( 'wc-api' ).isReportItemsRequesting.mockImplementation( ( ...args ) =>
func( ...args ) func( ...args )
); );
} }
function setIsGetReportItemsError( func ) { function setisReportItemsError( func ) {
select( 'wc-admin' ).isGetReportItemsError.mockImplementation( ( ...args ) => func( ...args ) ); select( 'wc-api' ).isReportItemsError.mockImplementation( ( ...args ) => func( ...args ) );
} }
it( 'returns isRequesting if a request is in progress', () => { it( 'returns isRequesting if a request is in progress', () => {
setIsGetReportItemsRequesting( () => true ); setisReportItemsRequesting( () => true );
const result = getReportTableData( 'coupons', query, select ); const result = getReportTableData( 'coupons', query, select );
expect( result ).toEqual( { ...response, query, isRequesting: true } ); expect( result ).toEqual( { ...response, query, isRequesting: true } );
expect( select( 'wc-admin' ).getReportItems ).toHaveBeenLastCalledWith( 'coupons', query ); expect( select( 'wc-api' ).getReportItems ).toHaveBeenLastCalledWith( 'coupons', query );
expect( select( 'wc-admin' ).isGetReportItemsRequesting ).toHaveBeenLastCalledWith( expect( select( 'wc-api' ).isReportItemsRequesting ).toHaveBeenLastCalledWith(
'coupons', 'coupons',
query query
); );
expect( select( 'wc-admin' ).isGetReportItemsError ).toHaveBeenCalledTimes( 0 ); expect( select( 'wc-api' ).isReportItemsError ).toHaveBeenCalledTimes( 0 );
} ); } );
it( 'returns isError if request errors', () => { it( 'returns isError if request errors', () => {
setIsGetReportItemsRequesting( () => false ); setisReportItemsRequesting( () => false );
setIsGetReportItemsError( () => true ); setisReportItemsError( () => true );
const result = getReportTableData( 'coupons', query, select ); const result = getReportTableData( 'coupons', query, select );
expect( result ).toEqual( { ...response, query, isError: true } ); expect( result ).toEqual( { ...response, query, isError: true } );
expect( select( 'wc-admin' ).getReportItems ).toHaveBeenLastCalledWith( 'coupons', query ); expect( select( 'wc-api' ).getReportItems ).toHaveBeenLastCalledWith( 'coupons', query );
expect( select( 'wc-admin' ).isGetReportItemsRequesting ).toHaveBeenLastCalledWith( expect( select( 'wc-api' ).isReportItemsRequesting ).toHaveBeenLastCalledWith(
'coupons', 'coupons',
query query
); );
expect( select( 'wc-admin' ).isGetReportItemsError ).toHaveBeenLastCalledWith( expect( select( 'wc-api' ).isReportItemsError ).toHaveBeenLastCalledWith(
'coupons', 'coupons',
query query
); );
@ -519,19 +519,19 @@ describe( 'getReportTableData()', () => {
it( 'returns results after queries finish', () => { it( 'returns results after queries finish', () => {
const items = [ { id: 1 }, { id: 2 }, { id: 3 } ]; const items = [ { id: 1 }, { id: 2 }, { id: 3 } ];
setIsGetReportItemsRequesting( () => false ); setisReportItemsRequesting( () => false );
setIsGetReportItemsError( () => false ); setisReportItemsError( () => false );
setGetReportItems( () => items ); setGetReportItems( () => items );
const result = getReportTableData( 'coupons', query, select ); const result = getReportTableData( 'coupons', query, select );
expect( result ).toEqual( { ...response, query, items } ); expect( result ).toEqual( { ...response, query, items } );
expect( select( 'wc-admin' ).getReportItems ).toHaveBeenLastCalledWith( 'coupons', query ); expect( select( 'wc-api' ).getReportItems ).toHaveBeenLastCalledWith( 'coupons', query );
expect( select( 'wc-admin' ).isGetReportItemsRequesting ).toHaveBeenLastCalledWith( expect( select( 'wc-api' ).isReportItemsRequesting ).toHaveBeenLastCalledWith(
'coupons', 'coupons',
query query
); );
expect( select( 'wc-admin' ).isGetReportItemsError ).toHaveBeenLastCalledWith( expect( select( 'wc-api' ).isReportItemsError ).toHaveBeenLastCalledWith(
'coupons', 'coupons',
query query
); );

View File

@ -139,7 +139,7 @@ function getRequestQuery( endpoint, dataType, query ) {
* @return {Object} Object containing summary number responses. * @return {Object} Object containing summary number responses.
*/ */
export function getSummaryNumbers( endpoint, query, select ) { export function getSummaryNumbers( endpoint, query, select ) {
const { getReportStats, isReportStatsRequesting, isReportStatsError } = select( 'wc-admin' ); const { getReportStats, isReportStatsRequesting, isReportStatsError } = select( 'wc-api' );
const response = { const response = {
isRequesting: false, isRequesting: false,
isError: false, isError: false,
@ -182,7 +182,7 @@ export function getSummaryNumbers( endpoint, query, select ) {
* @return {Object} Object containing API request information (response, fetching, and error details) * @return {Object} Object containing API request information (response, fetching, and error details)
*/ */
export function getReportChartData( endpoint, dataType, query, select ) { export function getReportChartData( endpoint, dataType, query, select ) {
const { getReportStats, isReportStatsRequesting, isReportStatsError } = select( 'wc-admin' ); const { getReportStats, isReportStatsRequesting, isReportStatsError } = select( 'wc-api' );
const response = { const response = {
isEmpty: false, isEmpty: false,
@ -296,8 +296,8 @@ export function getReportTableQuery( urlQuery, query ) {
* @return {Object} Object Table data response * @return {Object} Object Table data response
*/ */
export function getReportTableData( endpoint, urlQuery, select, query = {} ) { export function getReportTableData( endpoint, urlQuery, select, query = {} ) {
const { getReportItems, isGetReportItemsRequesting, isGetReportItemsError } = select( const { getReportItems, isReportItemsRequesting, isReportItemsError } = select(
'wc-admin' 'wc-api'
); );
const tableQuery = reportsUtils.getReportTableQuery( urlQuery, query ); const tableQuery = reportsUtils.getReportTableQuery( urlQuery, query );
@ -309,9 +309,9 @@ export function getReportTableData( endpoint, urlQuery, select, query = {} ) {
}; };
const items = getReportItems( endpoint, tableQuery ); const items = getReportItems( endpoint, tableQuery );
if ( isGetReportItemsRequesting( endpoint, tableQuery ) ) { if ( isReportItemsRequesting( endpoint, tableQuery ) ) {
return { ...response, isRequesting: true }; return { ...response, isRequesting: true };
} else if ( isGetReportItemsError( endpoint, tableQuery ) ) { } else if ( isReportItemsError( endpoint, tableQuery ) ) {
return { ...response, isError: true }; return { ...response, isError: true };
} }

View File

@ -33,11 +33,7 @@ const isGetOrdersRequesting = getResource => ( query = {} ) => {
const resourceName = getResourceName( 'order-query', query ); const resourceName = getResourceName( 'order-query', query );
const { lastRequested, lastReceived } = getResource( resourceName ); const { lastRequested, lastReceived } = getResource( resourceName );
if ( isNil( lastRequested ) ) { if ( isNil( lastRequested ) || isNil( lastReceived ) ) {
return false;
}
if ( isNil( lastReceived ) ) {
return true; return true;
} }

View File

@ -0,0 +1,11 @@
/** @format */
/**
* Internal dependencies
*/
import operations from './operations';
import selectors from './selectors';
export default {
operations,
selectors,
};

View File

@ -0,0 +1,74 @@
/** @format */
/**
* External dependencies
*/
import apiFetch from '@wordpress/api-fetch';
/**
* WooCommerce dependencies
*/
import { stringifyQuery } from '@woocommerce/navigation';
/**
* Internal dependencies
*/
import { getResourceIdentifier, getResourcePrefix } from '../../utils';
import { NAMESPACE } from '../../constants';
import { SWAGGERNAMESPACE } from 'store/constants';
// TODO: Remove once swagger endpoints are phased out.
const swaggerEndpoints = [ 'categories', 'coupons', 'taxes' ];
const typeEndpointMap = {
'report-items-query-orders': 'orders',
'report-items-query-revenue': 'revenue',
'report-items-query-products': 'products',
'report-items-query-categories': 'categories',
'report-items-query-coupons': 'coupons',
'report-items-query-taxes': 'taxes',
'report-items-query-variations': 'variations',
};
function read( resourceNames, fetch = apiFetch ) {
const filteredNames = resourceNames.filter( name => {
const prefix = getResourcePrefix( name );
return Boolean( typeEndpointMap[ prefix ] );
} );
return filteredNames.map( async resourceName => {
const prefix = getResourcePrefix( resourceName );
const endpoint = typeEndpointMap[ prefix ];
const query = getResourceIdentifier( resourceName );
const fetchArgs = {
parse: false,
};
if ( swaggerEndpoints.indexOf( endpoint ) >= 0 ) {
fetchArgs.url = SWAGGERNAMESPACE + 'reports/' + endpoint + stringifyQuery( query );
} else {
fetchArgs.path = NAMESPACE + '/reports/' + endpoint + stringifyQuery( query );
}
try {
const response = await fetch( fetchArgs );
const report = await response.json();
const totalResults = parseInt( response.headers.get( 'x-wp-total' ) );
const totalPages = parseInt( response.headers.get( 'x-wp-totalpages' ) );
return {
[ resourceName ]: {
data: report,
totalResults,
totalPages,
},
};
} catch ( error ) {
return { [ resourceName ]: { error } };
}
} );
}
export default {
read,
};

View File

@ -0,0 +1,43 @@
/** @format */
/**
* External dependencies
*/
import { isNil } from 'lodash';
/**
* Internal dependencies
*/
import { getResourceName } from '../../utils';
import { DEFAULT_REQUIREMENT } from '../../constants';
const getReportItems = ( getResource, requireResource ) => (
type,
query = {},
requirement = DEFAULT_REQUIREMENT
) => {
const resourceName = getResourceName( `report-items-query-${ type }`, query );
return requireResource( requirement, resourceName ) || {};
};
const isReportItemsRequesting = getResource => ( type, query = {} ) => {
const resourceName = getResourceName( `report-items-query-${ type }`, query );
const { lastRequested, lastReceived } = getResource( resourceName );
if ( isNil( lastRequested ) || isNil( lastReceived ) ) {
return true;
}
return lastRequested > lastReceived;
};
const isReportItemsError = getResource => ( type, query = {} ) => {
const resourceName = getResourceName( `report-items-query-${ type }`, query );
return getResource( resourceName ).error;
};
export default {
getReportItems,
isReportItemsRequesting,
isReportItemsError,
};

View File

@ -0,0 +1,11 @@
/** @format */
/**
* Internal dependencies
*/
import operations from './operations';
import selectors from './selectors';
export default {
operations,
selectors,
};

View File

@ -0,0 +1,76 @@
/** @format */
/**
* External dependencies
*/
import apiFetch from '@wordpress/api-fetch';
/**
* WooCommerce dependencies
*/
import { stringifyQuery } from '@woocommerce/navigation';
/**
* Internal dependencies
*/
import { getResourceIdentifier, getResourcePrefix } from '../../utils';
import { NAMESPACE } from '../../constants';
import { SWAGGERNAMESPACE } from 'store/constants';
const statEndpoints = [ 'orders', 'revenue', 'products' ];
// TODO: Remove once swagger endpoints are phased out.
const swaggerEndpoints = [ 'categories', 'coupons', 'taxes' ];
const typeEndpointMap = {
'report-stats-query-orders': 'orders',
'report-stats-query-revenue': 'revenue',
'report-stats-query-products': 'products',
'report-stats-query-categories': 'categories',
'report-stats-query-coupons': 'coupons',
'report-stats-query-taxes': 'taxes',
};
function read( resourceNames, fetch = apiFetch ) {
const filteredNames = resourceNames.filter( name => {
const prefix = getResourcePrefix( name );
return Boolean( typeEndpointMap[ prefix ] );
} );
return filteredNames.map( async resourceName => {
const prefix = getResourcePrefix( resourceName );
const endpoint = typeEndpointMap[ prefix ];
const query = getResourceIdentifier( resourceName );
const fetchArgs = {
parse: false,
};
if ( swaggerEndpoints.indexOf( endpoint ) >= 0 ) {
fetchArgs.url = SWAGGERNAMESPACE + 'reports/' + endpoint + '/stats' + stringifyQuery( query );
} else if ( statEndpoints.indexOf( endpoint ) >= 0 ) {
fetchArgs.path = NAMESPACE + '/reports/' + endpoint + '/stats' + stringifyQuery( query );
} else {
fetchArgs.path = endpoint + stringifyQuery( query );
}
try {
const response = await fetch( fetchArgs );
const report = await response.json();
const totalResults = parseInt( response.headers.get( 'x-wp-total' ) );
const totalPages = parseInt( response.headers.get( 'x-wp-totalpages' ) );
return {
[ resourceName ]: {
data: report,
totalResults,
totalPages,
},
};
} catch ( error ) {
return { [ resourceName ]: { error } };
}
} );
}
export default {
read,
};

View File

@ -0,0 +1,45 @@
/** @format */
/**
* External dependencies
*/
import { isNil } from 'lodash';
/**
* Internal dependencies
*/
import { getResourceName } from '../../utils';
import { DEFAULT_REQUIREMENT } from '../../constants';
const getReportStats = ( getResource, requireResource ) => (
type,
query = {},
requirement = DEFAULT_REQUIREMENT
) => {
const resourceName = getResourceName( `report-stats-query-${ type }`, query );
const data = requireResource( requirement, resourceName ) || {};
return data;
};
const isReportStatsRequesting = getResource => ( type, query = {} ) => {
const resourceName = getResourceName( `report-stats-query-${ type }`, query );
const { lastRequested, lastReceived } = getResource( resourceName );
if ( isNil( lastRequested ) || isNil( lastReceived ) ) {
return true;
}
return lastRequested > lastReceived;
};
const isReportStatsError = getResource => ( type, query = {} ) => {
const resourceName = getResourceName( `report-stats-query-${ type }`, query );
return getResource( resourceName ).error;
};
export default {
getReportStats,
isReportStatsRequesting,
isReportStatsError,
};

View File

@ -5,8 +5,12 @@ export function getResourceName( prefix, identifier ) {
return `${ prefix }:${ identifierString }`; return `${ prefix }:${ identifierString }`;
} }
export function getResourcePrefix( resourceName ) {
return resourceName.substring( 0, resourceName.indexOf( ':' ) );
}
export function isResourcePrefix( resourceName, prefix ) { export function isResourcePrefix( resourceName, prefix ) {
const resourcePrefix = resourceName.substring( 0, resourceName.indexOf( ':' ) ); const resourcePrefix = getResourcePrefix( resourceName );
return resourcePrefix === prefix; return resourcePrefix === prefix;
} }

View File

@ -5,18 +5,24 @@
*/ */
import notes from './notes'; import notes from './notes';
import orders from './orders'; import orders from './orders';
import reportItems from './reports/items';
import reportStats from './reports/stats';
function createWcApiSpec() { function createWcApiSpec() {
return { return {
selectors: { selectors: {
...notes.selectors, ...notes.selectors,
...orders.selectors, ...orders.selectors,
...reportItems.selectors,
...reportStats.selectors,
}, },
operations: { operations: {
read( resourceNames ) { read( resourceNames ) {
return [ return [
...notes.operations.read( resourceNames ), ...notes.operations.read( resourceNames ),
...orders.operations.read( resourceNames ), ...orders.operations.read( resourceNames ),
...reportItems.operations.read( resourceNames ),
...reportStats.operations.read( resourceNames ),
]; ];
}, },
}, },