New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nestjs-plugins/nestjs-nats-streaming-transport

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs-plugins/nestjs-nats-streaming-transport - npm Package Compare versions

Comparing version 1.0.15 to 1.0.16

CHANGELOG

10

dist/interfaces/index.d.ts

@@ -0,1 +1,2 @@

import { ModuleMetadata } from '@nestjs/common/interfaces';
import { StanOptions, StartPosition } from 'node-nats-streaming';

@@ -14,1 +15,10 @@ export declare type TransportConnectOptions = StanOptions;

}
export interface NatsStreamingPublishOptions {
clusterId: string;
clientId: string;
connectOptions: TransportConnectOptions;
}
export interface NatsStreamingPublishAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useFactory: (...args: any[]) => Promise<NatsStreamingPublishOptions> | NatsStreamingPublishOptions;
inject?: any[];
}

6

dist/listener.d.ts
import { CustomTransportStrategy, Server, Transport } from '@nestjs/microservices';
import { TransportConnectOptions, TransportSubscriptionOptions } from './interfaces';
export declare class Listener extends Server implements CustomTransportStrategy {
private clusterID;
private clientID;
private clusterId;
private clientId;
private queueGroup;

@@ -11,3 +11,3 @@ private connectOptions;

private connection;
constructor(clusterID: string, clientID: string, queueGroup: string, connectOptions: TransportConnectOptions, subscriptionOptions: TransportSubscriptionOptions);
constructor(clusterId: string, clientId: string, queueGroup: string, connectOptions: TransportConnectOptions, subscriptionOptions: TransportSubscriptionOptions);
listen(callback: () => void): Promise<void>;

@@ -14,0 +14,0 @@ close(): void;

@@ -10,6 +10,6 @@ "use strict";

class Listener extends microservices_1.Server {
constructor(clusterID, clientID, queueGroup, connectOptions, subscriptionOptions) {
constructor(clusterId, clientId, queueGroup, connectOptions, subscriptionOptions) {
super();
this.clusterID = clusterID;
this.clientID = clientID;
this.clusterId = clusterId;
this.clientId = clientId;
this.queueGroup = queueGroup;

@@ -21,3 +21,3 @@ this.connectOptions = connectOptions;

this.logger.log('Setting up event listeners...');
this.connection = await create_stan_connection_1.createConnection(this.clusterID, this.clientID, this.connectOptions);
this.connection = await create_stan_connection_1.createConnection(this.clusterId, this.clientId, this.connectOptions);
this.bindEventHandlers();

@@ -34,3 +34,3 @@ callback();

}
registerdPatterns.forEach(subject => {
registerdPatterns.forEach((subject) => {
const options = build_subscription_options_1.buildSubscriptionOptions(this.subscriptionOptions, this.connection);

@@ -37,0 +37,0 @@ const subscription = this.connection.subscribe(subject, this.queueGroup, options);

@@ -1,5 +0,7 @@

import { DynamicModule } from "@nestjs/common";
import { TransportConnectOptions } from "./interfaces";
import { DynamicModule } from '@nestjs/common';
import { NatsStreamingPublishAsyncOptions, NatsStreamingPublishOptions, TransportConnectOptions } from './interfaces';
export declare class NatsStreamingTransport {
static forRoot(clusterID: string, clientID: string, connectOptions: TransportConnectOptions): DynamicModule;
static forRoot(clusterId: string, clientId: string, connectOptions: TransportConnectOptions): DynamicModule;
static register(options: NatsStreamingPublishOptions): DynamicModule;
static registerAsync(options: NatsStreamingPublishAsyncOptions): DynamicModule;
}

@@ -12,10 +12,16 @@ "use strict";

const common_1 = require("@nestjs/common");
const constants_1 = require("./constants");
const publisher_1 = require("./publisher");
let NatsStreamingTransport = NatsStreamingTransport_1 = class NatsStreamingTransport {
static forRoot(clusterID, clientID, connectOptions) {
static forRoot(clusterId, clientId, connectOptions) {
console.log('WARNING: forRoot is depreciated! Use register or registerAsync instead! This will be removed in next version');
return this.register({ clusterId, clientId, connectOptions });
}
static register(options) {
const providers = [
{
provide: publisher_1.Publisher,
useValue: new publisher_1.Publisher(clusterID, clientID, connectOptions),
provide: constants_1.NATS_STREAMING_OPTIONS,
useValue: options,
},
publisher_1.Publisher,
];

@@ -28,2 +34,16 @@ return {

}
static registerAsync(options) {
return {
module: NatsStreamingTransport_1,
imports: options.imports,
providers: [
{
provide: constants_1.NATS_STREAMING_OPTIONS,
useFactory: options.useFactory,
inject: options.inject || [],
},
publisher_1.Publisher,
],
};
}
};

@@ -30,0 +50,0 @@ NatsStreamingTransport = NatsStreamingTransport_1 = __decorate([

import { ClientProxy, ReadPacket, WritePacket } from "@nestjs/microservices";
import { TransportConnectOptions } from "./interfaces";
import { NatsStreamingPublishOptions } from "./interfaces";
import { Stan } from "node-nats-streaming";
export declare class Publisher extends ClientProxy {
private clusterID;
private clientID;
private connectOptions;
private options;
private logger;
private connection;
constructor(clusterID: string, clientID: string, connectOptions: TransportConnectOptions);
constructor(options: NatsStreamingPublishOptions);
onApplicationBootstrap(): Promise<void>;

@@ -12,0 +10,0 @@ connect(): Promise<Stan>;

@@ -11,2 +11,5 @@ "use strict";

};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -17,12 +20,12 @@ exports.Publisher = void 0;

const create_stan_connection_1 = require("./utils/create-stan-connection");
const constants_1 = require("./constants");
let Publisher = class Publisher extends microservices_1.ClientProxy {
constructor(clusterID, clientID, connectOptions) {
constructor(options) {
super();
this.clusterID = clusterID;
this.clientID = clientID;
this.connectOptions = connectOptions;
this.options = options;
console.log(options);
this.logger = new common_1.Logger(this.constructor.name);
}
async onApplicationBootstrap() {
this.connection = await create_stan_connection_1.createConnection(this.clusterID, this.clientID, this.connectOptions);
this.connection = await create_stan_connection_1.createConnection(this.options.clusterId, this.options.clientId, this.options.connectOptions);
this.logger.log("Publisher - Connected early to nats.");

@@ -34,3 +37,3 @@ }

}
this.connection = await create_stan_connection_1.createConnection(this.clusterID, this.clientID, this.connectOptions);
this.connection = await create_stan_connection_1.createConnection(this.options.clusterId, this.options.clientId, this.options.connectOptions);
this.logger.log("Publisher - Connected to nats.");

@@ -66,5 +69,6 @@ }

common_1.Injectable(),
__metadata("design:paramtypes", [String, String, Object])
__param(0, common_1.Inject(constants_1.NATS_STREAMING_OPTIONS)),
__metadata("design:paramtypes", [Object])
], Publisher);
exports.Publisher = Publisher;
//# sourceMappingURL=publisher.js.map
{
"name": "@nestjs-plugins/nestjs-nats-streaming-transport",
"version": "1.0.15",
"version": "1.0.16",
"description": "Nats Streaming Transport for NestJS",

@@ -41,3 +41,3 @@ "main": "dist/index.js",

"@nestjs/core": "^7.2.0",
"@nestjs/microservices": "^7.2.0",
"@nestjs/microservices": "^7.4.4",
"@types/node": "^14.0.14",

@@ -44,0 +44,0 @@ "rimraf": "^3.0.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc