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

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.
@@ -2,7 +2,6 @@ import React__default, { Fragment, useEffect, useState, useContext, createContex
2
2
  import isEmpty$3 from 'lodash-es/isEmpty';
3
3
  import _, { isArray, capitalize, isEmpty as isEmpty$2, isFunction, replace, isObject, isNumber, every, some, mergeWith, remove as remove$2, cloneDeep, findIndex, reduce, merge, sumBy, mapValues, zipObject, isDate, omit as omit$1, maxBy, reject, defaultsDeep, isString, flatMap, filter, uniq, uniqBy, debounce as debounce$1, orderBy, minBy, throttle, get as get$1, min, max, groupBy, isEqual, intersection } from 'lodash-es';
4
4
  import { QueryEngineConfig } from '@vizzly/semantic-layer-public';
5
- import pino from 'pino';
6
5
  import moment from 'moment-timezone';
7
6
  import Joi from '@vizzly/joi';
8
7
  import { v4 } from 'uuid';
@@ -765,43 +764,6 @@ var snakeCaseToHumanReadable = function snakeCaseToHumanReadable(str) {
765
764
  return capitalise(_replaceAll(str, '_', ' '));
766
765
  };
767
766
 
768
- var enableBrowserLogging = function enableBrowserLogging() {
769
- if (typeof window !== 'undefined' && typeof document !== 'undefined') return true;
770
- return false;
771
- };
772
- var getOptions = function getOptions() {
773
- if (enableBrowserLogging()) {
774
- return {
775
- browser: {
776
- asObject: true
777
- }
778
- };
779
- } else {
780
- var _process$env, _process$env2, _process$env3, _process$env4;
781
- var otelExporter = (_process$env = process.env) == null ? void 0 : _process$env['OTEL_EXPORTER_OTLP_ENDPOINT'];
782
- var otelLogsExporter = (_process$env2 = process.env) == null ? void 0 : _process$env2['OTEL_EXPORTER_OTLP_LOGS_ENDPOINT'];
783
- var enableTerminalLogging = !!((_process$env3 = process.env) != null && _process$env3['TERMINAL_LOGGING']);
784
- var enableOTEL = !!otelExporter || !!otelLogsExporter;
785
- var logLevel = ((_process$env4 = process.env) == null ? void 0 : _process$env4['LOG_LEVEL']) || 'info';
786
- var targets = [];
787
- if (!!process.stdout.isTTY || !enableOTEL || !!enableTerminalLogging) {
788
- targets.push({
789
- target: 'pino-pretty',
790
- level: logLevel,
791
- customPrettifiers: {},
792
- options: {
793
- colorize: true,
794
- singleLine: false
795
- }
796
- });
797
- }
798
- return pino.transport({
799
- targets: targets
800
- });
801
- }
802
- };
803
- var logger = /*#__PURE__*/pino( /*#__PURE__*/getOptions());
804
-
805
767
  var LOG_LEVELS = ['debug', 'info', 'warning', 'error', 'properties'];
806
768
 
807
769
  // Singleton.
@@ -836,55 +798,57 @@ var shouldLog = function shouldLog(level) {
836
798
  });
837
799
  return currentLogLevelIndex <= logLevelIndex;
838
800
  };
801
+ var format = function format(value) {
802
+ if (value instanceof Error) return value;
803
+ if (isObject(value)) return JSON.stringify(value);
804
+ if (isArray(value)) return JSON.stringify(value);
805
+ return value;
806
+ };
839
807
  var logDebug = function logDebug() {
808
+ var _console;
840
809
  for (var _len = arguments.length, message = new Array(_len), _key = 0; _key < _len; _key++) {
841
810
  message[_key] = arguments[_key];
842
811
  }
843
812
  // Actually log as info because then it shows in browsers without making another change...
844
- if (shouldLog('debug')) logger.info.apply(logger, parseToPino("[VIZZLY DEBUG]", message));
813
+ if (shouldLog('debug')) (_console = console).info.apply(_console, ["[VIZZLY DEBUG]"].concat(message.map(format)));
845
814
  };
846
815
  var logInfo = function logInfo() {
816
+ var _console2;
847
817
  for (var _len2 = arguments.length, message = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
848
818
  message[_key2] = arguments[_key2];
849
819
  }
850
- if (shouldLog('info')) logger.info.apply(logger, parseToPino("[VIZZLY INFO]", message));
820
+ if (shouldLog('info')) (_console2 = console).info.apply(_console2, ["[VIZZLY INFO]"].concat(message.map(format)));
851
821
  };
852
822
  var logProperties = function logProperties() {
853
823
  for (var _len3 = arguments.length, message = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
854
824
  message[_key3] = arguments[_key3];
855
825
  }
856
- if (shouldLog('properties')) logger.info.apply(logger, parseToPino("[VIZZLY Dashboard Properties]", message));
826
+ if (shouldLog('properties')) console.info("[VIZZLY Dashboard Properties]", message);
857
827
  };
858
828
  var logWarning = function logWarning() {
829
+ var _console3;
859
830
  for (var _len4 = arguments.length, message = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
860
831
  message[_key4] = arguments[_key4];
861
832
  }
862
- if (shouldLog('warning')) logger.warn.apply(logger, parseToPino("[VIZZLY WARNING]", message));
833
+ if (shouldLog('warning')) (_console3 = console).warn.apply(_console3, ["[VIZZLY WARNING]"].concat(message.map(format)));
863
834
  };
864
835
  var logError = function logError() {
836
+ var _console4;
865
837
  for (var _len5 = arguments.length, message = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
866
838
  message[_key5] = arguments[_key5];
867
839
  }
868
- if (shouldLog('error')) logger.error.apply(logger, parseToPino("[VIZZLY ERROR]", message));
840
+ if (shouldLog('error')) (_console4 = console).error.apply(_console4, ["[VIZZLY ERROR]"].concat(message.map(format)));
869
841
  };
870
- var parseToPino = function parseToPino(prefix, args) {
871
- var inputs = isArray(args) ? args : [args];
872
- var err;
873
- var parts = [];
874
- for (var _iterator = _createForOfIteratorHelperLoose(inputs), _step; !(_step = _iterator()).done;) {
875
- var val = _step.value;
876
- if (!err && val instanceof Error) {
877
- err = val;
878
- continue;
879
- }
880
- if (isObject(val) || isArray(val)) {
881
- parts.push(JSON.stringify(val));
882
- } else if (val !== undefined && val !== null) {
883
- parts.push(String(val));
842
+ var wrapCallbackInDebugLog = function wrapCallbackInDebugLog(name, fn) {
843
+ if (fn === undefined) return undefined;
844
+ return function () {
845
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
846
+ args[_key6] = arguments[_key6];
884
847
  }
885
- }
886
- var msg = parts.length ? prefix + " " + parts.join(' ') : prefix;
887
- return err ? [err, msg] : [msg];
848
+ var result = fn.apply(void 0, args);
849
+ logDebug("Function " + name + " called with", args, 'and returned', result);
850
+ return result;
851
+ };
888
852
  };
889
853
 
890
854
  var NULL_REPLACEMENT = 'No value';
@@ -13067,7 +13031,7 @@ var formatShortDateAndTime = function formatShortDateAndTime(date) {
13067
13031
  });
13068
13032
  return date.toLocaleTimeString(EN_GB_LOCALE, options);
13069
13033
  };
13070
- var format = function format(value, _format) {
13034
+ var format$1 = function format(value, _format) {
13071
13035
  if (_format === 'day_of_month' && (typeof value === 'number' || typeof value === 'string')) {
13072
13036
  return "" + value + numberPostfix(typeof value === 'string' ? parseInt(value) : value);
13073
13037
  }
@@ -13457,7 +13421,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13457
13421
  noValueReplacement = noValue;
13458
13422
  }
13459
13423
  if (value === null || value === undefined) return noValueReplacement;
13460
- return format(value, 'hour_of_day');
13424
+ return format$1(value, 'hour_of_day');
13461
13425
  }
13462
13426
  },
13463
13427
  _vizzly_month_of_year: {
@@ -13467,7 +13431,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13467
13431
  noValueReplacement = noValue;
13468
13432
  }
13469
13433
  if (value === null || value === undefined) return noValueReplacement;
13470
- return format(value, 'month_of_year');
13434
+ return format$1(value, 'month_of_year');
13471
13435
  }
13472
13436
  },
13473
13437
  _vizzly_day_of_month: {
@@ -13477,7 +13441,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13477
13441
  noValueReplacement = noValue;
13478
13442
  }
13479
13443
  if (value === null || value === undefined) return noValueReplacement;
13480
- return format(value, 'day_of_month');
13444
+ return format$1(value, 'day_of_month');
13481
13445
  }
13482
13446
  },
13483
13447
  _vizzly_day_of_week_iso: {
@@ -13487,7 +13451,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13487
13451
  noValueReplacement = noValue;
13488
13452
  }
13489
13453
  if (value === null || value === undefined) return noValueReplacement;
13490
- return format(value, 'day_of_week_iso');
13454
+ return format$1(value, 'day_of_week_iso');
13491
13455
  }
13492
13456
  },
13493
13457
  _vizzly_week_of_year: {
@@ -13497,7 +13461,7 @@ var defaultNumberFormatOptions = function defaultNumberFormatOptions(textOverrid
13497
13461
  noValueReplacement = noValue;
13498
13462
  }
13499
13463
  if (value === null || value === undefined) return noValueReplacement;
13500
- return format(value, 'week_of_year');
13464
+ return format$1(value, 'week_of_year');
13501
13465
  }
13502
13466
  }
13503
13467
  };
@@ -13869,7 +13833,7 @@ function formattedFallbackDateTime(value) {
13869
13833
  var formattedDate;
13870
13834
  try {
13871
13835
  // Attempt to format using your custom DateTime functions
13872
- formattedDate = format(date, 'DD MMMM YYYY, hh:mm') || '';
13836
+ formattedDate = format$1(date, 'DD MMMM YYYY, hh:mm') || '';
13873
13837
  if (!formattedDate) throw new Error('Invalid format');
13874
13838
  } catch (e) {
13875
13839
  // Fallback to native Date handling if custom format fails
@@ -16223,119 +16187,119 @@ var defaultDateTimeFormatOptions = {
16223
16187
  hour_of_day: {
16224
16188
  description: 'Hour of the day',
16225
16189
  formatter: function formatter(date) {
16226
- return format(date, 'hour_of_day');
16190
+ return format$1(date, 'hour_of_day');
16227
16191
  }
16228
16192
  },
16229
16193
  /** @deprecated - moved to number formatting option */
16230
16194
  month_of_year: {
16231
16195
  description: 'Month of the year',
16232
16196
  formatter: function formatter(date) {
16233
- return format(date, 'month_of_year');
16197
+ return format$1(date, 'month_of_year');
16234
16198
  }
16235
16199
  },
16236
16200
  /** @deprecated - moved to number formatting option */
16237
16201
  day_of_month: {
16238
16202
  description: 'Day of month',
16239
16203
  formatter: function formatter(date) {
16240
- return format(date, 'day_of_month');
16204
+ return format$1(date, 'day_of_month');
16241
16205
  }
16242
16206
  },
16243
16207
  /** @deprecated - moved to number formatting option */
16244
16208
  day_of_week_iso: {
16245
16209
  description: 'Day of week',
16246
16210
  formatter: function formatter(date) {
16247
- return format(date, 'day_of_week_iso');
16211
+ return format$1(date, 'day_of_week_iso');
16248
16212
  }
16249
16213
  },
16250
16214
  /** @deprecated - moved to number formatting option */
16251
16215
  week_of_year: {
16252
16216
  description: 'Week of year',
16253
16217
  formatter: function formatter(date) {
16254
- return format(date, 'week_of_year');
16218
+ return format$1(date, 'week_of_year');
16255
16219
  }
16256
16220
  },
16257
16221
  'DD/MM/YYYY': {
16258
16222
  description: 'DD/MM/YYYY',
16259
16223
  formatter: function formatter(date) {
16260
- return format(date, 'DD/MM/YYYY');
16224
+ return format$1(date, 'DD/MM/YYYY');
16261
16225
  }
16262
16226
  },
16263
16227
  'MM/DD/YYYY': {
16264
16228
  description: 'MM/DD/YYYY',
16265
16229
  formatter: function formatter(date) {
16266
- return format(date, 'MM/DD/YYYY');
16230
+ return format$1(date, 'MM/DD/YYYY');
16267
16231
  }
16268
16232
  },
16269
16233
  'DD-MM-YYYY': {
16270
16234
  description: 'DD-MM-YYYY',
16271
16235
  formatter: function formatter(date) {
16272
- return format(date, 'DD-MM-YYYY');
16236
+ return format$1(date, 'DD-MM-YYYY');
16273
16237
  }
16274
16238
  },
16275
16239
  'MM-DD-YYYY': {
16276
16240
  description: 'MM-DD-YYYY',
16277
16241
  formatter: function formatter(date) {
16278
- return format(date, 'MM-DD-YYYY');
16242
+ return format$1(date, 'MM-DD-YYYY');
16279
16243
  }
16280
16244
  },
16281
16245
  'DD MMMM YYYY, hh:mm': {
16282
16246
  description: 'DD MMMM YYYY, hh:mm',
16283
16247
  formatter: function formatter(date) {
16284
- return format(date, 'DD MMMM YYYY, hh:mm');
16248
+ return format$1(date, 'DD MMMM YYYY, hh:mm');
16285
16249
  }
16286
16250
  },
16287
16251
  'dddd DD MMMM YYYY, hh:mm': {
16288
16252
  description: 'dddd DD MMMM YYYY, hh:mm',
16289
16253
  formatter: function formatter(date) {
16290
- return format(date, 'dddd DD MMMM YYYY, hh:mm');
16254
+ return format$1(date, 'dddd DD MMMM YYYY, hh:mm');
16291
16255
  }
16292
16256
  },
16293
16257
  'hh:mm': {
16294
16258
  description: 'hh:mm',
16295
16259
  formatter: function formatter(date) {
16296
- return format(date, 'hh:mm');
16260
+ return format$1(date, 'hh:mm');
16297
16261
  }
16298
16262
  },
16299
16263
  'hh:mm:ss': {
16300
16264
  description: 'hh:mm:ss',
16301
16265
  formatter: function formatter(date) {
16302
- return format(date, 'hh:mm:ss');
16266
+ return format$1(date, 'hh:mm:ss');
16303
16267
  }
16304
16268
  },
16305
16269
  'DD MMMM YYYY': {
16306
16270
  description: 'DD MMMM YYYY',
16307
16271
  formatter: function formatter(date) {
16308
- return format(date, 'DD MMMM YYYY');
16272
+ return format$1(date, 'DD MMMM YYYY');
16309
16273
  }
16310
16274
  },
16311
16275
  'MMMM YYYY': {
16312
16276
  description: 'MMMM YYYY',
16313
16277
  formatter: function formatter(date) {
16314
- return format(date, 'MMMM YYYY');
16278
+ return format$1(date, 'MMMM YYYY');
16315
16279
  }
16316
16280
  },
16317
16281
  YYYY: {
16318
16282
  description: 'YYYY',
16319
16283
  formatter: function formatter(date) {
16320
- return format(date, 'YYYY');
16284
+ return format$1(date, 'YYYY');
16321
16285
  }
16322
16286
  },
16323
16287
  'YYYY-MM-DD[T]HH:mm:ss': {
16324
16288
  description: 'YYYY-MM-DD[T]HH:mm:ss',
16325
16289
  formatter: function formatter(date) {
16326
- return format(date, 'YYYY-MM-DD[T]HH:mm:ss');
16290
+ return format$1(date, 'YYYY-MM-DD[T]HH:mm:ss');
16327
16291
  }
16328
16292
  },
16329
16293
  quarter: {
16330
16294
  description: 'Quarter',
16331
16295
  formatter: function formatter(date) {
16332
- return format(date, 'quarter');
16296
+ return format$1(date, 'quarter');
16333
16297
  }
16334
16298
  },
16335
16299
  week: {
16336
16300
  description: 'Week',
16337
16301
  formatter: function formatter(date) {
16338
- return format(date, 'week');
16302
+ return format$1(date, 'week');
16339
16303
  }
16340
16304
  }
16341
16305
  };
@@ -28840,7 +28804,7 @@ function DateFilter(props) {
28840
28804
  gap: "0.25rem",
28841
28805
  children: [jsxs(Flex, {
28842
28806
  children: [dateType === DateType.Fixed && jsx(DateTimeInput, {
28843
- value: value ? format(new Date(value), 'YYYY-MM-DD[T]HH:mm:ss') : undefined,
28807
+ value: value ? format$1(new Date(value), 'YYYY-MM-DD[T]HH:mm:ss') : undefined,
28844
28808
  onChange: function onChange(date) {
28845
28809
  var value = date ? date.toISOString() : null;
28846
28810
  setFilter({
@@ -69258,7 +69222,7 @@ function available(dashboard) {
69258
69222
  return Array.from(tagSet);
69259
69223
  }
69260
69224
 
69261
- function getOptions$1(allAvailableTags) {
69225
+ function getOptions(allAvailableTags) {
69262
69226
  var seenKeys = new Set();
69263
69227
  var tagOptions = [];
69264
69228
  allAvailableTags.forEach(function (tag) {
@@ -69295,7 +69259,7 @@ var TagsForm = function TagsForm(props) {
69295
69259
  dashboard = _useDashboardContext.dashboard;
69296
69260
  var allAvailableTags = available(dashboard);
69297
69261
  var getTagOptions = function getTagOptions() {
69298
- return getOptions$1(allAvailableTags);
69262
+ return getOptions(allAvailableTags);
69299
69263
  };
69300
69264
  var selectedTags = function selectedTags() {
69301
69265
  var options = getTagOptions();
@@ -81370,7 +81334,7 @@ var GlobalProviderContents = function GlobalProviderContents(props) {
81370
81334
  maxCSVDownloadLimit: props.maxCSVDownloadLimit,
81371
81335
  textOverrides: props.textOverrides,
81372
81336
  developerTools: props.developerTools,
81373
- dashboardFilters: props.dashboardFilters,
81337
+ dashboardFilters: wrapCallbackInDebugLog('dashboardFilters', props.dashboardFilters),
81374
81338
  onDashboardFilterChange: props.onDashboardFilterChange,
81375
81339
  onSave: onSave,
81376
81340
  onOpenConfigManagerUi: canOpenConfigManagerUi ? onOpenConfigManagerUi : undefined,
@@ -1,16 +1,17 @@
1
1
  import { LogLevel } from './types';
2
2
  export declare const LOG_LEVELS: Array<LogLevel>;
3
3
  export declare const setupLogger: (newLogLevel: LogLevel, onLogLevelChange?: ((newLogLevel: LogLevel) => void) | undefined) => {
4
- logDebug: (...message: unknown[]) => void;
5
- logError: (...message: unknown[]) => void;
6
- logInfo: (...message: unknown[]) => void;
7
- logWarning: (...message: unknown[]) => void;
8
- logProperties: (...message: unknown[]) => void;
4
+ logDebug: (...message: any) => void;
5
+ logError: (...message: any) => void;
6
+ logInfo: (...message: any) => void;
7
+ logWarning: (...message: any) => void;
8
+ logProperties: (...message: any) => void;
9
9
  getCurrentLogLevel: () => LogLevel;
10
10
  updateLogLevel: (newLevel: LogLevel) => void;
11
11
  };
12
- export declare const logDebug: (...message: unknown[]) => void;
13
- export declare const logInfo: (...message: unknown[]) => void;
14
- export declare const logProperties: (...message: unknown[]) => void;
15
- export declare const logWarning: (...message: unknown[]) => void;
16
- export declare const logError: (...message: unknown[]) => void;
12
+ export declare const logDebug: (...message: any) => void;
13
+ export declare const logInfo: (...message: any) => void;
14
+ export declare const logProperties: (...message: any) => void;
15
+ export declare const logWarning: (...message: any) => void;
16
+ export declare const logError: (...message: any) => void;
17
+ export declare const wrapCallbackInDebugLog: (name: string, fn: Function | undefined) => ((...args: any) => any) | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vizzly/dashboard",
3
3
  "author": "james@vizzly.co",
4
- "version": "0.15.0-dev-230b082ee8c6044131909984ccbd1d9f26373bdf",
4
+ "version": "0.15.0-dev-dc8abbc27d404a01b1c730481930e726e875c32b",
5
5
  "source": "src/index.tsx",
6
6
  "types": "./dist/dashboard/src/index.d.ts",
7
7
  "module": "./dist/dashboard.esm.js",
@@ -1 +0,0 @@
1
- export declare const logger: any;