@aicore/cocodb-ws-client 1.0.22 → 1.0.23
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 +9 -9
- package/src/utils/api.js +6 -2
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.23",
|
|
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": "19.
|
|
51
|
-
"@commitlint/config-conventional": "19.
|
|
50
|
+
"@commitlint/cli": "19.8.0",
|
|
51
|
+
"@commitlint/config-conventional": "19.8.0",
|
|
52
52
|
"c8": "10.1.3",
|
|
53
|
-
"chai": "5.
|
|
53
|
+
"chai": "5.2.0",
|
|
54
54
|
"cli-color": "2.0.4",
|
|
55
55
|
"documentation": "14.0.3",
|
|
56
|
-
"eslint": "9.
|
|
57
|
-
"glob": "11.0.
|
|
56
|
+
"eslint": "9.25.0",
|
|
57
|
+
"glob": "11.0.1",
|
|
58
58
|
"husky": "9.1.7",
|
|
59
|
-
"mocha": "
|
|
59
|
+
"mocha": "11.1.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@aicore/libcommonutils": "1.0.20",
|
|
63
|
-
"ws": "8.18.
|
|
63
|
+
"ws": "8.18.1"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
|
-
"bufferutil": "4.0.
|
|
66
|
+
"bufferutil": "4.0.9",
|
|
67
67
|
"utf-8-validate": "6.0.5"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/utils/api.js
CHANGED
|
@@ -288,13 +288,16 @@ export function deleteTable(tableName) {
|
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
290
|
* do mathematical addition on given json fields by given values in jsonFieldsIncrements
|
|
291
|
+
* conditional operation is also supported.
|
|
291
292
|
* @param {string} tableName - The name of the table you want to update.
|
|
292
293
|
* @param {string} documentId - The document id of the document you want to update.
|
|
293
294
|
* @param {Object} jsonFieldsIncrements - A JSON object with the fields to increment and the amount to
|
|
294
295
|
* increment them by.
|
|
296
|
+
* @param {string} [condition] - Optional coco query condition of the form "$.cost<35" that must be satisfied
|
|
297
|
+
* for update to happen. See query API for more details on how to write coco query strings.
|
|
295
298
|
* @returns {Promise} A promise.
|
|
296
299
|
*/
|
|
297
|
-
export function mathAdd(tableName, documentId, jsonFieldsIncrements) {
|
|
300
|
+
export function mathAdd(tableName, documentId, jsonFieldsIncrements, condition) {
|
|
298
301
|
if (isStringEmpty(tableName)) {
|
|
299
302
|
throw new Error('Please provide valid table name');
|
|
300
303
|
}
|
|
@@ -310,7 +313,8 @@ export function mathAdd(tableName, documentId, jsonFieldsIncrements) {
|
|
|
310
313
|
request: {
|
|
311
314
|
tableName: tableName,
|
|
312
315
|
documentId: documentId,
|
|
313
|
-
jsonFieldsIncrements: jsonFieldsIncrements
|
|
316
|
+
jsonFieldsIncrements: jsonFieldsIncrements,
|
|
317
|
+
condition: condition
|
|
314
318
|
}
|
|
315
319
|
});
|
|
316
320
|
}
|