@dnax/core 0.49.0 → 0.50.0

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.
@@ -816,7 +816,7 @@ class useRest {
816
816
  options?: Omit<optionCb, "elementAt">
817
817
  ): Promise<object | null> {
818
818
  return new Promise(async (resolve, reject) => {
819
- if (!id) fn.error("Id is required", 400);
819
+ if (!id) reject("Id is required");
820
820
  try {
821
821
  let meta = {
822
822
  total: 0,
@@ -1009,6 +1009,8 @@ class useRest {
1009
1009
  return resolve(result);
1010
1010
  }
1011
1011
 
1012
+ if (!id) reject("Id is required");
1013
+
1012
1014
  //@ts-expect-error
1013
1015
  update = omit(update, omitUpdate);
1014
1016
 
@@ -1340,7 +1342,7 @@ class useRest {
1340
1342
  }
1341
1343
 
1342
1344
  if (Array.isArray(ids)) {
1343
- if (!ids?.length) throw new contextError("List of id required", 400);
1345
+ if (!ids?.length) reject("Ids required");
1344
1346
 
1345
1347
  await this.#tenant.database.db?.collection(collection).updateMany(
1346
1348
  {
@@ -1420,7 +1422,6 @@ class useRest {
1420
1422
  ): Promise<object> {
1421
1423
  return new Promise(async (resolve, reject) => {
1422
1424
  try {
1423
- if (!id) fn.error("Id is required", 400);
1424
1425
  let useHook = options?.useHook ?? this.#useHook;
1425
1426
  let useCustomApi = options?.useCustomApi ?? this.#useCustomApi;
1426
1427
 
@@ -1473,6 +1474,7 @@ class useRest {
1473
1474
  });
1474
1475
  return resolve(result!);
1475
1476
  }
1477
+ if (!id) reject("Id is required");
1476
1478
 
1477
1479
  let doc = await this.#tenant.database.db
1478
1480
  ?.collection(collection)
@@ -1583,7 +1585,7 @@ class useRest {
1583
1585
 
1584
1586
  let deletedIds: any = ids || [];
1585
1587
 
1586
- if (!ids) fn.error("List of id required", 400);
1588
+ if (!ids) reject("Ids required");
1587
1589
 
1588
1590
  if (Array.isArray(ids)) {
1589
1591
  await this.#tenant.database.db?.collection(collection).deleteMany(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {