@magemetrics/core 0.8.2 → 0.9.1

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
@@ -142,6 +142,8 @@ declare interface components {
142
142
  dataType: string;
143
143
  renderType?: string;
144
144
  unit?: string;
145
+ /** @enum {string} */
146
+ canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
145
147
  }[];
146
148
  /** Format: uuid */
147
149
  CanvasId: string;
@@ -415,15 +417,6 @@ export declare interface ExternalAuthProviderConfig {
415
417
  authOptions?: Pick<GoTrueClientOptions, "fetch">;
416
418
  }
417
419
 
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
420
  declare type FrontendRecentFlows = z.infer<typeof FrontendRecentFlowsSchema>;
428
421
 
429
422
  declare const FrontendRecentFlowsSchema: z.ZodObject<{
@@ -435,14 +428,6 @@ declare const FrontendRecentFlowsSchema: z.ZodObject<{
435
428
  application_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
436
429
  }, z.core.$strip>;
437
430
 
438
- /**
439
- * Parameters for generating contextual insights
440
- */
441
- export declare type GenerateInsightParam = {
442
- selectedFilterValue: string;
443
- customId: string;
444
- };
445
-
446
431
  export declare const getPublicApiClient: (apiUrl: string, apiKey: string) => Client<NoAuthPaths>;
447
432
 
448
433
  declare const HEADER_SP_TOKEN: "sp-access-token";
@@ -714,7 +699,6 @@ export declare class MageMetricsClient {
714
699
  filename: string;
715
700
  data: Blob | string;
716
701
  }>;
717
- generateContextualInsight: (payload: GenerateInsightParam) => Promise<ExtractInsightResponse>;
718
702
  getChatTransport: (flowId: string, options?: MageMetricsChatTransportOptions) => MageMetricsChatTransport;
719
703
  getChatMessages: (flowId: string) => Promise<MMChatUIMessage[]>;
720
704
  fetchReportData: (reportId: number, { columns, limit, sorting, filters, cursor }: ReportDataFilters, signal?: AbortSignal) => Promise<{
@@ -731,6 +715,7 @@ export declare class MageMetricsClient {
731
715
  dataType: string;
732
716
  renderType?: string;
733
717
  unit?: string;
718
+ canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
734
719
  }[];
735
720
  rowCount: {
736
721
  count: number;
@@ -967,7 +952,7 @@ declare interface operations {
967
952
  /** @example name:asc,date:desc */
968
953
  order?: string;
969
954
  cursor?: number;
970
- /** @example status:active,name:John%20Doe */
955
+ /** @example status:eq:active,name:contains:John%20Doe */
971
956
  filter?: string;
972
957
  };
973
958
  header?: never;
@@ -1908,7 +1893,7 @@ declare interface operations {
1908
1893
  /** @example name:asc,date:desc */
1909
1894
  order?: string;
1910
1895
  cursor?: number;
1911
- /** @example status:active,name:John%20Doe */
1896
+ /** @example status:eq:active,name:contains:John%20Doe */
1912
1897
  filter?: string;
1913
1898
  };
1914
1899
  header: {
@@ -2966,73 +2951,6 @@ declare interface operations {
2966
2951
  };
2967
2952
  };
2968
2953
  };
2969
- generateInsight: {
2970
- parameters: {
2971
- query?: never;
2972
- header?: never;
2973
- path?: never;
2974
- cookie?: never;
2975
- };
2976
- requestBody?: {
2977
- content: {
2978
- "application/json": {
2979
- selected_filter_value: string;
2980
- custom_id: string;
2981
- };
2982
- };
2983
- };
2984
- responses: {
2985
- /** @description Insight generated successfully */
2986
- 200: {
2987
- headers: {
2988
- [name: string]: unknown;
2989
- };
2990
- content: {
2991
- "application/json": {
2992
- /** @enum {string} */
2993
- type: "text";
2994
- insight: string;
2995
- } | {
2996
- /** @enum {string} */
2997
- type: "missing";
2998
- };
2999
- };
3000
- };
3001
- /** @description Invalid request */
3002
- 400: {
3003
- headers: {
3004
- [name: string]: unknown;
3005
- };
3006
- content: {
3007
- "application/json": {
3008
- error: string;
3009
- };
3010
- };
3011
- };
3012
- /** @description Insight not found */
3013
- 404: {
3014
- headers: {
3015
- [name: string]: unknown;
3016
- };
3017
- content: {
3018
- "application/json": {
3019
- error: string;
3020
- };
3021
- };
3022
- };
3023
- /** @description Something wrong happened */
3024
- 500: {
3025
- headers: {
3026
- [name: string]: unknown;
3027
- };
3028
- content: {
3029
- "application/json": {
3030
- error: string;
3031
- };
3032
- };
3033
- };
3034
- };
3035
- };
3036
2954
  createQueryExample: {
3037
2955
  parameters: {
3038
2956
  query?: never;
@@ -3388,270 +3306,6 @@ declare interface operations {
3388
3306
  };
3389
3307
  };
3390
3308
  };
3391
- generateInsightTemplate: {
3392
- parameters: {
3393
- query?: never;
3394
- header?: never;
3395
- path?: never;
3396
- cookie?: never;
3397
- };
3398
- requestBody?: {
3399
- content: {
3400
- "application/json": {
3401
- request: string;
3402
- insight_type: string;
3403
- additional_context?: string;
3404
- };
3405
- };
3406
- };
3407
- responses: {
3408
- /** @description Insight template generated successfully */
3409
- 200: {
3410
- headers: {
3411
- [name: string]: unknown;
3412
- };
3413
- content: {
3414
- "application/json": {
3415
- expanded_request: string;
3416
- };
3417
- };
3418
- };
3419
- /** @description Something wrong happened */
3420
- 500: {
3421
- headers: {
3422
- [name: string]: unknown;
3423
- };
3424
- content: {
3425
- "application/json": {
3426
- error: string;
3427
- };
3428
- };
3429
- };
3430
- };
3431
- };
3432
- getContextualInsightPreviewData: {
3433
- parameters: {
3434
- query?: {
3435
- limit?: number;
3436
- /** @example name:asc,date:desc */
3437
- order?: string;
3438
- cursor?: number;
3439
- /** @example status:active,name:John%20Doe */
3440
- filter?: string;
3441
- };
3442
- header?: never;
3443
- path: {
3444
- report_id: string;
3445
- };
3446
- cookie?: never;
3447
- };
3448
- requestBody?: never;
3449
- responses: {
3450
- /** @description The preview data for the contextual insight */
3451
- 200: {
3452
- headers: {
3453
- [name: string]: unknown;
3454
- };
3455
- content: {
3456
- "application/json": {
3457
- columns: {
3458
- id: string;
3459
- accessorKey: string;
3460
- header: string;
3461
- cell?: unknown;
3462
- meta?: {
3463
- [key: string]: unknown;
3464
- };
3465
- }[];
3466
- data: {
3467
- [key: string]: unknown;
3468
- }[];
3469
- metadata?: {
3470
- wasSampled: boolean;
3471
- originalCount: number;
3472
- sampledCount: number;
3473
- };
3474
- };
3475
- };
3476
- };
3477
- /** @description Unable to retrieve flow data with this id */
3478
- 404: {
3479
- headers: {
3480
- [name: string]: unknown;
3481
- };
3482
- content: {
3483
- "application/json": {
3484
- error: string;
3485
- };
3486
- };
3487
- };
3488
- /** @description Something wrong happened */
3489
- 500: {
3490
- headers: {
3491
- [name: string]: unknown;
3492
- };
3493
- content: {
3494
- "application/json": {
3495
- error: string;
3496
- };
3497
- };
3498
- };
3499
- };
3500
- };
3501
- getContextualInsightColumnSampleValues: {
3502
- parameters: {
3503
- query: {
3504
- /** @description The column name to get sample values for */
3505
- column_name: string;
3506
- };
3507
- header?: never;
3508
- path: {
3509
- report_id: string;
3510
- };
3511
- cookie?: never;
3512
- };
3513
- requestBody?: never;
3514
- responses: {
3515
- /** @description Sample values for the specified column */
3516
- 200: {
3517
- headers: {
3518
- [name: string]: unknown;
3519
- };
3520
- content: {
3521
- "application/json": {
3522
- options: unknown[];
3523
- };
3524
- };
3525
- };
3526
- /** @description Unable to retrieve flow data with this id */
3527
- 404: {
3528
- headers: {
3529
- [name: string]: unknown;
3530
- };
3531
- content: {
3532
- "application/json": {
3533
- error: string;
3534
- };
3535
- };
3536
- };
3537
- /** @description Something wrong happened */
3538
- 500: {
3539
- headers: {
3540
- [name: string]: unknown;
3541
- };
3542
- content: {
3543
- "application/json": {
3544
- error: string;
3545
- };
3546
- };
3547
- };
3548
- };
3549
- };
3550
- extractInsight: {
3551
- parameters: {
3552
- query?: never;
3553
- header?: never;
3554
- path?: never;
3555
- cookie?: never;
3556
- };
3557
- requestBody?: {
3558
- content: {
3559
- "application/json": {
3560
- flow_id: string;
3561
- report_id: number;
3562
- topic: string;
3563
- expanded_request: string;
3564
- insight_type: string;
3565
- selected_filter: string;
3566
- selected_filter_value: string;
3567
- additional_context?: string;
3568
- };
3569
- };
3570
- };
3571
- responses: {
3572
- /** @description Insight extracted successfully */
3573
- 200: {
3574
- headers: {
3575
- [name: string]: unknown;
3576
- };
3577
- content: {
3578
- "application/json": {
3579
- /** @enum {string} */
3580
- type: "text";
3581
- insight: string;
3582
- } | {
3583
- /** @enum {string} */
3584
- type: "missing";
3585
- };
3586
- };
3587
- };
3588
- /** @description Something wrong happened */
3589
- 500: {
3590
- headers: {
3591
- [name: string]: unknown;
3592
- };
3593
- content: {
3594
- "application/json": {
3595
- error: string;
3596
- };
3597
- };
3598
- };
3599
- };
3600
- };
3601
- suggestFilterColumn: {
3602
- parameters: {
3603
- query?: never;
3604
- header?: never;
3605
- path?: never;
3606
- cookie?: never;
3607
- };
3608
- requestBody?: {
3609
- content: {
3610
- "application/json": {
3611
- report_id: number;
3612
- request: string;
3613
- insight_type: string;
3614
- additional_context?: string;
3615
- };
3616
- };
3617
- };
3618
- responses: {
3619
- /** @description Filter column suggestion generated successfully */
3620
- 200: {
3621
- headers: {
3622
- [name: string]: unknown;
3623
- };
3624
- content: {
3625
- "application/json": {
3626
- recommended_column: string;
3627
- reasoning: string;
3628
- };
3629
- };
3630
- };
3631
- /** @description Report not found */
3632
- 404: {
3633
- headers: {
3634
- [name: string]: unknown;
3635
- };
3636
- content: {
3637
- "application/json": {
3638
- error: string;
3639
- };
3640
- };
3641
- };
3642
- /** @description Something wrong happened */
3643
- 500: {
3644
- headers: {
3645
- [name: string]: unknown;
3646
- };
3647
- content: {
3648
- "application/json": {
3649
- error: string;
3650
- };
3651
- };
3652
- };
3653
- };
3654
- };
3655
3309
  getCompanySettings: {
3656
3310
  parameters: {
3657
3311
  query?: never;
@@ -4427,22 +4081,6 @@ declare interface paths {
4427
4081
  patch?: never;
4428
4082
  trace?: never;
4429
4083
  };
4430
- "/api/v1/contextual-insights/generate-insight": {
4431
- parameters: {
4432
- query?: never;
4433
- header?: never;
4434
- path?: never;
4435
- cookie?: never;
4436
- };
4437
- get?: never;
4438
- put?: never;
4439
- post: operations["generateInsight"];
4440
- delete?: never;
4441
- options?: never;
4442
- head?: never;
4443
- patch?: never;
4444
- trace?: never;
4445
- };
4446
4084
  "/api/v1/admin-console/query-examples": {
4447
4085
  parameters: {
4448
4086
  query?: never;
@@ -4539,86 +4177,6 @@ declare interface paths {
4539
4177
  patch?: never;
4540
4178
  trace?: never;
4541
4179
  };
4542
- "/api/v1/admin-console/contextual-insights/generate-template": {
4543
- parameters: {
4544
- query?: never;
4545
- header?: never;
4546
- path?: never;
4547
- cookie?: never;
4548
- };
4549
- get?: never;
4550
- put?: never;
4551
- post: operations["generateInsightTemplate"];
4552
- delete?: never;
4553
- options?: never;
4554
- head?: never;
4555
- patch?: never;
4556
- trace?: never;
4557
- };
4558
- "/api/v1/admin-console/contextual-insights/preview/{report_id}/data": {
4559
- parameters: {
4560
- query?: never;
4561
- header?: never;
4562
- path?: never;
4563
- cookie?: never;
4564
- };
4565
- get: operations["getContextualInsightPreviewData"];
4566
- put?: never;
4567
- post?: never;
4568
- delete?: never;
4569
- options?: never;
4570
- head?: never;
4571
- patch?: never;
4572
- trace?: never;
4573
- };
4574
- "/api/v1/admin-console/contextual-insights/preview/{report_id}/sample-values": {
4575
- parameters: {
4576
- query?: never;
4577
- header?: never;
4578
- path?: never;
4579
- cookie?: never;
4580
- };
4581
- get: operations["getContextualInsightColumnSampleValues"];
4582
- put?: never;
4583
- post?: never;
4584
- delete?: never;
4585
- options?: never;
4586
- head?: never;
4587
- patch?: never;
4588
- trace?: never;
4589
- };
4590
- "/api/v1/admin-console/contextual-insights/extract-insight": {
4591
- parameters: {
4592
- query?: never;
4593
- header?: never;
4594
- path?: never;
4595
- cookie?: never;
4596
- };
4597
- get?: never;
4598
- put?: never;
4599
- post: operations["extractInsight"];
4600
- delete?: never;
4601
- options?: never;
4602
- head?: never;
4603
- patch?: never;
4604
- trace?: never;
4605
- };
4606
- "/api/v1/admin-console/contextual-insights/suggest-filter-column": {
4607
- parameters: {
4608
- query?: never;
4609
- header?: never;
4610
- path?: never;
4611
- cookie?: never;
4612
- };
4613
- get?: never;
4614
- put?: never;
4615
- post: operations["suggestFilterColumn"];
4616
- delete?: never;
4617
- options?: never;
4618
- head?: never;
4619
- patch?: never;
4620
- trace?: never;
4621
- };
4622
4180
  "/api/v1/admin-console/company-settings": {
4623
4181
  parameters: {
4624
4182
  query?: never;
@@ -4682,7 +4240,26 @@ declare const redactedOutputSchema: z.ZodObject<{
4682
4240
  }, z.core.$strip>;
4683
4241
  }, z.core.$strip>, z.ZodObject<{
4684
4242
  status: z.ZodLiteral<"error">;
4685
- message: z.ZodString;
4243
+ category: z.ZodOptional<z.ZodEnum<{
4244
+ unknown: "unknown";
4245
+ timeout: "timeout";
4246
+ connection_error: "connection_error";
4247
+ auth_error: "auth_error";
4248
+ resource_exhausted: "resource_exhausted";
4249
+ table_not_found: "table_not_found";
4250
+ column_not_found: "column_not_found";
4251
+ schema_not_found: "schema_not_found";
4252
+ view_not_found: "view_not_found";
4253
+ function_not_found: "function_not_found";
4254
+ syntax_error: "syntax_error";
4255
+ ambiguous_column: "ambiguous_column";
4256
+ type_mismatch: "type_mismatch";
4257
+ invalid_cast: "invalid_cast";
4258
+ invalid_argument: "invalid_argument";
4259
+ division_by_zero: "division_by_zero";
4260
+ constraint_violation: "constraint_violation";
4261
+ permission_denied: "permission_denied";
4262
+ }>>;
4686
4263
  }, z.core.$strip>], "status">>;
4687
4264
  }, z.core.$strip>;
4688
4265
 
@@ -4819,7 +4396,26 @@ declare const SignalWithReportIdSchema: z.ZodObject<{
4819
4396
 
4820
4397
  declare type SortingState = ColumnSort[];
4821
4398
 
4822
- declare type TableFilters = Record<string, string | number>;
4399
+ declare type TableFilters = Record<string, TableFilterValue>;
4400
+
4401
+ declare type TableFilterValue = z.infer<typeof TableFilterValueSchema>;
4402
+
4403
+ declare const TableFilterValueSchema: z.ZodObject<{
4404
+ operator: z.ZodEnum<{
4405
+ endsWith: "endsWith";
4406
+ startsWith: "startsWith";
4407
+ contains: "contains";
4408
+ eq: "eq";
4409
+ gt: "gt";
4410
+ gte: "gte";
4411
+ lt: "lt";
4412
+ lte: "lte";
4413
+ neq: "neq";
4414
+ regex: "regex";
4415
+ between: "between";
4416
+ }>;
4417
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
4418
+ }, z.core.$strip>;
4823
4419
 
4824
4420
  /**
4825
4421
  * Token storage keys