@vaiftechnologies/vaif-client 0.1.2 → 0.2.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.cts CHANGED
@@ -1,3 +1,93 @@
1
+ /**
2
+ * Retry configuration for automatic request retries
3
+ */
4
+ interface RetryConfig {
5
+ /** Maximum number of retry attempts (default: 3) */
6
+ maxRetries?: number;
7
+ /** Initial delay between retries in ms (default: 1000) */
8
+ retryDelay?: number;
9
+ /** Maximum delay between retries in ms (default: 30000) */
10
+ maxRetryDelay?: number;
11
+ /** Backoff multiplier (default: 2) */
12
+ backoffMultiplier?: number;
13
+ /** HTTP status codes to retry on (default: [429, 500, 502, 503, 504]) */
14
+ retryOn?: number[];
15
+ /** Retry on network errors (default: true) */
16
+ retryOnNetworkError?: boolean;
17
+ }
18
+ /**
19
+ * Fully resolved retry configuration with defaults applied
20
+ */
21
+ interface ResolvedRetryConfig {
22
+ maxRetries: number;
23
+ retryDelay: number;
24
+ maxRetryDelay: number;
25
+ backoffMultiplier: number;
26
+ retryOn: number[];
27
+ retryOnNetworkError: boolean;
28
+ }
29
+ /**
30
+ * Context passed to request interceptors
31
+ */
32
+ interface RequestContext {
33
+ /** Full URL being requested */
34
+ url: string;
35
+ /** API path (without base URL) */
36
+ path: string;
37
+ /** HTTP method */
38
+ method: string;
39
+ /** Request headers */
40
+ headers: Record<string, string>;
41
+ /** Request body (if any) */
42
+ body?: string;
43
+ /** Current retry attempt (0-based) */
44
+ attempt: number;
45
+ }
46
+ /**
47
+ * Context passed to response interceptors
48
+ */
49
+ interface ResponseContext<T = unknown> {
50
+ /** Original request context */
51
+ request: RequestContext;
52
+ /** Parsed response data */
53
+ data: T;
54
+ /** HTTP status code */
55
+ status: number;
56
+ /** Response headers */
57
+ headers: Record<string, string>;
58
+ /** Request duration in milliseconds */
59
+ durationMs: number;
60
+ }
61
+ /**
62
+ * Context passed to error interceptors
63
+ */
64
+ interface ErrorContext {
65
+ /** Original request context */
66
+ request: RequestContext;
67
+ /** The error that occurred */
68
+ error: Error;
69
+ /** Request duration in milliseconds */
70
+ durationMs: number;
71
+ /** Whether the request will be retried */
72
+ willRetry: boolean;
73
+ }
74
+ /** Intercept and optionally modify outgoing requests */
75
+ type RequestInterceptor = (context: RequestContext) => RequestContext | void | Promise<RequestContext | void>;
76
+ /** Observe successful responses */
77
+ type ResponseInterceptor = (context: ResponseContext) => void | Promise<void>;
78
+ /** Observe request errors */
79
+ type ErrorInterceptor = (context: ErrorContext) => void | Promise<void>;
80
+ /**
81
+ * Interceptor configuration for request/response observation
82
+ */
83
+ interface InterceptorConfig {
84
+ /** Called before each request. Can modify the request context. */
85
+ onRequest?: RequestInterceptor;
86
+ /** Called after each successful response. */
87
+ onResponse?: ResponseInterceptor;
88
+ /** Called on request errors. */
89
+ onError?: ErrorInterceptor;
90
+ }
1
91
  /**
2
92
  * Configuration options for creating a VAIF client
3
93
  */
@@ -54,6 +144,14 @@ interface VaifClientOptions {
54
144
  * Custom storage implementation for session persistence
55
145
  */
56
146
  storage?: StorageAdapter;
147
+ /**
148
+ * Retry configuration for automatic request retries with exponential backoff
149
+ */
150
+ retry?: RetryConfig;
151
+ /**
152
+ * Request/response interceptors for observability and modification
153
+ */
154
+ interceptors?: InterceptorConfig;
57
155
  }
58
156
  /**
59
157
  * Internal configuration after processing options
@@ -70,6 +168,8 @@ interface VaifConfig {
70
168
  autoRefreshToken: boolean;
71
169
  persistSession: boolean;
72
170
  storage: StorageAdapter;
171
+ retry: ResolvedRetryConfig;
172
+ interceptors: InterceptorConfig;
73
173
  }
74
174
  /**
75
175
  * Storage adapter interface for session persistence
@@ -154,6 +254,56 @@ interface ApiError {
154
254
  */
155
255
  requestId?: string;
156
256
  }
257
+ /**
258
+ * Pagination parameters
259
+ */
260
+ interface PaginationParams {
261
+ /**
262
+ * Page number (1-indexed)
263
+ */
264
+ page?: number;
265
+ /**
266
+ * Items per page
267
+ */
268
+ limit?: number;
269
+ /**
270
+ * Offset for cursor-based pagination
271
+ */
272
+ offset?: number;
273
+ /**
274
+ * Cursor for cursor-based pagination
275
+ */
276
+ cursor?: string;
277
+ }
278
+ /**
279
+ * Paginated response
280
+ */
281
+ interface PaginatedResponse<T> {
282
+ /**
283
+ * Array of items
284
+ */
285
+ data: T[];
286
+ /**
287
+ * Total count of items
288
+ */
289
+ total: number;
290
+ /**
291
+ * Current page number
292
+ */
293
+ page: number;
294
+ /**
295
+ * Items per page
296
+ */
297
+ limit: number;
298
+ /**
299
+ * Whether there are more items
300
+ */
301
+ hasMore: boolean;
302
+ /**
303
+ * Next page cursor (if using cursor pagination)
304
+ */
305
+ nextCursor?: string;
306
+ }
157
307
 
158
308
  /**
159
309
  * Database query types for VAIF Studio
@@ -414,15 +564,60 @@ interface QueryError {
414
564
  */
415
565
  hint?: string;
416
566
  }
567
+ /**
568
+ * Transaction options
569
+ */
570
+ interface TransactionOptions {
571
+ /**
572
+ * Isolation level
573
+ */
574
+ isolationLevel?: 'ReadCommitted' | 'RepeatableRead' | 'Serializable';
575
+ }
576
+ /**
577
+ * Transaction interface
578
+ */
579
+ interface Transaction {
580
+ /**
581
+ * Execute query within transaction
582
+ */
583
+ from<T = Record<string, unknown>>(table: string): SelectQuery<T>;
584
+ /**
585
+ * Commit transaction
586
+ */
587
+ commit(): Promise<void>;
588
+ /**
589
+ * Rollback transaction
590
+ */
591
+ rollback(): Promise<void>;
592
+ }
417
593
 
418
594
  /**
419
595
  * VAIF Database Client
420
596
  *
421
- * Provides type-safe database operations with a fluent query builder
597
+ * Provides type-safe database operations with a fluent query builder.
598
+ * Supports SELECT, INSERT, UPDATE, DELETE, upsert, raw SQL, and stored procedures.
422
599
  */
423
600
 
424
601
  /**
425
602
  * Database client for VAIF Studio
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * // Query with fluent builder
607
+ * const result = await vaif.db.from('users')
608
+ * .select('id, name, email')
609
+ * .eq('active', true)
610
+ * .order('created_at', { ascending: false })
611
+ * .limit(10)
612
+ * .execute();
613
+ *
614
+ * // Insert with upsert
615
+ * const upserted = await vaif.db.from('users')
616
+ * .insert({ email: 'user@example.com', name: 'User' })
617
+ * .onConflict('email')
618
+ * .doUpdate({ name: 'Updated User' })
619
+ * .execute();
620
+ * ```
426
621
  */
427
622
  declare class VaifDatabase {
428
623
  private client;
@@ -430,6 +625,9 @@ declare class VaifDatabase {
430
625
  /**
431
626
  * Start a query on a table
432
627
  *
628
+ * @param table - Table name to query
629
+ * @returns A query builder for chaining operations
630
+ *
433
631
  * @example
434
632
  * ```typescript
435
633
  * const users = await vaif.db.from('users').select('*').execute();
@@ -439,6 +637,10 @@ declare class VaifDatabase {
439
637
  /**
440
638
  * Execute raw SQL query (admin only)
441
639
  *
640
+ * @param sql - SQL query string with $1, $2, etc. parameter placeholders
641
+ * @param params - Parameter values for the query
642
+ * @returns Query result with typed rows
643
+ *
442
644
  * @example
443
645
  * ```typescript
444
646
  * const result = await vaif.db.raw('SELECT * FROM users WHERE id = $1', [userId]);
@@ -446,7 +648,16 @@ declare class VaifDatabase {
446
648
  */
447
649
  raw<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T[]>>;
448
650
  /**
449
- * Execute a function (stored procedure)
651
+ * Execute a stored procedure (RPC call)
652
+ *
653
+ * @param functionName - Name of the database function to call
654
+ * @param params - Parameters to pass to the function
655
+ * @returns Query result with the function's return value
656
+ *
657
+ * @example
658
+ * ```typescript
659
+ * const result = await vaif.db.rpc('get_user_stats', { userId: '123' });
660
+ * ```
450
661
  */
451
662
  rpc<T = unknown>(functionName: string, params?: Record<string, unknown>): Promise<QueryResult<T>>;
452
663
  }
@@ -499,19 +710,33 @@ declare class QueryBuilder<T = Record<string, unknown>> {
499
710
  * Update on conflict
500
711
  */
501
712
  doUpdate(data: Partial<T>): this;
713
+ /** Filter by equality (column = value) */
502
714
  eq(column: keyof T | string, value: unknown): this;
715
+ /** Filter by inequality (column != value) */
503
716
  neq(column: keyof T | string, value: unknown): this;
717
+ /** Filter by greater than (column > value) */
504
718
  gt(column: keyof T | string, value: unknown): this;
719
+ /** Filter by greater than or equal (column >= value) */
505
720
  gte(column: keyof T | string, value: unknown): this;
721
+ /** Filter by less than (column < value) */
506
722
  lt(column: keyof T | string, value: unknown): this;
723
+ /** Filter by less than or equal (column <= value) */
507
724
  lte(column: keyof T | string, value: unknown): this;
725
+ /** Filter by pattern matching (case-sensitive LIKE) */
508
726
  like(column: keyof T | string, pattern: string): this;
727
+ /** Filter by pattern matching (case-insensitive ILIKE) */
509
728
  ilike(column: keyof T | string, pattern: string): this;
729
+ /** Filter by IS (null/boolean checks) */
510
730
  is(column: keyof T | string, value: null | boolean): this;
731
+ /** Filter by inclusion in an array of values */
511
732
  in(column: keyof T | string, values: unknown[]): this;
733
+ /** Filter by array containment (@>) */
512
734
  contains(column: keyof T | string, value: unknown[]): this;
735
+ /** Filter by array being contained by (<@) */
513
736
  containedBy(column: keyof T | string, value: unknown[]): this;
737
+ /** Filter by array overlap (&&) */
514
738
  overlaps(column: keyof T | string, value: unknown[]): this;
739
+ /** Full-text search filter */
515
740
  textSearch(column: keyof T | string, query: string, options?: {
516
741
  config?: string;
517
742
  }): this;
@@ -1766,6 +1991,35 @@ interface OAuthResponse {
1766
1991
  */
1767
1992
  url: string;
1768
1993
  }
1994
+ /**
1995
+ * MFA factor
1996
+ */
1997
+ interface MFAFactor {
1998
+ /**
1999
+ * Factor ID
2000
+ */
2001
+ id: string;
2002
+ /**
2003
+ * Factor type
2004
+ */
2005
+ factorType: 'totp' | 'phone';
2006
+ /**
2007
+ * Friendly name
2008
+ */
2009
+ friendlyName?: string;
2010
+ /**
2011
+ * Factor status
2012
+ */
2013
+ status: 'unverified' | 'verified';
2014
+ /**
2015
+ * Created timestamp
2016
+ */
2017
+ createdAt: string;
2018
+ /**
2019
+ * Updated timestamp
2020
+ */
2021
+ updatedAt: string;
2022
+ }
1769
2023
 
1770
2024
  /**
1771
2025
  * VAIF Auth Client
@@ -2293,6 +2547,142 @@ interface AICreditsInfo {
2293
2547
  */
2294
2548
  resetDate: string;
2295
2549
  }
2550
+ /**
2551
+ * Copilot metrics summary
2552
+ */
2553
+ interface CopilotMetricsSummary {
2554
+ /**
2555
+ * Total generation requests
2556
+ */
2557
+ totalRequests: number;
2558
+ /**
2559
+ * Successful requests
2560
+ */
2561
+ successfulRequests: number;
2562
+ /**
2563
+ * Failed requests
2564
+ */
2565
+ failedRequests: number;
2566
+ /**
2567
+ * Success rate percentage
2568
+ */
2569
+ successRate: number;
2570
+ /**
2571
+ * Total tokens used
2572
+ */
2573
+ totalTokens: number;
2574
+ /**
2575
+ * Total credits consumed
2576
+ */
2577
+ totalCredits: number;
2578
+ /**
2579
+ * Total unique sessions
2580
+ */
2581
+ totalSessions: number;
2582
+ /**
2583
+ * Batch completion rate percentage
2584
+ */
2585
+ batchCompletionRate: number;
2586
+ /**
2587
+ * Average files generated per session
2588
+ */
2589
+ avgFilesPerSession: number;
2590
+ }
2591
+ /**
2592
+ * Token trend data point
2593
+ */
2594
+ interface CopilotTokenTrend {
2595
+ /**
2596
+ * Timestamp (ISO string)
2597
+ */
2598
+ timestamp: string;
2599
+ /**
2600
+ * Input tokens used
2601
+ */
2602
+ inputTokens: number;
2603
+ /**
2604
+ * Output tokens used
2605
+ */
2606
+ outputTokens: number;
2607
+ /**
2608
+ * Total tokens
2609
+ */
2610
+ totalTokens: number;
2611
+ /**
2612
+ * Number of requests
2613
+ */
2614
+ requests: number;
2615
+ }
2616
+ /**
2617
+ * Copilot metrics response
2618
+ */
2619
+ interface CopilotMetrics {
2620
+ /**
2621
+ * Project ID
2622
+ */
2623
+ projectId: string;
2624
+ /**
2625
+ * Organization ID
2626
+ */
2627
+ orgId: string;
2628
+ /**
2629
+ * Time range used
2630
+ */
2631
+ range: string;
2632
+ /**
2633
+ * Start date (ISO string)
2634
+ */
2635
+ startDate: string;
2636
+ /**
2637
+ * End date (ISO string)
2638
+ */
2639
+ endDate: string;
2640
+ /**
2641
+ * Summary metrics
2642
+ */
2643
+ summary: CopilotMetricsSummary;
2644
+ /**
2645
+ * Average latency by model tier (ms)
2646
+ */
2647
+ avgLatencyByTier: Record<string, number>;
2648
+ /**
2649
+ * Token usage by model tier
2650
+ */
2651
+ tokensByTier: Record<string, {
2652
+ inputTokens: number;
2653
+ outputTokens: number;
2654
+ totalTokens: number;
2655
+ }>;
2656
+ /**
2657
+ * Credits consumed by generation type
2658
+ */
2659
+ creditsByType: Record<string, number>;
2660
+ /**
2661
+ * Request counts by type
2662
+ */
2663
+ requestTypeCount: Record<string, number>;
2664
+ /**
2665
+ * Counts by generation type (schema, functions, etc.)
2666
+ */
2667
+ generationTypeCount: Record<string, number>;
2668
+ /**
2669
+ * Error code frequencies
2670
+ */
2671
+ errorCodes: Record<string, number>;
2672
+ /**
2673
+ * Hourly token usage trends
2674
+ */
2675
+ tokenTrends: CopilotTokenTrend[];
2676
+ }
2677
+ /**
2678
+ * Copilot metrics request options
2679
+ */
2680
+ interface CopilotMetricsOptions {
2681
+ /**
2682
+ * Time range
2683
+ */
2684
+ range?: '1h' | '6h' | '24h' | '7d' | '30d';
2685
+ }
2296
2686
 
2297
2687
  /**
2298
2688
  * VAIF AI Client
@@ -2502,6 +2892,34 @@ declare class VaifAI {
2502
2892
  } | null;
2503
2893
  error: AIError | null;
2504
2894
  }>;
2895
+ /**
2896
+ * Get Copilot observability metrics for the current project
2897
+ *
2898
+ * @example
2899
+ * ```typescript
2900
+ * const { data, error } = await vaif.ai.getCopilotMetrics({ range: '24h' });
2901
+ * console.log(`Success rate: ${data.summary.successRate}%`);
2902
+ * console.log(`Total tokens: ${data.summary.totalTokens}`);
2903
+ * ```
2904
+ */
2905
+ getCopilotMetrics(options?: CopilotMetricsOptions): Promise<{
2906
+ data: CopilotMetrics | null;
2907
+ error: AIError | null;
2908
+ }>;
2909
+ /**
2910
+ * Get Copilot observability metrics for an organization
2911
+ *
2912
+ * @example
2913
+ * ```typescript
2914
+ * const { data, error } = await vaif.ai.getCopilotOrgMetrics(orgId, { range: '7d' });
2915
+ * console.log(`Total requests: ${data.summary.totalRequests}`);
2916
+ * console.log(`Projects: ${data.summary.uniqueProjects}`);
2917
+ * ```
2918
+ */
2919
+ getCopilotOrgMetrics(orgId: string, options?: CopilotMetricsOptions): Promise<{
2920
+ data: CopilotMetrics | null;
2921
+ error: AIError | null;
2922
+ }>;
2505
2923
  }
2506
2924
 
2507
2925
  /**
@@ -3574,10 +3992,118 @@ declare class VaifIntegrations {
3574
3992
  getFailedDeliveries(projectId: string, limit?: number): Promise<WebhookDelivery[]>;
3575
3993
  }
3576
3994
 
3995
+ /**
3996
+ * VAIF SDK Error Classes
3997
+ *
3998
+ * Typed error hierarchy for consistent error handling across the SDK.
3999
+ */
4000
+ /**
4001
+ * Base error class for all VAIF SDK errors
4002
+ */
4003
+ declare class VaifError extends Error {
4004
+ /** Error code for programmatic handling */
4005
+ readonly code: string;
4006
+ /** HTTP status code if applicable */
4007
+ readonly statusCode?: number;
4008
+ /** Request ID for support */
4009
+ readonly requestId?: string;
4010
+ /** Additional error details */
4011
+ readonly details?: unknown;
4012
+ constructor(message: string, options: {
4013
+ code: string;
4014
+ statusCode?: number;
4015
+ requestId?: string;
4016
+ details?: unknown;
4017
+ });
4018
+ toJSON(): {
4019
+ name: string;
4020
+ message: string;
4021
+ code: string;
4022
+ statusCode: number | undefined;
4023
+ requestId: string | undefined;
4024
+ details: unknown;
4025
+ };
4026
+ }
4027
+ /**
4028
+ * Authentication/authorization error (401, 403)
4029
+ */
4030
+ declare class VaifAuthError extends VaifError {
4031
+ constructor(message: string, options?: {
4032
+ code?: string;
4033
+ statusCode?: number;
4034
+ requestId?: string;
4035
+ });
4036
+ }
4037
+ /**
4038
+ * Validation error (400) with optional field-level errors
4039
+ */
4040
+ declare class VaifValidationError extends VaifError {
4041
+ /** Field-level validation errors */
4042
+ readonly fieldErrors?: Record<string, string[]>;
4043
+ constructor(message: string, options?: {
4044
+ fieldErrors?: Record<string, string[]>;
4045
+ details?: unknown;
4046
+ requestId?: string;
4047
+ });
4048
+ }
4049
+ /**
4050
+ * Network/connection error
4051
+ */
4052
+ declare class VaifNetworkError extends VaifError {
4053
+ /** Original error cause */
4054
+ readonly cause?: Error;
4055
+ constructor(message: string, cause?: Error);
4056
+ }
4057
+ /**
4058
+ * Rate limit error (429)
4059
+ */
4060
+ declare class VaifRateLimitError extends VaifError {
4061
+ /** Seconds to wait before retrying */
4062
+ readonly retryAfter?: number;
4063
+ constructor(message: string, retryAfter?: number);
4064
+ }
4065
+ /**
4066
+ * Resource not found error (404)
4067
+ */
4068
+ declare class VaifNotFoundError extends VaifError {
4069
+ constructor(message: string, requestId?: string);
4070
+ }
4071
+ /**
4072
+ * Conflict error (409)
4073
+ */
4074
+ declare class VaifConflictError extends VaifError {
4075
+ constructor(message: string, requestId?: string);
4076
+ }
4077
+ /**
4078
+ * Request timeout error
4079
+ */
4080
+ declare class VaifTimeoutError extends VaifNetworkError {
4081
+ /** Timeout duration in milliseconds */
4082
+ readonly timeoutMs?: number;
4083
+ constructor(message: string, timeoutMs?: number);
4084
+ }
4085
+ /** Check if an error is a VaifError */
4086
+ declare function isVaifError(error: unknown): error is VaifError;
4087
+ /** Check if an error is a VaifAuthError */
4088
+ declare function isVaifAuthError(error: unknown): error is VaifAuthError;
4089
+ /** Check if an error is a VaifValidationError */
4090
+ declare function isVaifValidationError(error: unknown): error is VaifValidationError;
4091
+ /** Check if an error is a VaifNetworkError */
4092
+ declare function isVaifNetworkError(error: unknown): error is VaifNetworkError;
4093
+ /** Check if an error is a VaifRateLimitError */
4094
+ declare function isVaifRateLimitError(error: unknown): error is VaifRateLimitError;
4095
+ /** Check if an error is a VaifNotFoundError */
4096
+ declare function isVaifNotFoundError(error: unknown): error is VaifNotFoundError;
4097
+ /** Check if an error is a VaifConflictError */
4098
+ declare function isVaifConflictError(error: unknown): error is VaifConflictError;
4099
+ /** Check if an error is a VaifTimeoutError */
4100
+ declare function isVaifTimeoutError(error: unknown): error is VaifTimeoutError;
4101
+
3577
4102
  /**
3578
4103
  * VAIF Studio Client
3579
4104
  *
3580
- * Main entry point for the VAIF SDK
4105
+ * Main entry point for the VAIF SDK. Provides authenticated API requests
4106
+ * with automatic retry, interceptors, and typed error handling.
3581
4107
  */
3582
4108
 
3583
4109
  /**
@@ -3596,89 +4122,65 @@ declare function createClient(options: VaifClientOptions): VaifClient;
3596
4122
  * VAIF Studio Client
3597
4123
  *
3598
4124
  * Provides access to all VAIF services:
3599
- * - Database (db)
3600
- * - Realtime subscriptions (realtime)
3601
- * - Storage (storage)
3602
- * - Edge Functions (functions)
3603
- * - Authentication (auth)
3604
- * - AI Generation (ai)
4125
+ * - Database (db) - CRUD operations with fluent query builder
4126
+ * - Realtime (realtime) - WebSocket subscriptions for live data
4127
+ * - Storage (storage) - File upload/download with CDN
4128
+ * - Functions (functions) - Edge function invocation
4129
+ * - Authentication (auth) - User auth with OAuth, OTP, etc.
4130
+ * - AI (ai) - Code generation and AI chat
4131
+ * - Schema (schema) - Database schema management
4132
+ * - TypeGen (typegen) - TypeScript type generation from DB schema
4133
+ * - Admin (admin) - Platform admin endpoints
4134
+ * - Projects (projects) - Project management
4135
+ * - API Keys (apiKeys) - API key management
4136
+ * - Integrations (integrations) - Webhook and integration management
3605
4137
  */
3606
4138
  declare class VaifClient {
3607
4139
  private config;
3608
4140
  private accessToken;
3609
- /**
3610
- * Database client for CRUD operations
3611
- */
4141
+ /** Database client for CRUD operations */
3612
4142
  readonly db: VaifDatabase;
3613
- /**
3614
- * Realtime client for subscriptions
3615
- */
4143
+ /** Realtime client for WebSocket subscriptions */
3616
4144
  readonly realtime: VaifRealtime;
3617
- /**
3618
- * Storage client for file operations
3619
- */
4145
+ /** Storage client for file operations */
3620
4146
  readonly storage: VaifStorage;
3621
- /**
3622
- * Functions client for edge function invocation
3623
- */
4147
+ /** Functions client for edge function invocation */
3624
4148
  readonly functions: VaifFunctions;
3625
- /**
3626
- * Auth client for authentication
3627
- */
4149
+ /** Auth client for authentication */
3628
4150
  readonly auth: VaifAuth;
3629
- /**
3630
- * AI client for generation features
3631
- */
4151
+ /** AI client for generation features */
3632
4152
  readonly ai: VaifAI;
3633
- /**
3634
- * Schema Engine client for schema management and migrations
3635
- */
4153
+ /** Schema Engine client for schema management and migrations */
3636
4154
  readonly schema: VaifSchema;
3637
- /**
3638
- * Type generator for generating TypeScript types from database schema
3639
- */
4155
+ /** Type generator for generating TypeScript types from database schema */
3640
4156
  readonly typegen: VaifTypeGen;
3641
- /**
3642
- * Admin client for platform management (admin-only endpoints)
3643
- */
4157
+ /** Admin client for platform management (admin-only endpoints) */
3644
4158
  readonly admin: VaifAdmin;
3645
- /**
3646
- * Projects client for project management
3647
- */
4159
+ /** Projects client for project management */
3648
4160
  readonly projects: VaifProjects;
3649
- /**
3650
- * API Keys client for API key management
3651
- */
4161
+ /** API Keys client for API key management */
3652
4162
  readonly apiKeys: VaifApiKeys;
3653
- /**
3654
- * Integrations client for managing webhooks and integrations
3655
- */
4163
+ /** Integrations client for managing webhooks and integrations */
3656
4164
  readonly integrations: VaifIntegrations;
3657
4165
  constructor(options: VaifClientOptions);
3658
- /**
3659
- * Get current configuration
3660
- */
4166
+ /** Get current configuration */
3661
4167
  getConfig(): VaifConfig;
3662
- /**
3663
- * Set access token for authenticated requests
3664
- */
4168
+ /** Set access token for authenticated requests */
3665
4169
  setAccessToken(token: string | null): void;
3666
- /**
3667
- * Get current access token
3668
- */
4170
+ /** Get current access token */
3669
4171
  getAccessToken(): string | null;
3670
4172
  /**
3671
- * Make an authenticated API request
4173
+ * Make an authenticated API request with automatic retry and interceptors
4174
+ *
4175
+ * @param path - API path (relative to base URL)
4176
+ * @param options - Request options (method, body, params, etc.)
4177
+ * @returns Typed API response with data, error, status, and headers
3672
4178
  */
3673
4179
  request<T = unknown>(path: string, options?: RequestOptions): Promise<ApiResponse<T>>;
3674
- /**
3675
- * Restore session from storage
3676
- */
4180
+ /** Restore session from storage */
3677
4181
  private restoreSession;
3678
- /**
3679
- * Log debug messages
3680
- */
4182
+ /** Log debug messages (sanitised to avoid leaking tokens) */
3681
4183
  debug(...args: unknown[]): void;
3682
4184
  }
3683
4185
 
3684
- export { type AIGenerateOptions, type AIModel, type AISession, type AddonsConfig, type AdminAdmin, type AdminIncident, type AdminOrg, type AdminOverview, type AdminProject, type AdminUser, type ApiError, type ApiKey, type ApiResponse, type ApiSettingsConfig, type AuthOptions, type AuthResponse, type Bucket, type ColumnDefinition, type ColumnSchema, type ComputeSettings, type ContextSnapshot, type CopilotOverview, type CopilotSession, type CreateApiKeyOptions$1 as CreateApiKeyOptions, type CreateApiKeyResult, type CreateIntegrationOptions, type CreateProjectOptions, type DatabaseSchema, type DeleteQuery, type DlqMessage, type DownloadOptions, type EndpointGenerationResult, type EnumSchema, type Environment, type FeatureFlag, type FileObject, type FilterOperator, type ForeignKeySchema, type FunctionError, type FunctionExecution, type FunctionGenerationResult, type FunctionInvocation, type FunctionInvokeOptions, type FunctionLog, type FunctionMetadata, type FunctionResponse, type GeneratedBackend, type HealthComponent, type IndexDefinition, type IndexSchema, type InsertQuery, type Integration, type IntegrationConfig, type JwtSettingsConfig, type MigrationRecord, type MigrationsListResult, type OrderDirection, type PlanStep, type Project, type ProjectApiKey, type ProjectSettings, type PromptTemplate, type QueryBuilder$1 as QueryBuilder, type QueueInfo, RealtimeChannel, type RealtimeEvent, type RealtimeMessage, type RealtimeOptions, type Region, type RequestOptions, type SchemaApplyRequest, type SchemaApplyResult, type SchemaDefinition, type SchemaGenerationResult, type SchemaIntrospectResult, type SchemaPreviewRequest, type SchemaPreviewResult, type SelectQuery, type Session, type SignInCredentials, type SignUpCredentials, type StorageOptions, type SubscriptionCallback, type TableDefinition, type TableSchema, type TypeGenOptions, type UpdateIntegrationOptions, type UpdateProjectOptions, type UpdateQuery, type UploadOptions, type User, VaifAI, VaifAdmin, VaifApiKeys, VaifAuth, VaifClient, type VaifClientOptions, type VaifConfig, VaifDatabase, type VaifFunction, VaifFunctions, VaifIntegrations, VaifProjects, VaifRealtime, VaifSchema, VaifStorage, VaifTypeGen, type ViewSchema, type WebhookDelivery, createClient, createTypeGen, createClient as createVaifClient };
4186
+ export { type AIChatMessage, type AIChatRequest, type AIChatResponse, type AICreditsInfo, type AIGenerateOptions, type AIModel, type AISession, type AISuggestion, type AddonsConfig, type AdminAdmin, type AdminIncident, type AdminOrg, type AdminOverview, type AdminProject, type AdminUser, type ApiError, type ApiKey, type ApiResponse, type ApiSettingsConfig, type AuthChangeEvent, type AuthError, type AuthOptions, type AuthResponse, type AuthStateChangeCallback, type BroadcastMessage, type Bucket, type ChannelStatus, type ColumnDefinition, type ColumnSchema, type ComputeSettings, type ContextSnapshot, type CopilotMetrics, type CopilotMetricsOptions, type CopilotMetricsSummary, type CopilotModel, type CopilotOverview, type CopilotSession, type CopilotTokenTrend, type CreateApiKeyOptions$1 as CreateApiKeyOptions, type CreateApiKeyResult, type CreateIntegrationOptions, type CreateProjectOptions, type DatabaseSchema, type DeleteQuery, type DlqMessage, type DownloadOptions, type EndpointGenerationRequest, type EndpointGenerationResult, type EnumSchema, type Environment, type ErrorContext, type ErrorInterceptor, type FeatureFlag, type FileObject, type FilterOperator, type ForeignKeySchema, type FunctionError, type FunctionExecution, type FunctionGenerationRequest, type FunctionGenerationResult, type FunctionInvocation, type FunctionInvokeOptions, type FunctionLog, type FunctionMetadata, type FunctionResponse, type GeneratedBackend, type HealthComponent, type ImageTransformOptions, type IndexDefinition, type IndexSchema, type InsertQuery, type Integration, type IntegrationConfig, type InterceptorConfig, type JwtSettingsConfig, type ListFilesOptions, type MFAFactor, type MigrationRecord, type MigrationsListResult, type OAuthProvider, type OAuthResponse, type OAuthSignInOptions, type OrderDirection, type PaginatedResponse, type PaginationParams, type PlanStep, type PostgresChangeEvent, type PostgresChangesFilter, type PresenceState, type PresenceSyncEvent, type Project, type ProjectApiKey, type ProjectSettings, type PromptTemplate, type QueryBuilder$1 as QueryBuilder, type QueryError, type QueryResult, type QueueInfo, RealtimeChannel, type RealtimeEvent, type RealtimeMessage, type RealtimeOptions, type Region, type RequestContext, type RequestInterceptor, type RequestOptions, type ResetPasswordOptions, type ResolvedRetryConfig, type ResponseContext, type ResponseInterceptor, type RetryConfig, type SchemaApplyRequest, type SchemaApplyResult, type SchemaDefinition, type SchemaGenerationRequest, type SchemaGenerationResult, type SchemaIntrospectResult, type SchemaPreviewRequest, type SchemaPreviewResult, type SelectQuery, type Session, type SignInCredentials, type SignUpCredentials, type SignedUrlOptions, type StorageAdapter, type StorageError, type StorageOptions, type SubscriptionCallback, type TableDefinition, type TableSchema, type Transaction, type TransactionOptions, type TypeGenOptions, type UpdateIntegrationOptions, type UpdateProjectOptions, type UpdateQuery, type UpdateUserOptions, type UploadOptions, type UploadResult, type User, VaifAI, VaifAdmin, VaifApiKeys, VaifAuth, VaifAuthError, VaifClient, type VaifClientOptions, type VaifConfig, VaifConflictError, VaifDatabase, VaifError, type VaifFunction, VaifFunctions, VaifIntegrations, VaifNetworkError, VaifNotFoundError, VaifProjects, VaifRateLimitError, VaifRealtime, VaifSchema, VaifStorage, VaifTimeoutError, VaifTypeGen, VaifValidationError, type ViewSchema, type WebhookDelivery, createClient, createTypeGen, createClient as createVaifClient, isVaifAuthError, isVaifConflictError, isVaifError, isVaifNetworkError, isVaifNotFoundError, isVaifRateLimitError, isVaifTimeoutError, isVaifValidationError };