@cubejs-client/core
Advanced tools
Comparing version 0.10.59 to 0.10.61
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.10.61](https://github.com/statsbotco/cubejs-client/compare/v0.10.60...v0.10.61) (2019-10-10) | ||
**Note:** Version bump only for package @cubejs-client/core | ||
## [0.10.59](https://github.com/statsbotco/cubejs-client/compare/v0.10.58...v0.10.59) (2019-10-08) | ||
@@ -8,0 +16,0 @@ |
@@ -60,2 +60,5 @@ import _regeneratorRuntime from '@babel/runtime/regenerator'; | ||
}; | ||
/** | ||
* Provides a convenient interface for data manipulation. | ||
*/ | ||
@@ -324,2 +327,27 @@ var ResultSet = | ||
} | ||
/** | ||
* Returns normalized query result data in the following format. | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.chartPivot() will return | ||
* [ | ||
* { "x":"2015-01-01T00:00:00", "Stories.count": 27120 }, | ||
* { "x":"2015-02-01T00:00:00", "Stories.count": 25861 }, | ||
* { "x": "2015-03-01T00:00:00", "Stories.count": 29661 }, | ||
* //... | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
*/ | ||
}, { | ||
@@ -348,2 +376,30 @@ key: "chartPivot", | ||
} | ||
/** | ||
* Returns normalized query result data prepared for visualization in the table format. | ||
* | ||
* For example | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.tablePivot() will return | ||
* [ | ||
* { "Stories.time": "2015-01-01T00:00:00", "Stories.count": 27120 }, | ||
* { "Stories.time": "2015-02-01T00:00:00", "Stories.count": 25861 }, | ||
* { "Stories.time": "2015-03-01T00:00:00", "Stories.count": 29661 }, | ||
* //... | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
* @returns {Array} of pivoted rows | ||
*/ | ||
}, { | ||
@@ -376,2 +432,29 @@ key: "tablePivot", | ||
} | ||
/** | ||
* Returns array of column definitions for `tablePivot`. | ||
* | ||
* For example | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.tableColumns() will return | ||
* [ | ||
* { key: "Stories.time", title: "Stories Time" }, | ||
* { key: "Stories.count", title: "Stories Count" }, | ||
* //... | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
* @returns {Array} of columns | ||
*/ | ||
}, { | ||
@@ -411,2 +494,25 @@ key: "tableColumns", | ||
} | ||
/** | ||
* Returns the array of series objects, containing `key` and `title` parameters. | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.seriesNames() will return | ||
* [ | ||
* { "key":"Stories.count", "title": "Stories Count" } | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
* @returns {Array} of series names | ||
*/ | ||
}, { | ||
@@ -646,3 +752,8 @@ key: "seriesNames", | ||
}; | ||
/** | ||
* Main class for accessing Cube.js API | ||
* @order -5 | ||
*/ | ||
var CubejsApi = | ||
@@ -773,2 +884,30 @@ /*#__PURE__*/ | ||
} | ||
/** | ||
* Fetch data for passed `query`. | ||
* | ||
* ```js | ||
* import cubejs from '@cubejs-client/core'; | ||
* import Chart from 'chart.js'; | ||
* import chartjsConfig from './toChartjsData'; | ||
* | ||
* const cubejsApi = cubejs('CUBEJS_TOKEN'); | ||
* | ||
* const resultSet = await cubejsApi.load({ | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* }); | ||
* | ||
* const context = document.getElementById('myChart'); | ||
* new Chart(context, chartjsConfig(resultSet)); | ||
* ``` | ||
* @param query - [Query object](query-format) | ||
* @param options | ||
* @param callback | ||
* @returns {Promise} for {@link ResultSet} if `callback` isn't passed | ||
*/ | ||
}, { | ||
@@ -785,2 +924,10 @@ key: "load", | ||
} | ||
/** | ||
* Get generated SQL string for given `query`. | ||
* @param query - [Query object](query-format) | ||
* @param options | ||
* @param callback | ||
* @return {Promise} for {@link SqlQuery} if `callback` isn't passed | ||
*/ | ||
}, { | ||
@@ -797,2 +944,9 @@ key: "sql", | ||
} | ||
/** | ||
* Get meta description of cubes available for querying. | ||
* @param options | ||
* @param callback | ||
* @return {Promise} for {@link Meta} if `callback` isn't passed | ||
*/ | ||
}, { | ||
@@ -813,3 +967,25 @@ key: "meta", | ||
}(); | ||
/** | ||
* Create instance of `CubejsApi`. | ||
* API entry point. | ||
* | ||
* ```javascript | ||
import cubejs from '@cubejs-client/core'; | ||
const cubejsApi = cubejs( | ||
'CUBEJS-API-TOKEN', | ||
{ apiUrl: 'http://localhost:4000/cubejs-api/v1' } | ||
); | ||
``` | ||
* @name cubejs | ||
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing. | ||
* In the development mode, Cube.js Backend will print the API token to the console on on startup. | ||
* @param options - options object. | ||
* @param options.apiUrl - URL of your Cube.js Backend. | ||
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`. | ||
* @returns {CubejsApi} | ||
* @order -10 | ||
*/ | ||
var index = (function (apiToken, options) { | ||
@@ -816,0 +992,0 @@ return new CubejsApi(apiToken, options); |
@@ -64,2 +64,5 @@ 'use strict'; | ||
}; | ||
/** | ||
* Provides a convenient interface for data manipulation. | ||
*/ | ||
@@ -328,2 +331,27 @@ var ResultSet = | ||
} | ||
/** | ||
* Returns normalized query result data in the following format. | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.chartPivot() will return | ||
* [ | ||
* { "x":"2015-01-01T00:00:00", "Stories.count": 27120 }, | ||
* { "x":"2015-02-01T00:00:00", "Stories.count": 25861 }, | ||
* { "x": "2015-03-01T00:00:00", "Stories.count": 29661 }, | ||
* //... | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
*/ | ||
}, { | ||
@@ -352,2 +380,30 @@ key: "chartPivot", | ||
} | ||
/** | ||
* Returns normalized query result data prepared for visualization in the table format. | ||
* | ||
* For example | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.tablePivot() will return | ||
* [ | ||
* { "Stories.time": "2015-01-01T00:00:00", "Stories.count": 27120 }, | ||
* { "Stories.time": "2015-02-01T00:00:00", "Stories.count": 25861 }, | ||
* { "Stories.time": "2015-03-01T00:00:00", "Stories.count": 29661 }, | ||
* //... | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
* @returns {Array} of pivoted rows | ||
*/ | ||
}, { | ||
@@ -380,2 +436,29 @@ key: "tablePivot", | ||
} | ||
/** | ||
* Returns array of column definitions for `tablePivot`. | ||
* | ||
* For example | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.tableColumns() will return | ||
* [ | ||
* { key: "Stories.time", title: "Stories Time" }, | ||
* { key: "Stories.count", title: "Stories Count" }, | ||
* //... | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
* @returns {Array} of columns | ||
*/ | ||
}, { | ||
@@ -415,2 +498,25 @@ key: "tableColumns", | ||
} | ||
/** | ||
* Returns the array of series objects, containing `key` and `title` parameters. | ||
* | ||
* ```js | ||
* // For query | ||
* { | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* } | ||
* | ||
* // ResultSet.seriesNames() will return | ||
* [ | ||
* { "key":"Stories.count", "title": "Stories Count" } | ||
* ] | ||
* ``` | ||
* @param pivotConfig | ||
* @returns {Array} of series names | ||
*/ | ||
}, { | ||
@@ -650,3 +756,8 @@ key: "seriesNames", | ||
}; | ||
/** | ||
* Main class for accessing Cube.js API | ||
* @order -5 | ||
*/ | ||
var CubejsApi = | ||
@@ -777,2 +888,30 @@ /*#__PURE__*/ | ||
} | ||
/** | ||
* Fetch data for passed `query`. | ||
* | ||
* ```js | ||
* import cubejs from '@cubejs-client/core'; | ||
* import Chart from 'chart.js'; | ||
* import chartjsConfig from './toChartjsData'; | ||
* | ||
* const cubejsApi = cubejs('CUBEJS_TOKEN'); | ||
* | ||
* const resultSet = await cubejsApi.load({ | ||
* measures: ['Stories.count'], | ||
* timeDimensions: [{ | ||
* dimension: 'Stories.time', | ||
* dateRange: ['2015-01-01', '2015-12-31'], | ||
* granularity: 'month' | ||
* }] | ||
* }); | ||
* | ||
* const context = document.getElementById('myChart'); | ||
* new Chart(context, chartjsConfig(resultSet)); | ||
* ``` | ||
* @param query - [Query object](query-format) | ||
* @param options | ||
* @param callback | ||
* @returns {Promise} for {@link ResultSet} if `callback` isn't passed | ||
*/ | ||
}, { | ||
@@ -789,2 +928,10 @@ key: "load", | ||
} | ||
/** | ||
* Get generated SQL string for given `query`. | ||
* @param query - [Query object](query-format) | ||
* @param options | ||
* @param callback | ||
* @return {Promise} for {@link SqlQuery} if `callback` isn't passed | ||
*/ | ||
}, { | ||
@@ -801,2 +948,9 @@ key: "sql", | ||
} | ||
/** | ||
* Get meta description of cubes available for querying. | ||
* @param options | ||
* @param callback | ||
* @return {Promise} for {@link Meta} if `callback` isn't passed | ||
*/ | ||
}, { | ||
@@ -817,3 +971,25 @@ key: "meta", | ||
}(); | ||
/** | ||
* Create instance of `CubejsApi`. | ||
* API entry point. | ||
* | ||
* ```javascript | ||
import cubejs from '@cubejs-client/core'; | ||
const cubejsApi = cubejs( | ||
'CUBEJS-API-TOKEN', | ||
{ apiUrl: 'http://localhost:4000/cubejs-api/v1' } | ||
); | ||
``` | ||
* @name cubejs | ||
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing. | ||
* In the development mode, Cube.js Backend will print the API token to the console on on startup. | ||
* @param options - options object. | ||
* @param options.apiUrl - URL of your Cube.js Backend. | ||
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`. | ||
* @returns {CubejsApi} | ||
* @order -10 | ||
*/ | ||
var index = (function (apiToken, options) { | ||
@@ -820,0 +996,0 @@ return new CubejsApi(apiToken, options); |
{ | ||
"name": "@cubejs-client/core", | ||
"version": "0.10.59", | ||
"version": "0.10.61", | ||
"description": "cube.js client", | ||
@@ -29,3 +29,3 @@ "main": "dist/cubejs-client-core.js", | ||
}, | ||
"gitHead": "31a826dedfa046b442e43bb9885e2bcfb00aaebe" | ||
"gitHead": "cc5aa4570e7bf9f920686e3574f657ec474bceaf" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
555024
15493