Compare commits

...

11 Commits

Author SHA1 Message Date
Michael Hohn
390dfeb087 refactor cli 2025-03-15 18:12:04 -07:00
Michael Hohn
012e597d4a refactor cli 2025-03-15 18:09:29 -07:00
Michael Hohn
cd568db7b4 refactor cli 2025-03-15 18:06:26 -07:00
Michael Hohn
dc745dd8e1 refactor cli 2025-03-15 18:02:25 -07:00
Michael Hohn
29d6b127e2 refactor cli 2025-03-15 18:00:00 -07:00
Michael Hohn
1cbfba32a0 refactor cli 2025-03-15 17:43:55 -07:00
Michael Hohn
c2b2d10591 refactor cli 2025-03-15 17:43:14 -07:00
Michael Hohn
1fe4abf6e8 refactor cli 2025-03-15 17:42:28 -07:00
Michael Hohn
efaef8a2cb refactor cli 2025-03-15 17:40:54 -07:00
Michael Hohn
a8d61a605a refactor cli 2025-03-15 17:36:35 -07:00
Michael Hohn
e44024763d refactor cli 2025-03-15 17:24:46 -07:00
3 changed files with 340 additions and 1614 deletions

View File

@@ -48,7 +48,7 @@ const baseConfig = {
"@typescript-eslint/no-throw-literal": "error", "@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/consistent-type-imports": "error",
"import/consistent-type-specifier-style": ["error", "prefer-top-level"], "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
curly: ["error", "all"], // curly: ["error", "all"],
"escompat/no-regexp-lookbehind": "off", "escompat/no-regexp-lookbehind": "off",
"etc/no-implicit-any-catch": "error", "etc/no-implicit-any-catch": "error",
"filenames/match-regex": "off", "filenames/match-regex": "off",

File diff suppressed because it is too large Load Diff

View File

@@ -15,28 +15,28 @@ export async function extractRawResults(
const bqrsInfo = await cliServer.bqrsInfo(filePath); const bqrsInfo = await cliServer.bqrsInfo(filePath);
const resultSets = bqrsInfo["result-sets"]; const resultSets = bqrsInfo["result-sets"];
if (resultSets.length < 1) { if (resultSets.length === 0) {
throw new Error("No result sets found in results file."); throw new Error("No result sets found in results file.");
} }
if (resultSets.length > 1) { if (resultSets.length > 1) {
void logger.log( void logger.log(
"Multiple result sets found in results file. Only one will be used.", "Multiple result sets found in results file. Using the first one.",
); );
} }
// Always prefer #select over any other result set. #select is usually the result the user // Prefer `#select` result set; otherwise, use the first available set.
// wants to see since it contains the outer #select.
const schema = const schema =
resultSets.find((resultSet) => resultSet.name === SELECT_TABLE_NAME) ?? resultSets.find((r) => r.name === SELECT_TABLE_NAME) ?? resultSets[0];
resultSets[0];
const chunk = await cliServer.bqrsDecode(filePath, schema.name, { const chunk = await cliServer.bqrsDecode(filePath, schema.name, {
pageSize: MAX_RAW_RESULTS, pageSize: MAX_RAW_RESULTS,
}); });
const resultSet = bqrsToResultSet(schema, chunk); const resultSet = bqrsToResultSet(schema, chunk);
const capped = !!chunk.next; return {
resultSet,
return { resultSet, fileLinkPrefix, sourceLocationPrefix, capped }; fileLinkPrefix,
sourceLocationPrefix,
capped: !!chunk.next,
};
} }