@cubejs-backend/api-gateway 1.0.12 → 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 +1 -1
- package/dist/src/gateway.d.ts.map +1 -1
- package/dist/src/gateway.js +39 -39
- 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.js +12 -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,CAAC;IACjD,UAAU,CAAC,GAAG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AAC,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;
|
|
@@ -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,kBAAkB,EACjC,mBAAmB,EAEnB,cAAc,EAEd,QAAQ,IAAI,eAAe,EAC5B,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,SAAS,EACT,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,OAAO,EACP,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,EAChB,YAAY,EAMZ,aAAa,EAAE,oBAAoB,EACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,WAAW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AAG,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);
|
|
@@ -341,7 +341,7 @@ class ApiGateway {
|
|
|
341
341
|
app.use(this.handleErrorMiddleware);
|
|
342
342
|
}
|
|
343
343
|
initSubscriptionServer(sendMessage) {
|
|
344
|
-
return new
|
|
344
|
+
return new subscription_server_1.SubscriptionServer(this, sendMessage, this.subscriptionStore, this.wsContextAcceptor);
|
|
345
345
|
}
|
|
346
346
|
duration(requestStarted) {
|
|
347
347
|
return requestStarted && (new Date().getTime() - requestStarted.getTime());
|
|
@@ -408,18 +408,18 @@ class ApiGateway {
|
|
|
408
408
|
const cubes = this.filterVisibleItemsInMeta(context, metaConfig)
|
|
409
409
|
.map((meta) => meta.config)
|
|
410
410
|
.map((cube) => ({
|
|
411
|
-
...(0,
|
|
411
|
+
...(0, transform_meta_extended_1.transformCube)(cube, cubeDefinitions),
|
|
412
412
|
measures: cube.measures?.map((measure) => ({
|
|
413
|
-
...(0,
|
|
413
|
+
...(0, transform_meta_extended_1.transformMeasure)(measure, cubeDefinitions),
|
|
414
414
|
})),
|
|
415
415
|
dimensions: cube.dimensions?.map((dimension) => ({
|
|
416
|
-
...(0,
|
|
416
|
+
...(0, transform_meta_extended_1.transformDimension)(dimension, cubeDefinitions),
|
|
417
417
|
})),
|
|
418
418
|
segments: cube.segments?.map((segment) => ({
|
|
419
|
-
...(0,
|
|
419
|
+
...(0, transform_meta_extended_1.transformSegment)(segment, cubeDefinitions),
|
|
420
420
|
})),
|
|
421
|
-
joins: (0,
|
|
422
|
-
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),
|
|
423
423
|
}));
|
|
424
424
|
res({ cubes });
|
|
425
425
|
}
|
|
@@ -588,11 +588,11 @@ class ApiGateway {
|
|
|
588
588
|
case 'post':
|
|
589
589
|
if (!query.selector.timezones ||
|
|
590
590
|
query.selector.timezones.length === 0) {
|
|
591
|
-
throw new
|
|
591
|
+
throw new user_error_1.UserError('A user\'s selector must contain at least one time zone.');
|
|
592
592
|
}
|
|
593
593
|
if (!query.selector.contexts ||
|
|
594
594
|
query.selector.contexts.length === 0) {
|
|
595
|
-
throw new
|
|
595
|
+
throw new user_error_1.UserError('A user\'s selector must contain at least one context element.');
|
|
596
596
|
}
|
|
597
597
|
else {
|
|
598
598
|
let e = false;
|
|
@@ -601,13 +601,13 @@ class ApiGateway {
|
|
|
601
601
|
e = true;
|
|
602
602
|
});
|
|
603
603
|
if (e) {
|
|
604
|
-
throw new
|
|
604
|
+
throw new user_error_1.UserError('Every context element must contain the ' +
|
|
605
605
|
'\'securityContext\' property.');
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
result = await this.preAggregationsJobsPOST(context, query.selector);
|
|
609
609
|
if (result.length === 0) {
|
|
610
|
-
throw new
|
|
610
|
+
throw new user_error_1.UserError('A user\'s selector doesn\'t match any of the ' +
|
|
611
611
|
'pre-aggregations described by the Cube schemas.');
|
|
612
612
|
}
|
|
613
613
|
break;
|
|
@@ -880,10 +880,10 @@ class ApiGateway {
|
|
|
880
880
|
if (queryType === enums_1.QueryType.BLENDING_QUERY) {
|
|
881
881
|
const queryGranularity = (0, query_1.getQueryGranularity)(normalizedQueries);
|
|
882
882
|
if (queryGranularity.length > 1) {
|
|
883
|
-
throw new
|
|
883
|
+
throw new user_error_1.UserError('Data blending query granularities must match');
|
|
884
884
|
}
|
|
885
885
|
if (queryGranularity.length === 0) {
|
|
886
|
-
throw new
|
|
886
|
+
throw new user_error_1.UserError('Data blending query without granularity is not supported');
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
return [queryType, normalizedQueries];
|
|
@@ -1223,7 +1223,7 @@ class ApiGateway {
|
|
|
1223
1223
|
const results = await Promise.all(normalizedQueries.map(async (normalizedQuery, index) => {
|
|
1224
1224
|
slowQuery = slowQuery ||
|
|
1225
1225
|
Boolean(sqlQueries[index].slowQuery);
|
|
1226
|
-
const annotation = (0,
|
|
1226
|
+
const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
|
|
1227
1227
|
const response = await this.getSqlResponseInternal(context, normalizedQuery, sqlQueries[index]);
|
|
1228
1228
|
return this.getResultInternal(context, queryType, normalizedQuery, sqlQueries[index], annotation, response, resType);
|
|
1229
1229
|
}));
|
|
@@ -1240,7 +1240,7 @@ class ApiGateway {
|
|
|
1240
1240
|
}, context);
|
|
1241
1241
|
if (queryType !== enums_1.QueryType.REGULAR_QUERY &&
|
|
1242
1242
|
props.queryType == null) {
|
|
1243
|
-
throw new
|
|
1243
|
+
throw new user_error_1.UserError(`'${queryType}' query type is not supported by the client.` +
|
|
1244
1244
|
'Please update the client.');
|
|
1245
1245
|
}
|
|
1246
1246
|
if (props.queryType === 'multi') {
|
|
@@ -1317,7 +1317,7 @@ class ApiGateway {
|
|
|
1317
1317
|
else {
|
|
1318
1318
|
const adapterApi = await this.getAdapterApi(context);
|
|
1319
1319
|
const response = await adapterApi.executeQuery(finalQuery);
|
|
1320
|
-
const annotation = (0,
|
|
1320
|
+
const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQueries[0]);
|
|
1321
1321
|
// TODO Can we just pass through data? Ensure hidden members can't be queried
|
|
1322
1322
|
results = [{
|
|
1323
1323
|
data: response.data,
|
|
@@ -1329,7 +1329,7 @@ class ApiGateway {
|
|
|
1329
1329
|
results = await Promise.all(normalizedQueries.map(async (normalizedQuery, index) => {
|
|
1330
1330
|
slowQuery = slowQuery ||
|
|
1331
1331
|
Boolean(sqlQueries[index].slowQuery);
|
|
1332
|
-
const annotation = (0,
|
|
1332
|
+
const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
|
|
1333
1333
|
if (request.streaming) {
|
|
1334
1334
|
return streamResponse(sqlQueries[index]);
|
|
1335
1335
|
}
|
|
@@ -1349,7 +1349,7 @@ class ApiGateway {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
async subscribeQueueEvents({ context, signedWithPlaygroundAuthSecret, connectionId, res }) {
|
|
1351
1351
|
if (this.enforceSecurityChecks && !signedWithPlaygroundAuthSecret) {
|
|
1352
|
-
throw new
|
|
1352
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Only for signed with playground auth secret');
|
|
1353
1353
|
}
|
|
1354
1354
|
return (await this.getAdapterApi(context)).subscribeQueueEvents(connectionId, res);
|
|
1355
1355
|
}
|
|
@@ -1404,14 +1404,14 @@ class ApiGateway {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
parseQueryParam(query) {
|
|
1406
1406
|
if (!query || query === 'undefined') {
|
|
1407
|
-
throw new
|
|
1407
|
+
throw new user_error_1.UserError('Query param is required');
|
|
1408
1408
|
}
|
|
1409
1409
|
if (typeof query === 'string') {
|
|
1410
1410
|
try {
|
|
1411
1411
|
return JSON.parse(query);
|
|
1412
1412
|
}
|
|
1413
1413
|
catch (e) {
|
|
1414
|
-
throw new
|
|
1414
|
+
throw new user_error_1.UserError(`Unable to decode query param as JSON, error: ${e.message}`);
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
return query;
|
|
@@ -1445,7 +1445,7 @@ class ApiGateway {
|
|
|
1445
1445
|
handleError({ e, context, query, res, requestStarted }) {
|
|
1446
1446
|
const requestId = (0, shared_1.getEnv)('devMode') || context?.signedWithPlaygroundAuthSecret ? context?.requestId : undefined;
|
|
1447
1447
|
const plainError = e.plainMessages;
|
|
1448
|
-
if (e instanceof
|
|
1448
|
+
if (e instanceof cubejs_handler_error_1.CubejsHandlerError) {
|
|
1449
1449
|
this.log({
|
|
1450
1450
|
type: e.type,
|
|
1451
1451
|
query,
|
|
@@ -1556,14 +1556,14 @@ class ApiGateway {
|
|
|
1556
1556
|
checkAuthFn = async (auth) => {
|
|
1557
1557
|
const decoded = jsonwebtoken_1.default.decode(auth, { complete: true });
|
|
1558
1558
|
if (!decoded) {
|
|
1559
|
-
throw new
|
|
1559
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Unable to decode JWT key');
|
|
1560
1560
|
}
|
|
1561
1561
|
if (!decoded.header || !decoded.header.kid) {
|
|
1562
|
-
throw new
|
|
1562
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'JWT without kid inside headers');
|
|
1563
1563
|
}
|
|
1564
1564
|
const jwk = await jwks.getJWKbyKid(typeof options.jwkUrl === 'function' ? await options.jwkUrl(decoded) : options.jwkUrl, decoded.header.kid);
|
|
1565
1565
|
if (!jwk) {
|
|
1566
|
-
throw new
|
|
1566
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', `Unable to verify, JWK with kid: "${decoded.header.kid}" not found`);
|
|
1567
1567
|
}
|
|
1568
1568
|
return verifyToken(auth, jwk);
|
|
1569
1569
|
};
|
|
@@ -1577,13 +1577,13 @@ class ApiGateway {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
catch (e) {
|
|
1579
1579
|
if (this.enforceSecurityChecks) {
|
|
1580
|
-
throw new
|
|
1580
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Invalid token', e);
|
|
1581
1581
|
}
|
|
1582
1582
|
}
|
|
1583
1583
|
}
|
|
1584
1584
|
else if (this.enforceSecurityChecks) {
|
|
1585
1585
|
// @todo Move it to 401 or 400
|
|
1586
|
-
throw new
|
|
1586
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Authorization header isn\'t set');
|
|
1587
1587
|
}
|
|
1588
1588
|
};
|
|
1589
1589
|
}
|
|
@@ -1650,7 +1650,7 @@ class ApiGateway {
|
|
|
1650
1650
|
const scopes = await this.contextToApiScopesFn(securityContext || {}, (0, shared_1.getEnv)('defaultApiScope') || await this.contextToApiScopesDefFn());
|
|
1651
1651
|
const permited = scopes.indexOf(scope) >= 0;
|
|
1652
1652
|
if (!permited) {
|
|
1653
|
-
throw new
|
|
1653
|
+
throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', `API scope is missing: ${scope}`);
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
extractAuthorizationHeaderWithSchema(req) {
|
|
@@ -1672,7 +1672,7 @@ class ApiGateway {
|
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
1674
|
catch (e) {
|
|
1675
|
-
if (e instanceof
|
|
1675
|
+
if (e instanceof cubejs_handler_error_1.CubejsHandlerError) {
|
|
1676
1676
|
const error = e.originalError || e;
|
|
1677
1677
|
this.log({
|
|
1678
1678
|
type: error.message,
|
|
@@ -1703,7 +1703,7 @@ class ApiGateway {
|
|
|
1703
1703
|
};
|
|
1704
1704
|
requestContextMiddleware = async (req, res, next) => {
|
|
1705
1705
|
try {
|
|
1706
|
-
req.context = await this.contextByReq(req, req.securityContext, (0,
|
|
1706
|
+
req.context = await this.contextByReq(req, req.securityContext, (0, request_parser_1.getRequestIdFromRequest)(req));
|
|
1707
1707
|
req.requestStarted = new Date();
|
|
1708
1708
|
if (next) {
|
|
1709
1709
|
next();
|
|
@@ -1719,7 +1719,7 @@ class ApiGateway {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
};
|
|
1721
1721
|
requestLogger = async (req, res, next) => {
|
|
1722
|
-
const details = (0,
|
|
1722
|
+
const details = (0, request_parser_1.requestParser)(req, res);
|
|
1723
1723
|
this.log({ type: 'REST API Request', ...details }, req.context);
|
|
1724
1724
|
if (next) {
|
|
1725
1725
|
next();
|
|
@@ -1750,7 +1750,7 @@ class ApiGateway {
|
|
|
1750
1750
|
(query.timeDimensions || []).forEach((td, index) => {
|
|
1751
1751
|
if (td.compareDateRange != null) {
|
|
1752
1752
|
if (queryCompareDateRange != null) {
|
|
1753
|
-
throw new
|
|
1753
|
+
throw new user_error_1.UserError('compareDateRange can only exist for one timeDimension');
|
|
1754
1754
|
}
|
|
1755
1755
|
queryCompareDateRange = td.compareDateRange;
|
|
1756
1756
|
compareDateRangeTDIndex = index;
|