(
tableName: string,
rowIdColumnName: string,
condition?: DpcTabularCondition,
contentSubIds?: Ids,
)
| 96 | }; |
| 97 | |
| 98 | const loadTable = async ( |
| 99 | tableName: string, |
| 100 | rowIdColumnName: string, |
| 101 | condition?: DpcTabularCondition, |
| 102 | contentSubIds?: Ids, |
| 103 | ): Promise<Table> => { |
| 104 | const contentSubIdSet = isUndefined(contentSubIds) |
| 105 | ? undefined |
| 106 | : setNew(contentSubIds); |
| 107 | const includeContentSubId = (contentSubId: Id): boolean => |
| 108 | isUndefined(contentSubIdSet) || collHas(contentSubIdSet, contentSubId); |
| 109 | return canSelect(tableName, rowIdColumnName) |
| 110 | ? objNew( |
| 111 | arrayFilter( |
| 112 | arrayMap( |
| 113 | await databaseExecuteCommand( |
| 114 | SELECT_STAR_FROM + |
| 115 | escapeId(tableName) + |
| 116 | getWhereCondition(tableName, condition), |
| 117 | ), |
| 118 | (row): [Id | undefined, Row] => { |
| 119 | const rowId = row[rowIdColumnName]; |
| 120 | const rowContent = decode |
| 121 | ? objMap(objDel(row, rowIdColumnName), decode) |
| 122 | : objDel(row, rowIdColumnName); |
| 123 | return [ |
| 124 | rowId, |
| 125 | isUndefined(contentSubIdSet) |
| 126 | ? rowContent |
| 127 | : objNew( |
| 128 | arrayFilter( |
| 129 | objToArray( |
| 130 | rowContent, |
| 131 | (cellOrValue, contentSubId) => |
| 132 | [contentSubId, cellOrValue] as [Id, any], |
| 133 | ), |
| 134 | ([contentSubId]) => includeContentSubId(contentSubId), |
| 135 | ), |
| 136 | ), |
| 137 | ]; |
| 138 | }, |
| 139 | ), |
| 140 | (entry): entry is [Id, Row] => |
| 141 | !isUndefined(entry[0]) && !objIsEmpty(entry[1]), |
| 142 | ), |
| 143 | ) |
| 144 | : {}; |
| 145 | }; |
| 146 | |
| 147 | const saveTable = async ( |
| 148 | tableName: string, |
no test coverage detected
searching dependent graphs…