Socket
Socket
Sign inDemoInstall

@cubejs-client/core

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cubejs-client/core - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

src/SqlQuery.js

56

dist/cubejs-client-core.js

@@ -218,2 +218,26 @@ 'use strict';

var SqlQuery =
/*#__PURE__*/
function () {
function SqlQuery(sqlQuery) {
_classCallCheck(this, SqlQuery);
this.sqlQuery = sqlQuery;
}
_createClass(SqlQuery, [{
key: "rawQuery",
value: function rawQuery() {
return this.sqlQuery.sql;
}
}, {
key: "sql",
value: function sql() {
return this.rawQuery().sql[0];
}
}]);
return SqlQuery;
}();
var ProgressResult =

@@ -265,6 +289,4 @@ /*#__PURE__*/

}, {
key: "load",
value: function load(query, options, callback) {
var _this = this;
key: "loadMethod",
value: function loadMethod(request, toResult, options, callback) {
if (typeof options === 'function' && !callback) {

@@ -289,3 +311,3 @@ callback = options;

_context.next = 2;
return _this.request("/load?query=".concat(JSON.stringify(query)));
return request();

@@ -329,3 +351,3 @@ case 2:

case 13:
return _context.abrupt("return", new ResultSet(body));
return _context.abrupt("return", toResult(body));

@@ -355,2 +377,24 @@ case 14:

}
}, {
key: "load",
value: function load(query, options, callback) {
var _this = this;
return this.loadMethod(function () {
return _this.request("/load?query=".concat(JSON.stringify(query)));
}, function (body) {
return new ResultSet(body);
}, options, callback);
}
}, {
key: "sql",
value: function sql(query, options, callback) {
var _this2 = this;
return this.loadMethod(function () {
return _this2.request("/sql?query=".concat(JSON.stringify(query)));
}, function (body) {
return new SqlQuery(body);
}, options, callback);
}
}]);

@@ -357,0 +401,0 @@

2

package.json
{
"name": "@cubejs-client/core",
"version": "0.1.3",
"version": "0.1.4",
"description": "cube.js client",

@@ -5,0 +5,0 @@ "main": "dist/cubejs-client-core.js",

import { fetch } from 'whatwg-fetch';
import ResultSet from './ResultSet';
import SqlQuery from './SqlQuery';
import ProgressResult from './ProgressResult';

@@ -19,3 +20,3 @@

load(query, options, callback) {
loadMethod(request, toResult, options, callback) {
if (typeof options === 'function' && !callback) {

@@ -28,4 +29,5 @@ callback = options;

const loadImpl = async () => {
const response = await this.request(`/load?query=${JSON.stringify(query)}`);
const response = await request();
if (response.status === 502) {

@@ -44,3 +46,3 @@ return loadImpl(); // TODO backoff wait

}
return new ResultSet(body);
return toResult(body);
};

@@ -53,2 +55,20 @@ if (callback) {

}
load(query, options, callback) {
return this.loadMethod(
() => this.request(`/load?query=${JSON.stringify(query)}`),
(body) => new ResultSet(body),
options,
callback
);
}
sql(query, options, callback) {
return this.loadMethod(
() => this.request(`/sql?query=${JSON.stringify(query)}`),
(body) => new SqlQuery(body),
options,
callback
);
}
}

@@ -55,0 +75,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc