@boltic/sdk 0.1.2 → 0.1.4
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/README.md +191 -146
- package/dist/databases/index.d.ts +214 -93
- package/dist/databases/index.js +1 -1
- package/dist/databases/index.js.map +1 -1
- package/dist/databases/index.mjs +1 -1
- package/dist/databases/index.mjs.map +1 -1
- package/dist/databases/test-client-BEAX5vfC.mjs +2 -0
- package/dist/databases/test-client-BEAX5vfC.mjs.map +1 -0
- package/dist/databases/test-client-BgkvBtst.js +2 -0
- package/dist/databases/test-client-BgkvBtst.js.map +1 -0
- package/dist/databases/testing.d.ts +204 -94
- package/dist/databases/testing.js +1 -1
- package/dist/databases/testing.mjs +1 -1
- package/dist/sdk.js +1531 -765
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.mjs +1532 -766
- package/dist/sdk.mjs.map +1 -1
- package/dist/types/index.d.ts +916 -70
- package/package.json +2 -1
- package/dist/databases/test-client-Bo_BCApL.js +0 -2
- package/dist/databases/test-client-Bo_BCApL.js.map +0 -1
- package/dist/databases/test-client-C9T839dW.mjs +0 -2
- package/dist/databases/test-client-C9T839dW.mjs.map +0 -1
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** Properties describing the activity to execute (dynamic, varies by integration) */
|
|
2
|
+
declare type ActivityProperties = Record<string, unknown>;
|
|
3
|
+
|
|
4
|
+
/** Result/context payload sent alongside activity nodes */
|
|
5
|
+
declare interface ActivityResultPayload {
|
|
6
|
+
payload: Record<string, unknown>;
|
|
7
|
+
global_variables: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
export declare interface AddIndexRequest {
|
|
2
11
|
field_names: string[];
|
|
3
12
|
method: 'btree' | 'hash' | 'spgist' | 'gin' | 'brin';
|
|
@@ -34,9 +43,6 @@ export declare const ALLOWED_FIELD_TYPE_CONVERSIONS: {
|
|
|
34
43
|
encrypted: never[];
|
|
35
44
|
};
|
|
36
45
|
|
|
37
|
-
/**
|
|
38
|
-
* API error for HTTP/API related failures
|
|
39
|
-
*/
|
|
40
46
|
export declare class ApiError extends Error {
|
|
41
47
|
readonly statusCode: number;
|
|
42
48
|
readonly response?: unknown;
|
|
@@ -80,6 +86,41 @@ declare class AuthManager {
|
|
|
80
86
|
toJSON(): object;
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Base API Client — provides common functionality for all API clients.
|
|
91
|
+
*
|
|
92
|
+
* Subclasses pass a `servicePath` to target different backend services
|
|
93
|
+
* while sharing auth, headers, error handling, and HTTP infrastructure.
|
|
94
|
+
*/
|
|
95
|
+
declare abstract class BaseApiClient {
|
|
96
|
+
protected httpAdapter: HttpAdapter;
|
|
97
|
+
protected config: BaseApiClientConfig;
|
|
98
|
+
protected baseURL: string;
|
|
99
|
+
protected environment: Environment;
|
|
100
|
+
protected region: Region;
|
|
101
|
+
constructor(apiKey: string, config?: Omit<BaseApiClientConfig, 'apiKey'>, servicePath?: string);
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a secondary service URL using the same region/environment
|
|
104
|
+
* but a different service path.
|
|
105
|
+
*/
|
|
106
|
+
protected resolveAdditionalServiceURL(servicePath: string): string;
|
|
107
|
+
protected buildHeaders(): Record<string, string>;
|
|
108
|
+
protected formatErrorResponse(error: unknown, prefix?: string): BolticErrorResponse;
|
|
109
|
+
toString(): string;
|
|
110
|
+
toJSON(): object;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare interface BaseApiClientConfig {
|
|
114
|
+
apiKey: string;
|
|
115
|
+
environment?: Environment;
|
|
116
|
+
region?: Region;
|
|
117
|
+
timeout?: number;
|
|
118
|
+
debug?: boolean;
|
|
119
|
+
retryAttempts?: number;
|
|
120
|
+
retryDelay?: number;
|
|
121
|
+
headers?: Record<string, string>;
|
|
122
|
+
}
|
|
123
|
+
|
|
83
124
|
declare class BaseClient {
|
|
84
125
|
private httpAdapter;
|
|
85
126
|
private authManager;
|
|
@@ -121,6 +162,7 @@ export declare class BolticClient {
|
|
|
121
162
|
private sqlResource;
|
|
122
163
|
private indexResource;
|
|
123
164
|
private databaseResource;
|
|
165
|
+
private workflowResource;
|
|
124
166
|
private currentDatabase;
|
|
125
167
|
private clientOptions;
|
|
126
168
|
constructor(apiKey: string, options?: ClientOptions);
|
|
@@ -169,10 +211,6 @@ export declare class BolticClient {
|
|
|
169
211
|
message: string;
|
|
170
212
|
}>>;
|
|
171
213
|
rename: (oldName: string, newName: string) => Promise<BolticSuccessResponse<TableRecord>>;
|
|
172
|
-
setAccess: (request: {
|
|
173
|
-
table_name: string;
|
|
174
|
-
is_shared: boolean;
|
|
175
|
-
}) => Promise<BolticSuccessResponse<TableRecord>>;
|
|
176
214
|
};
|
|
177
215
|
get columns(): {
|
|
178
216
|
create: (tableName: string, column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
|
|
@@ -239,6 +277,31 @@ export declare class BolticClient {
|
|
|
239
277
|
textToSQL: (prompt: string, options?: TextToSQLOptions) => Promise<AsyncIterable<string>>;
|
|
240
278
|
executeSQL: (query: string) => Promise<BolticErrorResponse | ExecuteSQLApiResponse>;
|
|
241
279
|
};
|
|
280
|
+
/**
|
|
281
|
+
* Workflow integration operations.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* // Execute and poll for result
|
|
286
|
+
* const result = await client.workflow.executeIntegration({
|
|
287
|
+
* nodes: [{ id: 'api1', data: { ... }, activity_data: { ... } }],
|
|
288
|
+
* });
|
|
289
|
+
*
|
|
290
|
+
* // Get execution result by ID
|
|
291
|
+
* const exec = await client.workflow.getIntegrationExecuteById('run-uuid');
|
|
292
|
+
*
|
|
293
|
+
* // List integrations
|
|
294
|
+
* const integrations = await client.workflow.getIntegrations();
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
get workflow(): {
|
|
298
|
+
executeIntegration: (params: ExecuteIntegrationParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ExecuteActivityResponseData | IntegrationExecutionData>>;
|
|
299
|
+
getIntegrationExecuteById: (executionId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationExecutionData>>;
|
|
300
|
+
getIntegrations: (params?: GetIntegrationsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationsListData>>;
|
|
301
|
+
getCredentials: (params: GetCredentialsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<CredentialsListData>>;
|
|
302
|
+
getIntegrationResource: (params: GetIntegrationResourceParams) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationResourceData>>;
|
|
303
|
+
getIntegrationForm: (params: GetIntegrationFormParams) => Promise<BolticErrorResponse | BolticSuccessResponse<Record<string, unknown> | IntegrationFormJsonSchema>>;
|
|
304
|
+
};
|
|
242
305
|
getSqlResource(): SqlResource;
|
|
243
306
|
updateApiKey(newApiKey: string): void;
|
|
244
307
|
updateConfig(updates: Partial<ClientConfig>): void;
|
|
@@ -272,15 +335,6 @@ export declare interface BolticErrorResponse {
|
|
|
272
335
|
};
|
|
273
336
|
}
|
|
274
337
|
|
|
275
|
-
declare interface BolticErrorResponse_2 {
|
|
276
|
-
data?: never;
|
|
277
|
-
error: {
|
|
278
|
-
code?: string;
|
|
279
|
-
message?: string;
|
|
280
|
-
meta?: string[];
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
|
|
284
338
|
export declare interface BolticListResponse<T> {
|
|
285
339
|
data: T[];
|
|
286
340
|
pagination?: {
|
|
@@ -298,18 +352,6 @@ export declare interface BolticListResponse<T> {
|
|
|
298
352
|
};
|
|
299
353
|
}
|
|
300
354
|
|
|
301
|
-
declare interface BolticListResponse_2<T = unknown> {
|
|
302
|
-
data: T[];
|
|
303
|
-
pagination?: {
|
|
304
|
-
total_count: number;
|
|
305
|
-
total_pages: number;
|
|
306
|
-
current_page: number;
|
|
307
|
-
per_page: number;
|
|
308
|
-
type: string;
|
|
309
|
-
};
|
|
310
|
-
message?: string;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
355
|
export declare interface BolticSuccessResponse<T> {
|
|
314
356
|
data: T;
|
|
315
357
|
message?: string;
|
|
@@ -320,11 +362,6 @@ export declare interface BolticSuccessResponse<T> {
|
|
|
320
362
|
};
|
|
321
363
|
}
|
|
322
364
|
|
|
323
|
-
declare interface BolticSuccessResponse_2<T = unknown> {
|
|
324
|
-
data: T;
|
|
325
|
-
message?: string;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
365
|
/**
|
|
329
366
|
* Build API filters with validation based on backend buildWhereClause
|
|
330
367
|
*/
|
|
@@ -629,9 +666,6 @@ export declare function createErrorResponse(error: string, details?: unknown): {
|
|
|
629
666
|
details: unknown;
|
|
630
667
|
};
|
|
631
668
|
|
|
632
|
-
/**
|
|
633
|
-
* Creates a structured error object with additional context
|
|
634
|
-
*/
|
|
635
669
|
export declare function createErrorWithContext(message: string, context?: Record<string, unknown>): Error;
|
|
636
670
|
|
|
637
671
|
/**
|
|
@@ -663,6 +697,9 @@ export declare function createTableBuilder(options: TableBuilderOptions, tablesA
|
|
|
663
697
|
|
|
664
698
|
export declare function createTestClient(options?: MockClientOptions): BolticClient;
|
|
665
699
|
|
|
700
|
+
/** Data returned from the get-credentials API */
|
|
701
|
+
declare type CredentialsListData = Record<string, unknown>;
|
|
702
|
+
|
|
666
703
|
export declare interface CrudOperations<TCreate, TUpdate, TResult, TQuery = unknown> extends CreateOperation<TCreate, TResult>, ReadOperation<TQuery, TResult>, UpdateOperation<TUpdate, TResult>, DeleteOperation {
|
|
667
704
|
}
|
|
668
705
|
|
|
@@ -885,6 +922,38 @@ export declare interface ErrorResponse {
|
|
|
885
922
|
code?: string;
|
|
886
923
|
}
|
|
887
924
|
|
|
925
|
+
/** Data returned from the execute-activity API */
|
|
926
|
+
declare interface ExecuteActivityResponseData {
|
|
927
|
+
execution_id: string;
|
|
928
|
+
[key: string]: unknown;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Parameters accepted by `workflow.executeIntegration()`.
|
|
933
|
+
*
|
|
934
|
+
* @remarks
|
|
935
|
+
* When `executeOnly` is `false` (default), the SDK will poll
|
|
936
|
+
* `getIntegrationExecuteById` until the execution reaches a terminal state.
|
|
937
|
+
*/
|
|
938
|
+
declare interface ExecuteIntegrationParams {
|
|
939
|
+
/**
|
|
940
|
+
* If `true`, return immediately after the execute call without polling.
|
|
941
|
+
* @defaultValue false
|
|
942
|
+
*/
|
|
943
|
+
executeOnly?: boolean;
|
|
944
|
+
/** Activity data describing what to execute. The SDK wraps this into the `nodes[]` structure the API expects. */
|
|
945
|
+
data: {
|
|
946
|
+
type: string;
|
|
947
|
+
name: string;
|
|
948
|
+
properties: ActivityProperties;
|
|
949
|
+
};
|
|
950
|
+
/**
|
|
951
|
+
* Result/context payload for the execute request.
|
|
952
|
+
* Falls back to a sensible default when omitted.
|
|
953
|
+
*/
|
|
954
|
+
result?: ActivityResultPayload;
|
|
955
|
+
}
|
|
956
|
+
|
|
888
957
|
export declare interface ExecuteSQLApiRequest {
|
|
889
958
|
query: string;
|
|
890
959
|
}
|
|
@@ -1035,16 +1104,73 @@ export declare interface FilterParams {
|
|
|
1035
1104
|
values: any[];
|
|
1036
1105
|
}
|
|
1037
1106
|
|
|
1038
|
-
/**
|
|
1039
|
-
* Formats error for logging/debugging
|
|
1040
|
-
*/
|
|
1041
1107
|
export declare function formatError(error: unknown): string;
|
|
1042
1108
|
|
|
1043
|
-
/**
|
|
1044
|
-
|
|
1045
|
-
*/
|
|
1109
|
+
/** Parameters accepted by `workflow.getCredentials()`. */
|
|
1110
|
+
declare interface GetCredentialsParams {
|
|
1111
|
+
/** Integration name (e.g. "freshsales"). Automatically uppercased by the SDK. */
|
|
1112
|
+
entity: string;
|
|
1113
|
+
/**
|
|
1114
|
+
* Current page number for pagination.
|
|
1115
|
+
* @defaultValue 1
|
|
1116
|
+
*/
|
|
1117
|
+
current_page?: number;
|
|
1118
|
+
/**
|
|
1119
|
+
* Number of items per page.
|
|
1120
|
+
* @defaultValue 999
|
|
1121
|
+
*/
|
|
1122
|
+
page_size?: number;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1046
1125
|
export declare function getHttpStatusCode(error: unknown): number | null;
|
|
1047
1126
|
|
|
1127
|
+
/** Parameters accepted by `workflow.getIntegrationForm()`. */
|
|
1128
|
+
declare interface GetIntegrationFormParams {
|
|
1129
|
+
/** Integration slug identifier (e.g. "blt-int.asana"). */
|
|
1130
|
+
integration_slug: string;
|
|
1131
|
+
/** Resource type (e.g. "project", "task"). */
|
|
1132
|
+
resource: string;
|
|
1133
|
+
/** Operation type (e.g. "create", "update", "read"). */
|
|
1134
|
+
operation: string;
|
|
1135
|
+
/** Credential secret for the integration. */
|
|
1136
|
+
secret: string;
|
|
1137
|
+
/**
|
|
1138
|
+
* When `true`, returns only the form schema without executing.
|
|
1139
|
+
* @defaultValue true
|
|
1140
|
+
*/
|
|
1141
|
+
getFormOnly?: boolean;
|
|
1142
|
+
/**
|
|
1143
|
+
* When `true`, the response `data` is returned as a JSON Schema object
|
|
1144
|
+
* describing the expected input shape (type, required, default, enum).
|
|
1145
|
+
*
|
|
1146
|
+
* When `false` or omitted, the response `data` is a flat JSON object
|
|
1147
|
+
* with default/fallback values for each field.
|
|
1148
|
+
*
|
|
1149
|
+
* @defaultValue false
|
|
1150
|
+
*/
|
|
1151
|
+
asJsonSchema?: boolean;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/** Parameters accepted by `workflow.getIntegrationResource()`. */
|
|
1155
|
+
declare interface GetIntegrationResourceParams {
|
|
1156
|
+
/** Integration slug identifier (e.g. "blt-int.asana"). */
|
|
1157
|
+
integration_slug: string;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/** Parameters accepted by `workflow.getIntegrations()`. */
|
|
1161
|
+
declare interface GetIntegrationsParams {
|
|
1162
|
+
/**
|
|
1163
|
+
* Page number for pagination.
|
|
1164
|
+
* @defaultValue 1
|
|
1165
|
+
*/
|
|
1166
|
+
page?: number;
|
|
1167
|
+
/**
|
|
1168
|
+
* Number of items per page.
|
|
1169
|
+
* @defaultValue 999
|
|
1170
|
+
*/
|
|
1171
|
+
per_page?: number;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1048
1174
|
export declare interface HttpAdapter {
|
|
1049
1175
|
request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
1050
1176
|
}
|
|
@@ -1080,6 +1206,21 @@ declare interface IndexListItem {
|
|
|
1080
1206
|
created_by?: string;
|
|
1081
1207
|
}
|
|
1082
1208
|
|
|
1209
|
+
/** Data returned from the get-execution-by-id API */
|
|
1210
|
+
declare type IntegrationExecutionData = Record<string, unknown>;
|
|
1211
|
+
|
|
1212
|
+
/** JSON Schema output for an integration form */
|
|
1213
|
+
declare interface IntegrationFormJsonSchema {
|
|
1214
|
+
type: 'object';
|
|
1215
|
+
properties: Record<string, JsonSchemaProperty>;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/** Data returned from the get-integration-resource API */
|
|
1219
|
+
declare type IntegrationResourceData = Record<string, unknown>;
|
|
1220
|
+
|
|
1221
|
+
/** Data returned from the get-integrations API */
|
|
1222
|
+
declare type IntegrationsListData = Record<string, unknown>;
|
|
1223
|
+
|
|
1083
1224
|
declare interface InterceptorManager {
|
|
1084
1225
|
request: {
|
|
1085
1226
|
use(interceptor: RequestInterceptor): number;
|
|
@@ -1112,11 +1253,17 @@ export declare function isErrorResponse<T>(response: ApiResponse<T>): response i
|
|
|
1112
1253
|
|
|
1113
1254
|
export declare function isListResponse<T>(response: ApiResponse<T>): response is BolticListResponse<T>;
|
|
1114
1255
|
|
|
1115
|
-
/**
|
|
1116
|
-
* Checks if an error is a network/HTTP related error
|
|
1117
|
-
*/
|
|
1118
1256
|
export declare function isNetworkError(error: unknown): error is Error;
|
|
1119
1257
|
|
|
1258
|
+
/** A single property in the generated JSON Schema */
|
|
1259
|
+
declare interface JsonSchemaProperty {
|
|
1260
|
+
type: string;
|
|
1261
|
+
required?: boolean;
|
|
1262
|
+
default?: unknown;
|
|
1263
|
+
description?: string;
|
|
1264
|
+
enum?: string[];
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1120
1267
|
export declare interface ListIndexesQuery {
|
|
1121
1268
|
page?: {
|
|
1122
1269
|
page_no: number;
|
|
@@ -1478,10 +1625,23 @@ export declare interface RecordWithId extends RecordData {
|
|
|
1478
1625
|
|
|
1479
1626
|
export declare type Region = 'asia-south1' | 'us-central1';
|
|
1480
1627
|
|
|
1628
|
+
export declare const REGION_BASE_HOSTS: Record<Region, Record<Environment, RegionHostConfig>>;
|
|
1629
|
+
|
|
1481
1630
|
export declare const REGION_CONFIGS: Record<Region, Record<Environment, EnvironmentConfig>>;
|
|
1482
1631
|
|
|
1632
|
+
export declare interface RegionHostConfig {
|
|
1633
|
+
host: string;
|
|
1634
|
+
timeout: number;
|
|
1635
|
+
debug?: boolean;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1483
1638
|
declare type RequestInterceptor = (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
|
|
1484
1639
|
|
|
1640
|
+
/**
|
|
1641
|
+
* Resolve a full service URL from region, environment, and service path.
|
|
1642
|
+
*/
|
|
1643
|
+
export declare function resolveServiceURL(region: Region, environment: Environment, servicePath: string): string;
|
|
1644
|
+
|
|
1485
1645
|
declare type ResponseInterceptor = (response: HttpResponse) => HttpResponse | Promise<HttpResponse>;
|
|
1486
1646
|
|
|
1487
1647
|
export declare class SchemaHelpers {
|
|
@@ -1587,18 +1747,12 @@ export declare interface SuccessResponse<T> {
|
|
|
1587
1747
|
pagination?: PaginationInfo;
|
|
1588
1748
|
}
|
|
1589
1749
|
|
|
1590
|
-
export declare interface TableAccessRequest {
|
|
1591
|
-
table_name: string;
|
|
1592
|
-
is_shared: boolean;
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
1750
|
/**
|
|
1596
1751
|
* Table Builder - provides a fluent interface for creating tables
|
|
1597
1752
|
*/
|
|
1598
1753
|
declare class TableBuilder {
|
|
1599
1754
|
private tableName;
|
|
1600
1755
|
private description?;
|
|
1601
|
-
private isPublic;
|
|
1602
1756
|
private fields;
|
|
1603
1757
|
private tablesApiClient?;
|
|
1604
1758
|
constructor(options: TableBuilderOptions, tablesApiClient?: TablesApiClient);
|
|
@@ -1610,10 +1764,6 @@ declare class TableBuilder {
|
|
|
1610
1764
|
* Set table description
|
|
1611
1765
|
*/
|
|
1612
1766
|
describe(description: string): TableBuilder;
|
|
1613
|
-
/**
|
|
1614
|
-
* Set if table is public
|
|
1615
|
-
*/
|
|
1616
|
-
public(isPublic?: boolean): TableBuilder;
|
|
1617
1767
|
/**
|
|
1618
1768
|
* Add a text field
|
|
1619
1769
|
*/
|
|
@@ -1789,7 +1939,6 @@ export declare interface TableDeleteOptions {
|
|
|
1789
1939
|
declare interface TableListOptions extends TableQueryOptions {
|
|
1790
1940
|
page?: number;
|
|
1791
1941
|
pageSize?: number;
|
|
1792
|
-
isShared?: boolean;
|
|
1793
1942
|
db_id?: string;
|
|
1794
1943
|
}
|
|
1795
1944
|
|
|
@@ -1804,7 +1953,6 @@ export declare interface TableQueryOptions {
|
|
|
1804
1953
|
name?: string;
|
|
1805
1954
|
db_id?: string;
|
|
1806
1955
|
resource_id?: string;
|
|
1807
|
-
is_public?: boolean;
|
|
1808
1956
|
created_by?: string;
|
|
1809
1957
|
created_at?: {
|
|
1810
1958
|
$gte?: string;
|
|
@@ -1833,6 +1981,7 @@ export declare interface TableRecord {
|
|
|
1833
1981
|
type?: string;
|
|
1834
1982
|
parent_table_id?: string;
|
|
1835
1983
|
is_deleted: boolean;
|
|
1984
|
+
/** @deprecated All tables are now public by default. This field is always true and ineffective. */
|
|
1836
1985
|
is_public: boolean;
|
|
1837
1986
|
created_by: string;
|
|
1838
1987
|
created_at: string;
|
|
@@ -1843,67 +1992,45 @@ export declare interface TableRecord {
|
|
|
1843
1992
|
source?: 'boltic' | 'copilot';
|
|
1844
1993
|
}
|
|
1845
1994
|
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
*/
|
|
1849
|
-
declare class TablesApiClient {
|
|
1850
|
-
private httpAdapter;
|
|
1851
|
-
private config;
|
|
1852
|
-
private baseURL;
|
|
1853
|
-
constructor(apiKey: string, config?: Omit<TablesApiClientConfig, 'apiKey'>);
|
|
1854
|
-
private getBaseURL;
|
|
1995
|
+
declare class TablesApiClient extends BaseApiClient {
|
|
1996
|
+
constructor(apiKey: string, config?: Omit<BaseApiClientConfig, 'apiKey'>);
|
|
1855
1997
|
/**
|
|
1856
1998
|
* Create a new table
|
|
1857
1999
|
*/
|
|
1858
|
-
createTable(request: TableCreateRequest, options?: TableCreateOptions): Promise<
|
|
2000
|
+
createTable(request: TableCreateRequest, options?: TableCreateOptions): Promise<BolticSuccessResponse<TableCreateResponse> | BolticErrorResponse>;
|
|
1859
2001
|
/**
|
|
1860
2002
|
* List tables with filtering and pagination
|
|
1861
2003
|
*/
|
|
1862
|
-
listTables(options?: TableListOptions): Promise<
|
|
2004
|
+
listTables(options?: TableListOptions): Promise<BolticListResponse<TableRecord> | BolticErrorResponse>;
|
|
1863
2005
|
/**
|
|
1864
2006
|
* Get a specific table by ID
|
|
1865
2007
|
*/
|
|
1866
2008
|
getTable(tableId: string, options?: {
|
|
1867
2009
|
fields?: Array<keyof TableRecord>;
|
|
1868
2010
|
db_id?: string;
|
|
1869
|
-
}): Promise<
|
|
2011
|
+
}): Promise<BolticSuccessResponse<TableRecord> | BolticErrorResponse>;
|
|
1870
2012
|
/**
|
|
1871
2013
|
* Update an existing table
|
|
1872
2014
|
*/
|
|
1873
2015
|
updateTable(tableId: string, updates: {
|
|
1874
2016
|
name?: string;
|
|
1875
2017
|
description?: string;
|
|
1876
|
-
is_shared?: boolean;
|
|
1877
2018
|
fields?: Array<keyof TableRecord>;
|
|
1878
2019
|
db_id?: string;
|
|
1879
|
-
}): Promise<
|
|
2020
|
+
}): Promise<BolticSuccessResponse<TableRecord> | BolticErrorResponse>;
|
|
1880
2021
|
/**
|
|
1881
2022
|
* Delete a table
|
|
1882
2023
|
*/
|
|
1883
2024
|
deleteTable(tableId: string, options?: {
|
|
1884
2025
|
db_id?: string;
|
|
1885
|
-
}): Promise<
|
|
2026
|
+
}): Promise<BolticSuccessResponse<{
|
|
1886
2027
|
message: string;
|
|
1887
|
-
}> |
|
|
1888
|
-
private buildHeaders;
|
|
1889
|
-
private formatErrorResponse;
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
declare interface TablesApiClientConfig {
|
|
1893
|
-
apiKey: string;
|
|
1894
|
-
environment?: Environment;
|
|
1895
|
-
region?: Region;
|
|
1896
|
-
timeout?: number;
|
|
1897
|
-
debug?: boolean;
|
|
1898
|
-
retryAttempts?: number;
|
|
1899
|
-
retryDelay?: number;
|
|
1900
|
-
headers?: Record<string, string>;
|
|
2028
|
+
}> | BolticErrorResponse>;
|
|
1901
2029
|
}
|
|
1902
2030
|
|
|
1903
2031
|
export declare interface TableUpdateRequest {
|
|
1904
2032
|
name?: string;
|
|
1905
2033
|
description?: string;
|
|
1906
|
-
is_shared?: boolean;
|
|
1907
2034
|
fields?: Array<keyof TableRecord>;
|
|
1908
2035
|
}
|
|
1909
2036
|
|
|
@@ -1949,17 +2076,11 @@ export declare interface UpdateOperation<TUpdate, TResult> {
|
|
|
1949
2076
|
}>;
|
|
1950
2077
|
}
|
|
1951
2078
|
|
|
1952
|
-
/**
|
|
1953
|
-
* Validation error for input validation failures
|
|
1954
|
-
*/
|
|
1955
2079
|
export declare class ValidationError extends Error {
|
|
1956
2080
|
readonly failures: ValidationFailure[];
|
|
1957
2081
|
constructor(message: string, failures?: ValidationFailure[]);
|
|
1958
2082
|
}
|
|
1959
2083
|
|
|
1960
|
-
/**
|
|
1961
|
-
* Utility functions for working with standard Error classes
|
|
1962
|
-
*/
|
|
1963
2084
|
export declare interface ValidationFailure {
|
|
1964
2085
|
field: string;
|
|
1965
2086
|
message: string;
|
package/dist/databases/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./test-client-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./test-client-BgkvBtst.js");class i{constructor(e){this.queryOptions={},this.updateData={},this.tableName=e.tableName,this.columnResource=e.columnResource}where(e){return this.queryOptions.where={...this.queryOptions.where,...e},this}orderBy(e,i="asc"){return this.queryOptions.sort||(this.queryOptions.sort=[]),this.queryOptions.sort.push({field:e,order:i}),this}limit(e){return this.queryOptions.limit=e,this}offset(e){return this.queryOptions.offset=e,this}select(e){return this.queryOptions.fields=e,this}set(e){return this.updateData={...this.updateData,...e},this}async findAll(){return this.columnResource.findAll(this.tableName,this.queryOptions)}async get(){return this.queryOptions.where?.name?this.columnResource.get(this.tableName,this.queryOptions.where.name):{error:{code:"MISSING_COLUMN_NAME",message:"Column name is required for get operation"}}}async update(){return this.queryOptions.where?.name?this.columnResource.update(this.tableName,this.queryOptions.where.name,this.updateData):{error:{code:"MISSING_COLUMN_NAME",message:"Column name is required for update operation"}}}async delete(){return this.queryOptions.where?.name?this.columnResource.delete(this.tableName,this.queryOptions.where.name):{error:{code:"MISSING_COLUMN_NAME",message:"Column name is required for delete operation"}}}getQueryOptions(){return{...this.queryOptions}}getUpdateData(){return{...this.updateData}}}exports.ALLOWED_FIELD_TYPE_CONVERSIONS=e.ALLOWED_FIELD_TYPE_CONVERSIONS,exports.ApiError=e.ApiError,exports.BolticClient=e.BolticClient,exports.DateFormatEnum=e.DateFormatEnum,exports.ENV_CONFIGS=e.ENV_CONFIGS,exports.FIELD_SPECIFIC_KEYS_MAP=e.FIELD_SPECIFIC_KEYS_MAP,exports.FILTER_OPERATORS=e.FILTER_OPERATORS,exports.FieldTypeEnum=e.FieldTypeEnum,exports.FilterBuilder=e.FilterBuilder,exports.REGION_BASE_HOSTS=e.REGION_BASE_HOSTS,exports.REGION_CONFIGS=e.REGION_CONFIGS,exports.SqlResource=e.SqlResource,exports.TimeFormatEnum=e.TimeFormatEnum,exports.ValidationError=e.ValidationError,exports.buildApiFilters=e.buildApiFilters,exports.createErrorResponse=e.createErrorResponse,exports.createErrorWithContext=e.createErrorWithContext,exports.createFilter=e.createFilter,exports.createMockResponse=e.createMockResponse,exports.createRecordBuilder=e.createRecordBuilder,exports.createTableBuilder=e.createTableBuilder,exports.createTestClient=e.createTestClient,exports.formatError=e.formatError,exports.getHttpStatusCode=e.getHttpStatusCode,exports.isErrorResponse=e.isErrorResponse,exports.isListResponse=e.isListResponse,exports.isNetworkError=e.isNetworkError,exports.mapFiltersToWhere=e.mapFiltersToWhere,exports.mapWhereToFilters=e.mapWhereToFilters,exports.normalizeFilters=e.normalizeFilters,exports.resolveServiceURL=e.resolveServiceURL,exports.ColumnHelpers=class{static fieldToUpdateRequest(e){return{name:e.name,type:e.type,description:e.description,is_nullable:e.is_nullable,is_unique:e.is_unique,is_indexed:e.is_indexed,is_visible:e.is_visible,is_primary_key:e.is_primary_key,is_readonly:e.is_readonly,field_order:e.field_order,default_value:e.default_value,alignment:e.alignment,decimals:e.decimals,currency_format:e.currency_format,selectable_items:e.selectable_items,multiple_selections:e.multiple_selections,phone_format:e.phone_format,date_format:e.date_format,time_format:e.time_format,timezone:e.timezone,vector_dimension:e.vector_dimension,show_decrypted:e.show_decrypted,is_deterministic:e.is_deterministic}}static applyDefaultValues(e){if(!e.name||!e.type)throw new Error("Column name and type are required");return{name:e.name,type:e.type,is_nullable:!0,is_unique:!1,is_indexed:!1,is_primary_key:!1,is_visible:!0,is_readonly:!1,field_order:1,alignment:"left",multiple_selections:!1,...e}}static createColumnDefinition(e,i,r={}){return this.applyDefaultValues({name:e,type:i,...r})}static getColumnTypeDisplayName(e){return{text:"Text","long-text":"Long Text",number:"Number",currency:"Currency",checkbox:"Checkbox",dropdown:"Dropdown",email:"Email","phone-number":"Phone Number",link:"Link",json:"JSON","date-time":"Date & Time",vector:"Vector",halfvec:"Half Vector",sparsevec:"Sparse Vector",encrypted:"Encrypted"}[e]||e}},exports.SchemaHelpers=class{static textField(e,i={}){return{name:e,type:"text",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,...i}}static numberField(e,i={}){return{name:e,type:"number",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,decimals:"0.00",...i}}static currencyField(e,i="USD",r={}){return{name:e,type:"currency",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,decimals:"0.00",currency_format:i,...r}}static dropdownField(e,i,r={}){return{name:e,type:"dropdown",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,selection_source:"provide-static-list",selectable_items:i,multiple_selections:!1,...r}}static vectorField(e,i,r={}){return{name:e,type:"vector",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,vector_dimension:i,...r}}static jsonField(e,i={}){return{name:e,type:"json",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,...i}}static dateTimeField(e,i={}){return{name:e,type:"date-time",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,date_format:"YYYY-MM-DD",time_format:"HH:mm:ss",...i}}static emailField(e,i={}){return{name:e,type:"email",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,...i}}static longTextField(e,i={}){return{name:e,type:"long-text",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,...i}}static linkField(e,i={}){return{name:e,type:"link",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,...i}}static phoneNumberField(e,i="international",r={}){return{name:e,type:"phone-number",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,phone_format:i,...r}}static checkboxField(e,i={}){return{name:e,type:"checkbox",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,default_value:!1,...i}}static halfVectorField(e,i,r={}){return{name:e,type:"halfvec",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,vector_dimension:i,...r}}static sparseVectorField(e,i,r={}){return{name:e,type:"sparsevec",is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:1,vector_dimension:i,...r}}static createBasicSchema(e){return e.map((e,i)=>({name:e.name,type:e.type,is_nullable:!0,is_primary_key:!1,is_unique:!1,is_visible:!0,is_readonly:!1,is_indexed:!1,field_order:i+1}))}},exports.VERSION="1.0.0",exports.createClient=function(i,r={}){return new e.BolticClient(i,r)},exports.createColumnBuilder=function(e){return new i(e)};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|