codehooks-js 1.3.23 → 1.3.25
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/types/index.d.ts +27 -13
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -198,13 +198,19 @@ export type keyvalOptions = {
|
|
|
198
198
|
*/
|
|
199
199
|
export type NoSQLAPI = {
|
|
200
200
|
/**
|
|
201
|
-
* - Get object by ID, returns a Promise with the object
|
|
201
|
+
* - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object
|
|
202
|
+
* @throws {Error} Rejects if the object is not found
|
|
202
203
|
*/
|
|
203
204
|
getOne: (query: string | object) => Promise<object>;
|
|
204
205
|
/**
|
|
205
|
-
* - Get object by ID, returns a Promise with the object - alias for getOne
|
|
206
|
+
* - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object - alias for getOne
|
|
207
|
+
* @throws {Error} Rejects if the object is not found
|
|
206
208
|
*/
|
|
207
209
|
findOne: (query: string | object) => Promise<object>;
|
|
210
|
+
/**
|
|
211
|
+
* - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object or null if not found
|
|
212
|
+
*/
|
|
213
|
+
findOneOrNull: (query: string | object) => Promise<object | null>;
|
|
208
214
|
/**
|
|
209
215
|
* - Get stream of objects by query
|
|
210
216
|
* https://codehooks.io/docs/nosql-database-api#getmanycollection-query-options
|
|
@@ -306,18 +312,24 @@ export type DatastoreAPI = {
|
|
|
306
312
|
*/
|
|
307
313
|
collection: (collection: string) => NoSQLAPI;
|
|
308
314
|
/**
|
|
309
|
-
* - Get object by ID, returns a Promise with the object
|
|
315
|
+
* - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object
|
|
316
|
+
* @throws {Error} Rejects if the object is not found
|
|
310
317
|
*/
|
|
311
|
-
getOne: (collection: string, query: string | object) => Promise<
|
|
318
|
+
getOne: (collection: string, query: string | object) => Promise<object>;
|
|
312
319
|
/**
|
|
313
320
|
* - Get stream of objects by query
|
|
314
321
|
* * https://codehooks.io/docs/nosql-database-api#getmanycollection-query-options
|
|
315
322
|
*/
|
|
316
323
|
getMany: (collection: string, query?: object, options?: object) => DataStream;
|
|
317
324
|
/**
|
|
318
|
-
* - Get object by ID, returns a Promise with the object (alias for getOne)
|
|
325
|
+
* - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object (alias for getOne)
|
|
326
|
+
* @throws {Error} Rejects if the object is not found
|
|
327
|
+
*/
|
|
328
|
+
findOne: (collection: string, query: string | object) => Promise<object>;
|
|
329
|
+
/**
|
|
330
|
+
* - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object or null if not found
|
|
319
331
|
*/
|
|
320
|
-
|
|
332
|
+
findOneOrNull: (collection: string, query: string | object) => Promise<object | null>;
|
|
321
333
|
/**
|
|
322
334
|
* - Alias for getMany
|
|
323
335
|
* https://codehooks.io/docs/nosql-database-api#getmanycollection-query-options
|
|
@@ -334,14 +346,14 @@ export type DatastoreAPI = {
|
|
|
334
346
|
* @param query string | object
|
|
335
347
|
* @param updateoperators object
|
|
336
348
|
* @param options object - {upsert: true}
|
|
337
|
-
* @returns Promise<
|
|
349
|
+
* @returns Promise<object>
|
|
338
350
|
*/
|
|
339
351
|
updateOne: (
|
|
340
352
|
collection: string,
|
|
341
353
|
query: string | object,
|
|
342
354
|
updateoperators?: object,
|
|
343
355
|
options?: object
|
|
344
|
-
) => Promise<
|
|
356
|
+
) => Promise<object>;
|
|
345
357
|
/**
|
|
346
358
|
* - Update multiple data objects in a datastore collection.
|
|
347
359
|
* - Input document is patched with the matched database objects
|
|
@@ -351,7 +363,7 @@ export type DatastoreAPI = {
|
|
|
351
363
|
query: object,
|
|
352
364
|
document: object,
|
|
353
365
|
updateoperators?: object
|
|
354
|
-
) => Promise<
|
|
366
|
+
) => Promise<object>;
|
|
355
367
|
/**
|
|
356
368
|
* - Replace one data object by ID in a datastore collection.
|
|
357
369
|
* - Input document overwrites the matched database object, the _id value is not overwritten.
|
|
@@ -359,8 +371,9 @@ export type DatastoreAPI = {
|
|
|
359
371
|
replaceOne: (
|
|
360
372
|
collection: string,
|
|
361
373
|
query: string | object,
|
|
374
|
+
document: object,
|
|
362
375
|
options?: object
|
|
363
|
-
) => Promise<
|
|
376
|
+
) => Promise<object>;
|
|
364
377
|
/**
|
|
365
378
|
* - Replace multiple data objects in a datastore collection.
|
|
366
379
|
* - Input document overwrites the matched database objects. The _id value is not overwritten
|
|
@@ -368,16 +381,17 @@ export type DatastoreAPI = {
|
|
|
368
381
|
replaceMany: (
|
|
369
382
|
collection: string,
|
|
370
383
|
query: object,
|
|
384
|
+
document: object,
|
|
371
385
|
options?: object
|
|
372
|
-
) => Promise<
|
|
386
|
+
) => Promise<object>;
|
|
373
387
|
/**
|
|
374
388
|
* - Remove one data object by ID in a collection in the current Datastore
|
|
375
389
|
*/
|
|
376
|
-
removeOne: (collection: string, query: string | object) => Promise<
|
|
390
|
+
removeOne: (collection: string, query: string | object) => Promise<object>;
|
|
377
391
|
/**
|
|
378
392
|
* - Remove multiple data objects in a collection in the current Datastore
|
|
379
393
|
*/
|
|
380
|
-
removeMany: (collection: string, query: object) => Promise<
|
|
394
|
+
removeMany: (collection: string, query: object) => Promise<object>;
|
|
381
395
|
/**
|
|
382
396
|
* - Set a key-value pair in the current Datastore
|
|
383
397
|
*/
|