🎯 MapView v2.0 - Global Deployment Ready

 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
This commit is contained in:
2025-07-20 19:52:16 +07:00
parent 3203463a6a
commit c65cc97a33
64624 changed files with 7199453 additions and 6462 deletions

View File

@@ -0,0 +1,10 @@
import { Controller } from '@nestjs/common/interfaces';
import { ContextId, InstanceWrapper } from '../injector/instance-wrapper';
export declare abstract class ContextCreator {
abstract createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
getGlobalMetadata?<T extends any[]>(contextId?: ContextId, inquirerId?: string): T;
createContext<T extends unknown[] = any, R extends unknown[] = any>(instance: Controller, callback: (...args: any[]) => void, metadataKey: string, contextId?: ContextId, inquirerId?: string): R;
reflectClassMetadata<T>(instance: Controller, metadataKey: string): T;
reflectMethodMetadata<T>(callback: (...args: unknown[]) => unknown, metadataKey: string): T;
protected getContextId(contextId: ContextId, instanceWrapper: InstanceWrapper): ContextId;
}

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextCreator = void 0;
const constants_1 = require("../injector/constants");
class ContextCreator {
createContext(instance, callback, metadataKey, contextId = constants_1.STATIC_CONTEXT, inquirerId) {
const globalMetadata = this.getGlobalMetadata &&
this.getGlobalMetadata(contextId, inquirerId);
const classMetadata = this.reflectClassMetadata(instance, metadataKey);
const methodMetadata = this.reflectMethodMetadata(callback, metadataKey);
return [
...this.createConcreteContext(globalMetadata || [], contextId, inquirerId),
...this.createConcreteContext(classMetadata, contextId, inquirerId),
...this.createConcreteContext(methodMetadata, contextId, inquirerId),
];
}
reflectClassMetadata(instance, metadataKey) {
const prototype = Object.getPrototypeOf(instance);
return Reflect.getMetadata(metadataKey, prototype.constructor);
}
reflectMethodMetadata(callback, metadataKey) {
return Reflect.getMetadata(metadataKey, callback);
}
getContextId(contextId, instanceWrapper) {
return contextId.getParent
? contextId.getParent({
token: instanceWrapper.token,
isTreeDurable: instanceWrapper.isDependencyTreeDurable(),
})
: contextId;
}
}
exports.ContextCreator = ContextCreator;

View File

@@ -0,0 +1,41 @@
import { ContextId, HostComponentInfo } from '../injector/instance-wrapper';
export declare function createContextId(): ContextId;
export type ContextIdResolverFn = (info: HostComponentInfo) => ContextId;
export interface ContextIdResolver {
/**
* Payload associated with the custom context id
*/
payload: unknown;
/**
* A context id resolver function
*/
resolve: ContextIdResolverFn;
}
export interface ContextIdStrategy<T = any> {
/**
* Allows to attach a parent context id to the existing child context id.
* This lets you construct durable DI sub-trees that can be shared between contexts.
* @param contextId auto-generated child context id
* @param request request object
*/
attach(contextId: ContextId, request: T): ContextIdResolverFn | ContextIdResolver | undefined;
}
export declare class ContextIdFactory {
private static strategy?;
/**
* Generates a context identifier based on the request object.
*/
static create(): ContextId;
/**
* Generates a random identifier to track asynchronous execution context.
* @param request request object
*/
static getByRequest<T extends Record<any, any> = any>(request: T, propsToInspect?: string[]): ContextId;
/**
* Registers a custom context id strategy that lets you attach
* a parent context id to the existing context id object.
* @param strategy strategy instance
*/
static apply(strategy: ContextIdStrategy): void;
private static isContextIdResolverWithPayload;
}

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextIdFactory = void 0;
exports.createContextId = createContextId;
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
const request_constants_1 = require("../router/request/request-constants");
function createContextId() {
/**
* We are generating random identifier to track asynchronous
* execution context. An identifier does not have to be neither unique
* nor unpredictable because WeakMap uses objects as keys (reference comparison).
* Thus, even though identifier number might be equal, WeakMap would properly
* associate asynchronous context with its internal map values using object reference.
* Object is automatically removed once request has been processed (closure).
*/
return { id: Math.random() };
}
class ContextIdFactory {
/**
* Generates a context identifier based on the request object.
*/
static create() {
return createContextId();
}
/**
* Generates a random identifier to track asynchronous execution context.
* @param request request object
*/
static getByRequest(request, propsToInspect = ['raw']) {
if (!request) {
return ContextIdFactory.create();
}
if (request[request_constants_1.REQUEST_CONTEXT_ID]) {
return request[request_constants_1.REQUEST_CONTEXT_ID];
}
for (const key of propsToInspect) {
if (request[key]?.[request_constants_1.REQUEST_CONTEXT_ID]) {
return request[key][request_constants_1.REQUEST_CONTEXT_ID];
}
}
if (!this.strategy) {
return ContextIdFactory.create();
}
const contextId = createContextId();
const resolverObjectOrFunction = this.strategy.attach(contextId, request);
if (this.isContextIdResolverWithPayload(resolverObjectOrFunction)) {
contextId.getParent = resolverObjectOrFunction.resolve;
contextId.payload = resolverObjectOrFunction.payload;
}
else {
contextId.getParent = resolverObjectOrFunction;
}
return contextId;
}
/**
* Registers a custom context id strategy that lets you attach
* a parent context id to the existing context id object.
* @param strategy strategy instance
*/
static apply(strategy) {
this.strategy = strategy;
}
static isContextIdResolverWithPayload(resolverOrResolverFn) {
return (0, shared_utils_1.isObject)(resolverOrResolverFn);
}
}
exports.ContextIdFactory = ContextIdFactory;

View File

@@ -0,0 +1,23 @@
import { ParamData } from '@nestjs/common';
import { ContextType, Controller, PipeTransform } from '@nestjs/common/interfaces';
import { ExecutionContextHost } from './execution-context-host';
export interface ParamProperties<T = any, IExtractor extends Function = any> {
index: number;
type: T | string;
data: ParamData;
pipes: PipeTransform[];
extractValue: IExtractor;
}
export declare class ContextUtils {
mapParamType(key: string): string;
reflectCallbackParamtypes(instance: Controller, methodName: string): any[];
reflectCallbackMetadata<T = any>(instance: Controller, methodName: string, metadataKey: string): T;
reflectPassthrough(instance: Controller, methodName: string): boolean;
getArgumentsLength<T>(keys: string[], metadata: T): number;
createNullArray(length: number): any[];
mergeParamsMetatypes(paramsProperties: ParamProperties[], paramtypes: any[]): (ParamProperties & {
metatype?: any;
})[];
getCustomFactory(factory: (...args: unknown[]) => void, data: unknown, contextFactory: (args: unknown[]) => ExecutionContextHost): (...args: unknown[]) => unknown;
getContextFactory<TContext extends string = ContextType>(contextType: TContext, instance?: object, callback?: Function): (args: unknown[]) => ExecutionContextHost;
}

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextUtils = void 0;
const constants_1 = require("@nestjs/common/constants");
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
const execution_context_host_1 = require("./execution-context-host");
class ContextUtils {
mapParamType(key) {
const keyPair = key.split(':');
return keyPair[0];
}
reflectCallbackParamtypes(instance, methodName) {
return Reflect.getMetadata(constants_1.PARAMTYPES_METADATA, instance, methodName);
}
reflectCallbackMetadata(instance, methodName, metadataKey) {
return Reflect.getMetadata(metadataKey, instance.constructor, methodName);
}
reflectPassthrough(instance, methodName) {
return Reflect.getMetadata(constants_1.RESPONSE_PASSTHROUGH_METADATA, instance.constructor, methodName);
}
getArgumentsLength(keys, metadata) {
return keys.length
? Math.max(...keys.map(key => metadata[key].index)) + 1
: 0;
}
createNullArray(length) {
const a = new Array(length);
for (let i = 0; i < length; ++i)
a[i] = undefined;
return a;
}
mergeParamsMetatypes(paramsProperties, paramtypes) {
if (!paramtypes) {
return paramsProperties;
}
return paramsProperties.map(param => ({
...param,
metatype: paramtypes[param.index],
}));
}
getCustomFactory(factory, data, contextFactory) {
return (0, shared_utils_1.isFunction)(factory)
? (...args) => factory(data, contextFactory(args))
: () => null;
}
getContextFactory(contextType, instance, callback) {
const type = instance && instance.constructor;
return (args) => {
const ctx = new execution_context_host_1.ExecutionContextHost(args, type, callback);
ctx.setType(contextType);
return ctx;
};
}
}
exports.ContextUtils = ContextUtils;

View File

@@ -0,0 +1,19 @@
import { ExecutionContext } from '@nestjs/common';
import { Type } from '@nestjs/common/interfaces';
import { ContextType, HttpArgumentsHost, RpcArgumentsHost, WsArgumentsHost } from '@nestjs/common/interfaces/features/arguments-host.interface';
export declare class ExecutionContextHost implements ExecutionContext {
private readonly args;
private readonly constructorRef;
private readonly handler;
private contextType;
constructor(args: any[], constructorRef?: Type<any>, handler?: Function);
setType<TContext extends string = ContextType>(type: TContext): void;
getType<TContext extends string = ContextType>(): TContext;
getClass<T = any>(): Type<T>;
getHandler(): Function;
getArgs<T extends Array<any> = any[]>(): T;
getArgByIndex<T = any>(index: number): T;
switchToRpc(): RpcArgumentsHost;
switchToHttp(): HttpArgumentsHost;
switchToWs(): WsArgumentsHost;
}

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionContextHost = void 0;
class ExecutionContextHost {
constructor(args, constructorRef = null, handler = null) {
this.args = args;
this.constructorRef = constructorRef;
this.handler = handler;
this.contextType = 'http';
}
setType(type) {
type && (this.contextType = type);
}
getType() {
return this.contextType;
}
getClass() {
return this.constructorRef;
}
getHandler() {
return this.handler;
}
getArgs() {
return this.args;
}
getArgByIndex(index) {
return this.args[index];
}
switchToRpc() {
return Object.assign(this, {
getData: () => this.getArgByIndex(0),
getContext: () => this.getArgByIndex(1),
});
}
switchToHttp() {
return Object.assign(this, {
getRequest: () => this.getArgByIndex(0),
getResponse: () => this.getArgByIndex(1),
getNext: () => this.getArgByIndex(2),
});
}
switchToWs() {
return Object.assign(this, {
getClient: () => this.getArgByIndex(0),
getData: () => this.getArgByIndex(1),
getPattern: () => this.getArgByIndex(this.getArgs().length - 1),
});
}
}
exports.ExecutionContextHost = ExecutionContextHost;

View File

@@ -0,0 +1,51 @@
import { ParamData } from '@nestjs/common';
import { ContextType, Controller, PipeTransform } from '@nestjs/common/interfaces';
import { ExternalExceptionFilterContext } from '../exceptions/external-exception-filter-context';
import { GuardsConsumer, GuardsContextCreator } from '../guards';
import { NestContainer } from '../injector/container';
import { ContextId } from '../injector/instance-wrapper';
import { ModulesContainer } from '../injector/modules-container';
import { InterceptorsConsumer, InterceptorsContextCreator } from '../interceptors';
import { PipesConsumer, PipesContextCreator } from '../pipes';
import { ParamProperties } from './context-utils';
import { ExternalHandlerMetadata } from './interfaces/external-handler-metadata.interface';
import { ParamsMetadata } from './interfaces/params-metadata.interface';
export interface ParamsFactory {
exchangeKeyForValue(type: number, data: ParamData, args: any): any;
}
export interface ExternalContextOptions {
guards?: boolean;
interceptors?: boolean;
filters?: boolean;
}
export declare class ExternalContextCreator {
private readonly guardsContextCreator;
private readonly guardsConsumer;
private readonly interceptorsContextCreator;
private readonly interceptorsConsumer;
private readonly modulesContainer;
private readonly pipesContextCreator;
private readonly pipesConsumer;
private readonly filtersContextCreator;
private readonly contextUtils;
private readonly externalErrorProxy;
private readonly handlerMetadataStorage;
private container;
constructor(guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, filtersContextCreator: ExternalExceptionFilterContext);
static fromContainer(container: NestContainer): ExternalContextCreator;
create<TParamsMetadata extends ParamsMetadata = ParamsMetadata, TContext extends string = ContextType>(instance: Controller, callback: (...args: unknown[]) => unknown, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextId?: ContextId, inquirerId?: string, options?: ExternalContextOptions, contextType?: TContext): (...args: any[]) => Promise<any>;
getMetadata<TMetadata, TContext extends string = ContextType>(instance: Controller, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextType?: TContext): ExternalHandlerMetadata;
getContextModuleKey(moduleCtor: Function | undefined): string;
exchangeKeysForValues<TMetadata = any>(keys: string[], metadata: TMetadata, moduleContext: string, paramsFactory: ParamsFactory, contextId?: ContextId, inquirerId?: string, contextFactory?: (args: unknown[]) => import("./execution-context-host").ExecutionContextHost): ParamProperties[];
createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
metatype?: unknown;
})[]): (args: unknown[], ...params: unknown[]) => Promise<void>;
getParamValue<T>(value: T, { metatype, type, data }: {
metatype: any;
type: any;
data: any;
}, pipes: PipeTransform[]): Promise<any>;
transformToResult(resultOrDeferred: any): Promise<any>;
createGuardsFn<TContext extends string = ContextType>(guards: any[], instance: Controller, callback: (...args: any[]) => any, contextType?: TContext): Function | null;
registerRequestProvider<T = any>(request: T, contextId: ContextId): void;
}

View File

@@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExternalContextCreator = void 0;
const common_1 = require("@nestjs/common");
const constants_1 = require("@nestjs/common/constants");
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
const rxjs_1 = require("rxjs");
const external_exception_filter_context_1 = require("../exceptions/external-exception-filter-context");
const constants_2 = require("../guards/constants");
const guards_1 = require("../guards");
const constants_3 = require("../injector/constants");
const interceptors_1 = require("../interceptors");
const pipes_1 = require("../pipes");
const context_utils_1 = require("./context-utils");
const external_proxy_1 = require("./external-proxy");
const handler_metadata_storage_1 = require("./handler-metadata-storage");
class ExternalContextCreator {
constructor(guardsContextCreator, guardsConsumer, interceptorsContextCreator, interceptorsConsumer, modulesContainer, pipesContextCreator, pipesConsumer, filtersContextCreator) {
this.guardsContextCreator = guardsContextCreator;
this.guardsConsumer = guardsConsumer;
this.interceptorsContextCreator = interceptorsContextCreator;
this.interceptorsConsumer = interceptorsConsumer;
this.modulesContainer = modulesContainer;
this.pipesContextCreator = pipesContextCreator;
this.pipesConsumer = pipesConsumer;
this.filtersContextCreator = filtersContextCreator;
this.contextUtils = new context_utils_1.ContextUtils();
this.externalErrorProxy = new external_proxy_1.ExternalErrorProxy();
this.handlerMetadataStorage = new handler_metadata_storage_1.HandlerMetadataStorage();
}
static fromContainer(container) {
const guardsContextCreator = new guards_1.GuardsContextCreator(container, container.applicationConfig);
const guardsConsumer = new guards_1.GuardsConsumer();
const interceptorsContextCreator = new interceptors_1.InterceptorsContextCreator(container, container.applicationConfig);
const interceptorsConsumer = new interceptors_1.InterceptorsConsumer();
const pipesContextCreator = new pipes_1.PipesContextCreator(container, container.applicationConfig);
const pipesConsumer = new pipes_1.PipesConsumer();
const filtersContextCreator = new external_exception_filter_context_1.ExternalExceptionFilterContext(container, container.applicationConfig);
const externalContextCreator = new ExternalContextCreator(guardsContextCreator, guardsConsumer, interceptorsContextCreator, interceptorsConsumer, container.getModules(), pipesContextCreator, pipesConsumer, filtersContextCreator);
externalContextCreator.container = container;
return externalContextCreator;
}
create(instance, callback, methodName, metadataKey, paramsFactory, contextId = constants_3.STATIC_CONTEXT, inquirerId, options = {
interceptors: true,
guards: true,
filters: true,
}, contextType = 'http') {
const module = this.getContextModuleKey(instance.constructor);
const { argsLength, paramtypes, getParamsMetadata } = this.getMetadata(instance, methodName, metadataKey, paramsFactory, contextType);
const pipes = this.pipesContextCreator.create(instance, callback, module, contextId, inquirerId);
const guards = this.guardsContextCreator.create(instance, callback, module, contextId, inquirerId);
const exceptionFilter = this.filtersContextCreator.create(instance, callback, module, contextId, inquirerId);
const interceptors = options.interceptors
? this.interceptorsContextCreator.create(instance, callback, module, contextId, inquirerId)
: [];
const paramsMetadata = getParamsMetadata(module, contextId, inquirerId);
const paramsOptions = paramsMetadata
? this.contextUtils.mergeParamsMetatypes(paramsMetadata, paramtypes)
: [];
const fnCanActivate = options.guards
? this.createGuardsFn(guards, instance, callback, contextType)
: null;
const fnApplyPipes = this.createPipesFn(pipes, paramsOptions);
const handler = (initialArgs, ...args) => async () => {
if (fnApplyPipes) {
await fnApplyPipes(initialArgs, ...args);
return callback.apply(instance, initialArgs);
}
return callback.apply(instance, args);
};
const target = async (...args) => {
const initialArgs = this.contextUtils.createNullArray(argsLength);
fnCanActivate && (await fnCanActivate(args));
const result = await this.interceptorsConsumer.intercept(interceptors, args, instance, callback, handler(initialArgs, ...args), contextType);
return this.transformToResult(result);
};
return options.filters
? this.externalErrorProxy.createProxy(target, exceptionFilter, contextType)
: target;
}
getMetadata(instance, methodName, metadataKey, paramsFactory, contextType) {
const cacheMetadata = this.handlerMetadataStorage.get(instance, methodName);
if (cacheMetadata) {
return cacheMetadata;
}
const metadata = this.contextUtils.reflectCallbackMetadata(instance, methodName, metadataKey || '') || {};
const keys = Object.keys(metadata);
const argsLength = this.contextUtils.getArgumentsLength(keys, metadata);
const paramtypes = this.contextUtils.reflectCallbackParamtypes(instance, methodName);
const contextFactory = this.contextUtils.getContextFactory(contextType, instance, instance[methodName]);
const getParamsMetadata = (moduleKey, contextId = constants_3.STATIC_CONTEXT, inquirerId) => paramsFactory
? this.exchangeKeysForValues(keys, metadata, moduleKey, paramsFactory, contextId, inquirerId, contextFactory)
: null;
const handlerMetadata = {
argsLength,
paramtypes,
getParamsMetadata,
};
this.handlerMetadataStorage.set(instance, methodName, handlerMetadata);
return handlerMetadata;
}
getContextModuleKey(moduleCtor) {
const emptyModuleKey = '';
if (!moduleCtor) {
return emptyModuleKey;
}
const moduleContainerEntries = this.modulesContainer.entries();
for (const [key, moduleRef] of moduleContainerEntries) {
if (moduleRef.hasProvider(moduleCtor)) {
return key;
}
}
return emptyModuleKey;
}
exchangeKeysForValues(keys, metadata, moduleContext, paramsFactory, contextId = constants_3.STATIC_CONTEXT, inquirerId, contextFactory = this.contextUtils.getContextFactory('http')) {
this.pipesContextCreator.setModuleContext(moduleContext);
return keys.map(key => {
const { index, data, pipes: pipesCollection } = metadata[key];
const pipes = this.pipesContextCreator.createConcreteContext(pipesCollection, contextId, inquirerId);
const type = this.contextUtils.mapParamType(key);
if (key.includes(constants_1.CUSTOM_ROUTE_ARGS_METADATA)) {
const { factory } = metadata[key];
const customExtractValue = this.contextUtils.getCustomFactory(factory, data, contextFactory);
return { index, extractValue: customExtractValue, type, data, pipes };
}
const numericType = Number(type);
const extractValue = (...args) => paramsFactory.exchangeKeyForValue(numericType, data, args);
return { index, extractValue, type: numericType, data, pipes };
});
}
createPipesFn(pipes, paramsOptions) {
const pipesFn = async (args, ...params) => {
const resolveParamValue = async (param) => {
const { index, extractValue, type, data, metatype, pipes: paramPipes, } = param;
const value = extractValue(...params);
args[index] = await this.getParamValue(value, { metatype, type, data }, pipes.concat(paramPipes));
};
await Promise.all(paramsOptions.map(resolveParamValue));
};
return paramsOptions.length ? pipesFn : null;
}
async getParamValue(value, { metatype, type, data }, pipes) {
return (0, shared_utils_1.isEmpty)(pipes)
? value
: this.pipesConsumer.apply(value, { metatype, type, data }, pipes);
}
async transformToResult(resultOrDeferred) {
if ((0, rxjs_1.isObservable)(resultOrDeferred)) {
return (0, rxjs_1.lastValueFrom)(resultOrDeferred);
}
return resultOrDeferred;
}
createGuardsFn(guards, instance, callback, contextType) {
const canActivateFn = async (args) => {
const canActivate = await this.guardsConsumer.tryActivate(guards, args, instance, callback, contextType);
if (!canActivate) {
throw new common_1.ForbiddenException(constants_2.FORBIDDEN_MESSAGE);
}
};
return guards.length ? canActivateFn : null;
}
registerRequestProvider(request, contextId) {
this.container.registerRequestProvider(request, contextId);
}
}
exports.ExternalContextCreator = ExternalContextCreator;

View File

@@ -0,0 +1,5 @@
import { ContextType } from '@nestjs/common/interfaces';
import { ExternalExceptionsHandler } from '../exceptions/external-exceptions-handler';
export declare class ExternalErrorProxy {
createProxy<TContext extends string = ContextType>(targetCallback: (...args: any[]) => any, exceptionsHandler: ExternalExceptionsHandler, type?: TContext): (...args: any[]) => Promise<any>;
}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExternalErrorProxy = void 0;
const execution_context_host_1 = require("../helpers/execution-context-host");
class ExternalErrorProxy {
createProxy(targetCallback, exceptionsHandler, type) {
return async (...args) => {
try {
return await targetCallback(...args);
}
catch (e) {
const host = new execution_context_host_1.ExecutionContextHost(args);
host.setType(type);
return exceptionsHandler.next(e, host);
}
};
}
}
exports.ExternalErrorProxy = ExternalErrorProxy;

View File

@@ -0,0 +1,3 @@
import { Scope } from '@nestjs/common';
import { Type } from '@nestjs/common/interfaces/type.interface';
export declare function getClassScope(provider: Type<unknown>): Scope;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClassScope = getClassScope;
const constants_1 = require("@nestjs/common/constants");
function getClassScope(provider) {
const metadata = Reflect.getMetadata(constants_1.SCOPE_OPTIONS_METADATA, provider);
return metadata && metadata.scope;
}

View File

@@ -0,0 +1,27 @@
import { Type } from '@nestjs/common/interfaces';
import { IncomingMessage } from 'http';
import { Observable } from 'rxjs';
import { ContextId } from '../injector/instance-wrapper';
import { HeaderStream } from '../router/sse-stream';
import { ParamProperties } from './context-utils';
export declare const HANDLER_METADATA_SYMBOL: unique symbol;
export type HandleResponseFn = HandlerResponseBasicFn | HandleSseResponseFn;
export type HandlerResponseBasicFn = <TResult, TResponse>(result: TResult, res: TResponse, req?: any) => any;
export type HandleSseResponseFn = <TResult extends Observable<unknown> = any, TResponse extends HeaderStream = any, TRequest extends IncomingMessage = any>(result: TResult, res: TResponse, req: TRequest) => any;
export interface HandlerMetadata {
argsLength: number;
paramtypes: any[];
httpStatusCode: number;
responseHeaders: any[];
hasCustomHeaders: boolean;
getParamsMetadata: (moduleKey: string, contextId?: ContextId, inquirerId?: string) => (ParamProperties & {
metatype?: any;
})[];
fnHandleResponse: HandleResponseFn;
}
export declare class HandlerMetadataStorage<TValue = HandlerMetadata, TKey extends Type<unknown> = any> {
private readonly [HANDLER_METADATA_SYMBOL];
set(controller: TKey, methodName: string, metadata: TValue): void;
get(controller: TKey, methodName: string): TValue | undefined;
private getMetadataKey;
}

View File

@@ -0,0 +1,26 @@
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HandlerMetadataStorage = exports.HANDLER_METADATA_SYMBOL = void 0;
const constants_1 = require("../injector/constants");
exports.HANDLER_METADATA_SYMBOL = Symbol.for('handler_metadata:cache');
class HandlerMetadataStorage {
constructor() {
this[_a] = new Map();
}
set(controller, methodName, metadata) {
const metadataKey = this.getMetadataKey(controller, methodName);
this[exports.HANDLER_METADATA_SYMBOL].set(metadataKey, metadata);
}
get(controller, methodName) {
const metadataKey = this.getMetadataKey(controller, methodName);
return this[exports.HANDLER_METADATA_SYMBOL].get(metadataKey);
}
getMetadataKey(controller, methodName) {
const ctor = controller.constructor;
const controllerKey = ctor && (ctor[constants_1.CONTROLLER_ID_KEY] || ctor.name);
return controllerKey + methodName;
}
}
exports.HandlerMetadataStorage = HandlerMetadataStorage;
_a = exports.HANDLER_METADATA_SYMBOL;

View File

@@ -0,0 +1,45 @@
import { Observable } from 'rxjs';
import { AbstractHttpAdapter } from '../adapters/http-adapter';
/**
* Defines the `HttpAdapterHost` object.
*
* `HttpAdapterHost` wraps the underlying
* platform-specific `HttpAdapter`. The `HttpAdapter` is a wrapper around the underlying
* native HTTP server library (e.g., Express). The `HttpAdapterHost` object
* provides methods to `get` and `set` the underlying HttpAdapter.
*
* @see [Http adapter](https://docs.nestjs.com/faq/http-adapter)
*
* @publicApi
*/
export declare class HttpAdapterHost<T extends AbstractHttpAdapter = AbstractHttpAdapter> {
private _httpAdapter?;
private _listen$;
private isListening;
/**
* Accessor for the underlying `HttpAdapter`
*
* @param httpAdapter reference to the `HttpAdapter` to be set
*/
set httpAdapter(httpAdapter: T);
/**
* Accessor for the underlying `HttpAdapter`
*
* @example
* `const httpAdapter = adapterHost.httpAdapter;`
*/
get httpAdapter(): T;
/**
* Observable that allows to subscribe to the `listen` event.
* This event is emitted when the HTTP application is listening for incoming requests.
*/
get listen$(): Observable<void>;
/**
* Sets the listening state of the application.
*/
set listening(listening: boolean);
/**
* Returns a boolean indicating whether the application is listening for incoming requests.
*/
get listening(): boolean;
}

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpAdapterHost = void 0;
const rxjs_1 = require("rxjs");
/**
* Defines the `HttpAdapterHost` object.
*
* `HttpAdapterHost` wraps the underlying
* platform-specific `HttpAdapter`. The `HttpAdapter` is a wrapper around the underlying
* native HTTP server library (e.g., Express). The `HttpAdapterHost` object
* provides methods to `get` and `set` the underlying HttpAdapter.
*
* @see [Http adapter](https://docs.nestjs.com/faq/http-adapter)
*
* @publicApi
*/
class HttpAdapterHost {
constructor() {
this._listen$ = new rxjs_1.Subject();
this.isListening = false;
}
/**
* Accessor for the underlying `HttpAdapter`
*
* @param httpAdapter reference to the `HttpAdapter` to be set
*/
set httpAdapter(httpAdapter) {
this._httpAdapter = httpAdapter;
}
/**
* Accessor for the underlying `HttpAdapter`
*
* @example
* `const httpAdapter = adapterHost.httpAdapter;`
*/
get httpAdapter() {
return this._httpAdapter;
}
/**
* Observable that allows to subscribe to the `listen` event.
* This event is emitted when the HTTP application is listening for incoming requests.
*/
get listen$() {
return this._listen$.asObservable();
}
/**
* Sets the listening state of the application.
*/
set listening(listening) {
this.isListening = listening;
if (listening) {
this._listen$.next();
this._listen$.complete();
}
}
/**
* Returns a boolean indicating whether the application is listening for incoming requests.
*/
get listening() {
return this.isListening;
}
}
exports.HttpAdapterHost = HttpAdapterHost;

3
backend/node_modules/@nestjs/core/helpers/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from './context-id-factory';
export * from './external-context-creator';
export * from './http-adapter-host';

6
backend/node_modules/@nestjs/core/helpers/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./context-id-factory"), exports);
tslib_1.__exportStar(require("./external-context-creator"), exports);
tslib_1.__exportStar(require("./http-adapter-host"), exports);

View File

@@ -0,0 +1,11 @@
import { ContextId } from '../../injector';
import { ParamProperties } from '../context-utils';
type ParamPropertiesWithMetatype<T = any> = ParamProperties & {
metatype?: T;
};
export interface ExternalHandlerMetadata {
argsLength: number;
paramtypes: any[];
getParamsMetadata: (moduleKey: string, contextId?: ContextId, inquirerId?: string) => ParamPropertiesWithMetatype[];
}
export {};

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
export * from './external-handler-metadata.interface';
export * from './params-metadata.interface';

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./external-handler-metadata.interface"), exports);
tslib_1.__exportStar(require("./params-metadata.interface"), exports);

View File

@@ -0,0 +1,6 @@
import { ParamData } from '@nestjs/common';
export type ParamsMetadata = Record<number, ParamMetadata>;
export interface ParamMetadata {
index: number;
data?: ParamData;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
import { Type } from '@nestjs/common/interfaces/type.interface';
export declare function isDurable(provider: Type<unknown>): boolean | undefined;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDurable = isDurable;
const constants_1 = require("@nestjs/common/constants");
function isDurable(provider) {
const metadata = Reflect.getMetadata(constants_1.SCOPE_OPTIONS_METADATA, provider);
return metadata && metadata.durable;
}

View File

@@ -0,0 +1 @@
export declare function loadAdapter(defaultPlatform: string, transport: string, loaderFn?: Function): any;

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadAdapter = loadAdapter;
const common_1 = require("@nestjs/common");
const MISSING_REQUIRED_DEPENDENCY = (defaultPlatform, transport) => `No driver (${transport}) has been selected. In order to take advantage of the default driver, please, ensure to install the "${defaultPlatform}" package ($ npm install ${defaultPlatform}).`;
const logger = new common_1.Logger('PackageLoader');
function loadAdapter(defaultPlatform, transport, loaderFn) {
try {
return loaderFn ? loaderFn() : require(defaultPlatform);
}
catch (e) {
logger.error(MISSING_REQUIRED_DEPENDENCY(defaultPlatform, transport));
process.exit(1);
}
}

View File

@@ -0,0 +1,7 @@
import { VersionValue } from '@nestjs/common/interfaces/version-options.interface';
export declare const MODULE_INIT_MESSAGE: (text: TemplateStringsArray, module: string) => string;
export declare const ROUTE_MAPPED_MESSAGE: (path: string, method: string | number) => string;
export declare const VERSIONED_ROUTE_MAPPED_MESSAGE: (path: string, method: string | number, version: VersionValue) => string;
export declare const CONTROLLER_MAPPING_MESSAGE: (name: string, path: string) => string;
export declare const VERSIONED_CONTROLLER_MAPPING_MESSAGE: (name: string, path: string, version: VersionValue) => string;
export declare const INVALID_EXECUTION_CONTEXT: (methodName: string, currentContext: string) => string;

29
backend/node_modules/@nestjs/core/helpers/messages.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.INVALID_EXECUTION_CONTEXT = exports.VERSIONED_CONTROLLER_MAPPING_MESSAGE = exports.CONTROLLER_MAPPING_MESSAGE = exports.VERSIONED_ROUTE_MAPPED_MESSAGE = exports.ROUTE_MAPPED_MESSAGE = exports.MODULE_INIT_MESSAGE = void 0;
const request_method_enum_1 = require("@nestjs/common/enums/request-method.enum");
const version_options_interface_1 = require("@nestjs/common/interfaces/version-options.interface");
const MODULE_INIT_MESSAGE = (text, module) => `${module} dependencies initialized`;
exports.MODULE_INIT_MESSAGE = MODULE_INIT_MESSAGE;
const ROUTE_MAPPED_MESSAGE = (path, method) => `Mapped {${path}, ${request_method_enum_1.RequestMethod[method]}} route`;
exports.ROUTE_MAPPED_MESSAGE = ROUTE_MAPPED_MESSAGE;
const VERSIONED_ROUTE_MAPPED_MESSAGE = (path, method, version) => {
const controllerVersions = Array.isArray(version) ? version : [version];
const versions = controllerVersions
.map(version => (version === version_options_interface_1.VERSION_NEUTRAL ? 'Neutral' : version))
.join(',');
return `Mapped {${path}, ${request_method_enum_1.RequestMethod[method]}} (version: ${versions}) route`;
};
exports.VERSIONED_ROUTE_MAPPED_MESSAGE = VERSIONED_ROUTE_MAPPED_MESSAGE;
const CONTROLLER_MAPPING_MESSAGE = (name, path) => `${name} {${path}}:`;
exports.CONTROLLER_MAPPING_MESSAGE = CONTROLLER_MAPPING_MESSAGE;
const VERSIONED_CONTROLLER_MAPPING_MESSAGE = (name, path, version) => {
const controllerVersions = Array.isArray(version) ? version : [version];
const versions = controllerVersions
.map(version => (version === version_options_interface_1.VERSION_NEUTRAL ? 'Neutral' : version))
.join(',');
return `${name} {${path}} (version: ${versions}):`;
};
exports.VERSIONED_CONTROLLER_MAPPING_MESSAGE = VERSIONED_CONTROLLER_MAPPING_MESSAGE;
const INVALID_EXECUTION_CONTEXT = (methodName, currentContext) => `Calling ${methodName} is not allowed in this context. Your current execution context is "${currentContext}".`;
exports.INVALID_EXECUTION_CONTEXT = INVALID_EXECUTION_CONTEXT;

View File

@@ -0,0 +1 @@
export declare function optionalRequire(packageName: string, loaderFn?: Function): any;

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.optionalRequire = optionalRequire;
function optionalRequire(packageName, loaderFn) {
try {
return loaderFn ? loaderFn() : require(packageName);
}
catch (e) {
return {};
}
}

View File

@@ -0,0 +1 @@
export declare const rethrow: (err: unknown) => never;

7
backend/node_modules/@nestjs/core/helpers/rethrow.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rethrow = void 0;
const rethrow = (err) => {
throw err;
};
exports.rethrow = rethrow;

View File

@@ -0,0 +1,5 @@
import { HttpServer } from '@nestjs/common';
import { RequestMethod } from '@nestjs/common/enums/request-method.enum';
export declare class RouterMethodFactory {
get(target: HttpServer, requestMethod: RequestMethod): Function;
}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouterMethodFactory = void 0;
const request_method_enum_1 = require("@nestjs/common/enums/request-method.enum");
const REQUEST_METHOD_MAP = {
[request_method_enum_1.RequestMethod.GET]: 'get',
[request_method_enum_1.RequestMethod.POST]: 'post',
[request_method_enum_1.RequestMethod.PUT]: 'put',
[request_method_enum_1.RequestMethod.DELETE]: 'delete',
[request_method_enum_1.RequestMethod.PATCH]: 'patch',
[request_method_enum_1.RequestMethod.ALL]: 'all',
[request_method_enum_1.RequestMethod.OPTIONS]: 'options',
[request_method_enum_1.RequestMethod.HEAD]: 'head',
[request_method_enum_1.RequestMethod.SEARCH]: 'search',
};
class RouterMethodFactory {
get(target, requestMethod) {
const methodName = REQUEST_METHOD_MAP[requestMethod];
const method = target[methodName];
if (!method) {
return target.use;
}
return method;
}
}
exports.RouterMethodFactory = RouterMethodFactory;