@dev-fastn-ai/react-core 1.0.20 → 2.0.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.
@@ -1,3 +1,4 @@
1
+ import { ConnectorActionResult } from "../types";
1
2
  /**
2
3
  * Input for activating a connector, including dependency, auth method, and form data.
3
4
  */
@@ -17,10 +18,7 @@ export declare const activateConnector: ({ connectorId, action, dependencyConnec
17
18
  dependencyConnector: any;
18
19
  authMethod: any;
19
20
  input?: any;
20
- }) => Promise<{
21
- data: any;
22
- status: string;
23
- }>;
21
+ }) => Promise<ConnectorActionResult>;
24
22
  /**
25
23
  * Framework-agnostic deactivateConnector utility.
26
24
  * @param args - Deactivation arguments (connectorId, action, deactivateConnectorFn, executeActionHandlerFn, config)
@@ -13,7 +13,7 @@ export declare function refreshOptions(pagination: SelectOptionsResultPagination
13
13
  /**
14
14
  * Gets options for a select field.
15
15
  */
16
- export declare function getOptions(pagination: SelectOptionsResultPagination, context?: FormData): Promise<OptionsResult>;
16
+ export declare function getOptions(pagination: SelectOptionsResultPagination, context?: FormData, query?: string): Promise<OptionsResult>;
17
17
  /**
18
18
  * Searches options for a select field.
19
19
  */
@@ -1,4 +1,4 @@
1
- export * from './config';
1
+ export * from "./config";
2
2
  /**
3
3
  * Represents a standardized error for Fastn operations.
4
4
  */
@@ -8,7 +8,7 @@ export interface FastnError extends Error {
8
8
  /** Optional HTTP status code. */
9
9
  statusCode?: number;
10
10
  /** Additional error details. */
11
- details?: unknown;
11
+ details?: Record<string, Primitive> | Record<string, Primitive>[];
12
12
  }
13
13
  /**
14
14
  * Supported field types for connector forms.
@@ -119,7 +119,7 @@ export interface Configuration {
119
119
  readonly imageUri: string;
120
120
  readonly status: string;
121
121
  readonly actions: readonly ConfigurationAction[];
122
- readonly metadata?: unknown;
122
+ readonly metadata?: Record<string, Record<string, Primitive> | Record<string, Primitive>[] | undefined | null> | Record<string, Record<string, Primitive> | Record<string, Primitive>[] | undefined | null>[] | undefined | null;
123
123
  }
124
124
  export type Event = "REFETCH_CONNECTORS" | "REFETCH_CONFIGURATIONS" | "REFRESH_CONFIGURATION_FORM" | "INVALIDATE_CONFIGURATION_FORM" | "INVALIDATE_CONFIGURATIONS" | "INVALIDATE_CONNECTORS";
125
125
  /**
@@ -130,7 +130,7 @@ export interface ConfigurationAction {
130
130
  readonly actionType: ConfigurationActionType;
131
131
  readonly onClick?: () => Promise<ConnectorActionResult>;
132
132
  readonly form?: ConnectorForm | null;
133
- readonly onSubmit?: (formData: unknown) => Promise<ConnectorActionResult>;
133
+ readonly onSubmit?: (formData: Record<string, Primitive>) => Promise<ConnectorActionResult>;
134
134
  }
135
135
  /**
136
136
  * Represents a selectable option in a dropdown or select field.
@@ -146,6 +146,7 @@ export interface SelectOptionsResultPagination {
146
146
  readonly sourceId: string;
147
147
  readonly sourceProject: string;
148
148
  readonly limit?: number;
149
+ readonly query?: string;
149
150
  readonly offset?: number;
150
151
  readonly cursor?: string;
151
152
  readonly type: "OFFSET" | "CURSOR";
@@ -156,11 +157,11 @@ export interface SelectOptionsResultPagination {
156
157
  /**
157
158
  * Primitive types allowed in form data.
158
159
  */
159
- type Primitive = string | number | boolean | null | undefined;
160
+ export type Primitive = string | number | boolean | null | undefined;
160
161
  /**
161
162
  * Represents form data as a record of values.
162
163
  */
163
- export type FormData = Record<string, Primitive | Primitive[] | Record<string, Primitive> | Record<string, Primitive>[]>;
164
+ export type FormData = Record<string, Record<string, Primitive> | Record<string, Primitive>[] | undefined | null> | Record<string, Record<string, Primitive> | Record<string, Primitive>[] | undefined | null>[] | undefined | null;
164
165
  /**
165
166
  * Result of loading options for a select field.
166
167
  */
@@ -177,7 +178,7 @@ export interface SelectOptionSource {
177
178
  readonly staticOptions?: readonly SelectOption[];
178
179
  readonly pagination?: SelectOptionsResultPagination;
179
180
  readonly searchOptions?: (query: string, pagination: SelectOptionsResultPagination, context?: FormData) => Promise<OptionsResult>;
180
- readonly getOptions?: (pagination: SelectOptionsResultPagination, context?: FormData) => Promise<OptionsResult>;
181
+ readonly getOptions?: (pagination: SelectOptionsResultPagination, context?: FormData, query?: string) => Promise<OptionsResult>;
181
182
  readonly loadMore?: (pagination: SelectOptionsResultPagination, context?: FormData) => Promise<OptionsResult>;
182
183
  readonly refresh?: (pagination: SelectOptionsResultPagination, context?: FormData) => Promise<OptionsResult>;
183
184
  }
@@ -211,8 +212,8 @@ export interface ConnectorForm {
211
212
  readonly submitButtonLabel?: string;
212
213
  }
213
214
  export interface ConnectorActionResult {
214
- readonly data: unknown;
215
- readonly status: "SUCCESS" | "ERROR";
215
+ readonly data?: Record<string, Primitive> | Record<string, Primitive>[] | undefined | null | null;
216
+ readonly status: "SUCCESS" | "ERROR" | "CANCELLED";
216
217
  }
217
218
  /**
218
219
  * Represents an action available on a connector.
@@ -221,8 +222,8 @@ export interface ConnectorAction {
221
222
  readonly name: string;
222
223
  readonly actionType: ConnectorActionType | string;
223
224
  readonly form?: ConnectorForm | null;
224
- readonly onClick?: (data?: unknown) => Promise<ConnectorActionResult>;
225
- readonly onSubmit?: (formData: Record<string, unknown>) => Promise<ConnectorActionResult>;
225
+ readonly onClick?: () => Promise<ConnectorActionResult>;
226
+ readonly onSubmit?: (formData: Record<string, Primitive>) => Promise<ConnectorActionResult>;
226
227
  }
227
228
  /**
228
229
  * Represents a connector (integration) instance.
@@ -1,9 +1,9 @@
1
- import type { FastnError as FastnErrorType } from '../types';
1
+ import type { FastnError as FastnErrorType, Primitive } from '../types';
2
2
  export declare class FastnError extends Error implements FastnErrorType {
3
3
  code: string;
4
4
  statusCode?: number;
5
- details?: any;
6
- constructor(message: string, code: string, statusCode?: number, details?: any);
5
+ details?: Record<string, Primitive> | Record<string, Primitive>[];
6
+ constructor(message: string, code: string, statusCode?: number, details?: Record<string, Primitive> | Record<string, Primitive>[]);
7
7
  }
8
8
  export declare class MissingConfigError extends FastnError {
9
9
  constructor(message?: string, details?: any);