moost 0.2.12 → 0.2.13

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/dist/index.cjs CHANGED
@@ -280,18 +280,18 @@ function panic(error) {
280
280
  return new Error(error);
281
281
  }
282
282
 
283
- function getCallableFn(targetInstance, fn, restoreCtx) {
283
+ function getCallableFn(targetInstance, fn, restoreCtx, silent) {
284
284
  return __awaiter(this, void 0, void 0, function* () {
285
285
  const mate$1 = getMoostMate();
286
286
  const meta = mate$1.read(fn);
287
287
  if (meta === null || meta === void 0 ? void 0 : meta.injectable) {
288
288
  const infact = getMoostInfact();
289
- infact.silent(meta.injectable === 'FOR_EVENT');
289
+ infact.silent(silent || (meta.injectable === 'FOR_EVENT' ? 'logs' : false));
290
290
  const instance = yield infact.getForInstance(targetInstance, fn, {
291
291
  syncContextFn: () => { restoreCtx && restoreCtx(); },
292
292
  customData: { pipes: meta.pipes },
293
293
  });
294
- infact.silent(false);
294
+ infact.silent(!!silent);
295
295
  return ((...args) => {
296
296
  return instance.handler(...args);
297
297
  });
@@ -389,7 +389,7 @@ function bindControllerMethods(options) {
389
389
  const { restoreCtx } = useHttpContext();
390
390
  const targetInstance = yield getInstance();
391
391
  restoreCtx();
392
- return (yield getCallableFn(targetInstance, handler, restoreCtx))(...args);
392
+ return (yield getCallableFn(targetInstance, handler, restoreCtx, options.silent))(...args);
393
393
  }));
394
394
  }
395
395
  else {
@@ -694,7 +694,7 @@ class Moost {
694
694
  this.provide = infact.createProvideRegistry([infact.Infact, getMoostInfact], [mate.Mate, getMoostMate], [valido$1.Valido, getMoostValido]);
695
695
  this.unregisteredControllers = [];
696
696
  if (options === null || options === void 0 ? void 0 : options.silent) {
697
- getMoostInfact().silent();
697
+ getMoostInfact().silent(options === null || options === void 0 ? void 0 : options.silent);
698
698
  }
699
699
  }
700
700
  adapter(a) {
@@ -751,12 +751,12 @@ class Moost {
751
751
  }
752
752
  // getInstance - instance factory for resolving SINGLETON and FOR_EVENT instance
753
753
  const getInstance = instance ? () => Promise.resolve(instance) : () => __awaiter(this, void 0, void 0, function* () {
754
- var _c;
754
+ var _c, _d;
755
755
  // if (!instance) {
756
- infact.silent();
756
+ infact.silent(((_c = this.options) === null || _c === void 0 ? void 0 : _c.silent) || 'logs');
757
757
  const { restoreCtx } = eventCore.useEventContext();
758
758
  const instance = yield infact.get(controller, Object.assign(Object.assign({}, infactOpts), { syncContextFn: restoreCtx }));
759
- infact.silent(!!((_c = this.options) === null || _c === void 0 ? void 0 : _c.silent));
759
+ infact.silent(!!((_d = this.options) === null || _d === void 0 ? void 0 : _d.silent));
760
760
  // }
761
761
  return instance;
762
762
  });
package/dist/index.mjs CHANGED
@@ -278,18 +278,18 @@ function panic(error) {
278
278
  return new Error(error);
279
279
  }
280
280
 
281
- function getCallableFn(targetInstance, fn, restoreCtx) {
281
+ function getCallableFn(targetInstance, fn, restoreCtx, silent) {
282
282
  return __awaiter(this, void 0, void 0, function* () {
283
283
  const mate = getMoostMate();
284
284
  const meta = mate.read(fn);
285
285
  if (meta === null || meta === void 0 ? void 0 : meta.injectable) {
286
286
  const infact = getMoostInfact();
287
- infact.silent(meta.injectable === 'FOR_EVENT');
287
+ infact.silent(silent || (meta.injectable === 'FOR_EVENT' ? 'logs' : false));
288
288
  const instance = yield infact.getForInstance(targetInstance, fn, {
289
289
  syncContextFn: () => { restoreCtx && restoreCtx(); },
290
290
  customData: { pipes: meta.pipes },
291
291
  });
292
- infact.silent(false);
292
+ infact.silent(!!silent);
293
293
  return ((...args) => {
294
294
  return instance.handler(...args);
295
295
  });
@@ -387,7 +387,7 @@ function bindControllerMethods(options) {
387
387
  const { restoreCtx } = useHttpContext();
388
388
  const targetInstance = yield getInstance();
389
389
  restoreCtx();
390
- return (yield getCallableFn(targetInstance, handler, restoreCtx))(...args);
390
+ return (yield getCallableFn(targetInstance, handler, restoreCtx, options.silent))(...args);
391
391
  }));
392
392
  }
393
393
  else {
@@ -692,7 +692,7 @@ class Moost {
692
692
  this.provide = createProvideRegistry([Infact, getMoostInfact], [Mate, getMoostMate], [Valido, getMoostValido]);
693
693
  this.unregisteredControllers = [];
694
694
  if (options === null || options === void 0 ? void 0 : options.silent) {
695
- getMoostInfact().silent();
695
+ getMoostInfact().silent(options === null || options === void 0 ? void 0 : options.silent);
696
696
  }
697
697
  }
698
698
  adapter(a) {
@@ -749,12 +749,12 @@ class Moost {
749
749
  }
750
750
  // getInstance - instance factory for resolving SINGLETON and FOR_EVENT instance
751
751
  const getInstance = instance ? () => Promise.resolve(instance) : () => __awaiter(this, void 0, void 0, function* () {
752
- var _c;
752
+ var _c, _d;
753
753
  // if (!instance) {
754
- infact.silent();
754
+ infact.silent(((_c = this.options) === null || _c === void 0 ? void 0 : _c.silent) || 'logs');
755
755
  const { restoreCtx } = useEventContext();
756
756
  const instance = yield infact.get(controller, Object.assign(Object.assign({}, infactOpts), { syncContextFn: restoreCtx }));
757
- infact.silent(!!((_c = this.options) === null || _c === void 0 ? void 0 : _c.silent));
757
+ infact.silent(!!((_d = this.options) === null || _d === void 0 ? void 0 : _d.silent));
758
758
  // }
759
759
  return instance;
760
760
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moost",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "moost",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -22,11 +22,11 @@
22
22
  "prostojs"
23
23
  ],
24
24
  "dependencies": {
25
- "@prostojs/infact": "^0.1.4",
25
+ "@prostojs/infact": "^0.1.6",
26
26
  "@prostojs/mate": "^0.1.12",
27
27
  "@prostojs/valido": "^0.0.2",
28
- "@wooksjs/event-core": "^0.2.6",
29
- "wooks": "^0.2.6"
28
+ "@wooksjs/event-core": "^0.2.7",
29
+ "wooks": "^0.2.7"
30
30
  },
31
31
  "author": "Artem Maltsev",
32
32
  "license": "MIT",