
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
@knawat/advanced-client-module
Advanced tools
First import the package:
import { AdvancedClientModule } from "@knawat/advanced-client-module";
AdvancedClientModule.register({
transport: 'TCP',
options: {
url: 'http://localhost:8080',
},
}),
Replace all MessagePattern
with MessagePatternExtended
and EventPattern
with EventPatternExtended
decorators to add NAMESPACE in calls.
Now for replacing the new Extended
decorators with valid replacement and because we can not alter Reflect.metaData over the Controller class from the npm package we have to do it manually.
First you need to create a service
to process decorators like this:
import { Injectable } from '@nestjs/common';
import { EventPattern, MessagePattern } from '@nestjs/microservices';
import {
EVENT_PATTERN_EXTENDED,
MESSAGE_PATTERN_EXTENDED,
} from '@knawat/advanced-client-module';
@Injectable()
export class AdvancedClientDecoratorProcessorService {
processCustomDecorators(namespace: string, types: any[]) {
for (const type of types) {
const propNames = Object.getOwnPropertyNames(type.prototype);
for (const prop of propNames) {
const propValue = Reflect.getMetadata(
MESSAGE_PATTERN_EXTENDED,
Reflect.get(type.prototype, prop),
);
if (propValue) {
propValue.cmd = `${namespace}-${propValue.cmd}`;
propValue.role = `${namespace}-${propValue.role}`;
Reflect.decorate(
[MessagePattern(propValue)],
type.prototype,
prop,
Reflect.getOwnPropertyDescriptor(type.prototype, prop),
);
}
let eventValue = Reflect.getMetadata(
EVENT_PATTERN_EXTENDED,
Reflect.get(type.prototype, prop),
);
if (eventValue) {
eventValue = `${namespace}-${eventValue}`;
Reflect.decorate(
[EventPattern(eventValue)],
type.prototype,
prop,
Reflect.getOwnPropertyDescriptor(type.prototype, prop),
);
}
}
}
}
}
Now add the processor to the main.ts
as below:
app
.get(AdvancedClientDecoratorProcessorService)
.processCustomDecorators(process.env.NAMESPACE, [...CONTROLLERS-WITH-EXTENDED-DECORATORS]);
In order to use microservice client you need to inject the SERVICE_CLIENT
class:
constructor(
@Inject(SERVICE_CLIENT)
private readonly client: ClientProxy,
) {}
FAQs
This is a Client Proxy providing module.
The npm package @knawat/advanced-client-module receives a total of 1 weekly downloads. As such, @knawat/advanced-client-module popularity was classified as not popular.
We found that @knawat/advanced-client-module demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.