(queryId: Id)
| 366 | }; |
| 367 | |
| 368 | const setQueryDefinitionImpl = (queryId: Id): Queries => |
| 369 | getResultStore(queryId).transaction( |
| 370 | () => |
| 371 | ifNotUndefined(getQueryArgs(queryId), ([build, , sourceIsQuery]) => { |
| 372 | const tableId = getTableId(queryId); |
| 373 | const rootStore = sourceIsQuery ? getResultStore(tableId) : store; |
| 374 | const resultStore = getResultStore(queryId); |
| 375 | const paramValues = getParamValues(queryId); |
| 376 | |
| 377 | setAdd(redefiningQueryIds, queryId); |
| 378 | resetPreStores(queryId); |
| 379 | resetSourceStores(queryId); |
| 380 | |
| 381 | const selectEntries: [Id, SelectClause][] = []; |
| 382 | const joinEntries: [Id | undefined, JoinClause][] = [ |
| 383 | [ |
| 384 | undefined, |
| 385 | [tableId, undefined, undefined, [], mapNew(), rootStore], |
| 386 | ], |
| 387 | ]; |
| 388 | const wheres: WhereClause[] = []; |
| 389 | const groupEntries: [Id, GroupClause][] = []; |
| 390 | const havings: HavingClause[] = []; |
| 391 | |
| 392 | const param = (paramId: Id) => objGet(paramValues, paramId); |
| 393 | |
| 394 | const select = ( |
| 395 | arg1: |
| 396 | | true |
| 397 | | Id |
| 398 | | ((getTableCell: GetTableCell, rowId: Id) => CellOrUndefined), |
| 399 | arg2?: Id, |
| 400 | arg3?: Id, |
| 401 | ) => { |
| 402 | const joinedTableId = isTrue(arg1) ? arg2 : arg1; |
| 403 | const joinedCellId = isTrue(arg1) ? arg3 : arg2; |
| 404 | const selectEntry: [Id, SelectClause] = isFunction(arg1) |
| 405 | ? [size(selectEntries) + EMPTY_STRING, arg1] |
| 406 | : isUndefined(joinedCellId) |
| 407 | ? [arg1 as Id, (getTableCell) => getTableCell(arg1 as Id)] |
| 408 | : [ |
| 409 | joinedCellId, |
| 410 | (getTableCell) => |
| 411 | isTrue(arg1) |
| 412 | ? getTableCell(true, joinedTableId as Id, joinedCellId) |
| 413 | : getTableCell(joinedTableId as Id, joinedCellId), |
| 414 | ]; |
| 415 | arrayPush(selectEntries, selectEntry); |
| 416 | return { |
| 417 | as: (selectedCellId: Id) => (selectEntry[0] = selectedCellId), |
| 418 | }; |
| 419 | }; |
| 420 | |
| 421 | const join = ( |
| 422 | arg1: true | Id, |
| 423 | arg2?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined), |
| 424 | arg3?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined), |
| 425 | arg4?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined), |
no test coverage detected
searching dependent graphs…