@quillsql/react 2.16.49 → 2.16.51

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.cjs CHANGED
@@ -33,6 +33,89 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
+ // src/utils/textProcessing.ts
37
+ function capitalize(text) {
38
+ return text.charAt(0).toUpperCase() + text.slice(1);
39
+ }
40
+ function matchCasing(text, template) {
41
+ if (!text || !template) {
42
+ return text ?? "";
43
+ }
44
+ const isTitleCase = (str) => /^[A-Z][a-z]*([A-Z][a-z]*)*$/.test(str);
45
+ const isCamelCase = (str) => /^[a-z]+([A-Z][a-z]*)*$/.test(str);
46
+ const isSnakeCase = (str) => /^[a-z0-9]+(_[a-z0-9]+)*$/.test(str);
47
+ const isAllLowerCase = (str) => /^[a-z]+$/.test(str);
48
+ const isAllUpperCase = (str) => /^[A-Z]+$/.test(str);
49
+ const isCapitalized = (str) => /^[A-Z][a-z]*$/.test(str);
50
+ const isScreamingSnakeCase = (str) => /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/.test(str);
51
+ const toTitleCase = (str) => str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
52
+ const toCamelCase = (str) => str.replace(/_./g, (match) => match.charAt(1).toUpperCase()).toLowerCase();
53
+ const toSnakeCase = (str) => str.replace(/[A-Z]/g, (match) => `_${match.toLowerCase()}`);
54
+ const toLowerCase = (str) => str.toLowerCase();
55
+ const toUpperCase = (str) => str.toUpperCase();
56
+ const toCapitalized = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
57
+ const toScreamingSnakeCase = (str) => str.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toUpperCase();
58
+ if (isTitleCase(template)) {
59
+ return toTitleCase(text);
60
+ } else if (isCamelCase(template)) {
61
+ return toCamelCase(text);
62
+ } else if (isSnakeCase(template)) {
63
+ return toSnakeCase(text);
64
+ } else if (isAllLowerCase(template)) {
65
+ return toLowerCase(text);
66
+ } else if (isAllUpperCase(template)) {
67
+ return toUpperCase(text);
68
+ } else if (isCapitalized(template)) {
69
+ return toCapitalized(text);
70
+ } else if (isScreamingSnakeCase(template)) {
71
+ return toScreamingSnakeCase(text);
72
+ } else {
73
+ return text;
74
+ }
75
+ }
76
+ function snakeCaseToTitleCase(str) {
77
+ if (!str) {
78
+ return str;
79
+ }
80
+ return str.toString().split(/_| /).map(
81
+ (word) => word === "id" ? "ID" : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
82
+ ).join(" ");
83
+ }
84
+ function snakeAndCamelCaseToTitleCase(str) {
85
+ if (!str || typeof str !== "string") {
86
+ return str;
87
+ }
88
+ if (str.includes("_")) {
89
+ return str.split(/_| /).map((word) => word === "id" ? "ID" : capitalize(word)).join(" ");
90
+ } else {
91
+ const text = str.replace(/([a-z])([A-Z])/g, "$1 $2");
92
+ const newText = text.split(" ").map((word) => word === "Id" || word === "id" ? "ID" : capitalize(word)).join(" ");
93
+ return newText;
94
+ }
95
+ }
96
+ function formatIdentifierLabel(str) {
97
+ if (!str || typeof str !== "string") {
98
+ return str;
99
+ }
100
+ const hasUnderscore = str.includes("_");
101
+ const hasCamelCaseBoundary = /[a-z0-9][A-Z]/.test(str);
102
+ if (hasUnderscore || hasCamelCaseBoundary) {
103
+ return snakeAndCamelCaseToTitleCase(str);
104
+ }
105
+ return str;
106
+ }
107
+ function removeDoubleQuotes(str) {
108
+ if (!str) {
109
+ return str;
110
+ }
111
+ return str.replace(/"/g, "");
112
+ }
113
+ var init_textProcessing = __esm({
114
+ "src/utils/textProcessing.ts"() {
115
+ "use strict";
116
+ }
117
+ });
118
+
36
119
  // src/utils/valueFormatter.ts
37
120
  function parseNumber(value) {
38
121
  if (typeof value === "number") return value;
@@ -59,6 +142,7 @@ var init_valueFormatter = __esm({
59
142
  "use strict";
60
143
  import_date_fns = require("date-fns");
61
144
  import_date_fns_tz = require("date-fns-tz");
145
+ init_textProcessing();
62
146
  DATE_FORMAT_TYPES = [
63
147
  "yyyy",
64
148
  "MMM_yyyy",
@@ -221,7 +305,7 @@ var init_valueFormatter = __esm({
221
305
  if (typeof value === "object") {
222
306
  return JSON.stringify(value);
223
307
  }
224
- return value.toString();
308
+ return formatIdentifierLabel(value.toString());
225
309
  };
226
310
  formatterDollar = new Intl.NumberFormat("en-US", {
227
311
  style: "currency",
@@ -494,78 +578,6 @@ var init_ast = __esm({
494
578
  }
495
579
  });
496
580
 
497
- // src/utils/textProcessing.ts
498
- function capitalize(text) {
499
- return text.charAt(0).toUpperCase() + text.slice(1);
500
- }
501
- function matchCasing(text, template) {
502
- if (!text || !template) {
503
- return text ?? "";
504
- }
505
- const isTitleCase = (str) => /^[A-Z][a-z]*([A-Z][a-z]*)*$/.test(str);
506
- const isCamelCase = (str) => /^[a-z]+([A-Z][a-z]*)*$/.test(str);
507
- const isSnakeCase = (str) => /^[a-z0-9]+(_[a-z0-9]+)*$/.test(str);
508
- const isAllLowerCase = (str) => /^[a-z]+$/.test(str);
509
- const isAllUpperCase = (str) => /^[A-Z]+$/.test(str);
510
- const isCapitalized = (str) => /^[A-Z][a-z]*$/.test(str);
511
- const isScreamingSnakeCase = (str) => /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/.test(str);
512
- const toTitleCase = (str) => str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
513
- const toCamelCase = (str) => str.replace(/_./g, (match) => match.charAt(1).toUpperCase()).toLowerCase();
514
- const toSnakeCase = (str) => str.replace(/[A-Z]/g, (match) => `_${match.toLowerCase()}`);
515
- const toLowerCase = (str) => str.toLowerCase();
516
- const toUpperCase = (str) => str.toUpperCase();
517
- const toCapitalized = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
518
- const toScreamingSnakeCase = (str) => str.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toUpperCase();
519
- if (isTitleCase(template)) {
520
- return toTitleCase(text);
521
- } else if (isCamelCase(template)) {
522
- return toCamelCase(text);
523
- } else if (isSnakeCase(template)) {
524
- return toSnakeCase(text);
525
- } else if (isAllLowerCase(template)) {
526
- return toLowerCase(text);
527
- } else if (isAllUpperCase(template)) {
528
- return toUpperCase(text);
529
- } else if (isCapitalized(template)) {
530
- return toCapitalized(text);
531
- } else if (isScreamingSnakeCase(template)) {
532
- return toScreamingSnakeCase(text);
533
- } else {
534
- return text;
535
- }
536
- }
537
- function snakeCaseToTitleCase(str) {
538
- if (!str) {
539
- return str;
540
- }
541
- return str.toString().split(/_| /).map(
542
- (word) => word === "id" ? "ID" : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
543
- ).join(" ");
544
- }
545
- function snakeAndCamelCaseToTitleCase(str) {
546
- if (!str || typeof str !== "string") {
547
- return str;
548
- }
549
- if (str.includes("_")) {
550
- return str.split(/_| /).map((word) => word === "id" ? "ID" : capitalize(word)).join(" ");
551
- } else {
552
- const text = str.replace(/([a-z])([A-Z])/g, "$1 $2");
553
- const newText = text.split(" ").map((word) => word === "Id" || word === "id" ? "ID" : capitalize(word)).join(" ");
554
- return newText;
555
- }
556
- }
557
- function removeDoubleQuotes(str) {
558
- if (!str) {
559
- return str;
560
- }
561
- return str.replace(/"/g, "");
562
- }
563
- var init_textProcessing = __esm({
564
- "src/utils/textProcessing.ts"() {
565
- "use strict";
566
- }
567
- });
568
-
569
581
  // src/components/ReportBuilder/bigDateMap.ts
570
582
  function cleanDateFieldName(fieldName) {
571
583
  if (!fieldName) return void 0;
@@ -15085,6 +15097,63 @@ function getDateString(value, dateRange, dateBucket, databaseType) {
15085
15097
  function isDateField(fieldType) {
15086
15098
  return fieldType === "date" || fieldType === "datetime" || fieldType === "timestamp" || fieldType === "timestamptz" || fieldType === "yyyy" || fieldType === "MMM_yyyy" || fieldType === "MMM_dd" || fieldType === "MMM_dd_yyyy" || fieldType === "MMM_dd_hh:mm_ap_pm" || fieldType === "hh_ap_pm";
15087
15099
  }
15100
+ function getExclusiveDateBucketRange(startInput, bucket) {
15101
+ const parsed = startInput instanceof Date ? startInput : new Date(startInput);
15102
+ if (Number.isNaN(parsed.getTime())) {
15103
+ throw new Error(`Invalid bucket start date: ${String(startInput)}`);
15104
+ }
15105
+ let start;
15106
+ let endExclusive;
15107
+ switch (bucket) {
15108
+ case "day": {
15109
+ start = new Date(
15110
+ Date.UTC(
15111
+ parsed.getUTCFullYear(),
15112
+ parsed.getUTCMonth(),
15113
+ parsed.getUTCDate()
15114
+ )
15115
+ );
15116
+ endExclusive = new Date(start);
15117
+ endExclusive.setUTCDate(endExclusive.getUTCDate() + 1);
15118
+ break;
15119
+ }
15120
+ case "week": {
15121
+ const day = parsed.getUTCDay();
15122
+ start = new Date(
15123
+ Date.UTC(
15124
+ parsed.getUTCFullYear(),
15125
+ parsed.getUTCMonth(),
15126
+ parsed.getUTCDate() - (day + 6) % 7
15127
+ )
15128
+ );
15129
+ endExclusive = new Date(start);
15130
+ endExclusive.setUTCDate(endExclusive.getUTCDate() + 7);
15131
+ break;
15132
+ }
15133
+ case "month": {
15134
+ start = new Date(
15135
+ Date.UTC(parsed.getUTCFullYear(), parsed.getUTCMonth(), 1)
15136
+ );
15137
+ endExclusive = new Date(
15138
+ Date.UTC(parsed.getUTCFullYear(), parsed.getUTCMonth() + 1, 1)
15139
+ );
15140
+ break;
15141
+ }
15142
+ case "year": {
15143
+ start = new Date(Date.UTC(parsed.getUTCFullYear(), 0, 1));
15144
+ endExclusive = new Date(Date.UTC(parsed.getUTCFullYear() + 1, 0, 1));
15145
+ break;
15146
+ }
15147
+ default: {
15148
+ const _exhaustive = bucket;
15149
+ throw new Error(`Unsupported date bucket: ${String(_exhaustive)}`);
15150
+ }
15151
+ }
15152
+ return {
15153
+ start: start.toISOString(),
15154
+ endExclusive: endExclusive.toISOString()
15155
+ };
15156
+ }
15088
15157
  var import_date_fns5;
15089
15158
  var init_dates = __esm({
15090
15159
  "src/utils/dates.ts"() {
@@ -17206,7 +17275,7 @@ async function generatePivotWithSQL({
17206
17275
  client,
17207
17276
  task: "pivot-template",
17208
17277
  metadata: {
17209
- clientId: client.clientId,
17278
+ clientId: client.id,
17210
17279
  pivot: pivotConfig,
17211
17280
  reportId: report?.id !== "__quillTempReport" ? report?.id : void 0,
17212
17281
  itemQuery: reportBuilderState ? void 0 : report?.queryString,
@@ -19032,7 +19101,7 @@ var init_tableProcessing = __esm({
19032
19101
  metadata: {
19033
19102
  reportBuilderState,
19034
19103
  stringColumns: stringColumns.map((col) => col.field),
19035
- clientId: client.clientId,
19104
+ clientId: client.id,
19036
19105
  databaseType: client.databaseType?.toLowerCase() || "postgresql",
19037
19106
  customFields,
19038
19107
  filters: void 0,
@@ -19223,7 +19292,7 @@ var init_tableProcessing = __esm({
19223
19292
  metadata: {
19224
19293
  reportBuilderState,
19225
19294
  columns: stringNames,
19226
- clientId: client.publicKey,
19295
+ clientId: client.id,
19227
19296
  databaseType: client.databaseType,
19228
19297
  customFieldsByTable: customFields,
19229
19298
  useNewNodeSql: true,
@@ -19238,7 +19307,7 @@ var init_tableProcessing = __esm({
19238
19307
  task: "query",
19239
19308
  metadata: {
19240
19309
  query: countQuery,
19241
- clientId: client.publicKey,
19310
+ clientId: client.id,
19242
19311
  databaseType: client.databaseType,
19243
19312
  customFieldsByTable: customFields,
19244
19313
  useNewNodeSql: true,
@@ -19298,7 +19367,7 @@ var init_tableProcessing = __esm({
19298
19367
  metadata: {
19299
19368
  reportBuilderState,
19300
19369
  stringColumns: columns,
19301
- clientId: client.clientId,
19370
+ clientId: client.id,
19302
19371
  databaseType: client.databaseType?.toLowerCase() || "postgresql",
19303
19372
  customFields,
19304
19373
  filters,
@@ -19348,7 +19417,7 @@ var init_tableProcessing = __esm({
19348
19417
  task: "query",
19349
19418
  metadata: {
19350
19419
  query,
19351
- clientId: client.publicKey,
19420
+ clientId: client.id,
19352
19421
  databaseType: client.databaseType,
19353
19422
  customFieldsByTable: customFields,
19354
19423
  useNewNodeSql: true,
@@ -19460,7 +19529,7 @@ var init_tableProcessing = __esm({
19460
19529
  task: "query",
19461
19530
  metadata: {
19462
19531
  query,
19463
- clientId: client.publicKey,
19532
+ clientId: client.id,
19464
19533
  databaseType: client.databaseType,
19465
19534
  customFieldsByTable: customFields,
19466
19535
  useNewNodeSql: true,
@@ -19589,7 +19658,7 @@ var init_tableProcessing = __esm({
19589
19658
  metadata: {
19590
19659
  query,
19591
19660
  filterMap,
19592
- clientId: client.publicKey,
19661
+ clientId: client.id,
19593
19662
  databaseType: client?.databaseType,
19594
19663
  customFieldsByTable: customFields,
19595
19664
  additionalProcessing: processing,
@@ -19624,7 +19693,7 @@ var init_tableProcessing = __esm({
19624
19693
  task: "log-broken-query",
19625
19694
  metadata: {
19626
19695
  query,
19627
- clientId: client.clientId,
19696
+ clientId: client.id,
19628
19697
  error: parsingError
19629
19698
  },
19630
19699
  getToken
@@ -19735,7 +19804,7 @@ var init_tableProcessing = __esm({
19735
19804
  metadata: {
19736
19805
  dashboardItemId: reportId,
19737
19806
  filters: minimalFilters,
19738
- clientId: client?.publicKey,
19807
+ clientId: client?.id,
19739
19808
  databaseType: client?.databaseType,
19740
19809
  additionalProcessing: updatedProcessing,
19741
19810
  forcePagination: true,
@@ -19808,7 +19877,7 @@ var init_tableProcessing = __esm({
19808
19877
  rowCountOnly,
19809
19878
  customFields,
19810
19879
  tenants,
19811
- clientId: client.clientId,
19880
+ clientId: client.id,
19812
19881
  databaseType: client.databaseType?.toLowerCase() || "postgresql",
19813
19882
  dashboardName,
19814
19883
  ...reportId ? {
@@ -19946,27 +20015,6 @@ function parseData(rows, queryType) {
19946
20015
  return rows;
19947
20016
  }
19948
20017
  }
19949
- function isQuillFetchDebugEnabled() {
19950
- if (typeof globalThis !== "undefined") {
19951
- for (const debugFlag of QUILL_FETCH_DEBUG_FLAGS) {
19952
- if (globalThis?.[debugFlag] === true) {
19953
- return true;
19954
- }
19955
- }
19956
- }
19957
- if (typeof process !== "undefined" && typeof process.env !== "undefined") {
19958
- const envCandidates = [
19959
- process?.env?.QUILL_DEBUG_USEFORM_HYDRATION,
19960
- process?.env?.QUILL_DEBUG_USEFORM_FILTERS,
19961
- process?.env?.QUILL_DEBUG_DATA_FETCHER
19962
- ];
19963
- return envCandidates.some((candidate) => {
19964
- const normalized = String(candidate ?? "").trim().toLowerCase();
19965
- return normalized === "1" || normalized === "true";
19966
- });
19967
- }
19968
- return false;
19969
- }
19970
20018
  async function testSqlViewState(client, referencedTables, getToken) {
19971
20019
  let errorMessage = null;
19972
20020
  await Promise.all(
@@ -19979,7 +20027,7 @@ async function testSqlViewState(client, referencedTables, getToken) {
19979
20027
  task: "test-view",
19980
20028
  metadata: {
19981
20029
  tables: [table],
19982
- clientId: client.clientId
20030
+ clientId: client.id
19983
20031
  },
19984
20032
  getToken
19985
20033
  });
@@ -19988,7 +20036,7 @@ async function testSqlViewState(client, referencedTables, getToken) {
19988
20036
  metadata: {
19989
20037
  table,
19990
20038
  task: "set-broken-view",
19991
- clientId: client.clientId
20039
+ clientId: client.id
19992
20040
  }
19993
20041
  };
19994
20042
  quillFetch({
@@ -20098,7 +20146,7 @@ async function* quillStream({
20098
20146
  body: JSON.stringify({
20099
20147
  metadata: {
20100
20148
  task,
20101
- clientId: client.clientId,
20149
+ clientId: client.id,
20102
20150
  ...metadata
20103
20151
  }
20104
20152
  }),
@@ -20327,7 +20375,7 @@ async function getData(client, cloudQueryEndpoint, noCred, hostedRequestBody, cl
20327
20375
  body: method === "POST" ? JSON.stringify({
20328
20376
  ...cloudRequestBody,
20329
20377
  ...{
20330
- publicKey: client?.publicKey
20378
+ publicKey: client?.id
20331
20379
  }
20332
20380
  }) : null,
20333
20381
  signal: abortSignal
@@ -20356,7 +20404,7 @@ async function fetchSqlQuery(ast, client, getToken, formData) {
20356
20404
  client,
20357
20405
  task: "sqlify",
20358
20406
  metadata: {
20359
- clientId: client.clientId,
20407
+ clientId: client.id,
20360
20408
  useNewNodeSql: true,
20361
20409
  ast: { ...ast, where }
20362
20410
  },
@@ -20377,7 +20425,7 @@ async function fetchSqlQueryFromState(reportBuilderState, client, getToken, data
20377
20425
  client,
20378
20426
  task: "sqlify",
20379
20427
  metadata: {
20380
- clientId: client.clientId,
20428
+ clientId: client.id,
20381
20429
  useNewNodeSql: true,
20382
20430
  ast
20383
20431
  },
@@ -20394,7 +20442,7 @@ async function fetchQueryDateRangesFromState(reportBuilderState, columns, client
20394
20442
  client,
20395
20443
  task: "report-builder-date-ranges",
20396
20444
  metadata: {
20397
- clientId: client.clientId,
20445
+ clientId: client.id,
20398
20446
  reportBuilderState,
20399
20447
  dateColumns: columns,
20400
20448
  databaseType: databaseType || "postgresql",
@@ -20452,7 +20500,7 @@ async function fetchRelevantInfoFromState(reportBuilderState, tables, columns, a
20452
20500
  return { error: error.message };
20453
20501
  }
20454
20502
  }
20455
- var QUILL_FETCH_DEBUG_FLAGS, quillFetchDebugSeq, logQuillFetchDebug, quillFetch, parseFetchResponse;
20503
+ var quillFetch, parseFetchResponse;
20456
20504
  var init_dataFetcher = __esm({
20457
20505
  "src/utils/dataFetcher.tsx"() {
20458
20506
  "use strict";
@@ -20461,16 +20509,6 @@ var init_dataFetcher = __esm({
20461
20509
  init_tableProcessing();
20462
20510
  init_dates();
20463
20511
  init_changelogNotify();
20464
- QUILL_FETCH_DEBUG_FLAGS = [
20465
- "__QUILL_DEBUG_USEFORM_HYDRATION__",
20466
- "__QUILL_DEBUG_USEFORM_FILTERS__",
20467
- "__QUILL_DEBUG_DATA_FETCHER__"
20468
- ];
20469
- quillFetchDebugSeq = 0;
20470
- logQuillFetchDebug = (label, payload) => {
20471
- if (!isQuillFetchDebugEnabled()) return;
20472
- console.log(`[quillFetch-debug] ${label}`, payload);
20473
- };
20474
20512
  quillFetch = async ({
20475
20513
  client,
20476
20514
  task,
@@ -20481,24 +20519,7 @@ var init_dataFetcher = __esm({
20481
20519
  urlParameters,
20482
20520
  getToken
20483
20521
  }) => {
20484
- const debugSeq = ++quillFetchDebugSeq;
20485
- const debugStart = Date.now();
20486
- logQuillFetchDebug("request", {
20487
- seq: debugSeq,
20488
- task,
20489
- reportId: metadata?.reportId,
20490
- dashboardItemId: metadata?.dashboardItemId,
20491
- hasPivot: Boolean(metadata?.pivot),
20492
- hasReportBuilderState: Boolean(metadata?.reportBuilderState),
20493
- filtersLength: Array.isArray(metadata?.filters) ? metadata.filters.length : void 0
20494
- });
20495
20522
  const token = await getToken();
20496
- logQuillFetchDebug("token-acquired", {
20497
- seq: debugSeq,
20498
- task,
20499
- ms: Date.now() - debugStart,
20500
- hasToken: Boolean(token)
20501
- });
20502
20523
  const queryString = urlParameters ?? `task=${task}`;
20503
20524
  const endpoint = client.queryEndpoint ? `${client.queryEndpoint}?${queryString}` : `${QUILL_SERVER}${QUILL_QUERY_ENDPOINT}?${queryString}`;
20504
20525
  try {
@@ -20512,7 +20533,7 @@ var init_dataFetcher = __esm({
20512
20533
  body: JSON.stringify({
20513
20534
  metadata: {
20514
20535
  task,
20515
- clientId: client.clientId,
20536
+ clientId: client.id ?? client.clientId,
20516
20537
  ...metadata
20517
20538
  }
20518
20539
  }),
@@ -20530,17 +20551,6 @@ var init_dataFetcher = __esm({
20530
20551
  if (task !== "fetch-changelog-list" && Array.isArray(normalizedData?.changelogs)) {
20531
20552
  notifyChangelogs(normalizedData.changelogs);
20532
20553
  }
20533
- logQuillFetchDebug("response", {
20534
- seq: debugSeq,
20535
- task,
20536
- ms: Date.now() - debugStart,
20537
- status: result.status,
20538
- error: result.error,
20539
- dataError: normalizedData?.error,
20540
- queryResultRowCounts: Array.isArray(result.queries?.queryResults) ? result.queries.queryResults.map(
20541
- (qr) => Array.isArray(qr?.rows) ? qr.rows.length : null
20542
- ) : void 0
20543
- });
20544
20554
  return {
20545
20555
  data: normalizedData,
20546
20556
  queries: result.queries,
@@ -20549,19 +20559,8 @@ var init_dataFetcher = __esm({
20549
20559
  };
20550
20560
  } catch (e) {
20551
20561
  if (e instanceof Error && e.name === "AbortError") {
20552
- logQuillFetchDebug("aborted", {
20553
- seq: debugSeq,
20554
- task,
20555
- ms: Date.now() - debugStart
20556
- });
20557
20562
  throw e;
20558
20563
  }
20559
- logQuillFetchDebug("threw", {
20560
- seq: debugSeq,
20561
- task,
20562
- ms: Date.now() - debugStart,
20563
- message: e instanceof Error ? e.message : String(e)
20564
- });
20565
20564
  if (task !== "set-section-order") {
20566
20565
  console.error("Failed to fetch:", e);
20567
20566
  }
@@ -21030,6 +21029,7 @@ __export(index_exports, {
21030
21029
  isQueryBuilderDisplayRule: () => isQueryBuilderDisplayRule,
21031
21030
  normalizeRelativeDateRules: () => normalizeRelativeDateRules,
21032
21031
  prepareQueryBuilderFiltersForSet: () => prepareQueryBuilderFiltersForSet,
21032
+ queryBuilderFiltersForEditor: () => queryBuilderFiltersForEditor,
21033
21033
  quillFetch: () => quillFetch,
21034
21034
  stripQueryBuilderTransientFields: () => stripQueryBuilderTransientFields,
21035
21035
  tableColumnFormatFromUiSelection: () => tableColumnFormatFromUiSelection,
@@ -21530,7 +21530,7 @@ async function getDashboard(dashboardName, client, getToken, tenants, flags) {
21530
21530
  task: "dashboard",
21531
21531
  metadata: {
21532
21532
  name: dashboardName,
21533
- clientId: client.publicKey,
21533
+ clientId: client.id,
21534
21534
  databaseType: client.databaseType,
21535
21535
  useNewNodeSql: true,
21536
21536
  tenants,
@@ -21905,7 +21905,7 @@ function createPivotTemplateMetadata({
21905
21905
  reportId,
21906
21906
  dashboardItemId: reportId,
21907
21907
  ...draftSessionId ? { draftSessionId: String(draftSessionId).trim() } : {},
21908
- clientId: client.publicKey,
21908
+ clientId: client.id,
21909
21909
  databaseType: client.databaseType,
21910
21910
  filters: removeFilterOptions(filters),
21911
21911
  additionalProcessing: normalizedAdditionalProcessing,
@@ -22222,7 +22222,7 @@ async function fetchReportRows({
22222
22222
  task: "report",
22223
22223
  metadata: {
22224
22224
  reportId,
22225
- clientId: client.publicKey,
22225
+ clientId: client.id,
22226
22226
  databaseType: client.databaseType,
22227
22227
  filters: filters.map((filter) => ({ ...filter, options: void 0 })),
22228
22228
  useNewNodeSql: true,
@@ -22292,7 +22292,7 @@ async function fetchReport({
22292
22292
  reportId,
22293
22293
  dashboardItemId: reportId,
22294
22294
  ...draftSessionId ? { draftSessionId: String(draftSessionId).trim() } : {},
22295
- clientId: client.publicKey,
22295
+ clientId: client.id,
22296
22296
  databaseType: client.databaseType,
22297
22297
  filters: filters.map((filter) => ({ ...filter, options: void 0 })),
22298
22298
  customFields,
@@ -22429,7 +22429,7 @@ async function fetchReportName({
22429
22429
  task: "report-name",
22430
22430
  metadata: {
22431
22431
  reportId,
22432
- clientId: client.publicKey,
22432
+ clientId: client.id,
22433
22433
  databaseType: client.databaseType,
22434
22434
  tenants
22435
22435
  },
@@ -22453,7 +22453,7 @@ async function fetchReportRowCount(reportId, client, getToken, tenants, flags, u
22453
22453
  metadata: {
22454
22454
  reportId,
22455
22455
  dashboardItemId: reportId,
22456
- clientId: client.publicKey,
22456
+ clientId: client.id,
22457
22457
  databaseType: client.databaseType,
22458
22458
  filters: filters.map((filter) => ({ ...filter, options: void 0 })),
22459
22459
  customFields,
@@ -22483,7 +22483,7 @@ async function saveReport({
22483
22483
  tenants,
22484
22484
  draftSessionId
22485
22485
  }) {
22486
- const { publicKey, databaseType } = client;
22486
+ const { id, databaseType } = client;
22487
22487
  const {
22488
22488
  reportBuilderState,
22489
22489
  queryString,
@@ -22523,7 +22523,7 @@ async function saveReport({
22523
22523
  ...dashboardItemId ? { reportId: dashboardItemId } : {},
22524
22524
  ...draftSessionId ? { draftSessionId: String(draftSessionId).trim() } : {},
22525
22525
  // Remove useNewNodeSql since backend will handle conversion
22526
- clientId: publicKey,
22526
+ clientId: id,
22527
22527
  tenants,
22528
22528
  // Only include adminMode for 'create' task, not 'create-report'
22529
22529
  ...isCreateTask && { adminMode },
@@ -23337,7 +23337,6 @@ var getSchemaInfo = async ({
23337
23337
  getToken,
23338
23338
  eventTracking
23339
23339
  }) => {
23340
- const { publicKey } = client;
23341
23340
  let customFieldsByTableUnique = null;
23342
23341
  if (client.featureFlags?.customFieldsEnabled && tenants && tenants[0] !== "QUILL_ALL_TENANTS" && tenants.length === 1 && (typeof tenants[0] !== "object" || tenants[0].tenantIds?.[0] !== "QUILL_ALL_TENANTS" && tenants[0].tenantIds?.length === 1)) {
23343
23342
  try {
@@ -23356,13 +23355,13 @@ var getSchemaInfo = async ({
23356
23355
  client,
23357
23356
  task: "schema",
23358
23357
  metadata: {
23359
- clientId: publicKey,
23358
+ clientId: client.id,
23360
23359
  removeCustomerField: true,
23361
23360
  removeCustomFieldRef: true,
23362
23361
  tableIds,
23363
23362
  customFieldsByTable: customFieldsByTableUnique,
23364
23363
  useNewCustomFields: true,
23365
- gatherSchemaData: "665610862cf7a3000be66453" === publicKey ? true : false,
23364
+ gatherSchemaData: "665610862cf7a3000be66453" === client.id ? true : false,
23366
23365
  // TODO: this should be a feature flag on the client
23367
23366
  tenants
23368
23367
  },
@@ -24461,7 +24460,7 @@ var CacheCab = class {
24461
24460
  task: "report",
24462
24461
  metadata: {
24463
24462
  reportId,
24464
- clientId: client.publicKey,
24463
+ clientId: client.id,
24465
24464
  databaseType: client.databaseType,
24466
24465
  filters: adjusted,
24467
24466
  additionalProcessing: { page: { rowsPerPage: 1e3, rowsPerRequest: 1e5 } },
@@ -24600,7 +24599,7 @@ var CacheCab = class {
24600
24599
  );
24601
24600
  const keyParts = [
24602
24601
  reportId,
24603
- client.publicKey,
24602
+ client.id,
24604
24603
  client.databaseType,
24605
24604
  hashString(stableStringify(canonicalizeForKey(tenants ?? null))),
24606
24605
  hashString(stableStringify(canonicalizeForKey(flags ?? null))),
@@ -25238,12 +25237,11 @@ var ContextProvider = ({
25238
25237
  typeof window !== "undefined" && sessionStorage ? JSON.parse(sessionStorage.getItem("quill-client") ?? "null") : null
25239
25238
  );
25240
25239
  const populatedClient = (0, import_react.useMemo)(() => {
25241
- if (!client || client.clientId !== publicKey) return null;
25240
+ if (!client || client.id !== publicKey) return null;
25242
25241
  return {
25243
25242
  ...client,
25244
- publicKey,
25245
- _id: publicKey,
25246
25243
  id: publicKey,
25244
+ clientId: publicKey,
25247
25245
  queryHeaders,
25248
25246
  queryEndpoint,
25249
25247
  streamEndpoint,
@@ -25406,7 +25404,7 @@ var ContextProvider = ({
25406
25404
  try {
25407
25405
  const result = await quillFetch({
25408
25406
  client: {
25409
- clientId: publicKey,
25407
+ id: publicKey,
25410
25408
  queryEndpoint,
25411
25409
  queryHeaders,
25412
25410
  withCredentials: !!withCredentials
@@ -25528,7 +25526,7 @@ var ContextProvider = ({
25528
25526
  try {
25529
25527
  const resp = await quillFetch({
25530
25528
  client: {
25531
- clientId: publicKey,
25529
+ id: publicKey,
25532
25530
  queryEndpoint,
25533
25531
  queryHeaders,
25534
25532
  withCredentials: !!withCredentials
@@ -25536,7 +25534,7 @@ var ContextProvider = ({
25536
25534
  task: fetchRows ? "report" : "report-info",
25537
25535
  metadata: {
25538
25536
  reportId,
25539
- clientId: populatedClient.publicKey,
25537
+ clientId: populatedClient.id,
25540
25538
  useNewNodeSql: true,
25541
25539
  filters: filters?.map((f) => ({ ...f, options: void 0 })),
25542
25540
  additionalProcessing,
@@ -25719,7 +25717,7 @@ var ContextProvider = ({
25719
25717
  try {
25720
25718
  const result = await quillFetch({
25721
25719
  client: {
25722
- clientId: publicKey,
25720
+ id: publicKey,
25723
25721
  queryEndpoint,
25724
25722
  queryHeaders,
25725
25723
  withCredentials: !!withCredentials
@@ -25939,7 +25937,7 @@ var ContextProvider = ({
25939
25937
  });
25940
25938
  return curDashboardConfig;
25941
25939
  }
25942
- if (!populatedClient || !populatedClient.publicKey) {
25940
+ if (!populatedClient || !populatedClient.id) {
25943
25941
  return curDashboardConfig;
25944
25942
  }
25945
25943
  if (dashboardName === null || dashboardName === void 0)
@@ -26093,7 +26091,7 @@ var ContextProvider = ({
26093
26091
  try {
26094
26092
  const result = await quillFetch({
26095
26093
  client: {
26096
- clientId: publicKey2,
26094
+ id: publicKey2,
26097
26095
  queryEndpoint,
26098
26096
  queryHeaders,
26099
26097
  withCredentials: !!withCredentials
@@ -26636,8 +26634,7 @@ var ContextProvider = ({
26636
26634
  withCredentials: withCredentials ?? false,
26637
26635
  databaseType: envClient.databaseType,
26638
26636
  name: envClient.name,
26639
- clientId: publicKey2,
26640
- publicKey: publicKey2,
26637
+ id: publicKey2,
26641
26638
  featureFlags: envClient.featureFlags,
26642
26639
  clerkOrgId: envClient.clerkOrgId,
26643
26640
  allTenantTypes: hydratedTenantTypes
@@ -26709,16 +26706,16 @@ var ContextProvider = ({
26709
26706
  }, [publicKey]);
26710
26707
  (0, import_react.useEffect)(() => {
26711
26708
  if (!hasHandledInitialPopulatedClient.current) {
26712
- if (!populatedClient?.publicKey && !populatedClient?.currentTenants) {
26709
+ if (!populatedClient?.id && !populatedClient?.currentTenants) {
26713
26710
  return;
26714
26711
  }
26715
26712
  hasHandledInitialPopulatedClient.current = true;
26716
- currentPublicKey.current = populatedClient?.publicKey ?? null;
26713
+ currentPublicKey.current = populatedClient?.id ?? null;
26717
26714
  currentTenant.current = populatedClient?.currentTenants ?? null;
26718
26715
  return;
26719
26716
  }
26720
26717
  let publicKeyChanged = false;
26721
- if (populatedClient?.publicKey && currentPublicKey.current !== populatedClient?.publicKey) {
26718
+ if (populatedClient?.id && currentPublicKey.current !== populatedClient?.id) {
26722
26719
  publicKeyChanged = true;
26723
26720
  dispatch({ type: "CLEAR_DASHBOARDS" });
26724
26721
  dashboardFiltersDispatch({ type: "CLEAR_DASHBOARD_FILTERS" });
@@ -26727,7 +26724,7 @@ var ContextProvider = ({
26727
26724
  backfilledDashboards.current.clear();
26728
26725
  if (isAdmin) {
26729
26726
  setIsDashboardsLoading(true);
26730
- fetchDashboards(populatedClient?.publicKey);
26727
+ fetchDashboards(populatedClient?.id);
26731
26728
  } else {
26732
26729
  setIsDashboardsLoading(false);
26733
26730
  }
@@ -26759,17 +26756,17 @@ var ContextProvider = ({
26759
26756
  })
26760
26757
  );
26761
26758
  }
26762
- if (populatedClient?.currentTenants && populatedClient?.publicKey) {
26759
+ if (populatedClient?.currentTenants && populatedClient?.id) {
26763
26760
  const tenant = typeof populatedClient?.currentTenants[0] === "object" ? populatedClient?.currentTenants[0]?.tenantField : void 0;
26764
26761
  const tenantIds = tenant && typeof populatedClient?.currentTenants[0] === "object" ? populatedClient?.currentTenants[0]?.tenantIds : populatedClient?.currentTenants;
26765
26762
  eventTracking?.setUser?.({
26766
- clientId: populatedClient.publicKey,
26763
+ clientId: populatedClient.id,
26767
26764
  clerkOrgId: populatedClient.clerkOrgId,
26768
26765
  tenant,
26769
26766
  tenantIds
26770
26767
  });
26771
26768
  }
26772
- }, [populatedClient?.currentTenants, populatedClient?.publicKey]);
26769
+ }, [populatedClient?.currentTenants, populatedClient?.id]);
26773
26770
  if (!theme) {
26774
26771
  return null;
26775
26772
  }
@@ -27078,7 +27075,7 @@ var useDashboardInternal = (dashboardName, customFilters) => {
27078
27075
  });
27079
27076
  const body = {
27080
27077
  task: "set-section-order",
27081
- clientId: client.clientId,
27078
+ clientId: client.id,
27082
27079
  dashboardName,
27083
27080
  sectionOrder
27084
27081
  };
@@ -27306,7 +27303,7 @@ var useDashboards = () => {
27306
27303
  dateFilter,
27307
27304
  name: name2.trim(),
27308
27305
  task: "edit-dashboard",
27309
- clientId: clientId ?? client.clientId,
27306
+ clientId: clientId ?? client.id,
27310
27307
  tenantKeys: dashboardOwners
27311
27308
  };
27312
27309
  try {
@@ -27381,7 +27378,7 @@ var useDashboards = () => {
27381
27378
  initialCacheDateRange,
27382
27379
  name: name2.trim(),
27383
27380
  task: "edit-dashboard",
27384
- clientId: clientId ?? client.clientId,
27381
+ clientId: clientId ?? client.id,
27385
27382
  tenantKeys
27386
27383
  };
27387
27384
  try {
@@ -27559,7 +27556,7 @@ var useDashboards = () => {
27559
27556
  client,
27560
27557
  task: "delete-dashboard",
27561
27558
  metadata: {
27562
- clientId: client.clientId,
27559
+ clientId: client.id,
27563
27560
  databaseType: client.databaseType,
27564
27561
  name: name2
27565
27562
  }
@@ -28404,7 +28401,7 @@ async function getExportData(client, dashboardFilters, reportId, getToken, event
28404
28401
  metadata: {
28405
28402
  reportId,
28406
28403
  dashboardItemId: reportId,
28407
- clientId: client.publicKey,
28404
+ clientId: client.id,
28408
28405
  databaseType: client?.databaseType,
28409
28406
  filters: minimalFilters,
28410
28407
  useNewNodeSql: true,
@@ -29177,6 +29174,13 @@ function linspace(start, end, num) {
29177
29174
  }
29178
29175
  return result;
29179
29176
  }
29177
+ function stableColorIndex(field) {
29178
+ let hash = 0;
29179
+ for (const character of field.replace("comparison_", "")) {
29180
+ hash = Math.imul(hash, 31) + character.charCodeAt(0) >>> 0;
29181
+ }
29182
+ return hash;
29183
+ }
29180
29184
  function selectColor(element, colors, index) {
29181
29185
  if (!element?.field) return "gray";
29182
29186
  const isComparison = element.field.includes("comparison_");
@@ -31461,15 +31465,19 @@ var QuillPortal = ({
31461
31465
  };
31462
31466
 
31463
31467
  // src/components/Chart/CustomLegend.tsx
31468
+ init_textProcessing();
31464
31469
  var import_jsx_runtime27 = require("react/jsx-runtime");
31465
31470
  var getLegendLabel = (entry) => {
31466
31471
  const label = entry?.payload?.name ?? entry?.value ?? entry?.dataKey ?? "";
31467
- return typeof label === "string" ? label : String(label ?? "");
31472
+ return snakeAndCamelCaseToTitleCase(
31473
+ typeof label === "string" ? label : String(label ?? "")
31474
+ );
31468
31475
  };
31469
31476
  var LegendItem = ({
31470
31477
  entry,
31471
31478
  index,
31472
- theme
31479
+ theme,
31480
+ onClick
31473
31481
  }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
31474
31482
  "div",
31475
31483
  {
@@ -31478,30 +31486,37 @@ var LegendItem = ({
31478
31486
  alignItems: "baseline",
31479
31487
  marginRight: "1rem"
31480
31488
  },
31481
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "row", alignItems: "center" }, children: [
31482
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
31483
- "svg",
31484
- {
31485
- style: { marginRight: "0.5rem" },
31486
- width: "16",
31487
- height: "16",
31488
- viewBox: "0 0 16 16",
31489
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { width: "16", height: "16", rx: "3", fill: entry?.color })
31490
- }
31491
- ),
31492
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
31493
- "span",
31494
- {
31495
- style: {
31496
- color: theme?.secondaryTextColor,
31497
- fontFamily: theme?.fontFamily,
31498
- fontSize: theme?.fontSizeMedium || "14px",
31499
- whiteSpace: "nowrap"
31500
- },
31501
- children: getLegendLabel(entry)
31502
- }
31503
- )
31504
- ] })
31489
+ onClick: () => onClick ? onClick(entry) : void 0,
31490
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
31491
+ "div",
31492
+ {
31493
+ style: { display: "flex", flexDirection: "row", alignItems: "center" },
31494
+ children: [
31495
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
31496
+ "svg",
31497
+ {
31498
+ style: { marginRight: "0.5rem" },
31499
+ width: "16",
31500
+ height: "16",
31501
+ viewBox: "0 0 16 16",
31502
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { width: "16", height: "16", rx: "3", fill: entry?.color })
31503
+ }
31504
+ ),
31505
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
31506
+ "span",
31507
+ {
31508
+ style: {
31509
+ color: theme?.secondaryTextColor,
31510
+ fontFamily: theme?.fontFamily,
31511
+ fontSize: theme?.fontSizeMedium || "14px",
31512
+ whiteSpace: "nowrap"
31513
+ },
31514
+ children: getLegendLabel(entry)
31515
+ }
31516
+ )
31517
+ ]
31518
+ }
31519
+ )
31505
31520
  },
31506
31521
  `legend-${index}`
31507
31522
  );
@@ -31515,7 +31530,8 @@ var getOuterWidth = (element) => {
31515
31530
  };
31516
31531
  var RenderLegend = ({
31517
31532
  payload,
31518
- limit
31533
+ limit,
31534
+ onClickLegendElement
31519
31535
  }) => {
31520
31536
  const [theme] = (0, import_react12.useContext)(ThemeContext);
31521
31537
  const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
@@ -31528,7 +31544,10 @@ var RenderLegend = ({
31528
31544
  const safePayload = payload ?? [];
31529
31545
  const maxItems = limit ?? safePayload.length;
31530
31546
  const measuredLimit = visibleCount ?? maxItems;
31531
- const visiblePayload = safePayload.slice(0, Math.min(maxItems, measuredLimit));
31547
+ const visiblePayload = safePayload.slice(
31548
+ 0,
31549
+ Math.min(maxItems, measuredLimit)
31550
+ );
31532
31551
  const handleOpen = () => setIsOpen(true);
31533
31552
  const handleClose = () => setIsOpen(false);
31534
31553
  (0, import_react12.useLayoutEffect)(() => {
@@ -31589,7 +31608,6 @@ var RenderLegend = ({
31589
31608
  visibility: "hidden",
31590
31609
  height: 0,
31591
31610
  overflow: "hidden",
31592
- pointerEvents: "none",
31593
31611
  display: "flex",
31594
31612
  alignItems: "center",
31595
31613
  flexWrap: "nowrap",
@@ -31613,7 +31631,15 @@ var RenderLegend = ({
31613
31631
  ref: (element) => {
31614
31632
  itemRefs.current[index] = element;
31615
31633
  },
31616
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LegendItem, { entry, index, theme })
31634
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
31635
+ LegendItem,
31636
+ {
31637
+ entry,
31638
+ index,
31639
+ theme,
31640
+ onClick: onClickLegendElement
31641
+ }
31642
+ )
31617
31643
  },
31618
31644
  `legend-measure-${index}`
31619
31645
  ))
@@ -31654,7 +31680,8 @@ var RenderLegend = ({
31654
31680
  {
31655
31681
  entry,
31656
31682
  index,
31657
- theme
31683
+ theme,
31684
+ onClick: onClickLegendElement
31658
31685
  },
31659
31686
  `legend-${index}`
31660
31687
  ))
@@ -31701,7 +31728,8 @@ var RenderLegend = ({
31701
31728
  {
31702
31729
  entry,
31703
31730
  index,
31704
- theme
31731
+ theme,
31732
+ onClick: onClickLegendElement
31705
31733
  },
31706
31734
  `legend-popover-${index}`
31707
31735
  ))
@@ -31973,6 +32001,7 @@ var PieChartWrapper = import_react13.default.forwardRef(
31973
32001
  containerStyle,
31974
32002
  theme,
31975
32003
  onClickChartElement,
32004
+ onClickLegendElement,
31976
32005
  yAxisFields,
31977
32006
  showLegend = false,
31978
32007
  ...other
@@ -32069,7 +32098,13 @@ var PieChartWrapper = import_react13.default.forwardRef(
32069
32098
  paddingBottom: 20,
32070
32099
  fontFamily: theme?.fontFamily
32071
32100
  },
32072
- content: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RenderLegend, { limit: 5 })
32101
+ content: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32102
+ RenderLegend,
32103
+ {
32104
+ limit: 5,
32105
+ onClickLegendElement
32106
+ }
32107
+ )
32073
32108
  }
32074
32109
  ),
32075
32110
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -32704,6 +32739,7 @@ init_valueFormatter();
32704
32739
  // src/utils/axisFormatter.ts
32705
32740
  var import_date_fns11 = require("date-fns");
32706
32741
  var import_date_fns_tz4 = require("date-fns-tz");
32742
+ init_textProcessing();
32707
32743
  var axisFormatter = ({ value, field, fields }) => {
32708
32744
  if (field === void 0 || field === null) return "";
32709
32745
  if (value === void 0 || value === null) return "";
@@ -32753,7 +32789,7 @@ var formatString2 = (value) => {
32753
32789
  if (typeof value === "object") {
32754
32790
  return JSON.stringify(value);
32755
32791
  }
32756
- return value.toString();
32792
+ return formatIdentifierLabel(value.toString());
32757
32793
  };
32758
32794
  var formatterDecimal2 = new Intl.NumberFormat("en-US", {
32759
32795
  style: "decimal",
@@ -32960,6 +32996,7 @@ function ChartTooltipRow2({
32960
32996
  }
32961
32997
 
32962
32998
  // src/components/Chart/ChartTooltipGroup.tsx
32999
+ init_textProcessing();
32963
33000
  var import_jsx_runtime32 = require("react/jsx-runtime");
32964
33001
  function ChartTooltipGroup({
32965
33002
  name: name2,
@@ -32994,7 +33031,7 @@ function ChartTooltipGroup({
32994
33031
  paddingBottom: 2,
32995
33032
  textTransform: "capitalize"
32996
33033
  },
32997
- children: name2.replaceAll("_", " ").toLowerCase()
33034
+ children: formatIdentifierLabel(name2)
32998
33035
  }
32999
33036
  ),
33000
33037
  items.map(({ color, value, name: name3 }, idx) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -33015,6 +33052,7 @@ function ChartTooltipGroup({
33015
33052
 
33016
33053
  // src/components/Chart/ChartTooltip.tsx
33017
33054
  init_dates();
33055
+ init_textProcessing();
33018
33056
  var import_jsx_runtime33 = require("react/jsx-runtime");
33019
33057
  var ChartTooltipPrimary = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartTooltipFrame2, { theme: props.theme, children: [
33020
33058
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
@@ -33049,7 +33087,7 @@ var ChartTooltipPrimary = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.js
33049
33087
  paddingTop: 2,
33050
33088
  paddingBottom: 2
33051
33089
  },
33052
- children: !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : props.label
33090
+ children: !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : formatIdentifierLabel(props.label)
33053
33091
  }
33054
33092
  )
33055
33093
  }
@@ -33132,7 +33170,7 @@ function reformatComparisonPayload(props, primaryLabel, comparisonLabel) {
33132
33170
  return columnsByKey;
33133
33171
  }
33134
33172
  function getTooltipLabel(props, altTooltipLabel, isDateXAxis) {
33135
- return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : !isNaN(new Date(altTooltipLabel)) ? (0, import_date_fns12.format)(new Date(altTooltipLabel), "MMM yyyy") : altTooltipLabel : !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : props.label;
33173
+ return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : !isNaN(new Date(altTooltipLabel)) ? (0, import_date_fns12.format)(new Date(altTooltipLabel), "MMM yyyy") : formatIdentifierLabel(altTooltipLabel) : !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : formatIdentifierLabel(props.label);
33136
33174
  }
33137
33175
  function ChartTooltipComparison(props) {
33138
33176
  const isDateXAxis = isDateFormat2(props.xAxisFormat);
@@ -33388,6 +33426,7 @@ function CustomReferenceLine({
33388
33426
 
33389
33427
  // src/components/Chart/LineChart.tsx
33390
33428
  init_columnProcessing();
33429
+ init_textProcessing();
33391
33430
  var import_jsx_runtime35 = require("react/jsx-runtime");
33392
33431
  function createLineForEmptyChart(yAxisFields, dateFilter, xAxisField, xAxisFormat) {
33393
33432
  let lineChartData = [];
@@ -33424,6 +33463,8 @@ function LineChart({
33424
33463
  cartesianGridLineColor,
33425
33464
  onClickChartElement = () => {
33426
33465
  },
33466
+ onClickLegendElement = () => {
33467
+ },
33427
33468
  dateFilter,
33428
33469
  referenceLines,
33429
33470
  showLegend = false
@@ -33520,7 +33561,7 @@ function LineChart({
33520
33561
  paddingBottom: 20,
33521
33562
  fontFamily: theme?.fontFamily
33522
33563
  },
33523
- content: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderLegend, {})
33564
+ content: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderLegend, { onClickLegendElement })
33524
33565
  }
33525
33566
  ),
33526
33567
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
@@ -33608,7 +33649,9 @@ function LineChart({
33608
33649
  color: p.color || "black",
33609
33650
  chartType: "line",
33610
33651
  dataKey: p.dataKey?.toLocaleString() || "",
33611
- name: name2 || p.name?.toString() || "",
33652
+ name: snakeAndCamelCaseToTitleCase(
33653
+ name2 || p.name?.toString() || ""
33654
+ ),
33612
33655
  payload: p.payload || {},
33613
33656
  type: p.type || "none",
33614
33657
  unit: "string",
@@ -33701,6 +33744,7 @@ function LineChart({
33701
33744
  import_recharts2.Area,
33702
33745
  {
33703
33746
  type: "linear",
33747
+ name: elem.label || elem.field,
33704
33748
  dataKey: elem.field,
33705
33749
  stroke: getCustomColor(index, elem.field) ?? selectColor(elem, colors, index - numComparisons),
33706
33750
  fill: `url(#${uniqueId})`,
@@ -33723,6 +33767,7 @@ function LineChart({
33723
33767
  var import_recharts3 = require("recharts");
33724
33768
  var import_react16 = require("react");
33725
33769
  init_valueFormatter();
33770
+ init_textProcessing();
33726
33771
  var import_jsx_runtime36 = require("react/jsx-runtime");
33727
33772
  function RadarChart({
33728
33773
  colors,
@@ -33738,6 +33783,8 @@ function RadarChart({
33738
33783
  isAnimationActive = true,
33739
33784
  onClickChartElement = () => {
33740
33785
  },
33786
+ onClickLegendElement = () => {
33787
+ },
33741
33788
  dateFilter,
33742
33789
  showLegend = false
33743
33790
  }) {
@@ -33831,7 +33878,7 @@ function RadarChart({
33831
33878
  paddingBottom: 20,
33832
33879
  fontFamily: theme?.fontFamily
33833
33880
  },
33834
- content: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RenderLegend, {})
33881
+ content: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RenderLegend, { onClickLegendElement })
33835
33882
  }
33836
33883
  ),
33837
33884
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -33866,7 +33913,9 @@ function RadarChart({
33866
33913
  color: p.color || "black",
33867
33914
  chartType: "radar",
33868
33915
  dataKey: p.dataKey?.toLocaleString() || "",
33869
- name: name2 || p.name?.toString() || "",
33916
+ name: snakeAndCamelCaseToTitleCase(
33917
+ name2 || p.name?.toString() || ""
33918
+ ),
33870
33919
  payload: p.payload || {},
33871
33920
  type: p.type || "none",
33872
33921
  unit: "string",
@@ -33973,6 +34022,10 @@ var CustomBar = (0, import_react17.memo)((props) => {
33973
34022
  width: rawWidth,
33974
34023
  height: rawHeight,
33975
34024
  fill,
34025
+ fillOpacity,
34026
+ stroke,
34027
+ strokeWidth,
34028
+ style,
33976
34029
  yAxisFields = [],
33977
34030
  dataKey,
33978
34031
  payload = {},
@@ -34030,7 +34083,17 @@ var CustomBar = (0, import_react17.memo)((props) => {
34030
34083
  rawY,
34031
34084
  radius
34032
34085
  ]);
34033
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: path, fill });
34086
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
34087
+ "path",
34088
+ {
34089
+ d: path,
34090
+ fill,
34091
+ fillOpacity,
34092
+ stroke,
34093
+ strokeWidth,
34094
+ style
34095
+ }
34096
+ );
34034
34097
  });
34035
34098
  CustomBar.displayName = "CustomBar";
34036
34099
  var CustomBar_default = CustomBar;
@@ -34038,10 +34101,25 @@ var CustomBar_default = CustomBar;
34038
34101
  // src/components/Chart/BarChart.tsx
34039
34102
  var import_react18 = require("react");
34040
34103
  init_columnProcessing();
34104
+ init_textProcessing();
34041
34105
  var import_jsx_runtime38 = require("react/jsx-runtime");
34042
34106
  var CATEGORY_AXIS_WIDTH = 120;
34043
34107
  var VALUE_AXIS_WIDTH = 44;
34044
34108
  var STACKED_DOMAIN_HEADROOM = 1.05;
34109
+ function rowValueFromPivotRow(row, xAxisField, fallbackLabel) {
34110
+ const rawDate = row?.__quillRawDate;
34111
+ if (rawDate != null && rawDate !== "") {
34112
+ return String(rawDate);
34113
+ }
34114
+ const category = row?.[xAxisField];
34115
+ if (category != null && category !== "") {
34116
+ return String(category);
34117
+ }
34118
+ if (fallbackLabel != null && fallbackLabel !== "") {
34119
+ return String(fallbackLabel);
34120
+ }
34121
+ return null;
34122
+ }
34045
34123
  function getStackedDomain(data, fields, comparison) {
34046
34124
  const fieldsArray = fields.filter((field) => comparison || !field.field.startsWith("comparison_")).map((field) => field.field);
34047
34125
  if (fieldsArray.length === 0 || data.length === 0) {
@@ -34063,14 +34141,16 @@ function getStackedDomain(data, fields, comparison) {
34063
34141
  }
34064
34142
  return [0, maxStack * STACKED_DOMAIN_HEADROOM];
34065
34143
  }
34066
- var createCustomBar = (yAxisFields, theme, layout) => {
34144
+ var createCustomBar = (yAxisFields, theme, layout, active = false) => {
34067
34145
  return (props) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
34068
34146
  CustomBar_default,
34069
34147
  {
34070
34148
  ...props,
34071
34149
  yAxisFields,
34072
34150
  theme,
34073
- layout
34151
+ layout,
34152
+ stroke: active ? theme?.primaryTextColor ?? "#111827" : props.stroke,
34153
+ strokeWidth: active ? 1.5 : props.strokeWidth
34074
34154
  }
34075
34155
  );
34076
34156
  };
@@ -34091,6 +34171,7 @@ function BarChart({
34091
34171
  hideYAxis = false,
34092
34172
  hideCartesianGrid = false,
34093
34173
  onClickChartElement,
34174
+ onClickLegendElement,
34094
34175
  dateFilter,
34095
34176
  referenceLines,
34096
34177
  showLegend = false,
@@ -34143,6 +34224,16 @@ function BarChart({
34143
34224
  return void 0;
34144
34225
  return createCustomBar(sortYAxisFields([...yAxisFields]), theme, layout);
34145
34226
  }, [isStacked, yAxisFields, theme, layout]);
34227
+ const customActiveBarShape = (0, import_react18.useMemo)(() => {
34228
+ if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
34229
+ return void 0;
34230
+ return createCustomBar(
34231
+ sortYAxisFields([...yAxisFields]),
34232
+ theme,
34233
+ layout,
34234
+ true
34235
+ );
34236
+ }, [isStacked, yAxisFields, theme, layout]);
34146
34237
  if (!data || data.length === 0) {
34147
34238
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
34148
34239
  "div",
@@ -34184,9 +34275,28 @@ function BarChart({
34184
34275
  {
34185
34276
  data: data ?? [],
34186
34277
  layout,
34187
- onClick: (event) => onClickChartElement ? onClickChartElement(
34188
- event?.activePayload ? event.activePayload[0].payload : void 0
34189
- ) : void 0,
34278
+ onClick: (event) => {
34279
+ if (!onClickChartElement || event?.activeLabel === void 0 || event?.activeTooltipIndex === void 0) {
34280
+ return;
34281
+ }
34282
+ const index = Number(event.activeTooltipIndex);
34283
+ const row = event.activePayload?.[0]?.payload ?? data[index] ?? {};
34284
+ onClickChartElement({
34285
+ ...row,
34286
+ interactionType: "bucket",
34287
+ activeLabel: event.activeLabel,
34288
+ rowValue: rowValueFromPivotRow(row, xAxisField, event.activeLabel),
34289
+ columnValue: void 0,
34290
+ activeDataKey: void 0,
34291
+ activeValue: void 0,
34292
+ activePayload: event.activePayload ?? [],
34293
+ category: event.activeLabel,
34294
+ series: void 0,
34295
+ value: void 0,
34296
+ row,
34297
+ index
34298
+ });
34299
+ },
34190
34300
  children: [
34191
34301
  !hideCartesianGrid && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
34192
34302
  import_recharts4.CartesianGrid,
@@ -34206,7 +34316,7 @@ function BarChart({
34206
34316
  wrapperStyle: {
34207
34317
  paddingBottom: 20
34208
34318
  },
34209
- content: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RenderLegend, {})
34319
+ content: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RenderLegend, { onClickLegendElement })
34210
34320
  }
34211
34321
  ),
34212
34322
  isHorizontalBars ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
@@ -34285,11 +34395,13 @@ function BarChart({
34285
34395
  {
34286
34396
  wrapperStyle: { outline: "none", zIndex: 2 },
34287
34397
  isAnimationActive: false,
34288
- cursor: { fill: "#d1d5db", opacity: "0.15" },
34398
+ cursor: false,
34399
+ shared: false,
34289
34400
  content: ({ active, payload, label }) => {
34290
34401
  if (!payload || payload.length === 0) {
34291
34402
  return null;
34292
34403
  }
34404
+ const activeLabel = label ?? payload[0]?.payload?.[xAxisField] ?? "";
34293
34405
  const payloadItems = payload.map((p) => {
34294
34406
  const rawName = yAxisFields?.find(
34295
34407
  (f) => f.field === p.name?.toString()
@@ -34300,7 +34412,9 @@ function BarChart({
34300
34412
  color: p.color || "black",
34301
34413
  chartType: "line",
34302
34414
  dataKey: p.dataKey?.toLocaleString() || "",
34303
- name: name2 || p.name?.toString() || "",
34415
+ name: snakeAndCamelCaseToTitleCase(
34416
+ name2 || p.name?.toString() || ""
34417
+ ),
34304
34418
  payload: p.payload || {},
34305
34419
  type: p.type || "none",
34306
34420
  unit: "string",
@@ -34313,7 +34427,7 @@ function BarChart({
34313
34427
  theme,
34314
34428
  active,
34315
34429
  payload: payloadItems,
34316
- label,
34430
+ label: `${activeLabel}`,
34317
34431
  dateFormatter: (value) => valueFormatter({
34318
34432
  value,
34319
34433
  field: xAxisField,
@@ -34345,21 +34459,47 @@ function BarChart({
34345
34459
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
34346
34460
  import_recharts4.Bar,
34347
34461
  {
34462
+ name: elem.label || elem.field,
34348
34463
  dataKey: elem.field,
34349
34464
  stackId: stackedMode ? "same_id" : isStacked ? elem.field.replace("comparison_", "") : void 0,
34350
34465
  type: "linear",
34351
- fill: getCustomColor(elem.field) ?? selectColor(
34352
- elem,
34353
- colors.length >= yAxisFields.length / (comparison ? 2 : 1) ? colors : generateArrayFromColor(
34354
- colors.slice(0, 2),
34355
- yAxisFields.length
34356
- ),
34357
- yAxisFields.findIndex(
34358
- (field) => field.field === elem.field?.replace("comparison_", "")
34359
- )
34360
- ),
34466
+ fill: getCustomColor(elem.field) ?? selectColor(elem, colors, stableColorIndex(elem.field)),
34361
34467
  isAnimationActive,
34362
- shape: customBarShape
34468
+ shape: customBarShape,
34469
+ activeBar: customActiveBarShape ?? {
34470
+ fillOpacity: 1,
34471
+ stroke: theme?.primaryTextColor ?? "#111827",
34472
+ strokeWidth: 1.5
34473
+ },
34474
+ style: {
34475
+ cursor: onClickChartElement ? "pointer" : void 0
34476
+ },
34477
+ onClick: (bar, index, event) => {
34478
+ event?.stopPropagation();
34479
+ const payload = bar.payload ?? data[index] ?? {};
34480
+ onClickChartElement?.({
34481
+ ...payload,
34482
+ interactionType: "bar",
34483
+ activeLabel: payload[xAxisField],
34484
+ rowValue: rowValueFromPivotRow(payload, xAxisField),
34485
+ columnValue: elem.field,
34486
+ activeDataKey: elem.field,
34487
+ activeValue: payload[elem.field] ?? bar.value,
34488
+ activePayload: [
34489
+ {
34490
+ dataKey: elem.field,
34491
+ name: elem.label || elem.field,
34492
+ payload,
34493
+ value: payload[elem.field] ?? bar.value
34494
+ }
34495
+ ],
34496
+ category: payload[xAxisField],
34497
+ series: elem.field,
34498
+ value: payload[elem.field] ?? bar.value,
34499
+ row: payload,
34500
+ index
34501
+ });
34502
+ }
34363
34503
  },
34364
34504
  elem.field
34365
34505
  );
@@ -39917,6 +40057,7 @@ var ChartDisplay = ({
39917
40057
  onPageChange,
39918
40058
  onSortChange,
39919
40059
  onClickChartElement,
40060
+ onClickLegendElement,
39920
40061
  overrideTheme,
39921
40062
  referenceLines,
39922
40063
  showLegend,
@@ -40001,6 +40142,7 @@ var ChartDisplay = ({
40001
40142
  theme: overrideTheme ?? theme,
40002
40143
  colorMap,
40003
40144
  onClickChartElement,
40145
+ onClickLegendElement,
40004
40146
  yAxisFields: config?.yAxisFields,
40005
40147
  showLegend: resolvedShowLegend
40006
40148
  }
@@ -40077,6 +40219,7 @@ var ChartDisplay = ({
40077
40219
  hideCartesianGrid,
40078
40220
  colorMap,
40079
40221
  onClickChartElement,
40222
+ onClickLegendElement,
40080
40223
  dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
40081
40224
  referenceLines,
40082
40225
  showLegend: resolvedShowLegend
@@ -40104,6 +40247,7 @@ var ChartDisplay = ({
40104
40247
  hideCartesianGrid,
40105
40248
  colorMap,
40106
40249
  onClickChartElement,
40250
+ onClickLegendElement,
40107
40251
  dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
40108
40252
  referenceLines,
40109
40253
  showLegend: resolvedShowLegend,
@@ -40260,6 +40404,7 @@ var ChartDisplay = ({
40260
40404
  className,
40261
40405
  isAnimationActive,
40262
40406
  onClickChartElement,
40407
+ onClickLegendElement,
40263
40408
  dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
40264
40409
  showLegend: resolvedShowLegend
40265
40410
  }
@@ -40290,6 +40435,7 @@ var ChartDisplay = ({
40290
40435
  comparisonLineStyle: comparisonLineStyle ?? "solid",
40291
40436
  cartesianGridLineColor,
40292
40437
  onClickChartElement,
40438
+ onClickLegendElement,
40293
40439
  dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
40294
40440
  referenceLines,
40295
40441
  showLegend: resolvedShowLegend
@@ -42348,7 +42494,7 @@ function DashboardLegacy({
42348
42494
  const [filterValues, setFilterValues] = (0, import_react40.useState)({});
42349
42495
  const prevNameRef = (0, import_react40.useRef)(name2);
42350
42496
  const prevFlagsRef = (0, import_react40.useRef)(flags);
42351
- const prevClientRef = (0, import_react40.useRef)(client?.publicKey ?? "");
42497
+ const prevClientRef = (0, import_react40.useRef)(client?.id ?? "");
42352
42498
  const addFilterPopoverButtonRef = (0, import_react40.useRef)(null);
42353
42499
  const viewFiltersPopoverButtonRef = (0, import_react40.useRef)(null);
42354
42500
  const previousFilters = (0, import_react40.useRef)(filters);
@@ -42404,15 +42550,15 @@ function DashboardLegacy({
42404
42550
  });
42405
42551
  }, [flags]);
42406
42552
  (0, import_react40.useEffect)(() => {
42407
- if (prevClientRef.current === client?.publicKey) {
42553
+ if (prevClientRef.current === client?.id) {
42408
42554
  return;
42409
42555
  }
42410
- const isInitialKeySet = !prevClientRef.current && client?.publicKey;
42556
+ const isInitialKeySet = !prevClientRef.current && client?.id;
42411
42557
  if (isInitialKeySet && Object.values(data?.sections ?? {}).flat().length) {
42412
- prevClientRef.current = client?.publicKey ?? "";
42558
+ prevClientRef.current = client?.id ?? "";
42413
42559
  return;
42414
42560
  }
42415
- prevClientRef.current = client?.publicKey ?? "";
42561
+ prevClientRef.current = client?.id ?? "";
42416
42562
  if (isClientLoading) {
42417
42563
  return;
42418
42564
  }
@@ -42424,7 +42570,7 @@ function DashboardLegacy({
42424
42570
  prevFlagsRef.current = flags;
42425
42571
  isInitialLoadOfDashboardRef.current = false;
42426
42572
  });
42427
- }, [client?.publicKey]);
42573
+ }, [client?.id]);
42428
42574
  (0, import_react40.useEffect)(() => {
42429
42575
  setFilterValues(
42430
42576
  Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
@@ -43407,6 +43553,7 @@ function StaticChart(props) {
43407
43553
  const {
43408
43554
  reportId,
43409
43555
  onClickChartElement,
43556
+ onClickLegendElement,
43410
43557
  containerStyle,
43411
43558
  showLegend,
43412
43559
  className
@@ -43459,6 +43606,7 @@ function StaticChart(props) {
43459
43606
  reportId,
43460
43607
  config,
43461
43608
  onClickChartElement,
43609
+ onClickLegendElement,
43462
43610
  loading,
43463
43611
  className,
43464
43612
  containerStyle: safeContainerStyle,
@@ -48501,7 +48649,7 @@ function ChartBuilder({
48501
48649
  task: "dashboard",
48502
48650
  metadata: {
48503
48651
  name: dashboardName,
48504
- clientId: client.clientId,
48652
+ clientId: client.id,
48505
48653
  databaseType: client.databaseType,
48506
48654
  useNewNodeSql: true,
48507
48655
  tenants
@@ -48561,11 +48709,11 @@ function ChartBuilder({
48561
48709
  const getReferencedTables = async (client2, dbTables, sqlQuery, reportBuilderState2, skipStar) => {
48562
48710
  const metadata = reportBuilderState2 ? {
48563
48711
  reportBuilderState: reportBuilderState2,
48564
- clientId: client2.clientId,
48712
+ clientId: client2.id,
48565
48713
  useNewNodeSql: true
48566
48714
  } : {
48567
48715
  query: sqlQuery,
48568
- clientId: client2.clientId,
48716
+ clientId: client2.id,
48569
48717
  useNewNodeSql: true
48570
48718
  };
48571
48719
  try {
@@ -48791,7 +48939,7 @@ function ChartBuilder({
48791
48939
  client,
48792
48940
  task: "dashnames",
48793
48941
  metadata: {
48794
- clientId: client.clientId
48942
+ clientId: client.id
48795
48943
  }
48796
48944
  });
48797
48945
  dashNames = resp.dashboardNames;
@@ -52336,7 +52484,7 @@ function SQLEditor({
52336
52484
  setColumns([]);
52337
52485
  setDisplayTable(false);
52338
52486
  }
52339
- }, [client?.publicKey]);
52487
+ }, [client?.id]);
52340
52488
  (0, import_react51.useEffect)(() => {
52341
52489
  if (isChartBuilderOpen === false) {
52342
52490
  onCloseChartBuilder && onCloseChartBuilder();
@@ -52595,7 +52743,7 @@ function SQLEditor({
52595
52743
  task: "astify",
52596
52744
  metadata: {
52597
52745
  query: sqlQuery,
52598
- clientId: client2.clientId,
52746
+ clientId: client2.id,
52599
52747
  useNewNodeSql: true
52600
52748
  }
52601
52749
  });
@@ -52788,7 +52936,7 @@ function SQLEditor({
52788
52936
  query: query || "",
52789
52937
  schema: filteredSchema,
52790
52938
  databaseType: client?.databaseType ?? "postgresql",
52791
- clientName: client?.publicKey || "",
52939
+ clientName: client?.id || "",
52792
52940
  setQuery,
52793
52941
  handleRunQuery: () => {
52794
52942
  handleRunQuery(currentProcessing, true);
@@ -54942,7 +55090,7 @@ var useReportBuilderInternal = ({
54942
55090
  !client.featureFlags?.["recommendedPivotsDisabled"]
54943
55091
  );
54944
55092
  }
54945
- if (!initialTableName && !reportId && client.publicKey) {
55093
+ if (!initialTableName && !reportId && client.id) {
54946
55094
  clearAllState();
54947
55095
  }
54948
55096
  }, [client]);
@@ -58457,6 +58605,7 @@ init_valueFormatter();
58457
58605
  // src/utils/queryBuilderFilters.ts
58458
58606
  init_Filter();
58459
58607
  init_reportBuilder();
58608
+ init_dates();
58460
58609
  var buildOperatorOption = (value, label, arity) => ({
58461
58610
  name: value,
58462
58611
  value,
@@ -58625,6 +58774,26 @@ var DATE_UNIT_BY_KEY = {
58625
58774
  day: TimeUnit.Day,
58626
58775
  hour: TimeUnit.Hour
58627
58776
  };
58777
+ var DATE_BUCKETS = /* @__PURE__ */ new Set(["day", "week", "month", "year"]);
58778
+ var parseInBucketValue = (value) => {
58779
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
58780
+ throw new Error(
58781
+ 'inBucket value must be `{ start: string, bucket: "day"|"week"|"month"|"year" }`'
58782
+ );
58783
+ }
58784
+ const record = value;
58785
+ const start = String(record.start ?? "").trim();
58786
+ const bucket = String(record.bucket ?? "").trim().toLowerCase();
58787
+ if (!start) {
58788
+ throw new Error("inBucket value.start is required");
58789
+ }
58790
+ if (!DATE_BUCKETS.has(bucket)) {
58791
+ throw new Error(
58792
+ `inBucket value.bucket must be day|week|month|year (got "${String(record.bucket)}")`
58793
+ );
58794
+ }
58795
+ return { start, bucket };
58796
+ };
58628
58797
  var EMPTY_QUERY_GROUP = {
58629
58798
  combinator: "and",
58630
58799
  rules: []
@@ -58844,6 +59013,17 @@ var internalFilterToRule = (filter) => {
58844
59013
  }
58845
59014
  case "date-custom-filter" /* DateCustomFilter */: {
58846
59015
  const customDate = filter.value;
59016
+ const dateCustom = filter;
59017
+ if (dateCustom.fromInBucket && dateCustom.dateBucket) {
59018
+ return {
59019
+ field,
59020
+ operator: "inBucket",
59021
+ value: {
59022
+ start: customDate.startDate,
59023
+ bucket: dateCustom.dateBucket
59024
+ }
59025
+ };
59026
+ }
58847
59027
  return {
58848
59028
  field,
58849
59029
  operator: "between",
@@ -59028,6 +59208,24 @@ var queryRuleToInternalFilter = (rule, fieldConfigByName) => {
59028
59208
  }
59029
59209
  };
59030
59210
  }
59211
+ if (compactOperatorKey === "inbucket") {
59212
+ const { start, bucket } = parseInBucketValue(rule.value);
59213
+ const range = getExclusiveDateBucketRange(start, bucket);
59214
+ const endInclusive = new Date(Date.parse(range.endExclusive) - 1).toISOString();
59215
+ return {
59216
+ filterType: "date-custom-filter" /* DateCustomFilter */,
59217
+ fieldType: FieldType.Date,
59218
+ operator: DateOperator.Custom,
59219
+ field,
59220
+ table,
59221
+ value: {
59222
+ startDate: range.start,
59223
+ endDate: endInclusive
59224
+ },
59225
+ dateBucket: bucket,
59226
+ fromInBucket: true
59227
+ };
59228
+ }
59031
59229
  const dateComparisonOperator = QUERY_TO_DATE_COMPARISON_OPERATOR[compactOperatorKey] ?? QUERY_TO_DATE_COMPARISON_OPERATOR[operatorKey];
59032
59230
  if (!dateComparisonOperator) {
59033
59231
  throw new Error(`Unsupported date operator "${String(rule.operator)}"`);
@@ -59214,6 +59412,31 @@ var filterStackToQueryBuilderFilters = (filterStack, fieldConfigByName, qualifyA
59214
59412
  ) : base;
59215
59413
  return qualified;
59216
59414
  };
59415
+ var queryBuilderFiltersForEditor = (group) => {
59416
+ const mapEntry = (entry) => {
59417
+ if (isCombinator(entry)) return entry;
59418
+ if (isRuleGroup(entry)) {
59419
+ return queryBuilderFiltersForEditor(entry);
59420
+ }
59421
+ if (!isRule(entry)) return entry;
59422
+ const operator = String(entry.operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
59423
+ if (operator !== "inbucket") return entry;
59424
+ const { start, bucket } = parseInBucketValue(entry.value);
59425
+ const range = getExclusiveDateBucketRange(start, bucket);
59426
+ const endInclusive = new Date(
59427
+ Date.parse(range.endExclusive) - 1
59428
+ ).toISOString();
59429
+ return {
59430
+ ...entry,
59431
+ operator: "between",
59432
+ value: [range.start, endInclusive]
59433
+ };
59434
+ };
59435
+ return {
59436
+ combinator: normalizeCombinator(group.combinator, "and"),
59437
+ rules: (group.rules ?? []).map(mapEntry)
59438
+ };
59439
+ };
59217
59440
  var queryBuilderFiltersToFilterStack = (query, fieldConfigByName) => {
59218
59441
  if (!isRuleGroup(query)) {
59219
59442
  throw new Error("Query must be a rule group");
@@ -59552,6 +59775,32 @@ function useFormReducer(state, action) {
59552
59775
  }
59553
59776
  }
59554
59777
 
59778
+ // src/utils/pivotDateBuckets.ts
59779
+ var import_date_fns18 = require("date-fns");
59780
+ function buildPivotDateBucketStarts(range, bucket) {
59781
+ const min2 = new Date(range.min);
59782
+ const max2 = new Date(range.max);
59783
+ if (Number.isNaN(min2.getTime()) || Number.isNaN(max2.getTime())) return [];
59784
+ const start = min2 <= max2 ? min2 : max2;
59785
+ const end = min2 <= max2 ? max2 : min2;
59786
+ const asLocalCalendarDate = (date) => new Date(
59787
+ date.getUTCFullYear(),
59788
+ date.getUTCMonth(),
59789
+ date.getUTCDate(),
59790
+ 12
59791
+ );
59792
+ const interval = {
59793
+ start: asLocalCalendarDate(start),
59794
+ end: asLocalCalendarDate(end)
59795
+ };
59796
+ const dates = bucket === "day" ? (0, import_date_fns18.eachDayOfInterval)(interval) : bucket === "week" ? (0, import_date_fns18.eachWeekOfInterval)(interval, { weekStartsOn: 1 }) : bucket === "year" ? (0, import_date_fns18.eachYearOfInterval)(interval) : (0, import_date_fns18.eachMonthOfInterval)(interval);
59797
+ return dates.map(
59798
+ (date) => new Date(
59799
+ Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())
59800
+ ).toISOString()
59801
+ );
59802
+ }
59803
+
59555
59804
  // src/hooks/useForm.queries.ts
59556
59805
  var QUERY_KEY_UNDEFINED = "__undefined__";
59557
59806
  var QUERY_KEY_FUNCTION = "__function__";
@@ -59729,52 +59978,6 @@ var AXIS_FORMAT_OPTIONS = [
59729
59978
  { value: "MMM_dd_hh:mm_ap_pm", label: "date and time" },
59730
59979
  { value: "hh_ap_pm", label: "hour" }
59731
59980
  ];
59732
- var USEFORM_FILTERS_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_FILTERS__";
59733
- var USEFORM_REFRESH_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_REFRESH__";
59734
- var USEFORM_PIVOT_SHAPE_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_PIVOT_SHAPE__";
59735
- var isUseFormFiltersDebugEnabled = () => {
59736
- const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_FILTERS_DEBUG_FLAG] : void 0;
59737
- if (globalValue === true) {
59738
- return true;
59739
- }
59740
- if (typeof process !== "undefined" && typeof process.env !== "undefined") {
59741
- const envValue = String(
59742
- process?.env?.QUILL_DEBUG_USEFORM_FILTERS ?? ""
59743
- ).trim().toLowerCase();
59744
- return envValue === "1" || envValue === "true";
59745
- }
59746
- return false;
59747
- };
59748
- var isUseFormRefreshDebugEnabled = () => {
59749
- const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_REFRESH_DEBUG_FLAG] : void 0;
59750
- if (globalValue === true) {
59751
- return true;
59752
- }
59753
- if (typeof process !== "undefined" && typeof process.env !== "undefined") {
59754
- const envValue = String(
59755
- process?.env?.QUILL_DEBUG_USEFORM_REFRESH ?? ""
59756
- ).trim().toLowerCase();
59757
- return envValue === "1" || envValue === "true";
59758
- }
59759
- return false;
59760
- };
59761
- var isUseFormPivotShapeDebugEnabled = () => {
59762
- const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_PIVOT_SHAPE_DEBUG_FLAG] : void 0;
59763
- if (globalValue === true) {
59764
- return true;
59765
- }
59766
- if (typeof process !== "undefined" && typeof process.env !== "undefined") {
59767
- const envValue = String(
59768
- process?.env?.QUILL_DEBUG_USEFORM_PIVOT_SHAPE ?? ""
59769
- ).trim().toLowerCase();
59770
- return envValue === "1" || envValue === "true";
59771
- }
59772
- return false;
59773
- };
59774
- var logUseFormPivotShapeDebug = (label, payload) => {
59775
- if (!isUseFormPivotShapeDebugEnabled()) return;
59776
- console.log(`[useReport][pivot-shape] ${label}`, payload);
59777
- };
59778
59981
  var BOOLEAN_FILTER_VALUE_OPTIONS = [
59779
59982
  { name: "true", label: "True", value: "true" },
59780
59983
  { name: "false", label: "False", value: "false" }
@@ -60242,6 +60445,8 @@ function normalizePivotForRefreshComparison(pivot) {
60242
60445
  const {
60243
60446
  rowFieldTable: _pivotRowTable,
60244
60447
  columnFieldTable: _pivotColumnTable,
60448
+ rowFilter: _rowFilter,
60449
+ columnFilter: _columnFilter,
60245
60450
  aggregations,
60246
60451
  ...pivotRest
60247
60452
  } = record;
@@ -60664,30 +60869,24 @@ function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat
60664
60869
  function normalizePivotChartForDisplay(chart) {
60665
60870
  const swapPivotRowsForChartRows = Boolean(chart?.pivot) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length > 0;
60666
60871
  const syntheticAggregationOnlyRows = chart && !swapPivotRowsForChartRows ? buildSyntheticAggregationOnlyDisplayRows(chart) : null;
60872
+ const hasExplicitEmptyGroupedPivot = Boolean(
60873
+ String(chart?.pivot?.rowField ?? "").trim() || String(chart?.pivot?.columnField ?? "").trim()
60874
+ ) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length === 0;
60667
60875
  const detailRowsAreNotPivotBuckets = Boolean(chart) && !swapPivotRowsForChartRows && !syntheticAggregationOnlyRows && chartDetailRowsMissingPivotRowBucket(chart);
60668
- logUseFormPivotShapeDebug("normalizePivotChartForDisplay:gate", {
60669
- hasPivot: Boolean(chart?.pivot),
60670
- pivotRowField: chart?.pivot?.rowField,
60671
- pivotRowsIsArray: Array.isArray(chart?.pivotRows),
60672
- pivotRowsLength: Array.isArray(chart?.pivotRows) ? chart.pivotRows.length : null,
60673
- incomingChartRowsLength: Array.isArray(chart?.rows) ? chart.rows.length : null,
60674
- swapPivotRowsForChartRows
60675
- });
60676
60876
  const config = swapPivotRowsForChartRows ? {
60677
60877
  ...chart,
60678
60878
  rows: chart.pivotRows
60679
60879
  } : syntheticAggregationOnlyRows ? {
60680
60880
  ...chart,
60681
60881
  rows: syntheticAggregationOnlyRows
60882
+ } : hasExplicitEmptyGroupedPivot ? {
60883
+ ...chart,
60884
+ rows: []
60682
60885
  } : detailRowsAreNotPivotBuckets ? {
60683
60886
  ...chart,
60684
60887
  rows: []
60685
60888
  } : chart;
60686
60889
  if (!config) return config;
60687
- logUseFormPivotShapeDebug("normalizePivotChartForDisplay:postGateRows", {
60688
- effectiveRowsLength: Array.isArray(config.rows) ? config.rows.length : null,
60689
- stillUsingDetailRows: Boolean(config.pivot) && !swapPivotRowsForChartRows && Array.isArray(config.rows) && config.rows.length > 0
60690
- });
60691
60890
  if (!config.pivot) return config;
60692
60891
  const pivotRowFieldEarly = String(config.pivot?.rowField ?? "").trim();
60693
60892
  const rowColumn = (config.pivotColumns ?? config.columns ?? []).find(
@@ -61851,16 +62050,6 @@ function mergeDisplayAndSourceForTableFormats(args) {
61851
62050
  });
61852
62051
  return { columns, formatByColumnOptionId };
61853
62052
  }
61854
- var USE_FORM_AXIS_SERIES_COLORS = [
61855
- "#6366f1",
61856
- "#f59e0b",
61857
- "#10b981",
61858
- "#ef4444",
61859
- "#8b5cf6",
61860
- "#06b6d4",
61861
- "#f97316",
61862
- "#84cc16"
61863
- ];
61864
62053
  function axisFormatToSelectLabel(format9) {
61865
62054
  const raw = String(format9 ?? "").trim();
61866
62055
  const exact = AXIS_FORMAT_OPTIONS.find((option) => option.value === raw);
@@ -62917,7 +63106,7 @@ async function loadReportForUseForm({
62917
63106
  const hasRowBucketKey = !rowFieldTrimmed || Array.isArray(pivotRows) && pivotRows.some(
62918
63107
  (row) => row && typeof row === "object" && Object.prototype.hasOwnProperty.call(row, rowFieldTrimmed)
62919
63108
  );
62920
- const hasMatchingPivotData = pivotResult.report && !pivotResult.error && Array.isArray(pivotRows) && pivotRows.length > 0 && hasRowBucketKey;
63109
+ const hasMatchingPivotData = pivotResult.report && !pivotResult.error && Array.isArray(pivotRows) && (pivotRows.length === 0 || hasRowBucketKey);
62921
63110
  if (hasMatchingPivotData) {
62922
63111
  return pivotResult;
62923
63112
  }
@@ -62963,7 +63152,6 @@ async function loadReportForUseForm({
62963
63152
  return normalizedBootstrapResult;
62964
63153
  }
62965
63154
  const shouldUseReportTaskForReload = internalFilters.length > 0;
62966
- const resolvedTask = shouldUseReportTaskForReload ? "report" : "item";
62967
63155
  return loadViaInMemoryEngines({
62968
63156
  reportId,
62969
63157
  client,
@@ -63209,8 +63397,6 @@ function useReport(reportIdArg, options = {}) {
63209
63397
  filterStackRef.current = filterStack;
63210
63398
  const resolvedGroupRowsBy = decodePivotGroupOptionValue(groupRowsBy);
63211
63399
  const resolvedGroupColumnsBy = decodePivotGroupOptionValue(groupColumnsBy);
63212
- const useFormRefreshDebugEnabled = isUseFormRefreshDebugEnabled();
63213
- const useFormFiltersDebugEnabled = isUseFormFiltersDebugEnabled();
63214
63400
  (0, import_react61.useEffect)(() => {
63215
63401
  if (propReportId) {
63216
63402
  setCreatedReportId(null);
@@ -63759,26 +63945,6 @@ function useReport(reportIdArg, options = {}) {
63759
63945
  const filterUniqueValuesEnabled = Boolean(
63760
63946
  client && client?.queryEndpoint && filterUniqueValuesRequest && filterUniqueValuesRequest.stringColumns.length > 0
63761
63947
  );
63762
- (0, import_react61.useEffect)(() => {
63763
- if (!useFormFiltersDebugEnabled) return;
63764
- const hasClient = Boolean(client);
63765
- const hasQueryEndpoint = Boolean(client?.queryEndpoint);
63766
- const hasRequest = Boolean(filterUniqueValuesRequest);
63767
- const stringColumnsCount = filterUniqueValuesRequest?.stringColumns.length ?? 0;
63768
- const stringColumnsByTableCount = filterUniqueValuesRequest?.stringColumnsByTable.length ?? 0;
63769
- const missingReasons = [];
63770
- if (!hasClient) missingReasons.push("missing-client");
63771
- if (!hasQueryEndpoint) missingReasons.push("missing-query-endpoint");
63772
- if (!hasRequest) missingReasons.push("missing-filterUniqueValuesRequest");
63773
- if (stringColumnsCount === 0) missingReasons.push("no-string-columns");
63774
- }, [
63775
- client,
63776
- filterUniqueValuesEnabled,
63777
- filterUniqueValuesRequest,
63778
- filterUniqueValuesRequestHash,
63779
- effectiveReportId,
63780
- useFormFiltersDebugEnabled
63781
- ]);
63782
63948
  const filterUniqueValuesQuery = (0, import_react_query2.useQuery)({
63783
63949
  queryKey: [
63784
63950
  "useReport",
@@ -63882,22 +64048,6 @@ function useReport(reportIdArg, options = {}) {
63882
64048
  filterUniqueValuesQuery.data?.uniqueValuesByColumn,
63883
64049
  filterUniqueValuesRequest?.stringColumnsByTable
63884
64050
  ]);
63885
- (0, import_react61.useEffect)(() => {
63886
- if (!useFormFiltersDebugEnabled) return;
63887
- if (filterUniqueValuesQuery.status !== "success" && filterUniqueValuesQuery.status !== "error") {
63888
- return;
63889
- }
63890
- const uniqueValuesByColumn = filterUniqueValuesQuery.data?.uniqueValuesByColumn ?? {};
63891
- const uniqueValuesByColumnRecord = uniqueValuesByColumn && typeof uniqueValuesByColumn === "object" ? uniqueValuesByColumn : {};
63892
- }, [
63893
- backendUniqueValuesByFieldName,
63894
- filterUniqueValuesEnabled,
63895
- filterUniqueValuesQuery.data,
63896
- filterUniqueValuesQuery.status,
63897
- filterUniqueValuesRequest,
63898
- effectiveReportId,
63899
- useFormFiltersDebugEnabled
63900
- ]);
63901
64051
  const filterValueOptionsByFieldName = (0, import_react61.useMemo)(() => {
63902
64052
  const optionsByField = /* @__PURE__ */ new Map();
63903
64053
  const selectedMultiselectByField = collectSelectedStringMultiselectValuesByField(queryFilters);
@@ -64660,19 +64810,6 @@ function useReport(reportIdArg, options = {}) {
64660
64810
  resolveCache.set(fieldName, resolved);
64661
64811
  return resolved;
64662
64812
  }
64663
- if (isUseFormFiltersDebugEnabled()) {
64664
- console.error(
64665
- "[useForm-debug] normalizeQueryBuilderFieldNameForConfig ambiguous",
64666
- {
64667
- fieldName,
64668
- candidateKeys: candidates.map(([key]) => key),
64669
- preferredTableNames: Array.from(preferredTableNames),
64670
- primaryTableName,
64671
- effectiveReportBuilderTableNames,
64672
- baseReportBuilderTableNames
64673
- }
64674
- );
64675
- }
64676
64813
  return fieldName;
64677
64814
  };
64678
64815
  }, [
@@ -65064,8 +65201,7 @@ function useReport(reportIdArg, options = {}) {
65064
65201
  }, [
65065
65202
  effectiveReportId,
65066
65203
  tableRefreshQuery.data,
65067
- tableRefreshQueryEnabled,
65068
- useFormRefreshDebugEnabled
65204
+ tableRefreshQueryEnabled
65069
65205
  ]);
65070
65206
  const chartTypes = (0, import_react61.useMemo)(() => {
65071
65207
  return getChartTypeOptions2({ pivot: pivotState });
@@ -65787,6 +65923,9 @@ function useReport(reportIdArg, options = {}) {
65787
65923
  return {
65788
65924
  ...previousReport,
65789
65925
  ...report,
65926
+ xAxisFormat: previousReport.xAxisFormat,
65927
+ columns: previousReport.columns,
65928
+ yAxisFields: previousReport.yAxisFields,
65790
65929
  pivot: previousReport.pivot,
65791
65930
  pivotRows: previousReport.pivotRows,
65792
65931
  pivotColumns: previousReport.pivotColumns,
@@ -65803,8 +65942,7 @@ function useReport(reportIdArg, options = {}) {
65803
65942
  pivotTableDataRefreshQuery.data,
65804
65943
  pivotTableDataRefreshQuery.status,
65805
65944
  pivotTableDataRefreshQueryEnabled,
65806
- effectiveReportId,
65807
- useFormRefreshDebugEnabled
65945
+ effectiveReportId
65808
65946
  ]);
65809
65947
  (0, import_react61.useEffect)(() => {
65810
65948
  if (!pivotRefreshQueryEnabled) return;
@@ -65856,8 +65994,7 @@ function useReport(reportIdArg, options = {}) {
65856
65994
  pivotRefreshQuery.data,
65857
65995
  pivotRefreshQuery.status,
65858
65996
  pivotRefreshQueryEnabled,
65859
- effectiveReportId,
65860
- useFormRefreshDebugEnabled
65997
+ effectiveReportId
65861
65998
  ]);
65862
65999
  const chartData = (0, import_react61.useMemo)(() => {
65863
66000
  if (!sourceReport) return void 0;
@@ -65865,8 +66002,8 @@ function useReport(reportIdArg, options = {}) {
65865
66002
  const chartPivotForDisplay = nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
65866
66003
  const rowCountForChart = chartPivotForDisplay ? sourceReport.pivotRowCount ?? (Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : sourceReport.rowCount) : useInMemoryEngines ? rowsForChart.length : sourceReport.rowCount;
65867
66004
  const referencedTablesForChart = effectiveReportBuilderState?.tables.map((table2) => table2.name).filter((name2) => Boolean(name2));
65868
- const pivotRowsForChart = Array.isArray(sourceReport.pivotRows) && sourceReport.pivotRows.length > 0 ? sourceReport.pivotRows : [];
65869
- const rowCountForChartResolved = chartPivotForDisplay ? pivotRowsForChart.length > 0 ? pivotRowsForChart.length : rowCountForChart : rowCountForChart;
66005
+ const pivotRowsForChart = Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows : void 0;
66006
+ const rowCountForChartResolved = chartPivotForDisplay ? Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : rowCountForChart : rowCountForChart;
65870
66007
  const chartDataPayload = {
65871
66008
  ...sourceReport,
65872
66009
  rows: rowsForChart,
@@ -65877,15 +66014,8 @@ function useReport(reportIdArg, options = {}) {
65877
66014
  referencedTables: referencedTablesForChart && referencedTablesForChart.length > 0 ? referencedTablesForChart : sourceReport.referencedTables,
65878
66015
  pivotRows: pivotRowsForChart,
65879
66016
  pivotColumns: sourceReport.pivotColumns,
65880
- pivotRowCount: pivotRowsForChart.length
66017
+ pivotRowCount: Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : sourceReport.pivotRowCount
65881
66018
  };
65882
- logUseFormPivotShapeDebug("chartData:memo", {
65883
- reportId: sourceReport.id,
65884
- detailRowsLength: rowsForChart.length,
65885
- pivotRowsIsArray: Array.isArray(sourceReport.pivotRows),
65886
- pivotRowsLength: Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : null,
65887
- hasNextPivot: Boolean(nextPivot)
65888
- });
65889
66019
  return chartDataPayload;
65890
66020
  }, [
65891
66021
  sourceReport,
@@ -65923,8 +66053,8 @@ function useReport(reportIdArg, options = {}) {
65923
66053
  for (const column of chartAxesBaseChart.columns ?? []) {
65924
66054
  registerOption(column.field, column.label, column.format);
65925
66055
  }
65926
- for (const yAxis of chartAxesBaseChart.yAxisFields ?? []) {
65927
- registerOption(yAxis.field, yAxis.label, yAxis.format);
66056
+ for (const yAxis2 of chartAxesBaseChart.yAxisFields ?? []) {
66057
+ registerOption(yAxis2.field, yAxis2.label, yAxis2.format);
65928
66058
  }
65929
66059
  if (chartAxesBaseChart.pivot?.columnField) {
65930
66060
  for (const aggregationAxis of buildPivotAggregationAxisFields(
@@ -66147,48 +66277,35 @@ function useReport(reportIdArg, options = {}) {
66147
66277
  }),
66148
66278
  [baseChart?.showLegend, chartVisibilityOverrides]
66149
66279
  );
66150
- const axisConfig = (0, import_react61.useMemo)(() => {
66280
+ const xAxis = (0, import_react61.useMemo)(() => {
66151
66281
  const pivotBucketXAxis = isPivotTableDateBucketRowAxis(
66152
66282
  chartAxesBaseChart,
66153
66283
  resolvedXAxisField
66154
66284
  );
66155
66285
  const xFormatLabel = pivotBucketXAxis && String(resolvedXAxisFormat ?? "").trim() === "string" ? "date" : axisFormatToSelectLabel(resolvedXAxisFormat);
66156
66286
  return {
66157
- xAxis: {
66158
- field: resolvedXAxisField,
66159
- label: resolvedXAxisLabel,
66160
- format: xFormatLabel,
66161
- show: true,
66162
- rotation: 0,
66163
- fontSize: 12
66164
- },
66165
- yAxis: {
66166
- fields: resolvedYAxisFields.map((yAxisField, index) => ({
66167
- field: yAxisField.field,
66168
- label: String(yAxisField.label ?? "").trim(),
66169
- format: axisFormatToSelectLabel(
66170
- toAxisFormat(yAxisField.format, "string")
66171
- ),
66172
- color: USE_FORM_AXIS_SERIES_COLORS[index % USE_FORM_AXIS_SERIES_COLORS.length]
66173
- })),
66174
- label: "",
66175
- show: true,
66176
- min: "",
66177
- max: "",
66178
- fontSize: 12
66179
- },
66180
- legend: {
66181
- show: chartVisibility.showLegend
66182
- }
66287
+ field: resolvedXAxisField,
66288
+ label: resolvedXAxisLabel,
66289
+ format: xFormatLabel
66183
66290
  };
66184
66291
  }, [
66185
66292
  chartAxesBaseChart,
66186
66293
  resolvedXAxisLabel,
66187
66294
  resolvedXAxisField,
66188
- resolvedXAxisFormat,
66189
- resolvedYAxisFields,
66190
- chartVisibility.showLegend
66295
+ resolvedXAxisFormat
66191
66296
  ]);
66297
+ const yAxis = (0, import_react61.useMemo)(
66298
+ () => ({
66299
+ fields: resolvedYAxisFields.map((yAxisField) => ({
66300
+ field: yAxisField.field,
66301
+ label: String(yAxisField.label ?? "").trim(),
66302
+ format: axisFormatToSelectLabel(
66303
+ toAxisFormat(yAxisField.format, "string")
66304
+ )
66305
+ }))
66306
+ }),
66307
+ [resolvedYAxisFields]
66308
+ );
66192
66309
  const resolvedYAxisFieldsForDisplay = (0, import_react61.useMemo)(() => {
66193
66310
  if (!baseChart) return resolvedYAxisFields;
66194
66311
  return mapResolvedPivotYAxisFieldsForDisplay({
@@ -66210,26 +66327,6 @@ function useReport(reportIdArg, options = {}) {
66210
66327
  xAxisLabel: resolvedXAxisLabel
66211
66328
  });
66212
66329
  }
66213
- logUseFormPivotShapeDebug("chart:formatting(yAxis+pivotColumns)", {
66214
- chartType: baseChart.chartType,
66215
- pivotRowField: baseChart.pivot?.rowField,
66216
- xAxisField: resolvedXAxisField,
66217
- xAxisFormat: resolvedXAxisFormat,
66218
- yAxisFieldsForDisplay: (resolvedYAxisFieldsForDisplay ?? []).map((y) => ({
66219
- field: y.field,
66220
- format: y.format,
66221
- label: y.label
66222
- })),
66223
- pivotColumnsSample: (baseChart.pivotColumns ?? []).slice(0, 12).map((c) => ({
66224
- field: c.field,
66225
- format: c.format,
66226
- label: c.label
66227
- })),
66228
- mergedColumnFormatsSample: (columns2 ?? baseChart.columns ?? []).slice(0, 12).map((c) => ({
66229
- field: c.field,
66230
- format: c.format
66231
- }))
66232
- });
66233
66330
  return {
66234
66331
  ...baseChart,
66235
66332
  xAxisField: resolvedXAxisField,
@@ -66245,6 +66342,144 @@ function useReport(reportIdArg, options = {}) {
66245
66342
  resolvedXAxisLabel,
66246
66343
  resolvedYAxisFieldsForDisplay
66247
66344
  ]);
66345
+ const pivotDateFilterRangeCacheRef = (0, import_react61.useRef)({ key: "", min: null, max: null });
66346
+ const filterOptions = (0, import_react61.useMemo)(() => {
66347
+ const out = [];
66348
+ for (const [field, values] of filterValueOptionsByFieldName) {
66349
+ out.push({
66350
+ field,
66351
+ fieldType: "string",
66352
+ operator: "in",
66353
+ options: values.map(({ label, value }) => ({ label, value }))
66354
+ });
66355
+ }
66356
+ const pivot = chart?.pivot;
66357
+ const rowField = String(pivot?.rowField ?? "").trim();
66358
+ if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
66359
+ const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
66360
+ const bucket = dateBucket || pivot?.dateBucket || "month";
66361
+ const labelsByRaw = /* @__PURE__ */ new Map();
66362
+ const cacheKey = `${String(effectiveReportId ?? "")}\0${field}\0${bucket}`;
66363
+ if (pivotDateFilterRangeCacheRef.current.key !== cacheKey) {
66364
+ pivotDateFilterRangeCacheRef.current = {
66365
+ key: cacheKey,
66366
+ min: null,
66367
+ max: null
66368
+ };
66369
+ }
66370
+ for (const row of chart?.rows ?? []) {
66371
+ const record = row;
66372
+ const raw = record.__quillRawDate;
66373
+ if (raw == null || raw === "") continue;
66374
+ const key = String(raw);
66375
+ const timestamp = new Date(key).getTime();
66376
+ if (Number.isNaN(timestamp)) continue;
66377
+ labelsByRaw.set(key, String(record[rowField] ?? key));
66378
+ const cachedMin = pivotDateFilterRangeCacheRef.current.min;
66379
+ const cachedMax = pivotDateFilterRangeCacheRef.current.max;
66380
+ if (cachedMin == null || timestamp < new Date(cachedMin).getTime()) {
66381
+ pivotDateFilterRangeCacheRef.current.min = key;
66382
+ }
66383
+ if (cachedMax == null || timestamp > new Date(cachedMax).getTime()) {
66384
+ pivotDateFilterRangeCacheRef.current.max = key;
66385
+ }
66386
+ }
66387
+ const { min: min2, max: max2 } = pivotDateFilterRangeCacheRef.current;
66388
+ const options2 = min2 && max2 ? buildPivotDateBucketStarts({ min: min2, max: max2 }, bucket).map((value) => ({
66389
+ value,
66390
+ label: labelsByRaw.get(value) ?? getDateString(value, void 0, bucket)
66391
+ })) : [];
66392
+ out.push({
66393
+ field,
66394
+ fieldType: "date",
66395
+ operator: "inBucket",
66396
+ dateBucket: bucket,
66397
+ options: options2
66398
+ });
66399
+ }
66400
+ return out;
66401
+ }, [
66402
+ chart?.pivot,
66403
+ chart?.rows,
66404
+ dateBucket,
66405
+ effectiveReportId,
66406
+ filterValueOptionsByFieldName
66407
+ ]);
66408
+ const chartForUi = (0, import_react61.useMemo)(() => {
66409
+ if (!chart?.pivot) return chart;
66410
+ const pivot = chart.pivot;
66411
+ const qualify = (field, table2) => table2 ? `${table2}.${field}` : field;
66412
+ const labelFor = (field) => chart.columns?.find((column) => column.field === field)?.label ?? field.split(".").pop().replace(/[_-]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
66413
+ const matchField = (entryField, field, table2) => {
66414
+ const qualified = qualify(field, table2);
66415
+ return entryField === qualified || entryField === field || entryField.endsWith(`.${field}`);
66416
+ };
66417
+ const selectedValue = (field, operator, options2) => {
66418
+ const rule = filtersForQueryBuilder.rules.find(
66419
+ (entry) => typeof entry === "object" && entry !== null && "field" in entry && entry.field === field && entry.operator === operator
66420
+ );
66421
+ if (!rule) return null;
66422
+ const raw = operator === "inBucket" ? rule.value?.start : Array.isArray(rule.value) ? rule.value[0] : void 0;
66423
+ if (raw == null) return null;
66424
+ const value = String(raw);
66425
+ return options2.some((option) => option.value === value) ? value : null;
66426
+ };
66427
+ let rowFilter = null;
66428
+ const rowField = String(pivot.rowField ?? "").trim();
66429
+ if (rowField) {
66430
+ if (isDateType(String(pivot.rowFieldType ?? ""))) {
66431
+ const entry = filterOptions.find(
66432
+ (option) => option.operator === "inBucket" && matchField(option.field, rowField, pivot.rowFieldTable)
66433
+ );
66434
+ if (entry) {
66435
+ const field = qualify(rowField, pivot.rowFieldTable);
66436
+ rowFilter = {
66437
+ ...entry,
66438
+ field,
66439
+ label: labelFor(rowField),
66440
+ value: selectedValue(field, entry.operator, entry.options)
66441
+ };
66442
+ }
66443
+ } else {
66444
+ const entry = filterOptions.find(
66445
+ (option) => option.operator === "in" && matchField(option.field, rowField, pivot.rowFieldTable)
66446
+ );
66447
+ if (entry) {
66448
+ const field = qualify(rowField, pivot.rowFieldTable);
66449
+ rowFilter = {
66450
+ ...entry,
66451
+ field,
66452
+ label: labelFor(rowField),
66453
+ value: selectedValue(field, entry.operator, entry.options)
66454
+ };
66455
+ }
66456
+ }
66457
+ }
66458
+ let columnFilter = null;
66459
+ const columnField = String(pivot.columnField ?? "").trim();
66460
+ if (columnField) {
66461
+ const entry = filterOptions.find(
66462
+ (option) => option.operator === "in" && matchField(option.field, columnField, pivot.columnFieldTable)
66463
+ );
66464
+ if (entry) {
66465
+ const field = qualify(columnField, pivot.columnFieldTable);
66466
+ columnFilter = {
66467
+ ...entry,
66468
+ field,
66469
+ label: labelFor(columnField),
66470
+ value: selectedValue(field, entry.operator, entry.options)
66471
+ };
66472
+ }
66473
+ }
66474
+ return {
66475
+ ...chart,
66476
+ pivot: {
66477
+ ...pivot,
66478
+ rowFilter,
66479
+ columnFilter
66480
+ }
66481
+ };
66482
+ }, [chart, filterOptions, filtersForQueryBuilder]);
66248
66483
  const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(
66249
66484
  chart && chart.pivot && Array.isArray(chart.columns) && chart.columns.length > 0
66250
66485
  );
@@ -66575,14 +66810,6 @@ function useReport(reportIdArg, options = {}) {
66575
66810
  schemaColumnOptions,
66576
66811
  table.columns
66577
66812
  ]);
66578
- const availableFields = (0, import_react61.useMemo)(
66579
- () => tableColumnPickerPoolOptions.map((option) => ({
66580
- id: option.value,
66581
- label: option.label,
66582
- type: option.type
66583
- })),
66584
- [tableColumnPickerPoolOptions]
66585
- );
66586
66813
  const axisSelectFormatLabels = (0, import_react61.useMemo)(
66587
66814
  () => AXIS_FORMAT_OPTIONS.map((option) => option.label),
66588
66815
  []
@@ -67028,8 +67255,12 @@ function useReport(reportIdArg, options = {}) {
67028
67255
  showLegend: Boolean(effectiveNextState.showLegend)
67029
67256
  }));
67030
67257
  }
67031
- if (effectiveNextState.chartAxes !== void 0) {
67032
- const cx = effectiveNextState.chartAxes;
67258
+ if (effectiveNextState.xAxis !== void 0 || effectiveNextState.yAxis !== void 0 || effectiveNextState.chartAxes !== void 0) {
67259
+ const cx = {
67260
+ ...effectiveNextState.chartAxes,
67261
+ ...effectiveNextState.xAxis !== void 0 ? { xAxis: effectiveNextState.xAxis } : {},
67262
+ ...effectiveNextState.yAxis !== void 0 ? { yAxis: effectiveNextState.yAxis } : {}
67263
+ };
67033
67264
  setChartAxisEdits((previousEdits) => {
67034
67265
  const nextEdits = { ...previousEdits };
67035
67266
  if (cx.xAxis) {
@@ -67549,8 +67780,9 @@ function useReport(reportIdArg, options = {}) {
67549
67780
  }
67550
67781
  };
67551
67782
  const setFilters = (nextFilters) => {
67783
+ const resolved = typeof nextFilters === "function" ? nextFilters(filtersForQueryBuilder) : nextFilters;
67552
67784
  const preparedForStack = prepareQueryBuilderFiltersForSet(
67553
- nextFilters,
67785
+ resolved,
67554
67786
  queryFilters
67555
67787
  );
67556
67788
  const nextFiltersNormalizedForConfig = normalizeQueryBuilderFiltersForConfig(preparedForStack);
@@ -67591,17 +67823,17 @@ function useReport(reportIdArg, options = {}) {
67591
67823
  });
67592
67824
  }
67593
67825
  } catch (error) {
67594
- if (isUseFormFiltersDebugEnabled()) {
67595
- console.error("[useForm-debug] setFilters swallowed error", {
67596
- error: error instanceof Error ? error.message : String(error),
67597
- requestedRules: (nextFilters?.rules ?? []).map((rule) => ({
67598
- table: rule?.table,
67599
- field: rule?.field,
67600
- operator: rule?.operator
67601
- })),
67602
- fieldConfigKeys: Object.keys(queryBuilderFieldConfigByName ?? {})
67603
- });
67604
- }
67826
+ console.error("[useForm] setFilters swallowed error", {
67827
+ error: error instanceof Error ? error.message : String(error),
67828
+ stack: error instanceof Error ? error.stack : void 0,
67829
+ requestedRules: (resolved?.rules ?? []).map((rule) => ({
67830
+ table: rule?.table,
67831
+ field: rule?.field,
67832
+ operator: rule?.operator,
67833
+ value: rule?.value
67834
+ })),
67835
+ fieldConfigKeys: Object.keys(queryBuilderFieldConfigByName ?? {})
67836
+ });
67605
67837
  }
67606
67838
  };
67607
67839
  const saveChanges = (0, import_react61.useCallback)(async () => {
@@ -67663,7 +67895,7 @@ function useReport(reportIdArg, options = {}) {
67663
67895
  ]);
67664
67896
  return {
67665
67897
  /* ── Chart & table (exceptions: not value/options pairs) ── */
67666
- chart,
67898
+ chart: chartForUi,
67667
67899
  chartLoading,
67668
67900
  table,
67669
67901
  tableLoading,
@@ -67701,9 +67933,9 @@ function useReport(reportIdArg, options = {}) {
67701
67933
  columnActions,
67702
67934
  /** Schema columns for current datasources — pool for the table column picker. */
67703
67935
  columnOptions: tableColumnPickerPoolOptions,
67704
- xAxis: chartAxes.xAxis,
67936
+ xAxis,
67705
67937
  xAxisOptions: normalizedChartXAxisOptions,
67706
- yAxis: chartAxes.yAxis,
67938
+ yAxis,
67707
67939
  yAxisOptions: normalizedChartYAxisOptions,
67708
67940
  /** Same strings as `axisSelectFormatLabels` (X/Y share chart format presets). */
67709
67941
  xAxisFormatOptions: xAxisFormatOptionLabels,
@@ -67711,8 +67943,6 @@ function useReport(reportIdArg, options = {}) {
67711
67943
  /** Table column format dropdown labels (same set as chart axis formats). */
67712
67944
  tableFormatOptions: axisSelectFormatLabels,
67713
67945
  showLegend: chartVisibility.showLegend,
67714
- axisConfig,
67715
- availableFields,
67716
67946
  axisSelectFormatLabels,
67717
67947
  /** @deprecated Prefer top-level `xAxis`, `yAxis`, and `showLegend`. */
67718
67948
  chartAxes,
@@ -67725,6 +67955,12 @@ function useReport(reportIdArg, options = {}) {
67725
67955
  hasTableDrivenColumnOrder,
67726
67956
  filters: filtersForQueryBuilder,
67727
67957
  filterQueryBuilderProps,
67958
+ /**
67959
+ * Filter value pick lists for custom UIs (string unique values + pivot date
67960
+ * buckets). Same string data as `filterQueryBuilderProps.getValues`; not
67961
+ * wired into react-querybuilder unless you use it yourself.
67962
+ */
67963
+ filterOptions,
67728
67964
  /** True while `report-builder-unique-values` runs for filter value options (not chart/table load). */
67729
67965
  filterUniqueValuesLoading,
67730
67966
  limit,
@@ -68105,11 +68341,11 @@ function Chat({
68105
68341
  setIsLoading(false);
68106
68342
  };
68107
68343
  const submitDefaultMessage = async (nextMessages, abortController) => {
68108
- const clientId = client.clientId ?? client.publicKey;
68344
+ const clientId = client.id;
68109
68345
  let responseBuffer = "";
68110
68346
  for await (const chunk of quillStream({
68111
68347
  client: {
68112
- clientId,
68348
+ id: clientId,
68113
68349
  queryEndpoint: client.queryEndpoint,
68114
68350
  streamEndpoint: client.streamEndpoint,
68115
68351
  queryHeaders: client.queryHeaders,
@@ -68193,12 +68429,12 @@ function Chat({
68193
68429
  }
68194
68430
  };
68195
68431
  const submitAgentMessage = async (nextMessages, abortController) => {
68196
- const clientId = client.clientId ?? client.publicKey;
68432
+ const clientId = client.id;
68197
68433
  let updatedMessages = [...nextMessages];
68198
68434
  for await (const event of quillAgentStream({
68199
68435
  endpoint: `${agentEndpoint}/agent/chat`,
68200
68436
  messages: updatedMessages,
68201
- sourceClientId: clientId,
68437
+ sourceClientId: clientId ?? "<unknown>",
68202
68438
  getToken,
68203
68439
  abortSignal: abortController.signal
68204
68440
  })) {
@@ -68266,7 +68502,7 @@ function Chat({
68266
68502
  setIsLoading(true);
68267
68503
  const abortController = new AbortController();
68268
68504
  abortControllerRef.current = abortController;
68269
- const clientId = client.clientId ?? client.publicKey;
68505
+ const clientId = client.id;
68270
68506
  if (!clientId) {
68271
68507
  setInputError("No client selected.");
68272
68508
  setIsLoading(false);
@@ -68563,7 +68799,9 @@ var committedFiltersSignature = (committed) => {
68563
68799
  };
68564
68800
  function useReportFilterDraft(args) {
68565
68801
  const { reportId, committedFilters, queryBuilderProps, setFilters } = args;
68566
- const committed = isQueryBuilderDisplayGroup(committedFilters) ? committedFilters : EMPTY_COMMITTED_FILTERS;
68802
+ const committed = queryBuilderFiltersForEditor(
68803
+ isQueryBuilderDisplayGroup(committedFilters) ? committedFilters : EMPTY_COMMITTED_FILTERS
68804
+ );
68567
68805
  const committedRef = (0, import_react64.useRef)(committed);
68568
68806
  committedRef.current = committed;
68569
68807
  const setFiltersRef = (0, import_react64.useRef)(setFilters);
@@ -68618,6 +68856,12 @@ function useReportFilterDraft(args) {
68618
68856
  setHasUnappliedFilterChanges(false);
68619
68857
  setResetEpoch((epoch) => epoch + 1);
68620
68858
  }, []);
68859
+ const getDefaultField = (0, import_react64.useCallback)((fields) => {
68860
+ const stringField = fields.find(
68861
+ (field) => field.quillFieldType === "string" && String(field.name ?? "").trim()
68862
+ );
68863
+ return stringField?.name ?? fields[0]?.name ?? "";
68864
+ }, []);
68621
68865
  const getDefaultValue = (0, import_react64.useCallback)(
68622
68866
  (rule) => defaultFilterRuleValueForOperator(rule?.operator),
68623
68867
  []
@@ -68628,9 +68872,12 @@ function useReportFilterDraft(args) {
68628
68872
  fields: effectiveFields,
68629
68873
  // Uncontrolled: react-querybuilder owns the draft; only read at mount,
68630
68874
  // while state keeps the next mount hydrated from the latest edits.
68631
- defaultQuery: draftQuery,
68875
+ // Empty draft: omit defaultQuery so addRuleToNewGroups seeds a root rule
68876
+ // (RQB ignores auto-add when defaultQuery.rules is []).
68877
+ ...draftQuery.rules.length > 0 ? { defaultQuery: draftQuery } : {},
68632
68878
  onQueryChange: handleQueryChange,
68633
68879
  addRuleToNewGroups: true,
68880
+ getDefaultField,
68634
68881
  getDefaultValue
68635
68882
  }),
68636
68883
  // eslint-disable-next-line react-hooks/exhaustive-deps -- filterDraftKey covers draftRef resets
@@ -68639,6 +68886,7 @@ function useReportFilterDraft(args) {
68639
68886
  effectiveFields,
68640
68887
  draftQuery,
68641
68888
  handleQueryChange,
68889
+ getDefaultField,
68642
68890
  getDefaultValue,
68643
68891
  filterDraftKey
68644
68892
  ]
@@ -69522,7 +69770,7 @@ var useVirtualTables = () => {
69522
69770
  };
69523
69771
  };
69524
69772
  const handleRefreshSome = async (client, tables) => {
69525
- if (!client.clientId) return schemaData;
69773
+ if (!client.id) return schemaData;
69526
69774
  setLoadingTables({
69527
69775
  ...loadingTables,
69528
69776
  ...tables.reduce((acc, table) => {
@@ -69540,7 +69788,7 @@ var useVirtualTables = () => {
69540
69788
  name: table.name,
69541
69789
  customFieldInfo: table.customFieldInfo,
69542
69790
  id: table._id,
69543
- clientId: client.clientId,
69791
+ clientId: client.id,
69544
69792
  runQueryConfig: { getColumns: true },
69545
69793
  databaseType: client.databaseType,
69546
69794
  useNewNodeSql: true
@@ -69688,11 +69936,12 @@ var useChangelogRefresh = () => {
69688
69936
  reportsDispatch({ type: "DELETE_REPORT", id: reportId });
69689
69937
  dashboardDispatch({ type: "REMOVE_DASHBOARD_ITEM", id: reportId });
69690
69938
  }
69691
- const finalDashboardSet = reloadAllDashboards ? new Set(
69692
- Object.keys(dashboardConfig).filter(
69939
+ const finalDashboardSet = reloadAllDashboards ? /* @__PURE__ */ new Set([
69940
+ ...Object.keys(dashboardConfig).filter(
69693
69941
  (d) => !dashboardsToRemove.has(d)
69694
- )
69695
- ) : dashboardsToReload;
69942
+ ),
69943
+ ...dashboardsToReload
69944
+ ]) : dashboardsToReload;
69696
69945
  const tasks = [];
69697
69946
  const schemaIdsToReload = schemaIds.filter(
69698
69947
  (id) => !schemaIdsToRemove.has(id)
@@ -69808,6 +70057,7 @@ init_constants();
69808
70057
  isQueryBuilderDisplayRule,
69809
70058
  normalizeRelativeDateRules,
69810
70059
  prepareQueryBuilderFiltersForSet,
70060
+ queryBuilderFiltersForEditor,
69811
70061
  quillFetch,
69812
70062
  stripQueryBuilderTransientFields,
69813
70063
  tableColumnFormatFromUiSelection,