autoql-fe-utils 1.11.25 → 1.11.27

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/index.mjs CHANGED
@@ -2168,7 +2168,7 @@ var getUniqueYearsForColumn = (data, columns, index) => {
2168
2168
  var supportsNetworkGraph = (data, columns) => {
2169
2169
  var _a2, _b2;
2170
2170
  const logUnsupportedReason = (message) => {
2171
- console.warn(`[supportsNetworkGraph] ${message}`);
2171
+ console.debug(`[supportsNetworkGraph] ${message}`);
2172
2172
  };
2173
2173
  if (!data || data.length < 2) {
2174
2174
  logUnsupportedReason(`Insufficient rows (${(_a2 = data == null ? void 0 : data.length) != null ? _a2 : 0}). Need at least 2 rows.`);
@@ -2298,7 +2298,7 @@ var supportsSankey = (rows, columns) => {
2298
2298
  var _a2, _b2;
2299
2299
  try {
2300
2300
  const logUnsupportedReason = (message) => {
2301
- console.warn(`[supportsSankey] ${message}`);
2301
+ console.debug(`[supportsSankey] ${message}`);
2302
2302
  };
2303
2303
  if (!(rows == null ? void 0 : rows.length) || !(columns == null ? void 0 : columns.length)) {
2304
2304
  logUnsupportedReason(
@@ -10191,7 +10191,8 @@ var runQueryOnly = ({
10191
10191
  cancelToken,
10192
10192
  scope = "null",
10193
10193
  newColumns,
10194
- displayOverrides
10194
+ displayOverrides,
10195
+ projectId
10195
10196
  }) => {
10196
10197
  const url = `${domain}/autoql/api/v1/query?key=${apiKey}`;
10197
10198
  const finalUserSelection = userSelectionFinal || transformUserSelection(userSelection);
@@ -10213,7 +10214,8 @@ var runQueryOnly = ({
10213
10214
  scope: finalScope,
10214
10215
  additional_selects: newColumns,
10215
10216
  display_overrides: displayOverrides,
10216
- time_zone: getCurrentTimezone()
10217
+ time_zone: getCurrentTimezone(),
10218
+ project_id: projectId
10217
10219
  };
10218
10220
  if (!query || !query.trim()) {
10219
10221
  console.error("No query supplied in request");
@@ -10293,7 +10295,8 @@ var runQuery = async ({
10293
10295
  skipQueryValidation,
10294
10296
  scope = "null",
10295
10297
  newColumns,
10296
- displayOverrides
10298
+ displayOverrides,
10299
+ projectId
10297
10300
  } = {}) => {
10298
10301
  if (enableQueryValidation && !(userSelection == null ? void 0 : userSelection.length) && !skipQueryValidation) {
10299
10302
  try {
@@ -10335,7 +10338,8 @@ var runQuery = async ({
10335
10338
  cancelToken,
10336
10339
  scope,
10337
10340
  newColumns,
10338
- displayOverrides
10341
+ displayOverrides,
10342
+ projectId
10339
10343
  });
10340
10344
  };
10341
10345
  var runCachedDashboardQuery = async ({
@@ -10353,7 +10357,8 @@ var runCachedDashboardQuery = async ({
10353
10357
  queryIndex,
10354
10358
  tileKey,
10355
10359
  dashboardId,
10356
- force
10360
+ force,
10361
+ projectId
10357
10362
  } = {}) => {
10358
10363
  if (!dashboardId) {
10359
10364
  console.error("No dashboard ID supplied in request");
@@ -10378,6 +10383,9 @@ var runCachedDashboardQuery = async ({
10378
10383
  if (force) {
10379
10384
  queryParams.set("force", "true");
10380
10385
  }
10386
+ if (projectId != null) {
10387
+ queryParams.set("project_id", String(projectId));
10388
+ }
10381
10389
  const url = `${domain}/autoql/api/v1/dashboards/${dashboardId}/tiles/${tileKey}/query?${queryParams.toString()}`;
10382
10390
  const config = {
10383
10391
  headers: {
@@ -10418,7 +10426,8 @@ var runCachedDashboardQueryPost = async ({
10418
10426
  queryIndex,
10419
10427
  tileKey,
10420
10428
  dashboardId,
10421
- force
10429
+ force,
10430
+ projectId
10422
10431
  } = {}) => {
10423
10432
  if (!dashboardId) {
10424
10433
  console.error("No dashboard ID supplied in request");
@@ -10442,7 +10451,8 @@ var runCachedDashboardQueryPost = async ({
10442
10451
  const data = {
10443
10452
  query_index: (queryIndex || 0).toString(),
10444
10453
  force,
10445
- session_filter_locks: filters
10454
+ session_filter_locks: filters,
10455
+ project_id: projectId
10446
10456
  };
10447
10457
  const url = `${domain}/autoql/api/v1/dashboards/${dashboardId}/tiles/${tileKey}/query?${queryParams.toString()}`;
10448
10458
  const config = {
@@ -12226,8 +12236,8 @@ function formatDecimal_default(x) {
12226
12236
  return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
12227
12237
  }
12228
12238
  function formatDecimalParts(x, p) {
12229
- if (!isFinite(x) || x === 0) return null;
12230
- var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
12239
+ if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null;
12240
+ var i, coefficient = x.slice(0, i);
12231
12241
  return [
12232
12242
  coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
12233
12243
  +x.slice(i + 1)
@@ -12321,7 +12331,7 @@ function formatTrim_default(s) {
12321
12331
  var prefixExponent;
12322
12332
  function formatPrefixAuto_default(x, p) {
12323
12333
  var d = formatDecimalParts(x, p);
12324
- if (!d) return prefixExponent = void 0, x.toPrecision(p);
12334
+ if (!d) return x + "";
12325
12335
  var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
12326
12336
  return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
12327
12337
  }
@@ -12361,13 +12371,13 @@ var map = Array.prototype.map;
12361
12371
  var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
12362
12372
  function locale_default(locale2) {
12363
12373
  var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
12364
- function newFormat(specifier, options) {
12374
+ function newFormat(specifier) {
12365
12375
  specifier = formatSpecifier(specifier);
12366
12376
  var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol2 = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
12367
12377
  if (type === "n") comma = true, type = "g";
12368
12378
  else if (!formatTypes_default[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
12369
12379
  if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
12370
- var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol2 === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : "");
12380
+ var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
12371
12381
  var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type);
12372
12382
  precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
12373
12383
  function format2(value) {
@@ -12382,7 +12392,7 @@ function locale_default(locale2) {
12382
12392
  if (trim) value = formatTrim_default(value);
12383
12393
  if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
12384
12394
  valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
12385
- valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
12395
+ valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
12386
12396
  if (maybeSuffix) {
12387
12397
  i = -1, n = value.length;
12388
12398
  while (++i < n) {
@@ -12419,9 +12429,9 @@ function locale_default(locale2) {
12419
12429
  return format2;
12420
12430
  }
12421
12431
  function formatPrefix2(specifier, value) {
12422
- var e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
12432
+ var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
12423
12433
  return function(value2) {
12424
- return f(k * value2);
12434
+ return f(k * value2) + prefix;
12425
12435
  };
12426
12436
  }
12427
12437
  return {