@venok/http 2.0.1 → 2.1.0-next.2
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/http/arguments-host.js +33 -0
- package/dist/http/starter-module.js +9 -7
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else
|
|
6
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
7
|
+
if (d = decorators[i])
|
|
8
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
12
|
+
var __legacyMetadataTS = (k, v) => {
|
|
13
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
14
|
+
return Reflect.metadata(k, v);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// packages/http/src/http/arguments-host.ts
|
|
18
|
+
import { ExecutionContextHost } from "@venok/core";
|
|
19
|
+
|
|
20
|
+
class HttpArgumentsHost extends ExecutionContextHost {
|
|
21
|
+
static create(context) {
|
|
22
|
+
const type = context.getType();
|
|
23
|
+
const websocketContext = new HttpArgumentsHost(context.getArgs());
|
|
24
|
+
websocketContext.setType(type);
|
|
25
|
+
return websocketContext;
|
|
26
|
+
}
|
|
27
|
+
getContext() {
|
|
28
|
+
return this.getArgByIndex(0);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
HttpArgumentsHost
|
|
33
|
+
};
|
|
@@ -44,13 +44,7 @@ class HttpStarterModule {
|
|
|
44
44
|
this.container = container;
|
|
45
45
|
this.httpConfig = httpConfig;
|
|
46
46
|
}
|
|
47
|
-
async
|
|
48
|
-
this.adapter = this.httpConfig.getHttpAdapterRef();
|
|
49
|
-
this.adapter[VENOK_ADAPTER_SET_EXCEPTION_FILTER](this.container, new ApplicationConfig);
|
|
50
|
-
this.options.callback && this.options.callback(this.httpConfig);
|
|
51
|
-
await this.middlewareService.explore(HttpMiddlewareModule);
|
|
52
|
-
await this.middlewareService.build();
|
|
53
|
-
this.httpExplorerService.explore(Controller.KEY).forEach((item) => this.registerRoutes(item));
|
|
47
|
+
async onApplicationBootstrap() {
|
|
54
48
|
const routes = this.adapter[VENOK_ADAPTER_BUILD]();
|
|
55
49
|
this.adapter[VENOK_APPLY_ROUTES_TO_INSTANCE](routes);
|
|
56
50
|
this.adapter.registerNotFoundHandler();
|
|
@@ -62,6 +56,14 @@ class HttpStarterModule {
|
|
|
62
56
|
};
|
|
63
57
|
await this.adapter.listen(this.options.port, this.options.hostname || "", listenCallback);
|
|
64
58
|
}
|
|
59
|
+
async onModuleInit() {
|
|
60
|
+
this.adapter = this.httpConfig.getHttpAdapterRef();
|
|
61
|
+
this.adapter[VENOK_ADAPTER_SET_EXCEPTION_FILTER](this.container, new ApplicationConfig);
|
|
62
|
+
this.options.callback && this.options.callback(this.httpConfig);
|
|
63
|
+
await this.middlewareService.explore(HttpMiddlewareModule);
|
|
64
|
+
await this.middlewareService.build();
|
|
65
|
+
this.httpExplorerService.explore(Controller.KEY).forEach((item) => this.registerRoutes(item));
|
|
66
|
+
}
|
|
65
67
|
registerRoutes(controllerDiscovery) {
|
|
66
68
|
controllerDiscovery.getItems().forEach((item) => {
|
|
67
69
|
const { path, ...metadata } = item.getMeta();
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* https://github.com/venloc-tech/svm
|
|
4
4
|
*/
|
|
5
5
|
import * as _venok_core from '@venok/core';
|
|
6
|
-
import { Type, VenokExceptionFilterContext, VenokContainer, ApplicationConfig, VenokParamsFactoryInterface, ScopeOptions, PipeTransform, ExceptionFilter, ArgumentsHost, VenokModule, ModulesContainer, CoreModule, DynamicModule } from '@venok/core';
|
|
6
|
+
import { Type, VenokExceptionFilterContext, VenokContainer, ApplicationConfig, VenokParamsFactoryInterface, ScopeOptions, PipeTransform, ExceptionFilter, ArgumentsHost, ExecutionContextHost, VenokModule, ModulesContainer, CoreModule, DynamicModule } from '@venok/core';
|
|
7
7
|
import * as _venok_integration from '@venok/integration';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -2089,6 +2089,11 @@ declare const flattenRoutePaths: (routes: Routes) => {
|
|
|
2089
2089
|
path: string;
|
|
2090
2090
|
}[];
|
|
2091
2091
|
|
|
2092
|
+
declare class HttpArgumentsHost extends ExecutionContextHost {
|
|
2093
|
+
static create(context: ArgumentsHost): HttpArgumentsHost;
|
|
2094
|
+
getContext<T>(): T;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2092
2097
|
declare const HttpConfigurableModuleClass: _venok_integration.ConfigurableModuleCls<HttpAppOptions, "register", "create", object>;
|
|
2093
2098
|
|
|
2094
2099
|
declare class HttpModule extends HttpConfigurableModuleClass {
|
|
@@ -2114,4 +2119,4 @@ declare class RouterModule {
|
|
|
2114
2119
|
private updateTargetModulesCache;
|
|
2115
2120
|
}
|
|
2116
2121
|
|
|
2117
|
-
export { AbstractHttpAdapter, type AdapterInstanceRouteMetadata, type AdapterMiddlewareMetadata, type AdapterPathMiddlewareMetadata, type AdapterRouteMetadata, All, BadGatewayException, BadRequestException, Body, ConflictException, Controller, type ControllerOptions, type CustomVersioningOptions, Delete, type DescriptionAndOptions, type ExcludeRouteMetadata, ExpectationFailedException, FailedDependencyException, ForbiddenException, GatewayTimeoutException, Get, type GlobalPrefixOptions, GoneException, HEADERS_METADATA, HOST_METADATA, Head, Header, type HeaderVersioningOptions, Headers, HostParam, type HttpAppOptions, HttpCode, HttpConfig, HttpContext, HttpException, type HttpExceptionBody, type HttpExceptionBodyMessage, HttpExceptionFilter, type HttpExceptionOptions, HttpMethod, type HttpMiddlewareConsumer, HttpMiddlewareModule, HttpModule, HttpParamtypes, HttpStatus, HttpVersionNotSupportedException, HttpVersioningType, ImATeapotException, InternalServerErrorException, Ip, LengthRequiredException, METHOD_METADATA, type MediaTypeVersioningOptions, MethodMapping, type MethodMappingMetadata, MethodNotAllowedException, type MiddlewareConfigProxy, MisdirectedException, MultipleUploadedFiles, NotAcceptableException, NotFoundException, NotImplementedException, Options, PATH_METADATA, Param, Patch, PayloadTooLargeException, PaymentRequiredException, Post, PreconditionFailedException, PreconditionRequiredException, ProxyAuthenticationRequiredException, Put, Query, REDIRECT_METADATA, RESPONSE_PASSTHROUGH_METADATA, ROUTES, Redirect, type RedirectOptions, RequestTimeoutException, RequestedRangeNotSatisfiableException, type ResponseDecoratorOptions, type RouteDefinition, type RouteInfo, type RoutePathMetadata, type RouteTree, RouterModule, type Routes, Search, ServiceUnavailableException, TooManyRequestsException, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UploadedFile, UploadedFiles, UriTooLongException, type UriVersioningOptions, VENOK_ADAPTER_RESPONSE, VENOK_ADAPTER_TRANSFORM_NATIVE_ARGS_TO_CONTEXT, VENOK_APPLY_ROUTES_TO_INSTANCE, VERSION_METADATA, VERSION_NEUTRAL, Version, type VersionOptions, type VersionValue, type VersioningOptions, addLeadingSlash, assignToken, filterMiddleware, flattenRoutePaths, getPathType, isMiddlewareClass, isOptionalParam, isParam, isRequestMethodAll, isRouteExcluded, isWildcard, mapToClass, mapToExcludeRoute, normalizePath, stripEndSlash, targetModulesByContainer };
|
|
2122
|
+
export { AbstractHttpAdapter, type AdapterInstanceRouteMetadata, type AdapterMiddlewareMetadata, type AdapterPathMiddlewareMetadata, type AdapterRouteMetadata, All, BadGatewayException, BadRequestException, Body, ConflictException, Controller, type ControllerOptions, type CustomVersioningOptions, Delete, type DescriptionAndOptions, type ExcludeRouteMetadata, ExpectationFailedException, FailedDependencyException, ForbiddenException, GatewayTimeoutException, Get, type GlobalPrefixOptions, GoneException, HEADERS_METADATA, HOST_METADATA, Head, Header, type HeaderVersioningOptions, Headers, HostParam, type HttpAppOptions, HttpArgumentsHost, HttpCode, HttpConfig, HttpContext, HttpException, type HttpExceptionBody, type HttpExceptionBodyMessage, HttpExceptionFilter, type HttpExceptionOptions, HttpMethod, type HttpMiddlewareConsumer, HttpMiddlewareModule, HttpModule, HttpParamtypes, HttpStatus, HttpVersionNotSupportedException, HttpVersioningType, ImATeapotException, InternalServerErrorException, Ip, LengthRequiredException, METHOD_METADATA, type MediaTypeVersioningOptions, MethodMapping, type MethodMappingMetadata, MethodNotAllowedException, type MiddlewareConfigProxy, MisdirectedException, MultipleUploadedFiles, NotAcceptableException, NotFoundException, NotImplementedException, Options, PATH_METADATA, Param, Patch, PayloadTooLargeException, PaymentRequiredException, Post, PreconditionFailedException, PreconditionRequiredException, ProxyAuthenticationRequiredException, Put, Query, REDIRECT_METADATA, RESPONSE_PASSTHROUGH_METADATA, ROUTES, Redirect, type RedirectOptions, RequestTimeoutException, RequestedRangeNotSatisfiableException, type ResponseDecoratorOptions, type RouteDefinition, type RouteInfo, type RoutePathMetadata, type RouteTree, RouterModule, type Routes, Search, ServiceUnavailableException, TooManyRequestsException, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UploadedFile, UploadedFiles, UriTooLongException, type UriVersioningOptions, VENOK_ADAPTER_RESPONSE, VENOK_ADAPTER_TRANSFORM_NATIVE_ARGS_TO_CONTEXT, VENOK_APPLY_ROUTES_TO_INSTANCE, VERSION_METADATA, VERSION_NEUTRAL, Version, type VersionOptions, type VersionValue, type VersioningOptions, addLeadingSlash, assignToken, filterMiddleware, flattenRoutePaths, getPathType, isMiddlewareClass, isOptionalParam, isParam, isRequestMethodAll, isRouteExcluded, isWildcard, mapToClass, mapToExcludeRoute, normalizePath, stripEndSlash, targetModulesByContainer };
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ export * from "./helpers/middleware.helper.js";
|
|
|
64
64
|
export * from "./helpers/path.helper.js";
|
|
65
65
|
export * from "./helpers/route.helper.js";
|
|
66
66
|
export * from "./http/adapter.js";
|
|
67
|
+
export * from "./http/arguments-host.js";
|
|
67
68
|
export * from "./http/config.js";
|
|
68
69
|
export * from "./http/module.js";
|
|
69
70
|
export * from "./interfaces/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venok/http",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-next.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "shiz-ceo",
|
|
6
6
|
"homepage": "",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"test": "bun test ./test/"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@venok/core": "
|
|
39
|
-
"@venok/integration": "
|
|
38
|
+
"@venok/core": "2.0.1",
|
|
39
|
+
"@venok/integration": "2.0.1",
|
|
40
40
|
"reflect-metadata": "^0.2.2",
|
|
41
41
|
"rxjs": "^7.8.1"
|
|
42
42
|
},
|