codehooks-js 1.3.23 → 1.3.24

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/types/index.d.ts +14 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codehooks-js",
3
- "version": "1.3.23",
3
+ "version": "1.3.24",
4
4
  "type": "module",
5
5
  "description": "Codehooks.io official library - provides express.JS like syntax",
6
6
  "main": "index.js",
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,7 +312,7 @@ 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
310
316
  */
311
317
  getOne: (collection: string, query: string | object) => Promise<any>;
312
318
  /**
@@ -315,9 +321,13 @@ export type DatastoreAPI = {
315
321
  */
316
322
  getMany: (collection: string, query?: object, options?: object) => DataStream;
317
323
  /**
318
- * - Get object by ID, returns a Promise with the object (alias for getOne)
324
+ * - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object (alias for getOne)
319
325
  */
320
326
  findOne: (collection: string, query: string | object) => Promise<any>;
327
+ /**
328
+ * - Get object by ID (objectID) or query (NoSQL query {...}), returns a Promise with the object or null if not found
329
+ */
330
+ findOneOrNull: (collection: string, query: string | object) => Promise<any>;
321
331
  /**
322
332
  * - Alias for getMany
323
333
  * https://codehooks.io/docs/nosql-database-api#getmanycollection-query-options