@magemetrics/ai 0.0.54-RC5 → 0.0.54-RC7

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.
@@ -8,6 +8,7 @@ import { JSX } from 'react/jsx-runtime';
8
8
  import { objectOutputType } from 'zod';
9
9
  import { PropsWithChildren } from 'react';
10
10
  import { RefAttributes } from 'react';
11
+ import type { Simplify } from 'type-fest';
11
12
  import { UseMutateAsyncFunction } from '@tanstack/react-query';
12
13
  import { UseMutateFunction } from '@tanstack/react-query';
13
14
  import { UseMutationOptions } from '@tanstack/react-query';
@@ -37,7 +38,7 @@ declare const Chat_2: default_2.MemoExoticComponent<({ flowId, className }: {
37
38
 
38
39
  export declare const ChatInput: React.FC<React.ComponentProps<typeof ChatInput_2>>;
39
40
 
40
- declare const ChatInput_2: default_2.FC<{
41
+ declare const ChatInput_2: React.FC<{
41
42
  flowId: string;
42
43
  }>;
43
44
 
@@ -50,7 +51,6 @@ export declare const ChatMessages: React.FC<React.ComponentProps<typeof ChatMess
50
51
 
51
52
  declare const ChatMessages_2: default_2.FC<{
52
53
  flowId: string;
53
- onWaitingMessagesCursorChange?: (value: number) => void;
54
54
  }>;
55
55
 
56
56
  export declare interface Components {
@@ -815,7 +815,15 @@ export declare class MageMetricsClient extends EventTarget {
815
815
  data_reports: number;
816
816
  visualizations: number;
817
817
  }>;
818
+ /**
819
+ * @deprecated Use `createFlow` instead.
820
+ * @param request the user request
821
+ * @returns the id of the created flow
822
+ */
818
823
  startFlow: (request: StartFlowParam) => Promise<string>;
824
+ createFlow: (request: StartFlowParam) => Promise<{
825
+ flowId: string;
826
+ }>;
819
827
  getDashboard: (dashboardId: string) => Promise<{
820
828
  description: string | null;
821
829
  id: string;
@@ -873,15 +881,13 @@ export declare interface MageMetricsClientConfig {
873
881
  apiUrl: string;
874
882
  apiKey: string;
875
883
  externalJwt?: string;
884
+ additionalHeaders?: Record<string, string>;
876
885
  }
877
886
 
878
887
  export declare const MageMetricsContextProvider: default_2.FC<MageMetricsContextProviderProps>;
879
888
 
880
- export declare interface MageMetricsContextProviderProps {
889
+ export declare interface MageMetricsContextProviderProps extends MageMetricsClientConfig {
881
890
  children: default_2.ReactNode;
882
- apiKey: string;
883
- externalJwt?: string;
884
- apiUrl: string;
885
891
  experimental_components?: Components;
886
892
  }
887
893
 
@@ -2067,6 +2073,50 @@ declare interface operations {
2067
2073
  };
2068
2074
  };
2069
2075
  };
2076
+ createFlow: {
2077
+ parameters: {
2078
+ query?: never;
2079
+ header: {
2080
+ "sp-access-token": string;
2081
+ "sp-refresh-token"?: string;
2082
+ };
2083
+ path?: never;
2084
+ cookie?: never;
2085
+ };
2086
+ requestBody: {
2087
+ content: {
2088
+ "application/json": {
2089
+ userQuery: string;
2090
+ };
2091
+ };
2092
+ };
2093
+ responses: {
2094
+ /** @description Create a new flow */
2095
+ 200: {
2096
+ headers: {
2097
+ [name: string]: unknown;
2098
+ };
2099
+ content: {
2100
+ "application/json": {
2101
+ /** @enum {string} */
2102
+ status: "success";
2103
+ flowId: string;
2104
+ };
2105
+ };
2106
+ };
2107
+ /** @description Something wrong happened */
2108
+ 500: {
2109
+ headers: {
2110
+ [name: string]: unknown;
2111
+ };
2112
+ content: {
2113
+ "application/json": {
2114
+ error: string;
2115
+ };
2116
+ };
2117
+ };
2118
+ };
2119
+ };
2070
2120
  retrieveChatTimeline: {
2071
2121
  parameters: {
2072
2122
  query?: never;
@@ -3077,6 +3127,22 @@ declare interface paths {
3077
3127
  patch?: never;
3078
3128
  trace?: never;
3079
3129
  };
3130
+ "/api/v1/flows": {
3131
+ parameters: {
3132
+ query?: never;
3133
+ header?: never;
3134
+ path?: never;
3135
+ cookie?: never;
3136
+ };
3137
+ get?: never;
3138
+ put?: never;
3139
+ post: operations["createFlow"];
3140
+ delete?: never;
3141
+ options?: never;
3142
+ head?: never;
3143
+ patch?: never;
3144
+ trace?: never;
3145
+ };
3080
3146
  "/api/v1/chat/{flowId}/timeline": {
3081
3147
  parameters: {
3082
3148
  query?: never;
@@ -3361,10 +3427,6 @@ declare type RemoveParamsConfig = Simplify<{
3361
3427
  cookie?: string;
3362
3428
  }>;
3363
3429
 
3364
- declare type Simplify<T> = {
3365
- [KeyType in keyof T]: T[KeyType];
3366
- } & {};
3367
-
3368
3430
  export declare const StandaloneConversationModal: React.FC<StandaloneConversationModalProps>;
3369
3431
 
3370
3432
  declare type StandaloneConversationModalProps = {
@@ -3390,6 +3452,120 @@ declare type ToRemove = Simplify<{
3390
3452
  header: "sp-access-token" | "sp-refresh-token";
3391
3453
  }>;
3392
3454
 
3455
+ export declare const useCreateFlow: (options?: UseMutationOptions<{
3456
+ flowId: string;
3457
+ }, Error, StartFlowParam>) => {
3458
+ createFlow: UseMutateFunction< {
3459
+ flowId: string;
3460
+ }, Error, StartFlowParam, unknown>;
3461
+ createFlowAsync: UseMutateAsyncFunction< {
3462
+ flowId: string;
3463
+ }, Error, StartFlowParam, unknown>;
3464
+ data: undefined;
3465
+ variables: undefined;
3466
+ error: null;
3467
+ isError: false;
3468
+ isIdle: true;
3469
+ isPending: false;
3470
+ isSuccess: false;
3471
+ status: "idle";
3472
+ mutate: UseMutateFunction< {
3473
+ flowId: string;
3474
+ }, Error, StartFlowParam, unknown>;
3475
+ reset: () => void;
3476
+ context: unknown;
3477
+ failureCount: number;
3478
+ failureReason: Error | null;
3479
+ isPaused: boolean;
3480
+ submittedAt: number;
3481
+ mutateAsync: UseMutateAsyncFunction< {
3482
+ flowId: string;
3483
+ }, Error, StartFlowParam, unknown>;
3484
+ } | {
3485
+ createFlow: UseMutateFunction< {
3486
+ flowId: string;
3487
+ }, Error, StartFlowParam, unknown>;
3488
+ createFlowAsync: UseMutateAsyncFunction< {
3489
+ flowId: string;
3490
+ }, Error, StartFlowParam, unknown>;
3491
+ data: undefined;
3492
+ variables: StartFlowParam;
3493
+ error: null;
3494
+ isError: false;
3495
+ isIdle: false;
3496
+ isPending: true;
3497
+ isSuccess: false;
3498
+ status: "pending";
3499
+ mutate: UseMutateFunction< {
3500
+ flowId: string;
3501
+ }, Error, StartFlowParam, unknown>;
3502
+ reset: () => void;
3503
+ context: unknown;
3504
+ failureCount: number;
3505
+ failureReason: Error | null;
3506
+ isPaused: boolean;
3507
+ submittedAt: number;
3508
+ mutateAsync: UseMutateAsyncFunction< {
3509
+ flowId: string;
3510
+ }, Error, StartFlowParam, unknown>;
3511
+ } | {
3512
+ createFlow: UseMutateFunction< {
3513
+ flowId: string;
3514
+ }, Error, StartFlowParam, unknown>;
3515
+ createFlowAsync: UseMutateAsyncFunction< {
3516
+ flowId: string;
3517
+ }, Error, StartFlowParam, unknown>;
3518
+ data: undefined;
3519
+ error: Error;
3520
+ variables: StartFlowParam;
3521
+ isError: true;
3522
+ isIdle: false;
3523
+ isPending: false;
3524
+ isSuccess: false;
3525
+ status: "error";
3526
+ mutate: UseMutateFunction< {
3527
+ flowId: string;
3528
+ }, Error, StartFlowParam, unknown>;
3529
+ reset: () => void;
3530
+ context: unknown;
3531
+ failureCount: number;
3532
+ failureReason: Error | null;
3533
+ isPaused: boolean;
3534
+ submittedAt: number;
3535
+ mutateAsync: UseMutateAsyncFunction< {
3536
+ flowId: string;
3537
+ }, Error, StartFlowParam, unknown>;
3538
+ } | {
3539
+ createFlow: UseMutateFunction< {
3540
+ flowId: string;
3541
+ }, Error, StartFlowParam, unknown>;
3542
+ createFlowAsync: UseMutateAsyncFunction< {
3543
+ flowId: string;
3544
+ }, Error, StartFlowParam, unknown>;
3545
+ data: {
3546
+ flowId: string;
3547
+ };
3548
+ error: null;
3549
+ variables: StartFlowParam;
3550
+ isError: false;
3551
+ isIdle: false;
3552
+ isPending: false;
3553
+ isSuccess: true;
3554
+ status: "success";
3555
+ mutate: UseMutateFunction< {
3556
+ flowId: string;
3557
+ }, Error, StartFlowParam, unknown>;
3558
+ reset: () => void;
3559
+ context: unknown;
3560
+ failureCount: number;
3561
+ failureReason: Error | null;
3562
+ isPaused: boolean;
3563
+ submittedAt: number;
3564
+ mutateAsync: UseMutateAsyncFunction< {
3565
+ flowId: string;
3566
+ }, Error, StartFlowParam, unknown>;
3567
+ };
3568
+
3393
3569
  export declare const useDataReport: (flowDataId: FrontendReport["id"]) => {
3394
3570
  dataColumns: {
3395
3571
  name: string;
@@ -3603,6 +3779,12 @@ request: string;
3603
3779
  user_id: string | null;
3604
3780
  }[], Error>;
3605
3781
 
3782
+ /**
3783
+ * Create a new flow with the given user query.
3784
+ * @deprecated Use `useCreateFlow` instead.
3785
+ * @param options tanstack query options to create the flow
3786
+ * @returns a mutation
3787
+ */
3606
3788
  export declare const useStartFlow: (options?: UseMutationOptions<string, Error, StartFlowParam>) => {
3607
3789
  startFlow: UseMutateFunction<string, Error, StartFlowParam, unknown>;
3608
3790
  startFlowAsync: UseMutateAsyncFunction<string, Error, StartFlowParam, unknown>;