@boltic/sdk 0.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.
@@ -0,0 +1,1077 @@
1
+ declare type AlignmentType = 'left' | 'center' | 'right';
2
+
3
+ /**
4
+ * Filter structure according to Tables Module PRD and backend buildWhereClause function
5
+ */
6
+ declare interface ApiFilter {
7
+ field: string;
8
+ operator: string;
9
+ values: unknown[];
10
+ }
11
+
12
+ declare type ApiResponse<T> = BolticSuccessResponse<T> | BolticListResponse<T> | BolticErrorResponse;
13
+
14
+ declare interface AuthConfig {
15
+ apiKey: string;
16
+ tokenRefreshThreshold?: number;
17
+ maxRetries?: number;
18
+ }
19
+
20
+ declare interface AuthHeaders {
21
+ 'x-boltic-token': string;
22
+ [key: string]: string;
23
+ }
24
+
25
+ declare class AuthManager {
26
+ private config;
27
+ private tokenInfo;
28
+ constructor(config: AuthConfig);
29
+ private validateApiKey;
30
+ getAuthHeaders(): AuthHeaders;
31
+ updateApiKey(newApiKey: string): void;
32
+ isAuthenticated(): boolean;
33
+ validateApiKeyAsync(): Promise<boolean>;
34
+ getTokenInfo(): TokenInfo | null;
35
+ getMaxRetries(): number;
36
+ }
37
+
38
+ declare class BaseClient {
39
+ private httpAdapter;
40
+ private authManager;
41
+ private interceptors;
42
+ private config;
43
+ constructor(config: ClientConfig, authManager: AuthManager);
44
+ private setupDefaultInterceptors;
45
+ private handleError;
46
+ request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
47
+ get<T = unknown>(url: string, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
48
+ post<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
49
+ put<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
50
+ patch<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
51
+ delete<T = unknown>(url: string, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
52
+ getInterceptors(): InterceptorManagerImpl;
53
+ updateConfig(updates: Partial<ClientConfig>): void;
54
+ getConfig(): ClientConfig;
55
+ }
56
+
57
+ declare class BolticClient {
58
+ private configManager;
59
+ private authManager;
60
+ private baseClient;
61
+ private tableResource;
62
+ private columnResource;
63
+ private recordResource;
64
+ private sqlResource;
65
+ private currentDatabase;
66
+ private clientOptions;
67
+ constructor(apiKey: string, options?: ClientOptions);
68
+ getCurrentDatabase(): DatabaseContext | null;
69
+ get tables(): {
70
+ create: (data: TableCreateRequest) => Promise<BolticSuccessResponse<TableCreateResponse>>;
71
+ findAll: (options?: TableQueryOptions) => Promise<ApiResponse<TableRecord[]>>;
72
+ findById: (id: string) => Promise<BolticSuccessResponse<TableRecord | null>>;
73
+ findByName: (name: string) => Promise<BolticSuccessResponse<TableRecord | null>>;
74
+ findOne: (options: TableQueryOptions) => Promise<BolticSuccessResponse<TableRecord | null>>;
75
+ update: (name: string, data: TableUpdateRequest) => Promise<BolticSuccessResponse<TableRecord>>;
76
+ delete: (name: string) => Promise<BolticSuccessResponse< {
77
+ message: string;
78
+ }>>;
79
+ rename: (oldName: string, newName: string) => Promise<BolticSuccessResponse<TableRecord>>;
80
+ setAccess: (request: {
81
+ table_name: string;
82
+ is_shared: boolean;
83
+ }) => Promise<BolticSuccessResponse<TableRecord>>;
84
+ };
85
+ get columns(): {
86
+ create: (tableName: string, column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
87
+ createMany: (tableName: string, columns: FieldDefinition[]) => Promise<BolticErrorResponse | BolticListResponse<ColumnRecord>>;
88
+ findAll: (tableName: string, options?: ColumnQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<ColumnDetails>>;
89
+ findOne: (tableName: string, columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
90
+ findById: (tableName: string, columnId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
91
+ update: (tableName: string, columnName: string, updates: ColumnUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
92
+ delete: (tableName: string, columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
93
+ success: boolean;
94
+ message?: string | undefined;
95
+ }>>;
96
+ };
97
+ table(name: string): TableBuilder;
98
+ from(tableName: string): {
99
+ columns: () => {
100
+ create: (column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
101
+ findAll: (options?: ColumnQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<ColumnDetails>>;
102
+ get: (columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
103
+ update: (columnName: string, updates: ColumnUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
104
+ delete: (columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
105
+ success: boolean;
106
+ message?: string | undefined;
107
+ }>>;
108
+ };
109
+ records: () => {
110
+ insert: (data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
111
+ findOne: (recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
112
+ update: (options: RecordUpdateOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
113
+ updateById: (recordId: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
114
+ delete: (options: RecordDeleteOptions) => Promise<BolticErrorResponse | BolticSuccessResponse< {
115
+ message: string;
116
+ }>>;
117
+ deleteById: (recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
118
+ message: string;
119
+ }>>;
120
+ };
121
+ record: () => RecordBuilder;
122
+ };
123
+ get records(): {
124
+ insert: (tableName: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
125
+ findAll: (tableName: string, options?: RecordQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
126
+ findOne: (tableName: string, recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
127
+ update: (tableName: string, options: RecordUpdateOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
128
+ updateById: (tableName: string, recordId: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
129
+ delete: (tableName: string, options: RecordDeleteOptions) => Promise<BolticErrorResponse | BolticSuccessResponse< {
130
+ message: string;
131
+ }>>;
132
+ deleteById: (tableName: string, recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
133
+ message: string;
134
+ }>>;
135
+ };
136
+ record(tableName: string): RecordBuilder;
137
+ get sql(): {
138
+ textToSQL: (prompt: string, options?: TextToSQLOptions) => Promise<AsyncIterable<string>>;
139
+ executeSQL: (query: string) => Promise<ExecuteSQLApiResponse_2>;
140
+ };
141
+ getSqlResource(): SqlResource;
142
+ updateApiKey(newApiKey: string): void;
143
+ updateConfig(updates: Partial<ClientConfig>): void;
144
+ getConfig(): ClientConfig;
145
+ validateApiKey(): Promise<boolean>;
146
+ isAuthenticated(): boolean;
147
+ getHttpClient(): BaseClient;
148
+ addRequestInterceptor(interceptor: (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>): number;
149
+ addResponseInterceptor(onFulfilled?: (response: HttpResponse) => HttpResponse | Promise<HttpResponse>, onRejected?: (error: unknown) => unknown): number;
150
+ ejectRequestInterceptor(id: number): void;
151
+ ejectResponseInterceptor(id: number): void;
152
+ testConnection(): Promise<boolean>;
153
+ getVersion(): string;
154
+ getEnvironment(): Environment;
155
+ getRegion(): string;
156
+ enableDebug(): void;
157
+ disableDebug(): void;
158
+ isDebugEnabled(): boolean;
159
+ }
160
+
161
+ declare interface BolticErrorResponse {
162
+ data?: {};
163
+ message?: string;
164
+ error: {
165
+ code?: string;
166
+ message?: string;
167
+ meta?: string[];
168
+ };
169
+ }
170
+
171
+ declare interface BolticErrorResponse_2 {
172
+ data: {};
173
+ error: {
174
+ code?: string;
175
+ message?: string;
176
+ meta?: string[];
177
+ };
178
+ }
179
+
180
+ declare interface BolticErrorResponse_3 {
181
+ data?: {};
182
+ message?: string;
183
+ error: {
184
+ code?: string;
185
+ message?: string;
186
+ meta?: string[];
187
+ };
188
+ }
189
+
190
+ declare interface BolticListResponse<T> {
191
+ data: T[];
192
+ pagination?: {
193
+ total_count: number;
194
+ total_pages: number;
195
+ current_page: number;
196
+ per_page: number;
197
+ type: string;
198
+ };
199
+ message?: string;
200
+ error?: {
201
+ code?: string;
202
+ message?: string;
203
+ meta?: string[];
204
+ };
205
+ }
206
+
207
+ declare interface BolticListResponse_2<T = unknown> {
208
+ data: T[];
209
+ pagination?: {
210
+ total_count: number;
211
+ total_pages: number;
212
+ current_page: number;
213
+ per_page: number;
214
+ type: string;
215
+ };
216
+ message?: string;
217
+ }
218
+
219
+ declare interface BolticListResponse_3<T> {
220
+ data: T[];
221
+ pagination?: {
222
+ total_count: number;
223
+ total_pages: number;
224
+ current_page: number;
225
+ per_page: number;
226
+ type: string;
227
+ };
228
+ message?: string;
229
+ error?: {
230
+ code?: string;
231
+ message?: string;
232
+ meta?: string[];
233
+ };
234
+ }
235
+
236
+ declare interface BolticSuccessResponse<T> {
237
+ data: T;
238
+ message?: string;
239
+ error?: {
240
+ code?: string;
241
+ message?: string;
242
+ meta?: string[];
243
+ };
244
+ }
245
+
246
+ declare interface BolticSuccessResponse_2<T = unknown> {
247
+ data: T;
248
+ message?: string;
249
+ }
250
+
251
+ declare interface BolticSuccessResponse_3<T> {
252
+ data: T;
253
+ message?: string;
254
+ error?: {
255
+ code?: string;
256
+ message?: string;
257
+ meta?: string[];
258
+ };
259
+ }
260
+
261
+ declare interface ClientConfig extends EnvironmentConfig {
262
+ apiKey: string;
263
+ environment: Environment;
264
+ region: Region;
265
+ headers?: Record<string, string>;
266
+ retryAttempts: number;
267
+ retryDelay: number;
268
+ maxRetries: number;
269
+ }
270
+
271
+ declare interface ClientOptions extends Partial<EnvironmentConfig> {
272
+ environment?: Environment;
273
+ region?: 'asia-south1' | 'us-central1';
274
+ debug?: boolean;
275
+ retryAttempts?: number;
276
+ retryDelay?: number;
277
+ }
278
+
279
+ declare interface ColumnDetails {
280
+ id: string;
281
+ name: string;
282
+ table_id: string;
283
+ type: FieldType;
284
+ description?: string;
285
+ is_nullable: boolean;
286
+ is_primary_key: boolean;
287
+ is_unique: boolean;
288
+ is_indexed: boolean;
289
+ is_visible: boolean;
290
+ is_readonly: boolean;
291
+ field_order: number;
292
+ default_value?: unknown;
293
+ created_at: string;
294
+ updated_at: string;
295
+ alignment?: AlignmentType;
296
+ timezone?: string;
297
+ date_format?: string;
298
+ time_format?: string;
299
+ decimals?: number | string;
300
+ currency_format?: string;
301
+ selection_source?: string;
302
+ selectable_items?: string[];
303
+ multiple_selections?: boolean;
304
+ phone_format?: string;
305
+ vector_dimension?: number;
306
+ }
307
+
308
+ declare interface ColumnQueryOptions {
309
+ where?: {
310
+ id?: string;
311
+ name?: string;
312
+ table_id?: string;
313
+ type?: FieldType;
314
+ is_nullable?: boolean;
315
+ is_unique?: boolean;
316
+ is_indexed?: boolean;
317
+ is_primary_key?: boolean;
318
+ };
319
+ fields?: Array<keyof ColumnDetails>;
320
+ sort?: Array<{
321
+ field: keyof ColumnDetails;
322
+ order: 'asc' | 'desc';
323
+ }>;
324
+ limit?: number;
325
+ offset?: number;
326
+ }
327
+
328
+ declare interface ColumnRecord {
329
+ id: string;
330
+ }
331
+
332
+ declare interface ColumnUpdateRequest {
333
+ name?: string;
334
+ type?: FieldType;
335
+ description?: string;
336
+ is_nullable?: boolean;
337
+ is_unique?: boolean;
338
+ is_indexed?: boolean;
339
+ is_visible?: boolean;
340
+ is_primary_key?: boolean;
341
+ is_readonly?: boolean;
342
+ default_value?: unknown;
343
+ field_order?: number;
344
+ fields?: Array<keyof ColumnDetails>;
345
+ alignment?: AlignmentType;
346
+ decimals?: DecimalType;
347
+ currency_format?: string;
348
+ selection_source?: 'provide-static-list';
349
+ selectable_items?: string[];
350
+ multiple_selections?: boolean;
351
+ phone_format?: PhoneFormatType;
352
+ date_format?: keyof typeof DateFormatEnum;
353
+ time_format?: keyof typeof TimeFormatEnum;
354
+ timezone?: string;
355
+ vector_dimension?: number;
356
+ }
357
+
358
+ export declare function createErrorResponse(error: string, details?: unknown): {
359
+ error: string;
360
+ details: unknown;
361
+ };
362
+
363
+ export declare function createMockResponse<T>(data: T, pagination?: PaginationInfo): {
364
+ data: T;
365
+ pagination: PaginationInfo | undefined;
366
+ };
367
+
368
+ export declare function createTestClient(options?: MockClientOptions): BolticClient;
369
+
370
+ declare interface DatabaseContext {
371
+ databaseName: string;
372
+ }
373
+
374
+ declare const DateFormatEnum: Readonly<{
375
+ MMDDYY: "%m/%d/%y";
376
+ MMDDYYYY: "%m/%d/%Y";
377
+ MM_DD_YYYY: "%m-%d-%Y";
378
+ DD_MM_YYYY: "%d-%m-%Y";
379
+ DDMMYYYY: "%d/%m/%Y";
380
+ DDMMYY: "%d/%m/%y";
381
+ YYYY_MM_DD: "%Y-%m-%d";
382
+ MMMM__DD__YYYY: "%B %d %Y";
383
+ MMM__DD__YYYY: "%b %d %Y";
384
+ ddd__MMM__DD__YYYY: "%a %b %d %Y";
385
+ }>;
386
+
387
+ declare type DecimalType = '00' | '0.0' | '0.00' | '0.000' | '0.0000' | '0.00000' | '0.000000';
388
+
389
+ declare type Environment = 'local' | 'sit' | 'uat' | 'prod';
390
+
391
+ declare interface EnvironmentConfig {
392
+ baseURL: string;
393
+ timeout: number;
394
+ retryAttempts?: number;
395
+ debug?: boolean;
396
+ }
397
+
398
+ declare type ErrorInterceptor = (error: unknown) => unknown | Promise<unknown>;
399
+
400
+ declare interface ExecuteSQLApiResponse {
401
+ data: [
402
+ Record<string, unknown>[],
403
+ unknown
404
+ ];
405
+ pagination?: {
406
+ total_count: number;
407
+ total_pages: number;
408
+ current_page: number;
409
+ per_page: number;
410
+ type: string;
411
+ };
412
+ message?: string;
413
+ }
414
+
415
+ declare interface ExecuteSQLApiResponse_2 {
416
+ data: [
417
+ Record<string, unknown>[],
418
+ unknown
419
+ ];
420
+ pagination?: {
421
+ total_count: number;
422
+ total_pages: number;
423
+ current_page: number;
424
+ per_page: number;
425
+ type: string;
426
+ };
427
+ message?: string;
428
+ }
429
+
430
+ declare interface FieldDefinition {
431
+ name: string;
432
+ type: FieldType;
433
+ is_nullable?: boolean;
434
+ is_primary_key?: boolean;
435
+ is_unique?: boolean;
436
+ is_indexed?: boolean;
437
+ is_visible?: boolean;
438
+ is_readonly?: boolean;
439
+ field_order?: number;
440
+ description?: string;
441
+ default_value?: unknown;
442
+ alignment?: 'left' | 'center' | 'right';
443
+ timezone?: string;
444
+ date_format?: string;
445
+ time_format?: string;
446
+ decimals?: string;
447
+ currency_format?: string;
448
+ selection_source?: string;
449
+ selectable_items?: string[];
450
+ multiple_selections?: boolean;
451
+ phone_format?: string;
452
+ vector_dimension?: number;
453
+ }
454
+
455
+ declare type FieldType = 'text' | 'long-text' | 'number' | 'currency' | 'checkbox' | 'dropdown' | 'email' | 'phone-number' | 'link' | 'json' | 'date-time' | 'vector' | 'halfvec' | 'sparsevec';
456
+
457
+ declare interface HttpRequestConfig {
458
+ url: string;
459
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
460
+ headers?: Record<string, string>;
461
+ params?: Record<string, unknown>;
462
+ data?: unknown;
463
+ timeout?: number;
464
+ signal?: AbortSignal;
465
+ }
466
+
467
+ declare interface HttpResponse<T = unknown> {
468
+ data: T;
469
+ status: number;
470
+ statusText: string;
471
+ headers: Record<string, string>;
472
+ }
473
+
474
+ declare interface InterceptorManager {
475
+ request: {
476
+ use(interceptor: RequestInterceptor): number;
477
+ eject(id: number): void;
478
+ };
479
+ response: {
480
+ use(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
481
+ eject(id: number): void;
482
+ };
483
+ }
484
+
485
+ declare class InterceptorManagerImpl implements InterceptorManager {
486
+ private requestInterceptors;
487
+ private responseInterceptors;
488
+ private nextId;
489
+ request: {
490
+ use: (interceptor: RequestInterceptor) => number;
491
+ eject: (id: number) => void;
492
+ };
493
+ response: {
494
+ use: (onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor) => number;
495
+ eject: (id: number) => void;
496
+ };
497
+ executeRequestInterceptors(config: HttpRequestConfig): Promise<HttpRequestConfig>;
498
+ executeResponseInterceptors(response: HttpResponse): Promise<HttpResponse>;
499
+ executeErrorInterceptors(error: unknown): Promise<unknown>;
500
+ }
501
+
502
+ export declare interface MockClientOptions {
503
+ apiKey?: string;
504
+ environment?: 'local' | 'sit' | 'uat' | 'prod';
505
+ region?: 'asia-south1' | 'us-central1';
506
+ mockResponses?: Record<string, unknown>;
507
+ debug?: boolean;
508
+ }
509
+
510
+ declare interface PaginationInfo {
511
+ total_count: number;
512
+ total_pages: number;
513
+ current_page: number;
514
+ per_page: number;
515
+ type: string;
516
+ }
517
+
518
+ declare type PhoneFormatType = '+91 123 456 7890' | '(123) 456-7890' | '+1 (123) 456-7890' | '+91 12 3456 7890';
519
+
520
+ /**
521
+ * Record Builder - provides a fluent interface for building record queries and operations
522
+ */
523
+ declare class RecordBuilder {
524
+ private tableName;
525
+ private recordResource;
526
+ private queryOptions;
527
+ private updateData;
528
+ constructor(options: RecordBuilderOptions);
529
+ /**
530
+ * Add filter conditions
531
+ */
532
+ where(conditions: Record<string, unknown>): RecordBuilder;
533
+ /**
534
+ * Set sorting
535
+ */
536
+ orderBy(field: string, direction?: 'asc' | 'desc'): RecordBuilder;
537
+ /**
538
+ * Set limit (using page)
539
+ */
540
+ limit(count: number): RecordBuilder;
541
+ /**
542
+ * Set offset (using page)
543
+ */
544
+ offset(count: number): RecordBuilder;
545
+ /**
546
+ * Set fields to select
547
+ */
548
+ select(fields: string[]): RecordBuilder;
549
+ /**
550
+ * Set data for update operations
551
+ */
552
+ set(data: RecordData): RecordBuilder;
553
+ /**
554
+ * Set pagination
555
+ */
556
+ page(pageNo: number, pageSize?: number): RecordBuilder;
557
+ /**
558
+ * Execute list operation (was findAll)
559
+ */
560
+ list(): Promise<BolticListResponse_3<RecordWithId> | BolticErrorResponse_3>;
561
+ /**
562
+ * Execute findAll operation (alias for list)
563
+ */
564
+ findAll(): Promise<BolticListResponse_3<RecordWithId> | BolticErrorResponse_3>;
565
+ /**
566
+ * Execute findOne operation by getting first result from list
567
+ */
568
+ findOne(): Promise<BolticSuccessResponse_3<RecordWithId | null> | BolticErrorResponse_3>;
569
+ /**
570
+ * Build where conditions from filters for API consumption
571
+ */
572
+ private buildWhereConditions;
573
+ /**
574
+ * Execute update operation - requires filters or record IDs
575
+ */
576
+ update(): Promise<BolticListResponse_3<RecordWithId> | BolticErrorResponse_3>;
577
+ /**
578
+ * Execute update by ID operation
579
+ */
580
+ updateById(id: string): Promise<BolticSuccessResponse_3<RecordWithId> | BolticErrorResponse_3>;
581
+ /**
582
+ * Execute delete by single ID operation
583
+ */
584
+ deleteById(id: string): Promise<BolticSuccessResponse_3<{
585
+ message: string;
586
+ }> | BolticErrorResponse_3>;
587
+ /**
588
+ * Execute delete by IDs operation
589
+ */
590
+ deleteByIds(ids: string[]): Promise<BolticSuccessResponse_3<{
591
+ message: string;
592
+ }> | BolticErrorResponse_3>;
593
+ /**
594
+ * Execute delete operation using filters
595
+ */
596
+ delete(): Promise<BolticSuccessResponse_3<{
597
+ message: string;
598
+ }> | BolticErrorResponse_3>;
599
+ /**
600
+ * Get the built query options (for debugging)
601
+ */
602
+ getQueryOptions(): RecordQueryOptions;
603
+ /**
604
+ * Get the update data (for debugging)
605
+ */
606
+ getUpdateData(): RecordData;
607
+ /**
608
+ * Execute insert operation
609
+ */
610
+ insert(data: RecordData): Promise<BolticSuccessResponse_3<RecordWithId> | BolticErrorResponse_3>;
611
+ }
612
+
613
+ declare interface RecordBuilderOptions {
614
+ tableName: string;
615
+ recordResource: RecordResource;
616
+ }
617
+
618
+ declare interface RecordData {
619
+ [fieldName: string]: unknown;
620
+ fields?: string[];
621
+ }
622
+
623
+ declare interface RecordDeleteOptions {
624
+ record_ids?: string[];
625
+ filters?: ApiFilter[] | Record<string, unknown>;
626
+ }
627
+
628
+ declare interface RecordQueryOptions {
629
+ page?: {
630
+ page_no: number;
631
+ page_size: number;
632
+ };
633
+ filters?: ApiFilter[] | Record<string, unknown>[];
634
+ sort?: Record<string, unknown>[];
635
+ fields?: string[];
636
+ }
637
+
638
+ declare class RecordResource {
639
+ private apiClient;
640
+ private tablesApiClient;
641
+ private client;
642
+ constructor(client: BaseClient);
643
+ /**
644
+ * Insert a single record
645
+ */
646
+ insert(tableName: string, data: RecordData): Promise<BolticSuccessResponse_3<RecordWithId> | BolticErrorResponse_3>;
647
+ /**
648
+ * Get a single record by ID
649
+ */
650
+ get(tableName: string, recordId: string): Promise<BolticSuccessResponse_3<RecordWithId> | BolticErrorResponse_3>;
651
+ /**
652
+ * List records with filtering and pagination
653
+ */
654
+ list(tableName: string, options?: RecordQueryOptions): Promise<BolticListResponse_3<RecordWithId> | BolticErrorResponse_3>;
655
+ /**
656
+ * Update records by filters
657
+ */
658
+ update(tableName: string, options: RecordUpdateOptions): Promise<BolticListResponse_3<RecordWithId> | BolticErrorResponse_3>;
659
+ /**
660
+ * Update a single record by ID
661
+ */
662
+ updateById(tableName: string, recordId: string, data: RecordData): Promise<BolticSuccessResponse_3<RecordWithId> | BolticErrorResponse_3>;
663
+ /**
664
+ * Unified delete method that supports both record IDs and filters
665
+ */
666
+ delete(tableName: string, options: RecordDeleteOptions): Promise<BolticSuccessResponse_3<{
667
+ message: string;
668
+ }> | BolticErrorResponse_3>;
669
+ /**
670
+ * Delete a single record by ID
671
+ */
672
+ deleteById(tableName: string, recordId: string): Promise<BolticSuccessResponse_3<{
673
+ message: string;
674
+ }> | BolticErrorResponse_3>;
675
+ /**
676
+ * Helper method to get table information by name
677
+ */
678
+ private getTableInfo;
679
+ /**
680
+ * Helper method to ensure all required fields for a record are present,
681
+ * filling missing ones with null.
682
+ */
683
+ private ensureCompleteRecordData;
684
+ }
685
+
686
+ declare interface RecordUpdateOptions {
687
+ set: RecordData;
688
+ filters: ApiFilter[] | Record<string, unknown>[];
689
+ fields?: string[];
690
+ }
691
+
692
+ declare interface RecordWithId extends RecordData {
693
+ id: string;
694
+ created_at?: string;
695
+ updated_at?: string;
696
+ }
697
+
698
+ declare type Region = 'asia-south1' | 'us-central1';
699
+
700
+ declare type RequestInterceptor = (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
701
+
702
+ declare type ResponseInterceptor = (response: HttpResponse) => HttpResponse | Promise<HttpResponse>;
703
+
704
+ declare class SqlResource {
705
+ private sqlApiClient;
706
+ constructor(client: BaseClient);
707
+ /**
708
+ * Convert natural language to SQL query
709
+ * Returns streaming results for real-time query generation
710
+ *
711
+ * @param prompt - Natural language description of the desired query
712
+ * @param options - Optional parameters including currentQuery for refinement
713
+ * @returns AsyncIterable<string> for streaming SQL generation
714
+ *
715
+ */
716
+ textToSQL(prompt: string, options?: TextToSQLOptions): Promise<AsyncIterable<string>>;
717
+ /**
718
+ * Execute SQL query with built-in safety measures and performance optimization
719
+ *
720
+ * @param query - SQL query string to execute
721
+ * @returns Promise<ExecuteSQLApiResponse> with raw API response following Boltic API Response Structure
722
+ *
723
+ */
724
+ executeSQL(query: string): Promise<ExecuteSQLApiResponse>;
725
+ }
726
+
727
+ export declare class SqlTestClient {
728
+ private sql;
729
+ constructor(sql: SqlResource);
730
+ /**
731
+ * Test helper for text-to-SQL conversion
732
+ * Collects all streaming chunks into a single string for easier testing
733
+ */
734
+ generateSQL(prompt: string, options?: TextToSQLOptions): Promise<string>;
735
+ /**
736
+ * Test helper for SQL execution
737
+ */
738
+ executeSQL(query: string): Promise<ExecuteSQLApiResponse_2>;
739
+ /**
740
+ * Utility to simulate streaming text-to-SQL for testing
741
+ */
742
+ simulateStreamingSQL(fullSQLQuery: string, chunkSize?: number, delayMs?: number): AsyncIterable<string>;
743
+ }
744
+
745
+ /**
746
+ * Table Builder - provides a fluent interface for creating tables
747
+ */
748
+ declare class TableBuilder {
749
+ private tableName;
750
+ private description?;
751
+ private isPublic;
752
+ private fields;
753
+ private tablesApiClient?;
754
+ constructor(options: TableBuilderOptions, tablesApiClient?: TablesApiClient);
755
+ /**
756
+ * Set table name
757
+ */
758
+ name(name: string): TableBuilder;
759
+ /**
760
+ * Set table description
761
+ */
762
+ describe(description: string): TableBuilder;
763
+ /**
764
+ * Set if table is public
765
+ */
766
+ public(isPublic?: boolean): TableBuilder;
767
+ /**
768
+ * Add a text field
769
+ */
770
+ text(name: string, options?: {
771
+ nullable?: boolean;
772
+ unique?: boolean;
773
+ indexed?: boolean;
774
+ defaultValue?: string;
775
+ description?: string;
776
+ alignment?: 'left' | 'center' | 'right';
777
+ }): TableBuilder;
778
+ /**
779
+ * Add a long text field
780
+ */
781
+ longText(name: string, options?: {
782
+ nullable?: boolean;
783
+ description?: string;
784
+ alignment?: 'left' | 'center' | 'right';
785
+ }): TableBuilder;
786
+ /**
787
+ * Add a number field
788
+ */
789
+ number(name: string, options?: {
790
+ nullable?: boolean;
791
+ unique?: boolean;
792
+ indexed?: boolean;
793
+ defaultValue?: number;
794
+ description?: string;
795
+ decimals?: string;
796
+ alignment?: 'left' | 'center' | 'right';
797
+ }): TableBuilder;
798
+ /**
799
+ * Add a currency field
800
+ */
801
+ currency(name: string, options?: {
802
+ nullable?: boolean;
803
+ defaultValue?: number;
804
+ description?: string;
805
+ currencyFormat?: string;
806
+ decimals?: string;
807
+ }): TableBuilder;
808
+ /**
809
+ * Add a checkbox field
810
+ */
811
+ checkbox(name: string, options?: {
812
+ nullable?: boolean;
813
+ defaultValue?: boolean;
814
+ description?: string;
815
+ }): TableBuilder;
816
+ /**
817
+ * Add a dropdown field
818
+ */
819
+ dropdown(name: string, items: string[], options?: {
820
+ nullable?: boolean;
821
+ multiple?: boolean;
822
+ defaultValue?: string | string[];
823
+ description?: string;
824
+ }): TableBuilder;
825
+ /**
826
+ * Add an email field
827
+ */
828
+ email(name: string, options?: {
829
+ nullable?: boolean;
830
+ unique?: boolean;
831
+ indexed?: boolean;
832
+ description?: string;
833
+ }): TableBuilder;
834
+ /**
835
+ * Add a phone number field
836
+ */
837
+ phone(name: string, options?: {
838
+ nullable?: boolean;
839
+ description?: string;
840
+ format?: string;
841
+ }): TableBuilder;
842
+ /**
843
+ * Add a link field
844
+ */
845
+ link(name: string, options?: {
846
+ nullable?: boolean;
847
+ description?: string;
848
+ }): TableBuilder;
849
+ /**
850
+ * Add a JSON field
851
+ */
852
+ json(name: string, options?: {
853
+ nullable?: boolean;
854
+ description?: string;
855
+ }): TableBuilder;
856
+ /**
857
+ * Add a date-time field
858
+ */
859
+ dateTime(name: string, options?: {
860
+ nullable?: boolean;
861
+ description?: string;
862
+ dateFormat?: string;
863
+ timeFormat?: string;
864
+ timezone?: string;
865
+ }): TableBuilder;
866
+ /**
867
+ * Add a vector field
868
+ */
869
+ vector(name: string, dimension: number, options?: {
870
+ nullable?: boolean;
871
+ description?: string;
872
+ }): TableBuilder;
873
+ /**
874
+ /**
875
+ * Add a half-precision vector field
876
+ */
877
+ halfVector(name: string, dimension: number, options?: {
878
+ nullable?: boolean;
879
+ description?: string;
880
+ }): TableBuilder;
881
+ /**
882
+ * Add a sparse vector field
883
+ */
884
+ sparseVector(name: string, dimension: number, options?: {
885
+ nullable?: boolean;
886
+ description?: string;
887
+ }): TableBuilder;
888
+ /**
889
+ * Add a custom field
890
+ */
891
+ addField(field: FieldDefinition): TableBuilder;
892
+ /**
893
+ * Remove a field by name
894
+ */
895
+ removeField(name: string): TableBuilder;
896
+ /**
897
+ * Get current fields
898
+ */
899
+ getFields(): FieldDefinition[];
900
+ /**
901
+ * Get current table name
902
+ */
903
+ getName(): string;
904
+ /**
905
+ * Get current description
906
+ */
907
+ getDescription(): string | undefined;
908
+ /**
909
+ * Build the table request object
910
+ */
911
+ build(): TableCreateRequest;
912
+ /**
913
+ * Build and create the table (requires API client)
914
+ */
915
+ create(options?: {
916
+ is_ai_generated_schema?: boolean;
917
+ is_template?: boolean;
918
+ }): Promise<BolticSuccessResponse_3<TableCreateResponse> | BolticErrorResponse_3>;
919
+ }
920
+
921
+ declare interface TableBuilderOptions {
922
+ name: string;
923
+ description?: string;
924
+ is_ai_generated_schema?: boolean;
925
+ }
926
+
927
+ declare interface TableCreateOptions {
928
+ is_ai_generated_schema?: boolean;
929
+ is_template?: boolean;
930
+ }
931
+
932
+ declare interface TableCreateRequest {
933
+ name: string;
934
+ fields: FieldDefinition[];
935
+ description?: string;
936
+ is_ai_generated_schema?: boolean;
937
+ is_template?: boolean;
938
+ responseFields?: Array<keyof TableRecord>;
939
+ }
940
+
941
+ declare interface TableCreateResponse {
942
+ id: string;
943
+ message: string;
944
+ }
945
+
946
+ declare interface TableListOptions extends TableQueryOptions {
947
+ page?: number;
948
+ pageSize?: number;
949
+ isShared?: boolean;
950
+ }
951
+
952
+ declare interface TableQueryOptions {
953
+ where?: {
954
+ id?: string;
955
+ name?: string;
956
+ db_id?: string;
957
+ is_public?: boolean;
958
+ created_by?: string;
959
+ created_at?: {
960
+ $gte?: string;
961
+ $lte?: string;
962
+ $between?: [string, string];
963
+ };
964
+ };
965
+ fields?: Array<keyof TableRecord>;
966
+ sort?: Array<{
967
+ field: keyof TableRecord;
968
+ order: 'asc' | 'desc';
969
+ }>;
970
+ limit?: number;
971
+ offset?: number;
972
+ }
973
+
974
+ declare interface TableRecord {
975
+ id: string;
976
+ name: string;
977
+ account_id: string;
978
+ internal_table_name: string;
979
+ internal_db_name: string;
980
+ db_id?: string;
981
+ resource_id?: string;
982
+ description?: string;
983
+ type?: string;
984
+ parent_table_id?: string;
985
+ is_deleted: boolean;
986
+ is_public: boolean;
987
+ created_by: string;
988
+ created_at: string;
989
+ updated_at: string;
990
+ updated_by: string;
991
+ snapshot_url?: string;
992
+ account_status: 'active' | 'inactive' | 'deleted';
993
+ source?: 'boltic' | 'copilot';
994
+ }
995
+
996
+ /**
997
+ * Tables API Client - handles all table-related API operations
998
+ */
999
+ declare class TablesApiClient {
1000
+ private httpAdapter;
1001
+ private config;
1002
+ private baseURL;
1003
+ constructor(apiKey: string, config?: Omit<TablesApiClientConfig, 'apiKey'>);
1004
+ private getBaseURL;
1005
+ /**
1006
+ * Create a new table
1007
+ */
1008
+ createTable(request: TableCreateRequest, options?: TableCreateOptions): Promise<BolticSuccessResponse_2<TableCreateResponse> | BolticErrorResponse_2>;
1009
+ /**
1010
+ * List tables with filtering and pagination
1011
+ */
1012
+ listTables(options?: TableListOptions): Promise<BolticListResponse_2<TableRecord> | BolticErrorResponse_2>;
1013
+ /**
1014
+ * Get a specific table by ID
1015
+ */
1016
+ getTable(tableId: string, options?: {
1017
+ fields?: Array<keyof TableRecord>;
1018
+ }): Promise<BolticSuccessResponse_2<TableRecord> | BolticErrorResponse_2>;
1019
+ /**
1020
+ * Update an existing table
1021
+ */
1022
+ updateTable(tableId: string, updates: {
1023
+ name?: string;
1024
+ description?: string;
1025
+ is_shared?: boolean;
1026
+ fields?: Array<keyof TableRecord>;
1027
+ }): Promise<BolticSuccessResponse_2<TableRecord> | BolticErrorResponse_2>;
1028
+ /**
1029
+ * Delete a table
1030
+ */
1031
+ deleteTable(tableId: string): Promise<BolticSuccessResponse_2<{
1032
+ message: string;
1033
+ }> | BolticErrorResponse_2>;
1034
+ private buildHeaders;
1035
+ private formatErrorResponse;
1036
+ }
1037
+
1038
+ declare interface TablesApiClientConfig {
1039
+ apiKey: string;
1040
+ environment?: Environment;
1041
+ region?: Region;
1042
+ timeout?: number;
1043
+ debug?: boolean;
1044
+ retryAttempts?: number;
1045
+ retryDelay?: number;
1046
+ headers?: Record<string, string>;
1047
+ }
1048
+
1049
+ declare interface TableUpdateRequest {
1050
+ name?: string;
1051
+ description?: string;
1052
+ is_shared?: boolean;
1053
+ fields?: Array<keyof TableRecord>;
1054
+ }
1055
+
1056
+ export declare const TEST_UTILS_VERSION = "1.0.0";
1057
+
1058
+ declare interface TextToSQLOptions {
1059
+ currentQuery?: string;
1060
+ }
1061
+
1062
+ declare const TimeFormatEnum: Readonly<{
1063
+ HH_mm_ss: "%H:%M:%S";
1064
+ HH_mm_ssZ: "%H:%M:%SZ";
1065
+ HH_mm_ss_SSS: "%H:%M:%S.%f";
1066
+ HH_mm_ss__Z: "%H:%M:%S %Z";
1067
+ HH_mm__AMPM: "%I:%M %p";
1068
+ HH_mm_ss__AMPM: "%I:%M:%S %p";
1069
+ }>;
1070
+
1071
+ declare interface TokenInfo {
1072
+ token: string;
1073
+ expiresAt?: Date;
1074
+ isValid: boolean;
1075
+ }
1076
+
1077
+ export { }