@magemetrics/core 0.4.3 → 0.5.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
@@ -306,10 +306,6 @@ declare const inputSchema_2: z.ZodObject<{
306
306
  scatter: "scatter";
307
307
  pie: "pie";
308
308
  }>;
309
- columnConfiguration: z.ZodObject<{
310
- dimensionColumn: z.ZodString;
311
- valueColumns: z.ZodArray<z.ZodString>;
312
- }, z.core.$strip>;
313
309
  explanations: z.ZodString;
314
310
  }, z.core.$strip>;
315
311
 
@@ -468,6 +464,14 @@ export declare class MageMetricsClient {
468
464
  status: string | null;
469
465
  is_removed: boolean;
470
466
  }[]>;
467
+ getFlow: (flowId: string) => Promise<{
468
+ created_at: string;
469
+ id: string;
470
+ request: string;
471
+ title: string | null;
472
+ user_id: string | null;
473
+ application_id?: number | null;
474
+ }>;
471
475
  getRecentFlows: (params?: {
472
476
  limit?: number;
473
477
  }) => Promise<FrontendRecentFlows[]>;
@@ -476,21 +480,26 @@ export declare class MageMetricsClient {
476
480
  }>;
477
481
  canvas: {
478
482
  list: (query?: string) => Promise<{
479
- title: string | null;
480
483
  id: string;
481
- nodes: any[];
482
- edges: any[];
484
+ title: string | null;
483
485
  is_public: boolean;
484
- canvas_flows: {
485
- flow_id: string;
486
+ nodes: unknown[];
487
+ edges: unknown[];
488
+ flows: {
489
+ created_at: string;
490
+ id: string;
491
+ request: string;
492
+ title: string | null;
493
+ user_id: string | null;
494
+ application_id?: number | null;
486
495
  }[];
487
496
  }[]>;
488
497
  get: (canvasId: string) => Promise<{
489
- title: string | null;
490
498
  id: string;
491
- nodes: any[];
492
- edges: any[];
499
+ title: string | null;
493
500
  is_public: boolean;
501
+ nodes: unknown[];
502
+ edges: unknown[];
494
503
  }>;
495
504
  create: (body: CreateCanvas) => Promise<{
496
505
  id: string;
@@ -517,6 +526,10 @@ export declare class MageMetricsClient {
517
526
  fetchReportData: (reportId: number, { columns, limit, sorting, filters, cursor }: ReportDataFilters, signal?: AbortSignal) => Promise<{
518
527
  [key: string]: unknown;
519
528
  }[]>;
529
+ createSpeechToken: () => Promise<{
530
+ token: string;
531
+ expiresAt: string;
532
+ }>;
520
533
  getReport: (reportId: number) => Promise<{
521
534
  columns: {
522
535
  name: string;
@@ -1046,8 +1059,6 @@ declare interface operations {
1046
1059
  title: string | null;
1047
1060
  user_id: string | null;
1048
1061
  application_id?: number | null;
1049
- user_friendly_goal?: string;
1050
- has_chat_messages: boolean;
1051
1062
  };
1052
1063
  };
1053
1064
  };
@@ -1937,6 +1948,47 @@ declare interface operations {
1937
1948
  };
1938
1949
  };
1939
1950
  };
1951
+ createSpeechToken: {
1952
+ parameters: {
1953
+ query?: never;
1954
+ header: {
1955
+ "sp-access-token": string;
1956
+ };
1957
+ path?: never;
1958
+ cookie?: never;
1959
+ };
1960
+ requestBody?: never;
1961
+ responses: {
1962
+ /** @description A short-lived token that can be used to stream audio. */
1963
+ 200: {
1964
+ headers: {
1965
+ [name: string]: unknown;
1966
+ };
1967
+ content: {
1968
+ "application/json": {
1969
+ /** @description Temporary AssemblyAI streaming token */
1970
+ token: string;
1971
+ /**
1972
+ * Format: date-time
1973
+ * @description ISO timestamp describing when the token expires.
1974
+ */
1975
+ expiresAt: string;
1976
+ };
1977
+ };
1978
+ };
1979
+ /** @description Failed to create a speech token */
1980
+ 500: {
1981
+ headers: {
1982
+ [name: string]: unknown;
1983
+ };
1984
+ content: {
1985
+ "application/json": {
1986
+ error: string;
1987
+ };
1988
+ };
1989
+ };
1990
+ };
1991
+ };
1940
1992
  getStarterRecommendations: {
1941
1993
  parameters: {
1942
1994
  query?: {
@@ -2455,8 +2507,13 @@ declare interface operations {
2455
2507
  is_public: boolean;
2456
2508
  nodes: unknown[];
2457
2509
  edges: unknown[];
2458
- canvas_flows: {
2459
- flow_id: string;
2510
+ flows: {
2511
+ created_at: string;
2512
+ id: string;
2513
+ request: string;
2514
+ title: string | null;
2515
+ user_id: string | null;
2516
+ application_id?: number | null;
2460
2517
  }[];
2461
2518
  }[];
2462
2519
  };
@@ -3520,6 +3577,22 @@ declare interface paths {
3520
3577
  patch?: never;
3521
3578
  trace?: never;
3522
3579
  };
3580
+ "/api/v1/speech/token": {
3581
+ parameters: {
3582
+ query?: never;
3583
+ header?: never;
3584
+ path?: never;
3585
+ cookie?: never;
3586
+ };
3587
+ get?: never;
3588
+ put?: never;
3589
+ post: operations["createSpeechToken"];
3590
+ delete?: never;
3591
+ options?: never;
3592
+ head?: never;
3593
+ patch?: never;
3594
+ trace?: never;
3595
+ };
3523
3596
  "/api/v1/recommendations": {
3524
3597
  parameters: {
3525
3598
  query?: never;
package/dist/index.js CHANGED
@@ -591,9 +591,6 @@ z.object({
591
591
  var FrontendFlowSchema = DatabaseFlowSchema.omit({
592
592
  flow_chat_messages: true,
593
593
  flow_steps: true
594
- }).extend({
595
- user_friendly_goal: z.string().optional(),
596
- has_chat_messages: z.boolean()
597
594
  });
598
595
  var FrontendRecentFlowsSchema = DatabaseFlowSchema.omit({
599
596
  flow_steps: true,
@@ -1163,7 +1160,7 @@ createRoute({
1163
1160
  }
1164
1161
  }
1165
1162
  });
1166
- createRoute({
1163
+ var RetrieveFlow = createRoute({
1167
1164
  method: "get",
1168
1165
  path: "/api/v1/flows/{flowId}",
1169
1166
  operationId: "retrieveFlow",
@@ -2332,6 +2329,40 @@ var ExchangeExternalToken = createRoute({
2332
2329
  }
2333
2330
  });
2334
2331
 
2332
+ // ../shared/dist/src/endpoints/companion/speech.routes.js
2333
+ var SpeechTokenResponseSchema = z.object({
2334
+ token: z.string().describe("Temporary AssemblyAI streaming token"),
2335
+ expiresAt: z.string().datetime().describe("ISO timestamp describing when the token expires.")
2336
+ });
2337
+ var CreateSpeechToken = createRoute({
2338
+ method: "post",
2339
+ path: "/api/v1/speech/token",
2340
+ operationId: "createSpeechToken",
2341
+ request: {
2342
+ headers: SupabaseHeaderSchema
2343
+ },
2344
+ responses: {
2345
+ 200: {
2346
+ description: "A short-lived token that can be used to stream audio.",
2347
+ content: {
2348
+ "application/json": {
2349
+ schema: SpeechTokenResponseSchema
2350
+ }
2351
+ }
2352
+ },
2353
+ 500: {
2354
+ description: "Failed to create a speech token",
2355
+ content: {
2356
+ "application/json": {
2357
+ schema: z.object({
2358
+ error: z.string()
2359
+ })
2360
+ }
2361
+ }
2362
+ }
2363
+ }
2364
+ });
2365
+
2335
2366
  // ../shared/dist/src/endpoints/end2end/run.routes.js
2336
2367
  var End2EndApiResponseSchema = z.discriminatedUnion("status", [
2337
2368
  z.object({
@@ -2589,9 +2620,7 @@ var ListCanvases = createRoute({
2589
2620
  content: {
2590
2621
  "application/json": {
2591
2622
  schema: z.array(FrontendCanvasSchema.extend({
2592
- canvas_flows: z.object({
2593
- flow_id: z.string()
2594
- }).array()
2623
+ flows: FrontendFlowSchema.array()
2595
2624
  }))
2596
2625
  }
2597
2626
  }
@@ -3121,7 +3150,7 @@ var toSearchParams = ({ cursor, filters, sorting, limit }) => {
3121
3150
 
3122
3151
  // package.json
3123
3152
  var package_default = {
3124
- version: "0.4.3"};
3153
+ version: "0.5.1"};
3125
3154
  var MageMetricsChatTransport = class extends DefaultChatTransport {
3126
3155
  constructor(apiUrl, flowId, options) {
3127
3156
  super({
@@ -3338,6 +3367,22 @@ var MageMetricsClient = class {
3338
3367
  }
3339
3368
  return data;
3340
3369
  },
3370
+ getFlow: async (flowId) => {
3371
+ await this.waitForAuth();
3372
+ const { data, error, response } = await this.internalApiClient.GET(
3373
+ RetrieveFlow.path,
3374
+ { params: { path: { flowId } } }
3375
+ );
3376
+ if (error) {
3377
+ throw new ApiError(error.error, response, {
3378
+ status: response.status,
3379
+ statusText: response.statusText,
3380
+ url: response.url,
3381
+ method: "GET"
3382
+ });
3383
+ }
3384
+ return data;
3385
+ },
3341
3386
  getRecentFlows: async (params = {}) => {
3342
3387
  await this.waitForAuth();
3343
3388
  const { data, error, response } = await this.internalApiClient.GET(
@@ -3428,11 +3473,7 @@ var MageMetricsClient = class {
3428
3473
  method: "GET"
3429
3474
  });
3430
3475
  }
3431
- return FrontendCanvasSchema.extend({
3432
- canvas_flows: z.object({
3433
- flow_id: z.string()
3434
- }).array()
3435
- }).array().parse(data);
3476
+ return data;
3436
3477
  },
3437
3478
  get: async (canvasId) => {
3438
3479
  await this.waitForAuth();
@@ -3454,7 +3495,7 @@ var MageMetricsClient = class {
3454
3495
  method: "GET"
3455
3496
  });
3456
3497
  }
3457
- return FrontendCanvasSchema.parse(data);
3498
+ return data;
3458
3499
  },
3459
3500
  create: async (body) => {
3460
3501
  await this.waitForAuth();
@@ -3645,6 +3686,22 @@ var MageMetricsClient = class {
3645
3686
  }
3646
3687
  return data;
3647
3688
  },
3689
+ createSpeechToken: async () => {
3690
+ await this.waitForAuth();
3691
+ const { data, error, response } = await this.internalApiClient.POST(
3692
+ CreateSpeechToken.path,
3693
+ {}
3694
+ );
3695
+ if (error) {
3696
+ throw new ApiError(error.error, response, {
3697
+ status: response.status,
3698
+ statusText: response.statusText,
3699
+ url: response.url,
3700
+ method: "POST"
3701
+ });
3702
+ }
3703
+ return data;
3704
+ },
3648
3705
  getReport: async (reportId) => {
3649
3706
  const params = { params: { path: { report_id: String(reportId) } } };
3650
3707
  const columnsPromise = this.internalApiClient.GET(