@dnax/core 0.8.8 → 0.8.10

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.
@@ -44,7 +44,7 @@ type optionCb = {
44
44
  };
45
45
 
46
46
  type QueryBatchType<T extends "findOne" | "find"> = {
47
- as: string;
47
+ as?: string;
48
48
  collection: string;
49
49
  action: T;
50
50
  filter?: {
@@ -441,19 +441,22 @@ class useRest {
441
441
  let result = {} as any;
442
442
  for await (let query of queries) {
443
443
  let resultName = query.as || query.collection;
444
- if (query.action == "findOne") {
444
+ if (
445
+ query.action == "findOne" &&
446
+ (query?.filter?.id || query?.filter?._id)
447
+ ) {
445
448
  result[resultName] = await this.findOne(
446
449
  query.collection,
447
- query.filter.id,
448
- query.filter.params,
450
+ query?.filter?.id || query?.filter?._id,
451
+ query?.filter?.params || {},
449
452
  query.options
450
453
  );
451
454
  }
452
455
  if (query.action == "find") {
453
456
  result[resultName] = await this.find(
454
457
  query.collection,
455
- query.filter.params,
456
- query.options
458
+ query?.filter?.params || {},
459
+ query?.options || {}
457
460
  );
458
461
  }
459
462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {