@aicore/cocodb-ws-client 1.0.13 → 1.0.14

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils/api.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicore/cocodb-ws-client",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Websocket client for cocoDb",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/utils/api.js CHANGED
@@ -291,9 +291,11 @@ export function mathAdd(tableName, documentId, jsonFieldsIncrements) {
291
291
  * @param {string} tableName - The name of the table to update the document in.
292
292
  * @param {string} documentId - The id of the document to update.
293
293
  * @param {Object}document - The document to be updated.
294
+ * @param {string} [condition] - Optional coco query condition of the form "$.cost<35" that must be satisfied
295
+ * for update to happen. See query API for more details on how to write coco query strings.
294
296
  * @returns {Promise} A promise.
295
297
  */
296
- export function update(tableName, documentId, document) {
298
+ export function update(tableName, documentId, document, condition) {
297
299
  if (isStringEmpty(tableName)) {
298
300
  throw new Error('Please provide valid table name');
299
301
  }
@@ -309,7 +311,8 @@ export function update(tableName, documentId, document) {
309
311
  request: {
310
312
  tableName: tableName,
311
313
  documentId: documentId,
312
- document: document
314
+ document: document,
315
+ condition
313
316
  }
314
317
  });
315
318
  }