datajunction 0.0.1-rc.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +6 -2
- package/Makefile +3 -0
- package/babel.config.js +1 -0
- package/package.json +14 -5
- package/src/httpclient.js +49 -7
- package/src/index.js +91 -32
- package/src/index.test.js +80 -0
- package/dist/datajunction.js +0 -1
- package/dist/httpclient.js +0 -120
- package/dist/index.js +0 -334
package/.babelrc
CHANGED
package/Makefile
ADDED
package/babel.config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {presets: ['@babel/preset-env']}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datajunction",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A Javascript client for interacting with a DataJunction server",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
7
|
+
"test": "jest",
|
|
8
|
+
"test-watch": "jest --watch",
|
|
8
9
|
"build": "rm -rf dist/* && webpack && babel src -d dist",
|
|
9
10
|
"lint": "prettier \"src/**/*.{js,jsx}\"",
|
|
10
11
|
"format": "prettier --write \"src/**/*.{js,jsx}\""
|
|
@@ -26,16 +27,24 @@
|
|
|
26
27
|
},
|
|
27
28
|
"homepage": "https://github.com/DataJunction/dj#readme",
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"babel
|
|
30
|
-
"babel
|
|
31
|
-
"babel-
|
|
30
|
+
"@babel/cli": "^7.0.0",
|
|
31
|
+
"@babel/core": "^7.0.0",
|
|
32
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
|
|
33
|
+
"@babel/preset-env": "^7.0.0",
|
|
34
|
+
"babel-core": "^7.0.0-bridge.0",
|
|
35
|
+
"babel-jest": "^23.4.2",
|
|
32
36
|
"eslint": "^8.39.0",
|
|
33
37
|
"eslint-config-standard": "^17.0.0",
|
|
34
38
|
"eslint-plugin-import": "^2.27.5",
|
|
35
39
|
"eslint-plugin-n": "^15.7.0",
|
|
36
40
|
"eslint-plugin-promise": "^6.1.1",
|
|
41
|
+
"jest": "^29.5.0",
|
|
37
42
|
"prettier": "^2.8.8",
|
|
38
43
|
"webpack": "^5.81.0",
|
|
39
44
|
"webpack-cli": "^5.0.2"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@babel/core": "^7.22.5",
|
|
48
|
+
"docker-names": "^1.2.1"
|
|
40
49
|
}
|
|
41
50
|
}
|
package/src/httpclient.js
CHANGED
|
@@ -1,24 +1,66 @@
|
|
|
1
1
|
export default class HttpClient {
|
|
2
2
|
constructor(options = {}) {
|
|
3
|
-
this._baseURL = options.baseURL || ''
|
|
4
|
-
this._headers = options.headers || {}
|
|
3
|
+
this._baseURL = options.baseURL || '';
|
|
4
|
+
this._headers = options.headers || {};
|
|
5
|
+
this._cookie = '';
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
async _fetchJSON(endpoint, options = {}) {
|
|
8
9
|
const res = await fetch(this._baseURL + endpoint, {
|
|
9
10
|
...options,
|
|
10
|
-
headers:
|
|
11
|
-
|
|
11
|
+
headers: {
|
|
12
|
+
...this._headers,
|
|
13
|
+
'Cookie': this._cookie,
|
|
14
|
+
},
|
|
15
|
+
credentials: 'include',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const setCookieHeader = res.headers.get('Set-Cookie');
|
|
19
|
+
if (setCookieHeader) {
|
|
20
|
+
this._cookie = setCookieHeader;
|
|
21
|
+
this._headers['Cookie'] = this._cookie;
|
|
22
|
+
}
|
|
12
23
|
|
|
13
|
-
if (!res.ok)
|
|
24
|
+
if (!res.ok) {
|
|
25
|
+
const errorText = await res.text();
|
|
26
|
+
throw new Error(`Request failed: ${res.status} ${errorText}`);
|
|
27
|
+
}
|
|
14
28
|
|
|
15
29
|
if (options.parseResponse !== false && res.status !== 204) {
|
|
16
|
-
return res.json()
|
|
30
|
+
return res.json();
|
|
17
31
|
}
|
|
18
32
|
|
|
19
|
-
return undefined
|
|
33
|
+
return undefined;
|
|
20
34
|
}
|
|
21
35
|
|
|
36
|
+
async login(username, password) {
|
|
37
|
+
const body = new URLSearchParams({
|
|
38
|
+
grant_type: 'password',
|
|
39
|
+
username: username,
|
|
40
|
+
password: password,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const response = await fetch(this._baseURL + '/basic/login', {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
headers: {
|
|
46
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
47
|
+
...this._headers,
|
|
48
|
+
},
|
|
49
|
+
body: body.toString(),
|
|
50
|
+
credentials: 'include',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
const errorText = await response.text();
|
|
55
|
+
throw new Error(`Login failed: ${response.status} ${errorText}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const setCookieHeader = response.headers.get('Set-Cookie');
|
|
59
|
+
if (setCookieHeader) {
|
|
60
|
+
this._cookie = setCookieHeader;
|
|
61
|
+
this._headers['Cookie'] = this._cookie;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
22
64
|
setHeader(key, value) {
|
|
23
65
|
this._headers[key] = value
|
|
24
66
|
return this
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import HttpClient from './httpclient.js'
|
|
2
2
|
|
|
3
3
|
export class DJClient extends HttpClient {
|
|
4
|
-
constructor(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
constructor(
|
|
5
|
+
baseURL,
|
|
6
|
+
namespace,
|
|
7
|
+
engineName = null,
|
|
8
|
+
engineVersion = null,
|
|
9
|
+
httpAgent = null,
|
|
10
|
+
) {
|
|
11
|
+
super(
|
|
12
|
+
{
|
|
13
|
+
baseURL,
|
|
14
|
+
},
|
|
15
|
+
httpAgent
|
|
16
|
+
)
|
|
8
17
|
this.namespace = namespace
|
|
9
18
|
this.engineName = engineName
|
|
10
19
|
this.engineVersion = engineVersion
|
|
@@ -16,14 +25,24 @@ export class DJClient extends HttpClient {
|
|
|
16
25
|
}
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
get
|
|
28
|
+
get catalogs() {
|
|
20
29
|
return {
|
|
21
30
|
list: () => this.get('/catalogs/'),
|
|
22
31
|
get: (catalog) => this.get(`/catalogs/${catalog}/`),
|
|
23
|
-
create: (
|
|
32
|
+
create: (catalog) =>
|
|
24
33
|
this.setHeader('Content-Type', 'application/json').post(
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
`/catalogs/`,
|
|
35
|
+
catalog
|
|
36
|
+
),
|
|
37
|
+
addEngine: (catalog, engineName, engineVersion) =>
|
|
38
|
+
this.setHeader('Content-Type', 'application/json').post(
|
|
39
|
+
`/catalogs/${catalog}/engines/`,
|
|
40
|
+
[
|
|
41
|
+
{
|
|
42
|
+
name: engineName,
|
|
43
|
+
version: engineVersion,
|
|
44
|
+
},
|
|
45
|
+
]
|
|
27
46
|
),
|
|
28
47
|
}
|
|
29
48
|
}
|
|
@@ -33,11 +52,7 @@ export class DJClient extends HttpClient {
|
|
|
33
52
|
list: () => this.get('/engines/'),
|
|
34
53
|
get: (engineName, engineVersion) =>
|
|
35
54
|
this.get(`/engines/${engineName}/${engineVersion}/`),
|
|
36
|
-
create: (engine) =>
|
|
37
|
-
this.setHeader('Content-Type', 'application/json').post(
|
|
38
|
-
'/engines/',
|
|
39
|
-
engine
|
|
40
|
-
),
|
|
55
|
+
create: (engine) => this.post('/engines/', engine),
|
|
41
56
|
}
|
|
42
57
|
}
|
|
43
58
|
|
|
@@ -64,12 +79,11 @@ export class DJClient extends HttpClient {
|
|
|
64
79
|
|
|
65
80
|
get commonDimensions() {
|
|
66
81
|
return {
|
|
67
|
-
list: (metrics) =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
),
|
|
82
|
+
list: (metrics) => {
|
|
83
|
+
const metricsQuery =
|
|
84
|
+
'?' + metrics.map((m) => `metric=${m}`).join('&')
|
|
85
|
+
return this.get('/metrics/common/dimensions/' + metricsQuery)
|
|
86
|
+
},
|
|
73
87
|
}
|
|
74
88
|
}
|
|
75
89
|
|
|
@@ -90,6 +104,7 @@ export class DJClient extends HttpClient {
|
|
|
90
104
|
downstream: (nodeName) =>
|
|
91
105
|
this.get(`/nodes/${nodeName}/downstream/`),
|
|
92
106
|
upstream: (nodeName) => this.get(`/nodes/${nodeName}/upstream/`),
|
|
107
|
+
publish: (nodeName) => this.patch(`/nodes/${nodeName}/`, {'mode': 'published'})
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
110
|
|
|
@@ -223,15 +238,25 @@ export class DJClient extends HttpClient {
|
|
|
223
238
|
metrics,
|
|
224
239
|
dimensions,
|
|
225
240
|
filters,
|
|
226
|
-
async_ = false,
|
|
227
241
|
engineName = null,
|
|
228
242
|
engineVersion = null
|
|
229
|
-
) =>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
243
|
+
) => {
|
|
244
|
+
const metricsQuery =
|
|
245
|
+
'?' + metrics.map((m) => `metrics=${m}`).join('&')
|
|
246
|
+
const dimensionsQuery = dimensions
|
|
247
|
+
.map((d) => `dimensions=${d}`)
|
|
248
|
+
.join('&')
|
|
249
|
+
const filtersQuery = filters
|
|
250
|
+
.map((f) => `filters=${f}`)
|
|
251
|
+
.join('&')
|
|
252
|
+
const engineNameP = engineName ? `&engine=${engineName}` : ''
|
|
253
|
+
const engineVersionP = engineVersion
|
|
254
|
+
? `&engine_version=${engineVersion}`
|
|
255
|
+
: ''
|
|
256
|
+
return this.get(
|
|
257
|
+
`/sql/${metricsQuery}&${dimensionsQuery}${filtersQuery}${engineNameP}${engineVersionP}`
|
|
258
|
+
)
|
|
259
|
+
},
|
|
235
260
|
}
|
|
236
261
|
}
|
|
237
262
|
|
|
@@ -244,12 +269,46 @@ export class DJClient extends HttpClient {
|
|
|
244
269
|
async_ = false,
|
|
245
270
|
engineName = null,
|
|
246
271
|
engineVersion = null
|
|
247
|
-
) =>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
272
|
+
) => {
|
|
273
|
+
const metricsQuery =
|
|
274
|
+
'?' + metrics.map((m) => `metrics=${m}`).join('&')
|
|
275
|
+
const dimensionsQuery = dimensions
|
|
276
|
+
.map((d) => `dimensions=${d}`)
|
|
277
|
+
.join('&')
|
|
278
|
+
const filtersQuery = filters
|
|
279
|
+
.map((f) => `filters=${f}`)
|
|
280
|
+
.join('&')
|
|
281
|
+
const asyncP = async_ ? `&async_=${async_}` : ''
|
|
282
|
+
const engineNameP = engineName ? `&engine=${engineName}` : ''
|
|
283
|
+
const engineVersionP = engineVersion
|
|
284
|
+
? `&engine_version=${engineVersion}`
|
|
285
|
+
: ''
|
|
286
|
+
const data = this.get(
|
|
287
|
+
`/data/${metricsQuery}&${dimensionsQuery}${filtersQuery}${asyncP}${engineNameP}${engineVersionP}`
|
|
288
|
+
).then((data) => {
|
|
289
|
+
return {
|
|
290
|
+
columns: data.results[0].columns,
|
|
291
|
+
data: data.results[0].rows,
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
return data
|
|
295
|
+
},
|
|
253
296
|
}
|
|
254
297
|
}
|
|
298
|
+
|
|
299
|
+
get register() {
|
|
300
|
+
return {
|
|
301
|
+
table: (catalog, schema, table) =>
|
|
302
|
+
this.setHeader('Content-Type', 'application/json').post(
|
|
303
|
+
`/register/table/${catalog}/${schema}/${table}`
|
|
304
|
+
),
|
|
305
|
+
view: (catalog, schema, view, query, replace = false) => {
|
|
306
|
+
const replaceQuery = replace ? `?replace=${replace}` : '';
|
|
307
|
+
return this.setHeader('Content-Type', 'application/json').post(
|
|
308
|
+
`/register/view/${catalog}/${schema}/${view}${replaceQuery}`,
|
|
309
|
+
{ query }
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
255
314
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const { DJClient } = require('./index')
|
|
2
|
+
var dockerNames = require('docker-names')
|
|
3
|
+
|
|
4
|
+
test('should return something', async () => {
|
|
5
|
+
const dj = new DJClient('http://localhost:8000', 'integration.tests', 'dj', 'dj');
|
|
6
|
+
await dj.login("dj", "dj")
|
|
7
|
+
|
|
8
|
+
await dj.catalogs.create({ name: 'tpch' });
|
|
9
|
+
await dj.engines.create({ name: 'trino', version: '451' });
|
|
10
|
+
await dj.catalogs.addEngine('tpch', 'trino', '451');
|
|
11
|
+
|
|
12
|
+
await dj.namespaces.create('integration.tests');
|
|
13
|
+
await dj.namespaces.create('integration.tests.trino');
|
|
14
|
+
|
|
15
|
+
const source = await dj.sources.create({
|
|
16
|
+
name: 'integration.tests.source1',
|
|
17
|
+
catalog: 'unknown',
|
|
18
|
+
schema_: 'db',
|
|
19
|
+
table: 'tbl',
|
|
20
|
+
display_name: 'Test Source with Columns',
|
|
21
|
+
description: 'A test source node with columns',
|
|
22
|
+
columns: [
|
|
23
|
+
{ name: 'id', type: 'int' },
|
|
24
|
+
{ name: 'name', type: 'string' },
|
|
25
|
+
{ name: 'price', type: 'double' },
|
|
26
|
+
{ name: 'created_at', type: 'timestamp' },
|
|
27
|
+
],
|
|
28
|
+
primary_key: ['id'],
|
|
29
|
+
mode: 'published',
|
|
30
|
+
update_if_exists: true,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await dj.register.table('tpch', 'sf1', 'orders');
|
|
34
|
+
|
|
35
|
+
const transform = await dj.transforms.create({
|
|
36
|
+
name: 'integration.tests.trino.transform1',
|
|
37
|
+
display_name: 'Filter to last 1000 records',
|
|
38
|
+
description: 'The last 1000 purchases',
|
|
39
|
+
mode: 'published',
|
|
40
|
+
query: 'select custkey, totalprice, orderdate from source.tpch.sf1.orders order by orderdate desc limit 1000',
|
|
41
|
+
update_if_exists: true,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const dimension = await dj.dimensions.create({
|
|
45
|
+
name: 'integration.tests.trino.dimension1',
|
|
46
|
+
display_name: 'Customer keys',
|
|
47
|
+
description: 'All custkey values in the source table',
|
|
48
|
+
mode: 'published',
|
|
49
|
+
primary_key: ['id'],
|
|
50
|
+
tags: [],
|
|
51
|
+
query: "select custkey as id, 'attribute' as foo from source.tpch.sf1.orders",
|
|
52
|
+
update_if_exists: true,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
await dj.dimensions.link(
|
|
56
|
+
'integration.tests.trino.transform1',
|
|
57
|
+
'custkey',
|
|
58
|
+
'integration.tests.trino.dimension1',
|
|
59
|
+
'id',
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const metric = await dj.metrics.create({
|
|
63
|
+
name: 'integration.tests.trino.metric1',
|
|
64
|
+
display_name: 'Total of last 1000 purchases',
|
|
65
|
+
description: 'This is the total amount from the last 1000 purchases',
|
|
66
|
+
mode: 'published',
|
|
67
|
+
query: 'select sum(totalprice) from integration.tests.trino.transform1',
|
|
68
|
+
update_if_exists: true,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await dj.commonDimensions.list(['integration.tests.trino.metric1']);
|
|
72
|
+
|
|
73
|
+
const query = await dj.sql.get(
|
|
74
|
+
['integration.tests.trino.metric1'],
|
|
75
|
+
['integration.tests.trino.dimension1.id'],
|
|
76
|
+
[]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
expect(query.sql).toContain('SELECT');
|
|
80
|
+
}, 60000)
|
package/dist/datajunction.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.datajunction=t():e.datajunction=t()}(this,(()=>(()=>{"use strict";var e={d:(t,s)=>{for(var n in s)e.o(s,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DJClient:()=>n});class s{constructor(e={}){this._baseURL=e.baseURL||"",this._headers=e.headers||{}}async _fetchJSON(e,t={}){const s=await fetch(this._baseURL+e,{...t,headers:this._headers});if(!s.ok)throw new Error(s.statusText);if(!1!==t.parseResponse&&204!==s.status)return s.json()}setHeader(e,t){return this._headers[e]=t,this}getHeader(e){return this._headers[e]}setBasicAuth(e,t){return this._headers.Authorization=`Basic ${btoa(`${e}:${t}`)}`,this}setBearerAuth(e){return this._headers.Authorization=`Bearer ${e}`,this}async get(e,t={}){return this._fetchJSON(e,{...t,method:"GET"})}async post(e,t,s={}){return this._fetchJSON(e,{...s,body:t?JSON.stringify(t):void 0,method:"POST"})}async put(e,t,s={}){return this._fetchJSON(e,{...s,body:t?JSON.stringify(t):void 0,method:"PUT"})}async patch(e,t,s={}){return this._fetchJSON(e,{parseResponse:!1,...s,body:JSON.stringify(t),method:"PATCH"})}async delete(e,t={}){return this._fetchJSON(e,{parseResponse:!1,...t,method:"DELETE"})}}class n extends s{constructor(e,t,s=null,n=null){super({baseURL:e}),this.namespace=t,this.engineName=s,this.engineVersion=n}get healthcheck(){return{get:()=>this.get("/health/")}}get catalog(){return{list:()=>this.get("/catalogs/"),get:e=>this.get(`/catalogs/${e}/`),create:e=>this.setHeader("Content-Type","application/json").post("/catalogs/",e)}}get engines(){return{list:()=>this.get("/engines/"),get:(e,t)=>this.get(`/engines/${e}/${t}/`),create:e=>this.setHeader("Content-Type","application/json").post("/engines/",e)}}get addEngineToCatalog(){return{set:(e,t)=>this.setHeader("Content-Type","application/json").post(`/catalogs/${e}/engines/`,[t])}}get namespaces(){return{list:()=>this.get("/namespaces/"),nodes:e=>this.get(`/namespaces/${e}/`),create:e=>this.setHeader("Content-Type","application/json").post(`/namespaces/${e}/`)}}get commonDimensions(){return{list:e=>this.get(`/metrics/common/dimensions/?metric=${encodeURIComponent(JSON.stringify(e))}`)}}get nodes(){return{get:e=>this.get(`/nodes/${e}/`),validate:e=>this.setHeader("Content-Type","application/json").post("/nodes/validate/",e),update:(e,t)=>this.setHeader("Content-Type","application/json").patch(`/nodes/${e}/`,t),revisions:e=>this.get(`/nodes/${e}/revisions/`),downstream:e=>this.get(`/nodes/${e}/downstream/`),upstream:e=>this.get(`/nodes/${e}/upstream/`)}}get sources(){return{create:e=>this.setHeader("Content-Type","application/json").post("/nodes/source/",e),list:()=>this.get(`/namespaces/${this.namespace}/?type_=source`)}}get transforms(){return{create:e=>this.setHeader("Content-Type","application/json").post("/nodes/transform/",e),list:()=>this.get(`/namespaces/${this.namespace}/?type_=transform`)}}get dimensions(){return{create:e=>this.setHeader("Content-Type","application/json").post("/nodes/dimension/",e),list:()=>this.get(`/namespaces/${this.namespace}/?type_=dimension`),link:(e,t,s,n)=>this.post(`/nodes/${e}/columns/${t}/?dimension=${s}&dimension_column=${n}`)}}get metrics(){return{get:e=>this.get(`/metrics/${e}/`),create:e=>this.setHeader("Content-Type","application/json").post("/nodes/metric/",e),list:()=>this.get(`/namespaces/${this.namespace}/?type_=metric`),all:()=>this.get("/metrics/")}}get cubes(){return{get:e=>this.get(`/cubes/${e}/`),create:e=>this.setHeader("Content-Type","application/json").post("/nodes/cube/",e)}}get tags(){return{list:()=>this.get("/tags/"),get:e=>this.get(`/tags/${e}/`),create:e=>this.setHeader("Content-Type","application/json").post("/tags/",e),update:(e,t)=>this.setHeader("Content-Type","application/json").patch(`/tags/${e}/`,t),set:(e,t)=>this.post(`/nodes/${e}/tag/?tag_name=${t}`),listNodes:e=>this.get(`/tags/${e}/nodes/`)}}get attributes(){return{list:()=>this.get("/attributes/"),create:e=>this.setHeader("Content-Type","application/json").post("/attributes/",e)}}get materializationConfigs(){return{update:(e,t)=>this.setHeader("Content-Type","application/json").post(`/nodes/${e}/materialization/`,t)}}get columnAttributes(){return{set:(e,t)=>this.setHeader("Content-Type","application/json").post(`/nodes/${e}/attributes/`,[t])}}get availabilityState(){return{set:(e,t)=>this.setHeader("Content-Type","application/json").post(`/data/${e}/availability/`,t)}}get sql(){return{get:(e,t,s,n=!1,i=null,a=null)=>this.get(`/sql/?metrics=${e}&dimensions=${t}&filters=${s}&async_=${n}&engine_name=${i||this.engineName}&engine_version=${a||this.engineVersion}`)}}get data(){return{get:(e,t,s,n=!1,i=null,a=null)=>this.get(`/data/?metrics=${e}&dimensions=${t}&filters=${s}&async_=${n}&engine_name=${i||this.engineName}&engine_version=${a||this.engineVersion}`)}}}return t})()));
|
package/dist/httpclient.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
|
-
|
|
9
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
-
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
|
|
13
|
-
var HttpClient = function () {
|
|
14
|
-
function HttpClient() {
|
|
15
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
-
|
|
17
|
-
_classCallCheck(this, HttpClient);
|
|
18
|
-
|
|
19
|
-
this._baseURL = options.baseURL || '';
|
|
20
|
-
this._headers = options.headers || {};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_createClass(HttpClient, [{
|
|
24
|
-
key: '_fetchJSON',
|
|
25
|
-
value: async function _fetchJSON(endpoint) {
|
|
26
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
-
|
|
28
|
-
var res = await fetch(this._baseURL + endpoint, _extends({}, options, {
|
|
29
|
-
headers: this._headers
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
if (!res.ok) throw new Error(res.statusText);
|
|
33
|
-
|
|
34
|
-
if (options.parseResponse !== false && res.status !== 204) {
|
|
35
|
-
return res.json();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
|
-
key: 'setHeader',
|
|
42
|
-
value: function setHeader(key, value) {
|
|
43
|
-
this._headers[key] = value;
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: 'getHeader',
|
|
48
|
-
value: function getHeader(key) {
|
|
49
|
-
return this._headers[key];
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: 'setBasicAuth',
|
|
53
|
-
value: function setBasicAuth(username, password) {
|
|
54
|
-
this._headers.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
key: 'setBearerAuth',
|
|
59
|
-
value: function setBearerAuth(token) {
|
|
60
|
-
this._headers.Authorization = 'Bearer ' + token;
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: 'get',
|
|
65
|
-
value: async function get(endpoint) {
|
|
66
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
67
|
-
|
|
68
|
-
return this._fetchJSON(endpoint, _extends({}, options, {
|
|
69
|
-
method: 'GET'
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: 'post',
|
|
74
|
-
value: async function post(endpoint, body) {
|
|
75
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
76
|
-
|
|
77
|
-
return this._fetchJSON(endpoint, _extends({}, options, {
|
|
78
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
79
|
-
method: 'POST'
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: 'put',
|
|
84
|
-
value: async function put(endpoint, body) {
|
|
85
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
86
|
-
|
|
87
|
-
return this._fetchJSON(endpoint, _extends({}, options, {
|
|
88
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
89
|
-
method: 'PUT'
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
}, {
|
|
93
|
-
key: 'patch',
|
|
94
|
-
value: async function patch(endpoint, operations) {
|
|
95
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
96
|
-
|
|
97
|
-
return this._fetchJSON(endpoint, _extends({
|
|
98
|
-
parseResponse: false
|
|
99
|
-
}, options, {
|
|
100
|
-
body: JSON.stringify(operations),
|
|
101
|
-
method: 'PATCH'
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: 'delete',
|
|
106
|
-
value: async function _delete(endpoint) {
|
|
107
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
108
|
-
|
|
109
|
-
return this._fetchJSON(endpoint, _extends({
|
|
110
|
-
parseResponse: false
|
|
111
|
-
}, options, {
|
|
112
|
-
method: 'DELETE'
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
}]);
|
|
116
|
-
|
|
117
|
-
return HttpClient;
|
|
118
|
-
}();
|
|
119
|
-
|
|
120
|
-
exports.default = HttpClient;
|
package/dist/index.js
DELETED
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DJClient = undefined;
|
|
7
|
-
|
|
8
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
9
|
-
|
|
10
|
-
var _httpclient = require('./httpclient.js');
|
|
11
|
-
|
|
12
|
-
var _httpclient2 = _interopRequireDefault(_httpclient);
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
|
|
18
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
19
|
-
|
|
20
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
21
|
-
|
|
22
|
-
var DJClient = exports.DJClient = function (_HttpClient) {
|
|
23
|
-
_inherits(DJClient, _HttpClient);
|
|
24
|
-
|
|
25
|
-
function DJClient(baseURL, namespace) {
|
|
26
|
-
var engineName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
27
|
-
var engineVersion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
28
|
-
|
|
29
|
-
_classCallCheck(this, DJClient);
|
|
30
|
-
|
|
31
|
-
var _this = _possibleConstructorReturn(this, (DJClient.__proto__ || Object.getPrototypeOf(DJClient)).call(this, {
|
|
32
|
-
baseURL: baseURL
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
_this.namespace = namespace;
|
|
36
|
-
_this.engineName = engineName;
|
|
37
|
-
_this.engineVersion = engineVersion;
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
_createClass(DJClient, [{
|
|
42
|
-
key: 'healthcheck',
|
|
43
|
-
get: function get() {
|
|
44
|
-
var _this2 = this;
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
get: function get() {
|
|
48
|
-
return _this2.get('/health/');
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: 'catalog',
|
|
54
|
-
get: function get() {
|
|
55
|
-
var _this3 = this;
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
list: function list() {
|
|
59
|
-
return _this3.get('/catalogs/');
|
|
60
|
-
},
|
|
61
|
-
get: function get(catalog) {
|
|
62
|
-
return _this3.get('/catalogs/' + catalog + '/');
|
|
63
|
-
},
|
|
64
|
-
create: function create(engine) {
|
|
65
|
-
return _this3.setHeader('Content-Type', 'application/json').post('/catalogs/', engine);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: 'engines',
|
|
71
|
-
get: function get() {
|
|
72
|
-
var _this4 = this;
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
list: function list() {
|
|
76
|
-
return _this4.get('/engines/');
|
|
77
|
-
},
|
|
78
|
-
get: function get(engineName, engineVersion) {
|
|
79
|
-
return _this4.get('/engines/' + engineName + '/' + engineVersion + '/');
|
|
80
|
-
},
|
|
81
|
-
create: function create(engine) {
|
|
82
|
-
return _this4.setHeader('Content-Type', 'application/json').post('/engines/', engine);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: 'addEngineToCatalog',
|
|
88
|
-
get: function get() {
|
|
89
|
-
var _this5 = this;
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
set: function set(catalogName, engine) {
|
|
93
|
-
return _this5.setHeader('Content-Type', 'application/json').post('/catalogs/' + catalogName + '/engines/', [engine]);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: 'namespaces',
|
|
99
|
-
get: function get() {
|
|
100
|
-
var _this6 = this;
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
list: function list() {
|
|
104
|
-
return _this6.get('/namespaces/');
|
|
105
|
-
},
|
|
106
|
-
nodes: function nodes(namespace) {
|
|
107
|
-
return _this6.get('/namespaces/' + namespace + '/');
|
|
108
|
-
},
|
|
109
|
-
create: function create(namespace) {
|
|
110
|
-
return _this6.setHeader('Content-Type', 'application/json').post('/namespaces/' + namespace + '/');
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: 'commonDimensions',
|
|
116
|
-
get: function get() {
|
|
117
|
-
var _this7 = this;
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
list: function list(metrics) {
|
|
121
|
-
return _this7.get('/metrics/common/dimensions/?metric=' + encodeURIComponent(JSON.stringify(metrics)));
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
key: 'nodes',
|
|
127
|
-
get: function get() {
|
|
128
|
-
var _this8 = this;
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
get: function get(nodeName) {
|
|
132
|
-
return _this8.get('/nodes/' + nodeName + '/');
|
|
133
|
-
},
|
|
134
|
-
validate: function validate(nodeDetails) {
|
|
135
|
-
return _this8.setHeader('Content-Type', 'application/json').post('/nodes/validate/', nodeDetails);
|
|
136
|
-
},
|
|
137
|
-
update: function update(nodeName, nodeDetails) {
|
|
138
|
-
return _this8.setHeader('Content-Type', 'application/json').patch('/nodes/' + nodeName + '/', nodeDetails);
|
|
139
|
-
},
|
|
140
|
-
revisions: function revisions(nodeName) {
|
|
141
|
-
return _this8.get('/nodes/' + nodeName + '/revisions/');
|
|
142
|
-
},
|
|
143
|
-
downstream: function downstream(nodeName) {
|
|
144
|
-
return _this8.get('/nodes/' + nodeName + '/downstream/');
|
|
145
|
-
},
|
|
146
|
-
upstream: function upstream(nodeName) {
|
|
147
|
-
return _this8.get('/nodes/' + nodeName + '/upstream/');
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
key: 'sources',
|
|
153
|
-
get: function get() {
|
|
154
|
-
var _this9 = this;
|
|
155
|
-
|
|
156
|
-
return {
|
|
157
|
-
create: function create(sourceDetails) {
|
|
158
|
-
return _this9.setHeader('Content-Type', 'application/json').post('/nodes/source/', sourceDetails);
|
|
159
|
-
},
|
|
160
|
-
list: function list() {
|
|
161
|
-
return _this9.get('/namespaces/' + _this9.namespace + '/?type_=source');
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: 'transforms',
|
|
167
|
-
get: function get() {
|
|
168
|
-
var _this10 = this;
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
create: function create(transformDetails) {
|
|
172
|
-
return _this10.setHeader('Content-Type', 'application/json').post('/nodes/transform/', transformDetails);
|
|
173
|
-
},
|
|
174
|
-
list: function list() {
|
|
175
|
-
return _this10.get('/namespaces/' + _this10.namespace + '/?type_=transform');
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}, {
|
|
180
|
-
key: 'dimensions',
|
|
181
|
-
get: function get() {
|
|
182
|
-
var _this11 = this;
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
create: function create(dimensionDetails) {
|
|
186
|
-
return _this11.setHeader('Content-Type', 'application/json').post('/nodes/dimension/', dimensionDetails);
|
|
187
|
-
},
|
|
188
|
-
list: function list() {
|
|
189
|
-
return _this11.get('/namespaces/' + _this11.namespace + '/?type_=dimension');
|
|
190
|
-
},
|
|
191
|
-
link: function link(nodeName, nodeColumn, dimension, dimensionColumn) {
|
|
192
|
-
return _this11.post('/nodes/' + nodeName + '/columns/' + nodeColumn + '/?dimension=' + dimension + '&dimension_column=' + dimensionColumn);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
key: 'metrics',
|
|
198
|
-
get: function get() {
|
|
199
|
-
var _this12 = this;
|
|
200
|
-
|
|
201
|
-
return {
|
|
202
|
-
get: function get(metricName) {
|
|
203
|
-
return _this12.get('/metrics/' + metricName + '/');
|
|
204
|
-
},
|
|
205
|
-
create: function create(metricDetails) {
|
|
206
|
-
return _this12.setHeader('Content-Type', 'application/json').post('/nodes/metric/', metricDetails);
|
|
207
|
-
},
|
|
208
|
-
list: function list() {
|
|
209
|
-
return _this12.get('/namespaces/' + _this12.namespace + '/?type_=metric');
|
|
210
|
-
},
|
|
211
|
-
all: function all() {
|
|
212
|
-
return _this12.get('/metrics/');
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}, {
|
|
217
|
-
key: 'cubes',
|
|
218
|
-
get: function get() {
|
|
219
|
-
var _this13 = this;
|
|
220
|
-
|
|
221
|
-
return {
|
|
222
|
-
get: function get(cubeName) {
|
|
223
|
-
return _this13.get('/cubes/' + cubeName + '/');
|
|
224
|
-
},
|
|
225
|
-
create: function create(cubeDetails) {
|
|
226
|
-
return _this13.setHeader('Content-Type', 'application/json').post('/nodes/cube/', cubeDetails);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
key: 'tags',
|
|
232
|
-
get: function get() {
|
|
233
|
-
var _this14 = this;
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
list: function list() {
|
|
237
|
-
return _this14.get('/tags/');
|
|
238
|
-
},
|
|
239
|
-
get: function get(tagName) {
|
|
240
|
-
return _this14.get('/tags/' + tagName + '/');
|
|
241
|
-
},
|
|
242
|
-
create: function create(tagData) {
|
|
243
|
-
return _this14.setHeader('Content-Type', 'application/json').post('/tags/', tagData);
|
|
244
|
-
},
|
|
245
|
-
update: function update(tagName, tagData) {
|
|
246
|
-
return _this14.setHeader('Content-Type', 'application/json').patch('/tags/' + tagName + '/', tagData);
|
|
247
|
-
},
|
|
248
|
-
set: function set(nodeName, tagName) {
|
|
249
|
-
return _this14.post('/nodes/' + nodeName + '/tag/?tag_name=' + tagName);
|
|
250
|
-
},
|
|
251
|
-
listNodes: function listNodes(tagName) {
|
|
252
|
-
return _this14.get('/tags/' + tagName + '/nodes/');
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}, {
|
|
257
|
-
key: 'attributes',
|
|
258
|
-
get: function get() {
|
|
259
|
-
var _this15 = this;
|
|
260
|
-
|
|
261
|
-
return {
|
|
262
|
-
list: function list() {
|
|
263
|
-
return _this15.get('/attributes/');
|
|
264
|
-
},
|
|
265
|
-
create: function create(attributeData) {
|
|
266
|
-
return _this15.setHeader('Content-Type', 'application/json').post('/attributes/', attributeData);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
}, {
|
|
271
|
-
key: 'materializationConfigs',
|
|
272
|
-
get: function get() {
|
|
273
|
-
var _this16 = this;
|
|
274
|
-
|
|
275
|
-
return {
|
|
276
|
-
update: function update(nodeName, materializationDetails) {
|
|
277
|
-
return _this16.setHeader('Content-Type', 'application/json').post('/nodes/' + nodeName + '/materialization/', materializationDetails);
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
}, {
|
|
282
|
-
key: 'columnAttributes',
|
|
283
|
-
get: function get() {
|
|
284
|
-
var _this17 = this;
|
|
285
|
-
|
|
286
|
-
return {
|
|
287
|
-
set: function set(nodeName, columnAttribute) {
|
|
288
|
-
return _this17.setHeader('Content-Type', 'application/json').post('/nodes/' + nodeName + '/attributes/', [columnAttribute]);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
}, {
|
|
293
|
-
key: 'availabilityState',
|
|
294
|
-
get: function get() {
|
|
295
|
-
var _this18 = this;
|
|
296
|
-
|
|
297
|
-
return {
|
|
298
|
-
set: function set(nodeName, availabilityState) {
|
|
299
|
-
return _this18.setHeader('Content-Type', 'application/json').post('/data/' + nodeName + '/availability/', availabilityState);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
}, {
|
|
304
|
-
key: 'sql',
|
|
305
|
-
get: function get() {
|
|
306
|
-
var _this19 = this;
|
|
307
|
-
|
|
308
|
-
return {
|
|
309
|
-
get: function get(metrics, dimensions, filters) {
|
|
310
|
-
var async_ = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
311
|
-
var engineName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
312
|
-
var engineVersion = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
313
|
-
return _this19.get('/sql/?metrics=' + metrics + '&dimensions=' + dimensions + '&filters=' + filters + '&async_=' + async_ + '&engine_name=' + (engineName || _this19.engineName) + '&engine_version=' + (engineVersion || _this19.engineVersion));
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
}, {
|
|
318
|
-
key: 'data',
|
|
319
|
-
get: function get() {
|
|
320
|
-
var _this20 = this;
|
|
321
|
-
|
|
322
|
-
return {
|
|
323
|
-
get: function get(metrics, dimensions, filters) {
|
|
324
|
-
var async_ = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
325
|
-
var engineName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
326
|
-
var engineVersion = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
327
|
-
return _this20.get('/data/?metrics=' + metrics + '&dimensions=' + dimensions + '&filters=' + filters + '&async_=' + async_ + '&engine_name=' + (engineName || _this20.engineName) + '&engine_version=' + (engineVersion || _this20.engineVersion));
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
}]);
|
|
332
|
-
|
|
333
|
-
return DJClient;
|
|
334
|
-
}(_httpclient2.default);
|