@moostjs/event-http 0.4.7 → 0.4.9
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 +16 -16
- package/dist/index.mjs +16 -16
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -235,6 +235,7 @@ class MoostHttp {
|
|
|
235
235
|
getIterceptorHandler: () => this.moost?.getGlobalInterceptorHandler(),
|
|
236
236
|
getControllerInstance: () => this.moost,
|
|
237
237
|
callControllerMethod: () => undefined,
|
|
238
|
+
targetPath: '',
|
|
238
239
|
})();
|
|
239
240
|
if (!response) {
|
|
240
241
|
throw new eventHttp.HttpError(404, 'Resource Not Found');
|
|
@@ -259,23 +260,22 @@ class MoostHttp {
|
|
|
259
260
|
const httpPath = handler.path;
|
|
260
261
|
const path = typeof httpPath === 'string' ? httpPath : typeof opts.method === 'string' ? opts.method : '';
|
|
261
262
|
const targetPath = `${`${opts.prefix || ''}/${path}`.replace(/\/\/+/g, '/')}${path.endsWith('//') ? '/' : ''}`;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
rawRequest.on('end', unscope);
|
|
275
|
-
},
|
|
263
|
+
fn = moost.defineMoostEventHandler({
|
|
264
|
+
contextType: CONTEXT_TYPE,
|
|
265
|
+
loggerTitle: LOGGER_TITLE,
|
|
266
|
+
getIterceptorHandler: opts.getIterceptorHandler,
|
|
267
|
+
getControllerInstance: opts.getInstance,
|
|
268
|
+
controllerMethod: opts.method,
|
|
269
|
+
resolveArgs: opts.resolveArgs,
|
|
270
|
+
manualUnscope: true,
|
|
271
|
+
hooks: {
|
|
272
|
+
init: ({ unscope }) => {
|
|
273
|
+
const { rawRequest } = eventHttp.useRequest();
|
|
274
|
+
rawRequest.on('end', unscope);
|
|
276
275
|
},
|
|
277
|
-
}
|
|
278
|
-
|
|
276
|
+
},
|
|
277
|
+
targetPath,
|
|
278
|
+
});
|
|
279
279
|
const routerBinding = this.httpApp.on(handler.method, targetPath, fn);
|
|
280
280
|
const { getPath: pathBuilder } = routerBinding;
|
|
281
281
|
const methodMeta = moost.getMoostMate().read(opts.fakeInstance, opts.method) || {};
|
package/dist/index.mjs
CHANGED
|
@@ -234,6 +234,7 @@ class MoostHttp {
|
|
|
234
234
|
getIterceptorHandler: () => this.moost?.getGlobalInterceptorHandler(),
|
|
235
235
|
getControllerInstance: () => this.moost,
|
|
236
236
|
callControllerMethod: () => undefined,
|
|
237
|
+
targetPath: '',
|
|
237
238
|
})();
|
|
238
239
|
if (!response) {
|
|
239
240
|
throw new HttpError(404, 'Resource Not Found');
|
|
@@ -258,23 +259,22 @@ class MoostHttp {
|
|
|
258
259
|
const httpPath = handler.path;
|
|
259
260
|
const path = typeof httpPath === 'string' ? httpPath : typeof opts.method === 'string' ? opts.method : '';
|
|
260
261
|
const targetPath = `${`${opts.prefix || ''}/${path}`.replace(/\/\/+/g, '/')}${path.endsWith('//') ? '/' : ''}`;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
rawRequest.on('end', unscope);
|
|
274
|
-
},
|
|
262
|
+
fn = defineMoostEventHandler({
|
|
263
|
+
contextType: CONTEXT_TYPE,
|
|
264
|
+
loggerTitle: LOGGER_TITLE,
|
|
265
|
+
getIterceptorHandler: opts.getIterceptorHandler,
|
|
266
|
+
getControllerInstance: opts.getInstance,
|
|
267
|
+
controllerMethod: opts.method,
|
|
268
|
+
resolveArgs: opts.resolveArgs,
|
|
269
|
+
manualUnscope: true,
|
|
270
|
+
hooks: {
|
|
271
|
+
init: ({ unscope }) => {
|
|
272
|
+
const { rawRequest } = useRequest();
|
|
273
|
+
rawRequest.on('end', unscope);
|
|
275
274
|
},
|
|
276
|
-
}
|
|
277
|
-
|
|
275
|
+
},
|
|
276
|
+
targetPath,
|
|
277
|
+
});
|
|
278
278
|
const routerBinding = this.httpApp.on(handler.method, targetPath, fn);
|
|
279
279
|
const { getPath: pathBuilder } = routerBinding;
|
|
280
280
|
const methodMeta = getMoostMate().read(opts.fakeInstance, opts.method) || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-http",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "@moostjs/event-http",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-http#readme",
|
|
39
39
|
"peerDependencies": {},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"moost": "0.4.
|
|
42
|
-
"@wooksjs/event-core": "^0.5.
|
|
43
|
-
"@wooksjs/event-http": "^0.5.
|
|
44
|
-
"@wooksjs/http-body": "^0.5.
|
|
41
|
+
"moost": "0.4.9",
|
|
42
|
+
"@wooksjs/event-core": "^0.5.9",
|
|
43
|
+
"@wooksjs/event-http": "^0.5.9",
|
|
44
|
+
"@wooksjs/http-body": "^0.5.9",
|
|
45
45
|
"@prostojs/infact": "^0.2.3",
|
|
46
46
|
"@prostojs/router": "^0.2.1"
|
|
47
47
|
}
|