UNPKG

@mikezimm/fps-core-v7

Version:

Library of reusable core interfaces, types and constants migrated from fps-library-v2

36 lines 1.67 kB
/** * 2024-09-06: Migrated from same folder fps-library-v2\src\pnpjs\SourceItems */ import { StandardMetaViewProps } from '../ISourceProps'; import { getExpandColumns } from '../Lists/getVX/getExpandV2'; export function createMinFetchProps(sourceProps, alertMe, consoleLog) { //This converts ISeriesSortObject which has string order to IOrderByBoolean for fetch requirements const orderBy = !sourceProps.orderBy ? null : { prop: sourceProps.orderBy.prop, asc: sourceProps.orderBy.asc ? sourceProps.orderBy.asc : sourceProps.orderBy.order === 'desc' ? false : true, }; if (!sourceProps.expandThese || sourceProps.expandThese.length === 0) { sourceProps.expandThese = getExpandColumns(sourceProps.columns, []); } // 2023-03-19: always add BaseType if it's not already found. // NOTE: This is not valid on items, only Lists // if ( sourceProps.columns.indexOf( 'BaseType' ) < 0 ) { // sourceProps.columns.push( 'BaseType' ); // } // 2023-03-19: always add BaseType if it's not already found. // NOTE: This is not valid on items, only Lists // if ( sourceProps.selectThese.indexOf( 'BaseType' ) < 0 ) { // sourceProps.selectThese.push( 'BaseType' ); // } const FetchProps = { ...sourceProps, ...{ orderByBoolean: orderBy, alertMe: alertMe, fetchCount: sourceProps.fetchCount, consoleLog: consoleLog, viewProps: sourceProps.viewProps ? sourceProps.viewProps : StandardMetaViewProps, } }; return FetchProps; } //# sourceMappingURL=createMinFetchProps.js.map