@aicore/cocodb-ws-client 1.0.11 → 1.0.12
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 +1 -1
- package/src/utils/api.js +24 -6
package/package.json
CHANGED
package/src/utils/api.js
CHANGED
|
@@ -163,9 +163,14 @@ export function createIndex(tableName, jsonField, dataType, isUnique, isNotNull)
|
|
|
163
163
|
* It returns list of documents matching the queryObject
|
|
164
164
|
* @param {string} tableName - The name of the table you want to query.
|
|
165
165
|
* @param{Object} queryObject - This is the object that you want to query the table with.
|
|
166
|
+
* @param {Object} options Optional parameter to add pagination.
|
|
167
|
+
* @param {number} options.pageOffset specify which row to start retrieving documents from. Eg: to get 10 documents from
|
|
168
|
+
* the 100'th document, you should specify `pageOffset = 100` and `pageLimit = 10`
|
|
169
|
+
* @param {number} options.pageLimit specify number of documents to retrieve. Eg: to get 10 documents from
|
|
170
|
+
* the 100'th document, you should specify `pageOffset = 100` and `pageLimit = 10`
|
|
166
171
|
* @returns {Promise}
|
|
167
172
|
*/
|
|
168
|
-
export function getFromIndex(tableName, queryObject) {
|
|
173
|
+
export function getFromIndex(tableName, queryObject, options= {}) {
|
|
169
174
|
if (isStringEmpty(tableName)) {
|
|
170
175
|
throw new Error('Please provide valid table name');
|
|
171
176
|
}
|
|
@@ -177,7 +182,8 @@ export function getFromIndex(tableName, queryObject) {
|
|
|
177
182
|
fn: COCO_DB_FUNCTIONS.getFromIndex,
|
|
178
183
|
request: {
|
|
179
184
|
tableName: tableName,
|
|
180
|
-
queryObject: queryObject
|
|
185
|
+
queryObject: queryObject,
|
|
186
|
+
options
|
|
181
187
|
}
|
|
182
188
|
});
|
|
183
189
|
}
|
|
@@ -186,9 +192,14 @@ export function getFromIndex(tableName, queryObject) {
|
|
|
186
192
|
* It returns list of documents matching the queryObject after scanning the COCO DB
|
|
187
193
|
* @param {string} tableName - The name of the table you want to query.
|
|
188
194
|
* @param{Object} queryObject - This is the object that you want to query the table with.
|
|
195
|
+
* @param {Object} options Optional parameter to add pagination.
|
|
196
|
+
* @param {number} options.pageOffset specify which row to start retrieving documents from. Eg: to get 10 documents from
|
|
197
|
+
* the 100'th document, you should specify `pageOffset = 100` and `pageLimit = 10`
|
|
198
|
+
* @param {number} options.pageLimit specify number of documents to retrieve. Eg: to get 10 documents from
|
|
199
|
+
* the 100'th document, you should specify `pageOffset = 100` and `pageLimit = 10`
|
|
189
200
|
* @returns {Promise}
|
|
190
201
|
*/
|
|
191
|
-
export function getFromNonIndex(tableName, queryObject = {}) {
|
|
202
|
+
export function getFromNonIndex(tableName, queryObject = {}, options= {}) {
|
|
192
203
|
if (isStringEmpty(tableName)) {
|
|
193
204
|
throw new Error('Please provide valid table name');
|
|
194
205
|
}
|
|
@@ -197,7 +208,8 @@ export function getFromNonIndex(tableName, queryObject = {}) {
|
|
|
197
208
|
fn: COCO_DB_FUNCTIONS.getFromNonIndex,
|
|
198
209
|
request: {
|
|
199
210
|
tableName: tableName,
|
|
200
|
-
queryObject: queryObject
|
|
211
|
+
queryObject: queryObject,
|
|
212
|
+
options
|
|
201
213
|
}
|
|
202
214
|
});
|
|
203
215
|
}
|
|
@@ -307,9 +319,14 @@ export function update(tableName, documentId, document) {
|
|
|
307
319
|
* @param {string} tableName - The name of the table you want to query.
|
|
308
320
|
* @param {string} queryString - The query string to be executed.
|
|
309
321
|
* @param {Array<string>}[useIndexForFields=null] - This is an array of fields that you want to use the index for.
|
|
322
|
+
* @param {Object} options Optional parameter to add pagination.
|
|
323
|
+
* @param {number} options.pageOffset specify which row to start retrieving documents from. Eg: to get 10 documents from
|
|
324
|
+
* the 100'th document, you should specify `pageOffset = 100` and `pageLimit = 10`
|
|
325
|
+
* @param {number} options.pageLimit specify number of documents to retrieve. Eg: to get 10 documents from
|
|
326
|
+
* the 100'th document, you should specify `pageOffset = 100` and `pageLimit = 10`
|
|
310
327
|
* @returns {Promise}A promise
|
|
311
328
|
*/
|
|
312
|
-
export function query(tableName, queryString, useIndexForFields = null) {
|
|
329
|
+
export function query(tableName, queryString, useIndexForFields = null, options= {}) {
|
|
313
330
|
if (isStringEmpty(tableName)) {
|
|
314
331
|
throw new Error('Please provide valid table name');
|
|
315
332
|
}
|
|
@@ -322,7 +339,8 @@ export function query(tableName, queryString, useIndexForFields = null) {
|
|
|
322
339
|
fn: COCO_DB_FUNCTIONS.query,
|
|
323
340
|
request: {
|
|
324
341
|
tableName: tableName,
|
|
325
|
-
queryString: queryString
|
|
342
|
+
queryString: queryString,
|
|
343
|
+
options
|
|
326
344
|
}
|
|
327
345
|
});
|
|
328
346
|
}
|