@aicore/cocodb-ws-client 1.0.13 → 1.0.15
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 +7 -7
- package/src/utils/api.js +10 -4
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.15",
|
|
4
4
|
"description": "Websocket client for cocoDb",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -47,23 +47,23 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/aicore/cocoDbWsClient#readme",
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@commitlint/cli": "17.4.
|
|
51
|
-
"@commitlint/config-conventional": "17.4.
|
|
50
|
+
"@commitlint/cli": "17.4.4",
|
|
51
|
+
"@commitlint/config-conventional": "17.4.4",
|
|
52
52
|
"c8": "7.13.0",
|
|
53
53
|
"chai": "4.3.7",
|
|
54
54
|
"cli-color": "2.0.3",
|
|
55
55
|
"documentation": "14.0.1",
|
|
56
|
-
"eslint": "8.
|
|
57
|
-
"glob": "
|
|
56
|
+
"eslint": "8.36.0",
|
|
57
|
+
"glob": "9.3.0",
|
|
58
58
|
"husky": "8.0.3",
|
|
59
59
|
"mocha": "10.2.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@aicore/libcommonutils": "1.0.19",
|
|
63
|
-
"ws": "8.
|
|
63
|
+
"ws": "8.13.0"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
66
|
"bufferutil": "4.0.7",
|
|
67
|
-
"utf-8-validate": "6.0.
|
|
67
|
+
"utf-8-validate": "6.0.3"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/utils/api.js
CHANGED
|
@@ -219,9 +219,11 @@ export function getFromNonIndex(tableName, queryObject = {}, options= {}) {
|
|
|
219
219
|
* > This function deletes a document from a table
|
|
220
220
|
* @param {string} tableName - The name of the table you want to delete the document from.
|
|
221
221
|
* @param {string} documentId - The id of the document to delete.
|
|
222
|
+
* @param {string} [condition] - Optional coco query condition of the form "$.cost<35" that must be satisfied
|
|
223
|
+
* for delete to happen. See query API for more details on how to write coco query strings.
|
|
222
224
|
* @returns {Promise} A promise.
|
|
223
225
|
*/
|
|
224
|
-
export function deleteDocument(tableName, documentId) {
|
|
226
|
+
export function deleteDocument(tableName, documentId, condition) {
|
|
225
227
|
if (isStringEmpty(tableName)) {
|
|
226
228
|
throw new Error('Please provide valid table name');
|
|
227
229
|
}
|
|
@@ -233,7 +235,8 @@ export function deleteDocument(tableName, documentId) {
|
|
|
233
235
|
fn: COCO_DB_FUNCTIONS.deleteDocument,
|
|
234
236
|
request: {
|
|
235
237
|
tableName: tableName,
|
|
236
|
-
documentId: documentId
|
|
238
|
+
documentId: documentId,
|
|
239
|
+
condition
|
|
237
240
|
}
|
|
238
241
|
});
|
|
239
242
|
}
|
|
@@ -291,9 +294,11 @@ export function mathAdd(tableName, documentId, jsonFieldsIncrements) {
|
|
|
291
294
|
* @param {string} tableName - The name of the table to update the document in.
|
|
292
295
|
* @param {string} documentId - The id of the document to update.
|
|
293
296
|
* @param {Object}document - The document to be updated.
|
|
297
|
+
* @param {string} [condition] - Optional coco query condition of the form "$.cost<35" that must be satisfied
|
|
298
|
+
* for update to happen. See query API for more details on how to write coco query strings.
|
|
294
299
|
* @returns {Promise} A promise.
|
|
295
300
|
*/
|
|
296
|
-
export function update(tableName, documentId, document) {
|
|
301
|
+
export function update(tableName, documentId, document, condition) {
|
|
297
302
|
if (isStringEmpty(tableName)) {
|
|
298
303
|
throw new Error('Please provide valid table name');
|
|
299
304
|
}
|
|
@@ -309,7 +314,8 @@ export function update(tableName, documentId, document) {
|
|
|
309
314
|
request: {
|
|
310
315
|
tableName: tableName,
|
|
311
316
|
documentId: documentId,
|
|
312
|
-
document: document
|
|
317
|
+
document: document,
|
|
318
|
+
condition
|
|
313
319
|
}
|
|
314
320
|
});
|
|
315
321
|
}
|