Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
@Inject(ModulesContainer) private readonly modulesContainer: ModulesContainer,
@InjectRepository(Resource) private readonly resourceRepo: Repository,
@InjectRepository(Permission) private readonly permissionRepo: Repository,
) {
this.metadataScanner = new MetadataScanner();
}
constructor(clientsContainer, contextCreator) {
this.clientsContainer = clientsContainer;
this.contextCreator = contextCreator;
this.metadataExplorer = new listener_metadata_explorer_1.ListenerMetadataExplorer(new metadata_scanner_1.MetadataScanner());
}
bindPatternHandlers(instance, server, module) {
constructor(userService, modulesContainer, systemModuleRepo, resourceRepo, permissionRepo, roleRepo, infoGroupRepo, userRepo) {
this.userService = userService;
this.modulesContainer = modulesContainer;
this.systemModuleRepo = systemModuleRepo;
this.resourceRepo = resourceRepo;
this.permissionRepo = permissionRepo;
this.roleRepo = roleRepo;
this.infoGroupRepo = infoGroupRepo;
this.userRepo = userRepo;
this.metadataScanner = new metadata_scanner_1.MetadataScanner();
}
static forRoot(options) {
public scanAndRegisterHandlers(): void {
const metadataScanner = new MetadataScanner();
const modules = [...this.modulesContainer.values()];
modules.forEach(({ metatype }) => {
const metadata = Reflect.getMetadata(nestMetadata.COMPONENTS, metatype) || [];
const providers = [...metadata.filter((metatype: any) => typeof metatype === 'function')];
providers.map(provider => {
metadataScanner.scanFromPrototype(null, provider.prototype, methodName => {
const intentOrAction =
Reflect.getMetadata(
DIALOG_FLOW_INTENT,
Reflect.getOwnPropertyDescriptor(provider.prototype, methodName).value,
) ||
Reflect.getMetadata(
DIALOG_FLOW_ACTION,
Reflect.getOwnPropertyDescriptor(provider.prototype, methodName).value,
providers.map(provider => {
if (Reflect.getOwnMetadata(BRAINTREE_WEBHOOK_PROVIDER, provider)) {
const realProvider = this.moduleRef.get(provider, {strict: false});
this.braintreeWebhookProvider.addProvider(realProvider);
const metadataScanner = new MetadataScanner();
metadataScanner.scanFromPrototype(null, provider['prototype'], method => {
const descriptor = Reflect.getOwnPropertyDescriptor(
provider['prototype'],
method,
);
const hook = Reflect.getMetadata(BRAINTREE_WEBHOOK_METHOD, descriptor.value);
if (hook) {
this.braintreeWebhookProvider.addMethod(hook, method, realProvider.constructor.name);
}
});
}
});
import 'reflect-metadata';
import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface';
import { ListenerMetadataExplorer } from './listener-metadata-explorer';
import { Server } from './server/server';
import { ClientProxyFactory } from './client/client-proxy-factory';
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
import { CustomTransportStrategy } from './interfaces';
import { ClientsContainer } from './container';
import { RpcContextCreator } from './context/rpc-context-creator';
export class ListenersController {
private readonly metadataExplorer = new ListenerMetadataExplorer(new MetadataScanner());
constructor(
private readonly clientsContainer: ClientsContainer,
private readonly contextCreator: RpcContextCreator) {}
public bindPatternHandlers(instance: Controller, server: Server & CustomTransportStrategy, module: string) {
const patternHandlers = this.metadataExplorer.explore(instance);
patternHandlers.forEach(({ pattern, targetCallback }) => {
const proxy = this.contextCreator.create(instance, targetCallback, module);
server.add(pattern, proxy);
});
}
public bindClientsToProperties(instance: Controller) {
for (const { property, metadata } of this.metadataExplorer.scanForClientHooks(instance)) {
const client = ClientProxyFactory.create(metadata);
constructor(socketServerProvider, container, config, contextCreator) {
this.socketServerProvider = socketServerProvider;
this.container = container;
this.config = config;
this.contextCreator = contextCreator;
this.metadataExplorer = new gateway_metadata_explorer_1.GatewayMetadataExplorer(new metadata_scanner_1.MetadataScanner());
this.middlewareInjector = new middleware_injector_1.MiddlewareInjector(container, config);
}
hookGatewayIntoServer(instance, metatype, module) {
InvalidSocketPortException
} from './exceptions/invalid-socket-port.exception';
import {
GatewayMetadataExplorer,
MessageMappingProperties
} from './gateway-metadata-explorer';
import {NestGateway} from './interfaces/nest-gateway.interface';
import {
ObservableSocketServer
} from './interfaces/observable-socket-server.interface';
import {MiddlewaresInjector} from './middlewares-injector';
import {SocketServerProvider} from './socket-server-provider';
export class WebSocketsController {
private readonly metadataExplorer =
new GatewayMetadataExplorer(new MetadataScanner());
private readonly middlewaresInjector: MiddlewaresInjector;
constructor(
private readonly socketServerProvider: SocketServerProvider,
private readonly container: NestContainer,
private readonly config: ApplicationConfig,
private readonly contextCreator: WsContextCreator,
) {
this.middlewaresInjector = new MiddlewaresInjector(container, config);
}
public hookGatewayIntoServer(instance: NestGateway,
metatype: Metatype, module: string) {
const namespace = Reflect.getMetadata(NAMESPACE_METADATA, metatype) || '';
const port = Reflect.getMetadata(PORT_METADATA, metatype) || 0;
constructor(clientsContainer, contextCreator) {
this.clientsContainer = clientsContainer;
this.contextCreator = contextCreator;
this.metadataExplorer = new listener_metadata_explorer_1.ListenerMetadataExplorer(new metadata_scanner_1.MetadataScanner());
}
bindPatternHandlers(instance, server, module) {
constructor(private readonly kueService: KueService) {
this.metadataExplorer = new TaskMetadataExplorer(
new MetadataScanner()
);
this.fancyLogger = new FancyLoggerService();
}