Skip to content

Commit 0b1f1d3

Browse files
committed
Client build
1 parent 13ab5de commit 0b1f1d3

File tree

6 files changed

+145
-31
lines changed

6 files changed

+145
-31
lines changed

packages/cubejs-client-core/dist/cubejs-client-core.esm.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -926,9 +926,19 @@ function () {
926926
return ProgressResult;
927927
}();
928928

929+
/**
930+
* Default transport implementation.
931+
*/
932+
929933
var HttpTransport =
930934
/*#__PURE__*/
931935
function () {
936+
/**
937+
* @param options - mandatory options object
938+
* @param options.authorization - [jwt auth token](security)
939+
* @param options.apiUrl - path to `/cubejs-api/v1`
940+
* @param [options.headers] - object of custom headers
941+
*/
932942
function HttpTransport(_ref) {
933943
var authorization = _ref.authorization,
934944
apiUrl = _ref.apiUrl,
@@ -1053,6 +1063,23 @@ function () {
10531063
baseRequestId: uuid()
10541064
}, params));
10551065
}
1066+
/**
1067+
* Base method used to perform all API calls.
1068+
* Shouldn't be used directly.
1069+
* @param request - function that invoked to perform actual request using `transport.request()` method.
1070+
* @param toResult - function that maps results of invocation to method return result
1071+
* @param [options] - options object
1072+
* @param options.mutexObj - object to use to store MUTEX
1073+
* @param [options.mutexKey='default'] - key to use to store current request MUTEX inside `mutexObj`.
1074+
* MUTEX object is used to reject orphaned queries results when new queries are sent.
1075+
* For example if two queries are sent with same `mutexKey` only last one will return results.
1076+
* @param options.subscribe - pass `true` to use continuous fetch behavior.
1077+
* @param {Function} options.progressCallback - function that receives `ProgressResult` on each
1078+
* `Continue wait` message.
1079+
* @param [callback] - if passed `callback` function will be called instead of `Promise` returned
1080+
* @return {{unsubscribe: function()}}
1081+
*/
1082+
10561083
}, {
10571084
key: "loadMethod",
10581085
value: function loadMethod(request, toResult, options, callback) {
@@ -1468,8 +1495,8 @@ function () {
14681495
* new Chart(context, chartjsConfig(resultSet));
14691496
* ```
14701497
* @param query - [Query object](query-format)
1471-
* @param options
1472-
* @param callback
1498+
* @param [options] - See {@link CubejsApi#loadMethod}
1499+
* @param [callback] - See {@link CubejsApi#loadMethod}
14731500
* @returns {Promise} for {@link ResultSet} if `callback` isn't passed
14741501
*/
14751502

@@ -1491,8 +1518,8 @@ function () {
14911518
/**
14921519
* Get generated SQL string for given `query`.
14931520
* @param query - [Query object](query-format)
1494-
* @param options
1495-
* @param callback
1521+
* @param [options] - See {@link CubejsApi#loadMethod}
1522+
* @param [callback] - See {@link CubejsApi#loadMethod}
14961523
* @return {Promise} for {@link SqlQuery} if `callback` isn't passed
14971524
*/
14981525

@@ -1511,8 +1538,8 @@ function () {
15111538
}
15121539
/**
15131540
* Get meta description of cubes available for querying.
1514-
* @param options
1515-
* @param callback
1541+
* @param [options] - See {@link CubejsApi#loadMethod}
1542+
* @param [callback] - See {@link CubejsApi#loadMethod}
15161543
* @return {Promise} for {@link Meta} if `callback` isn't passed
15171544
*/
15181545

@@ -1561,12 +1588,13 @@ function () {
15611588
);
15621589
```
15631590
* @name cubejs
1564-
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing.
1591+
* @param [apiToken] - [API token](security) is used to authorize requests and determine SQL database you're accessing.
15651592
* In the development mode, Cube.js Backend will print the API token to the console on on startup.
1566-
* Can be an async function without arguments that returns API token. Optional.
1567-
* @param options - options object.
1593+
* Can be an async function without arguments that returns API token.
1594+
* @param [options] - options object.
15681595
* @param options.apiUrl - URL of your Cube.js Backend.
15691596
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`.
1597+
* @param options.transport - transport implementation to use. {@link HttpTransport} will be used by default.
15701598
* @returns {CubejsApi}
15711599
* @order -10
15721600
*/

packages/cubejs-client-core/dist/cubejs-client-core.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,19 @@ function () {
932932
return ProgressResult;
933933
}();
934934

935+
/**
936+
* Default transport implementation.
937+
*/
938+
935939
var HttpTransport =
936940
/*#__PURE__*/
937941
function () {
942+
/**
943+
* @param options - mandatory options object
944+
* @param options.authorization - [jwt auth token](security)
945+
* @param options.apiUrl - path to `/cubejs-api/v1`
946+
* @param [options.headers] - object of custom headers
947+
*/
938948
function HttpTransport(_ref) {
939949
var authorization = _ref.authorization,
940950
apiUrl = _ref.apiUrl,
@@ -1059,6 +1069,23 @@ function () {
10591069
baseRequestId: uuid()
10601070
}, params));
10611071
}
1072+
/**
1073+
* Base method used to perform all API calls.
1074+
* Shouldn't be used directly.
1075+
* @param request - function that invoked to perform actual request using `transport.request()` method.
1076+
* @param toResult - function that maps results of invocation to method return result
1077+
* @param [options] - options object
1078+
* @param options.mutexObj - object to use to store MUTEX
1079+
* @param [options.mutexKey='default'] - key to use to store current request MUTEX inside `mutexObj`.
1080+
* MUTEX object is used to reject orphaned queries results when new queries are sent.
1081+
* For example if two queries are sent with same `mutexKey` only last one will return results.
1082+
* @param options.subscribe - pass `true` to use continuous fetch behavior.
1083+
* @param {Function} options.progressCallback - function that receives `ProgressResult` on each
1084+
* `Continue wait` message.
1085+
* @param [callback] - if passed `callback` function will be called instead of `Promise` returned
1086+
* @return {{unsubscribe: function()}}
1087+
*/
1088+
10621089
}, {
10631090
key: "loadMethod",
10641091
value: function loadMethod(request, toResult, options, callback) {
@@ -1474,8 +1501,8 @@ function () {
14741501
* new Chart(context, chartjsConfig(resultSet));
14751502
* ```
14761503
* @param query - [Query object](query-format)
1477-
* @param options
1478-
* @param callback
1504+
* @param [options] - See {@link CubejsApi#loadMethod}
1505+
* @param [callback] - See {@link CubejsApi#loadMethod}
14791506
* @returns {Promise} for {@link ResultSet} if `callback` isn't passed
14801507
*/
14811508

@@ -1497,8 +1524,8 @@ function () {
14971524
/**
14981525
* Get generated SQL string for given `query`.
14991526
* @param query - [Query object](query-format)
1500-
* @param options
1501-
* @param callback
1527+
* @param [options] - See {@link CubejsApi#loadMethod}
1528+
* @param [callback] - See {@link CubejsApi#loadMethod}
15021529
* @return {Promise} for {@link SqlQuery} if `callback` isn't passed
15031530
*/
15041531

@@ -1517,8 +1544,8 @@ function () {
15171544
}
15181545
/**
15191546
* Get meta description of cubes available for querying.
1520-
* @param options
1521-
* @param callback
1547+
* @param [options] - See {@link CubejsApi#loadMethod}
1548+
* @param [callback] - See {@link CubejsApi#loadMethod}
15221549
* @return {Promise} for {@link Meta} if `callback` isn't passed
15231550
*/
15241551

@@ -1567,12 +1594,13 @@ function () {
15671594
);
15681595
```
15691596
* @name cubejs
1570-
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing.
1597+
* @param [apiToken] - [API token](security) is used to authorize requests and determine SQL database you're accessing.
15711598
* In the development mode, Cube.js Backend will print the API token to the console on on startup.
1572-
* Can be an async function without arguments that returns API token. Optional.
1573-
* @param options - options object.
1599+
* Can be an async function without arguments that returns API token.
1600+
* @param [options] - options object.
15741601
* @param options.apiUrl - URL of your Cube.js Backend.
15751602
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`.
1603+
* @param options.transport - transport implementation to use. {@link HttpTransport} will be used by default.
15761604
* @returns {CubejsApi}
15771605
* @order -10
15781606
*/

packages/cubejs-client-core/dist/cubejs-client-core.umd.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15380,9 +15380,19 @@
1538015380
}
1538115381
})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : commonjsGlobal);
1538215382

15383+
/**
15384+
* Default transport implementation.
15385+
*/
15386+
1538315387
var HttpTransport =
1538415388
/*#__PURE__*/
1538515389
function () {
15390+
/**
15391+
* @param options - mandatory options object
15392+
* @param options.authorization - [jwt auth token](security)
15393+
* @param options.apiUrl - path to `/cubejs-api/v1`
15394+
* @param [options.headers] - object of custom headers
15395+
*/
1538615396
function HttpTransport(_ref) {
1538715397
var authorization = _ref.authorization,
1538815398
apiUrl = _ref.apiUrl,
@@ -15507,6 +15517,23 @@
1550715517
baseRequestId: v4_1()
1550815518
}, params));
1550915519
}
15520+
/**
15521+
* Base method used to perform all API calls.
15522+
* Shouldn't be used directly.
15523+
* @param request - function that invoked to perform actual request using `transport.request()` method.
15524+
* @param toResult - function that maps results of invocation to method return result
15525+
* @param [options] - options object
15526+
* @param options.mutexObj - object to use to store MUTEX
15527+
* @param [options.mutexKey='default'] - key to use to store current request MUTEX inside `mutexObj`.
15528+
* MUTEX object is used to reject orphaned queries results when new queries are sent.
15529+
* For example if two queries are sent with same `mutexKey` only last one will return results.
15530+
* @param options.subscribe - pass `true` to use continuous fetch behavior.
15531+
* @param {Function} options.progressCallback - function that receives `ProgressResult` on each
15532+
* `Continue wait` message.
15533+
* @param [callback] - if passed `callback` function will be called instead of `Promise` returned
15534+
* @return {{unsubscribe: function()}}
15535+
*/
15536+
1551015537
}, {
1551115538
key: "loadMethod",
1551215539
value: function loadMethod(request, toResult, options, callback) {
@@ -15922,8 +15949,8 @@
1592215949
* new Chart(context, chartjsConfig(resultSet));
1592315950
* ```
1592415951
* @param query - [Query object](query-format)
15925-
* @param options
15926-
* @param callback
15952+
* @param [options] - See {@link CubejsApi#loadMethod}
15953+
* @param [callback] - See {@link CubejsApi#loadMethod}
1592715954
* @returns {Promise} for {@link ResultSet} if `callback` isn't passed
1592815955
*/
1592915956

@@ -15945,8 +15972,8 @@
1594515972
/**
1594615973
* Get generated SQL string for given `query`.
1594715974
* @param query - [Query object](query-format)
15948-
* @param options
15949-
* @param callback
15975+
* @param [options] - See {@link CubejsApi#loadMethod}
15976+
* @param [callback] - See {@link CubejsApi#loadMethod}
1595015977
* @return {Promise} for {@link SqlQuery} if `callback` isn't passed
1595115978
*/
1595215979

@@ -15965,8 +15992,8 @@
1596515992
}
1596615993
/**
1596715994
* Get meta description of cubes available for querying.
15968-
* @param options
15969-
* @param callback
15995+
* @param [options] - See {@link CubejsApi#loadMethod}
15996+
* @param [callback] - See {@link CubejsApi#loadMethod}
1597015997
* @return {Promise} for {@link Meta} if `callback` isn't passed
1597115998
*/
1597215999

@@ -16015,12 +16042,13 @@
1601516042
);
1601616043
```
1601716044
* @name cubejs
16018-
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing.
16045+
* @param [apiToken] - [API token](security) is used to authorize requests and determine SQL database you're accessing.
1601916046
* In the development mode, Cube.js Backend will print the API token to the console on on startup.
16020-
* Can be an async function without arguments that returns API token. Optional.
16021-
* @param options - options object.
16047+
* Can be an async function without arguments that returns API token.
16048+
* @param [options] - options object.
1602216049
* @param options.apiUrl - URL of your Cube.js Backend.
1602316050
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`.
16051+
* @param options.transport - transport implementation to use. {@link HttpTransport} will be used by default.
1602416052
* @returns {CubejsApi}
1602516053
* @order -10
1602616054
*/

packages/cubejs-client-react/dist/cubejs-client-react.esm.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstruct
1111
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
1212
import _createClass from '@babel/runtime/helpers/createClass';
1313
import _inherits from '@babel/runtime/helpers/inherits';
14-
import React, { createContext, useState, useContext, useEffect } from 'react';
14+
import React, { createContext, useRef, useState, useContext, useEffect } from 'react';
1515
import { func, object, any, bool } from 'prop-types';
1616
import { equals, toPairs, fromPairs } from 'ramda';
1717
import _extends from '@babel/runtime/helpers/extends';
@@ -752,6 +752,16 @@ CubeProvider.propTypes = {
752752
children: any.isRequired
753753
};
754754

755+
function useDeepCompareMemoize(value) {
756+
var ref = useRef([]);
757+
758+
if (!equals(value, ref.current)) {
759+
ref.current = value;
760+
}
761+
762+
return ref.current;
763+
}
764+
755765
var useCubeQuery = (function (query) {
756766
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
757767

@@ -887,7 +897,7 @@ var useCubeQuery = (function (query) {
887897
subscribeRequest = null;
888898
}
889899
};
890-
}, [JSON.stringify(query), options.cubejsApi, context]);
900+
}, useDeepCompareMemoize([query, options, context]));
891901
return {
892902
isLoading: isLoading,
893903
resultSet: resultSet,

packages/cubejs-client-react/dist/cubejs-client-react.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,16 @@ CubeProvider.propTypes = {
759759
children: PropTypes.any.isRequired
760760
};
761761

762+
function useDeepCompareMemoize(value) {
763+
var ref = React.useRef([]);
764+
765+
if (!ramda.equals(value, ref.current)) {
766+
ref.current = value;
767+
}
768+
769+
return ref.current;
770+
}
771+
762772
var useCubeQuery = (function (query) {
763773
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
764774

@@ -894,7 +904,7 @@ var useCubeQuery = (function (query) {
894904
subscribeRequest = null;
895905
}
896906
};
897-
}, [JSON.stringify(query), options.cubejsApi, context]);
907+
}, useDeepCompareMemoize([query, options, context]));
898908
return {
899909
isLoading: isLoading,
900910
resultSet: resultSet,

packages/cubejs-client-react/dist/cubejs-client-react.umd.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8252,6 +8252,16 @@
82528252
children: PropTypes.any.isRequired
82538253
};
82548254

8255+
function useDeepCompareMemoize(value) {
8256+
var ref = React.useRef([]);
8257+
8258+
if (!equals(value, ref.current)) {
8259+
ref.current = value;
8260+
}
8261+
8262+
return ref.current;
8263+
}
8264+
82558265
var useCubeQuery = (function (query) {
82568266
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
82578267

@@ -8387,7 +8397,7 @@
83878397
subscribeRequest = null;
83888398
}
83898399
};
8390-
}, [JSON.stringify(query), options.cubejsApi, context]);
8400+
}, useDeepCompareMemoize([query, options, context]));
83918401
return {
83928402
isLoading: isLoading,
83938403
resultSet: resultSet,

0 commit comments

Comments
 (0)