@nestjs-plugins/nestjs-nats-jetstream-transport
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -1,4 +0,4 @@ | ||
import { ClientProxy, ReadPacket, WritePacket } from "@nestjs/microservices"; | ||
import { NatsConnection } from "nats"; | ||
import { NatsJetStreamClientOptions } from "./interfaces/nats-jetstream-client-options.interface"; | ||
import { ClientProxy, ReadPacket, WritePacket } from '@nestjs/microservices'; | ||
import { NatsConnection } from 'nats'; | ||
import { NatsJetStreamClientOptions } from './interfaces/nats-jetstream-client-options.interface'; | ||
export declare class NatsJetStreamClientProxy extends ClientProxy { | ||
@@ -5,0 +5,0 @@ private options; |
@@ -29,3 +29,5 @@ "use strict"; | ||
this.nc = await (0, nats_1.connect)(this.options.connectionOptions); | ||
this.options.connectionOptions.connectedHook(this.nc); | ||
if (this.options.connectionOptions.connectedHook) { | ||
this.options.connectionOptions.connectedHook(this.nc); | ||
} | ||
} | ||
@@ -32,0 +34,0 @@ return this.nc; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NATS_JETSTREAM_OPTIONS = void 0; | ||
exports.NATS_JETSTREAM_OPTIONS = "NATS_JETSTREAM_OPTIONS"; | ||
exports.NATS_JETSTREAM_OPTIONS = 'NATS_JETSTREAM_OPTIONS'; | ||
//# sourceMappingURL=constants.js.map |
@@ -1,10 +0,10 @@ | ||
export * from "./server"; | ||
export * from "./client"; | ||
export * from "./nats-jetstream-transport.module"; | ||
export * from "./interfaces/nats-connection-options.interface"; | ||
export * from "./interfaces/nats-jetstream-client-options.interface"; | ||
export * from "./interfaces/nats-jetstream-server-options.interface"; | ||
export * from "./interfaces/server-consumer-options.interface"; | ||
export * from "./utils/server-consumer-options-builder"; | ||
export * from "./nats-jetstream.context"; | ||
export * from "./nats-jetstream-client"; | ||
export * from './server'; | ||
export * from './client'; | ||
export * from './nats-jetstream-transport.module'; | ||
export * from './interfaces/nats-connection-options.interface'; | ||
export * from './interfaces/nats-jetstream-client-options.interface'; | ||
export * from './interfaces/nats-jetstream-server-options.interface'; | ||
export * from './interfaces/server-consumer-options.interface'; | ||
export * from './utils/server-consumer-options-builder'; | ||
export * from './nats-jetstream.context'; | ||
export * from './nats-jetstream-client'; |
@@ -1,2 +0,2 @@ | ||
import { ConnectionOptions, NatsConnection } from "nats"; | ||
import { ConnectionOptions, NatsConnection } from 'nats'; | ||
export interface NatsConnectionOptions extends ConnectionOptions { | ||
@@ -3,0 +3,0 @@ name: string; |
@@ -1,12 +0,12 @@ | ||
import { ModuleMetadata } from "@nestjs/common"; | ||
import { ConnectionOptions, JetStreamOptions, JetStreamPublishOptions } from "nats"; | ||
import { NatsConnectionOptions } from "./nats-connection-options.interface"; | ||
import { ModuleMetadata } from '@nestjs/common'; | ||
import { ConnectionOptions, JetStreamOptions, JetStreamPublishOptions } from 'nats'; | ||
import { NatsConnectionOptions } from './nats-connection-options.interface'; | ||
export interface NatsJetStreamClientOptions { | ||
connectionOptions: Partial<NatsConnectionOptions> & Pick<ConnectionOptions, "name">; | ||
connectionOptions: Partial<NatsConnectionOptions> & Pick<ConnectionOptions, 'name'>; | ||
jetStreamOption?: JetStreamOptions; | ||
jetStreamPublishOptions?: JetStreamPublishOptions; | ||
} | ||
export interface NatsJetStreamClientAsyncOptions extends Pick<ModuleMetadata, "imports"> { | ||
export interface NatsJetStreamClientAsyncOptions extends Pick<ModuleMetadata, 'imports'> { | ||
useFactory: (...args: any[]) => Promise<NatsJetStreamClientOptions> | NatsJetStreamClientOptions; | ||
inject?: any[]; | ||
} |
@@ -1,7 +0,7 @@ | ||
import { JetStreamOptions } from "nats"; | ||
import { ServerConsumerOptions } from "./server-consumer-options.interface"; | ||
import { NatsConnectionOptions } from "./nats-connection-options.interface"; | ||
import { NatsStreamConfig } from "./nats-stream-config.interface"; | ||
import { JetStreamOptions } from 'nats'; | ||
import { ServerConsumerOptions } from './server-consumer-options.interface'; | ||
import { NatsConnectionOptions } from './nats-connection-options.interface'; | ||
import { NatsStreamConfig } from './nats-stream-config.interface'; | ||
export interface NatsJetStreamServerOptions { | ||
connectionOptions: Partial<NatsConnectionOptions> & Pick<NatsConnectionOptions, "name">; | ||
connectionOptions: Partial<NatsConnectionOptions> & Pick<NatsConnectionOptions, 'name'>; | ||
consumerOptions: Partial<ServerConsumerOptions>; | ||
@@ -8,0 +8,0 @@ jetStreamOptions?: JetStreamOptions; |
@@ -1,3 +0,3 @@ | ||
import { StreamConfig } from "nats"; | ||
declare type $StreamConfig = Pick<StreamConfig, "storage" | "retention" | "discard" | "max_msgs" | "max_msgs_per_subject" | "max_msg_size" | "max_age" | "duplicate_window" | "num_replicas">; | ||
import { StreamConfig } from 'nats'; | ||
declare type $StreamConfig = Pick<StreamConfig, 'storage' | 'retention' | 'discard' | 'max_msgs' | 'max_msgs_per_subject' | 'max_msg_size' | 'max_age' | 'duplicate_window' | 'num_replicas'>; | ||
export interface NatsStreamConfig extends Partial<$StreamConfig> { | ||
@@ -4,0 +4,0 @@ name: string; |
export interface ServerConsumerOptions { | ||
durable?: string; | ||
deliverPolicy?: "All" | "Last" | "New" | "ByStartSequence" | "ByStartTime" | "last_per_subject"; | ||
deliverPolicy?: 'All' | 'Last' | 'New' | 'ByStartSequence' | 'ByStartTime' | 'last_per_subject'; | ||
startSequence?: number; | ||
@@ -9,6 +9,6 @@ startAtTimeDelta?: number; | ||
deliverToSubject?: string; | ||
ackPolicy?: "Explicit" | "All" | "None"; | ||
ackPolicy?: 'Explicit' | 'All' | 'None'; | ||
ackWait?: number; | ||
maxAckPending?: number; | ||
replayPolicy?: "Instant" | "All" | "ByStartSequence" | "ByStartTime" | "Original"; | ||
replayPolicy?: 'Instant' | 'All' | 'ByStartSequence' | 'ByStartTime' | 'Original'; | ||
maxDeliver?: number; | ||
@@ -15,0 +15,0 @@ filterSubject?: string; |
@@ -1,4 +0,4 @@ | ||
import { NatsConnection, PubAck } from "nats"; | ||
import { Observable } from "rxjs"; | ||
import { NatsJetStreamClientProxy } from "./client"; | ||
import { NatsConnection, PubAck } from 'nats'; | ||
import { Observable } from 'rxjs'; | ||
import { NatsJetStreamClientProxy } from './client'; | ||
export declare class NatsJetStreamClient { | ||
@@ -5,0 +5,0 @@ private client; |
@@ -1,3 +0,3 @@ | ||
import { DynamicModule } from "@nestjs/common"; | ||
import { NatsJetStreamClientOptions } from "./interfaces/nats-jetstream-client-options.interface"; | ||
import { DynamicModule } from '@nestjs/common'; | ||
import { NatsJetStreamClientOptions } from './interfaces/nats-jetstream-client-options.interface'; | ||
export declare class NatsJetStreamTransport { | ||
@@ -4,0 +4,0 @@ static register(options: NatsJetStreamClientOptions): DynamicModule; |
@@ -1,3 +0,3 @@ | ||
import { BaseRpcContext } from "@nestjs/microservices/ctx-host/base-rpc.context"; | ||
import { JsMsg, Msg } from "nats"; | ||
import { BaseRpcContext } from '@nestjs/microservices/ctx-host/base-rpc.context'; | ||
import { JsMsg, Msg } from 'nats'; | ||
export declare type NatsJetStreamContextArgs = [JsMsg]; | ||
@@ -4,0 +4,0 @@ export declare type NatsContextArgs = [Msg]; |
@@ -1,3 +0,3 @@ | ||
import { CustomTransportStrategy, Server } from "@nestjs/microservices"; | ||
import { NatsJetStreamServerOptions } from "./interfaces/nats-jetstream-server-options.interface"; | ||
import { CustomTransportStrategy, Server } from '@nestjs/microservices'; | ||
import { NatsJetStreamServerOptions } from './interfaces/nats-jetstream-server-options.interface'; | ||
export declare class NatsJetStreamServer extends Server implements CustomTransportStrategy { | ||
@@ -4,0 +4,0 @@ private options; |
@@ -18,3 +18,5 @@ "use strict"; | ||
this.nc = await (0, nats_1.connect)(this.options.connectionOptions); | ||
this.options.connectionOptions.connectedHook(this.nc); | ||
if (this.options.connectionOptions.connectedHook) { | ||
this.options.connectionOptions.connectedHook(this.nc); | ||
} | ||
} | ||
@@ -21,0 +23,0 @@ this.jsm = await this.nc.jetstreamManager(this.options.jetStreamOptions); |
@@ -1,2 +0,2 @@ | ||
import { ServerConsumerOptions } from "src/interfaces/server-consumer-options.interface"; | ||
import { ServerConsumerOptions } from 'src/interfaces/server-consumer-options.interface'; | ||
export declare function serverConsumerOptionsBuilder(serverConsumerOptions: ServerConsumerOptions, subject: string): import("nats").ConsumerOptsBuilder; |
@@ -10,13 +10,14 @@ "use strict"; | ||
manualAck && opts.manualAck(); | ||
ackPolicy === "All" && opts.ackAll(); | ||
ackPolicy === "Explicit" && opts.ackExplicit(); | ||
ackPolicy === "None" && opts.ackNone(); | ||
deliverPolicy === "All" && opts.deliverAll(); | ||
deliverPolicy === "Last" && opts.deliverLast(); | ||
deliverPolicy === "last_per_subject" && opts.deliverLastPerSubject(); | ||
deliverPolicy === "New" && opts.deliverNew(); | ||
ackPolicy === 'All' && opts.ackAll(); | ||
ackPolicy === 'Explicit' && opts.ackExplicit(); | ||
ackPolicy === 'None' && opts.ackNone(); | ||
deliverPolicy === 'All' && opts.deliverAll(); | ||
deliverPolicy === 'Last' && opts.deliverLast(); | ||
deliverPolicy === 'last_per_subject' && opts.deliverLastPerSubject(); | ||
deliverPolicy === 'New' && opts.deliverNew(); | ||
deliverToSubject && opts.deliverTo(deliverToSubject); | ||
deliverTo && opts.deliverTo((0, nats_1.createInbox)(deliverTo)); | ||
description && opts.description(description); | ||
durable && opts.durable(`${durable}-${subject.replaceAll(".", "_").replaceAll("*", "_ALL")}`); | ||
durable && | ||
opts.durable(`${durable}-${subject.replaceAll('.', '_').replaceAll('*', '_ALL')}`); | ||
filterSubject && opts.filterSubject(filterSubject); | ||
@@ -32,4 +33,4 @@ flowControl && opts.flowControl(); | ||
orderedConsumer && opts.orderedConsumer(); | ||
replayPolicy === "Instant" && opts.replayInstantly(); | ||
replayPolicy === "Original" && opts.replayOriginal(); | ||
replayPolicy === 'Instant' && opts.replayInstantly(); | ||
replayPolicy === 'Original' && opts.replayOriginal(); | ||
sample && opts.sample(sample); | ||
@@ -36,0 +37,0 @@ startAtTimeDelta && opts.startAtTimeDelta(startAtTimeDelta); |
{ | ||
"name": "@nestjs-plugins/nestjs-nats-jetstream-transport", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Nats JetStream Transport for NestJS", | ||
@@ -28,3 +28,5 @@ "main": "dist/index.js", | ||
"build": "rimraf dist && tsc", | ||
"watch": "tsc -w" | ||
"watch": "tsc -w", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" | ||
}, | ||
@@ -34,3 +36,3 @@ "author": "Bernt Anker [bernt.anker@gmail.com]", | ||
"dependencies": { | ||
"@nestjs-plugins/nestjs-nats-jetstream-transport": "^1.3.4", | ||
"@nestjs-plugins/nestjs-nats-jetstream-transport": "^1.3.5", | ||
"nats": "^2.6.1", | ||
@@ -44,6 +46,10 @@ "reflect-metadata": "^0.1.13", | ||
"@nestjs/microservices": "^8.2.0", | ||
"@typescript-eslint/eslint-plugin": "^5.33.1", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.4.4" | ||
}, | ||
"gitHead": "6a10e8182359ba43310508fa835976a99eb72e82" | ||
"gitHead": "497a92c6837b5b7012a591f2ca6468af4780c957" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150192
471
9