@vizzly/dashboard 0.15.0-dev-c2e1069059b99dca4fa8e9a6598dad3e94a0539e → 0.15.0-dev-230b082ee8c6044131909984ccbd1d9f26373bdf

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.
@@ -10,6 +10,7 @@ var isEmpty$2 = _interopDefault(require('lodash/isEmpty'));
10
10
  var _ = require('lodash');
11
11
  var ___default = _interopDefault(_);
12
12
  var semanticLayerPublic = require('@vizzly/semantic-layer-public');
13
+ var pino = _interopDefault(require('pino'));
13
14
  var moment = _interopDefault(require('moment-timezone'));
14
15
  var Joi = _interopDefault(require('@vizzly/joi'));
15
16
  var uuid = require('uuid');
@@ -773,6 +774,43 @@ var snakeCaseToHumanReadable = function snakeCaseToHumanReadable(str) {
773
774
  return capitalise(_replaceAll(str, '_', ' '));
774
775
  };
775
776
 
777
+ var enableBrowserLogging = function enableBrowserLogging() {
778
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') return true;
779
+ return false;
780
+ };
781
+ var getOptions = function getOptions() {
782
+ if (enableBrowserLogging()) {
783
+ return {
784
+ browser: {
785
+ asObject: true
786
+ }
787
+ };
788
+ } else {
789
+ var _process$env, _process$env2, _process$env3, _process$env4;
790
+ var otelExporter = (_process$env = process.env) == null ? void 0 : _process$env['OTEL_EXPORTER_OTLP_ENDPOINT'];
791
+ var otelLogsExporter = (_process$env2 = process.env) == null ? void 0 : _process$env2['OTEL_EXPORTER_OTLP_LOGS_ENDPOINT'];
792
+ var enableTerminalLogging = !!((_process$env3 = process.env) != null && _process$env3['TERMINAL_LOGGING']);
793
+ var enableOTEL = !!otelExporter || !!otelLogsExporter;
794
+ var logLevel = ((_process$env4 = process.env) == null ? void 0 : _process$env4['LOG_LEVEL']) || 'info';
795
+ var targets = [];
796
+ if (!!process.stdout.isTTY || !enableOTEL || !!enableTerminalLogging) {
797
+ targets.push({
798
+ target: 'pino-pretty',
799
+ level: logLevel,
800
+ customPrettifiers: {},
801
+ options: {
802
+ colorize: true,
803
+ singleLine: false
804
+ }
805
+ });
806
+ }
807
+ return pino.transport({
808
+ targets: targets
809
+ });
810
+ }
811
+ };
812
+ var logger = /*#__PURE__*/pino( /*#__PURE__*/getOptions());
813
+
776
814
  var LOG_LEVELS = ['debug', 'info', 'warning', 'error', 'properties'];
777
815
 
778
816
  // Singleton.
@@ -807,46 +845,55 @@ var shouldLog = function shouldLog(level) {
807
845
  });
808
846
  return currentLogLevelIndex <= logLevelIndex;
809
847
  };
810
- var format = function format(value) {
811
- if (value instanceof Error) return value;
812
- if (_.isObject(value)) return JSON.stringify(value);
813
- if (_.isArray(value)) return JSON.stringify(value);
814
- return value;
815
- };
816
848
  var logDebug = function logDebug() {
817
- var _console;
818
849
  for (var _len = arguments.length, message = new Array(_len), _key = 0; _key < _len; _key++) {
819
850
  message[_key] = arguments[_key];
820
851
  }
821
852
  // Actually log as info because then it shows in browsers without making another change...
822
- if (shouldLog('debug')) (_console = console).info.apply(_console, ["[VIZZLY DEBUG]"].concat(message.map(format)));
853
+ if (shouldLog('debug')) logger.info.apply(logger, parseToPino("[VIZZLY DEBUG]", message));
823
854
  };
824
855
  var logInfo = function logInfo() {
825
- var _console2;
826
856
  for (var _len2 = arguments.length, message = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
827
857
  message[_key2] = arguments[_key2];
828
858
  }
829
- if (shouldLog('info')) (_console2 = console).info.apply(_console2, ["[VIZZLY INFO]"].concat(message.map(format)));
859
+ if (shouldLog('info')) logger.info.apply(logger, parseToPino("[VIZZLY INFO]", message));
830
860
  };
831
861
  var logProperties = function logProperties() {
832
862
  for (var _len3 = arguments.length, message = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
833
863
  message[_key3] = arguments[_key3];
834
864
  }
835
- if (shouldLog('properties')) console.info("[VIZZLY Dashboard Properties]", message);
865
+ if (shouldLog('properties')) logger.info.apply(logger, parseToPino("[VIZZLY Dashboard Properties]", message));
836
866
  };
837
867
  var logWarning = function logWarning() {
838
- var _console3;
839
868
  for (var _len4 = arguments.length, message = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
840
869
  message[_key4] = arguments[_key4];
841
870
  }
842
- if (shouldLog('warning')) (_console3 = console).warn.apply(_console3, ["[VIZZLY WARNING]"].concat(message.map(format)));
871
+ if (shouldLog('warning')) logger.warn.apply(logger, parseToPino("[VIZZLY WARNING]", message));
843
872
  };
844
873
  var logError = function logError() {
845
- var _console4;
846
874
  for (var _len5 = arguments.length, message = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
847
875
  message[_key5] = arguments[_key5];
848
876
  }
849
- if (shouldLog('error')) (_console4 = console).error.apply(_console4, ["[VIZZLY ERROR]"].concat(message.map(format)));
877
+ if (shouldLog('error')) logger.error.apply(logger, parseToPino("[VIZZLY ERROR]", message));
878
+ };
879
+ var parseToPino = function parseToPino(prefix, args) {
880
+ var inputs = _.isArray(args) ? args : [args];
881
+ var err;
882
+ var parts = [];
883
+ for (var _iterator = _createForOfIteratorHelperLoose(inputs), _step; !(_step = _iterator()).done;) {
884
+ var val = _step.value;
885
+ if (!err && val instanceof Error) {
886
+ err = val;
887
+ continue;
888
+ }
889
+ if (_.isObject(val) || _.isArray(val)) {
890
+ parts.push(JSON.stringify(val));
891
+ } else if (val !== undefined && val !== null) {
892
+ parts.push(String(val));
893
+ }
894
+ }
895
+ var msg = parts.length ? prefix + " " + parts.join(' ') : prefix;
896
+ return err ? [err, msg] : [msg];
850
897
  };
851
898
 
852
899
  var NULL_REPLACEMENT = 'No value';
@@ -13026,7 +13073,7 @@ var formatShortDateAndTime = function formatShortDateAndTime(date) {
13026
13073
  });
13027
13074
  return date.toLocaleTimeString(EN_GB_LOCALE, options);
13028
13075
  };
13029
- var format$1 = function format(value, _format) {
13076
+ var format = function format(value, _format) {
13030
13077
  if (_format === 'day_of_month' && (typeof value === 'number' || typeof value === 'string')) {
13031
13078
  return "" + value + numberPostfix(typeof value === 'string' ? parseInt(value) : value);
13032
13079
  }
@@ -13416,7 +13463,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13416
13463
  noValueReplacement = noValue;
13417
13464
  }
13418
13465
  if (value === null || value === undefined) return noValueReplacement;
13419
- return format$1(value, 'hour_of_day');
13466
+ return format(value, 'hour_of_day');
13420
13467
  }
13421
13468
  },
13422
13469
  _vizzly_month_of_year: {
@@ -13426,7 +13473,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13426
13473
  noValueReplacement = noValue;
13427
13474
  }
13428
13475
  if (value === null || value === undefined) return noValueReplacement;
13429
- return format$1(value, 'month_of_year');
13476
+ return format(value, 'month_of_year');
13430
13477
  }
13431
13478
  },
13432
13479
  _vizzly_day_of_month: {
@@ -13436,7 +13483,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13436
13483
  noValueReplacement = noValue;
13437
13484
  }
13438
13485
  if (value === null || value === undefined) return noValueReplacement;
13439
- return format$1(value, 'day_of_month');
13486
+ return format(value, 'day_of_month');
13440
13487
  }
13441
13488
  },
13442
13489
  _vizzly_day_of_week_iso: {
@@ -13446,7 +13493,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13446
13493
  noValueReplacement = noValue;
13447
13494
  }
13448
13495
  if (value === null || value === undefined) return noValueReplacement;
13449
- return format$1(value, 'day_of_week_iso');
13496
+ return format(value, 'day_of_week_iso');
13450
13497
  }
13451
13498
  },
13452
13499
  _vizzly_week_of_year: {
@@ -13456,7 +13503,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13456
13503
  noValueReplacement = noValue;
13457
13504
  }
13458
13505
  if (value === null || value === undefined) return noValueReplacement;
13459
- return format$1(value, 'week_of_year');
13506
+ return format(value, 'week_of_year');
13460
13507
  }
13461
13508
  }
13462
13509
  };
@@ -13828,7 +13875,7 @@ function formattedFallbackDateTime(value) {
13828
13875
  var formattedDate;
13829
13876
  try {
13830
13877
  // Attempt to format using your custom DateTime functions
13831
- formattedDate = format$1(date, 'DD MMMM YYYY, hh:mm') || '';
13878
+ formattedDate = format(date, 'DD MMMM YYYY, hh:mm') || '';
13832
13879
  if (!formattedDate) throw new Error('Invalid format');
13833
13880
  } catch (e) {
13834
13881
  // Fallback to native Date handling if custom format fails
@@ -16181,119 +16228,119 @@ var defaultDateTimeFormatOptions = {
16181
16228
  hour_of_day: {
16182
16229
  description: 'Hour of the day',
16183
16230
  formatter: function formatter(date) {
16184
- return format$1(date, 'hour_of_day');
16231
+ return format(date, 'hour_of_day');
16185
16232
  }
16186
16233
  },
16187
16234
  /** @deprecated - moved to number formatting option */
16188
16235
  month_of_year: {
16189
16236
  description: 'Month of the year',
16190
16237
  formatter: function formatter(date) {
16191
- return format$1(date, 'month_of_year');
16238
+ return format(date, 'month_of_year');
16192
16239
  }
16193
16240
  },
16194
16241
  /** @deprecated - moved to number formatting option */
16195
16242
  day_of_month: {
16196
16243
  description: 'Day of month',
16197
16244
  formatter: function formatter(date) {
16198
- return format$1(date, 'day_of_month');
16245
+ return format(date, 'day_of_month');
16199
16246
  }
16200
16247
  },
16201
16248
  /** @deprecated - moved to number formatting option */
16202
16249
  day_of_week_iso: {
16203
16250
  description: 'Day of week',
16204
16251
  formatter: function formatter(date) {
16205
- return format$1(date, 'day_of_week_iso');
16252
+ return format(date, 'day_of_week_iso');
16206
16253
  }
16207
16254
  },
16208
16255
  /** @deprecated - moved to number formatting option */
16209
16256
  week_of_year: {
16210
16257
  description: 'Week of year',
16211
16258
  formatter: function formatter(date) {
16212
- return format$1(date, 'week_of_year');
16259
+ return format(date, 'week_of_year');
16213
16260
  }
16214
16261
  },
16215
16262
  'DD/MM/YYYY': {
16216
16263
  description: 'DD/MM/YYYY',
16217
16264
  formatter: function formatter(date) {
16218
- return format$1(date, 'DD/MM/YYYY');
16265
+ return format(date, 'DD/MM/YYYY');
16219
16266
  }
16220
16267
  },
16221
16268
  'MM/DD/YYYY': {
16222
16269
  description: 'MM/DD/YYYY',
16223
16270
  formatter: function formatter(date) {
16224
- return format$1(date, 'MM/DD/YYYY');
16271
+ return format(date, 'MM/DD/YYYY');
16225
16272
  }
16226
16273
  },
16227
16274
  'DD-MM-YYYY': {
16228
16275
  description: 'DD-MM-YYYY',
16229
16276
  formatter: function formatter(date) {
16230
- return format$1(date, 'DD-MM-YYYY');
16277
+ return format(date, 'DD-MM-YYYY');
16231
16278
  }
16232
16279
  },
16233
16280
  'MM-DD-YYYY': {
16234
16281
  description: 'MM-DD-YYYY',
16235
16282
  formatter: function formatter(date) {
16236
- return format$1(date, 'MM-DD-YYYY');
16283
+ return format(date, 'MM-DD-YYYY');
16237
16284
  }
16238
16285
  },
16239
16286
  'DD MMMM YYYY, hh:mm': {
16240
16287
  description: 'DD MMMM YYYY, hh:mm',
16241
16288
  formatter: function formatter(date) {
16242
- return format$1(date, 'DD MMMM YYYY, hh:mm');
16289
+ return format(date, 'DD MMMM YYYY, hh:mm');
16243
16290
  }
16244
16291
  },
16245
16292
  'dddd DD MMMM YYYY, hh:mm': {
16246
16293
  description: 'dddd DD MMMM YYYY, hh:mm',
16247
16294
  formatter: function formatter(date) {
16248
- return format$1(date, 'dddd DD MMMM YYYY, hh:mm');
16295
+ return format(date, 'dddd DD MMMM YYYY, hh:mm');
16249
16296
  }
16250
16297
  },
16251
16298
  'hh:mm': {
16252
16299
  description: 'hh:mm',
16253
16300
  formatter: function formatter(date) {
16254
- return format$1(date, 'hh:mm');
16301
+ return format(date, 'hh:mm');
16255
16302
  }
16256
16303
  },
16257
16304
  'hh:mm:ss': {
16258
16305
  description: 'hh:mm:ss',
16259
16306
  formatter: function formatter(date) {
16260
- return format$1(date, 'hh:mm:ss');
16307
+ return format(date, 'hh:mm:ss');
16261
16308
  }
16262
16309
  },
16263
16310
  'DD MMMM YYYY': {
16264
16311
  description: 'DD MMMM YYYY',
16265
16312
  formatter: function formatter(date) {
16266
- return format$1(date, 'DD MMMM YYYY');
16313
+ return format(date, 'DD MMMM YYYY');
16267
16314
  }
16268
16315
  },
16269
16316
  'MMMM YYYY': {
16270
16317
  description: 'MMMM YYYY',
16271
16318
  formatter: function formatter(date) {
16272
- return format$1(date, 'MMMM YYYY');
16319
+ return format(date, 'MMMM YYYY');
16273
16320
  }
16274
16321
  },
16275
16322
  YYYY: {
16276
16323
  description: 'YYYY',
16277
16324
  formatter: function formatter(date) {
16278
- return format$1(date, 'YYYY');
16325
+ return format(date, 'YYYY');
16279
16326
  }
16280
16327
  },
16281
16328
  'YYYY-MM-DD[T]HH:mm:ss': {
16282
16329
  description: 'YYYY-MM-DD[T]HH:mm:ss',
16283
16330
  formatter: function formatter(date) {
16284
- return format$1(date, 'YYYY-MM-DD[T]HH:mm:ss');
16331
+ return format(date, 'YYYY-MM-DD[T]HH:mm:ss');
16285
16332
  }
16286
16333
  },
16287
16334
  quarter: {
16288
16335
  description: 'Quarter',
16289
16336
  formatter: function formatter(date) {
16290
- return format$1(date, 'quarter');
16337
+ return format(date, 'quarter');
16291
16338
  }
16292
16339
  },
16293
16340
  week: {
16294
16341
  description: 'Week',
16295
16342
  formatter: function formatter(date) {
16296
- return format$1(date, 'week');
16343
+ return format(date, 'week');
16297
16344
  }
16298
16345
  }
16299
16346
  };
@@ -28765,7 +28812,7 @@ function DateFilter(props) {
28765
28812
  gap: "0.25rem",
28766
28813
  children: [jsxRuntime.jsxs(Flex, {
28767
28814
  children: [dateType === DateType.Fixed && jsxRuntime.jsx(DateTimeInput, {
28768
- value: value ? format$1(new Date(value), 'YYYY-MM-DD[T]HH:mm:ss') : undefined,
28815
+ value: value ? format(new Date(value), 'YYYY-MM-DD[T]HH:mm:ss') : undefined,
28769
28816
  onChange: function onChange(date) {
28770
28817
  var value = date ? date.toISOString() : null;
28771
28818
  setFilter({
@@ -65322,7 +65369,7 @@ var SortSection = function SortSection(props) {
65322
65369
  var attributes = props.attributes;
65323
65370
  var dimension = [];
65324
65371
  var measure = [];
65325
- if (attributes.type === 'comboChart') {
65372
+ if (attributes.type === 'comboChart' || attributes.type === 'comboChartV2') {
65326
65373
  if (!('barDimension' in attributes) || !('lineDimension' in attributes) || !('barMeasure' in attributes) || !('lineMeasure' in attributes)) {
65327
65374
  return null;
65328
65375
  }
@@ -69144,7 +69191,7 @@ function available(dashboard) {
69144
69191
  return Array.from(tagSet);
69145
69192
  }
69146
69193
 
69147
- function getOptions(allAvailableTags) {
69194
+ function getOptions$1(allAvailableTags) {
69148
69195
  var seenKeys = new Set();
69149
69196
  var tagOptions = [];
69150
69197
  allAvailableTags.forEach(function (tag) {
@@ -69181,7 +69228,7 @@ var TagsForm = function TagsForm(props) {
69181
69228
  dashboard = _useDashboardContext.dashboard;
69182
69229
  var allAvailableTags = available(dashboard);
69183
69230
  var getTagOptions = function getTagOptions() {
69184
- return getOptions(allAvailableTags);
69231
+ return getOptions$1(allAvailableTags);
69185
69232
  };
69186
69233
  var selectedTags = function selectedTags() {
69187
69234
  var options = getTagOptions();