@magemetrics/ai 0.4.0 → 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.
@@ -1,19 +1,15 @@
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';
5
4
  import { FetchNextPageOptions } from '@tanstack/react-query';
6
- import { ForwardRefExoticComponent } from 'react';
7
5
  import { GenerateInsightParam } from '@magemetrics/core';
8
6
  import { InfiniteData } from '@tanstack/react-query';
9
7
  import { InfiniteQueryObserverResult } from '@tanstack/react-query';
8
+ import { JSX } from 'react/jsx-runtime';
10
9
  import { MageMetricsClient } from '@magemetrics/core';
11
10
  import { MageMetricsClientConfig } from '@magemetrics/core';
12
- import { OnChangeFn } from '@tanstack/react-table';
13
11
  import { PropsWithChildren } from 'react';
14
- import { RefAttributes } from 'react';
15
- import { SetStateAction } from 'react';
16
- import { SortingState as SortingState_2 } from '@tanstack/react-table';
12
+ import { SortingState } from '@tanstack/react-table';
17
13
  import { UseMutateAsyncFunction } from '@tanstack/react-query';
18
14
  import { UseMutateFunction } from '@tanstack/react-query';
19
15
  import { UseMutationOptions } from '@tanstack/react-query';
@@ -45,7 +41,9 @@ export declare interface Components {
45
41
  [key: string]: (props: CellContentProps) => default_2.ReactNode;
46
42
  };
47
43
  };
48
- dataReportTable?: (props: DataReportMessageProps) => default_2.ReactNode;
44
+ dataReportTable?: (props: {
45
+ report: FrontendReport;
46
+ }) => default_2.ReactNode;
49
47
  dataReportMessageActions?: (props: {
50
48
  report: FrontendReport;
51
49
  isSelected: boolean;
@@ -69,8 +67,6 @@ declare type ControlledModalProps = {
69
67
  onClose: () => void;
70
68
  };
71
69
 
72
- export declare const ConversationContent: React.FC<ConversationContentProps>;
73
-
74
70
  declare interface ConversationContentProps {
75
71
  flowId?: string;
76
72
  className?: string;
@@ -81,45 +77,7 @@ declare interface ConversationContentProps {
81
77
 
82
78
  export { CreateFlowParam }
83
79
 
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
- */
92
- export declare const DataReport: React.FC<{
93
- reportId: number;
94
- initialState?: DataTableState;
95
- onStateChange?: (state: DataTableState) => void;
96
- }>;
97
-
98
- export declare interface DataReportMessageProps {
99
- report: FrontendReport;
100
- explainability: FrontendReportExplainability | null | undefined;
101
- infiniteData: {
102
- data?: {
103
- pages: Record<string, unknown>[][];
104
- };
105
- isPending: boolean;
106
- fetchNextPage: () => Promise<unknown>;
107
- isFetching: boolean;
108
- isFetchingNextPage: boolean;
109
- hasNextPage: boolean | undefined;
110
- };
111
- columns: FrontendReportColumns;
112
- totalRows: number;
113
- }
114
-
115
- export declare const DataTable: React.FC<DataReportMessageProps>;
116
-
117
- declare type DataTableState = {
118
- pageIndex: number;
119
- pageSize: number;
120
- sorting: SortingState;
121
- filters: TableFilters;
122
- };
80
+ export declare const DataTable: () => JSX.Element;
123
81
 
124
82
  declare type DisplayControlProps = {
125
83
  /** Whether to display the recommendations section when the input is active */
@@ -136,10 +94,6 @@ declare type DomWrapperProps = {
136
94
  display?: string;
137
95
  };
138
96
 
139
- export declare const DownloadDataReportButton: React.FC<{
140
- reportId: number;
141
- }>;
142
-
143
97
  declare type ExportReportDataParams = {
144
98
  reportId: number;
145
99
  filename?: string;
@@ -189,69 +143,6 @@ declare type FormattedData = {
189
143
 
190
144
  declare type FrontendReport = z.infer<typeof FrontendReportSchema>;
191
145
 
192
- declare type FrontendReportColumns = z.infer<typeof FrontendReportColumnsSchema>;
193
-
194
- declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
195
- dataType: z.ZodString;
196
- renderType: z.ZodOptional<z.ZodString>;
197
- unit: z.ZodOptional<z.ZodString>;
198
- name: z.ZodString;
199
- data_type: z.ZodString;
200
- }, z.core.$strip>>;
201
-
202
- declare type FrontendReportExplainability = z.infer<typeof FrontendReportExplainabilitySchema>;
203
-
204
- declare const FrontendReportExplainabilitySchema: z.ZodObject<{
205
- flow_data_id: z.ZodNumber;
206
- sql_explanation: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
207
- chunk_title: z.ZodString;
208
- chunk_explanation: z.ZodString;
209
- lines: z.ZodArray<z.ZodObject<{
210
- sql: z.ZodString;
211
- explanation: z.ZodString;
212
- }, z.core.$strip>>;
213
- }, z.core.$strip>>>>;
214
- business_explanation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
215
- summary: z.ZodString;
216
- implementation: z.ZodArray<z.ZodString>;
217
- assumptions: z.ZodArray<z.ZodObject<{
218
- type: z.ZodEnum<{
219
- grain: "grain";
220
- completeness: "completeness";
221
- transformation: "transformation";
222
- relationship: "relationship";
223
- other: "other";
224
- }>;
225
- details: z.ZodString;
226
- explanation: z.ZodString;
227
- }, z.core.$strip>>;
228
- }, z.core.$strip>>>;
229
- columns_lineage: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
230
- nodes: z.ZodArray<z.ZodObject<{
231
- id: z.ZodString;
232
- type: z.ZodEnum<{
233
- result: "result";
234
- filter: "filter";
235
- entity: "entity";
236
- attribute: "attribute";
237
- process: "process";
238
- combine: "combine";
239
- }>;
240
- explanation: z.ZodString;
241
- }, z.core.$strip>>;
242
- edges: z.ZodArray<z.ZodObject<{
243
- source: z.ZodString;
244
- target: z.ZodString;
245
- }, z.core.$strip>>;
246
- }, z.core.$strip>>>>;
247
- confidence_score: z.ZodNumber;
248
- confidence_score_reason: z.ZodString;
249
- assumptions_score: z.ZodOptional<z.ZodNumber>;
250
- assumptions_score_reason: z.ZodOptional<z.ZodString>;
251
- friendliness_score: z.ZodOptional<z.ZodNumber>;
252
- friendliness_score_reason: z.ZodOptional<z.ZodString>;
253
- }, z.core.$strip>;
254
-
255
146
  declare const FrontendReportSchema: z.ZodObject<{
256
147
  status: z.ZodNullable<z.ZodString>;
257
148
  title: z.ZodString;
@@ -323,20 +214,6 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
323
214
 
324
215
  export { GenerateInsightParam }
325
216
 
326
- export declare const InfiniteDataTableUI: React.FC<InfiniteDataTableUIProps>;
327
-
328
- declare type InfiniteDataTableUIProps = {
329
- flowDataId: number;
330
- data: Record<string, unknown>[];
331
- columns: FrontendReportColumns;
332
- explainability: FrontendReportExplainability | null | undefined;
333
- hasNextPage: boolean | undefined;
334
- fetchNextPage: () => Promise<unknown>;
335
- isFetchingNextPage: boolean;
336
- isFetching: boolean;
337
- totalRows: number;
338
- };
339
-
340
217
  export declare const logout: () => void;
341
218
 
342
219
  export { MageMetricsClient }
@@ -394,37 +271,6 @@ declare interface ModalProps {
394
271
  startOptions?: StartOptions;
395
272
  }
396
273
 
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
-
428
274
  declare type PersistenceOptions = "queryParam" | "none";
429
275
 
430
276
  export declare const PublicCanvas: React.FC<React.ComponentProps<typeof PublicCanvasPanel>>;
@@ -433,31 +279,15 @@ declare const PublicCanvasPanel: default_2.FC<{
433
279
  canvasId: string;
434
280
  }>;
435
281
 
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<{
446
- canvasId: string;
447
- reportId: number;
448
- initialState?: DataTableState;
449
- onStateChange?: (state: DataTableState) => void;
450
- }>;
451
-
452
282
  declare type ReportDataFilters = {
453
283
  columns?: string[];
454
284
  limit: number;
455
- sorting: SortingState;
285
+ sorting: SortingState_2;
456
286
  filters: TableFilters;
457
287
  cursor?: number;
458
288
  };
459
289
 
460
- declare type SortingState = ColumnSort[];
290
+ declare type SortingState_2 = ColumnSort[];
461
291
 
462
292
  export declare const StandaloneConversationModal: React.FC<StandaloneConversationModalProps>;
463
293
 
@@ -474,8 +304,6 @@ declare type StartOptions = DisplayControlProps & {
474
304
  label?: string;
475
305
  /** Label text displayed above the recommendations section */
476
306
  recommendationsLabel?: string;
477
- /** Placeholder text for the chat launcher input field */
478
- placeholder?: string;
479
307
  /** Whether the chat launcher input should auto-focus on mount */
480
308
  autoFocus?: boolean;
481
309
  };
@@ -600,7 +428,34 @@ export declare const useCreateFlow: (options?: UseMutationOptions<{
600
428
  }, Error, CreateFlowParam, unknown>;
601
429
  };
602
430
 
603
- 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;
604
459
  columns: {
605
460
  name: string;
606
461
  data_type: string;
@@ -609,59 +464,13 @@ export declare const useDataReport: (reportId: FrontendReport["id"]) => {
609
464
  unit?: string;
610
465
  }[] | undefined;
611
466
  isPendingColumns: boolean;
612
- isPendingData: boolean;
613
- fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData< {
614
- [key: string]: unknown;
615
- }[], unknown>, Error>>;
467
+ hasMoreData: boolean;
616
468
  isFetching: boolean;
617
- isFetchingNextPage: boolean;
618
- hasNextPage: boolean;
619
- allData: {
620
- [key: string]: unknown;
621
- }[];
622
- explainability: {
623
- sql_explanation?: {
624
- chunk_title: string;
625
- chunk_explanation: string;
626
- lines: {
627
- sql: string;
628
- explanation: string;
629
- }[];
630
- }[] | null;
631
- business_explanation?: {
632
- summary: string;
633
- implementation: string[];
634
- assumptions: {
635
- type: "grain" | "completeness" | "transformation" | "relationship" | "other";
636
- details: string;
637
- explanation: string;
638
- }[];
639
- } | null;
640
- columns_lineage?: {
641
- [key: string]: {
642
- nodes: {
643
- id: string;
644
- type: "entity" | "attribute" | "filter" | "process" | "combine" | "result";
645
- explanation: string;
646
- }[];
647
- edges: {
648
- source: string;
649
- target: string;
650
- }[];
651
- };
652
- } | null;
653
- confidence_score: number;
654
- confidence_score_reason: string;
655
- assumptions_score?: number;
656
- assumptions_score_reason?: string;
657
- friendliness_score?: number;
658
- friendliness_score_reason?: string;
659
- flow_data_id: number;
660
- } | null | undefined;
661
- totalRows: number;
662
- infiniteData: InfiniteData< {
663
- [key: string]: unknown;
664
- }[], unknown> | undefined;
469
+ isPendingData: boolean;
470
+ totalRows: number | undefined;
471
+ totalPages: number | undefined;
472
+ sorting: SortingState;
473
+ filters: TableFilters;
665
474
  };
666
475
 
667
476
  export declare const useDataReportColumnValue: (reportId: number, filters: ReportDataFilters) => UseQueryResult< {
@@ -911,79 +720,6 @@ export declare const useMageMetricsClient: () => MageMetricsClient;
911
720
 
912
721
  export declare const useMageMetricsReady: () => false | MageMetricsClient;
913
722
 
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
-
987
723
  export declare const useRecentFlows: (limit?: number) => UseQueryResult< {
988
724
  id: string;
989
725
  request: string;
@@ -1033,10 +769,4 @@ declare const V1FrontendVisualizationSchema: z.ZodObject<{
1033
769
  }, z.core.$strip>], "type">;
1034
770
  }, z.core.$strip>;
1035
771
 
1036
- export declare const Visualization: ForwardRefExoticComponent< {
1037
- visualizationId: number;
1038
- withTitle: boolean;
1039
- exportingEnabled?: boolean;
1040
- } & RefAttributes<HTMLDivElement>>;
1041
-
1042
772
  export { }