@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,1087 @@
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
+ export declare type ApiResponse<T> = BolticSuccessResponse<T> | BolticListResponse<T> | BolticErrorResponse;
13
+
14
+ export declare interface AuthConfig {
15
+ apiKey: string;
16
+ tokenRefreshThreshold?: number;
17
+ maxRetries?: number;
18
+ }
19
+
20
+ declare interface AuthConfig_2 {
21
+ apiKey: string;
22
+ tokenRefreshThreshold?: number;
23
+ maxRetries?: number;
24
+ }
25
+
26
+ export declare interface AuthHeaders {
27
+ 'x-boltic-token': string;
28
+ 'x-boltic-service'?: string;
29
+ [key: string]: string | undefined;
30
+ }
31
+
32
+ declare interface AuthHeaders_2 {
33
+ 'x-boltic-token': string;
34
+ [key: string]: string;
35
+ }
36
+
37
+ export declare class AuthManager {
38
+ private config;
39
+ private tokenInfo;
40
+ constructor(config: AuthConfig);
41
+ private validateApiKey;
42
+ getAuthHeaders(): AuthHeaders;
43
+ updateApiKey(newApiKey: string): void;
44
+ isAuthenticated(): boolean;
45
+ validateApiKeyAsync(): Promise<boolean>;
46
+ getTokenInfo(): TokenInfo | null;
47
+ getServiceHeaders(service?: string): AuthHeaders;
48
+ validateForService(): Promise<boolean>;
49
+ }
50
+
51
+ declare class AuthManager_2 {
52
+ private config;
53
+ private tokenInfo;
54
+ constructor(config: AuthConfig_2);
55
+ private validateApiKey;
56
+ getAuthHeaders(): AuthHeaders_2;
57
+ updateApiKey(newApiKey: string): void;
58
+ isAuthenticated(): boolean;
59
+ validateApiKeyAsync(): Promise<boolean>;
60
+ getTokenInfo(): TokenInfo_2 | null;
61
+ getMaxRetries(): number;
62
+ toString(): string;
63
+ toJSON(): object;
64
+ }
65
+
66
+ declare class BaseClient {
67
+ private httpAdapter;
68
+ private authManager;
69
+ private interceptors;
70
+ private config;
71
+ constructor(config: ClientConfig, authManager: AuthManager_2);
72
+ private setupDefaultInterceptors;
73
+ private handleError;
74
+ request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
75
+ get<T = unknown>(url: string, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
76
+ post<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
77
+ put<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
78
+ patch<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
79
+ delete<T = unknown>(url: string, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
80
+ getInterceptors(): InterceptorManagerImpl;
81
+ updateConfig(updates: Partial<ClientConfig>): void;
82
+ getConfig(): ClientConfig;
83
+ }
84
+
85
+ export declare class BolticClient {
86
+ private configManager;
87
+ private authManager;
88
+ private baseClient;
89
+ private tableResource;
90
+ private columnResource;
91
+ private recordResource;
92
+ private sqlResource;
93
+ private currentDatabase;
94
+ private clientOptions;
95
+ constructor(apiKey: string, options?: ClientOptions);
96
+ getCurrentDatabase(): DatabaseContext | null;
97
+ get tables(): {
98
+ create: (data: TableCreateRequest) => Promise<BolticSuccessResponse<TableCreateResponse>>;
99
+ findAll: (options?: TableQueryOptions) => Promise<ApiResponse<TableRecord>>;
100
+ findById: (id: string) => Promise<BolticErrorResponse | BolticSuccessResponse<TableRecord | null>>;
101
+ findByName: (name: string) => Promise<BolticErrorResponse | BolticSuccessResponse<TableRecord | null>>;
102
+ findOne: (options: TableQueryOptions) => Promise<BolticErrorResponse | BolticSuccessResponse<TableRecord | null>>;
103
+ update: (name: string, data: TableUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<TableRecord>>;
104
+ delete: (name: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
105
+ message: string;
106
+ }>>;
107
+ rename: (oldName: string, newName: string) => Promise<BolticSuccessResponse<TableRecord>>;
108
+ setAccess: (request: {
109
+ table_name: string;
110
+ is_shared: boolean;
111
+ }) => Promise<BolticSuccessResponse<TableRecord>>;
112
+ };
113
+ get columns(): {
114
+ create: (tableName: string, column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
115
+ createMany: (tableName: string, columns: FieldDefinition[]) => Promise<BolticErrorResponse | BolticListResponse<ColumnRecord>>;
116
+ findAll: (tableName: string, options?: ColumnQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<ColumnDetails>>;
117
+ findOne: (tableName: string, columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
118
+ findById: (tableName: string, columnId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
119
+ update: (tableName: string, columnName: string, updates: ColumnUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
120
+ delete: (tableName: string, columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
121
+ success: boolean;
122
+ message?: string | undefined;
123
+ }>>;
124
+ };
125
+ table(name: string): TableBuilder;
126
+ from(tableName: string): {
127
+ columns: () => {
128
+ create: (column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
129
+ findAll: (options?: ColumnQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<ColumnDetails>>;
130
+ get: (columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
131
+ update: (columnName: string, updates: ColumnUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
132
+ delete: (columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
133
+ success: boolean;
134
+ message?: string | undefined;
135
+ }>>;
136
+ };
137
+ records: () => {
138
+ insert: (data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
139
+ insertMany: (records: RecordData[], options?: {
140
+ validation?: boolean;
141
+ }) => Promise<RecordBulkInsertResponse | BolticErrorResponse>;
142
+ findOne: (recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
143
+ update: (options: RecordUpdateOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
144
+ updateById: (recordId: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
145
+ delete: (options: RecordDeleteOptions) => Promise<BolticErrorResponse | BolticSuccessResponse< {
146
+ message: string;
147
+ }>>;
148
+ deleteById: (recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
149
+ message: string;
150
+ }>>;
151
+ };
152
+ record: () => RecordBuilder;
153
+ };
154
+ get records(): {
155
+ insert: (tableName: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
156
+ insertMany: (tableName: string, records: RecordData[], options?: {
157
+ validation?: boolean;
158
+ }) => Promise<RecordBulkInsertResponse | BolticErrorResponse>;
159
+ findAll: (tableName: string, options?: RecordQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
160
+ findOne: (tableName: string, recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
161
+ update: (tableName: string, options: RecordUpdateOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
162
+ updateById: (tableName: string, recordId: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
163
+ delete: (tableName: string, options: RecordDeleteOptions) => Promise<BolticErrorResponse | BolticSuccessResponse< {
164
+ message: string;
165
+ }>>;
166
+ deleteById: (tableName: string, recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
167
+ message: string;
168
+ }>>;
169
+ };
170
+ record(tableName: string): RecordBuilder;
171
+ get sql(): {
172
+ textToSQL: (prompt: string, options?: TextToSQLOptions) => Promise<AsyncIterable<string>>;
173
+ executeSQL: (query: string) => Promise<BolticErrorResponse | ExecuteSQLApiResponse>;
174
+ };
175
+ getSqlResource(): SqlResource;
176
+ updateApiKey(newApiKey: string): void;
177
+ updateConfig(updates: Partial<ClientConfig>): void;
178
+ getConfig(): ClientConfig;
179
+ validateApiKey(): Promise<boolean>;
180
+ isAuthenticated(): boolean;
181
+ getHttpClient(): BaseClient;
182
+ addRequestInterceptor(interceptor: (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>): number;
183
+ addResponseInterceptor(onFulfilled?: (response: HttpResponse) => HttpResponse | Promise<HttpResponse>, onRejected?: (error: unknown) => unknown): number;
184
+ ejectRequestInterceptor(id: number): void;
185
+ ejectResponseInterceptor(id: number): void;
186
+ testConnection(): Promise<boolean>;
187
+ getVersion(): string;
188
+ getEnvironment(): Environment;
189
+ getRegion(): string;
190
+ enableDebug(): void;
191
+ disableDebug(): void;
192
+ isDebugEnabled(): boolean;
193
+ private updateAllResourcesConfig;
194
+ toString(): string;
195
+ toJSON(): object;
196
+ }
197
+
198
+ export declare interface BolticErrorResponse {
199
+ data?: never;
200
+ message?: string;
201
+ error: {
202
+ code?: string;
203
+ message?: string;
204
+ meta?: string[];
205
+ };
206
+ }
207
+
208
+ declare interface BolticErrorResponse_2 {
209
+ data?: never;
210
+ error: {
211
+ code?: string;
212
+ message?: string;
213
+ meta?: string[];
214
+ };
215
+ }
216
+
217
+ export declare interface BolticListResponse<T> {
218
+ data: T[];
219
+ pagination?: {
220
+ total_count: number;
221
+ total_pages: number;
222
+ current_page: number;
223
+ per_page: number;
224
+ type: string;
225
+ };
226
+ message?: string;
227
+ error?: {
228
+ code?: string;
229
+ message?: string;
230
+ meta?: string[];
231
+ };
232
+ }
233
+
234
+ declare interface BolticListResponse_2<T = unknown> {
235
+ data: T[];
236
+ pagination?: {
237
+ total_count: number;
238
+ total_pages: number;
239
+ current_page: number;
240
+ per_page: number;
241
+ type: string;
242
+ };
243
+ message?: string;
244
+ }
245
+
246
+ export declare interface BolticSuccessResponse<T> {
247
+ data: T;
248
+ message?: string;
249
+ error?: {
250
+ code?: string;
251
+ message?: string;
252
+ meta?: string[];
253
+ };
254
+ }
255
+
256
+ declare interface BolticSuccessResponse_2<T = unknown> {
257
+ data: T;
258
+ message?: string;
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
+ export 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 createClient(apiKey: string, options?: ClientOptions): BolticClient;
359
+
360
+ /**
361
+ * Utility functions for working with standard Error classes
362
+ */
363
+ /**
364
+ * Creates a structured error object with additional context
365
+ */
366
+ export declare function createErrorWithContext(message: string, context?: Record<string, unknown>): Error;
367
+
368
+ declare interface DatabaseContext {
369
+ databaseName: string;
370
+ }
371
+
372
+ declare const DateFormatEnum: Readonly<{
373
+ MMDDYY: "%m/%d/%y";
374
+ MMDDYYYY: "%m/%d/%Y";
375
+ MM_DD_YYYY: "%m-%d-%Y";
376
+ DD_MM_YYYY: "%d-%m-%Y";
377
+ DDMMYYYY: "%d/%m/%Y";
378
+ DDMMYY: "%d/%m/%y";
379
+ YYYY_MM_DD: "%Y-%m-%d";
380
+ MMMM__DD__YYYY: "%B %d %Y";
381
+ MMM__DD__YYYY: "%b %d %Y";
382
+ ddd__MMM__DD__YYYY: "%a %b %d %Y";
383
+ }>;
384
+
385
+ declare type DecimalType = '00' | '0.0' | '0.00' | '0.000' | '0.0000' | '0.00000' | '0.000000';
386
+
387
+ declare type Environment = 'local' | 'sit' | 'uat' | 'prod';
388
+
389
+ declare interface EnvironmentConfig {
390
+ baseURL: string;
391
+ timeout: number;
392
+ retryAttempts?: number;
393
+ debug?: boolean;
394
+ }
395
+
396
+ declare type ErrorInterceptor = (error: unknown) => unknown | Promise<unknown>;
397
+
398
+ declare interface ExecuteSQLApiResponse {
399
+ data: [
400
+ Record<string, unknown>[],
401
+ unknown
402
+ ];
403
+ pagination?: {
404
+ total_count: number;
405
+ total_pages: number;
406
+ current_page: number;
407
+ per_page: number;
408
+ type: string;
409
+ };
410
+ message?: string;
411
+ error?: {
412
+ code?: string;
413
+ message?: string;
414
+ meta?: string[];
415
+ };
416
+ }
417
+
418
+ export declare interface FieldDefinition {
419
+ name: string;
420
+ type: FieldType;
421
+ is_nullable?: boolean;
422
+ is_primary_key?: boolean;
423
+ is_unique?: boolean;
424
+ is_indexed?: boolean;
425
+ is_visible?: boolean;
426
+ is_readonly?: boolean;
427
+ field_order?: number;
428
+ description?: string;
429
+ default_value?: unknown;
430
+ alignment?: 'left' | 'center' | 'right';
431
+ timezone?: string;
432
+ date_format?: string;
433
+ time_format?: string;
434
+ decimals?: string;
435
+ currency_format?: string;
436
+ selection_source?: string;
437
+ selectable_items?: string[];
438
+ multiple_selections?: boolean;
439
+ phone_format?: string;
440
+ vector_dimension?: number;
441
+ }
442
+
443
+ export declare type FieldType = 'text' | 'long-text' | 'number' | 'currency' | 'checkbox' | 'dropdown' | 'email' | 'phone-number' | 'link' | 'json' | 'date-time' | 'vector' | 'halfvec' | 'sparsevec';
444
+
445
+ /**
446
+ * Formats error for logging/debugging
447
+ */
448
+ export declare function formatError(error: unknown): string;
449
+
450
+ /**
451
+ * Extracts HTTP status code from axios or fetch errors
452
+ */
453
+ export declare function getHttpStatusCode(error: unknown): number | null;
454
+
455
+ declare interface HttpRequestConfig {
456
+ url: string;
457
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
458
+ headers?: Record<string, string>;
459
+ params?: Record<string, unknown>;
460
+ data?: unknown;
461
+ timeout?: number;
462
+ signal?: AbortSignal;
463
+ }
464
+
465
+ declare interface HttpResponse<T = unknown> {
466
+ data: T;
467
+ status: number;
468
+ statusText: string;
469
+ headers: Record<string, string>;
470
+ }
471
+
472
+ declare interface InterceptorManager {
473
+ request: {
474
+ use(interceptor: RequestInterceptor): number;
475
+ eject(id: number): void;
476
+ };
477
+ response: {
478
+ use(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
479
+ eject(id: number): void;
480
+ };
481
+ }
482
+
483
+ declare class InterceptorManagerImpl implements InterceptorManager {
484
+ private requestInterceptors;
485
+ private responseInterceptors;
486
+ private nextId;
487
+ request: {
488
+ use: (interceptor: RequestInterceptor) => number;
489
+ eject: (id: number) => void;
490
+ };
491
+ response: {
492
+ use: (onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor) => number;
493
+ eject: (id: number) => void;
494
+ };
495
+ executeRequestInterceptors(config: HttpRequestConfig): Promise<HttpRequestConfig>;
496
+ executeResponseInterceptors(response: HttpResponse): Promise<HttpResponse>;
497
+ executeErrorInterceptors(error: unknown): Promise<unknown>;
498
+ }
499
+
500
+ export declare function isErrorResponse<T>(response: ApiResponse<T>): response is BolticErrorResponse;
501
+
502
+ export declare function isListResponse<T>(response: ApiResponse<T>): response is BolticListResponse<T>;
503
+
504
+ /**
505
+ * Checks if an error is a network/HTTP related error
506
+ */
507
+ export declare function isNetworkError(error: unknown): error is Error;
508
+
509
+ declare type PhoneFormatType = '+91 123 456 7890' | '(123) 456-7890' | '+1 (123) 456-7890' | '+91 12 3456 7890';
510
+
511
+ export declare interface QueryOperator<T = unknown> {
512
+ $eq?: T;
513
+ $ne?: T;
514
+ $gt?: T;
515
+ $gte?: T;
516
+ $lt?: T;
517
+ $lte?: T;
518
+ $in?: T[];
519
+ $nin?: T[];
520
+ $like?: string;
521
+ $ilike?: string;
522
+ $between?: [T, T];
523
+ $null?: boolean;
524
+ $exists?: boolean;
525
+ }
526
+
527
+ /**
528
+ * Record Builder - provides a fluent interface for building record queries and operations
529
+ */
530
+ declare class RecordBuilder {
531
+ private tableName;
532
+ private recordResource;
533
+ private queryOptions;
534
+ private updateData;
535
+ constructor(options: RecordBuilderOptions);
536
+ /**
537
+ * Add filter conditions
538
+ */
539
+ where(conditions: Record<string, unknown>): RecordBuilder;
540
+ /**
541
+ * Set sorting
542
+ */
543
+ orderBy(field: string, direction?: 'asc' | 'desc'): RecordBuilder;
544
+ /**
545
+ * Set limit (using page)
546
+ */
547
+ limit(count: number): RecordBuilder;
548
+ /**
549
+ * Set offset (using page)
550
+ */
551
+ offset(count: number): RecordBuilder;
552
+ /**
553
+ * Set fields to select
554
+ */
555
+ select(fields: string[]): RecordBuilder;
556
+ /**
557
+ * Set data for update operations
558
+ */
559
+ set(data: RecordData): RecordBuilder;
560
+ /**
561
+ * Set pagination
562
+ */
563
+ page(pageNo: number, pageSize?: number): RecordBuilder;
564
+ /**
565
+ * Execute list operation (was findAll)
566
+ */
567
+ list(): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
568
+ /**
569
+ * Execute findAll operation (alias for list)
570
+ */
571
+ findAll(): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
572
+ /**
573
+ * Execute findOne operation by getting first result from list
574
+ */
575
+ findOne(): Promise<BolticSuccessResponse<RecordWithId | null> | BolticErrorResponse>;
576
+ /**
577
+ * Build where conditions from filters for API consumption
578
+ */
579
+ private buildWhereConditions;
580
+ /**
581
+ * Execute update operation - requires filters or record IDs
582
+ */
583
+ update(): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
584
+ /**
585
+ * Execute update by ID operation
586
+ */
587
+ updateById(id: string): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
588
+ /**
589
+ * Execute delete by single ID operation
590
+ */
591
+ deleteById(id: string): Promise<BolticSuccessResponse<{
592
+ message: string;
593
+ }> | BolticErrorResponse>;
594
+ /**
595
+ * Execute delete by IDs operation
596
+ */
597
+ deleteByIds(ids: string[]): Promise<BolticSuccessResponse<{
598
+ message: string;
599
+ }> | BolticErrorResponse>;
600
+ /**
601
+ * Execute delete operation using filters
602
+ */
603
+ delete(): Promise<BolticSuccessResponse<{
604
+ message: string;
605
+ }> | BolticErrorResponse>;
606
+ /**
607
+ * Get the built query options (for debugging)
608
+ */
609
+ getQueryOptions(): RecordQueryOptions;
610
+ /**
611
+ * Get the update data (for debugging)
612
+ */
613
+ getUpdateData(): RecordData;
614
+ /**
615
+ * Execute insert operation
616
+ */
617
+ insert(data: RecordData): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
618
+ }
619
+
620
+ declare interface RecordBuilderOptions {
621
+ tableName: string;
622
+ recordResource: RecordResource;
623
+ }
624
+
625
+ declare interface RecordBulkInsertOptions {
626
+ validation?: boolean;
627
+ }
628
+
629
+ declare interface RecordBulkInsertResponse {
630
+ data: {
631
+ records: RecordWithId[];
632
+ insert_count: number;
633
+ };
634
+ message?: string;
635
+ error?: {
636
+ code?: string;
637
+ message?: string;
638
+ meta?: string[];
639
+ };
640
+ }
641
+
642
+ export declare interface RecordData {
643
+ [fieldName: string]: unknown;
644
+ fields?: string[];
645
+ }
646
+
647
+ declare interface RecordDeleteOptions {
648
+ record_ids?: string[];
649
+ filters?: ApiFilter[] | Record<string, unknown>;
650
+ }
651
+
652
+ declare interface RecordQueryOptions {
653
+ page?: {
654
+ page_no: number;
655
+ page_size: number;
656
+ };
657
+ filters?: ApiFilter[] | Record<string, unknown>[];
658
+ sort?: Record<string, unknown>[];
659
+ fields?: string[];
660
+ }
661
+
662
+ declare class RecordResource {
663
+ private apiClient;
664
+ private tablesApiClient;
665
+ private client;
666
+ constructor(client: BaseClient);
667
+ /**
668
+ * Insert a single record
669
+ */
670
+ insert(tableName: string, data: RecordData): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
671
+ /**
672
+ * Insert multiple records in bulk
673
+ */
674
+ insertMany(tableName: string, records: RecordData[], options?: RecordBulkInsertOptions): Promise<RecordBulkInsertResponse | BolticErrorResponse>;
675
+ /**
676
+ * Get a single record by ID
677
+ */
678
+ get(tableName: string, recordId: string): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
679
+ /**
680
+ * List records with filtering and pagination
681
+ */
682
+ list(tableName: string, options?: RecordQueryOptions): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
683
+ /**
684
+ * Update records by filters
685
+ */
686
+ update(tableName: string, options: RecordUpdateOptions): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
687
+ /**
688
+ * Update a single record by ID
689
+ */
690
+ updateById(tableName: string, recordId: string, data: RecordData): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
691
+ /**
692
+ * Unified delete method that supports both record IDs and filters
693
+ */
694
+ delete(tableName: string, options: RecordDeleteOptions): Promise<BolticSuccessResponse<{
695
+ message: string;
696
+ }> | BolticErrorResponse>;
697
+ /**
698
+ * Delete a single record by ID
699
+ */
700
+ deleteById(tableName: string, recordId: string): Promise<BolticSuccessResponse<{
701
+ message: string;
702
+ }> | BolticErrorResponse>;
703
+ /**
704
+ * Helper method to get table information by name
705
+ */
706
+ private getTableInfo;
707
+ /**
708
+ * Helper method to ensure all required fields for a record are present,
709
+ * filling missing ones with null.
710
+ */
711
+ private ensureCompleteRecordData;
712
+ }
713
+
714
+ declare interface RecordUpdateOptions {
715
+ set: RecordData;
716
+ filters: ApiFilter[] | Record<string, unknown>[];
717
+ fields?: string[];
718
+ }
719
+
720
+ export declare interface RecordWithId extends RecordData {
721
+ id: string;
722
+ created_at?: string;
723
+ updated_at?: string;
724
+ }
725
+
726
+ export declare type Region = 'asia-south1' | 'us-central1';
727
+
728
+ declare type RequestInterceptor = (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
729
+
730
+ declare type ResponseInterceptor = (response: HttpResponse) => HttpResponse | Promise<HttpResponse>;
731
+
732
+ export declare interface ServiceAuthConfig extends AuthConfig {
733
+ service: string;
734
+ serviceEndpoint?: string;
735
+ }
736
+
737
+ declare class SqlResource {
738
+ private sqlApiClient;
739
+ constructor(client: BaseClient);
740
+ /**
741
+ * Convert natural language to SQL query
742
+ * Returns streaming results for real-time query generation
743
+ *
744
+ * @param prompt - Natural language description of the desired query
745
+ * @param options - Optional parameters including currentQuery for refinement
746
+ * @returns AsyncIterable<string> for streaming SQL generation
747
+ *
748
+ */
749
+ textToSQL(prompt: string, options?: TextToSQLOptions): Promise<AsyncIterable<string>>;
750
+ /**
751
+ * Execute SQL query with built-in safety measures and performance optimization
752
+ *
753
+ * @param query - SQL query string to execute
754
+ * @returns Promise<ExecuteSQLApiResponse> with raw API response following Boltic API Response Structure
755
+ *
756
+ */
757
+ executeSQL(query: string): Promise<ExecuteSQLApiResponse | BolticErrorResponse>;
758
+ }
759
+
760
+ /**
761
+ * Table Builder - provides a fluent interface for creating tables
762
+ */
763
+ declare class TableBuilder {
764
+ private tableName;
765
+ private description?;
766
+ private isPublic;
767
+ private fields;
768
+ private tablesApiClient?;
769
+ constructor(options: TableBuilderOptions, tablesApiClient?: TablesApiClient);
770
+ /**
771
+ * Set table name
772
+ */
773
+ name(name: string): TableBuilder;
774
+ /**
775
+ * Set table description
776
+ */
777
+ describe(description: string): TableBuilder;
778
+ /**
779
+ * Set if table is public
780
+ */
781
+ public(isPublic?: boolean): TableBuilder;
782
+ /**
783
+ * Add a text field
784
+ */
785
+ text(name: string, options?: {
786
+ nullable?: boolean;
787
+ unique?: boolean;
788
+ indexed?: boolean;
789
+ defaultValue?: string;
790
+ description?: string;
791
+ alignment?: 'left' | 'center' | 'right';
792
+ }): TableBuilder;
793
+ /**
794
+ * Add a long text field
795
+ */
796
+ longText(name: string, options?: {
797
+ nullable?: boolean;
798
+ description?: string;
799
+ alignment?: 'left' | 'center' | 'right';
800
+ }): TableBuilder;
801
+ /**
802
+ * Add a number field
803
+ */
804
+ number(name: string, options?: {
805
+ nullable?: boolean;
806
+ unique?: boolean;
807
+ indexed?: boolean;
808
+ defaultValue?: number;
809
+ description?: string;
810
+ decimals?: string;
811
+ alignment?: 'left' | 'center' | 'right';
812
+ }): TableBuilder;
813
+ /**
814
+ * Add a currency field
815
+ */
816
+ currency(name: string, options?: {
817
+ nullable?: boolean;
818
+ defaultValue?: number;
819
+ description?: string;
820
+ currencyFormat?: string;
821
+ decimals?: string;
822
+ }): TableBuilder;
823
+ /**
824
+ * Add a checkbox field
825
+ */
826
+ checkbox(name: string, options?: {
827
+ nullable?: boolean;
828
+ defaultValue?: boolean;
829
+ description?: string;
830
+ }): TableBuilder;
831
+ /**
832
+ * Add a dropdown field
833
+ */
834
+ dropdown(name: string, items: string[], options?: {
835
+ nullable?: boolean;
836
+ multiple?: boolean;
837
+ defaultValue?: string | string[];
838
+ description?: string;
839
+ }): TableBuilder;
840
+ /**
841
+ * Add an email field
842
+ */
843
+ email(name: string, options?: {
844
+ nullable?: boolean;
845
+ unique?: boolean;
846
+ indexed?: boolean;
847
+ description?: string;
848
+ }): TableBuilder;
849
+ /**
850
+ * Add a phone number field
851
+ */
852
+ phone(name: string, options?: {
853
+ nullable?: boolean;
854
+ description?: string;
855
+ format?: string;
856
+ }): TableBuilder;
857
+ /**
858
+ * Add a link field
859
+ */
860
+ link(name: string, options?: {
861
+ nullable?: boolean;
862
+ description?: string;
863
+ }): TableBuilder;
864
+ /**
865
+ * Add a JSON field
866
+ */
867
+ json(name: string, options?: {
868
+ nullable?: boolean;
869
+ description?: string;
870
+ }): TableBuilder;
871
+ /**
872
+ * Add a date-time field
873
+ */
874
+ dateTime(name: string, options?: {
875
+ nullable?: boolean;
876
+ description?: string;
877
+ dateFormat?: string;
878
+ timeFormat?: string;
879
+ timezone?: string;
880
+ }): TableBuilder;
881
+ /**
882
+ * Add a vector field
883
+ */
884
+ vector(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<TableCreateResponse> | BolticErrorResponse>;
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
+ export 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
+ export 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
+ declare interface TextToSQLOptions {
1057
+ currentQuery?: string;
1058
+ }
1059
+
1060
+ declare const TimeFormatEnum: Readonly<{
1061
+ HH_mm_ss: "%H:%M:%S";
1062
+ HH_mm_ssZ: "%H:%M:%SZ";
1063
+ HH_mm_ss_SSS: "%H:%M:%S.%f";
1064
+ HH_mm_ss__Z: "%H:%M:%S %Z";
1065
+ HH_mm__AMPM: "%I:%M %p";
1066
+ HH_mm_ss__AMPM: "%I:%M:%S %p";
1067
+ }>;
1068
+
1069
+ export declare interface TokenInfo {
1070
+ token: string;
1071
+ expiresAt?: Date;
1072
+ isValid: boolean;
1073
+ }
1074
+
1075
+ declare interface TokenInfo_2 {
1076
+ token: string;
1077
+ expiresAt?: Date;
1078
+ isValid: boolean;
1079
+ }
1080
+
1081
+ export declare const VERSION = "1.0.0";
1082
+
1083
+ export declare interface WhereCondition {
1084
+ [fieldName: string]: unknown | QueryOperator;
1085
+ }
1086
+
1087
+ export { }