@cubejs-backend/api-gateway 1.5.11 → 1.5.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.
Files changed (82) hide show
  1. package/dist/src/{CubejsHandlerError.d.ts → cubejs-handler-error.d.ts} +1 -1
  2. package/dist/src/cubejs-handler-error.d.ts.map +1 -0
  3. package/dist/src/{CubejsHandlerError.js → cubejs-handler-error.js} +1 -1
  4. package/dist/src/cubejs-handler-error.js.map +1 -0
  5. package/dist/src/{dateParser.d.ts → date-parser.d.ts} +1 -1
  6. package/dist/src/date-parser.d.ts.map +1 -0
  7. package/dist/src/{dateParser.js → date-parser.js} +5 -5
  8. package/dist/src/date-parser.js.map +1 -0
  9. package/dist/src/gateway.d.ts +1 -1
  10. package/dist/src/gateway.d.ts.map +1 -1
  11. package/dist/src/gateway.js +54 -52
  12. package/dist/src/gateway.js.map +1 -1
  13. package/dist/src/helpers/{prepareAnnotation.d.ts → prepare-annotation.d.ts} +2 -2
  14. package/dist/src/helpers/prepare-annotation.d.ts.map +1 -0
  15. package/dist/src/helpers/{prepareAnnotation.js → prepare-annotation.js} +3 -3
  16. package/dist/src/helpers/prepare-annotation.js.map +1 -0
  17. package/dist/src/helpers/{toConfigMap.d.ts → to-config-map.d.ts} +1 -1
  18. package/dist/src/helpers/to-config-map.d.ts.map +1 -0
  19. package/dist/src/helpers/{toConfigMap.js → to-config-map.js} +1 -1
  20. package/dist/src/helpers/to-config-map.js.map +1 -0
  21. package/dist/src/helpers/{transformMetaExtended.d.ts → transform-meta-extended.d.ts} +1 -1
  22. package/dist/src/helpers/transform-meta-extended.d.ts.map +1 -0
  23. package/dist/src/helpers/{transformMetaExtended.js → transform-meta-extended.js} +1 -1
  24. package/dist/src/helpers/transform-meta-extended.js.map +1 -0
  25. package/dist/src/index.d.ts +4 -3
  26. package/dist/src/index.d.ts.map +1 -1
  27. package/dist/src/index.js +4 -4
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/interfaces.d.ts +1 -1
  30. package/dist/src/interfaces.d.ts.map +1 -1
  31. package/dist/src/query.js +13 -13
  32. package/dist/src/query.js.map +1 -1
  33. package/dist/src/{requestParser.d.ts → request-parser.d.ts} +1 -1
  34. package/dist/src/request-parser.d.ts.map +1 -0
  35. package/dist/src/{requestParser.js → request-parser.js} +1 -1
  36. package/dist/src/request-parser.js.map +1 -0
  37. package/dist/src/types/responses.d.ts +1 -1
  38. package/dist/src/types/responses.d.ts.map +1 -1
  39. package/dist/src/user-error.d.ts +5 -0
  40. package/dist/src/user-error.d.ts.map +1 -0
  41. package/dist/src/{UserError.js → user-error.js} +3 -3
  42. package/dist/src/user-error.js.map +1 -0
  43. package/dist/src/ws/index.d.ts +4 -0
  44. package/dist/src/ws/index.d.ts.map +1 -0
  45. package/dist/src/ws/index.js +20 -0
  46. package/dist/src/ws/index.js.map +1 -0
  47. package/dist/src/ws/local-subscription-store.d.ts +30 -0
  48. package/dist/src/ws/local-subscription-store.d.ts.map +1 -0
  49. package/dist/src/ws/local-subscription-store.js +64 -0
  50. package/dist/src/ws/local-subscription-store.js.map +1 -0
  51. package/dist/src/ws/message-schema.d.ts +53 -0
  52. package/dist/src/ws/message-schema.d.ts.map +1 -0
  53. package/dist/src/ws/message-schema.js +59 -0
  54. package/dist/src/ws/message-schema.js.map +1 -0
  55. package/dist/src/ws/subscription-server.d.ts +25 -0
  56. package/dist/src/ws/subscription-server.d.ts.map +1 -0
  57. package/dist/src/ws/subscription-server.js +187 -0
  58. package/dist/src/ws/subscription-server.js.map +1 -0
  59. package/package.json +8 -7
  60. package/dist/src/CubejsHandlerError.d.ts.map +0 -1
  61. package/dist/src/CubejsHandlerError.js.map +0 -1
  62. package/dist/src/LocalSubscriptionStore.d.ts +0 -19
  63. package/dist/src/LocalSubscriptionStore.d.ts.map +0 -1
  64. package/dist/src/LocalSubscriptionStore.js +0 -57
  65. package/dist/src/LocalSubscriptionStore.js.map +0 -1
  66. package/dist/src/SubscriptionServer.d.ts +0 -19
  67. package/dist/src/SubscriptionServer.d.ts.map +0 -1
  68. package/dist/src/SubscriptionServer.js +0 -133
  69. package/dist/src/SubscriptionServer.js.map +0 -1
  70. package/dist/src/UserError.d.ts +0 -5
  71. package/dist/src/UserError.d.ts.map +0 -1
  72. package/dist/src/UserError.js.map +0 -1
  73. package/dist/src/dateParser.d.ts.map +0 -1
  74. package/dist/src/dateParser.js.map +0 -1
  75. package/dist/src/helpers/prepareAnnotation.d.ts.map +0 -1
  76. package/dist/src/helpers/prepareAnnotation.js.map +0 -1
  77. package/dist/src/helpers/toConfigMap.d.ts.map +0 -1
  78. package/dist/src/helpers/toConfigMap.js.map +0 -1
  79. package/dist/src/helpers/transformMetaExtended.d.ts.map +0 -1
  80. package/dist/src/helpers/transformMetaExtended.js.map +0 -1
  81. package/dist/src/requestParser.d.ts.map +0 -1
  82. 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=CubejsHandlerError.d.ts.map
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"}
@@ -13,4 +13,4 @@ class CubejsHandlerError extends Error {
13
13
  }
14
14
  }
15
15
  exports.CubejsHandlerError = CubejsHandlerError;
16
- //# sourceMappingURL=CubejsHandlerError.js.map
16
+ //# sourceMappingURL=cubejs-handler-error.js.map
@@ -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=dateParser.d.ts.map
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,iFA2FC"}
@@ -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 UserError_1 = require("./UserError");
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'));
@@ -74,10 +74,10 @@ function dateParser(dateString, timezone, now = new Date()) {
74
74
  const fromResults = (0, chrono_node_1.parse)(from.trim(), new Date(current.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS)));
75
75
  const toResults = (0, chrono_node_1.parse)(to.trim(), new Date(current.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS)));
76
76
  if (!Array.isArray(fromResults) || !fromResults.length) {
77
- throw new UserError_1.UserError(`Can't parse date: '${from}'`);
77
+ throw new user_error_1.UserError(`Can't parse date: '${from}'`);
78
78
  }
79
79
  if (!Array.isArray(toResults) || !toResults.length) {
80
- throw new UserError_1.UserError(`Can't parse date: '${to}'`);
80
+ throw new user_error_1.UserError(`Can't parse date: '${to}'`);
81
81
  }
82
82
  const exactGranularity = ['second', 'minute', 'hour'].find(g => dateString.indexOf(g) !== -1) || 'day';
83
83
  momentRange = [
@@ -90,7 +90,7 @@ function dateParser(dateString, timezone, now = new Date()) {
90
90
  const current = (0, moment_timezone_1.default)(now).tz(timezone);
91
91
  const results = (0, chrono_node_1.parse)(dateString, new Date(current.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS)));
92
92
  if (!results?.length) {
93
- throw new UserError_1.UserError(`Can't parse date: '${dateString}'`);
93
+ throw new user_error_1.UserError(`Can't parse date: '${dateString}'`);
94
94
  }
95
95
  const exactGranularity = ['second', 'minute', 'hour'].find(g => dateString.indexOf(g) !== -1) || 'day';
96
96
  momentRange = results[0].end ? [
@@ -105,4 +105,4 @@ function dateParser(dateString, timezone, now = new Date()) {
105
105
  return momentRange.map(d => d.format(moment_timezone_1.default.HTML5_FMT.DATETIME_LOCAL_MS));
106
106
  }
107
107
  exports.dateParser = dateParser;
108
- //# sourceMappingURL=dateParser.js.map
108
+ //# 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,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;YAC5C,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC;SAC7C,CAAC;QACF,WAAW,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,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;AA3FD,gCA2FC"}
@@ -8,7 +8,7 @@ import { CheckAuthInternalOptions, JWTOptions, CheckAuthFn, ContextToApiScopesFn
8
8
  import { Query, NormalizedQuery } from './types/query';
9
9
  import { UserBackgroundContext, ApiGatewayOptions } from './types/gateway';
10
10
  import { RequestLoggerMiddlewareFn, ContextRejectionMiddlewareFn, ContextAcceptorFn } from './interfaces';
11
- import { SubscriptionServer, WebSocketSendMessageFn } from './SubscriptionServer';
11
+ import { SubscriptionServer, WebSocketSendMessageFn } from './ws/subscription-server';
12
12
  import { SQLServer, SQLServerConstructorOptions } from './sql-server';
13
13
  type HandleErrorOptions = {
14
14
  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;AAQjC,OAAO,EAKL,SAAS,EACV,MAAM,wBAAwB,CAAC;AAMhC,OAAO,KAAK,EACV,WAAW,IAAI,kBAAkB,EACjC,mBAAmB,EAEnB,cAAc,EAEd,QAAQ,IAAI,eAAe,EAC5B,MAAM,SAAS,CAAC;AAIjB,OAAO,EACL,SAAS,EACT,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,OAAO,EACP,cAA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,cAAc,CAahC;IAEK,OAAO;CAKf;AACD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,GACX,CAAC"}
@@ -15,18 +15,18 @@ const shared_1 = require("@cubejs-backend/shared");
15
15
  const native_1 = require("@cubejs-backend/native");
16
16
  const http_proxy_middleware_1 = require("http-proxy-middleware");
17
17
  const enums_1 = require("./types/enums");
18
- const requestParser_1 = require("./requestParser");
19
- const UserError_1 = require("./UserError");
20
- const CubejsHandlerError_1 = require("./CubejsHandlerError");
21
- const SubscriptionServer_1 = require("./SubscriptionServer");
22
- const LocalSubscriptionStore_1 = require("./LocalSubscriptionStore");
18
+ const request_parser_1 = require("./request-parser");
19
+ const user_error_1 = require("./user-error");
20
+ const cubejs_handler_error_1 = require("./cubejs-handler-error");
21
+ const subscription_server_1 = require("./ws/subscription-server");
22
+ const local_subscription_store_1 = require("./ws/local-subscription-store");
23
23
  const query_1 = require("./query");
24
24
  const cached_handler_1 = require("./cached-handler");
25
25
  const jwk_1 = require("./jwk");
26
26
  const sql_server_1 = require("./sql-server");
27
27
  const graphql_1 = require("./graphql");
28
- const prepareAnnotation_1 = require("./helpers/prepareAnnotation");
29
- const transformMetaExtended_1 = require("./helpers/transformMetaExtended");
28
+ const prepare_annotation_1 = require("./helpers/prepare-annotation");
29
+ const transform_meta_extended_1 = require("./helpers/transform-meta-extended");
30
30
  function userAsyncHandler(handler) {
31
31
  return (req, res, next) => {
32
32
  handler(req, res).catch(next);
@@ -88,7 +88,7 @@ class ApiGateway {
88
88
  this.basePath = options.basePath;
89
89
  this.playgroundAuthSecret = options.playgroundAuthSecret;
90
90
  this.queryRewrite = options.queryRewrite || (async (query) => query);
91
- this.subscriptionStore = options.subscriptionStore || new LocalSubscriptionStore_1.LocalSubscriptionStore();
91
+ this.subscriptionStore = options.subscriptionStore || new local_subscription_store_1.LocalSubscriptionStore();
92
92
  this.enforceSecurityChecks = options.enforceSecurityChecks || (process.env.NODE_ENV === 'production');
93
93
  this.extendContext = options.extendContext;
94
94
  this.checkAuthFn = this.createCheckAuthFn(options);
@@ -385,7 +385,7 @@ class ApiGateway {
385
385
  app.use(`${this.basePath}/v2`, proxyMiddleware);
386
386
  }
387
387
  initSubscriptionServer(sendMessage) {
388
- return new SubscriptionServer_1.SubscriptionServer(this, sendMessage, this.subscriptionStore, this.wsContextAcceptor);
388
+ return new subscription_server_1.SubscriptionServer(this, sendMessage, this.subscriptionStore, this.wsContextAcceptor);
389
389
  }
390
390
  duration(requestStarted) {
391
391
  return requestStarted && (new Date().getTime() - requestStarted.getTime());
@@ -452,20 +452,20 @@ class ApiGateway {
452
452
  const cubes = this.filterVisibleItemsInMeta(context, metaConfig)
453
453
  .map((meta) => meta.config)
454
454
  .map((cube) => ({
455
- ...(0, transformMetaExtended_1.transformCube)(cube, cubeDefinitions),
455
+ ...(0, transform_meta_extended_1.transformCube)(cube, cubeDefinitions),
456
456
  measures: cube.measures?.map((measure) => ({
457
- ...(0, transformMetaExtended_1.transformMeasure)(measure, cubeDefinitions),
457
+ ...(0, transform_meta_extended_1.transformMeasure)(measure, cubeDefinitions),
458
458
  })),
459
459
  dimensions: cube.dimensions?.map((dimension) => ({
460
- ...(0, transformMetaExtended_1.transformDimension)(dimension, cubeDefinitions),
460
+ ...(0, transform_meta_extended_1.transformDimension)(dimension, cubeDefinitions),
461
461
  })),
462
462
  segments: cube.segments?.map((segment) => ({
463
- ...(0, transformMetaExtended_1.transformSegment)(segment, cubeDefinitions),
463
+ ...(0, transform_meta_extended_1.transformSegment)(segment, cubeDefinitions),
464
464
  })),
465
- joins: (0, transformMetaExtended_1.transformJoins)(cubeDefinitions[cube.name]?.joins),
466
- preAggregations: (0, transformMetaExtended_1.transformPreAggregations)(cubeDefinitions[cube.name]?.preAggregations),
465
+ joins: (0, transform_meta_extended_1.transformJoins)(cubeDefinitions[cube.name]?.joins),
466
+ preAggregations: (0, transform_meta_extended_1.transformPreAggregations)(cubeDefinitions[cube.name]?.preAggregations),
467
467
  }));
468
- res({ cubes });
468
+ await res({ cubes });
469
469
  }
470
470
  catch (e) {
471
471
  this.handleError({
@@ -534,7 +534,7 @@ class ApiGateway {
534
534
  } : {}),
535
535
  })),
536
536
  });
537
- res({
537
+ await res({
538
538
  preAggregationPartitions: preAggregationPartitions.map(mergePartitionsAndVersionEntries())
539
539
  });
540
540
  }
@@ -557,7 +557,7 @@ class ApiGateway {
557
557
  });
558
558
  const { partitions } = (preAggregationPartitions?.[0] || {});
559
559
  const preAggregationPartition = partitions?.find(p => p?.tableName === versionEntry.table_name);
560
- res({
560
+ await res({
561
561
  preview: preAggregationPartition && await orchestratorApi.getPreAggregationPreview(context, preAggregationPartition)
562
562
  });
563
563
  }
@@ -573,7 +573,7 @@ class ApiGateway {
573
573
  query = (0, query_1.normalizeQueryPreAggregations)(this.parseQueryParam(query));
574
574
  const result = await this.refreshScheduler()
575
575
  .buildPreAggregations(context, query);
576
- res({ result });
576
+ await res({ result });
577
577
  }
578
578
  catch (e) {
579
579
  this.handleError({
@@ -630,17 +630,17 @@ class ApiGateway {
630
630
  try {
631
631
  await this.assertApiScope('jobs', req?.context?.securityContext);
632
632
  if (!query || Object.keys(query).length === 0) {
633
- throw new UserError_1.UserError('No job description provided');
633
+ throw new user_error_1.UserError('No job description provided');
634
634
  }
635
635
  const { error } = query_1.preAggsJobsRequestSchema.validate(query);
636
636
  if (error) {
637
- throw new UserError_1.UserError(`Invalid Job query format: ${error.message || error.toString()}`);
637
+ throw new user_error_1.UserError(`Invalid Job query format: ${error.message || error.toString()}`);
638
638
  }
639
639
  switch (query.action) {
640
640
  case 'post':
641
641
  result = await this.preAggregationsJobsPOST(context, query.selector);
642
642
  if (result.length === 0) {
643
- throw new UserError_1.UserError('A user\'s selector doesn\'t match any of the ' +
643
+ throw new user_error_1.UserError('A user\'s selector doesn\'t match any of the ' +
644
644
  'pre-aggregations defined in the data model.');
645
645
  }
646
646
  break;
@@ -672,7 +672,7 @@ class ApiGateway {
672
672
  const start = (0, shared_1.parseUtcIntoLocalDate)([{ val: selector.dateRange[0] }], 'UTC');
673
673
  const end = (0, shared_1.parseUtcIntoLocalDate)([{ val: selector.dateRange[1] }], 'UTC');
674
674
  if (!start || !end) {
675
- throw new UserError_1.UserError(`Cannot parse selector date range ${selector.dateRange}`);
675
+ throw new user_error_1.UserError(`Cannot parse selector date range ${selector.dateRange}`);
676
676
  }
677
677
  selector.dateRange = [start, end];
678
678
  }
@@ -842,7 +842,7 @@ class ApiGateway {
842
842
  const requestStarted = new Date();
843
843
  try {
844
844
  const orchestratorApi = await this.getAdapterApi(context);
845
- res({
845
+ await res({
846
846
  result: await orchestratorApi.getPreAggregationQueueStates()
847
847
  });
848
848
  }
@@ -857,7 +857,7 @@ class ApiGateway {
857
857
  try {
858
858
  const { queryKeys, dataSource } = (0, query_1.normalizeQueryCancelPreAggregations)(this.parseQueryParam(query));
859
859
  const orchestratorApi = await this.getAdapterApi(context);
860
- res({
860
+ await res({
861
861
  result: await orchestratorApi.cancelPreAggregationQueriesFromQueue(queryKeys, dataSource)
862
862
  });
863
863
  }
@@ -939,10 +939,10 @@ class ApiGateway {
939
939
  if (queryType === enums_1.QueryType.BLENDING_QUERY) {
940
940
  const queryGranularity = (0, query_1.getQueryGranularity)(normalizedQueries);
941
941
  if (queryGranularity.length > 1) {
942
- throw new UserError_1.UserError('Data blending query granularities must match');
942
+ throw new user_error_1.UserError('Data blending query granularities must match');
943
943
  }
944
944
  if (queryGranularity.length === 0) {
945
- throw new UserError_1.UserError('Data blending query without granularity is not supported');
945
+ throw new user_error_1.UserError('Data blending query without granularity is not supported');
946
946
  }
947
947
  }
948
948
  return [queryType, normalizedQueries, queryNormalizationResult.map((it) => (0, query_1.remapToQueryAdapterFormat)(it.normalizedQuery))];
@@ -951,7 +951,7 @@ class ApiGateway {
951
951
  try {
952
952
  await this.assertApiScope('sql', context.securityContext);
953
953
  const result = await this.sqlServer.sql4sql(query, disablePostProcessing, context.securityContext);
954
- res({ sql: result });
954
+ await res({ sql: result });
955
955
  }
956
956
  catch (e) {
957
957
  this.handleError({
@@ -975,7 +975,7 @@ class ApiGateway {
975
975
  ...sqlQuery,
976
976
  order: ramda_1.default.fromPairs(sqlQuery.order.map(({ id: key, desc }) => [key, desc ? 'desc' : 'asc']))
977
977
  });
978
- res(queryType === enums_1.QueryType.REGULAR_QUERY ?
978
+ await res(queryType === enums_1.QueryType.REGULAR_QUERY ?
979
979
  { sql: toQuery(sqlQueries[0]) } :
980
980
  sqlQueries.map((sqlQuery) => ({ sql: toQuery(sqlQuery) })));
981
981
  }
@@ -1094,7 +1094,7 @@ class ApiGateway {
1094
1094
  const memberToDataSource = await compilerApi.memberToDataSource(query);
1095
1095
  const dataSources = new Set(Object.values(memberToDataSource));
1096
1096
  const dataSourceToSqlGenerator = (await Promise.all([...dataSources].map(async (dataSource) => ({ [dataSource]: (await compilerApi.getSqlGenerator(query, dataSource)).sqlGenerator })))).reduce((a, b) => ({ ...a, ...b }), {});
1097
- res({ memberToDataSource, dataSourceToSqlGenerator });
1097
+ await res({ memberToDataSource, dataSourceToSqlGenerator });
1098
1098
  }
1099
1099
  catch (e) {
1100
1100
  this.handleError({
@@ -1156,7 +1156,7 @@ class ApiGateway {
1156
1156
  const sqlQueries = await Promise.all(normalizedQueries.map(async (normalizedQuery) => (await this.getCompilerApi(context)).getSql(this.coerceForSqlQuery(normalizedQuery, context), {
1157
1157
  includeDebugInfo: (0, shared_1.getEnv)('devMode') || context.signedWithPlaygroundAuthSecret
1158
1158
  })));
1159
- res({
1159
+ await res({
1160
1160
  queryType,
1161
1161
  normalizedQueries,
1162
1162
  queryOrder: sqlQueries.map((sqlQuery) => ramda_1.default.fromPairs(sqlQuery.order.map(({ id: member, desc }) => [member, desc ? 'desc' : 'asc']))),
@@ -1370,7 +1370,7 @@ class ApiGateway {
1370
1370
  const [queryType, normalizedQueries] = await this.getNormalizedQueries(query, context, false, false, cacheMode);
1371
1371
  if (queryType !== enums_1.QueryType.REGULAR_QUERY &&
1372
1372
  props.queryType == null) {
1373
- throw new UserError_1.UserError(`'${queryType}' query type is not supported by the client.` +
1373
+ throw new user_error_1.UserError(`'${queryType}' query type is not supported by the client.` +
1374
1374
  'Please update the client.');
1375
1375
  }
1376
1376
  let metaConfigResult = await (await this
@@ -1384,7 +1384,7 @@ class ApiGateway {
1384
1384
  slowQuery = slowQuery ||
1385
1385
  Boolean(sqlQueries[index].slowQuery);
1386
1386
  const response = await this.getSqlResponseInternal(context, normalizedQuery, sqlQueries[index]);
1387
- const annotation = (0, prepareAnnotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
1387
+ const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
1388
1388
  return this.prepareResultTransformData(context, queryType, normalizedQuery, sqlQueries[index], annotation, response, resType);
1389
1389
  }));
1390
1390
  this.log({
@@ -1402,12 +1402,12 @@ class ApiGateway {
1402
1402
  dbType: results.map(r => r.getRootResultObject()[0].dbType),
1403
1403
  }, context);
1404
1404
  if (props.queryType === 'multi') {
1405
- // We prepare the final json result on native side
1405
+ // We prepare the final JSON result on the native side
1406
1406
  const resultMulti = new native_1.ResultMultiWrapper(results, { queryType, slowQuery });
1407
1407
  await res(resultMulti);
1408
1408
  }
1409
1409
  else {
1410
- // We prepare the full final json result on native side
1410
+ // We prepare the full final JSON result on the native side
1411
1411
  await res(results[0]);
1412
1412
  }
1413
1413
  }
@@ -1471,7 +1471,7 @@ class ApiGateway {
1471
1471
  else {
1472
1472
  const adapterApi = await this.getAdapterApi(context);
1473
1473
  const response = await adapterApi.executeQuery(finalQuery);
1474
- const annotation = (0, prepareAnnotation_1.prepareAnnotation)(metaConfigResult, normalizedQueries[0]);
1474
+ const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQueries[0]);
1475
1475
  // TODO Can we just pass through data? Ensure hidden members can't be queried
1476
1476
  results = [{
1477
1477
  data: response.data,
@@ -1484,7 +1484,7 @@ class ApiGateway {
1484
1484
  results = await Promise.all(normalizedQueries.map(async (normalizedQuery, index) => {
1485
1485
  slowQuery = slowQuery ||
1486
1486
  Boolean(sqlQueries[index].slowQuery);
1487
- const annotation = (0, prepareAnnotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
1487
+ const annotation = (0, prepare_annotation_1.prepareAnnotation)(metaConfigResult, normalizedQuery);
1488
1488
  if (request.streaming) {
1489
1489
  return streamResponse(sqlQueries[index]);
1490
1490
  }
@@ -1537,10 +1537,12 @@ class ApiGateway {
1537
1537
  });
1538
1538
  const state = await subscriptionState();
1539
1539
  if (result && (!state || JSON.stringify(state.result) !== JSON.stringify(result))) {
1540
- res(result.message, result.opts);
1540
+ // We prepare the full final JSON result on the native side
1541
+ await res(result.message, result.opts);
1541
1542
  }
1542
1543
  else if (error) {
1543
- res(error.message, error.opts);
1544
+ // We prepare the full final JSON result on the native side
1545
+ await res(error.message, error.opts);
1544
1546
  }
1545
1547
  await subscribe({ error, result });
1546
1548
  }
@@ -1566,14 +1568,14 @@ class ApiGateway {
1566
1568
  }
1567
1569
  parseQueryParam(query) {
1568
1570
  if (!query || query === 'undefined') {
1569
- throw new UserError_1.UserError('Query param is required');
1571
+ throw new user_error_1.UserError('Query param is required');
1570
1572
  }
1571
1573
  if (typeof query === 'string') {
1572
1574
  try {
1573
1575
  return JSON.parse(query);
1574
1576
  }
1575
1577
  catch (e) {
1576
- throw new UserError_1.UserError(`Unable to decode query param as JSON, error: ${e.message}`);
1578
+ throw new user_error_1.UserError(`Unable to decode query param as JSON, error: ${e.message}`);
1577
1579
  }
1578
1580
  }
1579
1581
  return query;
@@ -1609,7 +1611,7 @@ class ApiGateway {
1609
1611
  const requestId = (0, shared_1.getEnv)('devMode') || context?.signedWithPlaygroundAuthSecret ? context?.requestId : undefined;
1610
1612
  const stack = (0, shared_1.getEnv)('devMode') ? e.stack : undefined;
1611
1613
  const plainError = e.plainMessages;
1612
- if (e instanceof CubejsHandlerError_1.CubejsHandlerError) {
1614
+ if (e instanceof cubejs_handler_error_1.CubejsHandlerError) {
1613
1615
  this.log({
1614
1616
  type: e.type,
1615
1617
  query: this.sanitizeQueryForLogging(query),
@@ -1723,14 +1725,14 @@ class ApiGateway {
1723
1725
  checkAuthFn = async (auth) => {
1724
1726
  const decoded = jsonwebtoken_1.default.decode(auth, { complete: true });
1725
1727
  if (!decoded) {
1726
- throw new CubejsHandlerError_1.CubejsHandlerError(403, 'Forbidden', 'Unable to decode JWT key');
1728
+ throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Unable to decode JWT key');
1727
1729
  }
1728
1730
  if (!decoded.header || !decoded.header.kid) {
1729
- throw new CubejsHandlerError_1.CubejsHandlerError(403, 'Forbidden', 'JWT without kid inside headers');
1731
+ throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'JWT without kid inside headers');
1730
1732
  }
1731
1733
  const jwk = await jwks.getJWKbyKid(typeof options.jwkUrl === 'function' ? await options.jwkUrl(decoded) : options.jwkUrl, decoded.header.kid);
1732
1734
  if (!jwk) {
1733
- throw new CubejsHandlerError_1.CubejsHandlerError(403, 'Forbidden', `Unable to verify, JWK with kid: "${decoded.header.kid}" not found`);
1735
+ throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', `Unable to verify, JWK with kid: "${decoded.header.kid}" not found`);
1734
1736
  }
1735
1737
  return verifyToken(auth, jwk);
1736
1738
  };
@@ -1744,13 +1746,13 @@ class ApiGateway {
1744
1746
  }
1745
1747
  catch (e) {
1746
1748
  if (this.enforceSecurityChecks) {
1747
- throw new CubejsHandlerError_1.CubejsHandlerError(403, 'Forbidden', 'Invalid token', e);
1749
+ throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Invalid token', e);
1748
1750
  }
1749
1751
  }
1750
1752
  }
1751
1753
  else if (this.enforceSecurityChecks) {
1752
1754
  // @todo Move it to 401 or 400
1753
- throw new CubejsHandlerError_1.CubejsHandlerError(403, 'Forbidden', 'Authorization header isn\'t set');
1755
+ throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', 'Authorization header isn\'t set');
1754
1756
  }
1755
1757
  return {
1756
1758
  securityContext: req.securityContext
@@ -1826,7 +1828,7 @@ class ApiGateway {
1826
1828
  const scopes = await this.contextToApiScopesFn(securityContext || {}, (0, shared_1.getEnv)('defaultApiScope') || await this.contextToApiScopesDefFn());
1827
1829
  const permited = scopes.indexOf(scope) >= 0;
1828
1830
  if (!permited) {
1829
- throw new CubejsHandlerError_1.CubejsHandlerError(403, 'Forbidden', `API scope is missing: ${scope}`);
1831
+ throw new cubejs_handler_error_1.CubejsHandlerError(403, 'Forbidden', `API scope is missing: ${scope}`);
1830
1832
  }
1831
1833
  }
1832
1834
  extractAuthorizationHeaderWithSchema(req) {
@@ -1849,7 +1851,7 @@ class ApiGateway {
1849
1851
  }
1850
1852
  }
1851
1853
  catch (e) {
1852
- if (e instanceof CubejsHandlerError_1.CubejsHandlerError) {
1854
+ if (e instanceof cubejs_handler_error_1.CubejsHandlerError) {
1853
1855
  const error = e.originalError || e;
1854
1856
  const stack = (0, shared_1.getEnv)('devMode') ? error.stack : undefined;
1855
1857
  this.log({
@@ -1882,7 +1884,7 @@ class ApiGateway {
1882
1884
  };
1883
1885
  requestContextMiddleware = async (req, res, next) => {
1884
1886
  try {
1885
- req.context = await this.contextByReq(req, req.securityContext, (0, requestParser_1.getRequestIdFromRequest)(req));
1887
+ req.context = await this.contextByReq(req, req.securityContext, (0, request_parser_1.getRequestIdFromRequest)(req));
1886
1888
  req.requestStarted = new Date();
1887
1889
  if (next) {
1888
1890
  next();
@@ -1898,7 +1900,7 @@ class ApiGateway {
1898
1900
  }
1899
1901
  };
1900
1902
  requestLogger = async (req, res, next) => {
1901
- const details = (0, requestParser_1.requestParser)(req, res);
1903
+ const details = (0, request_parser_1.requestParser)(req, res);
1902
1904
  this.log({ type: 'REST API Request', ...details }, req.context);
1903
1905
  if (next) {
1904
1906
  next();
@@ -1929,7 +1931,7 @@ class ApiGateway {
1929
1931
  (query.timeDimensions || []).forEach((td, index) => {
1930
1932
  if (td.compareDateRange != null) {
1931
1933
  if (queryCompareDateRange != null) {
1932
- throw new UserError_1.UserError('compareDateRange can only exist for one timeDimension');
1934
+ throw new user_error_1.UserError('compareDateRange can only exist for one timeDimension');
1933
1935
  }
1934
1936
  queryCompareDateRange = td.compareDateRange;
1935
1937
  compareDateRangeTDIndex = index;