@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.
- package/LICENSE +21 -0
- package/README.md +1012 -0
- package/dist/databases/index.d.ts +1560 -0
- package/dist/databases/index.js +2 -0
- package/dist/databases/index.js.map +1 -0
- package/dist/databases/index.mjs +523 -0
- package/dist/databases/index.mjs.map +1 -0
- package/dist/databases/test-client-BM9X5DH9.mjs +4053 -0
- package/dist/databases/test-client-BM9X5DH9.mjs.map +1 -0
- package/dist/databases/test-client-D-SuKCUC.js +2 -0
- package/dist/databases/test-client-D-SuKCUC.js.map +1 -0
- package/dist/databases/testing.d.ts +1077 -0
- package/dist/databases/testing.js +2 -0
- package/dist/databases/testing.js.map +1 -0
- package/dist/databases/testing.mjs +139 -0
- package/dist/databases/testing.mjs.map +1 -0
- package/dist/package.json +15 -0
- package/dist/sdk.js +3972 -0
- package/dist/sdk.js.map +1 -0
- package/dist/sdk.mjs +3972 -0
- package/dist/sdk.mjs.map +1 -0
- package/dist/types/index.d.ts +1087 -0
- package/package.json +82 -0
|
@@ -0,0 +1,1560 @@
|
|
|
1
|
+
export declare type AlignmentType = 'left' | 'right' | 'center';
|
|
2
|
+
|
|
3
|
+
declare type AlignmentType_2 = 'left' | 'center' | 'right';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* API error for HTTP/API related failures
|
|
7
|
+
*/
|
|
8
|
+
export declare class ApiError extends Error {
|
|
9
|
+
readonly statusCode: number;
|
|
10
|
+
readonly response?: unknown;
|
|
11
|
+
constructor(message: string, statusCode: number, response?: unknown);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Filter structure according to Tables Module PRD and backend buildWhereClause function
|
|
16
|
+
*/
|
|
17
|
+
export declare interface ApiFilter {
|
|
18
|
+
field: string;
|
|
19
|
+
operator: string;
|
|
20
|
+
values: unknown[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare type ApiResponse<T> = BolticSuccessResponse<T> | BolticListResponse<T> | BolticErrorResponse;
|
|
24
|
+
|
|
25
|
+
export declare interface AuthConfig {
|
|
26
|
+
apiKey: string;
|
|
27
|
+
tokenRefreshThreshold?: number;
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare interface AuthHeaders {
|
|
32
|
+
'x-boltic-token': string;
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class AuthManager {
|
|
37
|
+
private config;
|
|
38
|
+
private tokenInfo;
|
|
39
|
+
constructor(config: AuthConfig);
|
|
40
|
+
private validateApiKey;
|
|
41
|
+
getAuthHeaders(): AuthHeaders;
|
|
42
|
+
updateApiKey(newApiKey: string): void;
|
|
43
|
+
isAuthenticated(): boolean;
|
|
44
|
+
validateApiKeyAsync(): Promise<boolean>;
|
|
45
|
+
getTokenInfo(): TokenInfo | null;
|
|
46
|
+
getMaxRetries(): number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare class BaseClient {
|
|
50
|
+
private httpAdapter;
|
|
51
|
+
private authManager;
|
|
52
|
+
private interceptors;
|
|
53
|
+
private config;
|
|
54
|
+
constructor(config: ClientConfig, authManager: AuthManager);
|
|
55
|
+
private setupDefaultInterceptors;
|
|
56
|
+
private handleError;
|
|
57
|
+
request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
58
|
+
get<T = unknown>(url: string, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
|
|
59
|
+
post<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
|
|
60
|
+
put<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
|
|
61
|
+
patch<T = unknown>(url: string, data?: unknown, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
|
|
62
|
+
delete<T = unknown>(url: string, config?: Partial<HttpRequestConfig>): Promise<HttpResponse<T>>;
|
|
63
|
+
getInterceptors(): InterceptorManagerImpl;
|
|
64
|
+
updateConfig(updates: Partial<ClientConfig>): void;
|
|
65
|
+
getConfig(): ClientConfig;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare abstract class BaseResource {
|
|
69
|
+
protected client: BaseClient;
|
|
70
|
+
protected basePath: string;
|
|
71
|
+
constructor(client: BaseClient, basePath: string);
|
|
72
|
+
getBasePath(): string;
|
|
73
|
+
protected makeRequest<T>(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, data?: unknown, options?: {
|
|
74
|
+
params?: Record<string, unknown>;
|
|
75
|
+
}): Promise<ApiResponse<T>>;
|
|
76
|
+
protected buildQueryParams(options?: QueryOptions): Record<string, unknown>;
|
|
77
|
+
protected handleResponse<T>(response: ApiResponse<T>): ApiResponse<T>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare class BolticClient {
|
|
81
|
+
private configManager;
|
|
82
|
+
private authManager;
|
|
83
|
+
private baseClient;
|
|
84
|
+
private tableResource;
|
|
85
|
+
private columnResource;
|
|
86
|
+
private recordResource;
|
|
87
|
+
private sqlResource;
|
|
88
|
+
private currentDatabase;
|
|
89
|
+
private clientOptions;
|
|
90
|
+
constructor(apiKey: string, options?: ClientOptions);
|
|
91
|
+
getCurrentDatabase(): DatabaseContext | null;
|
|
92
|
+
get tables(): {
|
|
93
|
+
create: (data: TableCreateRequest) => Promise<BolticSuccessResponse<TableCreateResponse>>;
|
|
94
|
+
findAll: (options?: TableQueryOptions) => Promise<ApiResponse<TableRecord[]>>;
|
|
95
|
+
findById: (id: string) => Promise<BolticSuccessResponse<TableRecord | null>>;
|
|
96
|
+
findByName: (name: string) => Promise<BolticSuccessResponse<TableRecord | null>>;
|
|
97
|
+
findOne: (options: TableQueryOptions) => Promise<BolticSuccessResponse<TableRecord | null>>;
|
|
98
|
+
update: (name: string, data: TableUpdateRequest) => Promise<BolticSuccessResponse<TableRecord>>;
|
|
99
|
+
delete: (name: string) => Promise<BolticSuccessResponse< {
|
|
100
|
+
message: string;
|
|
101
|
+
}>>;
|
|
102
|
+
rename: (oldName: string, newName: string) => Promise<BolticSuccessResponse<TableRecord>>;
|
|
103
|
+
setAccess: (request: {
|
|
104
|
+
table_name: string;
|
|
105
|
+
is_shared: boolean;
|
|
106
|
+
}) => Promise<BolticSuccessResponse<TableRecord>>;
|
|
107
|
+
};
|
|
108
|
+
get columns(): {
|
|
109
|
+
create: (tableName: string, column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
|
|
110
|
+
createMany: (tableName: string, columns: FieldDefinition[]) => Promise<BolticErrorResponse | BolticListResponse<ColumnRecord>>;
|
|
111
|
+
findAll: (tableName: string, options?: ColumnQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<ColumnDetails>>;
|
|
112
|
+
findOne: (tableName: string, columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
|
|
113
|
+
findById: (tableName: string, columnId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
|
|
114
|
+
update: (tableName: string, columnName: string, updates: ColumnUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
|
|
115
|
+
delete: (tableName: string, columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
|
|
116
|
+
success: boolean;
|
|
117
|
+
message?: string | undefined;
|
|
118
|
+
}>>;
|
|
119
|
+
};
|
|
120
|
+
table(name: string): TableBuilder;
|
|
121
|
+
from(tableName: string): {
|
|
122
|
+
columns: () => {
|
|
123
|
+
create: (column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
|
|
124
|
+
findAll: (options?: ColumnQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<ColumnDetails>>;
|
|
125
|
+
get: (columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
|
|
126
|
+
update: (columnName: string, updates: ColumnUpdateRequest) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnDetails>>;
|
|
127
|
+
delete: (columnName: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
|
|
128
|
+
success: boolean;
|
|
129
|
+
message?: string | undefined;
|
|
130
|
+
}>>;
|
|
131
|
+
};
|
|
132
|
+
records: () => {
|
|
133
|
+
insert: (data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
|
|
134
|
+
findOne: (recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
|
|
135
|
+
update: (options: RecordUpdateOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
|
|
136
|
+
updateById: (recordId: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
|
|
137
|
+
delete: (options: RecordDeleteOptions) => Promise<BolticErrorResponse | BolticSuccessResponse< {
|
|
138
|
+
message: string;
|
|
139
|
+
}>>;
|
|
140
|
+
deleteById: (recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
|
|
141
|
+
message: string;
|
|
142
|
+
}>>;
|
|
143
|
+
};
|
|
144
|
+
record: () => RecordBuilder;
|
|
145
|
+
};
|
|
146
|
+
get records(): {
|
|
147
|
+
insert: (tableName: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
|
|
148
|
+
findAll: (tableName: string, options?: RecordQueryOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
|
|
149
|
+
findOne: (tableName: string, recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
|
|
150
|
+
update: (tableName: string, options: RecordUpdateOptions) => Promise<BolticErrorResponse | BolticListResponse<RecordWithId>>;
|
|
151
|
+
updateById: (tableName: string, recordId: string, data: RecordData) => Promise<BolticErrorResponse | BolticSuccessResponse<RecordWithId>>;
|
|
152
|
+
delete: (tableName: string, options: RecordDeleteOptions) => Promise<BolticErrorResponse | BolticSuccessResponse< {
|
|
153
|
+
message: string;
|
|
154
|
+
}>>;
|
|
155
|
+
deleteById: (tableName: string, recordId: string) => Promise<BolticErrorResponse | BolticSuccessResponse< {
|
|
156
|
+
message: string;
|
|
157
|
+
}>>;
|
|
158
|
+
};
|
|
159
|
+
record(tableName: string): RecordBuilder;
|
|
160
|
+
get sql(): {
|
|
161
|
+
textToSQL: (prompt: string, options?: TextToSQLOptions) => Promise<AsyncIterable<string>>;
|
|
162
|
+
executeSQL: (query: string) => Promise<ExecuteSQLApiResponse>;
|
|
163
|
+
};
|
|
164
|
+
getSqlResource(): SqlResource;
|
|
165
|
+
updateApiKey(newApiKey: string): void;
|
|
166
|
+
updateConfig(updates: Partial<ClientConfig>): void;
|
|
167
|
+
getConfig(): ClientConfig;
|
|
168
|
+
validateApiKey(): Promise<boolean>;
|
|
169
|
+
isAuthenticated(): boolean;
|
|
170
|
+
getHttpClient(): BaseClient;
|
|
171
|
+
addRequestInterceptor(interceptor: (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>): number;
|
|
172
|
+
addResponseInterceptor(onFulfilled?: (response: HttpResponse) => HttpResponse | Promise<HttpResponse>, onRejected?: (error: unknown) => unknown): number;
|
|
173
|
+
ejectRequestInterceptor(id: number): void;
|
|
174
|
+
ejectResponseInterceptor(id: number): void;
|
|
175
|
+
testConnection(): Promise<boolean>;
|
|
176
|
+
getVersion(): string;
|
|
177
|
+
getEnvironment(): Environment;
|
|
178
|
+
getRegion(): string;
|
|
179
|
+
enableDebug(): void;
|
|
180
|
+
disableDebug(): void;
|
|
181
|
+
isDebugEnabled(): boolean;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare interface BolticErrorResponse {
|
|
185
|
+
data?: {};
|
|
186
|
+
message?: string;
|
|
187
|
+
error: {
|
|
188
|
+
code?: string;
|
|
189
|
+
message?: string;
|
|
190
|
+
meta?: string[];
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare interface BolticErrorResponse_2 {
|
|
195
|
+
data: {};
|
|
196
|
+
error: {
|
|
197
|
+
code?: string;
|
|
198
|
+
message?: string;
|
|
199
|
+
meta?: string[];
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export declare interface BolticListResponse<T> {
|
|
204
|
+
data: T[];
|
|
205
|
+
pagination?: {
|
|
206
|
+
total_count: number;
|
|
207
|
+
total_pages: number;
|
|
208
|
+
current_page: number;
|
|
209
|
+
per_page: number;
|
|
210
|
+
type: string;
|
|
211
|
+
};
|
|
212
|
+
message?: string;
|
|
213
|
+
error?: {
|
|
214
|
+
code?: string;
|
|
215
|
+
message?: string;
|
|
216
|
+
meta?: string[];
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
declare interface BolticListResponse_2<T = unknown> {
|
|
221
|
+
data: T[];
|
|
222
|
+
pagination?: {
|
|
223
|
+
total_count: number;
|
|
224
|
+
total_pages: number;
|
|
225
|
+
current_page: number;
|
|
226
|
+
per_page: number;
|
|
227
|
+
type: string;
|
|
228
|
+
};
|
|
229
|
+
message?: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export declare interface BolticSuccessResponse<T> {
|
|
233
|
+
data: T;
|
|
234
|
+
message?: string;
|
|
235
|
+
error?: {
|
|
236
|
+
code?: string;
|
|
237
|
+
message?: string;
|
|
238
|
+
meta?: string[];
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare interface BolticSuccessResponse_2<T = unknown> {
|
|
243
|
+
data: T;
|
|
244
|
+
message?: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Build API filters with validation based on backend buildWhereClause
|
|
249
|
+
*/
|
|
250
|
+
export declare function buildApiFilters(whereOrFilters: WhereCondition_2 | ApiFilter[], whereOperator?: 'AND' | 'OR'): {
|
|
251
|
+
filters: ApiFilter[];
|
|
252
|
+
whereOperator: string;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export declare interface BulkResponse<T> {
|
|
256
|
+
success: T[];
|
|
257
|
+
failed: Array<{
|
|
258
|
+
item: unknown;
|
|
259
|
+
error: string;
|
|
260
|
+
}>;
|
|
261
|
+
summary: {
|
|
262
|
+
total: number;
|
|
263
|
+
successful: number;
|
|
264
|
+
failed: number;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare interface ClientConfig extends EnvironmentConfig {
|
|
269
|
+
apiKey: string;
|
|
270
|
+
environment: Environment;
|
|
271
|
+
region: Region;
|
|
272
|
+
headers?: Record<string, string>;
|
|
273
|
+
retryAttempts: number;
|
|
274
|
+
retryDelay: number;
|
|
275
|
+
maxRetries: number;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export declare interface ClientOptions extends Partial<EnvironmentConfig> {
|
|
279
|
+
environment?: Environment;
|
|
280
|
+
region?: 'asia-south1' | 'us-central1';
|
|
281
|
+
debug?: boolean;
|
|
282
|
+
retryAttempts?: number;
|
|
283
|
+
retryDelay?: number;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Column Builder - provides a fluent interface for building column queries and operations
|
|
288
|
+
*/
|
|
289
|
+
declare class ColumnBuilder {
|
|
290
|
+
private tableName;
|
|
291
|
+
private columnResource;
|
|
292
|
+
private queryOptions;
|
|
293
|
+
private updateData;
|
|
294
|
+
constructor(options: ColumnBuilderOptions);
|
|
295
|
+
/**
|
|
296
|
+
* Add filter conditions
|
|
297
|
+
*/
|
|
298
|
+
where(conditions: Partial<ColumnQueryOptions['where']>): ColumnBuilder;
|
|
299
|
+
/**
|
|
300
|
+
* Set sorting
|
|
301
|
+
*/
|
|
302
|
+
orderBy(field: keyof ColumnDetails, direction?: 'asc' | 'desc'): ColumnBuilder;
|
|
303
|
+
/**
|
|
304
|
+
* Set limit
|
|
305
|
+
*/
|
|
306
|
+
limit(count: number): ColumnBuilder;
|
|
307
|
+
/**
|
|
308
|
+
* Set offset
|
|
309
|
+
*/
|
|
310
|
+
offset(count: number): ColumnBuilder;
|
|
311
|
+
/**
|
|
312
|
+
* Set fields to select
|
|
313
|
+
*/
|
|
314
|
+
select(fields: Array<keyof ColumnDetails>): ColumnBuilder;
|
|
315
|
+
/**
|
|
316
|
+
* Set data for update operations
|
|
317
|
+
*/
|
|
318
|
+
set(data: ColumnUpdateRequest): ColumnBuilder;
|
|
319
|
+
/**
|
|
320
|
+
* Execute findAll operation
|
|
321
|
+
*/
|
|
322
|
+
findAll(): Promise<BolticListResponse<ColumnDetails> | BolticErrorResponse>;
|
|
323
|
+
/**
|
|
324
|
+
* Execute get operation (was findOne) - requires column name
|
|
325
|
+
*/
|
|
326
|
+
get(): Promise<BolticSuccessResponse<ColumnDetails> | BolticErrorResponse>;
|
|
327
|
+
/**
|
|
328
|
+
* Execute update operation - requires column name
|
|
329
|
+
*/
|
|
330
|
+
update(): Promise<BolticSuccessResponse<ColumnDetails> | BolticErrorResponse>;
|
|
331
|
+
/**
|
|
332
|
+
* Execute delete operation - requires column name
|
|
333
|
+
*/
|
|
334
|
+
delete(): Promise<BolticSuccessResponse<{
|
|
335
|
+
success: boolean;
|
|
336
|
+
message?: string;
|
|
337
|
+
}> | BolticErrorResponse>;
|
|
338
|
+
/**
|
|
339
|
+
* Get the built query options (for debugging)
|
|
340
|
+
*/
|
|
341
|
+
getQueryOptions(): ColumnQueryOptions;
|
|
342
|
+
/**
|
|
343
|
+
* Get the update data (for debugging)
|
|
344
|
+
*/
|
|
345
|
+
getUpdateData(): ColumnUpdateRequest;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
declare interface ColumnBuilderOptions {
|
|
349
|
+
tableName: string;
|
|
350
|
+
columnResource: ColumnResource;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export declare interface ColumnDetails {
|
|
354
|
+
id: string;
|
|
355
|
+
name: string;
|
|
356
|
+
table_id: string;
|
|
357
|
+
type: FieldType;
|
|
358
|
+
description?: string;
|
|
359
|
+
is_nullable: boolean;
|
|
360
|
+
is_primary_key: boolean;
|
|
361
|
+
is_unique: boolean;
|
|
362
|
+
is_indexed: boolean;
|
|
363
|
+
is_visible: boolean;
|
|
364
|
+
is_readonly: boolean;
|
|
365
|
+
field_order: number;
|
|
366
|
+
default_value?: unknown;
|
|
367
|
+
created_at: string;
|
|
368
|
+
updated_at: string;
|
|
369
|
+
alignment?: AlignmentType_2;
|
|
370
|
+
timezone?: string;
|
|
371
|
+
date_format?: string;
|
|
372
|
+
time_format?: string;
|
|
373
|
+
decimals?: number | string;
|
|
374
|
+
currency_format?: string;
|
|
375
|
+
selection_source?: string;
|
|
376
|
+
selectable_items?: string[];
|
|
377
|
+
multiple_selections?: boolean;
|
|
378
|
+
phone_format?: string;
|
|
379
|
+
vector_dimension?: number;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export declare class ColumnHelpers {
|
|
383
|
+
/**
|
|
384
|
+
* Convert FieldDefinition to ColumnUpdateRequest
|
|
385
|
+
*/
|
|
386
|
+
static fieldToUpdateRequest(field: FieldDefinition): ColumnUpdateRequest;
|
|
387
|
+
/**
|
|
388
|
+
* Apply default values to column definition
|
|
389
|
+
*/
|
|
390
|
+
static applyDefaultValues(column: Partial<FieldDefinition>): FieldDefinition;
|
|
391
|
+
/**
|
|
392
|
+
* Create a column definition with proper defaults
|
|
393
|
+
*/
|
|
394
|
+
static createColumnDefinition(name: string, type: FieldType, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
395
|
+
/**
|
|
396
|
+
* Get column type display name
|
|
397
|
+
*/
|
|
398
|
+
static getColumnTypeDisplayName(type: FieldType): string;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export declare interface ColumnQueryOptions {
|
|
402
|
+
where?: {
|
|
403
|
+
id?: string;
|
|
404
|
+
name?: string;
|
|
405
|
+
table_id?: string;
|
|
406
|
+
type?: FieldType;
|
|
407
|
+
is_nullable?: boolean;
|
|
408
|
+
is_unique?: boolean;
|
|
409
|
+
is_indexed?: boolean;
|
|
410
|
+
is_primary_key?: boolean;
|
|
411
|
+
};
|
|
412
|
+
fields?: Array<keyof ColumnDetails>;
|
|
413
|
+
sort?: Array<{
|
|
414
|
+
field: keyof ColumnDetails;
|
|
415
|
+
order: 'asc' | 'desc';
|
|
416
|
+
}>;
|
|
417
|
+
limit?: number;
|
|
418
|
+
offset?: number;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
declare interface ColumnRecord {
|
|
422
|
+
id: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
declare class ColumnResource extends BaseResource {
|
|
426
|
+
private columnsApiClient;
|
|
427
|
+
private tablesApiClient;
|
|
428
|
+
constructor(client: BaseClient);
|
|
429
|
+
/**
|
|
430
|
+
* Create a single column in a table
|
|
431
|
+
*/
|
|
432
|
+
create(tableName: string, column: FieldDefinition): Promise<BolticSuccessResponse<ColumnRecord> | BolticErrorResponse>;
|
|
433
|
+
/**
|
|
434
|
+
* Process column defaults and auto-generate field_order
|
|
435
|
+
*/
|
|
436
|
+
private processColumnDefaults;
|
|
437
|
+
/**
|
|
438
|
+
* Generate the next available field_order for a table
|
|
439
|
+
*/
|
|
440
|
+
private generateFieldOrder;
|
|
441
|
+
/**
|
|
442
|
+
* Transform SDK ColumnQueryOptions to API request format
|
|
443
|
+
*/
|
|
444
|
+
private transformColumnQueryToApiRequest;
|
|
445
|
+
/**
|
|
446
|
+
* Add multiple columns to existing table
|
|
447
|
+
*/
|
|
448
|
+
createMany(tableName: string, columns: FieldDefinition[]): Promise<BolticListResponse<ColumnRecord> | BolticErrorResponse>;
|
|
449
|
+
/**
|
|
450
|
+
* Find all columns in a table (replaces list functionality)
|
|
451
|
+
*/
|
|
452
|
+
findAll(tableName: string, options?: ColumnQueryOptions): Promise<BolticListResponse<ColumnDetails> | BolticErrorResponse>;
|
|
453
|
+
/**
|
|
454
|
+
* Get a single column by name
|
|
455
|
+
*/
|
|
456
|
+
get(tableName: string, columnName: string): Promise<BolticSuccessResponse<ColumnDetails> | BolticErrorResponse>;
|
|
457
|
+
findById(tableName: string, columnId: string): Promise<BolticSuccessResponse<ColumnDetails> | BolticErrorResponse>;
|
|
458
|
+
/**
|
|
459
|
+
* Update a column by name
|
|
460
|
+
*/
|
|
461
|
+
update(tableName: string, columnName: string, updates: ColumnUpdateRequest): Promise<BolticSuccessResponse<ColumnDetails> | BolticErrorResponse>;
|
|
462
|
+
/**
|
|
463
|
+
* Delete a column by name
|
|
464
|
+
*/
|
|
465
|
+
delete(tableName: string, columnName: string): Promise<BolticSuccessResponse<{
|
|
466
|
+
success: boolean;
|
|
467
|
+
message?: string;
|
|
468
|
+
}> | BolticErrorResponse>;
|
|
469
|
+
/**
|
|
470
|
+
* Helper method to get table information by name
|
|
471
|
+
*/
|
|
472
|
+
private getTableInfo;
|
|
473
|
+
/**
|
|
474
|
+
* Helper method to get table ID by name (deprecated, use getTableInfo instead)
|
|
475
|
+
*/
|
|
476
|
+
private getTableId;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export declare interface ColumnUpdateRequest {
|
|
480
|
+
name?: string;
|
|
481
|
+
type?: FieldType;
|
|
482
|
+
description?: string;
|
|
483
|
+
is_nullable?: boolean;
|
|
484
|
+
is_unique?: boolean;
|
|
485
|
+
is_indexed?: boolean;
|
|
486
|
+
is_visible?: boolean;
|
|
487
|
+
is_primary_key?: boolean;
|
|
488
|
+
is_readonly?: boolean;
|
|
489
|
+
default_value?: unknown;
|
|
490
|
+
field_order?: number;
|
|
491
|
+
fields?: Array<keyof ColumnDetails>;
|
|
492
|
+
alignment?: AlignmentType_2;
|
|
493
|
+
decimals?: DecimalType;
|
|
494
|
+
currency_format?: string;
|
|
495
|
+
selection_source?: 'provide-static-list';
|
|
496
|
+
selectable_items?: string[];
|
|
497
|
+
multiple_selections?: boolean;
|
|
498
|
+
phone_format?: PhoneFormatType;
|
|
499
|
+
date_format?: keyof typeof DateFormatEnum;
|
|
500
|
+
time_format?: keyof typeof TimeFormatEnum;
|
|
501
|
+
timezone?: string;
|
|
502
|
+
vector_dimension?: number;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export declare function createClient(apiKey: string, options?: ClientOptions): BolticClient;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Create a new column builder
|
|
509
|
+
*/
|
|
510
|
+
export declare function createColumnBuilder(options: ColumnBuilderOptions): ColumnBuilder;
|
|
511
|
+
|
|
512
|
+
export declare function createErrorResponse(error: string, details?: unknown): {
|
|
513
|
+
error: string;
|
|
514
|
+
details: unknown;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Creates a structured error object with additional context
|
|
519
|
+
*/
|
|
520
|
+
export declare function createErrorWithContext(message: string, context?: Record<string, unknown>): Error;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Helper function to create a new filter builder
|
|
524
|
+
*/
|
|
525
|
+
export declare function createFilter(): FilterBuilder;
|
|
526
|
+
|
|
527
|
+
export declare function createMockResponse<T>(data: T, pagination?: PaginationInfo): {
|
|
528
|
+
data: T;
|
|
529
|
+
pagination: PaginationInfo | undefined;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
export declare interface CreateOperation<TCreate, TResult> {
|
|
533
|
+
create(data: TCreate): Promise<{
|
|
534
|
+
data: TResult;
|
|
535
|
+
error?: string;
|
|
536
|
+
}>;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Create a new record builder
|
|
541
|
+
*/
|
|
542
|
+
export declare function createRecordBuilder(options: RecordBuilderOptions): RecordBuilder;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Create a new table builder
|
|
546
|
+
*/
|
|
547
|
+
export declare function createTableBuilder(options: TableBuilderOptions, tablesApiClient?: TablesApiClient): TableBuilder;
|
|
548
|
+
|
|
549
|
+
export declare function createTestClient(options?: MockClientOptions): BolticClient;
|
|
550
|
+
|
|
551
|
+
export declare interface CrudOperations<TCreate, TUpdate, TResult, TQuery = unknown> extends CreateOperation<TCreate, TResult>, ReadOperation<TQuery, TResult>, UpdateOperation<TUpdate, TResult>, DeleteOperation {
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare interface DatabaseContext {
|
|
555
|
+
databaseName: string;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
declare const DateFormatEnum: Readonly<{
|
|
559
|
+
MMDDYY: "%m/%d/%y";
|
|
560
|
+
MMDDYYYY: "%m/%d/%Y";
|
|
561
|
+
MM_DD_YYYY: "%m-%d-%Y";
|
|
562
|
+
DD_MM_YYYY: "%d-%m-%Y";
|
|
563
|
+
DDMMYYYY: "%d/%m/%Y";
|
|
564
|
+
DDMMYY: "%d/%m/%y";
|
|
565
|
+
YYYY_MM_DD: "%Y-%m-%d";
|
|
566
|
+
MMMM__DD__YYYY: "%B %d %Y";
|
|
567
|
+
MMM__DD__YYYY: "%b %d %Y";
|
|
568
|
+
ddd__MMM__DD__YYYY: "%a %b %d %Y";
|
|
569
|
+
}>;
|
|
570
|
+
|
|
571
|
+
declare type DecimalType = '00' | '0.0' | '0.00' | '0.000' | '0.0000' | '0.00000' | '0.000000';
|
|
572
|
+
|
|
573
|
+
export declare interface DeleteOperation {
|
|
574
|
+
delete(id: string): Promise<{
|
|
575
|
+
success: boolean;
|
|
576
|
+
error?: string;
|
|
577
|
+
}>;
|
|
578
|
+
delete(options: {
|
|
579
|
+
where: Record<string, unknown>;
|
|
580
|
+
}): Promise<{
|
|
581
|
+
deletedCount: number;
|
|
582
|
+
error?: string;
|
|
583
|
+
}>;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export declare const ENV_CONFIGS: Record<Environment, EnvironmentConfig>;
|
|
587
|
+
|
|
588
|
+
export declare type Environment = 'local' | 'sit' | 'uat' | 'prod';
|
|
589
|
+
|
|
590
|
+
export declare interface EnvironmentConfig {
|
|
591
|
+
baseURL: string;
|
|
592
|
+
timeout: number;
|
|
593
|
+
retryAttempts?: number;
|
|
594
|
+
debug?: boolean;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
declare type ErrorInterceptor = (error: unknown) => unknown | Promise<unknown>;
|
|
598
|
+
|
|
599
|
+
export declare interface ErrorResponse {
|
|
600
|
+
data?: never;
|
|
601
|
+
error: string;
|
|
602
|
+
details?: unknown;
|
|
603
|
+
code?: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export declare interface ExecuteSQLApiRequest {
|
|
607
|
+
query: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export declare interface ExecuteSQLApiResponse {
|
|
611
|
+
data: [
|
|
612
|
+
Record<string, unknown>[],
|
|
613
|
+
unknown
|
|
614
|
+
];
|
|
615
|
+
pagination?: {
|
|
616
|
+
total_count: number;
|
|
617
|
+
total_pages: number;
|
|
618
|
+
current_page: number;
|
|
619
|
+
per_page: number;
|
|
620
|
+
type: string;
|
|
621
|
+
};
|
|
622
|
+
message?: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export declare interface ExecutionResult {
|
|
626
|
+
data: Record<string, unknown>[];
|
|
627
|
+
count: number;
|
|
628
|
+
metadata: unknown;
|
|
629
|
+
pagination?: PaginationInfo;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export declare interface FieldDefinition {
|
|
633
|
+
name: string;
|
|
634
|
+
type: FieldType;
|
|
635
|
+
is_nullable?: boolean;
|
|
636
|
+
is_primary_key?: boolean;
|
|
637
|
+
is_unique?: boolean;
|
|
638
|
+
is_indexed?: boolean;
|
|
639
|
+
is_visible?: boolean;
|
|
640
|
+
is_readonly?: boolean;
|
|
641
|
+
field_order?: number;
|
|
642
|
+
description?: string;
|
|
643
|
+
default_value?: unknown;
|
|
644
|
+
alignment?: 'left' | 'center' | 'right';
|
|
645
|
+
timezone?: string;
|
|
646
|
+
date_format?: string;
|
|
647
|
+
time_format?: string;
|
|
648
|
+
decimals?: string;
|
|
649
|
+
currency_format?: string;
|
|
650
|
+
selection_source?: string;
|
|
651
|
+
selectable_items?: string[];
|
|
652
|
+
multiple_selections?: boolean;
|
|
653
|
+
phone_format?: string;
|
|
654
|
+
vector_dimension?: number;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export declare type FieldType = 'text' | 'long-text' | 'number' | 'currency' | 'checkbox' | 'dropdown' | 'email' | 'phone-number' | 'link' | 'json' | 'date-time' | 'vector' | 'halfvec' | 'sparsevec';
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Comprehensive filter operators based on backend buildWhereClause function
|
|
661
|
+
*/
|
|
662
|
+
export declare const FILTER_OPERATORS: {
|
|
663
|
+
readonly EQUALS: "=";
|
|
664
|
+
readonly NOT_EQUALS: "!=";
|
|
665
|
+
readonly GREATER_THAN: ">";
|
|
666
|
+
readonly GREATER_THAN_EQUAL: ">=";
|
|
667
|
+
readonly LESS_THAN: "<";
|
|
668
|
+
readonly LESS_THAN_EQUAL: "<=";
|
|
669
|
+
readonly LIKE: "LIKE";
|
|
670
|
+
readonly ILIKE: "ILIKE";
|
|
671
|
+
readonly STARTS_WITH: "STARTS WITH";
|
|
672
|
+
readonly IN: "IN";
|
|
673
|
+
readonly NOT_IN: "NOT IN";
|
|
674
|
+
readonly IS_EMPTY: "IS EMPTY";
|
|
675
|
+
readonly IS_NULL: "IS NULL";
|
|
676
|
+
readonly IS_NOT_NULL: "IS NOT NULL";
|
|
677
|
+
readonly BETWEEN: "BETWEEN";
|
|
678
|
+
readonly ARRAY_CONTAINS: "@>";
|
|
679
|
+
readonly ARRAY_NOT_CONTAINS: "NOT @>";
|
|
680
|
+
readonly ANY: "ANY";
|
|
681
|
+
readonly IS_ONE_OF_ARRAY: "IS ONE OF";
|
|
682
|
+
readonly DROPDOWN_ITEM_STARTS_WITH: "DROPDOWN ITEM STARTS WITH";
|
|
683
|
+
readonly WITHIN: "WITHIN";
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Create filter helper for building complex filter conditions
|
|
688
|
+
*/
|
|
689
|
+
export declare class FilterBuilder {
|
|
690
|
+
private filters;
|
|
691
|
+
equals(field: string, value: unknown): FilterBuilder;
|
|
692
|
+
notEquals(field: string, value: unknown): FilterBuilder;
|
|
693
|
+
greaterThan(field: string, value: unknown): FilterBuilder;
|
|
694
|
+
lessThan(field: string, value: unknown): FilterBuilder;
|
|
695
|
+
between(field: string, start: unknown, end: unknown): FilterBuilder;
|
|
696
|
+
in(field: string, values: unknown[]): FilterBuilder;
|
|
697
|
+
like(field: string, value: unknown): FilterBuilder;
|
|
698
|
+
startsWith(field: string, value: unknown): FilterBuilder;
|
|
699
|
+
isEmpty(field: string): FilterBuilder;
|
|
700
|
+
isNull(field: string): FilterBuilder;
|
|
701
|
+
arrayContains(field: string, value: unknown): FilterBuilder;
|
|
702
|
+
build(): ApiFilter[];
|
|
703
|
+
clear(): FilterBuilder;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Formats error for logging/debugging
|
|
708
|
+
*/
|
|
709
|
+
export declare function formatError(error: unknown): string;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Extracts HTTP status code from axios or fetch errors
|
|
713
|
+
*/
|
|
714
|
+
export declare function getHttpStatusCode(error: unknown): number | null;
|
|
715
|
+
|
|
716
|
+
export declare interface HttpAdapter {
|
|
717
|
+
request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export declare interface HttpRequestConfig {
|
|
721
|
+
url: string;
|
|
722
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
723
|
+
headers?: Record<string, string>;
|
|
724
|
+
params?: Record<string, unknown>;
|
|
725
|
+
data?: unknown;
|
|
726
|
+
timeout?: number;
|
|
727
|
+
signal?: AbortSignal;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export declare interface HttpResponse<T = unknown> {
|
|
731
|
+
data: T;
|
|
732
|
+
status: number;
|
|
733
|
+
statusText: string;
|
|
734
|
+
headers: Record<string, string>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
declare interface InterceptorManager {
|
|
738
|
+
request: {
|
|
739
|
+
use(interceptor: RequestInterceptor): number;
|
|
740
|
+
eject(id: number): void;
|
|
741
|
+
};
|
|
742
|
+
response: {
|
|
743
|
+
use(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
|
|
744
|
+
eject(id: number): void;
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
declare class InterceptorManagerImpl implements InterceptorManager {
|
|
749
|
+
private requestInterceptors;
|
|
750
|
+
private responseInterceptors;
|
|
751
|
+
private nextId;
|
|
752
|
+
request: {
|
|
753
|
+
use: (interceptor: RequestInterceptor) => number;
|
|
754
|
+
eject: (id: number) => void;
|
|
755
|
+
};
|
|
756
|
+
response: {
|
|
757
|
+
use: (onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor) => number;
|
|
758
|
+
eject: (id: number) => void;
|
|
759
|
+
};
|
|
760
|
+
executeRequestInterceptors(config: HttpRequestConfig): Promise<HttpRequestConfig>;
|
|
761
|
+
executeResponseInterceptors(response: HttpResponse): Promise<HttpResponse>;
|
|
762
|
+
executeErrorInterceptors(error: unknown): Promise<unknown>;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export declare function isErrorResponse<T>(response: ApiResponse<T>): response is BolticErrorResponse;
|
|
766
|
+
|
|
767
|
+
export declare function isListResponse<T>(response: ApiResponse<T>): response is BolticListResponse<T>;
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Checks if an error is a network/HTTP related error
|
|
771
|
+
*/
|
|
772
|
+
export declare function isNetworkError(error: unknown): error is Error;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Convert API filters back to SDK where clause
|
|
776
|
+
*/
|
|
777
|
+
export declare function mapFiltersToWhere(filters: ApiFilter[]): WhereCondition_2;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Map SDK where clause to API filters format
|
|
781
|
+
*/
|
|
782
|
+
export declare function mapWhereToFilters(where: WhereCondition_2): ApiFilter[];
|
|
783
|
+
|
|
784
|
+
export declare interface MockClientOptions {
|
|
785
|
+
apiKey?: string;
|
|
786
|
+
environment?: 'local' | 'sit' | 'uat' | 'prod';
|
|
787
|
+
region?: 'asia-south1' | 'us-central1';
|
|
788
|
+
mockResponses?: Record<string, unknown>;
|
|
789
|
+
debug?: boolean;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Convert direct filter array format to SDK format
|
|
794
|
+
* This handles the case where filters are passed directly as an array
|
|
795
|
+
*/
|
|
796
|
+
export declare function normalizeFilters(filters: ApiFilter[] | Record<string, unknown>[] | WhereCondition_2): ApiFilter[];
|
|
797
|
+
|
|
798
|
+
export declare interface PaginationInfo {
|
|
799
|
+
total_count: number;
|
|
800
|
+
total_pages: number;
|
|
801
|
+
current_page: number;
|
|
802
|
+
per_page: number;
|
|
803
|
+
type: string;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
declare interface PaginationInfo_2 {
|
|
807
|
+
total: number;
|
|
808
|
+
page: number;
|
|
809
|
+
limit: number;
|
|
810
|
+
pages: number;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
declare type PhoneFormatType = '+91 123 456 7890' | '(123) 456-7890' | '+1 (123) 456-7890' | '+91 12 3456 7890';
|
|
814
|
+
|
|
815
|
+
export declare interface QueryOperator<T = unknown> {
|
|
816
|
+
$eq?: T;
|
|
817
|
+
$ne?: T;
|
|
818
|
+
$gt?: T;
|
|
819
|
+
$gte?: T;
|
|
820
|
+
$lt?: T;
|
|
821
|
+
$lte?: T;
|
|
822
|
+
$in?: T[];
|
|
823
|
+
$nin?: T[];
|
|
824
|
+
$like?: string;
|
|
825
|
+
$ilike?: string;
|
|
826
|
+
$between?: [T, T];
|
|
827
|
+
$null?: boolean;
|
|
828
|
+
$exists?: boolean;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export declare interface QueryOptions {
|
|
832
|
+
fields?: string[];
|
|
833
|
+
sort?: Array<{
|
|
834
|
+
field: string;
|
|
835
|
+
order: 'asc' | 'desc';
|
|
836
|
+
}>;
|
|
837
|
+
limit?: number;
|
|
838
|
+
offset?: number;
|
|
839
|
+
where?: Record<string, unknown>;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export declare interface ReadOperation<TQuery, TResult> {
|
|
843
|
+
findOne(options: TQuery): Promise<{
|
|
844
|
+
data: TResult | null;
|
|
845
|
+
error?: string;
|
|
846
|
+
}>;
|
|
847
|
+
findAll(options?: TQuery): Promise<{
|
|
848
|
+
data: TResult[];
|
|
849
|
+
pagination?: PaginationInfo;
|
|
850
|
+
error?: string;
|
|
851
|
+
}>;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Record Builder - provides a fluent interface for building record queries and operations
|
|
856
|
+
*/
|
|
857
|
+
declare class RecordBuilder {
|
|
858
|
+
private tableName;
|
|
859
|
+
private recordResource;
|
|
860
|
+
private queryOptions;
|
|
861
|
+
private updateData;
|
|
862
|
+
constructor(options: RecordBuilderOptions);
|
|
863
|
+
/**
|
|
864
|
+
* Add filter conditions
|
|
865
|
+
*/
|
|
866
|
+
where(conditions: Record<string, unknown>): RecordBuilder;
|
|
867
|
+
/**
|
|
868
|
+
* Set sorting
|
|
869
|
+
*/
|
|
870
|
+
orderBy(field: string, direction?: 'asc' | 'desc'): RecordBuilder;
|
|
871
|
+
/**
|
|
872
|
+
* Set limit (using page)
|
|
873
|
+
*/
|
|
874
|
+
limit(count: number): RecordBuilder;
|
|
875
|
+
/**
|
|
876
|
+
* Set offset (using page)
|
|
877
|
+
*/
|
|
878
|
+
offset(count: number): RecordBuilder;
|
|
879
|
+
/**
|
|
880
|
+
* Set fields to select
|
|
881
|
+
*/
|
|
882
|
+
select(fields: string[]): RecordBuilder;
|
|
883
|
+
/**
|
|
884
|
+
* Set data for update operations
|
|
885
|
+
*/
|
|
886
|
+
set(data: RecordData): RecordBuilder;
|
|
887
|
+
/**
|
|
888
|
+
* Set pagination
|
|
889
|
+
*/
|
|
890
|
+
page(pageNo: number, pageSize?: number): RecordBuilder;
|
|
891
|
+
/**
|
|
892
|
+
* Execute list operation (was findAll)
|
|
893
|
+
*/
|
|
894
|
+
list(): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
|
|
895
|
+
/**
|
|
896
|
+
* Execute findAll operation (alias for list)
|
|
897
|
+
*/
|
|
898
|
+
findAll(): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
|
|
899
|
+
/**
|
|
900
|
+
* Execute findOne operation by getting first result from list
|
|
901
|
+
*/
|
|
902
|
+
findOne(): Promise<BolticSuccessResponse<RecordWithId | null> | BolticErrorResponse>;
|
|
903
|
+
/**
|
|
904
|
+
* Build where conditions from filters for API consumption
|
|
905
|
+
*/
|
|
906
|
+
private buildWhereConditions;
|
|
907
|
+
/**
|
|
908
|
+
* Execute update operation - requires filters or record IDs
|
|
909
|
+
*/
|
|
910
|
+
update(): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
|
|
911
|
+
/**
|
|
912
|
+
* Execute update by ID operation
|
|
913
|
+
*/
|
|
914
|
+
updateById(id: string): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
|
|
915
|
+
/**
|
|
916
|
+
* Execute delete by single ID operation
|
|
917
|
+
*/
|
|
918
|
+
deleteById(id: string): Promise<BolticSuccessResponse<{
|
|
919
|
+
message: string;
|
|
920
|
+
}> | BolticErrorResponse>;
|
|
921
|
+
/**
|
|
922
|
+
* Execute delete by IDs operation
|
|
923
|
+
*/
|
|
924
|
+
deleteByIds(ids: string[]): Promise<BolticSuccessResponse<{
|
|
925
|
+
message: string;
|
|
926
|
+
}> | BolticErrorResponse>;
|
|
927
|
+
/**
|
|
928
|
+
* Execute delete operation using filters
|
|
929
|
+
*/
|
|
930
|
+
delete(): Promise<BolticSuccessResponse<{
|
|
931
|
+
message: string;
|
|
932
|
+
}> | BolticErrorResponse>;
|
|
933
|
+
/**
|
|
934
|
+
* Get the built query options (for debugging)
|
|
935
|
+
*/
|
|
936
|
+
getQueryOptions(): RecordQueryOptions;
|
|
937
|
+
/**
|
|
938
|
+
* Get the update data (for debugging)
|
|
939
|
+
*/
|
|
940
|
+
getUpdateData(): RecordData;
|
|
941
|
+
/**
|
|
942
|
+
* Execute insert operation
|
|
943
|
+
*/
|
|
944
|
+
insert(data: RecordData): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
declare interface RecordBuilderOptions {
|
|
948
|
+
tableName: string;
|
|
949
|
+
recordResource: RecordResource;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
export declare interface RecordCreateRequest {
|
|
953
|
+
[fieldName: string]: unknown;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
export declare interface RecordData {
|
|
957
|
+
[fieldName: string]: unknown;
|
|
958
|
+
fields?: string[];
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
export declare interface RecordDeleteOptions {
|
|
962
|
+
record_ids?: string[];
|
|
963
|
+
filters?: ApiFilter[] | Record<string, unknown>;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export declare interface RecordDeleteResponse {
|
|
967
|
+
message: string;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export declare interface RecordListResponse {
|
|
971
|
+
data: RecordWithId[];
|
|
972
|
+
pagination: {
|
|
973
|
+
total_count: number;
|
|
974
|
+
total_pages: number;
|
|
975
|
+
current_page: number;
|
|
976
|
+
per_page: number;
|
|
977
|
+
type: string;
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
export declare interface RecordQueryOptions {
|
|
982
|
+
page?: {
|
|
983
|
+
page_no: number;
|
|
984
|
+
page_size: number;
|
|
985
|
+
};
|
|
986
|
+
filters?: ApiFilter[] | Record<string, unknown>[];
|
|
987
|
+
sort?: Record<string, unknown>[];
|
|
988
|
+
fields?: string[];
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
declare class RecordResource {
|
|
992
|
+
private apiClient;
|
|
993
|
+
private tablesApiClient;
|
|
994
|
+
private client;
|
|
995
|
+
constructor(client: BaseClient);
|
|
996
|
+
/**
|
|
997
|
+
* Insert a single record
|
|
998
|
+
*/
|
|
999
|
+
insert(tableName: string, data: RecordData): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Get a single record by ID
|
|
1002
|
+
*/
|
|
1003
|
+
get(tableName: string, recordId: string): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
|
|
1004
|
+
/**
|
|
1005
|
+
* List records with filtering and pagination
|
|
1006
|
+
*/
|
|
1007
|
+
list(tableName: string, options?: RecordQueryOptions): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Update records by filters
|
|
1010
|
+
*/
|
|
1011
|
+
update(tableName: string, options: RecordUpdateOptions): Promise<BolticListResponse<RecordWithId> | BolticErrorResponse>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Update a single record by ID
|
|
1014
|
+
*/
|
|
1015
|
+
updateById(tableName: string, recordId: string, data: RecordData): Promise<BolticSuccessResponse<RecordWithId> | BolticErrorResponse>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Unified delete method that supports both record IDs and filters
|
|
1018
|
+
*/
|
|
1019
|
+
delete(tableName: string, options: RecordDeleteOptions): Promise<BolticSuccessResponse<{
|
|
1020
|
+
message: string;
|
|
1021
|
+
}> | BolticErrorResponse>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Delete a single record by ID
|
|
1024
|
+
*/
|
|
1025
|
+
deleteById(tableName: string, recordId: string): Promise<BolticSuccessResponse<{
|
|
1026
|
+
message: string;
|
|
1027
|
+
}> | BolticErrorResponse>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Helper method to get table information by name
|
|
1030
|
+
*/
|
|
1031
|
+
private getTableInfo;
|
|
1032
|
+
/**
|
|
1033
|
+
* Helper method to ensure all required fields for a record are present,
|
|
1034
|
+
* filling missing ones with null.
|
|
1035
|
+
*/
|
|
1036
|
+
private ensureCompleteRecordData;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
export declare interface RecordUpdateByIdOptions {
|
|
1040
|
+
id: string;
|
|
1041
|
+
set: RecordData;
|
|
1042
|
+
fields?: string[];
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
export declare interface RecordUpdateOptions {
|
|
1046
|
+
set: RecordData;
|
|
1047
|
+
filters: ApiFilter[] | Record<string, unknown>[];
|
|
1048
|
+
fields?: string[];
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
export declare interface RecordUpdateRequest {
|
|
1052
|
+
[fieldName: string]: unknown;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
export declare interface RecordWithId extends RecordData {
|
|
1056
|
+
id: string;
|
|
1057
|
+
created_at?: string;
|
|
1058
|
+
updated_at?: string;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
export declare type Region = 'asia-south1' | 'us-central1';
|
|
1062
|
+
|
|
1063
|
+
export declare const REGION_CONFIGS: Record<Region, Record<Environment, EnvironmentConfig>>;
|
|
1064
|
+
|
|
1065
|
+
declare type RequestInterceptor = (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
|
|
1066
|
+
|
|
1067
|
+
declare type ResponseInterceptor = (response: HttpResponse) => HttpResponse | Promise<HttpResponse>;
|
|
1068
|
+
|
|
1069
|
+
export declare class SchemaHelpers {
|
|
1070
|
+
/**
|
|
1071
|
+
* Create a text field definition
|
|
1072
|
+
*/
|
|
1073
|
+
static textField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1074
|
+
/**
|
|
1075
|
+
* Create a number field definition
|
|
1076
|
+
*/
|
|
1077
|
+
static numberField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1078
|
+
/**
|
|
1079
|
+
* Create a currency field definition
|
|
1080
|
+
*/
|
|
1081
|
+
static currencyField(name: string, currency?: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1082
|
+
/**
|
|
1083
|
+
* Create a dropdown field definition
|
|
1084
|
+
*/
|
|
1085
|
+
static dropdownField(name: string, items: string[], options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1086
|
+
/**
|
|
1087
|
+
* Create a vector field definition
|
|
1088
|
+
*/
|
|
1089
|
+
static vectorField(name: string, dimension: number, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1090
|
+
/**
|
|
1091
|
+
* Create a JSON field definition
|
|
1092
|
+
*/
|
|
1093
|
+
static jsonField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1094
|
+
/**
|
|
1095
|
+
* Create a date-time field definition
|
|
1096
|
+
*/
|
|
1097
|
+
static dateTimeField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1098
|
+
/**
|
|
1099
|
+
* Create an email field definition
|
|
1100
|
+
*/
|
|
1101
|
+
static emailField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1102
|
+
/**
|
|
1103
|
+
* Create a long-text field definition
|
|
1104
|
+
*/
|
|
1105
|
+
static longTextField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1106
|
+
/**
|
|
1107
|
+
* Create a link field definition
|
|
1108
|
+
*/
|
|
1109
|
+
static linkField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1110
|
+
/**
|
|
1111
|
+
* Create a phone number field definition
|
|
1112
|
+
*/
|
|
1113
|
+
static phoneNumberField(name: string, format?: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1114
|
+
/**
|
|
1115
|
+
* Create a checkbox field definition
|
|
1116
|
+
*/
|
|
1117
|
+
static checkboxField(name: string, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1118
|
+
/**
|
|
1119
|
+
* Create a half-vector field definition
|
|
1120
|
+
*/
|
|
1121
|
+
static halfVectorField(name: string, dimension: number, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1122
|
+
/**
|
|
1123
|
+
* Create a sparse vector field definition
|
|
1124
|
+
*/
|
|
1125
|
+
static sparseVectorField(name: string, dimension: number, options?: Partial<FieldDefinition>): FieldDefinition;
|
|
1126
|
+
/**
|
|
1127
|
+
* Create a basic schema from field definitions
|
|
1128
|
+
*/
|
|
1129
|
+
static createBasicSchema(fields: Array<{
|
|
1130
|
+
name: string;
|
|
1131
|
+
type: FieldType;
|
|
1132
|
+
}>): FieldDefinition[];
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
export declare class SqlResource {
|
|
1136
|
+
private sqlApiClient;
|
|
1137
|
+
constructor(client: BaseClient);
|
|
1138
|
+
/**
|
|
1139
|
+
* Convert natural language to SQL query
|
|
1140
|
+
* Returns streaming results for real-time query generation
|
|
1141
|
+
*
|
|
1142
|
+
* @param prompt - Natural language description of the desired query
|
|
1143
|
+
* @param options - Optional parameters including currentQuery for refinement
|
|
1144
|
+
* @returns AsyncIterable<string> for streaming SQL generation
|
|
1145
|
+
*
|
|
1146
|
+
*/
|
|
1147
|
+
textToSQL(prompt: string, options?: TextToSQLOptions): Promise<AsyncIterable<string>>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Execute SQL query with built-in safety measures and performance optimization
|
|
1150
|
+
*
|
|
1151
|
+
* @param query - SQL query string to execute
|
|
1152
|
+
* @returns Promise<ExecuteSQLApiResponse> with raw API response following Boltic API Response Structure
|
|
1153
|
+
*
|
|
1154
|
+
*/
|
|
1155
|
+
executeSQL(query: string): Promise<ExecuteSQLApiResponse>;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
export declare interface SuccessResponse<T> {
|
|
1159
|
+
data: T;
|
|
1160
|
+
error?: never;
|
|
1161
|
+
pagination?: PaginationInfo;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
export declare interface TableAccessRequest {
|
|
1165
|
+
table_name: string;
|
|
1166
|
+
is_shared: boolean;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Table Builder - provides a fluent interface for creating tables
|
|
1171
|
+
*/
|
|
1172
|
+
declare class TableBuilder {
|
|
1173
|
+
private tableName;
|
|
1174
|
+
private description?;
|
|
1175
|
+
private isPublic;
|
|
1176
|
+
private fields;
|
|
1177
|
+
private tablesApiClient?;
|
|
1178
|
+
constructor(options: TableBuilderOptions, tablesApiClient?: TablesApiClient);
|
|
1179
|
+
/**
|
|
1180
|
+
* Set table name
|
|
1181
|
+
*/
|
|
1182
|
+
name(name: string): TableBuilder;
|
|
1183
|
+
/**
|
|
1184
|
+
* Set table description
|
|
1185
|
+
*/
|
|
1186
|
+
describe(description: string): TableBuilder;
|
|
1187
|
+
/**
|
|
1188
|
+
* Set if table is public
|
|
1189
|
+
*/
|
|
1190
|
+
public(isPublic?: boolean): TableBuilder;
|
|
1191
|
+
/**
|
|
1192
|
+
* Add a text field
|
|
1193
|
+
*/
|
|
1194
|
+
text(name: string, options?: {
|
|
1195
|
+
nullable?: boolean;
|
|
1196
|
+
unique?: boolean;
|
|
1197
|
+
indexed?: boolean;
|
|
1198
|
+
defaultValue?: string;
|
|
1199
|
+
description?: string;
|
|
1200
|
+
alignment?: 'left' | 'center' | 'right';
|
|
1201
|
+
}): TableBuilder;
|
|
1202
|
+
/**
|
|
1203
|
+
* Add a long text field
|
|
1204
|
+
*/
|
|
1205
|
+
longText(name: string, options?: {
|
|
1206
|
+
nullable?: boolean;
|
|
1207
|
+
description?: string;
|
|
1208
|
+
alignment?: 'left' | 'center' | 'right';
|
|
1209
|
+
}): TableBuilder;
|
|
1210
|
+
/**
|
|
1211
|
+
* Add a number field
|
|
1212
|
+
*/
|
|
1213
|
+
number(name: string, options?: {
|
|
1214
|
+
nullable?: boolean;
|
|
1215
|
+
unique?: boolean;
|
|
1216
|
+
indexed?: boolean;
|
|
1217
|
+
defaultValue?: number;
|
|
1218
|
+
description?: string;
|
|
1219
|
+
decimals?: string;
|
|
1220
|
+
alignment?: 'left' | 'center' | 'right';
|
|
1221
|
+
}): TableBuilder;
|
|
1222
|
+
/**
|
|
1223
|
+
* Add a currency field
|
|
1224
|
+
*/
|
|
1225
|
+
currency(name: string, options?: {
|
|
1226
|
+
nullable?: boolean;
|
|
1227
|
+
defaultValue?: number;
|
|
1228
|
+
description?: string;
|
|
1229
|
+
currencyFormat?: string;
|
|
1230
|
+
decimals?: string;
|
|
1231
|
+
}): TableBuilder;
|
|
1232
|
+
/**
|
|
1233
|
+
* Add a checkbox field
|
|
1234
|
+
*/
|
|
1235
|
+
checkbox(name: string, options?: {
|
|
1236
|
+
nullable?: boolean;
|
|
1237
|
+
defaultValue?: boolean;
|
|
1238
|
+
description?: string;
|
|
1239
|
+
}): TableBuilder;
|
|
1240
|
+
/**
|
|
1241
|
+
* Add a dropdown field
|
|
1242
|
+
*/
|
|
1243
|
+
dropdown(name: string, items: string[], options?: {
|
|
1244
|
+
nullable?: boolean;
|
|
1245
|
+
multiple?: boolean;
|
|
1246
|
+
defaultValue?: string | string[];
|
|
1247
|
+
description?: string;
|
|
1248
|
+
}): TableBuilder;
|
|
1249
|
+
/**
|
|
1250
|
+
* Add an email field
|
|
1251
|
+
*/
|
|
1252
|
+
email(name: string, options?: {
|
|
1253
|
+
nullable?: boolean;
|
|
1254
|
+
unique?: boolean;
|
|
1255
|
+
indexed?: boolean;
|
|
1256
|
+
description?: string;
|
|
1257
|
+
}): TableBuilder;
|
|
1258
|
+
/**
|
|
1259
|
+
* Add a phone number field
|
|
1260
|
+
*/
|
|
1261
|
+
phone(name: string, options?: {
|
|
1262
|
+
nullable?: boolean;
|
|
1263
|
+
description?: string;
|
|
1264
|
+
format?: string;
|
|
1265
|
+
}): TableBuilder;
|
|
1266
|
+
/**
|
|
1267
|
+
* Add a link field
|
|
1268
|
+
*/
|
|
1269
|
+
link(name: string, options?: {
|
|
1270
|
+
nullable?: boolean;
|
|
1271
|
+
description?: string;
|
|
1272
|
+
}): TableBuilder;
|
|
1273
|
+
/**
|
|
1274
|
+
* Add a JSON field
|
|
1275
|
+
*/
|
|
1276
|
+
json(name: string, options?: {
|
|
1277
|
+
nullable?: boolean;
|
|
1278
|
+
description?: string;
|
|
1279
|
+
}): TableBuilder;
|
|
1280
|
+
/**
|
|
1281
|
+
* Add a date-time field
|
|
1282
|
+
*/
|
|
1283
|
+
dateTime(name: string, options?: {
|
|
1284
|
+
nullable?: boolean;
|
|
1285
|
+
description?: string;
|
|
1286
|
+
dateFormat?: string;
|
|
1287
|
+
timeFormat?: string;
|
|
1288
|
+
timezone?: string;
|
|
1289
|
+
}): TableBuilder;
|
|
1290
|
+
/**
|
|
1291
|
+
* Add a vector field
|
|
1292
|
+
*/
|
|
1293
|
+
vector(name: string, dimension: number, options?: {
|
|
1294
|
+
nullable?: boolean;
|
|
1295
|
+
description?: string;
|
|
1296
|
+
}): TableBuilder;
|
|
1297
|
+
/**
|
|
1298
|
+
/**
|
|
1299
|
+
* Add a half-precision vector field
|
|
1300
|
+
*/
|
|
1301
|
+
halfVector(name: string, dimension: number, options?: {
|
|
1302
|
+
nullable?: boolean;
|
|
1303
|
+
description?: string;
|
|
1304
|
+
}): TableBuilder;
|
|
1305
|
+
/**
|
|
1306
|
+
* Add a sparse vector field
|
|
1307
|
+
*/
|
|
1308
|
+
sparseVector(name: string, dimension: number, options?: {
|
|
1309
|
+
nullable?: boolean;
|
|
1310
|
+
description?: string;
|
|
1311
|
+
}): TableBuilder;
|
|
1312
|
+
/**
|
|
1313
|
+
* Add a custom field
|
|
1314
|
+
*/
|
|
1315
|
+
addField(field: FieldDefinition): TableBuilder;
|
|
1316
|
+
/**
|
|
1317
|
+
* Remove a field by name
|
|
1318
|
+
*/
|
|
1319
|
+
removeField(name: string): TableBuilder;
|
|
1320
|
+
/**
|
|
1321
|
+
* Get current fields
|
|
1322
|
+
*/
|
|
1323
|
+
getFields(): FieldDefinition[];
|
|
1324
|
+
/**
|
|
1325
|
+
* Get current table name
|
|
1326
|
+
*/
|
|
1327
|
+
getName(): string;
|
|
1328
|
+
/**
|
|
1329
|
+
* Get current description
|
|
1330
|
+
*/
|
|
1331
|
+
getDescription(): string | undefined;
|
|
1332
|
+
/**
|
|
1333
|
+
* Build the table request object
|
|
1334
|
+
*/
|
|
1335
|
+
build(): TableCreateRequest;
|
|
1336
|
+
/**
|
|
1337
|
+
* Build and create the table (requires API client)
|
|
1338
|
+
*/
|
|
1339
|
+
create(options?: {
|
|
1340
|
+
is_ai_generated_schema?: boolean;
|
|
1341
|
+
is_template?: boolean;
|
|
1342
|
+
}): Promise<BolticSuccessResponse<TableCreateResponse> | BolticErrorResponse>;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
declare interface TableBuilderOptions {
|
|
1346
|
+
name: string;
|
|
1347
|
+
description?: string;
|
|
1348
|
+
is_ai_generated_schema?: boolean;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
declare interface TableCreateOptions {
|
|
1352
|
+
is_ai_generated_schema?: boolean;
|
|
1353
|
+
is_template?: boolean;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
export declare interface TableCreateRequest {
|
|
1357
|
+
name: string;
|
|
1358
|
+
fields: FieldDefinition[];
|
|
1359
|
+
description?: string;
|
|
1360
|
+
is_ai_generated_schema?: boolean;
|
|
1361
|
+
is_template?: boolean;
|
|
1362
|
+
responseFields?: Array<keyof TableRecord>;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
export declare interface TableCreateResponse {
|
|
1366
|
+
id: string;
|
|
1367
|
+
message: string;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
export declare interface TableDeleteOptions {
|
|
1371
|
+
where: {
|
|
1372
|
+
id?: string;
|
|
1373
|
+
name?: string;
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
declare interface TableListOptions extends TableQueryOptions {
|
|
1378
|
+
page?: number;
|
|
1379
|
+
pageSize?: number;
|
|
1380
|
+
isShared?: boolean;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
export declare interface TableListResponse {
|
|
1384
|
+
tables: TableRecord[];
|
|
1385
|
+
pagination: PaginationInfo_2;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
export declare interface TableQueryOptions {
|
|
1389
|
+
where?: {
|
|
1390
|
+
id?: string;
|
|
1391
|
+
name?: string;
|
|
1392
|
+
db_id?: string;
|
|
1393
|
+
is_public?: boolean;
|
|
1394
|
+
created_by?: string;
|
|
1395
|
+
created_at?: {
|
|
1396
|
+
$gte?: string;
|
|
1397
|
+
$lte?: string;
|
|
1398
|
+
$between?: [string, string];
|
|
1399
|
+
};
|
|
1400
|
+
};
|
|
1401
|
+
fields?: Array<keyof TableRecord>;
|
|
1402
|
+
sort?: Array<{
|
|
1403
|
+
field: keyof TableRecord;
|
|
1404
|
+
order: 'asc' | 'desc';
|
|
1405
|
+
}>;
|
|
1406
|
+
limit?: number;
|
|
1407
|
+
offset?: number;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
export declare interface TableRecord {
|
|
1411
|
+
id: string;
|
|
1412
|
+
name: string;
|
|
1413
|
+
account_id: string;
|
|
1414
|
+
internal_table_name: string;
|
|
1415
|
+
internal_db_name: string;
|
|
1416
|
+
db_id?: string;
|
|
1417
|
+
resource_id?: string;
|
|
1418
|
+
description?: string;
|
|
1419
|
+
type?: string;
|
|
1420
|
+
parent_table_id?: string;
|
|
1421
|
+
is_deleted: boolean;
|
|
1422
|
+
is_public: boolean;
|
|
1423
|
+
created_by: string;
|
|
1424
|
+
created_at: string;
|
|
1425
|
+
updated_at: string;
|
|
1426
|
+
updated_by: string;
|
|
1427
|
+
snapshot_url?: string;
|
|
1428
|
+
account_status: 'active' | 'inactive' | 'deleted';
|
|
1429
|
+
source?: 'boltic' | 'copilot';
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* Tables API Client - handles all table-related API operations
|
|
1434
|
+
*/
|
|
1435
|
+
declare class TablesApiClient {
|
|
1436
|
+
private httpAdapter;
|
|
1437
|
+
private config;
|
|
1438
|
+
private baseURL;
|
|
1439
|
+
constructor(apiKey: string, config?: Omit<TablesApiClientConfig, 'apiKey'>);
|
|
1440
|
+
private getBaseURL;
|
|
1441
|
+
/**
|
|
1442
|
+
* Create a new table
|
|
1443
|
+
*/
|
|
1444
|
+
createTable(request: TableCreateRequest, options?: TableCreateOptions): Promise<BolticSuccessResponse_2<TableCreateResponse> | BolticErrorResponse_2>;
|
|
1445
|
+
/**
|
|
1446
|
+
* List tables with filtering and pagination
|
|
1447
|
+
*/
|
|
1448
|
+
listTables(options?: TableListOptions): Promise<BolticListResponse_2<TableRecord> | BolticErrorResponse_2>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Get a specific table by ID
|
|
1451
|
+
*/
|
|
1452
|
+
getTable(tableId: string, options?: {
|
|
1453
|
+
fields?: Array<keyof TableRecord>;
|
|
1454
|
+
}): Promise<BolticSuccessResponse_2<TableRecord> | BolticErrorResponse_2>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Update an existing table
|
|
1457
|
+
*/
|
|
1458
|
+
updateTable(tableId: string, updates: {
|
|
1459
|
+
name?: string;
|
|
1460
|
+
description?: string;
|
|
1461
|
+
is_shared?: boolean;
|
|
1462
|
+
fields?: Array<keyof TableRecord>;
|
|
1463
|
+
}): Promise<BolticSuccessResponse_2<TableRecord> | BolticErrorResponse_2>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Delete a table
|
|
1466
|
+
*/
|
|
1467
|
+
deleteTable(tableId: string): Promise<BolticSuccessResponse_2<{
|
|
1468
|
+
message: string;
|
|
1469
|
+
}> | BolticErrorResponse_2>;
|
|
1470
|
+
private buildHeaders;
|
|
1471
|
+
private formatErrorResponse;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
declare interface TablesApiClientConfig {
|
|
1475
|
+
apiKey: string;
|
|
1476
|
+
environment?: Environment;
|
|
1477
|
+
region?: Region;
|
|
1478
|
+
timeout?: number;
|
|
1479
|
+
debug?: boolean;
|
|
1480
|
+
retryAttempts?: number;
|
|
1481
|
+
retryDelay?: number;
|
|
1482
|
+
headers?: Record<string, string>;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
export declare interface TableUpdateRequest {
|
|
1486
|
+
name?: string;
|
|
1487
|
+
description?: string;
|
|
1488
|
+
is_shared?: boolean;
|
|
1489
|
+
fields?: Array<keyof TableRecord>;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
export declare interface TextToSQLApiRequest {
|
|
1493
|
+
prompt: string;
|
|
1494
|
+
current_query?: string;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
export declare interface TextToSQLApiResponse {
|
|
1498
|
+
data: string;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
export declare interface TextToSQLOptions {
|
|
1502
|
+
currentQuery?: string;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
declare const TimeFormatEnum: Readonly<{
|
|
1506
|
+
HH_mm_ss: "%H:%M:%S";
|
|
1507
|
+
HH_mm_ssZ: "%H:%M:%SZ";
|
|
1508
|
+
HH_mm_ss_SSS: "%H:%M:%S.%f";
|
|
1509
|
+
HH_mm_ss__Z: "%H:%M:%S %Z";
|
|
1510
|
+
HH_mm__AMPM: "%I:%M %p";
|
|
1511
|
+
HH_mm_ss__AMPM: "%I:%M:%S %p";
|
|
1512
|
+
}>;
|
|
1513
|
+
|
|
1514
|
+
export declare interface TokenInfo {
|
|
1515
|
+
token: string;
|
|
1516
|
+
expiresAt?: Date;
|
|
1517
|
+
isValid: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
export declare interface UpdateOperation<TUpdate, TResult> {
|
|
1521
|
+
update(id: string, data: TUpdate): Promise<{
|
|
1522
|
+
data: TResult;
|
|
1523
|
+
error?: string;
|
|
1524
|
+
}>;
|
|
1525
|
+
update(options: {
|
|
1526
|
+
where: Record<string, unknown>;
|
|
1527
|
+
set: TUpdate;
|
|
1528
|
+
}): Promise<{
|
|
1529
|
+
data: TResult[];
|
|
1530
|
+
error?: string;
|
|
1531
|
+
}>;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Validation error for input validation failures
|
|
1536
|
+
*/
|
|
1537
|
+
export declare class ValidationError extends Error {
|
|
1538
|
+
readonly failures: ValidationFailure[];
|
|
1539
|
+
constructor(message: string, failures?: ValidationFailure[]);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Utility functions for working with standard Error classes
|
|
1544
|
+
*/
|
|
1545
|
+
export declare interface ValidationFailure {
|
|
1546
|
+
field: string;
|
|
1547
|
+
message: string;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
export declare const VERSION = "1.0.0";
|
|
1551
|
+
|
|
1552
|
+
export declare interface WhereCondition {
|
|
1553
|
+
[fieldName: string]: unknown | QueryOperator;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
declare interface WhereCondition_2 {
|
|
1557
|
+
[field: string]: unknown;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
export { }
|