Comparing version 2.0.4 to 2.0.6
@@ -347,3 +347,3 @@ /* | ||
} | ||
export declare function consumerOpts(): ConsumerOptsBuilder; | ||
export declare function consumerOpts(opts?: Partial<ConsumerConfig>): ConsumerOptsBuilder; | ||
@@ -350,0 +350,0 @@ export interface ConsumerOptsBuilder { |
@@ -123,6 +123,8 @@ "use strict"; | ||
if (s) { | ||
const idx = s.indexOf(": "); | ||
const k = s.slice(0, idx); | ||
const v = s.slice(idx + 2); | ||
mh.append(k, v); | ||
const idx = s.indexOf(":"); | ||
if (idx > -1) { | ||
const k = s.slice(0, idx); | ||
const v = s.slice(idx + 1).trim(); | ||
mh.append(k, v); | ||
} | ||
} | ||
@@ -129,0 +131,0 @@ }); |
@@ -5,6 +5,5 @@ export { NatsConnectionImpl } from "./nats"; | ||
export type { Msg, NatsConnection, PublishOptions, RequestOptions, Server, ServerInfo, ServersChanged, Status, Sub, SubOpts, Subscription, SubscriptionOptions, } from "./types"; | ||
export type { AccountLimits, ClusterInfo, ConnectionOptions, Consumer, ConsumerConfig, ConsumerOpts, DeliveryInfo, JetStreamAccountStats, JetStreamApiStats, JetStreamClient, JetStreamManager, JetStreamOptions, JetStreamPublishOptions, JetStreamPullSubscription, JetStreamSubscription, JetStreamSubscriptionOptions, JsMsg, JsMsgCallback, Lister, LostStreamData, MsgDeleteRequest, MsgRequest, Nanos, PeerInfo, Placement, PullOptions, SequencePair, StoredMsg, StreamConfig, StreamInfo, StreamNames, StreamSource, StreamSourceInfo, StreamState, } from "./types"; | ||
export type { AccountLimits, ClusterInfo, ConnectionOptions, Consumer, ConsumerConfig, ConsumerOpts, ConsumerOptsBuilder, DeliveryInfo, JetStreamAccountStats, JetStreamApiStats, JetStreamClient, JetStreamManager, JetStreamOptions, JetStreamPublishOptions, JetStreamPullSubscription, JetStreamSubscription, JetStreamSubscriptionOptions, JsMsg, JsMsgCallback, Lister, LostStreamData, MsgDeleteRequest, MsgRequest, Nanos, PeerInfo, Placement, PullOptions, SequencePair, StoredMsg, StreamConfig, StreamInfo, StreamNames, StreamSource, StreamSourceInfo, StreamState, } from "./types"; | ||
export { AckPolicy, AdvisoryKind, DeliverPolicy, DiscardPolicy, ReplayPolicy, RetentionPolicy, StorageType, } from "./types"; | ||
export { consumerOpts } from "./jsconsumeropts"; | ||
export type { ConsumerOptsBuilder } from "./jsconsumeropts"; | ||
export { toJsMsg } from "./jsmsg"; | ||
@@ -11,0 +10,0 @@ export { DebugEvents, Empty, Events } from "./types"; |
@@ -5,3 +5,3 @@ import { ConsumerAPI, ConsumerOpts, JetStreamClient, JetStreamOptions, JetStreamPublishOptions, JetStreamPullSubscription, JetStreamSubscription, JsMsg, NatsConnection, PubAck, PullOptions } from "./types"; | ||
import { QueuedIterator } from "./queued_iterator"; | ||
import type { ConsumerOptsBuilder } from "./jsconsumeropts"; | ||
import type { ConsumerOptsBuilder } from "./types"; | ||
export interface JetStreamSubscriptionInfoable { | ||
@@ -8,0 +8,0 @@ info: JetStreamSubscriptionInfo | null; |
@@ -1,21 +0,3 @@ | ||
import { ConsumerConfig, ConsumerOpts, JsMsgCallback, Nanos } from "./types"; | ||
export interface ConsumerOptsBuilder { | ||
deliverTo(subject: string): void; | ||
manualAck(): void; | ||
durable(name: string): void; | ||
deliverAll(): void; | ||
deliverLast(): void; | ||
deliverNew(): void; | ||
startSequence(seq: number): void; | ||
startTime(time: Date | Nanos): void; | ||
ackNone(): void; | ||
ackAll(): void; | ||
ackExplicit(): void; | ||
maxDeliver(max: number): void; | ||
maxAckPending(max: number): void; | ||
maxWaiting(max: number): void; | ||
maxMessages(max: number): void; | ||
callback(fn: JsMsgCallback): void; | ||
} | ||
export declare function consumerOpts(): ConsumerOptsBuilder; | ||
import { ConsumerConfig, ConsumerOpts, ConsumerOptsBuilder, JsMsgCallback } from "./types"; | ||
export declare function consumerOpts(opts?: Partial<ConsumerConfig>): ConsumerOptsBuilder; | ||
export declare class ConsumerOptsBuilderImpl implements ConsumerOptsBuilder { | ||
@@ -27,3 +9,3 @@ config: Partial<ConsumerConfig>; | ||
max?: number; | ||
constructor(); | ||
constructor(opts?: Partial<ConsumerConfig>); | ||
getOpts(): ConsumerOpts; | ||
@@ -30,0 +12,0 @@ deliverTo(subject: string): void; |
@@ -20,11 +20,18 @@ "use strict"; | ||
const jsutil_1 = require("./jsutil"); | ||
function consumerOpts() { | ||
return new ConsumerOptsBuilderImpl(); | ||
function consumerOpts(opts) { | ||
return new ConsumerOptsBuilderImpl(opts); | ||
} | ||
exports.consumerOpts = consumerOpts; | ||
// FIXME: some items here that may need to be addressed | ||
// 503s? | ||
// maxRetries() | ||
// retryBackoff() | ||
// ackWait(time) | ||
// replayOriginal() | ||
// rateLimit(bytesPerSec) | ||
class ConsumerOptsBuilderImpl { | ||
constructor() { | ||
constructor(opts) { | ||
this.stream = ""; | ||
this.mack = false; | ||
this.config = jsutil_1.defaultConsumer(""); | ||
this.config = jsutil_1.defaultConsumer("", opts || {}); | ||
// not set | ||
@@ -31,0 +38,0 @@ this.config.ack_policy = types_1.AckPolicy.All; |
@@ -77,6 +77,11 @@ "use strict"; | ||
if (!this.didAck) { | ||
this.didAck = true; | ||
// all acks are final with the exception of +WPI | ||
this.didAck = !this.isWIP(payload); | ||
this.msg.respond(payload); | ||
} | ||
} | ||
isWIP(p) { | ||
return p.length === 4 && p[0] === WPI[0] && p[1] === WPI[1] && | ||
p[2] === WPI[2] && p[3] === WPI[3]; | ||
} | ||
// this has to dig into the internals as the message has access | ||
@@ -83,0 +88,0 @@ // to the protocol but not the high-level client. |
@@ -121,3 +121,3 @@ "use strict"; | ||
_parse(s) { | ||
const bs = window.atob(s); | ||
const bs = atob(s); | ||
const len = bs.length; | ||
@@ -124,0 +124,0 @@ const bytes = new Uint8Array(len); |
@@ -528,3 +528,3 @@ import { NatsError } from "./error"; | ||
"ack_policy": AckPolicy; | ||
"ack_wait"?: number; | ||
"ack_wait"?: Nanos; | ||
"max_deliver"?: number; | ||
@@ -531,0 +531,0 @@ "filter_subject"?: string; |
@@ -45,3 +45,3 @@ "use strict"; | ||
const { readFile, existsSync } = require("fs"); | ||
const VERSION = "2.0.4"; | ||
const VERSION = "2.0.6"; | ||
const LANG = "nats.js"; | ||
@@ -48,0 +48,0 @@ class NodeTransport { |
{ | ||
"name": "nats", | ||
"version": "2.0.4", | ||
"version": "2.0.6", | ||
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
"clean": "shx rm -Rf ./lib/* ./nats-base-client ./.deps", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.0.4 https://github.com/nats-io/nats.deno.git", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.0.6 https://github.com/nats-io/nats.deno.git", | ||
"fmt": "deno fmt ./src/ ./examples/ ./test/", | ||
@@ -47,0 +47,0 @@ "prepack": "npm run clone-nbc && npm run cjs && npm run build", |
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
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
536062
8960