@magemetrics/ai 0.3.3 → 0.4.1-RC1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,14 +2,14 @@ import { AuthState } from '@magemetrics/core';
2
2
  import { CreateFlowParam } from '@magemetrics/core';
3
3
  import { default as default_2 } from 'react';
4
4
  import { FetchNextPageOptions } from '@tanstack/react-query';
5
- import { ForwardRefExoticComponent } from 'react';
6
5
  import { GenerateInsightParam } from '@magemetrics/core';
7
6
  import { InfiniteData } from '@tanstack/react-query';
8
7
  import { InfiniteQueryObserverResult } from '@tanstack/react-query';
8
+ import { JSX } from 'react/jsx-runtime';
9
9
  import { MageMetricsClient } from '@magemetrics/core';
10
10
  import { MageMetricsClientConfig } from '@magemetrics/core';
11
11
  import { PropsWithChildren } from 'react';
12
- import { RefAttributes } from 'react';
12
+ import { SortingState as SortingState_2 } from '@tanstack/react-table';
13
13
  import { UseMutateAsyncFunction } from '@tanstack/react-query';
14
14
  import { UseMutateFunction } from '@tanstack/react-query';
15
15
  import { UseMutationOptions } from '@tanstack/react-query';
@@ -41,7 +41,9 @@ export declare interface Components {
41
41
  [key: string]: (props: CellContentProps) => default_2.ReactNode;
42
42
  };
43
43
  };
44
- dataReportTable?: (props: DataReportMessageProps) => default_2.ReactNode;
44
+ dataReportTable?: (props: {
45
+ report: FrontendReport;
46
+ }) => default_2.ReactNode;
45
47
  dataReportMessageActions?: (props: {
46
48
  report: FrontendReport;
47
49
  isSelected: boolean;
@@ -65,8 +67,6 @@ declare type ControlledModalProps = {
65
67
  onClose: () => void;
66
68
  };
67
69
 
68
- export declare const ConversationContent: React.FC<ConversationContentProps>;
69
-
70
70
  declare interface ConversationContentProps {
71
71
  flowId?: string;
72
72
  className?: string;
@@ -77,29 +77,7 @@ declare interface ConversationContentProps {
77
77
 
78
78
  export { CreateFlowParam }
79
79
 
80
- /** This component is not bounded in height and must be wrapped in a container to properly work */
81
- export declare const DataReport: React.FC<{
82
- reportId: number;
83
- }>;
84
-
85
- export declare interface DataReportMessageProps {
86
- report: FrontendReport;
87
- explainability: FrontendReportExplainability | null | undefined;
88
- infiniteData: {
89
- data?: {
90
- pages: Record<string, unknown>[][];
91
- };
92
- isPending: boolean;
93
- fetchNextPage: () => Promise<unknown>;
94
- isFetching: boolean;
95
- isFetchingNextPage: boolean;
96
- hasNextPage: boolean | undefined;
97
- };
98
- columns: FrontendReportColumns;
99
- totalRows: number;
100
- }
101
-
102
- export declare const DataTable: React.FC<DataReportMessageProps>;
80
+ export declare const DataTable: () => JSX.Element;
103
81
 
104
82
  declare type DisplayControlProps = {
105
83
  /** Whether to display the recommendations section when the input is active */
@@ -116,10 +94,6 @@ declare type DomWrapperProps = {
116
94
  display?: string;
117
95
  };
118
96
 
119
- export declare const DownloadDataReportButton: React.FC<{
120
- reportId: number;
121
- }>;
122
-
123
97
  declare type ExportReportDataParams = {
124
98
  reportId: number;
125
99
  filename?: string;
@@ -169,69 +143,6 @@ declare type FormattedData = {
169
143
 
170
144
  declare type FrontendReport = z.infer<typeof FrontendReportSchema>;
171
145
 
172
- declare type FrontendReportColumns = z.infer<typeof FrontendReportColumnsSchema>;
173
-
174
- declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
175
- dataType: z.ZodString;
176
- renderType: z.ZodOptional<z.ZodString>;
177
- unit: z.ZodOptional<z.ZodString>;
178
- name: z.ZodString;
179
- data_type: z.ZodString;
180
- }, z.core.$strip>>;
181
-
182
- declare type FrontendReportExplainability = z.infer<typeof FrontendReportExplainabilitySchema>;
183
-
184
- declare const FrontendReportExplainabilitySchema: z.ZodObject<{
185
- flow_data_id: z.ZodNumber;
186
- sql_explanation: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
187
- chunk_title: z.ZodString;
188
- chunk_explanation: z.ZodString;
189
- lines: z.ZodArray<z.ZodObject<{
190
- sql: z.ZodString;
191
- explanation: z.ZodString;
192
- }, z.core.$strip>>;
193
- }, z.core.$strip>>>>;
194
- business_explanation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
195
- summary: z.ZodString;
196
- implementation: z.ZodArray<z.ZodString>;
197
- assumptions: z.ZodArray<z.ZodObject<{
198
- type: z.ZodEnum<{
199
- grain: "grain";
200
- completeness: "completeness";
201
- transformation: "transformation";
202
- relationship: "relationship";
203
- other: "other";
204
- }>;
205
- details: z.ZodString;
206
- explanation: z.ZodString;
207
- }, z.core.$strip>>;
208
- }, z.core.$strip>>>;
209
- columns_lineage: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
210
- nodes: z.ZodArray<z.ZodObject<{
211
- id: z.ZodString;
212
- type: z.ZodEnum<{
213
- result: "result";
214
- filter: "filter";
215
- entity: "entity";
216
- attribute: "attribute";
217
- process: "process";
218
- combine: "combine";
219
- }>;
220
- explanation: z.ZodString;
221
- }, z.core.$strip>>;
222
- edges: z.ZodArray<z.ZodObject<{
223
- source: z.ZodString;
224
- target: z.ZodString;
225
- }, z.core.$strip>>;
226
- }, z.core.$strip>>>>;
227
- confidence_score: z.ZodNumber;
228
- confidence_score_reason: z.ZodString;
229
- assumptions_score: z.ZodOptional<z.ZodNumber>;
230
- assumptions_score_reason: z.ZodOptional<z.ZodString>;
231
- friendliness_score: z.ZodOptional<z.ZodNumber>;
232
- friendliness_score_reason: z.ZodOptional<z.ZodString>;
233
- }, z.core.$strip>;
234
-
235
146
  declare const FrontendReportSchema: z.ZodObject<{
236
147
  status: z.ZodNullable<z.ZodString>;
237
148
  title: z.ZodString;
@@ -303,20 +214,6 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
303
214
 
304
215
  export { GenerateInsightParam }
305
216
 
306
- export declare const InfiniteDataTableUI: React.FC<InfiniteDataTableUIProps>;
307
-
308
- declare type InfiniteDataTableUIProps = {
309
- flowDataId: number;
310
- data: Record<string, unknown>[];
311
- columns: FrontendReportColumns;
312
- explainability: FrontendReportExplainability | null | undefined;
313
- hasNextPage: boolean | undefined;
314
- fetchNextPage: () => Promise<unknown>;
315
- isFetchingNextPage: boolean;
316
- isFetching: boolean;
317
- totalRows: number;
318
- };
319
-
320
217
  export declare const logout: () => void;
321
218
 
322
219
  export { MageMetricsClient }
@@ -357,6 +254,8 @@ declare interface ManagedModalProps extends ModalProps {
357
254
  apiUrl: string;
358
255
  /** Whether to disable canvas functionality in conversations */
359
256
  disableCanvas?: boolean;
257
+ /** Whether to render data freshness info in the conversation header */
258
+ showDataFreshness?: boolean;
360
259
  /** Where to persist modal state (localStorage, queryParam, or none) */
361
260
  persist?: PersistenceOptions;
362
261
  /** Custom component overrides for extending functionality */
@@ -376,12 +275,6 @@ declare type PersistenceOptions = "queryParam" | "none";
376
275
 
377
276
  export declare const PublicCanvas: React.FC<React.ComponentProps<typeof PublicCanvasPanel>>;
378
277
 
379
- /** This component is not bounded in height and must be wrapped in a container to properly work */
380
- export declare const PublicCanvasDataReport: React.FC<{
381
- canvasId: string;
382
- reportId: number;
383
- }>;
384
-
385
278
  declare const PublicCanvasPanel: default_2.FC<{
386
279
  canvasId: string;
387
280
  }>;
@@ -402,6 +295,7 @@ declare type StandaloneConversationModalProps = {
402
295
  opened: boolean;
403
296
  flowId: string;
404
297
  disableCanvas?: boolean;
298
+ showDataFreshness?: boolean;
405
299
  onOpenChange?: (open: boolean) => void;
406
300
  };
407
301
 
@@ -410,8 +304,6 @@ declare type StartOptions = DisplayControlProps & {
410
304
  label?: string;
411
305
  /** Label text displayed above the recommendations section */
412
306
  recommendationsLabel?: string;
413
- /** Placeholder text for the chat launcher input field */
414
- placeholder?: string;
415
307
  /** Whether the chat launcher input should auto-focus on mount */
416
308
  autoFocus?: boolean;
417
309
  };
@@ -536,7 +428,34 @@ export declare const useCreateFlow: (options?: UseMutationOptions<{
536
428
  }, Error, CreateFlowParam, unknown>;
537
429
  };
538
430
 
539
- export declare const useDataReport: (reportId: FrontendReport["id"]) => {
431
+ export declare const useCustomReportData: () => {
432
+ report: {
433
+ status: string | null;
434
+ title: string;
435
+ id: number;
436
+ request: string | null;
437
+ created_at: string;
438
+ is_removed: boolean;
439
+ flow_id: string;
440
+ bookmarked: boolean;
441
+ data_summary: {
442
+ [x: string]: unknown;
443
+ columns: Record<string, {
444
+ [x: string]: unknown;
445
+ data_type: string;
446
+ null_count: number | null;
447
+ unique_count: number | null;
448
+ unique_percentage: number | null;
449
+ position?: number | undefined;
450
+ }>;
451
+ };
452
+ };
453
+ fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData< {
454
+ [key: string]: unknown;
455
+ }[], unknown>, Error>>;
456
+ pages: {
457
+ [key: string]: unknown;
458
+ }[][] | undefined;
540
459
  columns: {
541
460
  name: string;
542
461
  data_type: string;
@@ -545,59 +464,13 @@ export declare const useDataReport: (reportId: FrontendReport["id"]) => {
545
464
  unit?: string;
546
465
  }[] | undefined;
547
466
  isPendingColumns: boolean;
548
- isPendingData: boolean;
549
- fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData< {
550
- [key: string]: unknown;
551
- }[], unknown>, Error>>;
467
+ hasMoreData: boolean;
552
468
  isFetching: boolean;
553
- isFetchingNextPage: boolean;
554
- hasNextPage: boolean;
555
- allData: {
556
- [key: string]: unknown;
557
- }[];
558
- explainability: {
559
- sql_explanation?: {
560
- chunk_title: string;
561
- chunk_explanation: string;
562
- lines: {
563
- sql: string;
564
- explanation: string;
565
- }[];
566
- }[] | null;
567
- business_explanation?: {
568
- summary: string;
569
- implementation: string[];
570
- assumptions: {
571
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
572
- details: string;
573
- explanation: string;
574
- }[];
575
- } | null;
576
- columns_lineage?: {
577
- [key: string]: {
578
- nodes: {
579
- id: string;
580
- type: "entity" | "attribute" | "filter" | "process" | "combine" | "result";
581
- explanation: string;
582
- }[];
583
- edges: {
584
- source: string;
585
- target: string;
586
- }[];
587
- };
588
- } | null;
589
- confidence_score: number;
590
- confidence_score_reason: string;
591
- assumptions_score?: number;
592
- assumptions_score_reason?: string;
593
- friendliness_score?: number;
594
- friendliness_score_reason?: string;
595
- flow_data_id: number;
596
- } | null | undefined;
597
- totalRows: number;
598
- infiniteData: InfiniteData< {
599
- [key: string]: unknown;
600
- }[], unknown> | undefined;
469
+ isPendingData: boolean;
470
+ totalRows: number | undefined;
471
+ totalPages: number | undefined;
472
+ sorting: SortingState_2;
473
+ filters: TableFilters;
601
474
  };
602
475
 
603
476
  export declare const useDataReportColumnValue: (reportId: number, filters: ReportDataFilters) => UseQueryResult< {
@@ -896,12 +769,6 @@ declare const V1FrontendVisualizationSchema: z.ZodObject<{
896
769
  }, z.core.$strip>], "type">;
897
770
  }, z.core.$strip>;
898
771
 
899
- export declare const Visualization: ForwardRefExoticComponent< {
900
- visualizationId: number;
901
- withTitle: boolean;
902
- exportingEnabled?: boolean;
903
- } & RefAttributes<HTMLDivElement>>;
904
-
905
772
  export { }
906
773
 
907
774