@cubejs-backend/api-gateway 1.0.11 → 1.0.13
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/dist/src/{CubejsHandlerError.d.ts → cubejs-handler-error.d.ts} +1 -1
- package/dist/src/cubejs-handler-error.d.ts.map +1 -0
- package/dist/src/{CubejsHandlerError.js → cubejs-handler-error.js} +1 -1
- package/dist/src/cubejs-handler-error.js.map +1 -0
- package/dist/src/{dateParser.d.ts → date-parser.d.ts} +1 -1
- package/dist/src/date-parser.d.ts.map +1 -0
- package/dist/src/{dateParser.js → date-parser.js} +5 -5
- package/dist/src/date-parser.js.map +1 -0
- package/dist/src/gateway.d.ts +3 -2
- package/dist/src/gateway.d.ts.map +1 -1
- package/dist/src/gateway.js +42 -40
- package/dist/src/gateway.js.map +1 -1
- package/dist/src/helpers/{prepareAnnotation.d.ts → prepare-annotation.d.ts} +2 -2
- package/dist/src/helpers/prepare-annotation.d.ts.map +1 -0
- package/dist/src/helpers/{prepareAnnotation.js → prepare-annotation.js} +3 -3
- package/dist/src/helpers/prepare-annotation.js.map +1 -0
- package/dist/src/helpers/{toConfigMap.d.ts → to-config-map.d.ts} +1 -1
- package/dist/src/helpers/to-config-map.d.ts.map +1 -0
- package/dist/src/helpers/{toConfigMap.js → to-config-map.js} +1 -1
- package/dist/src/helpers/to-config-map.js.map +1 -0
- package/dist/src/helpers/{transformMetaExtended.d.ts → transform-meta-extended.d.ts} +1 -1
- package/dist/src/helpers/transform-meta-extended.d.ts.map +1 -0
- package/dist/src/helpers/{transformMetaExtended.js → transform-meta-extended.js} +1 -1
- package/dist/src/helpers/transform-meta-extended.js.map +1 -0
- package/dist/src/helpers/transformData.d.ts +1 -1
- package/dist/src/helpers/transformData.d.ts.map +1 -1
- package/dist/src/helpers/transformData.js +11 -11
- package/dist/src/helpers/transformData.js.map +1 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/query.d.ts.map +1 -1
- package/dist/src/query.js +13 -12
- package/dist/src/query.js.map +1 -1
- package/dist/src/{requestParser.d.ts → request-parser.d.ts} +1 -1
- package/dist/src/request-parser.d.ts.map +1 -0
- package/dist/src/{requestParser.js → request-parser.js} +1 -1
- package/dist/src/request-parser.js.map +1 -0
- package/dist/src/types/responses.d.ts +1 -0
- package/dist/src/types/responses.d.ts.map +1 -0
- package/dist/src/types/responses.js +2 -0
- package/dist/src/types/responses.js.map +1 -0
- package/dist/src/user-error.d.ts +5 -0
- package/dist/src/user-error.d.ts.map +1 -0
- package/dist/src/{UserError.js → user-error.js} +3 -3
- package/dist/src/user-error.js.map +1 -0
- package/dist/src/ws/index.d.ts +4 -0
- package/dist/src/ws/index.d.ts.map +1 -0
- package/dist/src/ws/index.js +20 -0
- package/dist/src/ws/index.js.map +1 -0
- package/dist/src/ws/local-subscription-store.d.ts +30 -0
- package/dist/src/ws/local-subscription-store.d.ts.map +1 -0
- package/dist/src/ws/local-subscription-store.js +64 -0
- package/dist/src/ws/local-subscription-store.js.map +1 -0
- package/dist/src/ws/message-schema.d.ts +53 -0
- package/dist/src/ws/message-schema.d.ts.map +1 -0
- package/dist/src/ws/message-schema.js +59 -0
- package/dist/src/ws/message-schema.js.map +1 -0
- package/dist/src/ws/subscription-server.d.ts +25 -0
- package/dist/src/ws/subscription-server.d.ts.map +1 -0
- package/dist/src/ws/subscription-server.js +190 -0
- package/dist/src/ws/subscription-server.js.map +1 -0
- package/package.json +7 -6
- package/dist/src/CubejsHandlerError.d.ts.map +0 -1
- package/dist/src/CubejsHandlerError.js.map +0 -1
- package/dist/src/LocalSubscriptionStore.d.ts +0 -19
- package/dist/src/LocalSubscriptionStore.d.ts.map +0 -1
- package/dist/src/LocalSubscriptionStore.js +0 -57
- package/dist/src/LocalSubscriptionStore.js.map +0 -1
- package/dist/src/SubscriptionServer.d.ts +0 -19
- package/dist/src/SubscriptionServer.d.ts.map +0 -1
- package/dist/src/SubscriptionServer.js +0 -136
- package/dist/src/SubscriptionServer.js.map +0 -1
- package/dist/src/UserError.d.ts +0 -5
- package/dist/src/UserError.d.ts.map +0 -1
- package/dist/src/UserError.js.map +0 -1
- package/dist/src/dateParser.d.ts.map +0 -1
- package/dist/src/dateParser.js.map +0 -1
- package/dist/src/helpers/prepareAnnotation.d.ts.map +0 -1
- package/dist/src/helpers/prepareAnnotation.js.map +0 -1
- package/dist/src/helpers/toConfigMap.d.ts.map +0 -1
- package/dist/src/helpers/toConfigMap.js.map +0 -1
- package/dist/src/helpers/transformMetaExtended.d.ts.map +0 -1
- package/dist/src/helpers/transformMetaExtended.js.map +0 -1
- package/dist/src/requestParser.d.ts.map +0 -1
- package/dist/src/requestParser.js.map +0 -1
|
@@ -4,4 +4,4 @@ export declare class CubejsHandlerError extends Error {
|
|
|
4
4
|
readonly originalError?: Error | undefined;
|
|
5
5
|
constructor(status: number, type: string, message: string, originalError?: Error | undefined);
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=cubejs-handler-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cubejs-handler-error.d.ts","sourceRoot":"","sources":["../../src/cubejs-handler-error.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;aAEzB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;aAEZ,aAAa,CAAC;gBAHd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACC,aAAa,CAAC,mBAAO;CAIxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cubejs-handler-error.js","sourceRoot":"","sources":["../../src/cubejs-handler-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAmB,SAAQ,KAAK;IAEzB;IACA;IAEA;IAJlB,YACkB,MAAc,EACd,IAAY,EAC5B,OAAe,EACC,aAAqB;QAErC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QALP,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,kBAAa,GAAb,aAAa,CAAQ;IAGvC,CAAC;CACF;AATD,gDASC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export function dateParser(dateString: any, timezone: any, now?: Date): string[];
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=date-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-parser.d.ts","sourceRoot":"","sources":["../../src/date-parser.js"],"names":[],"mappings":"AAmBA,iFAwFC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.dateParser = void 0;
|
|
7
7
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
8
8
|
const chrono_node_1 = require("chrono-node");
|
|
9
|
-
const
|
|
9
|
+
const user_error_1 = require("./user-error");
|
|
10
10
|
const momentFromResult = (result, timezone) => {
|
|
11
11
|
const dateMoment = (0, moment_timezone_1.default)().tz(timezone);
|
|
12
12
|
dateMoment.set('year', result.get('year'));
|
|
@@ -73,10 +73,10 @@ function dateParser(dateString, timezone, now = new Date()) {
|
|
|
73
73
|
const fromResults = (0, chrono_node_1.parse)(from, new Date(current.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS)));
|
|
74
74
|
const toResults = (0, chrono_node_1.parse)(to, new Date(current.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS)));
|
|
75
75
|
if (!Array.isArray(fromResults) || !fromResults.length) {
|
|
76
|
-
throw new
|
|
76
|
+
throw new user_error_1.UserError(`Can't parse date: '${from}'`);
|
|
77
77
|
}
|
|
78
78
|
if (!Array.isArray(fromResults) || !fromResults.length) {
|
|
79
|
-
throw new
|
|
79
|
+
throw new user_error_1.UserError(`Can't parse date: '${to}'`);
|
|
80
80
|
}
|
|
81
81
|
const exactGranularity = ['second', 'minute', 'hour'].find(g => dateString.indexOf(g) !== -1) || 'day';
|
|
82
82
|
momentRange = [
|
|
@@ -88,7 +88,7 @@ function dateParser(dateString, timezone, now = new Date()) {
|
|
|
88
88
|
else {
|
|
89
89
|
const results = (0, chrono_node_1.parse)(dateString, new Date((0, moment_timezone_1.default)().tz(timezone).format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS)));
|
|
90
90
|
if (!results || !results.length) {
|
|
91
|
-
throw new
|
|
91
|
+
throw new user_error_1.UserError(`Can't parse date: '${dateString}'`);
|
|
92
92
|
}
|
|
93
93
|
const exactGranularity = ['second', 'minute', 'hour'].find(g => dateString.indexOf(g) !== -1) || 'day';
|
|
94
94
|
momentRange = results[0].end ? [
|
|
@@ -103,4 +103,4 @@ function dateParser(dateString, timezone, now = new Date()) {
|
|
|
103
103
|
return momentRange.map(d => d.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS));
|
|
104
104
|
}
|
|
105
105
|
exports.dateParser = dateParser;
|
|
106
|
-
//# sourceMappingURL=
|
|
106
|
+
//# sourceMappingURL=date-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-parser.js","sourceRoot":"","sources":["../../src/date-parser.js"],"names":[],"mappings":";;;;;;AAAA,sEAAqC;AACrC,6CAAoC;AAEpC,6CAAyC;AAEzC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;IAC5C,MAAM,UAAU,GAAG,IAAA,yBAAM,GAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEzC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CA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BAAgB,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;KAClG;IAED,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAC5E,CAAC;AAxFD,gCAwFC"}
|
package/dist/src/gateway.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { CheckAuthInternalOptions, JWTOptions, CheckAuthFn, ContextToApiScopesFn
|
|
|
7
7
|
import { Query, NormalizedQuery } from './types/query';
|
|
8
8
|
import { UserBackgroundContext, ApiGatewayOptions } from './types/gateway';
|
|
9
9
|
import { RequestLoggerMiddlewareFn, ContextRejectionMiddlewareFn, ContextAcceptorFn } from './interfaces';
|
|
10
|
-
import { SubscriptionServer, WebSocketSendMessageFn } from './
|
|
10
|
+
import { SubscriptionServer, WebSocketSendMessageFn } from './ws/subscription-server';
|
|
11
11
|
import { SQLServer, SQLServerConstructorOptions } from './sql-server';
|
|
12
12
|
type HandleErrorOptions = {
|
|
13
13
|
e: any;
|
|
@@ -62,8 +62,9 @@ declare class ApiGateway {
|
|
|
62
62
|
context: ExtendedRequestContext;
|
|
63
63
|
res: ResponseResultFn;
|
|
64
64
|
}): Promise<void>;
|
|
65
|
-
getPreAggregations({ cacheOnly, context, res }: {
|
|
65
|
+
getPreAggregations({ cacheOnly, metaOnly, context, res }: {
|
|
66
66
|
cacheOnly?: boolean;
|
|
67
|
+
metaOnly?: boolean;
|
|
67
68
|
context: RequestContext;
|
|
68
69
|
res: ResponseResultFn;
|
|
69
70
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/gateway.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAWjC,OAAO,KAAK,EACV,WAAW,IAAI,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Ae,EAAE,cAAc,CAkBvC;IAEF,SAAS,CAAC,2BAA2B,CAAC,KAAK,KAAA;IAoCpC,GAAG,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAezF,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,GAAG,MAAM;IAMxE,SAAS,CAAC,0BAA0B,aAAc,MAAM,KAAG,cAAc,CAUvE;IAEF,OAAO,CAAC,aAAa;IAQrB,SAAS,CAAC,SAAS,EAAE,cAAc,CAkBjC;IAEF,SAAS,CAAC,QAAQ,EAAE,cAAc,CAahC;IAEK,OAAO;CAKf;AACD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,GACX,CAAC"}
|
package/dist/src/gateway.js
CHANGED
|
@@ -12,19 +12,19 @@ const structured_clone_1 = __importDefault(require("@ungap/structured-clone"));
|
|
|
12
12
|
const shared_1 = require("@cubejs-backend/shared");
|
|
13
13
|
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
14
14
|
const enums_1 = require("./types/enums");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
15
|
+
const request_parser_1 = require("./request-parser");
|
|
16
|
+
const user_error_1 = require("./user-error");
|
|
17
|
+
const cubejs_handler_error_1 = require("./cubejs-handler-error");
|
|
18
|
+
const subscription_server_1 = require("./ws/subscription-server");
|
|
19
|
+
const local_subscription_store_1 = require("./ws/local-subscription-store");
|
|
20
20
|
const query_1 = require("./query");
|
|
21
21
|
const cached_handler_1 = require("./cached-handler");
|
|
22
22
|
const jwk_1 = require("./jwk");
|
|
23
23
|
const sql_server_1 = require("./sql-server");
|
|
24
24
|
const graphql_1 = require("./graphql");
|
|
25
|
-
const
|
|
25
|
+
const prepare_annotation_1 = require("./helpers/prepare-annotation");
|
|
26
26
|
const transformData_1 = __importDefault(require("./helpers/transformData"));
|
|
27
|
-
const
|
|
27
|
+
const transform_meta_extended_1 = require("./helpers/transform-meta-extended");
|
|
28
28
|
function userAsyncHandler(handler) {
|
|
29
29
|
return (req, res, next) => {
|
|
30
30
|
handler(req, res).catch(next);
|
|
@@ -78,7 +78,7 @@ class ApiGateway {
|
|
|
78
78
|
this.basePath = options.basePath;
|
|
79
79
|
this.playgroundAuthSecret = options.playgroundAuthSecret;
|
|
80
80
|
this.queryRewrite = options.queryRewrite || (async (query) => query);
|
|
81
|
-
this.subscriptionStore = options.subscriptionStore || new
|
|
81
|
+
this.subscriptionStore = options.subscriptionStore || new local_subscription_store_1.LocalSubscriptionStore();
|
|
82
82
|
this.enforceSecurityChecks = options.enforceSecurityChecks || (process.env.NODE_ENV === 'production');
|
|
83
83
|
this.extendContext = options.extendContext;
|
|
84
84
|
this.checkAuthFn = this.createCheckAuthFn(options);
|
|
@@ -278,6 +278,7 @@ class ApiGateway {
|
|
|
278
278
|
app.get('/cubejs-system/v1/pre-aggregations', systemMiddlewares, systemAsyncHandler(async (req, res) => {
|
|
279
279
|
await this.getPreAggregations({
|
|
280
280
|
cacheOnly: !!req.query.cacheOnly,
|
|
281
|
+
metaOnly: !!req.query.metaOnly,
|
|
281
282
|
context: req.context,
|
|
282
283
|
res: this.resToResultFn(res)
|
|
283
284
|
});
|
|
@@ -340,7 +341,7 @@ class ApiGateway {
|
|
|
340
341
|
app.use(this.handleErrorMiddleware);
|
|
341
342
|
}
|
|
342
343
|
initSubscriptionServer(sendMessage) {
|
|
343
|
-
return new
|
|
344
|
+
return new subscription_server_1.SubscriptionServer(this, sendMessage, this.subscriptionStore, this.wsContextAcceptor);
|
|
344
345
|
}
|
|
345
346
|
duration(requestStarted) {
|
|
346
347
|
return requestStarted && (new Date().getTime() - requestStarted.getTime());
|
|
@@ -407,18 +408,18 @@ class ApiGateway {
|
|
|
407
408
|
const cubes = this.filterVisibleItemsInMeta(context, metaConfig)
|
|
408
409
|
.map((meta) => meta.config)
|
|
409
410
|
.map((cube) => ({
|
|
410
|
-
...(0,
|
|
411
|
+
...(0, transform_meta_extended_1.transformCube)(cube, cubeDefinitions),
|
|
411
412
|
measures: cube.measures?.map((measure) => ({
|
|
412
|
-
...(0,
|
|
413
|
+
...(0, transform_meta_extended_1.transformMeasure)(measure, cubeDefinitions),
|
|
413
414
|
})),
|
|
414
415
|
dimensions: cube.dimensions?.map((dimension) => ({
|
|
415
|
-
...(0,
|
|
416
|
+
...(0, transform_meta_extended_1.transformDimension)(dimension, cubeDefinitions),
|
|
416
417
|
})),
|
|
417
418
|
segments: cube.segments?.map((segment) => ({
|
|
418
|
-
...(0,
|
|
419
|
+
...(0, transform_meta_extended_1.transformSegment)(segment, cubeDefinitions),
|
|
419
420
|
})),
|
|
420
|
-
joins: (0,
|
|
421
|
-
preAggregations: (0,
|
|
421
|
+
joins: (0, transform_meta_extended_1.transformJoins)(cubeDefinitions[cube.name]?.joins),
|
|
422
|
+
preAggregations: (0, transform_meta_extended_1.transformPreAggregations)(cubeDefinitions[cube.name]?.preAggregations),
|
|
422
423
|
}));
|
|
423
424
|
res({ cubes });
|
|
424
425
|
}
|
|
@@ -431,7 +432,7 @@ class ApiGateway {
|
|
|
431
432
|
});
|
|
432
433
|
}
|
|
433
434
|
}
|
|
434
|
-
async getPreAggregations({ cacheOnly, context, res }) {
|
|
435
|
+
async getPreAggregations({ cacheOnly, metaOnly, context, res }) {
|
|
435
436
|
const requestStarted = new Date();
|
|
436
437
|
try {
|
|
437
438
|
const compilerApi = await this.getCompilerApi(context);
|
|
@@ -442,6 +443,7 @@ class ApiGateway {
|
|
|
442
443
|
preAggregations: preAggregations.map(p => ({
|
|
443
444
|
id: p.id,
|
|
444
445
|
cacheOnly,
|
|
446
|
+
metaOnly
|
|
445
447
|
}))
|
|
446
448
|
}));
|
|
447
449
|
res({ preAggregations: preAggregationPartitions.map(({ preAggregation }) => preAggregation) });
|
|
@@ -586,11 +588,11 @@ class ApiGateway {
|
|
|
586
588
|
case 'post':
|
|
587
589
|
if (!query.selector.timezones ||
|
|
588
590
|
query.selector.timezones.length === 0) {
|
|
589
|
-
throw new
|
|
591
|
+
throw new user_error_1.UserError('A user\'s selector must contain at least one time zone.');
|
|
590
592
|
}
|
|
591
593
|
if (!query.selector.contexts ||
|
|
592
594
|
query.selector.contexts.length === 0) {
|
|
593
|
-
throw new
|
|
595
|
+
throw new user_error_1.UserError('A user\'s selector must contain at least one context element.');
|
|
594
596
|
}
|
|
595
597
|
else {
|
|
596
598
|
let e = false;
|
|
@@ -599,13 +601,13 @@ class ApiGateway {
|
|
|
599
601
|
e = true;
|
|
600
602
|
});
|
|
601
603
|
if (e) {
|
|
602
|
-
throw new
|
|
604
|
+
throw new user_error_1.UserError('Every context element must contain the ' +
|
|
603
605
|
'\'securityContext\' property.');
|
|
604
606
|
}
|
|
605
607
|
}
|
|
606
608
|
result = await this.preAggregationsJobsPOST(context, query.selector);
|
|
607
609
|
if (result.length === 0) {
|
|
608
|
-
throw new
|
|
610
|
+
throw new user_error_1.UserError('A user\'s selector doesn\'t match any of the ' +
|
|
609
611
|
'pre-aggregations described by the Cube schemas.');
|
|
610
612
|
}
|
|
611
613
|
break;
|
|
@@ -878,10 +880,10 @@ class ApiGateway {
|
|
|
878
880
|
if (queryType === enums_1.QueryType.BLENDING_QUERY) {
|
|
879
881
|
const queryGranularity = (0, query_1.getQueryGranularity)(normalizedQueries);
|
|
880
882
|
if (queryGranularity.length > 1) {
|
|
881
|
-
throw new
|
|
883
|
+
throw new user_error_1.UserError('Data blending query granularities must match');
|
|
882
884
|
}
|
|
883
885
|
if (queryGranularity.length === 0) {
|
|
884
|
-
throw new
|
|
886
|
+
throw new user_error_1.UserError('Data blending query without granularity is not supported');
|
|
885
887
|
}
|
|
886
888
|
}
|
|
887
889
|
return [queryType, normalizedQueries];
|
|
@@ -1221,7 +1223,7 @@ class ApiGateway {
|
|
|
1221
1223
|
const results = await Promise.all(normalizedQueries.map(async (normalizedQuery, index) => {
|
|
1222
1224
|
slowQuery = slowQuery ||
|
|
1223
1225
|
Boolean(sqlQueries[index].slowQuery);
|
|
1224
|
-
const annotation = (0,
|
|
1226
|
+
const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
|
|
1225
1227
|
const response = await this.getSqlResponseInternal(context, normalizedQuery, sqlQueries[index]);
|
|
1226
1228
|
return this.getResultInternal(context, queryType, normalizedQuery, sqlQueries[index], annotation, response, resType);
|
|
1227
1229
|
}));
|
|
@@ -1238,7 +1240,7 @@ class ApiGateway {
|
|
|
1238
1240
|
}, context);
|
|
1239
1241
|
if (queryType !== enums_1.QueryType.REGULAR_QUERY &&
|
|
1240
1242
|
props.queryType == null) {
|
|
1241
|
-
throw new
|
|
1243
|
+
throw new user_error_1.UserError(`'${queryType}' query type is not supported by the client.` +
|
|
1242
1244
|
'Please update the client.');
|
|
1243
1245
|
}
|
|
1244
1246
|
if (props.queryType === 'multi') {
|
|
@@ -1315,7 +1317,7 @@ class ApiGateway {
|
|
|
1315
1317
|
else {
|
|
1316
1318
|
const adapterApi = await this.getAdapterApi(context);
|
|
1317
1319
|
const response = await adapterApi.executeQuery(finalQuery);
|
|
1318
|
-
const annotation = (0,
|
|
1320
|
+
const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQueries[0]);
|
|
1319
1321
|
// TODO Can we just pass through data? Ensure hidden members can't be queried
|
|
1320
1322
|
results = [{
|
|
1321
1323
|
data: response.data,
|
|
@@ -1327,7 +1329,7 @@ class ApiGateway {
|
|
|
1327
1329
|
results = await Promise.all(normalizedQueries.map(async (normalizedQuery, index) => {
|
|
1328
1330
|
slowQuery = slowQuery ||
|
|
1329
1331
|
Boolean(sqlQueries[index].slowQuery);
|
|
1330
|
-
const annotation = (0,
|
|
1332
|
+
const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
|
|
1331
1333
|
if (request.streaming) {
|
|
1332
1334
|
return streamResponse(sqlQueries[index]);
|
|
1333
1335
|
}
|
|
@@ -1347,7 +1349,7 @@ class ApiGateway {
|
|
|
1347
1349
|
}
|
|
1348
1350
|
async subscribeQueueEvents({ context, signedWithPlaygroundAuthSecret, connectionId, res }) {
|
|
1349
1351
|
if (this.enforceSecurityChecks && !signedWithPlaygroundAuthSecret) {
|
|
1350
|
-
throw new
|
|
1352
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Only for signed with playground auth secret');
|
|
1351
1353
|
}
|
|
1352
1354
|
return (await this.getAdapterApi(context)).subscribeQueueEvents(connectionId, res);
|
|
1353
1355
|
}
|
|
@@ -1402,14 +1404,14 @@ class ApiGateway {
|
|
|
1402
1404
|
}
|
|
1403
1405
|
parseQueryParam(query) {
|
|
1404
1406
|
if (!query || query === 'undefined') {
|
|
1405
|
-
throw new
|
|
1407
|
+
throw new user_error_1.UserError('Query param is required');
|
|
1406
1408
|
}
|
|
1407
1409
|
if (typeof query === 'string') {
|
|
1408
1410
|
try {
|
|
1409
1411
|
return JSON.parse(query);
|
|
1410
1412
|
}
|
|
1411
1413
|
catch (e) {
|
|
1412
|
-
throw new
|
|
1414
|
+
throw new user_error_1.UserError(`Unable to decode query param as JSON, error: ${e.message}`);
|
|
1413
1415
|
}
|
|
1414
1416
|
}
|
|
1415
1417
|
return query;
|
|
@@ -1443,7 +1445,7 @@ class ApiGateway {
|
|
|
1443
1445
|
handleError({ e, context, query, res, requestStarted }) {
|
|
1444
1446
|
const requestId = (0, shared_1.getEnv)('devMode') || context?.signedWithPlaygroundAuthSecret ? context?.requestId : undefined;
|
|
1445
1447
|
const plainError = e.plainMessages;
|
|
1446
|
-
if (e instanceof
|
|
1448
|
+
if (e instanceof cubejs_handler_error_1.CubejsHandlerError) {
|
|
1447
1449
|
this.log({
|
|
1448
1450
|
type: e.type,
|
|
1449
1451
|
query,
|
|
@@ -1554,14 +1556,14 @@ class ApiGateway {
|
|
|
1554
1556
|
checkAuthFn = async (auth) => {
|
|
1555
1557
|
const decoded = jsonwebtoken_1.default.decode(auth, { complete: true });
|
|
1556
1558
|
if (!decoded) {
|
|
1557
|
-
throw new
|
|
1559
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Unable to decode JWT key');
|
|
1558
1560
|
}
|
|
1559
1561
|
if (!decoded.header || !decoded.header.kid) {
|
|
1560
|
-
throw new
|
|
1562
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'JWT without kid inside headers');
|
|
1561
1563
|
}
|
|
1562
1564
|
const jwk = await jwks.getJWKbyKid(typeof options.jwkUrl === 'function' ? await options.jwkUrl(decoded) : options.jwkUrl, decoded.header.kid);
|
|
1563
1565
|
if (!jwk) {
|
|
1564
|
-
throw new
|
|
1566
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', `Unable to verify, JWK with kid: "${decoded.header.kid}" not found`);
|
|
1565
1567
|
}
|
|
1566
1568
|
return verifyToken(auth, jwk);
|
|
1567
1569
|
};
|
|
@@ -1575,13 +1577,13 @@ class ApiGateway {
|
|
|
1575
1577
|
}
|
|
1576
1578
|
catch (e) {
|
|
1577
1579
|
if (this.enforceSecurityChecks) {
|
|
1578
|
-
throw new
|
|
1580
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Invalid token', e);
|
|
1579
1581
|
}
|
|
1580
1582
|
}
|
|
1581
1583
|
}
|
|
1582
1584
|
else if (this.enforceSecurityChecks) {
|
|
1583
1585
|
// @todo Move it to 401 or 400
|
|
1584
|
-
throw new
|
|
1586
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Authorization header isn\'t set');
|
|
1585
1587
|
}
|
|
1586
1588
|
};
|
|
1587
1589
|
}
|
|
@@ -1648,7 +1650,7 @@ class ApiGateway {
|
|
|
1648
1650
|
const scopes = await this.contextToApiScopesFn(securityContext || {}, (0, shared_1.getEnv)('defaultApiScope') || await this.contextToApiScopesDefFn());
|
|
1649
1651
|
const permited = scopes.indexOf(scope) >= 0;
|
|
1650
1652
|
if (!permited) {
|
|
1651
|
-
throw new
|
|
1653
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', `API scope is missing: ${scope}`);
|
|
1652
1654
|
}
|
|
1653
1655
|
}
|
|
1654
1656
|
extractAuthorizationHeaderWithSchema(req) {
|
|
@@ -1670,7 +1672,7 @@ class ApiGateway {
|
|
|
1670
1672
|
}
|
|
1671
1673
|
}
|
|
1672
1674
|
catch (e) {
|
|
1673
|
-
if (e instanceof
|
|
1675
|
+
if (e instanceof cubejs_handler_error_1.CubejsHandlerError) {
|
|
1674
1676
|
const error = e.originalError || e;
|
|
1675
1677
|
this.log({
|
|
1676
1678
|
type: error.message,
|
|
@@ -1701,7 +1703,7 @@ class ApiGateway {
|
|
|
1701
1703
|
};
|
|
1702
1704
|
requestContextMiddleware = async (req, res, next) => {
|
|
1703
1705
|
try {
|
|
1704
|
-
req.context = await this.contextByReq(req, req.securityContext, (0,
|
|
1706
|
+
req.context = await this.contextByReq(req, req.securityContext, (0, request_parser_1.getRequestIdFromRequest)(req));
|
|
1705
1707
|
req.requestStarted = new Date();
|
|
1706
1708
|
if (next) {
|
|
1707
1709
|
next();
|
|
@@ -1717,7 +1719,7 @@ class ApiGateway {
|
|
|
1717
1719
|
}
|
|
1718
1720
|
};
|
|
1719
1721
|
requestLogger = async (req, res, next) => {
|
|
1720
|
-
const details = (0,
|
|
1722
|
+
const details = (0, request_parser_1.requestParser)(req, res);
|
|
1721
1723
|
this.log({ type: 'REST API Request', ...details }, req.context);
|
|
1722
1724
|
if (next) {
|
|
1723
1725
|
next();
|
|
@@ -1748,7 +1750,7 @@ class ApiGateway {
|
|
|
1748
1750
|
(query.timeDimensions || []).forEach((td, index) => {
|
|
1749
1751
|
if (td.compareDateRange != null) {
|
|
1750
1752
|
if (queryCompareDateRange != null) {
|
|
1751
|
-
throw new
|
|
1753
|
+
throw new user_error_1.UserError('compareDateRange can only exist for one timeDimension');
|
|
1752
1754
|
}
|
|
1753
1755
|
queryCompareDateRange = td.compareDateRange;
|
|
1754
1756
|
compareDateRangeTDIndex = index;
|