@magemetrics/ai 0.3.2 → 0.4.0

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.
@@ -1,6 +1,7 @@
1
1
  import { AuthState } from '@magemetrics/core';
2
2
  import { CreateFlowParam } from '@magemetrics/core';
3
3
  import { default as default_2 } from 'react';
4
+ import { Dispatch } from 'react';
4
5
  import { FetchNextPageOptions } from '@tanstack/react-query';
5
6
  import { ForwardRefExoticComponent } from 'react';
6
7
  import { GenerateInsightParam } from '@magemetrics/core';
@@ -8,8 +9,11 @@ import { InfiniteData } from '@tanstack/react-query';
8
9
  import { InfiniteQueryObserverResult } from '@tanstack/react-query';
9
10
  import { MageMetricsClient } from '@magemetrics/core';
10
11
  import { MageMetricsClientConfig } from '@magemetrics/core';
12
+ import { OnChangeFn } from '@tanstack/react-table';
11
13
  import { PropsWithChildren } from 'react';
12
14
  import { RefAttributes } from 'react';
15
+ import { SetStateAction } from 'react';
16
+ import { SortingState as SortingState_2 } from '@tanstack/react-table';
13
17
  import { UseMutateAsyncFunction } from '@tanstack/react-query';
14
18
  import { UseMutateFunction } from '@tanstack/react-query';
15
19
  import { UseMutationOptions } from '@tanstack/react-query';
@@ -77,9 +81,18 @@ declare interface ConversationContentProps {
77
81
 
78
82
  export { CreateFlowParam }
79
83
 
80
- /** This component is not bounded in height and must be wrapped in a container to properly work */
84
+ /**
85
+ * This component is not bounded in height and must be wrapped in a container to properly work
86
+ * @param props - props
87
+ * @param props.reportId - The ID of the report to display
88
+ * @param props.initialState - The initial state of data table
89
+ * @param props.onStateChange - Callback function to handle state changes
90
+ * @returns JSX.Element
91
+ */
81
92
  export declare const DataReport: React.FC<{
82
93
  reportId: number;
94
+ initialState?: DataTableState;
95
+ onStateChange?: (state: DataTableState) => void;
83
96
  }>;
84
97
 
85
98
  export declare interface DataReportMessageProps {
@@ -101,9 +114,19 @@ export declare interface DataReportMessageProps {
101
114
 
102
115
  export declare const DataTable: React.FC<DataReportMessageProps>;
103
116
 
117
+ declare type DataTableState = {
118
+ pageIndex: number;
119
+ pageSize: number;
120
+ sorting: SortingState;
121
+ filters: TableFilters;
122
+ };
123
+
104
124
  declare type DisplayControlProps = {
125
+ /** Whether to display the recommendations section when the input is active */
105
126
  showRecommendations?: boolean;
127
+ /** Whether to display recent chats when the input is active */
106
128
  showRecentChats?: boolean;
129
+ /** Whether to display a backdrop overlay when the input is active */
107
130
  showBackdrop?: boolean;
108
131
  };
109
132
 
@@ -113,6 +136,10 @@ declare type DomWrapperProps = {
113
136
  display?: string;
114
137
  };
115
138
 
139
+ export declare const DownloadDataReportButton: React.FC<{
140
+ reportId: number;
141
+ }>;
142
+
116
143
  declare type ExportReportDataParams = {
117
144
  reportId: number;
118
145
  filename?: string;
@@ -129,19 +156,9 @@ declare type ExtractInsightResponse = z.infer<typeof ExtractInsightResponseSchem
129
156
  declare const ExtractInsightResponseSchema: z.ZodUnion<[z.ZodObject<{
130
157
  type: z.ZodLiteral<"text">;
131
158
  insight: z.ZodString;
132
- }, "strip", z.ZodTypeAny, {
133
- type: "text";
134
- insight: string;
135
- }, {
136
- type: "text";
137
- insight: string;
138
- }>, z.ZodObject<{
159
+ }, z.core.$strip>, z.ZodObject<{
139
160
  type: z.ZodLiteral<"missing">;
140
- }, "strip", z.ZodTypeAny, {
141
- type: "missing";
142
- }, {
143
- type: "missing";
144
- }>]>;
161
+ }, z.core.$strip>]>;
145
162
 
146
163
  /**
147
164
  * This module handles the formatting and normalization of table cell values for display and sorting.
@@ -175,229 +192,75 @@ declare type FrontendReport = z.infer<typeof FrontendReportSchema>;
175
192
  declare type FrontendReportColumns = z.infer<typeof FrontendReportColumnsSchema>;
176
193
 
177
194
  declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
178
- name: z.ZodString;
179
- data_type: z.ZodString;
180
- } & {
181
195
  dataType: z.ZodString;
182
196
  renderType: z.ZodOptional<z.ZodString>;
183
197
  unit: z.ZodOptional<z.ZodString>;
184
- }, "strip", z.ZodTypeAny, {
185
- name: string;
186
- data_type: string;
187
- dataType: string;
188
- unit?: string | undefined;
189
- renderType?: string | undefined;
190
- }, {
191
- name: string;
192
- data_type: string;
193
- dataType: string;
194
- unit?: string | undefined;
195
- renderType?: string | undefined;
196
- }>, "many">;
198
+ name: z.ZodString;
199
+ data_type: z.ZodString;
200
+ }, z.core.$strip>>;
197
201
 
198
202
  declare type FrontendReportExplainability = z.infer<typeof FrontendReportExplainabilitySchema>;
199
203
 
200
- declare const FrontendReportExplainabilitySchema: z.ZodObject<Omit<{
204
+ declare const FrontendReportExplainabilitySchema: z.ZodObject<{
205
+ flow_data_id: z.ZodNumber;
201
206
  sql_explanation: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
202
207
  chunk_title: z.ZodString;
203
208
  chunk_explanation: z.ZodString;
204
209
  lines: z.ZodArray<z.ZodObject<{
205
210
  sql: z.ZodString;
206
211
  explanation: z.ZodString;
207
- }, "strip", z.ZodTypeAny, {
208
- explanation: string;
209
- sql: string;
210
- }, {
211
- explanation: string;
212
- sql: string;
213
- }>, "many">;
214
- }, "strip", z.ZodTypeAny, {
215
- chunk_title: string;
216
- chunk_explanation: string;
217
- lines: {
218
- explanation: string;
219
- sql: string;
220
- }[];
221
- }, {
222
- chunk_title: string;
223
- chunk_explanation: string;
224
- lines: {
225
- explanation: string;
226
- sql: string;
227
- }[];
228
- }>, "many">>>;
212
+ }, z.core.$strip>>;
213
+ }, z.core.$strip>>>>;
229
214
  business_explanation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
230
215
  summary: z.ZodString;
231
- implementation: z.ZodArray<z.ZodString, "many">;
216
+ implementation: z.ZodArray<z.ZodString>;
232
217
  assumptions: z.ZodArray<z.ZodObject<{
233
- type: z.ZodEnum<["grain", "completeness", "transformation", "relationship", "other"]>;
218
+ type: z.ZodEnum<{
219
+ grain: "grain";
220
+ completeness: "completeness";
221
+ transformation: "transformation";
222
+ relationship: "relationship";
223
+ other: "other";
224
+ }>;
234
225
  details: z.ZodString;
235
226
  explanation: z.ZodString;
236
- }, "strip", z.ZodTypeAny, {
237
- explanation: string;
238
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
239
- details: string;
240
- }, {
241
- explanation: string;
242
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
243
- details: string;
244
- }>, "many">;
245
- }, "strip", z.ZodTypeAny, {
246
- implementation: string[];
247
- summary: string;
248
- assumptions: {
249
- explanation: string;
250
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
251
- details: string;
252
- }[];
253
- }, {
254
- implementation: string[];
255
- summary: string;
256
- assumptions: {
257
- explanation: string;
258
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
259
- details: string;
260
- }[];
261
- }>>>;
227
+ }, z.core.$strip>>;
228
+ }, z.core.$strip>>>;
262
229
  columns_lineage: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
263
230
  nodes: z.ZodArray<z.ZodObject<{
264
231
  id: z.ZodString;
265
- type: z.ZodEnum<["entity", "attribute", "filter", "process", "combine", "result"]>;
232
+ type: z.ZodEnum<{
233
+ result: "result";
234
+ filter: "filter";
235
+ entity: "entity";
236
+ attribute: "attribute";
237
+ process: "process";
238
+ combine: "combine";
239
+ }>;
266
240
  explanation: z.ZodString;
267
- }, "strip", z.ZodTypeAny, {
268
- explanation: string;
269
- type: "filter" | "result" | "entity" | "attribute" | "process" | "combine";
270
- id: string;
271
- }, {
272
- explanation: string;
273
- type: "filter" | "result" | "entity" | "attribute" | "process" | "combine";
274
- id: string;
275
- }>, "many">;
241
+ }, z.core.$strip>>;
276
242
  edges: z.ZodArray<z.ZodObject<{
277
243
  source: z.ZodString;
278
244
  target: z.ZodString;
279
- }, "strip", z.ZodTypeAny, {
280
- source: string;
281
- target: string;
282
- }, {
283
- source: string;
284
- target: string;
285
- }>, "many">;
286
- }, "strip", z.ZodTypeAny, {
287
- nodes: {
288
- explanation: string;
289
- type: "filter" | "result" | "entity" | "attribute" | "process" | "combine";
290
- id: string;
291
- }[];
292
- edges: {
293
- source: string;
294
- target: string;
295
- }[];
296
- }, {
297
- nodes: {
298
- explanation: string;
299
- type: "filter" | "result" | "entity" | "attribute" | "process" | "combine";
300
- id: string;
301
- }[];
302
- edges: {
303
- source: string;
304
- target: string;
305
- }[];
306
- }>>>>;
245
+ }, z.core.$strip>>;
246
+ }, z.core.$strip>>>>;
307
247
  confidence_score: z.ZodNumber;
308
248
  confidence_score_reason: z.ZodString;
309
249
  assumptions_score: z.ZodOptional<z.ZodNumber>;
310
250
  assumptions_score_reason: z.ZodOptional<z.ZodString>;
311
251
  friendliness_score: z.ZodOptional<z.ZodNumber>;
312
252
  friendliness_score_reason: z.ZodOptional<z.ZodString>;
313
- id: z.ZodNumber;
314
- flow_data_id: z.ZodNumber;
315
- created_at: z.ZodString;
316
- }, "id" | "created_at">, "strip", z.ZodTypeAny, {
317
- flow_data_id: number;
318
- confidence_score: number;
319
- confidence_score_reason: string;
320
- sql_explanation?: {
321
- chunk_title: string;
322
- chunk_explanation: string;
323
- lines: {
324
- explanation: string;
325
- sql: string;
326
- }[];
327
- }[] | null | undefined;
328
- business_explanation?: {
329
- implementation: string[];
330
- summary: string;
331
- assumptions: {
332
- explanation: string;
333
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
334
- details: string;
335
- }[];
336
- } | null | undefined;
337
- columns_lineage?: Record<string, {
338
- nodes: {
339
- explanation: string;
340
- type: "filter" | "result" | "entity" | "attribute" | "process" | "combine";
341
- id: string;
342
- }[];
343
- edges: {
344
- source: string;
345
- target: string;
346
- }[];
347
- }> | null | undefined;
348
- assumptions_score?: number | undefined;
349
- assumptions_score_reason?: string | undefined;
350
- friendliness_score?: number | undefined;
351
- friendliness_score_reason?: string | undefined;
352
- }, {
353
- flow_data_id: number;
354
- confidence_score: number;
355
- confidence_score_reason: string;
356
- sql_explanation?: {
357
- chunk_title: string;
358
- chunk_explanation: string;
359
- lines: {
360
- explanation: string;
361
- sql: string;
362
- }[];
363
- }[] | null | undefined;
364
- business_explanation?: {
365
- implementation: string[];
366
- summary: string;
367
- assumptions: {
368
- explanation: string;
369
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
370
- details: string;
371
- }[];
372
- } | null | undefined;
373
- columns_lineage?: Record<string, {
374
- nodes: {
375
- explanation: string;
376
- type: "filter" | "result" | "entity" | "attribute" | "process" | "combine";
377
- id: string;
378
- }[];
379
- edges: {
380
- source: string;
381
- target: string;
382
- }[];
383
- }> | null | undefined;
384
- assumptions_score?: number | undefined;
385
- assumptions_score_reason?: string | undefined;
386
- friendliness_score?: number | undefined;
387
- friendliness_score_reason?: string | undefined;
388
- }>;
253
+ }, z.core.$strip>;
389
254
 
390
- declare const FrontendReportSchema: z.ZodObject<Omit<{
391
- created_at: z.ZodString;
392
- flow_id: z.ZodString;
393
- id: z.ZodNumber;
394
- is_sample: z.ZodBoolean;
395
- schema: z.ZodString;
396
- sql: z.ZodString;
397
- table: z.ZodString;
255
+ declare const FrontendReportSchema: z.ZodObject<{
256
+ status: z.ZodNullable<z.ZodString>;
398
257
  title: z.ZodString;
258
+ id: z.ZodNumber;
399
259
  request: z.ZodNullable<z.ZodString>;
400
- data_sample: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
260
+ created_at: z.ZodString;
261
+ is_removed: z.ZodBoolean;
262
+ flow_id: z.ZodString;
263
+ bookmarked: z.ZodBoolean;
401
264
  data_summary: z.ZodObject<{
402
265
  columns: z.ZodRecord<z.ZodString, z.ZodObject<{
403
266
  position: z.ZodOptional<z.ZodNumber>;
@@ -405,118 +268,18 @@ declare const FrontendReportSchema: z.ZodObject<Omit<{
405
268
  null_count: z.ZodNullable<z.ZodNumber>;
406
269
  unique_count: z.ZodNullable<z.ZodNumber>;
407
270
  unique_percentage: z.ZodNullable<z.ZodNumber>;
408
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
409
- position: z.ZodOptional<z.ZodNumber>;
410
- data_type: z.ZodString;
411
- null_count: z.ZodNullable<z.ZodNumber>;
412
- unique_count: z.ZodNullable<z.ZodNumber>;
413
- unique_percentage: z.ZodNullable<z.ZodNumber>;
414
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
415
- position: z.ZodOptional<z.ZodNumber>;
416
- data_type: z.ZodString;
417
- null_count: z.ZodNullable<z.ZodNumber>;
418
- unique_count: z.ZodNullable<z.ZodNumber>;
419
- unique_percentage: z.ZodNullable<z.ZodNumber>;
420
- }, z.ZodTypeAny, "passthrough">>>;
421
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
422
- columns: z.ZodRecord<z.ZodString, z.ZodObject<{
423
- position: z.ZodOptional<z.ZodNumber>;
424
- data_type: z.ZodString;
425
- null_count: z.ZodNullable<z.ZodNumber>;
426
- unique_count: z.ZodNullable<z.ZodNumber>;
427
- unique_percentage: z.ZodNullable<z.ZodNumber>;
428
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
429
- position: z.ZodOptional<z.ZodNumber>;
430
- data_type: z.ZodString;
431
- null_count: z.ZodNullable<z.ZodNumber>;
432
- unique_count: z.ZodNullable<z.ZodNumber>;
433
- unique_percentage: z.ZodNullable<z.ZodNumber>;
434
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
435
- position: z.ZodOptional<z.ZodNumber>;
436
- data_type: z.ZodString;
437
- null_count: z.ZodNullable<z.ZodNumber>;
438
- unique_count: z.ZodNullable<z.ZodNumber>;
439
- unique_percentage: z.ZodNullable<z.ZodNumber>;
440
- }, z.ZodTypeAny, "passthrough">>>;
441
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
442
- columns: z.ZodRecord<z.ZodString, z.ZodObject<{
443
- position: z.ZodOptional<z.ZodNumber>;
444
- data_type: z.ZodString;
445
- null_count: z.ZodNullable<z.ZodNumber>;
446
- unique_count: z.ZodNullable<z.ZodNumber>;
447
- unique_percentage: z.ZodNullable<z.ZodNumber>;
448
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
449
- position: z.ZodOptional<z.ZodNumber>;
450
- data_type: z.ZodString;
451
- null_count: z.ZodNullable<z.ZodNumber>;
452
- unique_count: z.ZodNullable<z.ZodNumber>;
453
- unique_percentage: z.ZodNullable<z.ZodNumber>;
454
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
455
- position: z.ZodOptional<z.ZodNumber>;
456
- data_type: z.ZodString;
457
- null_count: z.ZodNullable<z.ZodNumber>;
458
- unique_count: z.ZodNullable<z.ZodNumber>;
459
- unique_percentage: z.ZodNullable<z.ZodNumber>;
460
- }, z.ZodTypeAny, "passthrough">>>;
461
- }, z.ZodTypeAny, "passthrough">>;
462
- bookmarked: z.ZodBoolean;
463
- status: z.ZodNullable<z.ZodString>;
464
- is_removed: z.ZodBoolean;
465
- }, "schema" | "sql" | "table" | "data_sample" | "is_sample">, "strip", z.ZodTypeAny, {
466
- title: string;
467
- status: string | null;
468
- id: number;
469
- request: string | null;
470
- created_at: string;
471
- is_removed: boolean;
472
- flow_id: string;
473
- bookmarked: boolean;
474
- data_summary: {
475
- columns: Record<string, z.objectOutputType<{
476
- position: z.ZodOptional<z.ZodNumber>;
477
- data_type: z.ZodString;
478
- null_count: z.ZodNullable<z.ZodNumber>;
479
- unique_count: z.ZodNullable<z.ZodNumber>;
480
- unique_percentage: z.ZodNullable<z.ZodNumber>;
481
- }, z.ZodTypeAny, "passthrough">>;
482
- } & {
483
- [k: string]: unknown;
484
- };
485
- }, {
486
- title: string;
487
- status: string | null;
488
- id: number;
489
- request: string | null;
490
- created_at: string;
491
- is_removed: boolean;
492
- flow_id: string;
493
- bookmarked: boolean;
494
- data_summary: {
495
- columns: Record<string, z.objectInputType<{
496
- position: z.ZodOptional<z.ZodNumber>;
497
- data_type: z.ZodString;
498
- null_count: z.ZodNullable<z.ZodNumber>;
499
- unique_count: z.ZodNullable<z.ZodNumber>;
500
- unique_percentage: z.ZodNullable<z.ZodNumber>;
501
- }, z.ZodTypeAny, "passthrough">>;
502
- } & {
503
- [k: string]: unknown;
504
- };
505
- }>;
271
+ }, z.core.$loose>>;
272
+ }, z.core.$loose>;
273
+ }, z.core.$strip>;
506
274
 
507
275
  declare type FrontendVisualization = z.output<typeof FrontendVisualizationSchema>;
508
276
 
509
- declare const FrontendVisualizationSchema: z.ZodObject<Omit<{
277
+ declare const FrontendVisualizationSchema: z.ZodObject<{
510
278
  id: z.ZodNumber;
511
- flow_data_id: z.ZodNumber;
512
279
  created_at: z.ZodString;
513
- sql: z.ZodString;
280
+ flow_data_id: z.ZodNumber;
514
281
  bookmarked: z.ZodBoolean;
515
- data_sample: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
516
- is_sample: z.ZodBoolean;
517
- data_summary: z.ZodRecord<z.ZodString, z.ZodUnknown>;
518
- } & {
519
- configuration: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
282
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
520
283
  config_version: z.ZodLiteral<2>;
521
284
  xAxisLabel: z.ZodString;
522
285
  yAxisLabel: z.ZodString;
@@ -525,46 +288,14 @@ declare const FrontendVisualizationSchema: z.ZodObject<Omit<{
525
288
  valueColumn: z.ZodString;
526
289
  title: z.ZodString;
527
290
  type: z.ZodLiteral<"bar">;
528
- }, "strip", z.ZodTypeAny, {
529
- type: "bar";
530
- title: string;
531
- xAxisLabel: string;
532
- yAxisLabel: string;
533
- config_version: 2;
534
- categoryColumn: string;
535
- valueColumn: string;
536
- secondaryCategoryColumn?: string | undefined;
537
- }, {
538
- type: "bar";
539
- title: string;
540
- xAxisLabel: string;
541
- yAxisLabel: string;
542
- config_version: 2;
543
- categoryColumn: string;
544
- valueColumn: string;
545
- secondaryCategoryColumn?: string | undefined;
546
- }>, z.ZodObject<{
291
+ }, z.core.$strip>, z.ZodObject<{
547
292
  xAxisColumn: z.ZodString;
548
- valueColumns: z.ZodArray<z.ZodString, "many">;
549
- yAxisLabels: z.ZodArray<z.ZodString, "many">;
293
+ valueColumns: z.ZodArray<z.ZodString>;
294
+ yAxisLabels: z.ZodArray<z.ZodString>;
550
295
  title: z.ZodString;
551
296
  type: z.ZodLiteral<"line/area">;
552
297
  config_version: z.ZodLiteral<2>;
553
- }, "strip", z.ZodTypeAny, {
554
- type: "line/area";
555
- title: string;
556
- valueColumns: string[];
557
- config_version: 2;
558
- xAxisColumn: string;
559
- yAxisLabels: string[];
560
- }, {
561
- type: "line/area";
562
- title: string;
563
- valueColumns: string[];
564
- config_version: 2;
565
- xAxisColumn: string;
566
- yAxisLabels: string[];
567
- }>, z.ZodObject<{
298
+ }, z.core.$strip>, z.ZodObject<{
568
299
  config_version: z.ZodLiteral<2>;
569
300
  valueColumn: z.ZodString;
570
301
  xAxisColumn: z.ZodString;
@@ -573,25 +304,7 @@ declare const FrontendVisualizationSchema: z.ZodObject<Omit<{
573
304
  categoryColumn: z.ZodString;
574
305
  title: z.ZodString;
575
306
  type: z.ZodLiteral<"line/area-categorical">;
576
- }, "strip", z.ZodTypeAny, {
577
- type: "line/area-categorical";
578
- title: string;
579
- xAxisLabel: string;
580
- yAxisLabel: string;
581
- config_version: 2;
582
- categoryColumn: string;
583
- valueColumn: string;
584
- xAxisColumn: string;
585
- }, {
586
- type: "line/area-categorical";
587
- title: string;
588
- xAxisLabel: string;
589
- yAxisLabel: string;
590
- config_version: 2;
591
- categoryColumn: string;
592
- valueColumn: string;
593
- xAxisColumn: string;
594
- }>, z.ZodObject<{
307
+ }, z.core.$strip>, z.ZodObject<{
595
308
  config_version: z.ZodLiteral<2>;
596
309
  xAxisLabel: z.ZodString;
597
310
  yAxisLabel: z.ZodString;
@@ -599,132 +312,14 @@ declare const FrontendVisualizationSchema: z.ZodObject<Omit<{
599
312
  yAxisValueColumn: z.ZodString;
600
313
  title: z.ZodString;
601
314
  type: z.ZodLiteral<"scatter">;
602
- }, "strip", z.ZodTypeAny, {
603
- type: "scatter";
604
- title: string;
605
- xAxisLabel: string;
606
- yAxisLabel: string;
607
- config_version: 2;
608
- xAxisValueColumn: string;
609
- yAxisValueColumn: string;
610
- }, {
611
- type: "scatter";
612
- title: string;
613
- xAxisLabel: string;
614
- yAxisLabel: string;
615
- config_version: 2;
616
- xAxisValueColumn: string;
617
- yAxisValueColumn: string;
618
- }>, z.ZodObject<{
315
+ }, z.core.$strip>, z.ZodObject<{
619
316
  config_version: z.ZodLiteral<2>;
620
317
  categoryColumn: z.ZodString;
621
318
  valueColumn: z.ZodString;
622
319
  title: z.ZodString;
623
320
  type: z.ZodLiteral<"pie">;
624
- }, "strip", z.ZodTypeAny, {
625
- type: "pie";
626
- title: string;
627
- config_version: 2;
628
- categoryColumn: string;
629
- valueColumn: string;
630
- }, {
631
- type: "pie";
632
- title: string;
633
- config_version: 2;
634
- categoryColumn: string;
635
- valueColumn: string;
636
- }>]>;
637
- }, "sql" | "data_sample" | "is_sample" | "data_summary">, "strip", z.ZodTypeAny, {
638
- id: number;
639
- created_at: string;
640
- flow_data_id: number;
641
- bookmarked: boolean;
642
- configuration: {
643
- type: "bar";
644
- title: string;
645
- xAxisLabel: string;
646
- yAxisLabel: string;
647
- config_version: 2;
648
- categoryColumn: string;
649
- valueColumn: string;
650
- secondaryCategoryColumn?: string | undefined;
651
- } | {
652
- type: "line/area";
653
- title: string;
654
- valueColumns: string[];
655
- config_version: 2;
656
- xAxisColumn: string;
657
- yAxisLabels: string[];
658
- } | {
659
- type: "line/area-categorical";
660
- title: string;
661
- xAxisLabel: string;
662
- yAxisLabel: string;
663
- config_version: 2;
664
- categoryColumn: string;
665
- valueColumn: string;
666
- xAxisColumn: string;
667
- } | {
668
- type: "scatter";
669
- title: string;
670
- xAxisLabel: string;
671
- yAxisLabel: string;
672
- config_version: 2;
673
- xAxisValueColumn: string;
674
- yAxisValueColumn: string;
675
- } | {
676
- type: "pie";
677
- title: string;
678
- config_version: 2;
679
- categoryColumn: string;
680
- valueColumn: string;
681
- };
682
- }, {
683
- id: number;
684
- created_at: string;
685
- flow_data_id: number;
686
- bookmarked: boolean;
687
- configuration: {
688
- type: "bar";
689
- title: string;
690
- xAxisLabel: string;
691
- yAxisLabel: string;
692
- config_version: 2;
693
- categoryColumn: string;
694
- valueColumn: string;
695
- secondaryCategoryColumn?: string | undefined;
696
- } | {
697
- type: "line/area";
698
- title: string;
699
- valueColumns: string[];
700
- config_version: 2;
701
- xAxisColumn: string;
702
- yAxisLabels: string[];
703
- } | {
704
- type: "line/area-categorical";
705
- title: string;
706
- xAxisLabel: string;
707
- yAxisLabel: string;
708
- config_version: 2;
709
- categoryColumn: string;
710
- valueColumn: string;
711
- xAxisColumn: string;
712
- } | {
713
- type: "scatter";
714
- title: string;
715
- xAxisLabel: string;
716
- yAxisLabel: string;
717
- config_version: 2;
718
- xAxisValueColumn: string;
719
- yAxisValueColumn: string;
720
- } | {
721
- type: "pie";
722
- title: string;
723
- config_version: 2;
724
- categoryColumn: string;
725
- valueColumn: string;
726
- };
727
- }>;
321
+ }, z.core.$strip>], "type">;
322
+ }, z.core.$strip>;
728
323
 
729
324
  export { GenerateInsightParam }
730
325
 
@@ -742,7 +337,7 @@ declare type InfiniteDataTableUIProps = {
742
337
  totalRows: number;
743
338
  };
744
339
 
745
- export declare const logout: () => Promise<void>;
340
+ export declare const logout: () => void;
746
341
 
747
342
  export { MageMetricsClient }
748
343
 
@@ -774,32 +369,84 @@ declare type MageMetricsPublicContextProviderProps = PropsWithChildren<Pick<Mage
774
369
  export declare const ManagedModal: React.FC<ManagedModalProps>;
775
370
 
776
371
  declare interface ManagedModalProps extends ModalProps {
372
+ /** API key for authenticating with the MageMetrics service */
777
373
  apiKey: string;
374
+ /** External JWT token for user authentication */
778
375
  externalJwt: string;
376
+ /** Base URL for the MageMetrics API */
779
377
  apiUrl: string;
378
+ /** Whether to disable canvas functionality in conversations */
780
379
  disableCanvas?: boolean;
380
+ /** Whether to render data freshness info in the conversation header */
381
+ showDataFreshness?: boolean;
382
+ /** Where to persist modal state (localStorage, queryParam, or none) */
781
383
  persist?: PersistenceOptions;
384
+ /** Custom component overrides for extending functionality */
782
385
  components?: Components;
783
386
  }
784
387
 
785
388
  declare interface ModalProps {
389
+ /** CSS display property for the wrapper element */
786
390
  display?: string;
391
+ /** Control modal visibility and close behavior externally */
787
392
  modal?: ControlledModalProps;
393
+ /** Configuration options for the start modal (chat launcher, recommendations, etc.) */
788
394
  startOptions?: StartOptions;
789
395
  }
790
396
 
397
+ export declare const PaginatedDataTableUI: React.FC<PaginatedDataTableUIProps>;
398
+
399
+ declare type PaginatedDataTableUIProps = {
400
+ reportId: number;
401
+ data: Record<string, unknown>[];
402
+ columns: FrontendReportColumns;
403
+ explainability: FrontendReportExplainability | null | undefined;
404
+ isFetching: boolean;
405
+ totalRows?: number;
406
+ pageIndex: number;
407
+ pageSize: number;
408
+ totalPages?: number;
409
+ hasNextPage: boolean;
410
+ hasPreviousPage: boolean;
411
+ onNextPage: () => void;
412
+ onPreviousPage: () => void;
413
+ goToPage: (page: number) => void;
414
+ sorting: SortingState;
415
+ onSortingChange: OnChangeFn<SortingState>;
416
+ filters: TableFilters;
417
+ onFiltersChange: (filters: TableFilters) => void;
418
+ onCalculatedPageSize?: (pageSize: number) => void;
419
+ onStateChange?: (state: {
420
+ pageIndex: number;
421
+ pageSize: number;
422
+ sorting: SortingState;
423
+ filters: TableFilters;
424
+ }) => void;
425
+ emptyState?: React.ReactNode;
426
+ };
427
+
791
428
  declare type PersistenceOptions = "queryParam" | "none";
792
429
 
793
430
  export declare const PublicCanvas: React.FC<React.ComponentProps<typeof PublicCanvasPanel>>;
794
431
 
795
- /** This component is not bounded in height and must be wrapped in a container to properly work */
796
- export declare const PublicCanvasDataReport: React.FC<{
432
+ declare const PublicCanvasPanel: default_2.FC<{
797
433
  canvasId: string;
798
- reportId: number;
799
434
  }>;
800
435
 
801
- declare const PublicCanvasPanel: default_2.FC<{
436
+ /**
437
+ * This component is not bounded in height and must be wrapped in a container to properly work
438
+ * @param props - props
439
+ * @param props.canvasId - The ID of the canvas to display
440
+ * @param props.reportId - The ID of the report to display
441
+ * @param props.initialState - The initial state of data table
442
+ * @param props.onStateChange - Callback function to handle state changes
443
+ * @returns JSX.Element
444
+ */
445
+ export declare const PublicDataReport: React.FC<{
802
446
  canvasId: string;
447
+ reportId: number;
448
+ initialState?: DataTableState;
449
+ onStateChange?: (state: DataTableState) => void;
803
450
  }>;
804
451
 
805
452
  declare type ReportDataFilters = {
@@ -818,13 +465,19 @@ declare type StandaloneConversationModalProps = {
818
465
  opened: boolean;
819
466
  flowId: string;
820
467
  disableCanvas?: boolean;
468
+ showDataFreshness?: boolean;
821
469
  onOpenChange?: (open: boolean) => void;
822
470
  };
823
471
 
824
472
  declare type StartOptions = DisplayControlProps & {
473
+ /** Label text displayed above the chat launcher input */
825
474
  label?: string;
475
+ /** Label text displayed above the recommendations section */
826
476
  recommendationsLabel?: string;
477
+ /** Placeholder text for the chat launcher input field */
827
478
  placeholder?: string;
479
+ /** Whether the chat launcher input should auto-focus on mount */
480
+ autoFocus?: boolean;
828
481
  };
829
482
 
830
483
  declare type TableFilters = Record<string, string | number>;
@@ -957,11 +610,15 @@ export declare const useDataReport: (reportId: FrontendReport["id"]) => {
957
610
  }[] | undefined;
958
611
  isPendingColumns: boolean;
959
612
  isPendingData: boolean;
960
- fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData<Record<string, unknown>[], unknown>, Error>>;
613
+ fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData< {
614
+ [key: string]: unknown;
615
+ }[], unknown>, Error>>;
961
616
  isFetching: boolean;
962
617
  isFetchingNextPage: boolean;
963
618
  hasNextPage: boolean;
964
- allData: Record<string, unknown>[];
619
+ allData: {
620
+ [key: string]: unknown;
621
+ }[];
965
622
  explainability: {
966
623
  sql_explanation?: {
967
624
  chunk_title: string;
@@ -1002,10 +659,14 @@ export declare const useDataReport: (reportId: FrontendReport["id"]) => {
1002
659
  flow_data_id: number;
1003
660
  } | null | undefined;
1004
661
  totalRows: number;
1005
- infiniteData: InfiniteData<Record<string, unknown>[], unknown> | undefined;
662
+ infiniteData: InfiniteData< {
663
+ [key: string]: unknown;
664
+ }[], unknown> | undefined;
1006
665
  };
1007
666
 
1008
- export declare const useDataReportColumnValue: (reportId: number, filters: ReportDataFilters) => UseQueryResult<Record<string, unknown>[], Error>;
667
+ export declare const useDataReportColumnValue: (reportId: number, filters: ReportDataFilters) => UseQueryResult< {
668
+ [key: string]: unknown;
669
+ }[], Error>;
1009
670
 
1010
671
  export declare const useDownloadReportData: (options?: UseMutationOptions<ExportReportDataResult, Error, ExportReportDataParams>) => {
1011
672
  download: UseMutateFunction<ExportReportDataResult, Error, ExportReportDataParams, unknown>;
@@ -1250,6 +911,79 @@ export declare const useMageMetricsClient: () => MageMetricsClient;
1250
911
 
1251
912
  export declare const useMageMetricsReady: () => false | MageMetricsClient;
1252
913
 
914
+ export declare const usePaginatedDataReport: (reportId: FrontendReport["id"], options?: {
915
+ pageSize?: number;
916
+ initialPageIndex?: number;
917
+ initialSorting?: SortingState_2;
918
+ initialFilters?: TableFilters;
919
+ }) => {
920
+ columns: {
921
+ name: string;
922
+ data_type: string;
923
+ dataType: string;
924
+ renderType?: string;
925
+ unit?: string;
926
+ }[] | undefined;
927
+ isPendingColumns: boolean;
928
+ isPendingData: boolean;
929
+ isFetching: boolean;
930
+ data: {
931
+ [key: string]: unknown;
932
+ }[];
933
+ explainability: {
934
+ sql_explanation?: {
935
+ chunk_title: string;
936
+ chunk_explanation: string;
937
+ lines: {
938
+ sql: string;
939
+ explanation: string;
940
+ }[];
941
+ }[] | null;
942
+ business_explanation?: {
943
+ summary: string;
944
+ implementation: string[];
945
+ assumptions: {
946
+ type: "grain" | "completeness" | "transformation" | "relationship" | "other";
947
+ details: string;
948
+ explanation: string;
949
+ }[];
950
+ } | null;
951
+ columns_lineage?: {
952
+ [key: string]: {
953
+ nodes: {
954
+ id: string;
955
+ type: "entity" | "attribute" | "filter" | "process" | "combine" | "result";
956
+ explanation: string;
957
+ }[];
958
+ edges: {
959
+ source: string;
960
+ target: string;
961
+ }[];
962
+ };
963
+ } | null;
964
+ confidence_score: number;
965
+ confidence_score_reason: string;
966
+ assumptions_score?: number;
967
+ assumptions_score_reason?: string;
968
+ friendliness_score?: number;
969
+ friendliness_score_reason?: string;
970
+ flow_data_id: number;
971
+ } | null | undefined;
972
+ totalRows: number | undefined;
973
+ pageIndex: number;
974
+ pageSize: number;
975
+ totalPages: number | undefined;
976
+ nextPage: () => void;
977
+ previousPage: () => void;
978
+ goToPage: (page: number) => void;
979
+ hasNextPage: boolean;
980
+ hasPreviousPage: boolean;
981
+ sorting: SortingState_2;
982
+ setSorting: Dispatch<SetStateAction<SortingState_2>>;
983
+ filters: TableFilters;
984
+ setFilters: (newFilters: TableFilters) => void;
985
+ };
986
+
1253
987
  export declare const useRecentFlows: (limit?: number) => UseQueryResult< {
1254
988
  id: string;
1255
989
  request: string;
@@ -1259,194 +993,50 @@ user_id: string | null;
1259
993
 
1260
994
  declare type V1FrontendVisualization = z.output<typeof V1FrontendVisualizationSchema>;
1261
995
 
1262
- declare const V1FrontendVisualizationSchema: z.ZodObject<Omit<{
996
+ declare const V1FrontendVisualizationSchema: z.ZodObject<{
1263
997
  id: z.ZodNumber;
1264
- flow_data_id: z.ZodNumber;
1265
998
  created_at: z.ZodString;
1266
- sql: z.ZodString;
999
+ flow_data_id: z.ZodNumber;
1267
1000
  bookmarked: z.ZodBoolean;
1268
- data_sample: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
1269
- is_sample: z.ZodBoolean;
1270
- data_summary: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1271
- } & {
1272
- configuration: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1001
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
1273
1002
  xAxisLabel: z.ZodString;
1274
1003
  yAxisLabel: z.ZodString;
1275
1004
  xAxisDataKey: z.ZodOptional<z.ZodString>;
1276
1005
  yAxisDataKey: z.ZodOptional<z.ZodString>;
1277
1006
  dimensionDataKey: z.ZodOptional<z.ZodString>;
1278
- valueColumns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1007
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
1279
1008
  title: z.ZodString;
1280
1009
  type: z.ZodLiteral<"bar">;
1281
- }, "strip", z.ZodTypeAny, {
1282
- type: "bar";
1283
- title: string;
1284
- xAxisLabel: string;
1285
- yAxisLabel: string;
1286
- valueColumns?: string[] | undefined;
1287
- xAxisDataKey?: string | undefined;
1288
- yAxisDataKey?: string | undefined;
1289
- dimensionDataKey?: string | undefined;
1290
- }, {
1291
- type: "bar";
1292
- title: string;
1293
- xAxisLabel: string;
1294
- yAxisLabel: string;
1295
- valueColumns?: string[] | undefined;
1296
- xAxisDataKey?: string | undefined;
1297
- yAxisDataKey?: string | undefined;
1298
- dimensionDataKey?: string | undefined;
1299
- }>, z.ZodObject<{
1010
+ }, z.core.$strip>, z.ZodObject<{
1300
1011
  xAxisLabel: z.ZodString;
1301
1012
  yAxisLabel: z.ZodString;
1302
1013
  xAxisDataKey: z.ZodOptional<z.ZodString>;
1303
1014
  yAxisDataKey: z.ZodOptional<z.ZodString>;
1304
1015
  dimensionDataKey: z.ZodOptional<z.ZodString>;
1305
- valueColumns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1016
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
1306
1017
  title: z.ZodString;
1307
1018
  type: z.ZodLiteral<"line/area">;
1308
- }, "strip", z.ZodTypeAny, {
1309
- type: "line/area";
1310
- title: string;
1311
- xAxisLabel: string;
1312
- yAxisLabel: string;
1313
- valueColumns?: string[] | undefined;
1314
- xAxisDataKey?: string | undefined;
1315
- yAxisDataKey?: string | undefined;
1316
- dimensionDataKey?: string | undefined;
1317
- }, {
1318
- type: "line/area";
1319
- title: string;
1320
- xAxisLabel: string;
1321
- yAxisLabel: string;
1322
- valueColumns?: string[] | undefined;
1323
- xAxisDataKey?: string | undefined;
1324
- yAxisDataKey?: string | undefined;
1325
- dimensionDataKey?: string | undefined;
1326
- }>, z.ZodObject<{
1019
+ }, z.core.$strip>, z.ZodObject<{
1327
1020
  xAxisLabel: z.ZodString;
1328
1021
  yAxisLabel: z.ZodString;
1329
1022
  xAxisDataKey: z.ZodOptional<z.ZodString>;
1330
1023
  yAxisDataKey: z.ZodOptional<z.ZodString>;
1331
1024
  dimensionDataKey: z.ZodOptional<z.ZodString>;
1332
- valueColumns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1025
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
1333
1026
  title: z.ZodString;
1334
1027
  type: z.ZodLiteral<"scatter">;
1335
- }, "strip", z.ZodTypeAny, {
1336
- type: "scatter";
1337
- title: string;
1338
- xAxisLabel: string;
1339
- yAxisLabel: string;
1340
- valueColumns?: string[] | undefined;
1341
- xAxisDataKey?: string | undefined;
1342
- yAxisDataKey?: string | undefined;
1343
- dimensionDataKey?: string | undefined;
1344
- }, {
1345
- type: "scatter";
1346
- title: string;
1347
- xAxisLabel: string;
1348
- yAxisLabel: string;
1349
- valueColumns?: string[] | undefined;
1350
- xAxisDataKey?: string | undefined;
1351
- yAxisDataKey?: string | undefined;
1352
- dimensionDataKey?: string | undefined;
1353
- }>, z.ZodObject<{
1028
+ }, z.core.$strip>, z.ZodObject<{
1354
1029
  nameKey: z.ZodString;
1355
1030
  dataKey: z.ZodString;
1356
1031
  title: z.ZodString;
1357
1032
  type: z.ZodLiteral<"pie">;
1358
- }, "strip", z.ZodTypeAny, {
1359
- type: "pie";
1360
- title: string;
1361
- nameKey: string;
1362
- dataKey: string;
1363
- }, {
1364
- type: "pie";
1365
- title: string;
1366
- nameKey: string;
1367
- dataKey: string;
1368
- }>]>;
1369
- }, "sql" | "data_sample" | "is_sample" | "data_summary">, "strip", z.ZodTypeAny, {
1370
- id: number;
1371
- created_at: string;
1372
- flow_data_id: number;
1373
- bookmarked: boolean;
1374
- configuration: {
1375
- type: "bar";
1376
- title: string;
1377
- xAxisLabel: string;
1378
- yAxisLabel: string;
1379
- valueColumns?: string[] | undefined;
1380
- xAxisDataKey?: string | undefined;
1381
- yAxisDataKey?: string | undefined;
1382
- dimensionDataKey?: string | undefined;
1383
- } | {
1384
- type: "line/area";
1385
- title: string;
1386
- xAxisLabel: string;
1387
- yAxisLabel: string;
1388
- valueColumns?: string[] | undefined;
1389
- xAxisDataKey?: string | undefined;
1390
- yAxisDataKey?: string | undefined;
1391
- dimensionDataKey?: string | undefined;
1392
- } | {
1393
- type: "scatter";
1394
- title: string;
1395
- xAxisLabel: string;
1396
- yAxisLabel: string;
1397
- valueColumns?: string[] | undefined;
1398
- xAxisDataKey?: string | undefined;
1399
- yAxisDataKey?: string | undefined;
1400
- dimensionDataKey?: string | undefined;
1401
- } | {
1402
- type: "pie";
1403
- title: string;
1404
- nameKey: string;
1405
- dataKey: string;
1406
- };
1407
- }, {
1408
- id: number;
1409
- created_at: string;
1410
- flow_data_id: number;
1411
- bookmarked: boolean;
1412
- configuration: {
1413
- type: "bar";
1414
- title: string;
1415
- xAxisLabel: string;
1416
- yAxisLabel: string;
1417
- valueColumns?: string[] | undefined;
1418
- xAxisDataKey?: string | undefined;
1419
- yAxisDataKey?: string | undefined;
1420
- dimensionDataKey?: string | undefined;
1421
- } | {
1422
- type: "line/area";
1423
- title: string;
1424
- xAxisLabel: string;
1425
- yAxisLabel: string;
1426
- valueColumns?: string[] | undefined;
1427
- xAxisDataKey?: string | undefined;
1428
- yAxisDataKey?: string | undefined;
1429
- dimensionDataKey?: string | undefined;
1430
- } | {
1431
- type: "scatter";
1432
- title: string;
1433
- xAxisLabel: string;
1434
- yAxisLabel: string;
1435
- valueColumns?: string[] | undefined;
1436
- xAxisDataKey?: string | undefined;
1437
- yAxisDataKey?: string | undefined;
1438
- dimensionDataKey?: string | undefined;
1439
- } | {
1440
- type: "pie";
1441
- title: string;
1442
- nameKey: string;
1443
- dataKey: string;
1444
- };
1445
- }>;
1033
+ }, z.core.$strip>], "type">;
1034
+ }, z.core.$strip>;
1446
1035
 
1447
1036
  export declare const Visualization: ForwardRefExoticComponent< {
1448
1037
  visualizationId: number;
1449
1038
  withTitle: boolean;
1039
+ exportingEnabled?: boolean;
1450
1040
  } & RefAttributes<HTMLDivElement>>;
1451
1041
 
1452
1042
  export { }
@@ -1455,7 +1045,7 @@ export { }
1455
1045
  declare module "react" {
1456
1046
  namespace JSX {
1457
1047
  interface IntrinsicElements {
1458
- "magemetrics-ai": ManagedModalProps;
1048
+ "magemetrics-ai": WebComponentManagedModalProps;
1459
1049
  }
1460
1050
  }
1461
1051
  }
@@ -1464,7 +1054,7 @@ declare module "react" {
1464
1054
  declare module "react" {
1465
1055
  namespace JSX {
1466
1056
  interface IntrinsicElements {
1467
- "magemetrics-ai": ManagedModalProps;
1057
+ "magemetrics-ai": WebComponentManagedModalProps;
1468
1058
  }
1469
1059
  }
1470
1060
  }