@boltic/sdk 0.0.2 → 0.0.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 +1 -1
- package/dist/databases/index.d.ts +47 -25
- package/dist/databases/index.js +1 -1
- package/dist/databases/index.js.map +1 -1
- package/dist/databases/index.mjs +2 -5
- package/dist/databases/index.mjs.map +1 -1
- package/dist/databases/test-client-BI3VkYA6.js +2 -0
- package/dist/databases/test-client-BI3VkYA6.js.map +1 -0
- package/dist/databases/{test-client-BM9X5DH9.mjs → test-client-BffJwqJq.mjs} +191 -180
- package/dist/databases/test-client-BffJwqJq.mjs.map +1 -0
- package/dist/databases/testing.d.ts +103 -76
- package/dist/databases/testing.js +1 -1
- package/dist/databases/testing.mjs +1 -1
- package/dist/sdk.js +5 -0
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.mjs +5 -0
- package/dist/sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/databases/test-client-BM9X5DH9.mjs.map +0 -1
- package/dist/databases/test-client-D-SuKCUC.js +0 -2
- package/dist/databases/test-client-D-SuKCUC.js.map +0 -1
|
@@ -109,6 +109,20 @@ class AuthManager {
|
|
|
109
109
|
getMaxRetries() {
|
|
110
110
|
return this.config.maxRetries || 3;
|
|
111
111
|
}
|
|
112
|
+
// Security methods to prevent API key exposure
|
|
113
|
+
toString() {
|
|
114
|
+
return `AuthManager { authenticated: ${this.isAuthenticated()}, maxRetries: ${this.getMaxRetries()} }`;
|
|
115
|
+
}
|
|
116
|
+
toJSON() {
|
|
117
|
+
return {
|
|
118
|
+
authenticated: this.isAuthenticated(),
|
|
119
|
+
maxRetries: this.getMaxRetries()
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// Custom inspect method for Node.js console logging
|
|
123
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
124
|
+
return this.toString();
|
|
125
|
+
}
|
|
112
126
|
}
|
|
113
127
|
class AxiosAdapter {
|
|
114
128
|
constructor() {
|
|
@@ -122,7 +136,7 @@ class AxiosAdapter {
|
|
|
122
136
|
}
|
|
123
137
|
}
|
|
124
138
|
async request(config) {
|
|
125
|
-
var _a;
|
|
139
|
+
var _a, _b, _c, _d, _e;
|
|
126
140
|
try {
|
|
127
141
|
const axiosConfig = {
|
|
128
142
|
url: config.url,
|
|
@@ -151,6 +165,18 @@ class AxiosAdapter {
|
|
|
151
165
|
timeout: config.timeout
|
|
152
166
|
});
|
|
153
167
|
}
|
|
168
|
+
if (axiosError.code === "ERR_NETWORK" || axiosError.code === "ENOTFOUND" || axiosError.code === "ECONNREFUSED" || axiosError.code === "EHOSTUNREACH" || axiosError.code === "ETIMEDOUT" || axiosError.code === "ERR_INTERNET_DISCONNECTED" || ((_b = axiosError.message) == null ? void 0 : _b.includes("network")) || ((_c = axiosError.message) == null ? void 0 : _c.includes("internet")) || ((_d = axiosError.message) == null ? void 0 : _d.includes("connection")) || ((_e = axiosError.message) == null ? void 0 : _e.includes("resolve"))) {
|
|
169
|
+
throw createErrorWithContext(
|
|
170
|
+
"Network connection failed. Please check your internet connection or VPN settings.",
|
|
171
|
+
{
|
|
172
|
+
url: config.url,
|
|
173
|
+
method: config.method,
|
|
174
|
+
networkError: true,
|
|
175
|
+
errorCode: axiosError.code,
|
|
176
|
+
originalMessage: axiosError.message
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
154
180
|
if (axiosError.name === "AbortError" || axiosError.code === "ERR_CANCELED") {
|
|
155
181
|
throw createErrorWithContext("Request was aborted", {
|
|
156
182
|
url: config.url,
|
|
@@ -237,6 +263,20 @@ class FetchAdapter {
|
|
|
237
263
|
method: config.method
|
|
238
264
|
});
|
|
239
265
|
}
|
|
266
|
+
if (error instanceof Error) {
|
|
267
|
+
const errorMessage = error.message.toLowerCase();
|
|
268
|
+
if (error.name === "TypeError" && (errorMessage.includes("network") || errorMessage.includes("fetch") || errorMessage.includes("failed to fetch") || errorMessage.includes("internet") || errorMessage.includes("connection") || errorMessage.includes("resolve") || errorMessage.includes("unreachable"))) {
|
|
269
|
+
throw createErrorWithContext(
|
|
270
|
+
"Network connection failed. Please check your internet connection or VPN settings.",
|
|
271
|
+
{
|
|
272
|
+
url: config.url,
|
|
273
|
+
method: config.method,
|
|
274
|
+
networkError: true,
|
|
275
|
+
originalMessage: error.message
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
240
280
|
throw createErrorWithContext(
|
|
241
281
|
`HTTP request failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
242
282
|
{
|
|
@@ -507,6 +547,19 @@ class ConfigManager {
|
|
|
507
547
|
updateConfig(updates) {
|
|
508
548
|
this.config = { ...this.config, ...updates };
|
|
509
549
|
}
|
|
550
|
+
// Security methods to prevent API key exposure
|
|
551
|
+
toString() {
|
|
552
|
+
return `ConfigManager { environment: "${this.config.environment}", region: "${this.config.region}", debug: ${this.config.debug} }`;
|
|
553
|
+
}
|
|
554
|
+
toJSON() {
|
|
555
|
+
const safeConfig = { ...this.config };
|
|
556
|
+
delete safeConfig.apiKey;
|
|
557
|
+
return safeConfig;
|
|
558
|
+
}
|
|
559
|
+
// Custom inspect method for Node.js console logging
|
|
560
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
561
|
+
return this.toString();
|
|
562
|
+
}
|
|
510
563
|
}
|
|
511
564
|
function filterObjectFields(obj, fields) {
|
|
512
565
|
if (!fields || fields.length === 0) {
|
|
@@ -936,7 +989,6 @@ class ColumnsApiClient {
|
|
|
936
989
|
}
|
|
937
990
|
if (!findResult.data) {
|
|
938
991
|
return {
|
|
939
|
-
data: {},
|
|
940
992
|
error: {
|
|
941
993
|
code: "COLUMN_NOT_FOUND",
|
|
942
994
|
message: `Column '${columnName}' not found in table`,
|
|
@@ -971,7 +1023,6 @@ class ColumnsApiClient {
|
|
|
971
1023
|
}
|
|
972
1024
|
if (!findResult.data) {
|
|
973
1025
|
return {
|
|
974
|
-
data: {},
|
|
975
1026
|
error: {
|
|
976
1027
|
code: "COLUMN_NOT_FOUND",
|
|
977
1028
|
message: `Column '${columnName}' not found in table`,
|
|
@@ -1002,7 +1053,6 @@ class ColumnsApiClient {
|
|
|
1002
1053
|
return apiError.response.data;
|
|
1003
1054
|
}
|
|
1004
1055
|
return {
|
|
1005
|
-
data: {},
|
|
1006
1056
|
error: {
|
|
1007
1057
|
code: "API_ERROR",
|
|
1008
1058
|
message: error.message || "Unknown API error",
|
|
@@ -1012,7 +1062,6 @@ class ColumnsApiClient {
|
|
|
1012
1062
|
}
|
|
1013
1063
|
if (error && typeof error === "object" && "message" in error) {
|
|
1014
1064
|
return {
|
|
1015
|
-
data: {},
|
|
1016
1065
|
error: {
|
|
1017
1066
|
code: "CLIENT_ERROR",
|
|
1018
1067
|
message: error.message,
|
|
@@ -1021,7 +1070,6 @@ class ColumnsApiClient {
|
|
|
1021
1070
|
};
|
|
1022
1071
|
}
|
|
1023
1072
|
return {
|
|
1024
|
-
data: {},
|
|
1025
1073
|
error: {
|
|
1026
1074
|
code: "UNKNOWN_ERROR",
|
|
1027
1075
|
message: "An unexpected error occurred",
|
|
@@ -1523,7 +1571,6 @@ class TablesApiClient {
|
|
|
1523
1571
|
return apiError.response.data;
|
|
1524
1572
|
}
|
|
1525
1573
|
return {
|
|
1526
|
-
data: {},
|
|
1527
1574
|
error: {
|
|
1528
1575
|
code: "API_ERROR",
|
|
1529
1576
|
message: error.message || "Unknown API error",
|
|
@@ -1533,7 +1580,6 @@ class TablesApiClient {
|
|
|
1533
1580
|
}
|
|
1534
1581
|
if (error && typeof error === "object" && "message" in error) {
|
|
1535
1582
|
return {
|
|
1536
|
-
data: {},
|
|
1537
1583
|
error: {
|
|
1538
1584
|
code: "CLIENT_ERROR",
|
|
1539
1585
|
message: error.message,
|
|
@@ -1542,7 +1588,6 @@ class TablesApiClient {
|
|
|
1542
1588
|
};
|
|
1543
1589
|
}
|
|
1544
1590
|
return {
|
|
1545
|
-
data: {},
|
|
1546
1591
|
error: {
|
|
1547
1592
|
code: "UNKNOWN_ERROR",
|
|
1548
1593
|
message: "An unexpected error occurred",
|
|
@@ -1600,7 +1645,6 @@ class BaseResource {
|
|
|
1600
1645
|
return response.data;
|
|
1601
1646
|
} catch (error) {
|
|
1602
1647
|
return {
|
|
1603
|
-
data: {},
|
|
1604
1648
|
error: {
|
|
1605
1649
|
code: "CLIENT_ERROR",
|
|
1606
1650
|
message: formatError(error),
|
|
@@ -1655,12 +1699,6 @@ class TableResource extends BaseResource {
|
|
|
1655
1699
|
headers: config.headers
|
|
1656
1700
|
});
|
|
1657
1701
|
}
|
|
1658
|
-
/**
|
|
1659
|
-
* Get the TablesApiClient instance
|
|
1660
|
-
*/
|
|
1661
|
-
getTablesApiClient() {
|
|
1662
|
-
return this.tablesApiClient;
|
|
1663
|
-
}
|
|
1664
1702
|
/**
|
|
1665
1703
|
* Create a new table
|
|
1666
1704
|
*/
|
|
@@ -1910,9 +1948,10 @@ class TableResource extends BaseResource {
|
|
|
1910
1948
|
*/
|
|
1911
1949
|
async rename(oldName, newName) {
|
|
1912
1950
|
try {
|
|
1913
|
-
|
|
1951
|
+
const result = await this.update(oldName, {
|
|
1914
1952
|
name: newName
|
|
1915
1953
|
});
|
|
1954
|
+
return result;
|
|
1916
1955
|
} catch (error) {
|
|
1917
1956
|
throw error instanceof ApiError ? error : new ApiError(this.formatError(error), 500);
|
|
1918
1957
|
}
|
|
@@ -1922,9 +1961,10 @@ class TableResource extends BaseResource {
|
|
|
1922
1961
|
*/
|
|
1923
1962
|
async setAccess(request) {
|
|
1924
1963
|
try {
|
|
1925
|
-
|
|
1964
|
+
const result = await this.update(request.table_name, {
|
|
1926
1965
|
is_shared: request.is_shared
|
|
1927
1966
|
});
|
|
1967
|
+
return result;
|
|
1928
1968
|
} catch (error) {
|
|
1929
1969
|
throw error instanceof ApiError ? error : new ApiError(this.formatError(error), 500);
|
|
1930
1970
|
}
|
|
@@ -1969,22 +2009,12 @@ class ColumnResource extends BaseResource {
|
|
|
1969
2009
|
const tableInfo = await this.getTableInfo(tableName);
|
|
1970
2010
|
if (!tableInfo) {
|
|
1971
2011
|
return {
|
|
1972
|
-
data: {},
|
|
1973
2012
|
error: {
|
|
1974
2013
|
code: "TABLE_NOT_FOUND",
|
|
1975
2014
|
message: `Table '${tableName}' not found`
|
|
1976
2015
|
}
|
|
1977
2016
|
};
|
|
1978
2017
|
}
|
|
1979
|
-
if (tableInfo.snapshot_url) {
|
|
1980
|
-
return {
|
|
1981
|
-
data: {},
|
|
1982
|
-
error: {
|
|
1983
|
-
code: "SNAPSHOT_PROTECTION",
|
|
1984
|
-
message: `Cannot create column in snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
1985
|
-
}
|
|
1986
|
-
};
|
|
1987
|
-
}
|
|
1988
2018
|
const processedColumn = await this.processColumnDefaults(
|
|
1989
2019
|
tableInfo.id,
|
|
1990
2020
|
column
|
|
@@ -1999,7 +2029,6 @@ class ColumnResource extends BaseResource {
|
|
|
1999
2029
|
return result;
|
|
2000
2030
|
} catch (error) {
|
|
2001
2031
|
return {
|
|
2002
|
-
data: {},
|
|
2003
2032
|
error: {
|
|
2004
2033
|
code: "CREATE_COLUMN_ERROR",
|
|
2005
2034
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2096,22 +2125,12 @@ class ColumnResource extends BaseResource {
|
|
|
2096
2125
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2097
2126
|
if (!tableInfo) {
|
|
2098
2127
|
return {
|
|
2099
|
-
data: {},
|
|
2100
2128
|
error: {
|
|
2101
2129
|
code: "TABLE_NOT_FOUND",
|
|
2102
2130
|
message: `Table '${tableName}' not found`
|
|
2103
2131
|
}
|
|
2104
2132
|
};
|
|
2105
2133
|
}
|
|
2106
|
-
if (tableInfo.snapshot_url) {
|
|
2107
|
-
return {
|
|
2108
|
-
data: {},
|
|
2109
|
-
error: {
|
|
2110
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2111
|
-
message: `Cannot create columns in snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2112
|
-
}
|
|
2113
|
-
};
|
|
2114
|
-
}
|
|
2115
2134
|
const processedColumns = [];
|
|
2116
2135
|
for (const column of columns) {
|
|
2117
2136
|
const processedColumn = await this.processColumnDefaults(
|
|
@@ -2129,7 +2148,6 @@ class ColumnResource extends BaseResource {
|
|
|
2129
2148
|
return result;
|
|
2130
2149
|
} catch (error) {
|
|
2131
2150
|
return {
|
|
2132
|
-
data: {},
|
|
2133
2151
|
error: {
|
|
2134
2152
|
code: "CREATE_COLUMNS_ERROR",
|
|
2135
2153
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2145,7 +2163,6 @@ class ColumnResource extends BaseResource {
|
|
|
2145
2163
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2146
2164
|
if (!tableInfo) {
|
|
2147
2165
|
return {
|
|
2148
|
-
data: {},
|
|
2149
2166
|
error: {
|
|
2150
2167
|
code: "TABLE_NOT_FOUND",
|
|
2151
2168
|
message: `Table '${tableName}' not found`
|
|
@@ -2163,7 +2180,6 @@ class ColumnResource extends BaseResource {
|
|
|
2163
2180
|
return result;
|
|
2164
2181
|
} catch (error) {
|
|
2165
2182
|
return {
|
|
2166
|
-
data: {},
|
|
2167
2183
|
error: {
|
|
2168
2184
|
code: "LIST_COLUMNS_ERROR",
|
|
2169
2185
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2179,7 +2195,6 @@ class ColumnResource extends BaseResource {
|
|
|
2179
2195
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2180
2196
|
if (!tableInfo) {
|
|
2181
2197
|
return {
|
|
2182
|
-
data: {},
|
|
2183
2198
|
error: {
|
|
2184
2199
|
code: "TABLE_NOT_FOUND",
|
|
2185
2200
|
message: `Table '${tableName}' not found`
|
|
@@ -2195,7 +2210,6 @@ class ColumnResource extends BaseResource {
|
|
|
2195
2210
|
}
|
|
2196
2211
|
if (!result.data) {
|
|
2197
2212
|
return {
|
|
2198
|
-
data: {},
|
|
2199
2213
|
error: {
|
|
2200
2214
|
code: "COLUMN_NOT_FOUND",
|
|
2201
2215
|
message: `Column '${columnName}' not found in table '${tableName}'`
|
|
@@ -2208,7 +2222,6 @@ class ColumnResource extends BaseResource {
|
|
|
2208
2222
|
};
|
|
2209
2223
|
} catch (error) {
|
|
2210
2224
|
return {
|
|
2211
|
-
data: {},
|
|
2212
2225
|
error: {
|
|
2213
2226
|
code: "GET_COLUMN_ERROR",
|
|
2214
2227
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2221,7 +2234,6 @@ class ColumnResource extends BaseResource {
|
|
|
2221
2234
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2222
2235
|
if (!tableInfo) {
|
|
2223
2236
|
return {
|
|
2224
|
-
data: {},
|
|
2225
2237
|
error: {
|
|
2226
2238
|
code: "TABLE_NOT_FOUND",
|
|
2227
2239
|
message: `Table '${tableName}' not found`
|
|
@@ -2238,7 +2250,6 @@ class ColumnResource extends BaseResource {
|
|
|
2238
2250
|
return result;
|
|
2239
2251
|
} catch (error) {
|
|
2240
2252
|
return {
|
|
2241
|
-
data: {},
|
|
2242
2253
|
error: {
|
|
2243
2254
|
code: "FIND_COLUMN_BY_ID_ERROR",
|
|
2244
2255
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2254,22 +2265,12 @@ class ColumnResource extends BaseResource {
|
|
|
2254
2265
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2255
2266
|
if (!tableInfo) {
|
|
2256
2267
|
return {
|
|
2257
|
-
data: {},
|
|
2258
2268
|
error: {
|
|
2259
2269
|
code: "TABLE_NOT_FOUND",
|
|
2260
2270
|
message: `Table '${tableName}' not found`
|
|
2261
2271
|
}
|
|
2262
2272
|
};
|
|
2263
2273
|
}
|
|
2264
|
-
if (tableInfo.snapshot_url) {
|
|
2265
|
-
return {
|
|
2266
|
-
data: {},
|
|
2267
|
-
error: {
|
|
2268
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2269
|
-
message: `Cannot update column '${columnName}' in snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2270
|
-
}
|
|
2271
|
-
};
|
|
2272
|
-
}
|
|
2273
2274
|
const result = await this.columnsApiClient.updateColumnByName(
|
|
2274
2275
|
tableInfo.id,
|
|
2275
2276
|
columnName,
|
|
@@ -2281,7 +2282,6 @@ class ColumnResource extends BaseResource {
|
|
|
2281
2282
|
return result;
|
|
2282
2283
|
} catch (error) {
|
|
2283
2284
|
return {
|
|
2284
|
-
data: {},
|
|
2285
2285
|
error: {
|
|
2286
2286
|
code: "UPDATE_COLUMN_ERROR",
|
|
2287
2287
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2297,22 +2297,12 @@ class ColumnResource extends BaseResource {
|
|
|
2297
2297
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2298
2298
|
if (!tableInfo) {
|
|
2299
2299
|
return {
|
|
2300
|
-
data: {},
|
|
2301
2300
|
error: {
|
|
2302
2301
|
code: "TABLE_NOT_FOUND",
|
|
2303
2302
|
message: `Table '${tableName}' not found`
|
|
2304
2303
|
}
|
|
2305
2304
|
};
|
|
2306
2305
|
}
|
|
2307
|
-
if (tableInfo.snapshot_url) {
|
|
2308
|
-
return {
|
|
2309
|
-
data: {},
|
|
2310
|
-
error: {
|
|
2311
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2312
|
-
message: `Cannot delete column '${columnName}' from snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2313
|
-
}
|
|
2314
|
-
};
|
|
2315
|
-
}
|
|
2316
2306
|
const result = await this.columnsApiClient.deleteColumnByName(
|
|
2317
2307
|
tableInfo.id,
|
|
2318
2308
|
columnName
|
|
@@ -2328,7 +2318,6 @@ class ColumnResource extends BaseResource {
|
|
|
2328
2318
|
};
|
|
2329
2319
|
} catch (error) {
|
|
2330
2320
|
return {
|
|
2331
|
-
data: {},
|
|
2332
2321
|
error: {
|
|
2333
2322
|
code: "DELETE_COLUMN_ERROR",
|
|
2334
2323
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2369,6 +2358,11 @@ const RECORD_ENDPOINTS = {
|
|
|
2369
2358
|
method: "POST",
|
|
2370
2359
|
authenticated: true
|
|
2371
2360
|
},
|
|
2361
|
+
insertMany: {
|
|
2362
|
+
path: "/tables/{table_id}/records/bulk-insert",
|
|
2363
|
+
method: "POST",
|
|
2364
|
+
authenticated: true
|
|
2365
|
+
},
|
|
2372
2366
|
list: {
|
|
2373
2367
|
path: "/tables/{table_id}/records/list",
|
|
2374
2368
|
method: "POST",
|
|
@@ -2482,6 +2476,42 @@ class RecordsApiClient {
|
|
|
2482
2476
|
return this.formatErrorResponse(error);
|
|
2483
2477
|
}
|
|
2484
2478
|
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Insert multiple records in bulk
|
|
2481
|
+
*/
|
|
2482
|
+
async insertManyRecords(records, tableId, options = { validation: true }) {
|
|
2483
|
+
try {
|
|
2484
|
+
if (!tableId) {
|
|
2485
|
+
return this.formatErrorResponse(
|
|
2486
|
+
new Error("table_id is required for bulk insert operation")
|
|
2487
|
+
);
|
|
2488
|
+
}
|
|
2489
|
+
if (!records || !Array.isArray(records) || records.length === 0) {
|
|
2490
|
+
return this.formatErrorResponse(
|
|
2491
|
+
new Error("records array is required and cannot be empty")
|
|
2492
|
+
);
|
|
2493
|
+
}
|
|
2494
|
+
const endpoint = RECORD_ENDPOINTS.insertMany;
|
|
2495
|
+
let url = `${this.baseURL}${buildRecordEndpointPath(endpoint, { table_id: tableId })}`;
|
|
2496
|
+
const queryParams = new URLSearchParams();
|
|
2497
|
+
if (options.validation !== void 0) {
|
|
2498
|
+
queryParams.append("validation", options.validation.toString());
|
|
2499
|
+
}
|
|
2500
|
+
if (queryParams.toString()) {
|
|
2501
|
+
url += `?${queryParams.toString()}`;
|
|
2502
|
+
}
|
|
2503
|
+
const response = await this.httpAdapter.request({
|
|
2504
|
+
url,
|
|
2505
|
+
method: endpoint.method,
|
|
2506
|
+
headers: this.buildHeaders(),
|
|
2507
|
+
data: records,
|
|
2508
|
+
timeout: this.config.timeout
|
|
2509
|
+
});
|
|
2510
|
+
return response.data;
|
|
2511
|
+
} catch (error) {
|
|
2512
|
+
return this.formatErrorResponse(error);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2485
2515
|
/**
|
|
2486
2516
|
* Get a single record by ID
|
|
2487
2517
|
*/
|
|
@@ -2667,7 +2697,6 @@ class RecordsApiClient {
|
|
|
2667
2697
|
return apiError.response.data;
|
|
2668
2698
|
}
|
|
2669
2699
|
return {
|
|
2670
|
-
data: {},
|
|
2671
2700
|
error: {
|
|
2672
2701
|
code: "API_ERROR",
|
|
2673
2702
|
message: error.message || "Unknown API error",
|
|
@@ -2677,7 +2706,6 @@ class RecordsApiClient {
|
|
|
2677
2706
|
}
|
|
2678
2707
|
if (error && typeof error === "object" && "message" in error) {
|
|
2679
2708
|
return {
|
|
2680
|
-
data: {},
|
|
2681
2709
|
error: {
|
|
2682
2710
|
code: "CLIENT_ERROR",
|
|
2683
2711
|
message: error.message,
|
|
@@ -2686,7 +2714,6 @@ class RecordsApiClient {
|
|
|
2686
2714
|
};
|
|
2687
2715
|
}
|
|
2688
2716
|
return {
|
|
2689
|
-
data: {},
|
|
2690
2717
|
error: {
|
|
2691
2718
|
code: "UNKNOWN_ERROR",
|
|
2692
2719
|
message: "An unexpected error occurred",
|
|
@@ -2717,22 +2744,12 @@ class RecordResource {
|
|
|
2717
2744
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2718
2745
|
if (!tableInfo) {
|
|
2719
2746
|
return {
|
|
2720
|
-
data: {},
|
|
2721
2747
|
error: {
|
|
2722
2748
|
code: "TABLE_NOT_FOUND",
|
|
2723
2749
|
message: `Table '${tableName}' not found`
|
|
2724
2750
|
}
|
|
2725
2751
|
};
|
|
2726
2752
|
}
|
|
2727
|
-
if (tableInfo.snapshot_url) {
|
|
2728
|
-
return {
|
|
2729
|
-
data: {},
|
|
2730
|
-
error: {
|
|
2731
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2732
|
-
message: `Cannot insert record into snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2733
|
-
}
|
|
2734
|
-
};
|
|
2735
|
-
}
|
|
2736
2753
|
const completeDataResult = await this.ensureCompleteRecordData(
|
|
2737
2754
|
tableName,
|
|
2738
2755
|
data
|
|
@@ -2751,7 +2768,6 @@ class RecordResource {
|
|
|
2751
2768
|
return result;
|
|
2752
2769
|
} catch (error) {
|
|
2753
2770
|
return {
|
|
2754
|
-
data: {},
|
|
2755
2771
|
error: {
|
|
2756
2772
|
code: "INSERT_ERROR",
|
|
2757
2773
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2759,6 +2775,46 @@ class RecordResource {
|
|
|
2759
2775
|
};
|
|
2760
2776
|
}
|
|
2761
2777
|
}
|
|
2778
|
+
/**
|
|
2779
|
+
* Insert multiple records in bulk
|
|
2780
|
+
*/
|
|
2781
|
+
async insertMany(tableName, records, options = { validation: true }) {
|
|
2782
|
+
try {
|
|
2783
|
+
if (!records || !Array.isArray(records) || records.length === 0) {
|
|
2784
|
+
return {
|
|
2785
|
+
error: {
|
|
2786
|
+
code: "INVALID_INPUT",
|
|
2787
|
+
message: "Records array is required and cannot be empty"
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
}
|
|
2791
|
+
const tableInfo = await this.getTableInfo(tableName);
|
|
2792
|
+
if (!tableInfo) {
|
|
2793
|
+
return {
|
|
2794
|
+
error: {
|
|
2795
|
+
code: "TABLE_NOT_FOUND",
|
|
2796
|
+
message: `Table '${tableName}' not found`
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2799
|
+
}
|
|
2800
|
+
const result = await this.apiClient.insertManyRecords(
|
|
2801
|
+
records,
|
|
2802
|
+
tableInfo.id,
|
|
2803
|
+
options
|
|
2804
|
+
);
|
|
2805
|
+
if (isErrorResponse(result)) {
|
|
2806
|
+
return result;
|
|
2807
|
+
}
|
|
2808
|
+
return result;
|
|
2809
|
+
} catch (error) {
|
|
2810
|
+
return {
|
|
2811
|
+
error: {
|
|
2812
|
+
code: "INSERT_MANY_ERROR",
|
|
2813
|
+
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
2814
|
+
}
|
|
2815
|
+
};
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2762
2818
|
/**
|
|
2763
2819
|
* Get a single record by ID
|
|
2764
2820
|
*/
|
|
@@ -2767,7 +2823,6 @@ class RecordResource {
|
|
|
2767
2823
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2768
2824
|
if (!tableInfo) {
|
|
2769
2825
|
return {
|
|
2770
|
-
data: {},
|
|
2771
2826
|
error: {
|
|
2772
2827
|
code: "TABLE_NOT_FOUND",
|
|
2773
2828
|
message: `Table '${tableName}' not found`
|
|
@@ -2781,7 +2836,6 @@ class RecordResource {
|
|
|
2781
2836
|
return result;
|
|
2782
2837
|
} catch (error) {
|
|
2783
2838
|
return {
|
|
2784
|
-
data: {},
|
|
2785
2839
|
error: {
|
|
2786
2840
|
code: "GET_ERROR",
|
|
2787
2841
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2797,7 +2851,6 @@ class RecordResource {
|
|
|
2797
2851
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2798
2852
|
if (!tableInfo) {
|
|
2799
2853
|
return {
|
|
2800
|
-
data: {},
|
|
2801
2854
|
error: {
|
|
2802
2855
|
code: "TABLE_NOT_FOUND",
|
|
2803
2856
|
message: `Table '${tableName}' not found`
|
|
@@ -2812,7 +2865,6 @@ class RecordResource {
|
|
|
2812
2865
|
return result;
|
|
2813
2866
|
} catch (error) {
|
|
2814
2867
|
return {
|
|
2815
|
-
data: {},
|
|
2816
2868
|
error: {
|
|
2817
2869
|
code: "LIST_ERROR",
|
|
2818
2870
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2828,22 +2880,12 @@ class RecordResource {
|
|
|
2828
2880
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2829
2881
|
if (!tableInfo) {
|
|
2830
2882
|
return {
|
|
2831
|
-
data: {},
|
|
2832
2883
|
error: {
|
|
2833
2884
|
code: "TABLE_NOT_FOUND",
|
|
2834
2885
|
message: `Table '${tableName}' not found`
|
|
2835
2886
|
}
|
|
2836
2887
|
};
|
|
2837
2888
|
}
|
|
2838
|
-
if (tableInfo.snapshot_url) {
|
|
2839
|
-
return {
|
|
2840
|
-
data: {},
|
|
2841
|
-
error: {
|
|
2842
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2843
|
-
message: `Cannot update records in snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2844
|
-
}
|
|
2845
|
-
};
|
|
2846
|
-
}
|
|
2847
2889
|
const requestOptions = { ...options, table_id: tableInfo.id };
|
|
2848
2890
|
const result = await this.apiClient.updateRecords(requestOptions);
|
|
2849
2891
|
if (isErrorResponse(result)) {
|
|
@@ -2852,7 +2894,6 @@ class RecordResource {
|
|
|
2852
2894
|
return result;
|
|
2853
2895
|
} catch (error) {
|
|
2854
2896
|
return {
|
|
2855
|
-
data: {},
|
|
2856
2897
|
error: {
|
|
2857
2898
|
code: "UPDATE_ERROR",
|
|
2858
2899
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2868,22 +2909,12 @@ class RecordResource {
|
|
|
2868
2909
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2869
2910
|
if (!tableInfo) {
|
|
2870
2911
|
return {
|
|
2871
|
-
data: {},
|
|
2872
2912
|
error: {
|
|
2873
2913
|
code: "TABLE_NOT_FOUND",
|
|
2874
2914
|
message: `Table '${tableName}' not found`
|
|
2875
2915
|
}
|
|
2876
2916
|
};
|
|
2877
2917
|
}
|
|
2878
|
-
if (tableInfo.snapshot_url) {
|
|
2879
|
-
return {
|
|
2880
|
-
data: {},
|
|
2881
|
-
error: {
|
|
2882
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2883
|
-
message: `Cannot update record in snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2884
|
-
}
|
|
2885
|
-
};
|
|
2886
|
-
}
|
|
2887
2918
|
const requestOptions = {
|
|
2888
2919
|
id: recordId,
|
|
2889
2920
|
set: data,
|
|
@@ -2899,7 +2930,6 @@ class RecordResource {
|
|
|
2899
2930
|
return result;
|
|
2900
2931
|
} catch (error) {
|
|
2901
2932
|
return {
|
|
2902
|
-
data: {},
|
|
2903
2933
|
error: {
|
|
2904
2934
|
code: "UPDATE_BY_ID_ERROR",
|
|
2905
2935
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2915,22 +2945,12 @@ class RecordResource {
|
|
|
2915
2945
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2916
2946
|
if (!tableInfo) {
|
|
2917
2947
|
return {
|
|
2918
|
-
data: {},
|
|
2919
2948
|
error: {
|
|
2920
2949
|
code: "TABLE_NOT_FOUND",
|
|
2921
2950
|
message: `Table '${tableName}' not found`
|
|
2922
2951
|
}
|
|
2923
2952
|
};
|
|
2924
2953
|
}
|
|
2925
|
-
if (tableInfo.snapshot_url) {
|
|
2926
|
-
return {
|
|
2927
|
-
data: {},
|
|
2928
|
-
error: {
|
|
2929
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2930
|
-
message: `Cannot delete records from snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2931
|
-
}
|
|
2932
|
-
};
|
|
2933
|
-
}
|
|
2934
2954
|
const requestOptions = { ...options, table_id: tableInfo.id };
|
|
2935
2955
|
const result = await this.apiClient.deleteRecords(requestOptions);
|
|
2936
2956
|
if (isErrorResponse(result)) {
|
|
@@ -2939,7 +2959,6 @@ class RecordResource {
|
|
|
2939
2959
|
return result;
|
|
2940
2960
|
} catch (error) {
|
|
2941
2961
|
return {
|
|
2942
|
-
data: {},
|
|
2943
2962
|
error: {
|
|
2944
2963
|
code: "DELETE_ERROR",
|
|
2945
2964
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -2955,22 +2974,12 @@ class RecordResource {
|
|
|
2955
2974
|
const tableInfo = await this.getTableInfo(tableName);
|
|
2956
2975
|
if (!tableInfo) {
|
|
2957
2976
|
return {
|
|
2958
|
-
data: {},
|
|
2959
2977
|
error: {
|
|
2960
2978
|
code: "TABLE_NOT_FOUND",
|
|
2961
2979
|
message: `Table '${tableName}' not found`
|
|
2962
2980
|
}
|
|
2963
2981
|
};
|
|
2964
2982
|
}
|
|
2965
|
-
if (tableInfo.snapshot_url) {
|
|
2966
|
-
return {
|
|
2967
|
-
data: {},
|
|
2968
|
-
error: {
|
|
2969
|
-
code: "SNAPSHOT_PROTECTION",
|
|
2970
|
-
message: `Cannot delete record from snapshot table '${tableName}'. Snapshots are read-only and cannot be modified.`
|
|
2971
|
-
}
|
|
2972
|
-
};
|
|
2973
|
-
}
|
|
2974
2983
|
const result = await this.apiClient.deleteRecordById(recordId, {
|
|
2975
2984
|
table_id: tableInfo.id
|
|
2976
2985
|
});
|
|
@@ -2980,7 +2989,6 @@ class RecordResource {
|
|
|
2980
2989
|
return result;
|
|
2981
2990
|
} catch (error) {
|
|
2982
2991
|
return {
|
|
2983
|
-
data: {},
|
|
2984
2992
|
error: {
|
|
2985
2993
|
code: "DELETE_BY_ID_ERROR",
|
|
2986
2994
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -3031,7 +3039,6 @@ class RecordResource {
|
|
|
3031
3039
|
return completeData;
|
|
3032
3040
|
} catch (error) {
|
|
3033
3041
|
return {
|
|
3034
|
-
data: {},
|
|
3035
3042
|
error: {
|
|
3036
3043
|
code: "COMPLETE_DATA_ERROR",
|
|
3037
3044
|
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
@@ -3180,7 +3187,6 @@ class RecordBuilder {
|
|
|
3180
3187
|
async update() {
|
|
3181
3188
|
if (!this.updateData) {
|
|
3182
3189
|
return {
|
|
3183
|
-
data: [],
|
|
3184
3190
|
error: {
|
|
3185
3191
|
code: "MISSING_UPDATE_DATA",
|
|
3186
3192
|
message: "Update data is required for update operation"
|
|
@@ -3217,7 +3223,6 @@ class RecordBuilder {
|
|
|
3217
3223
|
async delete() {
|
|
3218
3224
|
if (!this.queryOptions.filters || this.queryOptions.filters.length === 0) {
|
|
3219
3225
|
return {
|
|
3220
|
-
data: {},
|
|
3221
3226
|
error: {
|
|
3222
3227
|
code: "MISSING_DELETE_CONDITIONS",
|
|
3223
3228
|
message: "Filter conditions are required for delete operation. Use where() to specify conditions."
|
|
@@ -3313,7 +3318,6 @@ class BaseApiClient {
|
|
|
3313
3318
|
return apiError.response.data;
|
|
3314
3319
|
}
|
|
3315
3320
|
return {
|
|
3316
|
-
data: {},
|
|
3317
3321
|
error: {
|
|
3318
3322
|
code: `${prefix}_ERROR`,
|
|
3319
3323
|
message: error.message || `Unknown ${prefix} error`,
|
|
@@ -3323,7 +3327,6 @@ class BaseApiClient {
|
|
|
3323
3327
|
}
|
|
3324
3328
|
if (error && typeof error === "object" && "message" in error) {
|
|
3325
3329
|
return {
|
|
3326
|
-
data: {},
|
|
3327
3330
|
error: {
|
|
3328
3331
|
code: `${prefix}_CLIENT_ERROR`,
|
|
3329
3332
|
message: error.message,
|
|
@@ -3332,7 +3335,6 @@ class BaseApiClient {
|
|
|
3332
3335
|
};
|
|
3333
3336
|
}
|
|
3334
3337
|
return {
|
|
3335
|
-
data: {},
|
|
3336
3338
|
error: {
|
|
3337
3339
|
code: `${prefix}_UNKNOWN_ERROR`,
|
|
3338
3340
|
message: `An unexpected ${prefix} error occurred`,
|
|
@@ -3340,6 +3342,22 @@ class BaseApiClient {
|
|
|
3340
3342
|
}
|
|
3341
3343
|
};
|
|
3342
3344
|
}
|
|
3345
|
+
// Security methods to prevent API key exposure
|
|
3346
|
+
toString() {
|
|
3347
|
+
return `${this.constructor.name} { environment: "${this.config.environment || "prod"}", debug: ${this.config.debug || false} }`;
|
|
3348
|
+
}
|
|
3349
|
+
toJSON() {
|
|
3350
|
+
const safeConfig = { ...this.config };
|
|
3351
|
+
delete safeConfig.apiKey;
|
|
3352
|
+
return {
|
|
3353
|
+
client: this.constructor.name,
|
|
3354
|
+
config: safeConfig
|
|
3355
|
+
};
|
|
3356
|
+
}
|
|
3357
|
+
// Custom inspect method for Node.js console logging
|
|
3358
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
3359
|
+
return this.toString();
|
|
3360
|
+
}
|
|
3343
3361
|
}
|
|
3344
3362
|
class SqlApiClient extends BaseApiClient {
|
|
3345
3363
|
constructor(apiKey, config = {}) {
|
|
@@ -3454,7 +3472,7 @@ class SqlResource {
|
|
|
3454
3472
|
async executeSQL(query) {
|
|
3455
3473
|
const response = await this.sqlApiClient.executeSQL({ query });
|
|
3456
3474
|
if (isErrorResponse(response)) {
|
|
3457
|
-
|
|
3475
|
+
return response;
|
|
3458
3476
|
}
|
|
3459
3477
|
return response;
|
|
3460
3478
|
}
|
|
@@ -3708,43 +3726,6 @@ class TableBuilder {
|
|
|
3708
3726
|
});
|
|
3709
3727
|
return this;
|
|
3710
3728
|
}
|
|
3711
|
-
/**
|
|
3712
|
-
/**
|
|
3713
|
-
* Add a half-precision vector field
|
|
3714
|
-
*/
|
|
3715
|
-
halfVector(name, dimension, options = {}) {
|
|
3716
|
-
this.fields.push({
|
|
3717
|
-
name,
|
|
3718
|
-
type: "halfvec",
|
|
3719
|
-
is_nullable: options.nullable ?? true,
|
|
3720
|
-
is_unique: false,
|
|
3721
|
-
is_indexed: false,
|
|
3722
|
-
is_primary_key: false,
|
|
3723
|
-
description: options.description,
|
|
3724
|
-
vector_dimension: dimension,
|
|
3725
|
-
alignment: "left",
|
|
3726
|
-
field_order: this.fields.length + 1
|
|
3727
|
-
});
|
|
3728
|
-
return this;
|
|
3729
|
-
}
|
|
3730
|
-
/**
|
|
3731
|
-
* Add a sparse vector field
|
|
3732
|
-
*/
|
|
3733
|
-
sparseVector(name, dimension, options = {}) {
|
|
3734
|
-
this.fields.push({
|
|
3735
|
-
name,
|
|
3736
|
-
type: "sparsevec",
|
|
3737
|
-
is_nullable: options.nullable ?? true,
|
|
3738
|
-
is_unique: false,
|
|
3739
|
-
is_indexed: false,
|
|
3740
|
-
is_primary_key: false,
|
|
3741
|
-
description: options.description,
|
|
3742
|
-
vector_dimension: dimension,
|
|
3743
|
-
alignment: "left",
|
|
3744
|
-
field_order: this.fields.length + 1
|
|
3745
|
-
});
|
|
3746
|
-
return this;
|
|
3747
|
-
}
|
|
3748
3729
|
/**
|
|
3749
3730
|
* Add a custom field
|
|
3750
3731
|
*/
|
|
@@ -3872,10 +3853,7 @@ class BolticClient {
|
|
|
3872
3853
|
}
|
|
3873
3854
|
// Fluent table operations
|
|
3874
3855
|
table(name) {
|
|
3875
|
-
const tableBuilder = createTableBuilder(
|
|
3876
|
-
{ name },
|
|
3877
|
-
this.tableResource.getTablesApiClient()
|
|
3878
|
-
);
|
|
3856
|
+
const tableBuilder = createTableBuilder({ name });
|
|
3879
3857
|
return tableBuilder;
|
|
3880
3858
|
}
|
|
3881
3859
|
// Method 3: Table-scoped operations
|
|
@@ -3892,6 +3870,7 @@ class BolticClient {
|
|
|
3892
3870
|
// Record operations for this table
|
|
3893
3871
|
records: () => ({
|
|
3894
3872
|
insert: (data) => this.recordResource.insert(tableName, data),
|
|
3873
|
+
insertMany: (records, options) => this.recordResource.insertMany(tableName, records, options),
|
|
3895
3874
|
findOne: (recordId) => this.recordResource.get(tableName, recordId),
|
|
3896
3875
|
update: (options) => this.recordResource.update(tableName, options),
|
|
3897
3876
|
updateById: (recordId, data) => this.recordResource.updateById(tableName, recordId, data),
|
|
@@ -3911,6 +3890,7 @@ class BolticClient {
|
|
|
3911
3890
|
get records() {
|
|
3912
3891
|
return {
|
|
3913
3892
|
insert: (tableName, data) => this.recordResource.insert(tableName, data),
|
|
3893
|
+
insertMany: (tableName, records, options) => this.recordResource.insertMany(tableName, records, options),
|
|
3914
3894
|
findAll: (tableName, options) => this.recordResource.list(tableName, options),
|
|
3915
3895
|
findOne: (tableName, recordId) => this.recordResource.get(tableName, recordId),
|
|
3916
3896
|
update: (tableName, options) => this.recordResource.update(tableName, options),
|
|
@@ -3945,6 +3925,7 @@ class BolticClient {
|
|
|
3945
3925
|
updateConfig(updates) {
|
|
3946
3926
|
this.configManager.updateConfig(updates);
|
|
3947
3927
|
this.baseClient.updateConfig(this.configManager.getConfig());
|
|
3928
|
+
this.updateAllResourcesConfig();
|
|
3948
3929
|
}
|
|
3949
3930
|
getConfig() {
|
|
3950
3931
|
return this.configManager.getConfig();
|
|
@@ -3995,13 +3976,43 @@ class BolticClient {
|
|
|
3995
3976
|
// Debug helpers
|
|
3996
3977
|
enableDebug() {
|
|
3997
3978
|
this.configManager.updateConfig({ debug: true });
|
|
3979
|
+
this.baseClient.updateConfig(this.configManager.getConfig());
|
|
3980
|
+
this.updateAllResourcesConfig();
|
|
3998
3981
|
}
|
|
3999
3982
|
disableDebug() {
|
|
4000
3983
|
this.configManager.updateConfig({ debug: false });
|
|
3984
|
+
this.baseClient.updateConfig(this.configManager.getConfig());
|
|
3985
|
+
this.updateAllResourcesConfig();
|
|
4001
3986
|
}
|
|
4002
3987
|
isDebugEnabled() {
|
|
4003
3988
|
return this.configManager.getConfig().debug || false;
|
|
4004
3989
|
}
|
|
3990
|
+
// Private method to update all resource configurations
|
|
3991
|
+
updateAllResourcesConfig() {
|
|
3992
|
+
this.tableResource = new TableResource(this.baseClient);
|
|
3993
|
+
this.columnResource = new ColumnResource(this.baseClient);
|
|
3994
|
+
this.recordResource = new RecordResource(this.baseClient);
|
|
3995
|
+
this.sqlResource = new SqlResource(this.baseClient);
|
|
3996
|
+
}
|
|
3997
|
+
// Security methods to prevent API key exposure
|
|
3998
|
+
toString() {
|
|
3999
|
+
const config = this.getConfig();
|
|
4000
|
+
return `BolticClient { environment: "${config.environment}", region: "${config.region}", debug: ${config.debug} }`;
|
|
4001
|
+
}
|
|
4002
|
+
toJSON() {
|
|
4003
|
+
const config = this.getConfig();
|
|
4004
|
+
return {
|
|
4005
|
+
environment: config.environment,
|
|
4006
|
+
region: config.region,
|
|
4007
|
+
debug: config.debug,
|
|
4008
|
+
timeout: config.timeout,
|
|
4009
|
+
version: this.getVersion()
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
4012
|
+
// Custom inspect method for Node.js console logging
|
|
4013
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
4014
|
+
return this.toString();
|
|
4015
|
+
}
|
|
4005
4016
|
}
|
|
4006
4017
|
function createTestClient(options = {}) {
|
|
4007
4018
|
return new BolticClient(options.apiKey || "test-api-key-12345", {
|
|
@@ -4050,4 +4061,4 @@ export {
|
|
|
4050
4061
|
createMockResponse as p,
|
|
4051
4062
|
createTestClient as q
|
|
4052
4063
|
};
|
|
4053
|
-
//# sourceMappingURL=test-client-
|
|
4064
|
+
//# sourceMappingURL=test-client-BffJwqJq.mjs.map
|