moost 0.4.9 → 0.4.11

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
@@ -142,9 +142,10 @@ function defineMoostEventHandler(options) {
142
142
  const instance = await options.getControllerInstance();
143
143
  if (instance) {
144
144
  setControllerContext(instance, options.controllerMethod || '', options.targetPath);
145
+ ci.hook('Controller:registered');
145
146
  }
146
147
  const interceptorHandler = await options.getIterceptorHandler();
147
- if (interceptorHandler) {
148
+ if (interceptorHandler?.count) {
148
149
  try {
149
150
  response = await ci.with('Inteceptors:init', () => interceptorHandler.init());
150
151
  if (response !== undefined) {
@@ -168,7 +169,7 @@ function defineMoostEventHandler(options) {
168
169
  return endWithResponse(true);
169
170
  }
170
171
  }
171
- if (interceptorHandler) {
172
+ if (interceptorHandler?.countBefore) {
172
173
  response = await ci.with('Inteceptors:before', () => interceptorHandler.fireBefore(response));
173
174
  if (response !== undefined) {
174
175
  return endWithResponse();
@@ -196,7 +197,7 @@ function defineMoostEventHandler(options) {
196
197
  return endWithResponse(true);
197
198
  }
198
199
  async function endWithResponse(raise = false) {
199
- if (interceptorHandler) {
200
+ if (interceptorHandler?.countAfter || interceptorHandler?.countOnError) {
200
201
  try {
201
202
  response = await ci.with('Inteceptors:after', () => interceptorHandler.fireAfter(response));
202
203
  }
package/dist/index.mjs CHANGED
@@ -143,9 +143,10 @@ function defineMoostEventHandler(options) {
143
143
  const instance = await options.getControllerInstance();
144
144
  if (instance) {
145
145
  setControllerContext(instance, options.controllerMethod || '', options.targetPath);
146
+ ci.hook('Controller:registered');
146
147
  }
147
148
  const interceptorHandler = await options.getIterceptorHandler();
148
- if (interceptorHandler) {
149
+ if (interceptorHandler?.count) {
149
150
  try {
150
151
  response = await ci.with('Inteceptors:init', () => interceptorHandler.init());
151
152
  if (response !== undefined) {
@@ -169,7 +170,7 @@ function defineMoostEventHandler(options) {
169
170
  return endWithResponse(true);
170
171
  }
171
172
  }
172
- if (interceptorHandler) {
173
+ if (interceptorHandler?.countBefore) {
173
174
  response = await ci.with('Inteceptors:before', () => interceptorHandler.fireBefore(response));
174
175
  if (response !== undefined) {
175
176
  return endWithResponse();
@@ -197,7 +198,7 @@ function defineMoostEventHandler(options) {
197
198
  return endWithResponse(true);
198
199
  }
199
200
  async function endWithResponse(raise = false) {
200
- if (interceptorHandler) {
201
+ if (interceptorHandler?.countAfter || interceptorHandler?.countOnError) {
201
202
  try {
202
203
  response = await ci.with('Inteceptors:after', () => interceptorHandler.fireAfter(response));
203
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moost",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "moost",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",