@magemetrics/core 0.8.1 → 0.9.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.
package/dist/index.d.ts CHANGED
@@ -415,15 +415,6 @@ export declare interface ExternalAuthProviderConfig {
415
415
  authOptions?: Pick<GoTrueClientOptions, "fetch">;
416
416
  }
417
417
 
418
- declare type ExtractInsightResponse = z.infer<typeof ExtractInsightResponseSchema>;
419
-
420
- declare const ExtractInsightResponseSchema: z.ZodUnion<[z.ZodObject<{
421
- type: z.ZodLiteral<"text">;
422
- insight: z.ZodString;
423
- }, z.core.$strip>, z.ZodObject<{
424
- type: z.ZodLiteral<"missing">;
425
- }, z.core.$strip>]>;
426
-
427
418
  declare type FrontendRecentFlows = z.infer<typeof FrontendRecentFlowsSchema>;
428
419
 
429
420
  declare const FrontendRecentFlowsSchema: z.ZodObject<{
@@ -435,14 +426,6 @@ declare const FrontendRecentFlowsSchema: z.ZodObject<{
435
426
  application_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
436
427
  }, z.core.$strip>;
437
428
 
438
- /**
439
- * Parameters for generating contextual insights
440
- */
441
- export declare type GenerateInsightParam = {
442
- selectedFilterValue: string;
443
- customId: string;
444
- };
445
-
446
429
  export declare const getPublicApiClient: (apiUrl: string, apiKey: string) => Client<NoAuthPaths>;
447
430
 
448
431
  declare const HEADER_SP_TOKEN: "sp-access-token";
@@ -488,10 +471,17 @@ declare const inputSchema_6: z.ZodObject<{
488
471
  }, z.core.$strip>;
489
472
 
490
473
  declare const inputSchema_7: z.ZodObject<{
491
- query: z.ZodString;
474
+ reportId: z.ZodNumber;
475
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
476
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
477
+ skipSampleRows: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
492
478
  }, z.core.$strip>;
493
479
 
494
480
  declare const inputSchema_8: z.ZodObject<{
481
+ query: z.ZodString;
482
+ }, z.core.$strip>;
483
+
484
+ declare const inputSchema_9: z.ZodObject<{
495
485
  questions: z.ZodArray<z.ZodObject<{
496
486
  question: z.ZodString;
497
487
  header: z.ZodString;
@@ -707,7 +697,6 @@ export declare class MageMetricsClient {
707
697
  filename: string;
708
698
  data: Blob | string;
709
699
  }>;
710
- generateContextualInsight: (payload: GenerateInsightParam) => Promise<ExtractInsightResponse>;
711
700
  getChatTransport: (flowId: string, options?: MageMetricsChatTransportOptions) => MageMetricsChatTransport;
712
701
  getChatMessages: (flowId: string) => Promise<MMChatUIMessage[]>;
713
702
  fetchReportData: (reportId: number, { columns, limit, sorting, filters, cursor }: ReportDataFilters, signal?: AbortSignal) => Promise<{
@@ -799,8 +788,9 @@ declare type MMUiTools = {
799
788
  valueBasedColumnSearch: UiTool_4;
800
789
  getAvailableTables: UiTool_5;
801
790
  getAvailableColumnsForTable: UiTool_6;
802
- webSearch: UiTool_7;
803
- askUserQuestion: UiTool_8;
791
+ paginateDataReport: UiTool_7;
792
+ webSearch: UiTool_8;
793
+ askUserQuestion: UiTool_9;
804
794
  };
805
795
 
806
796
  declare type NoAuthPaths = Simplify<{
@@ -2958,73 +2948,6 @@ declare interface operations {
2958
2948
  };
2959
2949
  };
2960
2950
  };
2961
- generateInsight: {
2962
- parameters: {
2963
- query?: never;
2964
- header?: never;
2965
- path?: never;
2966
- cookie?: never;
2967
- };
2968
- requestBody?: {
2969
- content: {
2970
- "application/json": {
2971
- selected_filter_value: string;
2972
- custom_id: string;
2973
- };
2974
- };
2975
- };
2976
- responses: {
2977
- /** @description Insight generated successfully */
2978
- 200: {
2979
- headers: {
2980
- [name: string]: unknown;
2981
- };
2982
- content: {
2983
- "application/json": {
2984
- /** @enum {string} */
2985
- type: "text";
2986
- insight: string;
2987
- } | {
2988
- /** @enum {string} */
2989
- type: "missing";
2990
- };
2991
- };
2992
- };
2993
- /** @description Invalid request */
2994
- 400: {
2995
- headers: {
2996
- [name: string]: unknown;
2997
- };
2998
- content: {
2999
- "application/json": {
3000
- error: string;
3001
- };
3002
- };
3003
- };
3004
- /** @description Insight not found */
3005
- 404: {
3006
- headers: {
3007
- [name: string]: unknown;
3008
- };
3009
- content: {
3010
- "application/json": {
3011
- error: string;
3012
- };
3013
- };
3014
- };
3015
- /** @description Something wrong happened */
3016
- 500: {
3017
- headers: {
3018
- [name: string]: unknown;
3019
- };
3020
- content: {
3021
- "application/json": {
3022
- error: string;
3023
- };
3024
- };
3025
- };
3026
- };
3027
- };
3028
2951
  createQueryExample: {
3029
2952
  parameters: {
3030
2953
  query?: never;
@@ -3380,270 +3303,6 @@ declare interface operations {
3380
3303
  };
3381
3304
  };
3382
3305
  };
3383
- generateInsightTemplate: {
3384
- parameters: {
3385
- query?: never;
3386
- header?: never;
3387
- path?: never;
3388
- cookie?: never;
3389
- };
3390
- requestBody?: {
3391
- content: {
3392
- "application/json": {
3393
- request: string;
3394
- insight_type: string;
3395
- additional_context?: string;
3396
- };
3397
- };
3398
- };
3399
- responses: {
3400
- /** @description Insight template generated successfully */
3401
- 200: {
3402
- headers: {
3403
- [name: string]: unknown;
3404
- };
3405
- content: {
3406
- "application/json": {
3407
- expanded_request: string;
3408
- };
3409
- };
3410
- };
3411
- /** @description Something wrong happened */
3412
- 500: {
3413
- headers: {
3414
- [name: string]: unknown;
3415
- };
3416
- content: {
3417
- "application/json": {
3418
- error: string;
3419
- };
3420
- };
3421
- };
3422
- };
3423
- };
3424
- getContextualInsightPreviewData: {
3425
- parameters: {
3426
- query?: {
3427
- limit?: number;
3428
- /** @example name:asc,date:desc */
3429
- order?: string;
3430
- cursor?: number;
3431
- /** @example status:active,name:John%20Doe */
3432
- filter?: string;
3433
- };
3434
- header?: never;
3435
- path: {
3436
- report_id: string;
3437
- };
3438
- cookie?: never;
3439
- };
3440
- requestBody?: never;
3441
- responses: {
3442
- /** @description The preview data for the contextual insight */
3443
- 200: {
3444
- headers: {
3445
- [name: string]: unknown;
3446
- };
3447
- content: {
3448
- "application/json": {
3449
- columns: {
3450
- id: string;
3451
- accessorKey: string;
3452
- header: string;
3453
- cell?: unknown;
3454
- meta?: {
3455
- [key: string]: unknown;
3456
- };
3457
- }[];
3458
- data: {
3459
- [key: string]: unknown;
3460
- }[];
3461
- metadata?: {
3462
- wasSampled: boolean;
3463
- originalCount: number;
3464
- sampledCount: number;
3465
- };
3466
- };
3467
- };
3468
- };
3469
- /** @description Unable to retrieve flow data with this id */
3470
- 404: {
3471
- headers: {
3472
- [name: string]: unknown;
3473
- };
3474
- content: {
3475
- "application/json": {
3476
- error: string;
3477
- };
3478
- };
3479
- };
3480
- /** @description Something wrong happened */
3481
- 500: {
3482
- headers: {
3483
- [name: string]: unknown;
3484
- };
3485
- content: {
3486
- "application/json": {
3487
- error: string;
3488
- };
3489
- };
3490
- };
3491
- };
3492
- };
3493
- getContextualInsightColumnSampleValues: {
3494
- parameters: {
3495
- query: {
3496
- /** @description The column name to get sample values for */
3497
- column_name: string;
3498
- };
3499
- header?: never;
3500
- path: {
3501
- report_id: string;
3502
- };
3503
- cookie?: never;
3504
- };
3505
- requestBody?: never;
3506
- responses: {
3507
- /** @description Sample values for the specified column */
3508
- 200: {
3509
- headers: {
3510
- [name: string]: unknown;
3511
- };
3512
- content: {
3513
- "application/json": {
3514
- options: unknown[];
3515
- };
3516
- };
3517
- };
3518
- /** @description Unable to retrieve flow data with this id */
3519
- 404: {
3520
- headers: {
3521
- [name: string]: unknown;
3522
- };
3523
- content: {
3524
- "application/json": {
3525
- error: string;
3526
- };
3527
- };
3528
- };
3529
- /** @description Something wrong happened */
3530
- 500: {
3531
- headers: {
3532
- [name: string]: unknown;
3533
- };
3534
- content: {
3535
- "application/json": {
3536
- error: string;
3537
- };
3538
- };
3539
- };
3540
- };
3541
- };
3542
- extractInsight: {
3543
- parameters: {
3544
- query?: never;
3545
- header?: never;
3546
- path?: never;
3547
- cookie?: never;
3548
- };
3549
- requestBody?: {
3550
- content: {
3551
- "application/json": {
3552
- flow_id: string;
3553
- report_id: number;
3554
- topic: string;
3555
- expanded_request: string;
3556
- insight_type: string;
3557
- selected_filter: string;
3558
- selected_filter_value: string;
3559
- additional_context?: string;
3560
- };
3561
- };
3562
- };
3563
- responses: {
3564
- /** @description Insight extracted successfully */
3565
- 200: {
3566
- headers: {
3567
- [name: string]: unknown;
3568
- };
3569
- content: {
3570
- "application/json": {
3571
- /** @enum {string} */
3572
- type: "text";
3573
- insight: string;
3574
- } | {
3575
- /** @enum {string} */
3576
- type: "missing";
3577
- };
3578
- };
3579
- };
3580
- /** @description Something wrong happened */
3581
- 500: {
3582
- headers: {
3583
- [name: string]: unknown;
3584
- };
3585
- content: {
3586
- "application/json": {
3587
- error: string;
3588
- };
3589
- };
3590
- };
3591
- };
3592
- };
3593
- suggestFilterColumn: {
3594
- parameters: {
3595
- query?: never;
3596
- header?: never;
3597
- path?: never;
3598
- cookie?: never;
3599
- };
3600
- requestBody?: {
3601
- content: {
3602
- "application/json": {
3603
- report_id: number;
3604
- request: string;
3605
- insight_type: string;
3606
- additional_context?: string;
3607
- };
3608
- };
3609
- };
3610
- responses: {
3611
- /** @description Filter column suggestion generated successfully */
3612
- 200: {
3613
- headers: {
3614
- [name: string]: unknown;
3615
- };
3616
- content: {
3617
- "application/json": {
3618
- recommended_column: string;
3619
- reasoning: string;
3620
- };
3621
- };
3622
- };
3623
- /** @description Report not found */
3624
- 404: {
3625
- headers: {
3626
- [name: string]: unknown;
3627
- };
3628
- content: {
3629
- "application/json": {
3630
- error: string;
3631
- };
3632
- };
3633
- };
3634
- /** @description Something wrong happened */
3635
- 500: {
3636
- headers: {
3637
- [name: string]: unknown;
3638
- };
3639
- content: {
3640
- "application/json": {
3641
- error: string;
3642
- };
3643
- };
3644
- };
3645
- };
3646
- };
3647
3306
  getCompanySettings: {
3648
3307
  parameters: {
3649
3308
  query?: never;
@@ -4419,22 +4078,6 @@ declare interface paths {
4419
4078
  patch?: never;
4420
4079
  trace?: never;
4421
4080
  };
4422
- "/api/v1/contextual-insights/generate-insight": {
4423
- parameters: {
4424
- query?: never;
4425
- header?: never;
4426
- path?: never;
4427
- cookie?: never;
4428
- };
4429
- get?: never;
4430
- put?: never;
4431
- post: operations["generateInsight"];
4432
- delete?: never;
4433
- options?: never;
4434
- head?: never;
4435
- patch?: never;
4436
- trace?: never;
4437
- };
4438
4081
  "/api/v1/admin-console/query-examples": {
4439
4082
  parameters: {
4440
4083
  query?: never;
@@ -4531,86 +4174,6 @@ declare interface paths {
4531
4174
  patch?: never;
4532
4175
  trace?: never;
4533
4176
  };
4534
- "/api/v1/admin-console/contextual-insights/generate-template": {
4535
- parameters: {
4536
- query?: never;
4537
- header?: never;
4538
- path?: never;
4539
- cookie?: never;
4540
- };
4541
- get?: never;
4542
- put?: never;
4543
- post: operations["generateInsightTemplate"];
4544
- delete?: never;
4545
- options?: never;
4546
- head?: never;
4547
- patch?: never;
4548
- trace?: never;
4549
- };
4550
- "/api/v1/admin-console/contextual-insights/preview/{report_id}/data": {
4551
- parameters: {
4552
- query?: never;
4553
- header?: never;
4554
- path?: never;
4555
- cookie?: never;
4556
- };
4557
- get: operations["getContextualInsightPreviewData"];
4558
- put?: never;
4559
- post?: never;
4560
- delete?: never;
4561
- options?: never;
4562
- head?: never;
4563
- patch?: never;
4564
- trace?: never;
4565
- };
4566
- "/api/v1/admin-console/contextual-insights/preview/{report_id}/sample-values": {
4567
- parameters: {
4568
- query?: never;
4569
- header?: never;
4570
- path?: never;
4571
- cookie?: never;
4572
- };
4573
- get: operations["getContextualInsightColumnSampleValues"];
4574
- put?: never;
4575
- post?: never;
4576
- delete?: never;
4577
- options?: never;
4578
- head?: never;
4579
- patch?: never;
4580
- trace?: never;
4581
- };
4582
- "/api/v1/admin-console/contextual-insights/extract-insight": {
4583
- parameters: {
4584
- query?: never;
4585
- header?: never;
4586
- path?: never;
4587
- cookie?: never;
4588
- };
4589
- get?: never;
4590
- put?: never;
4591
- post: operations["extractInsight"];
4592
- delete?: never;
4593
- options?: never;
4594
- head?: never;
4595
- patch?: never;
4596
- trace?: never;
4597
- };
4598
- "/api/v1/admin-console/contextual-insights/suggest-filter-column": {
4599
- parameters: {
4600
- query?: never;
4601
- header?: never;
4602
- path?: never;
4603
- cookie?: never;
4604
- };
4605
- get?: never;
4606
- put?: never;
4607
- post: operations["suggestFilterColumn"];
4608
- delete?: never;
4609
- options?: never;
4610
- head?: never;
4611
- patch?: never;
4612
- trace?: never;
4613
- };
4614
4177
  "/api/v1/admin-console/company-settings": {
4615
4178
  parameters: {
4616
4179
  query?: never;
@@ -4728,6 +4291,22 @@ declare const redactedOutputSchema_5: z.ZodObject<{
4728
4291
  }, z.core.$strip>;
4729
4292
 
4730
4293
  declare const redactedOutputSchema_6: z.ZodObject<{
4294
+ tool: z.ZodLiteral<"paginateDataReport">;
4295
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
4296
+ status: z.ZodLiteral<"success">;
4297
+ public: z.ZodObject<{
4298
+ totalRows: z.ZodNumber;
4299
+ fetchedRows: z.ZodNumber;
4300
+ offset: z.ZodNumber;
4301
+ hasMore: z.ZodBoolean;
4302
+ }, z.core.$strip>;
4303
+ }, z.core.$strip>, z.ZodObject<{
4304
+ status: z.ZodLiteral<"error">;
4305
+ message: z.ZodString;
4306
+ }, z.core.$strip>], "status">>;
4307
+ }, z.core.$strip>;
4308
+
4309
+ declare const redactedOutputSchema_7: z.ZodObject<{
4731
4310
  tool: z.ZodLiteral<"search">;
4732
4311
  result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
4733
4312
  status: z.ZodLiteral<"success">;
@@ -4820,7 +4399,9 @@ declare type UiTool_6 = InferUITool<Tool<z.infer<typeof inputSchema_6>, z.infer<
4820
4399
 
4821
4400
  declare type UiTool_7 = InferUITool<Tool<z.infer<typeof inputSchema_7>, z.infer<typeof redactedOutputSchema_6>>>;
4822
4401
 
4823
- declare type UiTool_8 = InferUITool<Tool<z.infer<typeof inputSchema_8>, z.infer<typeof RedactedAskUserQuestionResponse>>>;
4402
+ declare type UiTool_8 = InferUITool<Tool<z.infer<typeof inputSchema_8>, z.infer<typeof redactedOutputSchema_7>>>;
4403
+
4404
+ declare type UiTool_9 = InferUITool<Tool<z.infer<typeof inputSchema_9>, z.infer<typeof RedactedAskUserQuestionResponse>>>;
4824
4405
 
4825
4406
  declare const UpdateCanvasSchema: z.ZodObject<{
4826
4407
  id: z.ZodUUID;