UNPKG

@proofkit/fmodata

Version:

FileMaker OData API client

29 lines (28 loc) 898 B
import { isColumn } from "../../orm/column.js"; function processSelectWithRenames(fields, tableName, logger) { const selectedFields = []; const fieldMapping = {}; for (const [outputKey, column] of Object.entries(fields)) { if (!isColumn(column)) { throw new Error(`select() expects column references, but got: ${typeof column}`); } if (column.tableName !== tableName) { logger.warn( `Column ${column.toString()} is from table "${column.tableName}", but query is for table "${tableName}"` ); } const fieldName = column.fieldName; selectedFields.push(fieldName); if (fieldName !== outputKey) { fieldMapping[fieldName] = outputKey; } } return { selectedFields, fieldMapping: Object.keys(fieldMapping).length > 0 ? fieldMapping : {} }; } export { processSelectWithRenames }; //# sourceMappingURL=select-mixin.js.map