@dnax/core 0.21.0 → 0.21.1

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.
@@ -204,6 +204,7 @@ class useRest {
204
204
  if (col?.hooks?.beforeOperation && useHook) {
205
205
  await col.hooks.beforeOperation({
206
206
  io: Cfg.io,
207
+ error: fn.error,
207
208
  sharedData: sharedData,
208
209
  pipeline: pipeline,
209
210
  c: this.#c,
@@ -278,6 +279,7 @@ class useRest {
278
279
  await col.hooks.beforeOperation({
279
280
  sharedData: sharedData,
280
281
  io: Cfg.io,
282
+ error: fn.error,
281
283
  data: data,
282
284
  c: this.#c,
283
285
  driver: "mongodb",
@@ -399,6 +401,7 @@ class useRest {
399
401
  if (col?.hooks?.beforeOperation && useHook) {
400
402
  await col.hooks.beforeOperation({
401
403
  sharedData: sharedData,
404
+ error: fn.error,
402
405
  data: toJson(data),
403
406
  io: Cfg.io,
404
407
  c: this.#c,
@@ -575,6 +578,7 @@ class useRest {
575
578
  await col.hooks.beforeOperation({
576
579
  sharedData: sharedData,
577
580
  c: this.#c,
581
+ error: fn.error,
578
582
  driver: "mongodb",
579
583
  io: Cfg.io,
580
584
  action: "find",
@@ -701,6 +705,7 @@ class useRest {
701
705
  await col.hooks.beforeOperation({
702
706
  sharedData: sharedData,
703
707
  c: this.#c,
708
+ error: fn.error,
704
709
  driver: "mongodb",
705
710
  io: Cfg.io,
706
711
  action: "find",
@@ -811,6 +816,7 @@ class useRest {
811
816
  sharedData: sharedData,
812
817
  id: id,
813
818
  io: Cfg.io,
819
+ error: fn.error,
814
820
  c: this.#c,
815
821
  driver: "mongodb",
816
822
  action: "findOne",
@@ -926,6 +932,7 @@ class useRest {
926
932
  sharedData: sharedData,
927
933
  id: id,
928
934
  io: Cfg.io,
935
+ error: fn.error,
929
936
  c: this.#c,
930
937
  driver: "mongodb",
931
938
  action: "updateOne",
@@ -1083,6 +1090,7 @@ class useRest {
1083
1090
  sharedData: sharedData,
1084
1091
  filter: filter || {},
1085
1092
  c: this.#c,
1093
+ error: fn.error,
1086
1094
  io: Cfg.io,
1087
1095
  driver: "mongodb",
1088
1096
  action: "findOneAndUpdate",
@@ -1202,6 +1210,7 @@ class useRest {
1202
1210
  sharedData: sharedData,
1203
1211
  ids: ids,
1204
1212
  c: this.#c,
1213
+ error: fn.error,
1205
1214
  driver: "mongodb",
1206
1215
  io: Cfg.io,
1207
1216
  action: "updateMany",
@@ -1367,6 +1376,8 @@ class useRest {
1367
1376
  c: this.#c,
1368
1377
  io: Cfg.io,
1369
1378
  driver: "mongodb",
1379
+ error: fn.error,
1380
+
1370
1381
  action: "deleteOne",
1371
1382
  session: sessionStorage(),
1372
1383
  rest: new useRest({
@@ -1468,6 +1479,7 @@ class useRest {
1468
1479
  ids: ids,
1469
1480
  c: this.#c,
1470
1481
  driver: "mongodb",
1482
+ error: fn.error,
1471
1483
  io: Cfg.io,
1472
1484
  action: "deleteMany",
1473
1485
  session: sessionStorage(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1 @@
1
+ import { type } from "arktype";
package/types/index.ts CHANGED
@@ -203,6 +203,7 @@ export type hooksCtx = (ctx: {
203
203
  rest: InstanceType<typeof useRest>;
204
204
  session?: sessionCtx;
205
205
  io: socketIoType;
206
+ error: typeof fn.error;
206
207
  }) => any;
207
208
 
208
209
  export type ctxApi = {
package/utils/index.ts CHANGED
@@ -345,7 +345,7 @@ class contextError extends Error {
345
345
 
346
346
  const fn = {
347
347
  error: (message: string, code: number) => {
348
- throw new contextError(message || "unknow", code);
348
+ throw new contextError(message || "", code);
349
349
  },
350
350
  };
351
351