@magemetrics/core 0.10.0 → 0.11.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.js CHANGED
@@ -57,7 +57,7 @@ var addApiKeyHeader = (apiKey) => {
57
57
 
58
58
  // package.json
59
59
  var package_default = {
60
- version: "0.10.0"};
60
+ version: "0.11.1"};
61
61
 
62
62
  // src/core/MageMetricsEventEmitter.ts
63
63
  var MageMetricsEventEmitter = class {
@@ -494,9 +494,7 @@ var GetApiInformation = createRoute({
494
494
  method: "get",
495
495
  path: "/api/v1/auth/apiInformation",
496
496
  operationId: "getApiInformation",
497
- request: {
498
- query: GetApiInformationInputSchema
499
- },
497
+ tags: ["public"],
500
498
  responses: {
501
499
  200: {
502
500
  content: {
@@ -575,6 +573,7 @@ var ExchangeExternalToken = createRoute({
575
573
  method: "post",
576
574
  path: "/api/v1/auth/exchangeExternalToken",
577
575
  operationId: "exchangeExternalToken",
576
+ tags: ["public"],
578
577
  request: {
579
578
  body: {
580
579
  required: true,
@@ -701,13 +700,7 @@ var ExternalAuthProvider = class {
701
700
  this.noAuthApiClient.use(throwOnError);
702
701
  this.noAuthApiClient.use(addVersionHeader(MM_CLIENT_VERSION2));
703
702
  this.noAuthApiClient.use(addApiKeyHeader(this.config.apiKey));
704
- const { data } = await this.noAuthApiClient.GET(GetApiInformation.path, {
705
- params: {
706
- query: {
707
- apiKey: this.config.apiKey
708
- }
709
- }
710
- });
703
+ const { data } = await this.noAuthApiClient.GET(GetApiInformation.path);
711
704
  if (!data) {
712
705
  throw new Error("Failed to fetch API information");
713
706
  }
@@ -840,7 +833,7 @@ var ExternalAuthProvider = class {
840
833
  }
841
834
  };
842
835
  var SupabaseUserHeaderSchema = z.object({
843
- [HEADER_SP_TOKEN]: z.string()
836
+ [HEADER_SP_TOKEN]: z.string().optional()
844
837
  });
845
838
  var SupabaseHeaderSchema = SupabaseUserHeaderSchema;
846
839
  var FEEDBACK_OPTIONS = [
@@ -970,7 +963,6 @@ var ReportSchema = z.object({
970
963
  data_summary: z.looseObject({
971
964
  columns: z.record(z.string(), ReportColumnSchema)
972
965
  }),
973
- bookmarked: z.boolean(),
974
966
  status: z.string().nullable(),
975
967
  is_removed: z.boolean(),
976
968
  ...MaterializationFieldsSchema.shape
@@ -1192,6 +1184,7 @@ var RetrieveFlowDataReports = createRoute({
1192
1184
  method: "get",
1193
1185
  path: "/api/v1/flows/{flowId}/data-reports",
1194
1186
  operationId: "retrieveFlowDataReports",
1187
+ tags: ["public"],
1195
1188
  request: {
1196
1189
  headers: SupabaseHeaderSchema,
1197
1190
  params: FlowIdParam
@@ -1227,8 +1220,10 @@ var RetrieveFlowDataReports = createRoute({
1227
1220
  });
1228
1221
  createRoute({
1229
1222
  method: "get",
1223
+ hide: true,
1230
1224
  path: "/api/v1/flows/{flowId}/data-reports/last/status",
1231
1225
  operationId: "retrieveLatestDataReportStatus",
1226
+ tags: ["public"],
1232
1227
  request: {
1233
1228
  headers: SupabaseHeaderSchema,
1234
1229
  params: FlowIdParam
@@ -1266,6 +1261,7 @@ var RetrieveFlow = createRoute({
1266
1261
  method: "get",
1267
1262
  path: "/api/v1/flows/{flowId}",
1268
1263
  operationId: "retrieveFlow",
1264
+ tags: ["public"],
1269
1265
  request: {
1270
1266
  headers: SupabaseHeaderSchema,
1271
1267
  params: FlowIdParam
@@ -1303,6 +1299,7 @@ var RetrieveRecentFlows = createRoute({
1303
1299
  method: "get",
1304
1300
  path: "/api/v1/recent-flows",
1305
1301
  operationId: "retrieveRecentFlows",
1302
+ tags: ["public"],
1306
1303
  request: {
1307
1304
  headers: SupabaseHeaderSchema,
1308
1305
  query: z.object({
@@ -1334,6 +1331,7 @@ var GetReportColumns = createRoute({
1334
1331
  method: "get",
1335
1332
  path: "/api/v1/data-reports/{report_id}/columns",
1336
1333
  operationId: "getDataReportColumns",
1334
+ tags: ["public"],
1337
1335
  request: {
1338
1336
  headers: SupabaseHeaderSchema,
1339
1337
  params: ReportIdParam
@@ -1371,6 +1369,7 @@ var ExportReportData = createRoute({
1371
1369
  method: "get",
1372
1370
  path: "/api/v1/data-reports/{report_id}/export",
1373
1371
  operationId: "exportReportData",
1372
+ tags: ["public"],
1374
1373
  request: {
1375
1374
  headers: SupabaseHeaderSchema,
1376
1375
  params: ReportIdParam
@@ -1408,6 +1407,7 @@ var GetReportData = createRoute({
1408
1407
  method: "get",
1409
1408
  path: "/api/v1/data-reports/{report_id}/data",
1410
1409
  operationId: "getDataReportData",
1410
+ tags: ["public"],
1411
1411
  request: {
1412
1412
  headers: SupabaseHeaderSchema,
1413
1413
  params: ReportIdParam,
@@ -1452,6 +1452,7 @@ var GetReportRowCount = createRoute({
1452
1452
  method: "get",
1453
1453
  path: "/api/v1/data-reports/{report_id}/count",
1454
1454
  operationId: "getDataReportRowCount",
1455
+ tags: ["public"],
1455
1456
  request: {
1456
1457
  headers: SupabaseHeaderSchema,
1457
1458
  params: ReportIdParam
@@ -1491,6 +1492,7 @@ createRoute({
1491
1492
  method: "get",
1492
1493
  path: "/api/v1/data-reports/{report_id}/feedback",
1493
1494
  operationId: "getDataReportFeedback",
1495
+ tags: ["public"],
1494
1496
  request: {
1495
1497
  headers: SupabaseHeaderSchema,
1496
1498
  params: ReportIdParam
@@ -1528,6 +1530,7 @@ createRoute({
1528
1530
  method: "post",
1529
1531
  path: "/api/v1/data-reports/{report_id}/feedback",
1530
1532
  operationId: "upsertReportFeedback",
1533
+ tags: ["public"],
1531
1534
  request: {
1532
1535
  headers: SupabaseHeaderSchema,
1533
1536
  params: ReportIdParam,
@@ -1563,6 +1566,7 @@ createRoute({
1563
1566
  method: "delete",
1564
1567
  path: "/api/v1/data-reports/{report_id}/feedback",
1565
1568
  operationId: "deleteReportFeedback",
1569
+ tags: ["public"],
1566
1570
  request: {
1567
1571
  headers: SupabaseHeaderSchema,
1568
1572
  params: ReportIdParam
@@ -1595,6 +1599,7 @@ createRoute({
1595
1599
  method: "get",
1596
1600
  path: "/api/v1/data-reports/{report_id}/explainability",
1597
1601
  operationId: "getDataReportExplainability",
1602
+ tags: ["public"],
1598
1603
  request: {
1599
1604
  headers: SupabaseHeaderSchema,
1600
1605
  params: ReportIdParam
@@ -1656,6 +1661,7 @@ createRoute({
1656
1661
  method: "post",
1657
1662
  path: "/api/v1/workflows/column_lineage",
1658
1663
  operationId: "getColumnLineage",
1664
+ tags: ["public"],
1659
1665
  request: {
1660
1666
  headers: SupabaseHeaderSchema,
1661
1667
  body: {
@@ -1711,6 +1717,7 @@ createRoute({
1711
1717
  method: "get",
1712
1718
  path: "/api/v1/data-reports/{report_id}",
1713
1719
  operationId: "getDataReport",
1720
+ tags: ["public"],
1714
1721
  request: {
1715
1722
  headers: SupabaseHeaderSchema,
1716
1723
  params: ReportIdParam
@@ -1748,6 +1755,7 @@ createRoute({
1748
1755
  method: "post",
1749
1756
  path: "/api/v1/flow_data/v1/materialized_views/refresh",
1750
1757
  operationId: "refreshMaterializedViews",
1758
+ tags: ["public"],
1751
1759
  request: {
1752
1760
  headers: SupabaseHeaderSchema,
1753
1761
  body: {
@@ -1800,6 +1808,7 @@ createRoute({
1800
1808
  method: "get",
1801
1809
  path: "/api/v1/flow_data/materialization-status",
1802
1810
  operationId: "getMaterializationStatus",
1811
+ tags: ["public"],
1803
1812
  request: {
1804
1813
  headers: SupabaseHeaderSchema,
1805
1814
  query: z.object({
@@ -1835,6 +1844,7 @@ var CreateFlow = createRoute({
1835
1844
  method: "post",
1836
1845
  path: "/api/v1/flows",
1837
1846
  operationId: "createFlow",
1847
+ tags: ["public"],
1838
1848
  request: {
1839
1849
  headers: SupabaseHeaderSchema,
1840
1850
  body: {
@@ -1893,6 +1903,7 @@ var CreateSpeechToken = createRoute({
1893
1903
  method: "post",
1894
1904
  path: "/api/v1/speech/token",
1895
1905
  operationId: "createSpeechToken",
1906
+ tags: ["public"],
1896
1907
  request: {
1897
1908
  headers: SupabaseHeaderSchema
1898
1909
  },
@@ -1936,6 +1947,7 @@ var TriggerFlow = createRoute({
1936
1947
  method: "post",
1937
1948
  path: "/api/v1/trigger-flow",
1938
1949
  operationId: "triggerFlow",
1950
+ tags: ["public"],
1939
1951
  request: {
1940
1952
  headers: SupabaseHeaderSchema,
1941
1953
  body: {
@@ -2207,6 +2219,7 @@ var ListCanvases = createRoute({
2207
2219
  method: "get",
2208
2220
  path: "/api/v1/canvases",
2209
2221
  operationId: "listCanvases",
2222
+ tags: ["public"],
2210
2223
  request: {
2211
2224
  headers: SupabaseHeaderSchema,
2212
2225
  query: z.object({
@@ -2240,6 +2253,7 @@ var RetrieveCanvas = createRoute({
2240
2253
  method: "get",
2241
2254
  path: "/api/v1/canvas/{canvas_id}",
2242
2255
  operationId: "retrieveCanvas",
2256
+ tags: ["public"],
2243
2257
  request: {
2244
2258
  headers: SupabaseHeaderSchema,
2245
2259
  params: z.object({
@@ -2279,6 +2293,7 @@ var CreateCanvas = createRoute({
2279
2293
  method: "post",
2280
2294
  path: "/api/v1/canvas/",
2281
2295
  operationId: "createCanvas",
2296
+ tags: ["public"],
2282
2297
  request: {
2283
2298
  headers: SupabaseHeaderSchema,
2284
2299
  body: {
@@ -2325,6 +2340,7 @@ var UpdateCanvas = createRoute({
2325
2340
  method: "put",
2326
2341
  path: "/api/v1/canvas/{canvas_id}",
2327
2342
  operationId: "updateCanvas",
2343
+ tags: ["public"],
2328
2344
  request: {
2329
2345
  headers: SupabaseHeaderSchema,
2330
2346
  params: z.object({
@@ -2374,6 +2390,7 @@ var DeleteCanvas = createRoute({
2374
2390
  method: "delete",
2375
2391
  path: "/api/v1/canvas/{canvas_id}",
2376
2392
  operationId: "deleteCanvas",
2393
+ tags: ["public"],
2377
2394
  request: {
2378
2395
  headers: SupabaseHeaderSchema,
2379
2396
  params: z.object({
@@ -2408,6 +2425,7 @@ var GetCanvasForFlow = createRoute({
2408
2425
  method: "get",
2409
2426
  path: "/api/v1/canvas/flow/{flow_id}",
2410
2427
  operationId: "getCanvasForFlow",
2428
+ tags: ["public"],
2411
2429
  request: {
2412
2430
  headers: SupabaseHeaderSchema,
2413
2431
  params: z.object({
@@ -2449,6 +2467,7 @@ var ChatMessages = createRoute({
2449
2467
  method: "get",
2450
2468
  path: "/api/v1/chat/{flowId}/messages",
2451
2469
  operationId: "retrieveChatMessages",
2470
+ tags: ["public"],
2452
2471
  request: {
2453
2472
  headers: SupabaseHeaderSchema,
2454
2473
  params: FlowIdParam
@@ -2759,7 +2778,6 @@ var BaseVisualizationSchema = z.object({
2759
2778
  flow_data_id: z.number(),
2760
2779
  created_at: z.string(),
2761
2780
  sql: z.string(),
2762
- bookmarked: z.boolean(),
2763
2781
  data_sample: z.array(z.record(z.string(), z.unknown())),
2764
2782
  is_sample: z.boolean(),
2765
2783
  data_summary: z.record(z.string(), z.unknown()),
@@ -2819,6 +2837,7 @@ createRoute({
2819
2837
  method: "get",
2820
2838
  path: "/api/v1/visualizations/{visualization_id}",
2821
2839
  operationId: "fetchVisualization",
2840
+ tags: ["public"],
2822
2841
  request: {
2823
2842
  headers: SupabaseHeaderSchema,
2824
2843
  params: z.object({ visualization_id: z.string().pipe(z.coerce.number()) }).openapi("VisualizationId", { type: "number" })
@@ -2864,6 +2883,7 @@ var ListVisualizationsForFlow = createRoute({
2864
2883
  method: "get",
2865
2884
  path: "/api/v1/flows/{flowId}/visualizations",
2866
2885
  operationId: "listVisualizationsForFlow",
2886
+ tags: ["public"],
2867
2887
  request: {
2868
2888
  headers: SupabaseHeaderSchema,
2869
2889
  params: FlowIdParam,
@@ -2919,7 +2939,7 @@ var MageMetricsChatTransport = class extends DefaultChatTransport {
2919
2939
  super({
2920
2940
  ...options,
2921
2941
  api: `${apiUrl}/api/v1/chat/${flowId}`,
2922
- prepareSendMessagesRequest({ messages, id: chatId }) {
2942
+ prepareSendMessagesRequest({ messages, id: chatId, body }) {
2923
2943
  const lastMessage = messages.at(-1);
2924
2944
  if (lastMessage && isToolResultMessage(lastMessage)) {
2925
2945
  lastMessage.metadata = {
@@ -2927,7 +2947,14 @@ var MageMetricsChatTransport = class extends DefaultChatTransport {
2927
2947
  isFrontendToolSubmission: true
2928
2948
  };
2929
2949
  }
2930
- return { body: { message: lastMessage, id: chatId } };
2950
+ const chatHints = body?.chatHints;
2951
+ return {
2952
+ body: {
2953
+ message: lastMessage,
2954
+ id: chatId,
2955
+ ...chatHints ? { chatHints } : {}
2956
+ }
2957
+ };
2931
2958
  }
2932
2959
  });
2933
2960
  }