@magemetrics/core 0.12.0 → 0.12.2

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +206 -278
  2. package/dist/index.js +85 -19
  3. package/package.json +5 -5
package/dist/index.d.ts CHANGED
@@ -159,8 +159,16 @@ declare interface components {
159
159
  id: number;
160
160
  uuid: string;
161
161
  report_uuid: string;
162
+ /**
163
+ * @deprecated
164
+ * @description Deprecated: use report_uuid.
165
+ */
162
166
  flow_data_id: number;
163
167
  created_at: string;
168
+ /**
169
+ * @deprecated
170
+ * @description Deprecated: use materialization.
171
+ */
164
172
  flow_data?: {
165
173
  is_materialized: boolean | null;
166
174
  last_materialized_at: string | null;
@@ -168,6 +176,13 @@ declare interface components {
168
176
  /** @enum {string|null} */
169
177
  materialized_status: "completed" | "running" | "failed" | null;
170
178
  };
179
+ materialization?: {
180
+ is_materialized: boolean | null;
181
+ last_materialized_at: string | null;
182
+ materialized_error_message: string | null;
183
+ /** @enum {string|null} */
184
+ materialized_status: "completed" | "running" | "failed" | null;
185
+ };
171
186
  configuration: {
172
187
  /** @enum {string} */
173
188
  type: "bar";
@@ -232,8 +247,16 @@ declare interface components {
232
247
  id: number;
233
248
  uuid: string;
234
249
  report_uuid: string;
250
+ /**
251
+ * @deprecated
252
+ * @description Deprecated: use report_uuid.
253
+ */
235
254
  flow_data_id: number;
236
255
  created_at: string;
256
+ /**
257
+ * @deprecated
258
+ * @description Deprecated: use materialization.
259
+ */
237
260
  flow_data?: {
238
261
  is_materialized: boolean | null;
239
262
  last_materialized_at: string | null;
@@ -241,6 +264,13 @@ declare interface components {
241
264
  /** @enum {string|null} */
242
265
  materialized_status: "completed" | "running" | "failed" | null;
243
266
  };
267
+ materialization?: {
268
+ is_materialized: boolean | null;
269
+ last_materialized_at: string | null;
270
+ materialized_error_message: string | null;
271
+ /** @enum {string|null} */
272
+ materialized_status: "completed" | "running" | "failed" | null;
273
+ };
244
274
  configuration: {
245
275
  /** @enum {string} */
246
276
  type: "bar";
@@ -485,6 +515,26 @@ declare interface components {
485
515
  /** @description Column name (optional). Omit for table-level items, include for column-level items. */
486
516
  column_name?: string;
487
517
  };
518
+ StatisticsResponse: {
519
+ /** @description The time period in days for these statistics */
520
+ period_days: number;
521
+ user_generated: components["schemas"]["UserGeneratedStatistics"];
522
+ agent_generated: components["schemas"]["AgentGeneratedStatistics"];
523
+ };
524
+ /** @description Statistics for user-generated content (conversations, reports, visualizations) */
525
+ UserGeneratedStatistics: {
526
+ /** @description Number of user-created conversations */
527
+ conversations: number | null;
528
+ /** @description Number of reports generated */
529
+ reports: number | null;
530
+ /** @description Number of visualizations generated */
531
+ visualizations: number | null;
532
+ };
533
+ /** @description Statistics for agent-generated content (custom agent runs only) */
534
+ AgentGeneratedStatistics: {
535
+ /** @description Number of custom agent runs */
536
+ agent_runs: number;
537
+ };
488
538
  };
489
539
  responses: never;
490
540
  parameters: never;
@@ -523,6 +573,11 @@ declare type CustomDataParts = {
523
573
  "report-status": {
524
574
  status: string | null;
525
575
  };
576
+ "report-narration": {
577
+ step_name: string;
578
+ step_order: number;
579
+ narration: string;
580
+ };
526
581
  };
527
582
 
528
583
  /**
@@ -645,6 +700,10 @@ declare const inputSchema: z.ZodObject<{
645
700
  }>;
646
701
  }, z.core.$strip>;
647
702
 
703
+ declare const inputSchema_10: z.ZodObject<{
704
+ question: z.ZodString;
705
+ }, z.core.$strip>;
706
+
648
707
  declare const inputSchema_2: z.ZodObject<{
649
708
  reportId: z.ZodNumber;
650
709
  chartType: z.ZodEnum<{
@@ -667,6 +726,7 @@ declare const inputSchema_4: z.ZodObject<{
667
726
  declare const inputSchema_5: z.ZodObject<{}, z.core.$strip>;
668
727
 
669
728
  declare const inputSchema_6: z.ZodObject<{
729
+ dataset: z.ZodString;
670
730
  table_name: z.ZodString;
671
731
  }, z.core.$strip>;
672
732
 
@@ -762,6 +822,12 @@ export declare class MageMetricsClient {
762
822
  materialized_error_message: string | null;
763
823
  materialized_status: "completed" | "running" | "failed" | null;
764
824
  } | undefined;
825
+ materialization?: {
826
+ is_materialized: boolean | null;
827
+ last_materialized_at: string | null;
828
+ materialized_error_message: string | null;
829
+ materialized_status: "completed" | "running" | "failed" | null;
830
+ } | undefined;
765
831
  configuration: {
766
832
  type: "bar";
767
833
  title: string;
@@ -1009,6 +1075,7 @@ declare type MMUiTools = {
1009
1075
  paginateDataReport: UiTool_7;
1010
1076
  webSearch: UiTool_8;
1011
1077
  askUserQuestion: UiTool_9;
1078
+ exploreSchema: UiTool_10;
1012
1079
  };
1013
1080
 
1014
1081
  declare interface operations {
@@ -1554,148 +1621,6 @@ declare interface operations {
1554
1621
  };
1555
1622
  };
1556
1623
  };
1557
- getDataReportFeedback: {
1558
- parameters: {
1559
- query?: never;
1560
- header?: {
1561
- "sp-access-token"?: string;
1562
- };
1563
- path: {
1564
- /** @description Numeric legacy ID or UUID */
1565
- report_id: string;
1566
- };
1567
- cookie?: never;
1568
- };
1569
- requestBody?: never;
1570
- responses: {
1571
- /** @description The feedback for the report */
1572
- 200: {
1573
- headers: {
1574
- [name: string]: unknown;
1575
- };
1576
- content: {
1577
- "application/json": {
1578
- created_at: string;
1579
- /** Format: uuid */
1580
- report_id: string;
1581
- flow_data_id: number;
1582
- /** @enum {string} */
1583
- helpfulness: "helpful" | "partially helpful" | "not helpful" | "incorrect";
1584
- id: number;
1585
- } | null;
1586
- };
1587
- };
1588
- /** @description Unable to retrieve feedback */
1589
- 404: {
1590
- headers: {
1591
- [name: string]: unknown;
1592
- };
1593
- content: {
1594
- "application/json": {
1595
- error: string;
1596
- };
1597
- };
1598
- };
1599
- /** @description Something wrong happened */
1600
- 500: {
1601
- headers: {
1602
- [name: string]: unknown;
1603
- };
1604
- content: {
1605
- "application/json": {
1606
- error: string;
1607
- };
1608
- };
1609
- };
1610
- };
1611
- };
1612
- upsertReportFeedback: {
1613
- parameters: {
1614
- query?: never;
1615
- header?: {
1616
- "sp-access-token"?: string;
1617
- };
1618
- path: {
1619
- /** @description Numeric legacy ID or UUID */
1620
- report_id: string;
1621
- };
1622
- cookie?: never;
1623
- };
1624
- /** @description The feedback for the flow data */
1625
- requestBody: {
1626
- content: {
1627
- "application/json": {
1628
- /** @enum {string} */
1629
- helpfulness: "helpful" | "partially helpful" | "not helpful" | "incorrect";
1630
- };
1631
- };
1632
- };
1633
- responses: {
1634
- /** @description Successfully upserted feedback */
1635
- 200: {
1636
- headers: {
1637
- [name: string]: unknown;
1638
- };
1639
- content?: never;
1640
- };
1641
- /** @description Something wrong happened */
1642
- 500: {
1643
- headers: {
1644
- [name: string]: unknown;
1645
- };
1646
- content: {
1647
- "application/json": {
1648
- error: string;
1649
- };
1650
- };
1651
- };
1652
- };
1653
- };
1654
- deleteReportFeedback: {
1655
- parameters: {
1656
- query?: never;
1657
- header?: {
1658
- "sp-access-token"?: string;
1659
- };
1660
- path: {
1661
- /** @description Numeric legacy ID or UUID */
1662
- report_id: string;
1663
- };
1664
- cookie?: never;
1665
- };
1666
- requestBody?: never;
1667
- responses: {
1668
- /** @description Successfully deleted feedback */
1669
- 200: {
1670
- headers: {
1671
- [name: string]: unknown;
1672
- };
1673
- content?: never;
1674
- };
1675
- /** @description Unable to retrieve feedback */
1676
- 404: {
1677
- headers: {
1678
- [name: string]: unknown;
1679
- };
1680
- content: {
1681
- "application/json": {
1682
- error: string;
1683
- };
1684
- };
1685
- };
1686
- /** @description Something wrong happened */
1687
- 500: {
1688
- headers: {
1689
- [name: string]: unknown;
1690
- };
1691
- content: {
1692
- "application/json": {
1693
- error: string;
1694
- };
1695
- };
1696
- };
1697
- };
1698
- };
1699
1624
  getDataReportExplainability: {
1700
1625
  parameters: {
1701
1626
  query?: never;
@@ -1791,6 +1716,56 @@ declare interface operations {
1791
1716
  };
1792
1717
  };
1793
1718
  };
1719
+ getDataReportNarrations: {
1720
+ parameters: {
1721
+ query?: never;
1722
+ header?: {
1723
+ "sp-access-token"?: string;
1724
+ };
1725
+ path: {
1726
+ report_id: string;
1727
+ };
1728
+ cookie?: never;
1729
+ };
1730
+ requestBody?: never;
1731
+ responses: {
1732
+ /** @description The narration steps for the report */
1733
+ 200: {
1734
+ headers: {
1735
+ [name: string]: unknown;
1736
+ };
1737
+ content: {
1738
+ "application/json": {
1739
+ step_name: string;
1740
+ step_order: number;
1741
+ narration: string;
1742
+ }[];
1743
+ };
1744
+ };
1745
+ /** @description Unable to retrieve report with this id */
1746
+ 404: {
1747
+ headers: {
1748
+ [name: string]: unknown;
1749
+ };
1750
+ content: {
1751
+ "application/json": {
1752
+ error: string;
1753
+ };
1754
+ };
1755
+ };
1756
+ /** @description Something wrong happened */
1757
+ 500: {
1758
+ headers: {
1759
+ [name: string]: unknown;
1760
+ };
1761
+ content: {
1762
+ "application/json": {
1763
+ error: string;
1764
+ };
1765
+ };
1766
+ };
1767
+ };
1768
+ };
1794
1769
  getColumnLineage: {
1795
1770
  parameters: {
1796
1771
  query?: never;
@@ -1803,8 +1778,8 @@ declare interface operations {
1803
1778
  requestBody: {
1804
1779
  content: {
1805
1780
  "application/json": {
1806
- /** @description The report id */
1807
- report_id: number;
1781
+ /** @description The report identifier (UUID or legacy numeric ID) */
1782
+ report_id: number | string;
1808
1783
  /** @description The column name to get lineage for */
1809
1784
  column_name: string;
1810
1785
  };
@@ -2269,102 +2244,6 @@ declare interface operations {
2269
2244
  };
2270
2245
  };
2271
2246
  };
2272
- refreshMaterializedViews: {
2273
- parameters: {
2274
- query?: never;
2275
- header?: {
2276
- "sp-access-token"?: string;
2277
- };
2278
- path?: never;
2279
- cookie?: never;
2280
- };
2281
- requestBody: {
2282
- content: {
2283
- "application/json": {
2284
- /** @description List of report IDs to refresh */
2285
- flow_data_ids: (string | number)[];
2286
- };
2287
- };
2288
- };
2289
- responses: {
2290
- /** @description Successfully triggered refresh for materialized views */
2291
- 200: {
2292
- headers: {
2293
- [name: string]: unknown;
2294
- };
2295
- content: {
2296
- "application/json": {
2297
- /** @enum {string} */
2298
- status: "success";
2299
- triggered_at: string;
2300
- };
2301
- };
2302
- };
2303
- /** @description Invalid request */
2304
- 400: {
2305
- headers: {
2306
- [name: string]: unknown;
2307
- };
2308
- content: {
2309
- "application/json": {
2310
- error: string;
2311
- };
2312
- };
2313
- };
2314
- /** @description Something wrong happened */
2315
- 500: {
2316
- headers: {
2317
- [name: string]: unknown;
2318
- };
2319
- content: {
2320
- "application/json": {
2321
- error: string;
2322
- };
2323
- };
2324
- };
2325
- };
2326
- };
2327
- getMaterializationStatus: {
2328
- parameters: {
2329
- query: {
2330
- /** @description Comma-separated list of reports IDs */
2331
- ids: string;
2332
- };
2333
- header?: {
2334
- "sp-access-token"?: string;
2335
- };
2336
- path?: never;
2337
- cookie?: never;
2338
- };
2339
- requestBody?: never;
2340
- responses: {
2341
- /** @description Materialization status for the requested flow_data IDs */
2342
- 200: {
2343
- headers: {
2344
- [name: string]: unknown;
2345
- };
2346
- content: {
2347
- "application/json": {
2348
- id: number;
2349
- /** @enum {string|null} */
2350
- materialized_status: "completed" | "running" | "failed" | null;
2351
- last_materialized_at: string | null;
2352
- }[];
2353
- };
2354
- };
2355
- /** @description Something wrong happened */
2356
- 500: {
2357
- headers: {
2358
- [name: string]: unknown;
2359
- };
2360
- content: {
2361
- "application/json": {
2362
- error: string;
2363
- };
2364
- };
2365
- };
2366
- };
2367
- };
2368
2247
  getPromptStarters: {
2369
2248
  parameters: {
2370
2249
  query?: {
@@ -2616,8 +2495,16 @@ declare interface operations {
2616
2495
  id: number;
2617
2496
  uuid: string;
2618
2497
  report_uuid: string;
2498
+ /**
2499
+ * @deprecated
2500
+ * @description Deprecated: use report_uuid.
2501
+ */
2619
2502
  flow_data_id: number;
2620
2503
  created_at: string;
2504
+ /**
2505
+ * @deprecated
2506
+ * @description Deprecated: use materialization.
2507
+ */
2621
2508
  flow_data?: {
2622
2509
  is_materialized: boolean | null;
2623
2510
  last_materialized_at: string | null;
@@ -2625,6 +2512,13 @@ declare interface operations {
2625
2512
  /** @enum {string|null} */
2626
2513
  materialized_status: "completed" | "running" | "failed" | null;
2627
2514
  };
2515
+ materialization?: {
2516
+ is_materialized: boolean | null;
2517
+ last_materialized_at: string | null;
2518
+ materialized_error_message: string | null;
2519
+ /** @enum {string|null} */
2520
+ materialized_status: "completed" | "running" | "failed" | null;
2521
+ };
2628
2522
  configuration: {
2629
2523
  /** @enum {string} */
2630
2524
  type: "bar";
@@ -5233,6 +5127,7 @@ declare interface operations {
5233
5127
  "application/json": {
5234
5128
  /** @description The natural language data request */
5235
5129
  request: string;
5130
+ execution_context?: components["schemas"]["ExecutionContextInput"];
5236
5131
  };
5237
5132
  };
5238
5133
  };
@@ -5332,6 +5227,42 @@ declare interface operations {
5332
5227
  };
5333
5228
  };
5334
5229
  };
5230
+ getStatistics: {
5231
+ parameters: {
5232
+ query?: {
5233
+ /** @description Time period in days (1-90, default: 30) */
5234
+ days?: number;
5235
+ };
5236
+ header?: {
5237
+ "sp-access-token"?: string;
5238
+ };
5239
+ path?: never;
5240
+ cookie?: never;
5241
+ };
5242
+ requestBody?: never;
5243
+ responses: {
5244
+ /** @description Statistics retrieved successfully */
5245
+ 200: {
5246
+ headers: {
5247
+ [name: string]: unknown;
5248
+ };
5249
+ content: {
5250
+ "application/json": components["schemas"]["StatisticsResponse"];
5251
+ };
5252
+ };
5253
+ /** @description Internal server error */
5254
+ 500: {
5255
+ headers: {
5256
+ [name: string]: unknown;
5257
+ };
5258
+ content: {
5259
+ "application/json": {
5260
+ error: string;
5261
+ };
5262
+ };
5263
+ };
5264
+ };
5265
+ };
5335
5266
  }
5336
5267
 
5337
5268
  declare type PatchParam<T, Config extends RemoveParamsConfig, P extends keyof Config> = Simplify<T extends {
@@ -5504,30 +5435,30 @@ declare interface paths {
5504
5435
  patch?: never;
5505
5436
  trace?: never;
5506
5437
  };
5507
- "/api/v1/data-reports/{report_id}/feedback": {
5438
+ "/api/v1/data-reports/{report_id}/explainability": {
5508
5439
  parameters: {
5509
5440
  query?: never;
5510
5441
  header?: never;
5511
5442
  path?: never;
5512
5443
  cookie?: never;
5513
5444
  };
5514
- get: operations["getDataReportFeedback"];
5445
+ get: operations["getDataReportExplainability"];
5515
5446
  put?: never;
5516
- post: operations["upsertReportFeedback"];
5517
- delete: operations["deleteReportFeedback"];
5447
+ post?: never;
5448
+ delete?: never;
5518
5449
  options?: never;
5519
5450
  head?: never;
5520
5451
  patch?: never;
5521
5452
  trace?: never;
5522
5453
  };
5523
- "/api/v1/data-reports/{report_id}/explainability": {
5454
+ "/api/v1/data-reports/{report_id}/narrations": {
5524
5455
  parameters: {
5525
5456
  query?: never;
5526
5457
  header?: never;
5527
5458
  path?: never;
5528
5459
  cookie?: never;
5529
5460
  };
5530
- get: operations["getDataReportExplainability"];
5461
+ get: operations["getDataReportNarrations"];
5531
5462
  put?: never;
5532
5463
  post?: never;
5533
5464
  delete?: never;
@@ -5664,38 +5595,6 @@ declare interface paths {
5664
5595
  patch?: never;
5665
5596
  trace?: never;
5666
5597
  };
5667
- "/api/v1/flow_data/v1/materialized_views/refresh": {
5668
- parameters: {
5669
- query?: never;
5670
- header?: never;
5671
- path?: never;
5672
- cookie?: never;
5673
- };
5674
- get?: never;
5675
- put?: never;
5676
- post: operations["refreshMaterializedViews"];
5677
- delete?: never;
5678
- options?: never;
5679
- head?: never;
5680
- patch?: never;
5681
- trace?: never;
5682
- };
5683
- "/api/v1/flow_data/materialization-status": {
5684
- parameters: {
5685
- query?: never;
5686
- header?: never;
5687
- path?: never;
5688
- cookie?: never;
5689
- };
5690
- get: operations["getMaterializationStatus"];
5691
- put?: never;
5692
- post?: never;
5693
- delete?: never;
5694
- options?: never;
5695
- head?: never;
5696
- patch?: never;
5697
- trace?: never;
5698
- };
5699
5598
  "/api/v1/prompt-starters": {
5700
5599
  parameters: {
5701
5600
  query?: never;
@@ -6112,6 +6011,22 @@ declare interface paths {
6112
6011
  patch?: never;
6113
6012
  trace?: never;
6114
6013
  };
6014
+ "/api/v1/statistics": {
6015
+ parameters: {
6016
+ query?: never;
6017
+ header?: never;
6018
+ path?: never;
6019
+ cookie?: never;
6020
+ };
6021
+ get: operations["getStatistics"];
6022
+ put?: never;
6023
+ post?: never;
6024
+ delete?: never;
6025
+ options?: never;
6026
+ head?: never;
6027
+ patch?: never;
6028
+ trace?: never;
6029
+ };
6115
6030
  }
6116
6031
 
6117
6032
  declare type PublicApiClient = Simplify<Client<PublicPaths, `${string}/${string}`>>;
@@ -6255,6 +6170,17 @@ declare const redactedOutputSchema_7: z.ZodObject<{
6255
6170
  }, z.core.$strip>], "status">>;
6256
6171
  }, z.core.$strip>;
6257
6172
 
6173
+ declare const redactedOutputSchema_8: z.ZodObject<{
6174
+ tool: z.ZodLiteral<"exploreSchema">;
6175
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
6176
+ status: z.ZodLiteral<"success">;
6177
+ public: z.ZodObject<{}, z.core.$loose>;
6178
+ }, z.core.$strip>, z.ZodObject<{
6179
+ status: z.ZodLiteral<"error">;
6180
+ message: z.ZodString;
6181
+ }, z.core.$strip>], "status">>;
6182
+ }, z.core.$strip>;
6183
+
6258
6184
  declare const RedactedThinkResponse: z.ZodObject<{
6259
6185
  tool: z.ZodDefault<z.ZodLiteral<"think">>;
6260
6186
  result: z.ZodOptional<z.ZodObject<{
@@ -6337,6 +6263,8 @@ declare type ToRemove = {
6337
6263
 
6338
6264
  declare type UiTool = InferUITool<Tool<z.infer<typeof inputSchema>, z.infer<typeof redactedOutputSchema>>>;
6339
6265
 
6266
+ declare type UiTool_10 = InferUITool<Tool<z.infer<typeof inputSchema_10>, z.infer<typeof redactedOutputSchema_8>>>;
6267
+
6340
6268
  declare type UiTool_2 = InferUITool<Tool<z.infer<typeof inputSchema_2>, z.infer<typeof redactedOutputSchema_2>>>;
6341
6269
 
6342
6270
  declare type UiTool_3 = InferUITool<Tool<z.infer<typeof inputSchema_3>, z.infer<typeof RedactedThinkResponse>>>;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ var addApiKeyHeader = (apiKey) => {
58
58
 
59
59
  // package.json
60
60
  var package_default = {
61
- version: "0.12.0"};
61
+ version: "0.12.2"};
62
62
 
63
63
  // src/core/MageMetricsEventEmitter.ts
64
64
  var MageMetricsEventEmitter = class {
@@ -482,7 +482,7 @@ function getOpenApiConfiguration(refOrOpenapi, metadataOrOptions, options) {
482
482
  };
483
483
  }
484
484
 
485
- // ../../node_modules/.pnpm/hono@4.12.10/node_modules/hono/dist/router/reg-exp-router/node.js
485
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/reg-exp-router/node.js
486
486
  new Set(".\\+*[^]$()");
487
487
  var createRoute = (routeConfig) => {
488
488
  const route = {
@@ -1057,6 +1057,11 @@ var FrontendReportExplainabilitySchema = ReportExplainabilitySchema.omit({
1057
1057
  output_dataset: z.string().optional(),
1058
1058
  sql: z.string().optional()
1059
1059
  });
1060
+ var ReportNarrationSchema = z.object({
1061
+ step_name: z.string(),
1062
+ step_order: z.number(),
1063
+ narration: z.string()
1064
+ });
1060
1065
  var FilterOperatorSchema = z.enum([
1061
1066
  // Text operators
1062
1067
  "eq",
@@ -1287,7 +1292,7 @@ createRoute({
1287
1292
  hide: true,
1288
1293
  path: "/api/v1/flows/{flowId}/data-reports/last/status",
1289
1294
  operationId: "retrieveLatestDataReportStatus",
1290
- tags: ["public"],
1295
+ tags: ["internal"],
1291
1296
  request: {
1292
1297
  headers: SupabaseHeaderSchema,
1293
1298
  params: FlowIdParam
@@ -1556,7 +1561,7 @@ createRoute({
1556
1561
  method: "get",
1557
1562
  path: "/api/v1/data-reports/{report_id}/feedback",
1558
1563
  operationId: "getDataReportFeedback",
1559
- tags: ["public"],
1564
+ tags: ["private"],
1560
1565
  request: {
1561
1566
  headers: SupabaseHeaderSchema,
1562
1567
  params: ReportIdParam
@@ -1594,7 +1599,7 @@ createRoute({
1594
1599
  method: "post",
1595
1600
  path: "/api/v1/data-reports/{report_id}/feedback",
1596
1601
  operationId: "upsertReportFeedback",
1597
- tags: ["public"],
1602
+ tags: ["private"],
1598
1603
  request: {
1599
1604
  headers: SupabaseHeaderSchema,
1600
1605
  params: ReportIdParam,
@@ -1630,7 +1635,7 @@ createRoute({
1630
1635
  method: "delete",
1631
1636
  path: "/api/v1/data-reports/{report_id}/feedback",
1632
1637
  operationId: "deleteReportFeedback",
1633
- tags: ["public"],
1638
+ tags: ["private"],
1634
1639
  request: {
1635
1640
  headers: SupabaseHeaderSchema,
1636
1641
  params: ReportIdParam
@@ -1697,6 +1702,45 @@ createRoute({
1697
1702
  }
1698
1703
  }
1699
1704
  });
1705
+ var ReportUuidParam = z.object({ report_id: z.uuid() }).openapi("ReportUuid");
1706
+ createRoute({
1707
+ method: "get",
1708
+ path: "/api/v1/data-reports/{report_id}/narrations",
1709
+ operationId: "getDataReportNarrations",
1710
+ tags: ["public"],
1711
+ request: {
1712
+ headers: SupabaseHeaderSchema,
1713
+ params: ReportUuidParam
1714
+ },
1715
+ responses: {
1716
+ 200: {
1717
+ description: "The narration steps for the report",
1718
+ content: {
1719
+ "application/json": {
1720
+ schema: z.array(ReportNarrationSchema)
1721
+ }
1722
+ }
1723
+ },
1724
+ 404: {
1725
+ content: {
1726
+ "application/json": {
1727
+ schema: z.object({ error: z.string() })
1728
+ }
1729
+ },
1730
+ description: "Unable to retrieve report with this id"
1731
+ },
1732
+ 500: {
1733
+ description: "Something wrong happened",
1734
+ content: {
1735
+ "application/json": {
1736
+ schema: z.object({
1737
+ error: z.string()
1738
+ })
1739
+ }
1740
+ }
1741
+ }
1742
+ }
1743
+ });
1700
1744
  var ColumnLineageNodeSchema = z.object({
1701
1745
  id: z.string(),
1702
1746
  type: z.enum([
@@ -1733,7 +1777,7 @@ createRoute({
1733
1777
  content: {
1734
1778
  "application/json": {
1735
1779
  schema: z.object({
1736
- report_id: z.number().int().describe("The report id"),
1780
+ report_id: z.union([z.number().int(), z.uuid()]).describe("The report identifier (UUID or legacy numeric ID)"),
1737
1781
  column_name: z.string().describe("The column name to get lineage for")
1738
1782
  })
1739
1783
  }
@@ -1819,7 +1863,7 @@ createRoute({
1819
1863
  method: "post",
1820
1864
  path: "/api/v1/flow_data/v1/materialized_views/refresh",
1821
1865
  operationId: "refreshMaterializedViews",
1822
- tags: ["public"],
1866
+ tags: ["private"],
1823
1867
  request: {
1824
1868
  headers: SupabaseHeaderSchema,
1825
1869
  body: {
@@ -1827,7 +1871,8 @@ createRoute({
1827
1871
  content: {
1828
1872
  "application/json": {
1829
1873
  schema: z.object({
1830
- flow_data_ids: z.array(ReportIdFromBody).min(1).describe("List of report IDs to refresh")
1874
+ report_ids: z.array(ReportIdFromBody).min(1).describe("Preferred over flow_data_ids. List of report IDs to refresh.").optional(),
1875
+ flow_data_ids: z.array(ReportIdFromBody).min(1).describe("Deprecated: use report_ids.").optional()
1831
1876
  })
1832
1877
  }
1833
1878
  }
@@ -1872,7 +1917,7 @@ createRoute({
1872
1917
  method: "get",
1873
1918
  path: "/api/v1/flow_data/materialization-status",
1874
1919
  operationId: "getMaterializationStatus",
1875
- tags: ["public"],
1920
+ tags: ["private"],
1876
1921
  request: {
1877
1922
  headers: SupabaseHeaderSchema,
1878
1923
  query: z.object({
@@ -1881,11 +1926,15 @@ createRoute({
1881
1926
  },
1882
1927
  responses: {
1883
1928
  200: {
1884
- description: "Materialization status for the requested flow_data IDs",
1929
+ description: "Materialization status for the requested report IDs",
1885
1930
  content: {
1886
1931
  "application/json": {
1887
1932
  schema: z.array(z.object({
1888
- id: z.number(),
1933
+ uuid: z.string().describe("The report UUID"),
1934
+ id: z.number().openapi({
1935
+ description: "Deprecated: use uuid. Legacy numeric ID.",
1936
+ deprecated: true
1937
+ }),
1889
1938
  materialized_status: MaterializationStatusSchema.nullable(),
1890
1939
  last_materialized_at: z.string().nullable()
1891
1940
  }))
@@ -2616,6 +2665,20 @@ dayjs.extend(timezone);
2616
2665
  var daysjs_default = dayjs;
2617
2666
 
2618
2667
  // ../shared/dist/src/data/FormattedData.js
2668
+ var numberFormatCache = /* @__PURE__ */ new Map();
2669
+ var getNumberFormatter = (minimumFractionDigits, maximumFractionDigits, useGrouping) => {
2670
+ const key = `${minimumFractionDigits}:${maximumFractionDigits}:${useGrouping}`;
2671
+ let formatter = numberFormatCache.get(key);
2672
+ if (!formatter) {
2673
+ formatter = new Intl.NumberFormat(void 0, {
2674
+ minimumFractionDigits,
2675
+ maximumFractionDigits,
2676
+ useGrouping
2677
+ });
2678
+ numberFormatCache.set(key, formatter);
2679
+ }
2680
+ return formatter;
2681
+ };
2619
2682
  var formatWithAutoPrecision = (value, options = {}) => {
2620
2683
  const { minPrecision = 0, maxPrecision = 6, trimZeros = true, useGrouping = true } = options;
2621
2684
  if (typeof value !== "number" || isNaN(value)) {
@@ -2648,11 +2711,7 @@ var formatWithAutoPrecision = (value, options = {}) => {
2648
2711
  }
2649
2712
  }
2650
2713
  maximumFractionDigits = Math.max(maximumFractionDigits, minPrecision);
2651
- const formatter = new Intl.NumberFormat(void 0, {
2652
- minimumFractionDigits: trimZeros ? 0 : maximumFractionDigits,
2653
- maximumFractionDigits,
2654
- useGrouping
2655
- });
2714
+ const formatter = getNumberFormatter(trimZeros ? 0 : maximumFractionDigits, maximumFractionDigits, useGrouping);
2656
2715
  return formatter.format(value);
2657
2716
  };
2658
2717
  var MIN_VALID_YEAR = 1900;
@@ -2887,13 +2946,20 @@ var BaseVisualizationSchema = z.object({
2887
2946
  }),
2888
2947
  uuid: z.string(),
2889
2948
  report_uuid: z.string(),
2890
- flow_data_id: z.number(),
2949
+ flow_data_id: z.number().openapi({
2950
+ description: "Deprecated: use report_uuid.",
2951
+ deprecated: true
2952
+ }),
2891
2953
  created_at: z.string(),
2892
2954
  sql: z.string(),
2893
2955
  data_sample: z.array(z.record(z.string(), z.unknown())),
2894
2956
  is_sample: z.boolean(),
2895
2957
  data_summary: z.record(z.string(), z.unknown()),
2896
- flow_data: MaterializationFieldsSchema.optional()
2958
+ flow_data: MaterializationFieldsSchema.optional().openapi({
2959
+ description: "Deprecated: use materialization.",
2960
+ deprecated: true
2961
+ }),
2962
+ materialization: MaterializationFieldsSchema.optional()
2897
2963
  });
2898
2964
  var V1VisualizationSchema = z.object({
2899
2965
  ...BaseVisualizationSchema.shape,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magemetrics/core",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.12.2",
5
5
  "description": "MageMetrics client library",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -33,10 +33,10 @@
33
33
  "dist/"
34
34
  ],
35
35
  "dependencies": {
36
- "@noble/hashes": "^2.0.1",
37
- "@supabase/auth-js": "^2.97.0",
38
- "@xyflow/system": "^0.0.75",
39
- "ai": "6.0.145",
36
+ "@noble/hashes": "^2.2.0",
37
+ "@supabase/auth-js": "^2.103.0",
38
+ "@xyflow/system": "^0.0.76",
39
+ "ai": "6.0.159",
40
40
  "dayjs": "^1.11.20",
41
41
  "openapi-fetch": "^0.17.0",
42
42
  "type-fest": "^5.5.0",