@venok/core 2.0.1-next.1 → 2.0.1-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.
@@ -37,6 +37,18 @@ class VenokProxy {
37
37
  exceptionsHandler.next(error, host);
38
38
  return args;
39
39
  }
40
+ createExceptionLayerProxy(targetCallback, exceptionsHandler, type) {
41
+ return async (err, req, res, next) => {
42
+ try {
43
+ await targetCallback(err, req, res, next);
44
+ } catch (e) {
45
+ const host = new ExecutionContextHost([req, res, next]);
46
+ host.setType(type);
47
+ exceptionsHandler.next(e, host);
48
+ return res;
49
+ }
50
+ };
51
+ }
40
52
  }
41
53
  export {
42
54
  VenokProxy
package/dist/index.d.ts CHANGED
@@ -2185,7 +2185,8 @@ declare class VenokExceptionFilterContext extends ExceptionFilterContextCreator
2185
2185
 
2186
2186
  declare class VenokProxy {
2187
2187
  createProxy<TContext extends string = ContextType>(targetCallback: (...args: any[]) => any, exceptionsHandler: VenokExceptionsHandler, type?: ContextType): (...args: any[]) => Promise<any>;
2188
- protected handleError<T>(exceptionsHandler: VenokExceptionsHandler, args: any[], error: T, type?: ContextType): any[];
2188
+ private handleError;
2189
+ createExceptionLayerProxy<TContext extends string = ContextType>(targetCallback: <TError>(err: TError, ...args: any[]) => void | Promise<void>, exceptionsHandler: VenokExceptionsHandler, type?: TContext): <TError>(err: TError, req: any, res: any, next: any) => Promise<any>;
2189
2190
  }
2190
2191
 
2191
2192
  /**
@@ -2507,16 +2508,9 @@ declare function Injectable(options?: InjectableOptions): ClassDecorator;
2507
2508
  */
2508
2509
  declare function mixin<T>(mixinClass: Type<T>): Type<T>;
2509
2510
 
2510
- /**
2511
- * Extended interface for Module decorator that allows custom keys
2512
- */
2513
- interface ExtendedModuleMetadata {
2514
- /**
2515
- * Allows any additional keys (controllers, queues, processors, etc.)
2516
- * that will be automatically added to the providers array.
2517
- */
2518
- [key: string]: Provider[];
2519
- }
2511
+ type KnownModuleKeys = keyof ModuleMetadata;
2512
+ type DisjointRecord<T> = keyof T extends infer K ? K extends KnownModuleKeys ? never : K extends string ? Record<K, Provider[]> : never : never;
2513
+ type ModuleOptions = ModuleMetadata | (Record<string, Provider[]> & DisjointRecord<Record<string, Provider[]>>);
2520
2514
  /**
2521
2515
  * Decorator that marks a class as a module.
2522
2516
  *
@@ -2528,7 +2522,7 @@ interface ExtendedModuleMetadata {
2528
2522
  *
2529
2523
  * @publicApi
2530
2524
  */
2531
- declare function Module(metadata: ModuleMetadata & ExtendedModuleMetadata): ClassDecorator;
2525
+ declare function Module(metadata: ModuleOptions): ClassDecorator;
2532
2526
 
2533
2527
  /**
2534
2528
  * Parameter decorator for an injected dependency marking the
@@ -3138,4 +3132,4 @@ declare class MetaHostStorage {
3138
3132
  private static getMetaKeyByInstanceWrapper;
3139
3133
  }
3140
3134
 
3141
- export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE, type Abstract, ApplicationConfig, ApplicationContext, ApplicationContextOptions, type ArgumentMetadata, type ArgumentsHost, type AttachedEnhancerDefinition, type BeforeApplicationShutdown, Bind, CATCH_WATERMARK, CUSTOM_ROUTE_ARGS_METADATA, type CallHandler, type CanActivate, Catch, CircularDependencyException, type ClassDecoratorOptions, type ClassNode, type ClassProvider, ConsoleLogger, type ConsoleLoggerOptions, ContextCreator, type ContextId, ContextIdFactory, type ContextIdResolver, type ContextIdResolverFn, type ContextIdStrategy, type ContextType, ContextUtils, Module$1 as CoreModule, type CreateDecoratorOptions, type CustomDecorator, type CustomParamFactory, type DecoratorOptions, type DecoratorsType, Dependencies, DependenciesScanner, DeterministicUuidRegistry, type DynamicModule, ENHANCER_KEY_TO_SUBTYPE_MAP, ENHANCER_TOKEN_TO_SUBTYPE_MAP, ENTRY_PROVIDER_WATERMARK, EXCEPTION_FILTERS_METADATA, type Edge, type EnhancerMetadataCacheEntry, type EnhancerSubtype, type Entrypoint, type ExceptionFilter, ExceptionFilterContextCreator, type ExceptionFilterMetadata, type ExecutionContext, ExecutionContextHost, type ExistingProvider, type ExternalContextOptions, type ExternalHandlerMetadata, type Extras, FILTER_CATCH_EXCEPTIONS, FORBIDDEN_MESSAGE, type FactoryProvider, type ForwardReference, GLOBAL_MODULE_METADATA, GUARDS_METADATA, type GetOrResolveOptions, type GetParamsMetadata, Global, GraphInspector, GuardsConsumer, GuardsContextCreator, HANDLER_METADATA_SYMBOL, HandlerMetadataStorage, type HostComponentInfo, INJECTABLE_WATERMARK, INQUIRER, INSTANCE_ID_SYMBOL, INSTANCE_METADATA_SYMBOL, INTERCEPTORS_METADATA, INVALID_CLASS_MESSAGE, INVALID_CLASS_SCOPE_MESSAGE, INVALID_EXCEPTION_FILTER, INVALID_MODULE_MESSAGE, InitializeOnPreviewAllowlist, Inject, Injectable, type InjectableToken, type InjectionToken, Injector, type InjectorDependency, type InjectorDependencyContext, type InstancePerContext, InstanceWrapper, InterceptorsConsumer, InterceptorsContextCreator, type IntrospectionResult, InvalidClassException, InvalidClassModuleException, InvalidClassScopeException, InvalidDecoratorItemException, InvalidExceptionFilterException, InvalidModuleException, LOG_LEVELS, LazyModuleLoader, type LazyModuleLoaderLoadOptions, type LogLevel, Logger, type LoggerService, MESSAGES, MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION, MODULE_INIT_MESSAGE, MODULE_METADATA, MODULE_PATH, MetaHostStorage, MetadataScanner, type MethodDecoratorOptions, Module, type ModuleDefinition, type ModuleFactory, type ModuleMetadata, type ModuleNode, ModuleRef, type ModuleRefGetOrResolveOpts, ModulesContainer, type Node, OPTIONAL_DEPS_METADATA, OPTIONAL_PROPERTY_DEPS_METADATA, type OnApplicationBootstrap, type OnApplicationShutdown, type OnModuleDestroy, type OnModuleInit, Optional, type OptionalFactoryDependency, type OrphanedEnhancerDefinition, PARAMTYPES_METADATA, PIPES_METADATA, PROPERTY_DEPS_METADATA, PROVIDER_ID_KEY, type ParamData, type ParamDecoratorEnhancer, type ParamMetadata, type ParamProperties, type ParamsMetadata, PartialGraphHost, type PipeTransform, PipesConsumer, PipesContextCreator, type PropertyDependency, type PropertyMetadata, type Provider, REQUEST, REQUEST_CONTEXT_ID, ROUTE_ARGS_METADATA, type ReflectableClassDecorator, type ReflectableDecorator, type ReflectableDecorators, type ReflectableMethodDecorator, Reflector, ReflectorAliasProvider, RuntimeException, SCOPE_OPTIONS_METADATA, SELF_DECLARED_DEPS_METADATA, STATIC_CONTEXT, Scope, type ScopeOptions, type SelectOptions, SerializedGraph, type SerializedGraphJson, type SerializedGraphMetadata, type SerializedGraphStatus, SetMetadata, type SetMetadataType, SilentLogger, type Transform, type Type, UNDEFINED_FORWARDREF_MESSAGE, UNDEFINED_MODULE_MESSAGE, UNHANDLED_RUNTIME_EXCEPTION, UNKNOWN_DEPENDENCIES_MESSAGE, UNKNOWN_EXPORT_MESSAGE, USING_INVALID_CLASS_AS_A_MODULE_MESSAGE, UndefinedDependencyException, UndefinedForwardRefException, UndefinedModuleException, UnknownDependenciesException, UnknownElementException, UnknownExportException, UnknownModuleException, UseFilters, UseGuards, UseInterceptors, UsePipes, UuidFactory, UuidFactoryMode, type ValueProvider, type VenokApplicationContext, VenokContainer, VenokContextCreator, type VenokContextCreatorInterface, VenokExceptionFilterContext, VenokExceptionsHandler, VenokFactory, type VenokInterceptor, type VenokModule, type VenokParamsFactoryInterface, VenokProxy, type WithRequired, type WithTransform, applyDecorators, assignCustomParameterMetadata, assignMetadata, colors, createContextId, createNativeParamDecorator, createNativeParamDecoratorWithoutPipes, createParamDecorator, createParamDecoratorWithoutPipes, extendArrayMetadata, filterLogLevels, flatten, getClassScope, getNonTransientInstances, getTransientInstances, inquirerProvider, isClassProvider, isColorAllowed, isConstructor, isDurable, isEmpty, isFactoryProvider, isFunction, isLogLevel, isLogLevelEnabled, isNull, isNumber, isObject, isPlainObject, isString, isSymbol, isUndefined, isValueProvider, mixin, noop, randomStringGenerator, requestProvider, rethrow, validateEach, yellow };
3135
+ export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE, type Abstract, ApplicationConfig, ApplicationContext, ApplicationContextOptions, type ArgumentMetadata, type ArgumentsHost, type AttachedEnhancerDefinition, type BeforeApplicationShutdown, Bind, CATCH_WATERMARK, CUSTOM_ROUTE_ARGS_METADATA, type CallHandler, type CanActivate, Catch, CircularDependencyException, type ClassDecoratorOptions, type ClassNode, type ClassProvider, ConsoleLogger, type ConsoleLoggerOptions, ContextCreator, type ContextId, ContextIdFactory, type ContextIdResolver, type ContextIdResolverFn, type ContextIdStrategy, type ContextType, ContextUtils, Module$1 as CoreModule, type CreateDecoratorOptions, type CustomDecorator, type CustomParamFactory, type DecoratorOptions, type DecoratorsType, Dependencies, DependenciesScanner, DeterministicUuidRegistry, type DynamicModule, ENHANCER_KEY_TO_SUBTYPE_MAP, ENHANCER_TOKEN_TO_SUBTYPE_MAP, ENTRY_PROVIDER_WATERMARK, EXCEPTION_FILTERS_METADATA, type Edge, type EnhancerMetadataCacheEntry, type EnhancerSubtype, type Entrypoint, type ExceptionFilter, type ExceptionFilterMetadata, type ExecutionContext, ExecutionContextHost, type ExistingProvider, type ExternalContextOptions, type ExternalHandlerMetadata, type Extras, FILTER_CATCH_EXCEPTIONS, FORBIDDEN_MESSAGE, type FactoryProvider, type ForwardReference, GLOBAL_MODULE_METADATA, GUARDS_METADATA, type GetOrResolveOptions, type GetParamsMetadata, Global, GraphInspector, GuardsConsumer, GuardsContextCreator, HANDLER_METADATA_SYMBOL, HandlerMetadataStorage, type HostComponentInfo, INJECTABLE_WATERMARK, INQUIRER, INSTANCE_ID_SYMBOL, INSTANCE_METADATA_SYMBOL, INTERCEPTORS_METADATA, INVALID_CLASS_MESSAGE, INVALID_CLASS_SCOPE_MESSAGE, INVALID_EXCEPTION_FILTER, INVALID_MODULE_MESSAGE, InitializeOnPreviewAllowlist, Inject, Injectable, type InjectableToken, type InjectionToken, Injector, type InjectorDependency, type InjectorDependencyContext, type InstancePerContext, InstanceWrapper, InterceptorsConsumer, InterceptorsContextCreator, type IntrospectionResult, InvalidClassException, InvalidClassModuleException, InvalidClassScopeException, InvalidDecoratorItemException, InvalidExceptionFilterException, InvalidModuleException, LOG_LEVELS, LazyModuleLoader, type LazyModuleLoaderLoadOptions, type LogLevel, Logger, type LoggerService, MESSAGES, MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION, MODULE_INIT_MESSAGE, MODULE_METADATA, MODULE_PATH, MetaHostStorage, MetadataScanner, type MethodDecoratorOptions, Module, type ModuleDefinition, type ModuleFactory, type ModuleMetadata, type ModuleNode, type ModuleOptions, ModuleRef, type ModuleRefGetOrResolveOpts, ModulesContainer, type Node, OPTIONAL_DEPS_METADATA, OPTIONAL_PROPERTY_DEPS_METADATA, type OnApplicationBootstrap, type OnApplicationShutdown, type OnModuleDestroy, type OnModuleInit, Optional, type OptionalFactoryDependency, type OrphanedEnhancerDefinition, PARAMTYPES_METADATA, PIPES_METADATA, PROPERTY_DEPS_METADATA, PROVIDER_ID_KEY, type ParamData, type ParamDecoratorEnhancer, type ParamMetadata, type ParamProperties, type ParamsMetadata, PartialGraphHost, type PipeTransform, PipesConsumer, PipesContextCreator, type PropertyDependency, type PropertyMetadata, type Provider, REQUEST, REQUEST_CONTEXT_ID, ROUTE_ARGS_METADATA, type ReflectableClassDecorator, type ReflectableDecorator, type ReflectableDecorators, type ReflectableMethodDecorator, Reflector, ReflectorAliasProvider, RuntimeException, SCOPE_OPTIONS_METADATA, SELF_DECLARED_DEPS_METADATA, STATIC_CONTEXT, Scope, type ScopeOptions, type SelectOptions, SerializedGraph, type SerializedGraphJson, type SerializedGraphMetadata, type SerializedGraphStatus, SetMetadata, type SetMetadataType, SilentLogger, type Transform, type Type, UNDEFINED_FORWARDREF_MESSAGE, UNDEFINED_MODULE_MESSAGE, UNHANDLED_RUNTIME_EXCEPTION, UNKNOWN_DEPENDENCIES_MESSAGE, UNKNOWN_EXPORT_MESSAGE, USING_INVALID_CLASS_AS_A_MODULE_MESSAGE, UndefinedDependencyException, UndefinedForwardRefException, UndefinedModuleException, UnknownDependenciesException, UnknownElementException, UnknownExportException, UnknownModuleException, UseFilters, UseGuards, UseInterceptors, UsePipes, UuidFactory, UuidFactoryMode, type ValueProvider, type VenokApplicationContext, VenokContainer, VenokContextCreator, type VenokContextCreatorInterface, VenokExceptionFilterContext, VenokFactory, type VenokInterceptor, type VenokModule, type VenokParamsFactoryInterface, VenokProxy, type WithRequired, type WithTransform, applyDecorators, assignCustomParameterMetadata, assignMetadata, colors, createContextId, createNativeParamDecorator, createNativeParamDecoratorWithoutPipes, createParamDecorator, createParamDecoratorWithoutPipes, extendArrayMetadata, filterLogLevels, flatten, getClassScope, getNonTransientInstances, getTransientInstances, inquirerProvider, isClassProvider, isColorAllowed, isConstructor, isDurable, isEmpty, isFactoryProvider, isFunction, isLogLevel, isLogLevelEnabled, isNull, isNumber, isObject, isPlainObject, isString, isSymbol, isUndefined, isValueProvider, mixin, noop, randomStringGenerator, requestProvider, rethrow, validateEach, yellow };
package/dist/index.js CHANGED
@@ -58,9 +58,7 @@ export * from "./errors/exceptions/unknown-element.exception.js";
58
58
  export * from "./errors/exceptions/unknown-export.exception.js";
59
59
  export * from "./errors/exceptions/unknown-module.exception.js";
60
60
  export * from "./errors/messages.js";
61
- export * from "./exceptions/handler.js";
62
61
  export * from "./filters/context.js";
63
- export * from "./filters/context-creator.js";
64
62
  export * from "./guards/consumer.js";
65
63
  export * from "./guards/context-creator.js";
66
64
  export * from "./helpers/color.helper.js";
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@venok/core",
3
- "version": "2.0.1-next.1",
3
+ "version": "2.0.1-next.2",
4
4
  "description": "",
5
5
  "author": "shiz-ceo",
6
6
  "type": "module",
7
7
  "homepage": "",
8
- "files": ["package.json", "dist"],
8
+ "files": [
9
+ "package.json",
10
+ "dist"
11
+ ],
9
12
  "exports": {
10
13
  ".": {
11
14
  "require": {
@@ -37,8 +40,7 @@
37
40
  "directory": "packages/core"
38
41
  },
39
42
  "scripts": {
40
- "build": "venok build",
41
- "test": "mocha test_old/**/*.spec.ts"
43
+ "test": "bun test ./test/"
42
44
  },
43
45
  "dependencies": {
44
46
  "fast-safe-stringify": "^2.1.1"