@aicore/cocodb-ws-client 1.0.15 → 1.0.16
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/package.json +2 -2
- package/src/index.js +2 -1
- package/src/utils/api.js +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicore/cocodb-ws-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Websocket client for cocoDb",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"mocha": "10.2.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@aicore/libcommonutils": "1.0.
|
|
62
|
+
"@aicore/libcommonutils": "1.0.20",
|
|
63
63
|
"ws": "8.13.0"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
package/src/index.js
CHANGED
package/src/utils/api.js
CHANGED
|
@@ -241,6 +241,32 @@ export function deleteDocument(tableName, documentId, condition) {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/**
|
|
245
|
+
* > This function deletes all documents satisfying query condition from a table
|
|
246
|
+
* @param {string} tableName - The name of the table in which the key is to be deleted.
|
|
247
|
+
* @param {string} queryString - The cocDB query string.
|
|
248
|
+
* @param {Array[string]} useIndexForFields - List of indexed fields in the document.
|
|
249
|
+
* @returns {Promise} A promise.
|
|
250
|
+
*/
|
|
251
|
+
export function deleteDocuments(tableName, queryString, useIndexForFields = []) {
|
|
252
|
+
if (isStringEmpty(tableName)) {
|
|
253
|
+
throw new Error('Please provide valid table name');
|
|
254
|
+
}
|
|
255
|
+
if (isStringEmpty(queryString)) {
|
|
256
|
+
throw new Error('Please provide valid queryString');
|
|
257
|
+
}
|
|
258
|
+
return sendMessage(
|
|
259
|
+
{
|
|
260
|
+
fn: COCO_DB_FUNCTIONS.deleteDocuments,
|
|
261
|
+
request: {
|
|
262
|
+
tableName,
|
|
263
|
+
queryString,
|
|
264
|
+
useIndexForFields
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
244
270
|
/**
|
|
245
271
|
* > This function deletes a table from the database
|
|
246
272
|
* @param {string} tableName - The name of the table to delete.
|