Skip to content

Commit 4499f44

Browse files
committed
v1.1.0
1 parent 1e970d3 commit 4499f44

File tree

18 files changed

+165
-12
lines changed

18 files changed

+165
-12
lines changed

dist/cjs/VERSION.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export declare const VERSION = "1.0.39";
1+
export declare const VERSION = "1.1.0";

dist/cjs/VERSION.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.VERSION = void 0;
4-
exports.VERSION = "1.0.39";
4+
exports.VERSION = "1.1.0";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || function (mod) {
19+
if (mod && mod.__esModule) return mod;
20+
var result = {};
21+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22+
__setModuleDefault(result, mod);
23+
return result;
24+
};
25+
Object.defineProperty(exports, "__esModule", { value: true });
26+
const cmd = __importStar(require("commander"));
27+
const logger_util_js_1 = require("../../utils/logger_util.js");
28+
const spinner_util_js_1 = require("../../utils/spinner_util.js");
29+
const options_util_js_1 = require("../../utils/options_util.js");
30+
const auth_util_js_1 = require("../../utils/auth_util.js");
31+
const config_util_js_1 = require("../../utils/config_util.js");
32+
const output_util_js_1 = require("../../utils/output_util.js");
33+
const query_js_1 = require("../../../integration/boilingdata/query.js");
34+
const logger = (0, logger_util_js_1.getLogger)("bdcli-api");
35+
logger.setLogLevel(logger_util_js_1.ELogLevel.WARN);
36+
async function query(options, _command) {
37+
try {
38+
options = await (0, config_util_js_1.combineOptsWithSettings)(options, logger);
39+
(0, spinner_util_js_1.updateSpinnerText)("Authenticating");
40+
const { idToken: token, cached, region } = await (0, auth_util_js_1.getIdToken)(logger);
41+
(0, spinner_util_js_1.updateSpinnerText)(cached ? "Authenticating: cached" : "Authenticating: success");
42+
(0, spinner_util_js_1.spinnerSuccess)();
43+
(0, spinner_util_js_1.updateSpinnerText)("Sending Query to Boiling API");
44+
const results = await (0, query_js_1.runBoilingQuery)(options.sql, token, region, logger);
45+
(0, spinner_util_js_1.spinnerSuccess)();
46+
await (0, output_util_js_1.outputResults)(results, options.disableSpinner);
47+
}
48+
catch (err) {
49+
(0, spinner_util_js_1.spinnerError)(err?.message);
50+
}
51+
}
52+
const program = new cmd.Command("bdcli api query")
53+
.addOption(new cmd.Option("-s, --sql <sqlQuery>", "SQL clause").makeOptionMandatory())
54+
.action(async (options, command) => await query(options, command));
55+
(async () => {
56+
await (0, options_util_js_1.addGlobalOptions)(program, logger);
57+
await program.parseAsync(process.argv);
58+
})();

dist/cjs/bdcli/commands/bdcli-api.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
const commander_1 = require("commander");
44
const program = new commander_1.Command("bdcli api")
55
.executableDir("api")
6-
.command("wssurl", "Get signed WebSocket (wss://) URL for connecting to Boiling Data");
6+
.command("wssurl", "Get signed WebSocket (wss://) URL for connecting to Boiling Data")
7+
.command("query", "Run SQL query on Boiling cloud");
78
program.parse(process.argv);

dist/cjs/bdcli/utils/spinner_util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ function spinnerWarn(message) {
5151
}
5252
exports.spinnerWarn = spinnerWarn;
5353
function spinnerError(message, forceExit = true) {
54-
if (isEnabled)
55-
spinner.fail(message ? error(message) : undefined);
54+
// We show errors regardless whether the spinner is disabled
55+
spinner.fail(message ? error(message) : undefined);
5656
if (forceExit)
5757
process.exit(1); // error
5858
}

dist/cjs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ program
3535
.command("aws", "Setup and configure your AWS account integration with BoilingData")
3636
.command("domain", "Admin setup and configuration for your domain (.e.g @boilingdata.com, @mycompany.com)")
3737
.command("sandbox", "Managa Boiling S3 Sandboxes with IaC templates")
38-
.command("api", "Get signed WSS URL etc.");
38+
.command("api", "Boiling query API operations: run SQL, get signed WSS URL etc.");
3939
program.parse(process.argv);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { ILogger } from "../../bdcli/utils/logger_util.js";
2+
export declare function runBoilingQuery(sql: string, idToken: string, region: string, logger: ILogger): Promise<any[]>;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.runBoilingQuery = void 0;
4+
const node_boilingdata_1 = require("@boilingdata/node-boilingdata");
5+
async function runBoilingQuery(sql, idToken, region, logger) {
6+
try {
7+
logger.debug({ sql, idToken, region });
8+
const bdInstance = new node_boilingdata_1.BoilingData({
9+
logLevel: "error",
10+
region: region,
11+
authcontext: { idToken: { jwtToken: idToken } },
12+
});
13+
await bdInstance.connect();
14+
const start = Date.now();
15+
//const sql = `SELECT COUNT(*) FROM parquet_scan('s3://boilingdata-demo/demo.parquet');`;
16+
const rows = await bdInstance.execQueryPromise({ sql });
17+
const stop = Date.now();
18+
const parsedRows = JSON.parse(JSON.stringify(rows));
19+
logger.debug(JSON.parse(JSON.stringify(rows)));
20+
logger.debug("Query time measured e2e (ms):", stop - start);
21+
await bdInstance.close();
22+
return parsedRows;
23+
}
24+
catch (err) {
25+
logger.error(err);
26+
}
27+
return [];
28+
}
29+
exports.runBoilingQuery = runBoilingQuery;

dist/esm/VERSION.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export declare const VERSION = "1.0.39";
1+
export declare const VERSION = "1.1.0";

0 commit comments

Comments
 (0)