@magemetrics/core 0.11.6 → 0.12.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
@@ -152,7 +152,13 @@ declare interface components {
152
152
  [key: string]: unknown;
153
153
  }[];
154
154
  VisualizationWithData: {
155
+ /**
156
+ * @deprecated
157
+ * @description Deprecated: use uuid.
158
+ */
155
159
  id: number;
160
+ uuid: string;
161
+ report_uuid: string;
156
162
  flow_data_id: number;
157
163
  created_at: string;
158
164
  flow_data?: {
@@ -219,7 +225,13 @@ declare interface components {
219
225
  sampledCount: number;
220
226
  };
221
227
  } | {
228
+ /**
229
+ * @deprecated
230
+ * @description Deprecated: use uuid.
231
+ */
222
232
  id: number;
233
+ uuid: string;
234
+ report_uuid: string;
223
235
  flow_data_id: number;
224
236
  created_at: string;
225
237
  flow_data?: {
@@ -297,7 +309,7 @@ declare interface components {
297
309
  /** Format: uuid */
298
310
  flow_id: string | null;
299
311
  /** @enum {string} */
300
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
312
+ status: "pending" | "running" | "post_processing" | "completed" | "failed" | "cancelled";
301
313
  created_at: string;
302
314
  started_at: string | null;
303
315
  completed_at: string | null;
@@ -419,6 +431,11 @@ declare interface components {
419
431
  model: "gemini-3.1-pro-preview";
420
432
  /** @enum {string} */
421
433
  thinking?: "low" | "high";
434
+ } | {
435
+ /** @enum {string} */
436
+ model: "gemini-2.5-pro";
437
+ /** @enum {string} */
438
+ thinking?: "low" | "high";
422
439
  } | {
423
440
  /** @enum {string} */
424
441
  model: "claude-sonnet-4-6" | "claude-opus-4-6";
@@ -426,8 +443,10 @@ declare interface components {
426
443
  effort?: "low" | "medium" | "high";
427
444
  } | {
428
445
  /** @enum {string} */
429
- model: "claude-haiku-4-5";
446
+ model: "claude-haiku-4-5" | "claude-opus-4-5";
430
447
  } | null;
448
+ /** @enum {string} */
449
+ execution_platform: "native" | "sandbox" | "sandbox_public";
431
450
  master_prompt_name: string | null;
432
451
  master_prompt_version: number | null;
433
452
  created_at: string;
@@ -484,27 +503,12 @@ declare const CreateCanvasSchema: z.ZodObject<{
484
503
  flow_id: z.ZodOptional<z.ZodString>;
485
504
  }, z.core.$strip>;
486
505
 
487
- /**
488
- * A file attachment to include in the first message of a flow.
489
- *
490
- * Structurally compatible with the AI SDK's `FileUIPart`, so the output of
491
- * `useFileUpload().getFileParts()` can be passed directly — no mapping needed.
492
- */
493
- declare type CreateFlowFile = default_2.infer<typeof CreateFlowFileSchema>;
494
-
495
- declare const CreateFlowFileSchema: z.ZodObject<{
496
- type: z.ZodLiteral<"file">;
497
- mediaType: z.ZodString;
498
- filename: z.ZodOptional<z.ZodString>;
499
- url: z.ZodString;
500
- }, z.core.$strip>;
501
-
502
506
  /**
503
507
  * Parameters for starting a flow
504
508
  */
505
509
  export declare type CreateFlowParam = {
506
510
  query: string;
507
- files?: CreateFlowFile[];
511
+ uploadedFileIds?: UploadedFileId[];
508
512
  } | {
509
513
  triggerId: string;
510
514
  variables: Record<string, string>;
@@ -621,6 +625,9 @@ declare const FrontendRecentFlowsSchema: z.ZodObject<{
621
625
  created_at: z.ZodString;
622
626
  application_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
623
627
  user_id: z.ZodNullable<z.ZodString>;
628
+ context_tokens: z.ZodOptional<z.ZodNumber>;
629
+ acc_input_tokens: z.ZodOptional<z.ZodNumber>;
630
+ acc_output_tokens: z.ZodOptional<z.ZodNumber>;
624
631
  }, z.core.$strip>;
625
632
 
626
633
  export declare const getPublicApiClient: (apiUrl: string, apiKey: string) => Client<PublicPaths>;
@@ -631,11 +638,6 @@ declare const inputSchema: z.ZodObject<{
631
638
  rawRequest: z.ZodString;
632
639
  userRequest: z.ZodString;
633
640
  isNewAnalysisGoal: z.ZodBoolean;
634
- responseType: z.ZodEnum<{
635
- text: "text";
636
- visualization: "visualization";
637
- table: "table";
638
- }>;
639
641
  difficultyLevel: z.ZodEnum<{
640
642
  simple: "simple";
641
643
  moderate: "moderate";
@@ -750,6 +752,8 @@ export declare class MageMetricsClient {
750
752
  api: {
751
753
  getFlowVisualizations: (flowId: string) => Promise<{
752
754
  id: number;
755
+ uuid: string;
756
+ report_uuid: string;
753
757
  flow_data_id: number;
754
758
  created_at: string;
755
759
  flow_data?: {
@@ -803,6 +807,7 @@ export declare class MageMetricsClient {
803
807
  created_at: string;
804
808
  flow_id: string;
805
809
  id: number;
810
+ uuid: string;
806
811
  title: string;
807
812
  request: string | null;
808
813
  data_summary: {
@@ -842,6 +847,9 @@ export declare class MageMetricsClient {
842
847
  title: string | null;
843
848
  user_id: string | null;
844
849
  application_id?: number | null | undefined;
850
+ context_tokens?: number | undefined;
851
+ acc_input_tokens?: number | undefined;
852
+ acc_output_tokens?: number | undefined;
845
853
  }>;
846
854
  getRecentFlows: (params?: {
847
855
  limit?: number;
@@ -849,6 +857,13 @@ export declare class MageMetricsClient {
849
857
  createFlow: (request: CreateFlowParam) => Promise<{
850
858
  flowId: string;
851
859
  }>;
860
+ uploadFile: (file: File, flowId?: string) => Promise<{
861
+ uploadedFileId: string;
862
+ filename: string;
863
+ mediaType: string;
864
+ sizeBytes: number;
865
+ }>;
866
+ deleteUploadedFile: (uploadedFileId: string) => Promise<void>;
852
867
  canvas: {
853
868
  list: (query?: string) => Promise<{
854
869
  id: string;
@@ -863,6 +878,9 @@ export declare class MageMetricsClient {
863
878
  title: string | null;
864
879
  user_id: string | null;
865
880
  application_id?: number | null | undefined;
881
+ context_tokens?: number | undefined;
882
+ acc_input_tokens?: number | undefined;
883
+ acc_output_tokens?: number | undefined;
866
884
  }[];
867
885
  }[]>;
868
886
  get: (canvasId: string) => Promise<{
@@ -1096,6 +1114,7 @@ declare interface operations {
1096
1114
  query?: never;
1097
1115
  header?: never;
1098
1116
  path: {
1117
+ /** @description Numeric legacy ID or UUID */
1099
1118
  report_id: string;
1100
1119
  canvas_id: components["schemas"]["CanvasId"];
1101
1120
  };
@@ -1148,6 +1167,7 @@ declare interface operations {
1148
1167
  };
1149
1168
  header?: never;
1150
1169
  path: {
1170
+ /** @description Numeric legacy ID or UUID */
1151
1171
  report_id: string;
1152
1172
  canvas_id: components["schemas"]["CanvasId"];
1153
1173
  };
@@ -1193,6 +1213,7 @@ declare interface operations {
1193
1213
  query?: never;
1194
1214
  header?: never;
1195
1215
  path: {
1216
+ /** @description Numeric legacy ID or UUID */
1196
1217
  report_id: string;
1197
1218
  canvas_id: components["schemas"]["CanvasId"];
1198
1219
  };
@@ -1369,6 +1390,9 @@ declare interface operations {
1369
1390
  title: string | null;
1370
1391
  user_id: string | null;
1371
1392
  application_id?: number | null;
1393
+ context_tokens?: number;
1394
+ acc_input_tokens?: number;
1395
+ acc_output_tokens?: number;
1372
1396
  };
1373
1397
  };
1374
1398
  };
@@ -1422,6 +1446,9 @@ declare interface operations {
1422
1446
  title: string | null;
1423
1447
  user_id: string | null;
1424
1448
  application_id?: number | null;
1449
+ context_tokens?: number;
1450
+ acc_input_tokens?: number;
1451
+ acc_output_tokens?: number;
1425
1452
  }[];
1426
1453
  };
1427
1454
  };
@@ -1460,7 +1487,12 @@ declare interface operations {
1460
1487
  "application/json": {
1461
1488
  created_at: string;
1462
1489
  flow_id: string;
1490
+ /**
1491
+ * @deprecated
1492
+ * @description Deprecated: use uuid.
1493
+ */
1463
1494
  id: number;
1495
+ uuid: string;
1464
1496
  title: string;
1465
1497
  request: string | null;
1466
1498
  data_summary: {
@@ -1529,6 +1561,7 @@ declare interface operations {
1529
1561
  "sp-access-token"?: string;
1530
1562
  };
1531
1563
  path: {
1564
+ /** @description Numeric legacy ID or UUID */
1532
1565
  report_id: string;
1533
1566
  };
1534
1567
  cookie?: never;
@@ -1543,6 +1576,8 @@ declare interface operations {
1543
1576
  content: {
1544
1577
  "application/json": {
1545
1578
  created_at: string;
1579
+ /** Format: uuid */
1580
+ report_id: string;
1546
1581
  flow_data_id: number;
1547
1582
  /** @enum {string} */
1548
1583
  helpfulness: "helpful" | "partially helpful" | "not helpful" | "incorrect";
@@ -1581,6 +1616,7 @@ declare interface operations {
1581
1616
  "sp-access-token"?: string;
1582
1617
  };
1583
1618
  path: {
1619
+ /** @description Numeric legacy ID or UUID */
1584
1620
  report_id: string;
1585
1621
  };
1586
1622
  cookie?: never;
@@ -1622,6 +1658,7 @@ declare interface operations {
1622
1658
  "sp-access-token"?: string;
1623
1659
  };
1624
1660
  path: {
1661
+ /** @description Numeric legacy ID or UUID */
1625
1662
  report_id: string;
1626
1663
  };
1627
1664
  cookie?: never;
@@ -1666,6 +1703,7 @@ declare interface operations {
1666
1703
  "sp-access-token"?: string;
1667
1704
  };
1668
1705
  path: {
1706
+ /** @description Numeric legacy ID or UUID */
1669
1707
  report_id: string;
1670
1708
  };
1671
1709
  cookie?: never;
@@ -1715,6 +1753,12 @@ declare interface operations {
1715
1753
  confidence_score_reason?: string;
1716
1754
  assumptions_score?: number;
1717
1755
  assumptions_score_reason?: string;
1756
+ /** Format: uuid */
1757
+ report_id: string;
1758
+ /**
1759
+ * @deprecated
1760
+ * @description Deprecated: use report_id.
1761
+ */
1718
1762
  flow_data_id: number;
1719
1763
  friendliness_score?: number;
1720
1764
  friendliness_score_reason?: string;
@@ -1879,6 +1923,7 @@ declare interface operations {
1879
1923
  "sp-access-token"?: string;
1880
1924
  };
1881
1925
  path: {
1926
+ /** @description Numeric legacy ID or UUID */
1882
1927
  report_id: string;
1883
1928
  };
1884
1929
  cookie?: never;
@@ -1925,6 +1970,7 @@ declare interface operations {
1925
1970
  "sp-access-token"?: string;
1926
1971
  };
1927
1972
  path: {
1973
+ /** @description Numeric legacy ID or UUID */
1928
1974
  report_id: string;
1929
1975
  };
1930
1976
  cookie?: never;
@@ -1980,6 +2026,7 @@ declare interface operations {
1980
2026
  "sp-access-token"?: string;
1981
2027
  };
1982
2028
  path: {
2029
+ /** @description Numeric legacy ID or UUID */
1983
2030
  report_id: string;
1984
2031
  };
1985
2032
  cookie?: never;
@@ -2026,6 +2073,7 @@ declare interface operations {
2026
2073
  "sp-access-token"?: string;
2027
2074
  };
2028
2075
  path: {
2076
+ /** @description Numeric legacy ID or UUID */
2029
2077
  report_id: string;
2030
2078
  };
2031
2079
  cookie?: never;
@@ -2075,6 +2123,7 @@ declare interface operations {
2075
2123
  "sp-access-token"?: string;
2076
2124
  };
2077
2125
  path: {
2126
+ /** @description Numeric legacy ID or UUID */
2078
2127
  report_id: string;
2079
2128
  };
2080
2129
  cookie?: never;
@@ -2090,7 +2139,12 @@ declare interface operations {
2090
2139
  "application/json": {
2091
2140
  created_at: string;
2092
2141
  flow_id: string;
2142
+ /**
2143
+ * @deprecated
2144
+ * @description Deprecated: use uuid.
2145
+ */
2093
2146
  id: number;
2147
+ uuid: string;
2094
2148
  title: string;
2095
2149
  request: string | null;
2096
2150
  data_summary: {
@@ -2173,6 +2227,7 @@ declare interface operations {
2173
2227
  filename?: string;
2174
2228
  url: string;
2175
2229
  }[];
2230
+ uploadedFileIds?: string[];
2176
2231
  };
2177
2232
  };
2178
2233
  };
@@ -2226,8 +2281,8 @@ declare interface operations {
2226
2281
  requestBody: {
2227
2282
  content: {
2228
2283
  "application/json": {
2229
- /** @description List of flow_data IDs to refresh */
2230
- flow_data_ids: number[];
2284
+ /** @description List of report IDs to refresh */
2285
+ flow_data_ids: (string | number)[];
2231
2286
  };
2232
2287
  };
2233
2288
  };
@@ -2272,7 +2327,7 @@ declare interface operations {
2272
2327
  getMaterializationStatus: {
2273
2328
  parameters: {
2274
2329
  query: {
2275
- /** @description Comma-separated list of flow_data IDs */
2330
+ /** @description Comma-separated list of reports IDs */
2276
2331
  ids: string;
2277
2332
  };
2278
2333
  header?: {
@@ -2554,7 +2609,13 @@ declare interface operations {
2554
2609
  };
2555
2610
  content: {
2556
2611
  "application/json": {
2612
+ /**
2613
+ * @deprecated
2614
+ * @description Deprecated: use uuid.
2615
+ */
2557
2616
  id: number;
2617
+ uuid: string;
2618
+ report_uuid: string;
2558
2619
  flow_data_id: number;
2559
2620
  created_at: string;
2560
2621
  flow_data?: {
@@ -2966,6 +3027,9 @@ declare interface operations {
2966
3027
  title: string | null;
2967
3028
  user_id: string | null;
2968
3029
  application_id?: number | null;
3030
+ context_tokens?: number;
3031
+ acc_input_tokens?: number;
3032
+ acc_output_tokens?: number;
2969
3033
  }[];
2970
3034
  }[];
2971
3035
  };
@@ -3039,7 +3103,7 @@ declare interface operations {
3039
3103
  listAgentRuns: {
3040
3104
  parameters: {
3041
3105
  query?: {
3042
- status?: "pending" | "running" | "completed" | "failed" | "cancelled";
3106
+ status?: "pending" | "running" | "post_processing" | "completed" | "failed" | "cancelled";
3043
3107
  agent_id?: string;
3044
3108
  limit?: number;
3045
3109
  };
@@ -3270,6 +3334,11 @@ declare interface operations {
3270
3334
  model: "gemini-3.1-pro-preview";
3271
3335
  /** @enum {string} */
3272
3336
  thinking?: "low" | "high";
3337
+ } | {
3338
+ /** @enum {string} */
3339
+ model: "gemini-2.5-pro";
3340
+ /** @enum {string} */
3341
+ thinking?: "low" | "high";
3273
3342
  } | {
3274
3343
  /** @enum {string} */
3275
3344
  model: "claude-sonnet-4-6" | "claude-opus-4-6";
@@ -3277,8 +3346,13 @@ declare interface operations {
3277
3346
  effort?: "low" | "medium" | "high";
3278
3347
  } | {
3279
3348
  /** @enum {string} */
3280
- model: "claude-haiku-4-5";
3349
+ model: "claude-haiku-4-5" | "claude-opus-4-5";
3281
3350
  };
3351
+ /**
3352
+ * @default native
3353
+ * @enum {string}
3354
+ */
3355
+ execution_platform?: "native" | "sandbox" | "sandbox_public";
3282
3356
  master_prompt_name?: string;
3283
3357
  master_prompt_version?: number;
3284
3358
  };
@@ -3424,6 +3498,11 @@ declare interface operations {
3424
3498
  model: "gemini-3.1-pro-preview";
3425
3499
  /** @enum {string} */
3426
3500
  thinking?: "low" | "high";
3501
+ } | {
3502
+ /** @enum {string} */
3503
+ model: "gemini-2.5-pro";
3504
+ /** @enum {string} */
3505
+ thinking?: "low" | "high";
3427
3506
  } | {
3428
3507
  /** @enum {string} */
3429
3508
  model: "claude-sonnet-4-6" | "claude-opus-4-6";
@@ -3431,8 +3510,10 @@ declare interface operations {
3431
3510
  effort?: "low" | "medium" | "high";
3432
3511
  } | {
3433
3512
  /** @enum {string} */
3434
- model: "claude-haiku-4-5";
3513
+ model: "claude-haiku-4-5" | "claude-opus-4-5";
3435
3514
  } | null;
3515
+ /** @enum {string} */
3516
+ execution_platform?: "native" | "sandbox" | "sandbox_public";
3436
3517
  master_prompt_name?: string | null;
3437
3518
  master_prompt_version?: number | null;
3438
3519
  };
@@ -5138,6 +5219,119 @@ declare interface operations {
5138
5219
  };
5139
5220
  };
5140
5221
  };
5222
+ generateDataReport: {
5223
+ parameters: {
5224
+ query?: never;
5225
+ header?: {
5226
+ "sp-access-token"?: string;
5227
+ };
5228
+ path?: never;
5229
+ cookie?: never;
5230
+ };
5231
+ requestBody: {
5232
+ content: {
5233
+ "application/json": {
5234
+ /** @description The natural language data request */
5235
+ request: string;
5236
+ };
5237
+ };
5238
+ };
5239
+ responses: {
5240
+ /** @description Data report generated successfully */
5241
+ 200: {
5242
+ headers: {
5243
+ [name: string]: unknown;
5244
+ };
5245
+ content: {
5246
+ "application/json": {
5247
+ /** @enum {string} */
5248
+ status: "success";
5249
+ generation_id: string;
5250
+ sql: string;
5251
+ title: string | null;
5252
+ goal: string | null;
5253
+ view_name: string | null;
5254
+ view_schema: string | null;
5255
+ data_sample: {
5256
+ [key: string]: unknown;
5257
+ }[] | null;
5258
+ data_summary: {
5259
+ [key: string]: unknown;
5260
+ } | null;
5261
+ is_sample: boolean;
5262
+ };
5263
+ };
5264
+ };
5265
+ /** @description Invalid request */
5266
+ 400: {
5267
+ headers: {
5268
+ [name: string]: unknown;
5269
+ };
5270
+ content: {
5271
+ "application/json": {
5272
+ error: string;
5273
+ };
5274
+ };
5275
+ };
5276
+ /** @description Service account authentication required */
5277
+ 403: {
5278
+ headers: {
5279
+ [name: string]: unknown;
5280
+ };
5281
+ content: {
5282
+ "application/json": {
5283
+ error: string;
5284
+ };
5285
+ };
5286
+ };
5287
+ /** @description SQL generation failed */
5288
+ 422: {
5289
+ headers: {
5290
+ [name: string]: unknown;
5291
+ };
5292
+ content: {
5293
+ "application/json": {
5294
+ /** @enum {string} */
5295
+ status: "error";
5296
+ error: string;
5297
+ error_info?: {
5298
+ error_message: string;
5299
+ /** @enum {string} */
5300
+ category: "timeout" | "connection_error" | "auth_error" | "resource_exhausted" | "table_not_found" | "column_not_found" | "schema_not_found" | "view_not_found" | "function_not_found" | "syntax_error" | "ambiguous_column" | "type_mismatch" | "invalid_cast" | "invalid_argument" | "division_by_zero" | "constraint_violation" | "permission_denied" | "unknown";
5301
+ details?: string | null;
5302
+ hint?: string | null;
5303
+ line_num?: number | null;
5304
+ col_num?: number | null;
5305
+ } | null;
5306
+ failed_sql?: string | null;
5307
+ };
5308
+ };
5309
+ };
5310
+ /** @description Rate limit exceeded for this API key */
5311
+ 429: {
5312
+ headers: {
5313
+ [name: string]: unknown;
5314
+ };
5315
+ content: {
5316
+ "application/json": {
5317
+ error: string;
5318
+ retry_after_ms: number;
5319
+ };
5320
+ };
5321
+ };
5322
+ /** @description Internal server error */
5323
+ 500: {
5324
+ headers: {
5325
+ [name: string]: unknown;
5326
+ };
5327
+ content: {
5328
+ "application/json": {
5329
+ error: string;
5330
+ };
5331
+ };
5332
+ };
5333
+ };
5334
+ };
5141
5335
  }
5142
5336
 
5143
5337
  declare type PatchParam<T, Config extends RemoveParamsConfig, P extends keyof Config> = Simplify<T extends {
@@ -5902,6 +6096,22 @@ declare interface paths {
5902
6096
  patch: operations["updateTableColumn"];
5903
6097
  trace?: never;
5904
6098
  };
6099
+ "/api/v1/data-reports/generate": {
6100
+ parameters: {
6101
+ query?: never;
6102
+ header?: never;
6103
+ path?: never;
6104
+ cookie?: never;
6105
+ };
6106
+ get?: never;
6107
+ put?: never;
6108
+ post: operations["generateDataReport"];
6109
+ delete?: never;
6110
+ options?: never;
6111
+ head?: never;
6112
+ patch?: never;
6113
+ trace?: never;
6114
+ };
5905
6115
  }
5906
6116
 
5907
6117
  declare type PublicApiClient = Simplify<Client<PublicPaths, `${string}/${string}`>>;
@@ -6151,4 +6361,9 @@ declare const UpdateCanvasSchema: z.ZodObject<{
6151
6361
  is_public: z.ZodOptional<z.ZodBoolean>;
6152
6362
  }, z.core.$strip>;
6153
6363
 
6364
+ /** A previously uploaded file identifier to attach to the first message of a flow. */
6365
+ declare type UploadedFileId = default_2.infer<typeof UploadedFileIdSchema>;
6366
+
6367
+ declare const UploadedFileIdSchema: z.ZodUUID;
6368
+
6154
6369
  export { }