@boltic/sdk 0.1.0 → 0.1.2
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 -8
- package/dist/sdk.js +5 -34
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.mjs +5 -34
- package/dist/sdk.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -309,17 +309,11 @@ const tableByName = await client.tables.findByName('users');
|
|
|
309
309
|
// Update table properties
|
|
310
310
|
const updateResult = await client.tables.update('users', {
|
|
311
311
|
name: 'updated_users',
|
|
312
|
-
|
|
312
|
+
description: 'Updated description',
|
|
313
313
|
});
|
|
314
314
|
|
|
315
315
|
// Rename table
|
|
316
316
|
const renameResult = await client.tables.rename('users', 'new_users');
|
|
317
|
-
|
|
318
|
-
// Set table access
|
|
319
|
-
const accessResult = await client.tables.setAccess({
|
|
320
|
-
table_name: 'new_users',
|
|
321
|
-
is_shared: true,
|
|
322
|
-
});
|
|
323
317
|
```
|
|
324
318
|
|
|
325
319
|
### Deleting Tables
|
|
@@ -1040,7 +1034,6 @@ main().catch(console.error);
|
|
|
1040
1034
|
- **`client.tables.findByName(name)`**: Get table by name
|
|
1041
1035
|
- **`client.tables.update(identifier, data)`**: Update table properties
|
|
1042
1036
|
- **`client.tables.rename(oldName, newName)`**: Rename a table
|
|
1043
|
-
- **`client.tables.setAccess(data)`**: Update table access settings
|
|
1044
1037
|
- **`client.tables.delete(name)`**: Delete a table by name
|
|
1045
1038
|
|
|
1046
1039
|
### Columns
|
package/dist/sdk.js
CHANGED
|
@@ -2025,30 +2025,7 @@ class TableResource extends BaseResource {
|
|
|
2025
2025
|
*/
|
|
2026
2026
|
async rename(oldName, newName, dbId) {
|
|
2027
2027
|
try {
|
|
2028
|
-
const result = await this.update(
|
|
2029
|
-
oldName,
|
|
2030
|
-
{
|
|
2031
|
-
name: newName
|
|
2032
|
-
},
|
|
2033
|
-
dbId
|
|
2034
|
-
);
|
|
2035
|
-
return result;
|
|
2036
|
-
} catch (error) {
|
|
2037
|
-
throw error instanceof ApiError ? error : new ApiError(this.formatError(error), 500);
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
/**
|
|
2041
|
-
* Set table access permissions
|
|
2042
|
-
*/
|
|
2043
|
-
async setAccess(request, dbId) {
|
|
2044
|
-
try {
|
|
2045
|
-
const result = await this.update(
|
|
2046
|
-
request.table_name,
|
|
2047
|
-
{
|
|
2048
|
-
is_shared: request.is_shared
|
|
2049
|
-
},
|
|
2050
|
-
dbId
|
|
2051
|
-
);
|
|
2028
|
+
const result = await this.update(oldName, { name: newName }, dbId);
|
|
2052
2029
|
return result;
|
|
2053
2030
|
} catch (error) {
|
|
2054
2031
|
throw error instanceof ApiError ? error : new ApiError(this.formatError(error), 500);
|
|
@@ -4508,7 +4485,6 @@ class SqlResource {
|
|
|
4508
4485
|
}
|
|
4509
4486
|
class TableBuilder {
|
|
4510
4487
|
constructor(options, tablesApiClient) {
|
|
4511
|
-
this.isPublic = false;
|
|
4512
4488
|
this.fields = [];
|
|
4513
4489
|
this.tableName = options.name;
|
|
4514
4490
|
this.description = options.description;
|
|
@@ -4528,13 +4504,6 @@ class TableBuilder {
|
|
|
4528
4504
|
this.description = description;
|
|
4529
4505
|
return this;
|
|
4530
4506
|
}
|
|
4531
|
-
/**
|
|
4532
|
-
* Set if table is public
|
|
4533
|
-
*/
|
|
4534
|
-
public(isPublic = true) {
|
|
4535
|
-
this.isPublic = isPublic;
|
|
4536
|
-
return this;
|
|
4537
|
-
}
|
|
4538
4507
|
/**
|
|
4539
4508
|
* Add a text field
|
|
4540
4509
|
*/
|
|
@@ -4875,12 +4844,15 @@ class BolticClient {
|
|
|
4875
4844
|
* ```
|
|
4876
4845
|
*/
|
|
4877
4846
|
async useDatabase(dbInternalName) {
|
|
4847
|
+
console.log(`Database internal name:${dbInternalName}`);
|
|
4878
4848
|
if (!dbInternalName || dbInternalName === "") {
|
|
4879
4849
|
this.currentDatabase = null;
|
|
4880
4850
|
return;
|
|
4881
4851
|
}
|
|
4882
4852
|
const result = await this.databaseResource.findOne(dbInternalName);
|
|
4853
|
+
console.log(`Result:${JSON.stringify(result, null, 2)}`);
|
|
4883
4854
|
if (isErrorResponse(result)) {
|
|
4855
|
+
console.log(`Error:${result.error.message}`);
|
|
4884
4856
|
throw new Error(
|
|
4885
4857
|
result.error.message || `Failed to switch database to internal name '${dbInternalName}'`
|
|
4886
4858
|
);
|
|
@@ -4915,8 +4887,7 @@ class BolticClient {
|
|
|
4915
4887
|
findOne: (options) => this.tableResource.findOne(options, dbId),
|
|
4916
4888
|
update: (name, data) => this.tableResource.update(name, data, dbId),
|
|
4917
4889
|
delete: (name) => this.tableResource.delete(name, dbId),
|
|
4918
|
-
rename: (oldName, newName) => this.tableResource.rename(oldName, newName, dbId)
|
|
4919
|
-
setAccess: (request) => this.tableResource.setAccess(request, dbId)
|
|
4890
|
+
rename: (oldName, newName) => this.tableResource.rename(oldName, newName, dbId)
|
|
4920
4891
|
};
|
|
4921
4892
|
}
|
|
4922
4893
|
// Direct column operations
|