Comparing version 2.0.8 to 2.1.0
@@ -134,2 +134,3 @@ /* | ||
export interface Sub<T> extends AsyncIterable<T> { | ||
closed: Promise<void>; | ||
unsubscribe(max?: number): void; | ||
@@ -276,2 +277,3 @@ drain(): Promise<void>; | ||
timeout?: number; | ||
domain?: string; | ||
} | ||
@@ -304,2 +306,3 @@ export interface JetStreamManager { | ||
lastSequence: number; | ||
lastSubjectSequence: number; | ||
}>; | ||
@@ -370,2 +373,4 @@ } | ||
callback(fn: JsMsgCallback): void; | ||
idleHeartbeat(millis: number): void; | ||
flowControl(): void; | ||
} | ||
@@ -388,7 +393,7 @@ export interface Lister<T> { | ||
update(cfg: StreamConfig): Promise<StreamInfo>; | ||
purge(stream: string): Promise<PurgeResponse>; | ||
purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>; | ||
delete(stream: string): Promise<boolean>; | ||
list(): Lister<StreamInfo>; | ||
deleteMessage(stream: string, seq: number): Promise<boolean>; | ||
getMessage(stream: string, seq: number): Promise<StoredMsg>; | ||
deleteMessage(stream: string, seq: number, erase?: boolean): Promise<boolean>; | ||
getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>; | ||
find(subject: string): Promise<string>; | ||
@@ -486,12 +491,13 @@ } | ||
"template_owner"?: string; | ||
"duplicate_window"?: number; | ||
"duplicate_window"?: Nanos; | ||
placement?: Placement; | ||
mirror?: StreamSource; | ||
sources?: StreamSource[]; | ||
"max_msgs_per_subject"?: number; | ||
} | ||
export interface StreamSource { | ||
name: string; | ||
"opt_start_seq": number; | ||
"opt_start_time": string; | ||
"filter_subject": string; | ||
"opt_start_seq"?: number; | ||
"opt_start_time"?: string; | ||
"filter_subject"?: string; | ||
} | ||
@@ -566,2 +572,14 @@ export interface Placement { | ||
} | ||
export declare type PurgeOpts = PurgeBySeq | PurgeTrimOpts | PurgeBySubject; | ||
export declare type PurgeBySeq = { | ||
filter?: string; | ||
seq: number; | ||
}; | ||
export declare type PurgeTrimOpts = { | ||
filter?: string; | ||
keep: number; | ||
}; | ||
export declare type PurgeBySubject = { | ||
filter: string; | ||
}; | ||
export interface PurgeResponse extends Success { | ||
@@ -610,6 +628,10 @@ purged: number; | ||
export declare type SuccessResponse = ApiResponse & Success; | ||
export interface MsgRequest { | ||
export interface LastForMsgRequest { | ||
"last_by_subj": string; | ||
} | ||
export interface SeqMsgRequest { | ||
seq: number; | ||
} | ||
export interface MsgDeleteRequest extends MsgRequest { | ||
export declare type MsgRequest = SeqMsgRequest | LastForMsgRequest | number; | ||
export interface MsgDeleteRequest extends SeqMsgRequest { | ||
"no_erase"?: boolean; | ||
@@ -624,2 +646,3 @@ } | ||
limits: AccountLimits; | ||
domain?: string; | ||
} | ||
@@ -646,3 +669,3 @@ export interface JetStreamApiStats { | ||
"ack_policy": AckPolicy; | ||
"ack_wait"?: number; | ||
"ack_wait"?: Nanos; | ||
"max_deliver"?: number; | ||
@@ -655,2 +678,4 @@ "filter_subject"?: string; | ||
"max_ack_pending"?: number; | ||
"idle_heartbeat"?: Nanos; | ||
"flow_control"?: boolean; | ||
} | ||
@@ -673,2 +698,8 @@ export interface Consumer { | ||
export declare enum JsHeaders { | ||
StreamSourceHdr = "Nats-Stream-Source", | ||
LastConsumerSeqHdr = "Nats-Last-Consumer", | ||
LastStreamSeqHdr = "Nats-Last-Stream" | ||
} | ||
export declare type MsgAdapter<T> = ( | ||
@@ -693,1 +724,7 @@ err: NatsError | null, | ||
export declare type DispatchedFn<T> = (data: T | null) => void; | ||
export declare function defaultConsumer(name: string, opts?: Partial<ConsumerConfig>): ConsumerConfig; | ||
export declare function nanos(millis: number): Nanos; | ||
export declare function millis(ns: Nanos): number; | ||
export declare function isFlowControlMsg(msg: Msg): boolean; | ||
export declare function isHeartbeatMsg(msg: Msg): boolean; |
@@ -120,3 +120,3 @@ "use strict"; | ||
} | ||
else { | ||
if (lines.length >= 1) { | ||
lines.slice(1).map((s) => { | ||
@@ -123,0 +123,0 @@ if (s) { |
@@ -5,7 +5,7 @@ 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, 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 type { AccountLimits, ClusterInfo, ConnectionOptions, Consumer, ConsumerConfig, ConsumerOpts, ConsumerOptsBuilder, DeliveryInfo, JetStreamAccountStats, JetStreamApiStats, JetStreamClient, JetStreamManager, JetStreamOptions, JetStreamPublishOptions, JetStreamPullSubscription, JetStreamSubscription, JetStreamSubscriptionOptions, JsMsg, JsMsgCallback, LastForMsgRequest, Lister, LostStreamData, MsgDeleteRequest, MsgRequest, Nanos, PeerInfo, Placement, PullOptions, SeqMsgRequest, 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 { toJsMsg } from "./jsmsg"; | ||
export { DebugEvents, Empty, Events } from "./types"; | ||
export { DebugEvents, Empty, Events, JsHeaders } from "./types"; | ||
export { MsgImpl } from "./msg"; | ||
@@ -43,2 +43,2 @@ export { SubscriptionImpl } from "./subscription"; | ||
export type { TypedSubscriptionOptions } from "./typedsub"; | ||
export { millis, nanos } from "./jsutil"; | ||
export { isFlowControlMsg, isHeartbeatMsg, millis, nanos } from "./jsutil"; |
@@ -13,4 +13,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DenoBuffer = exports.State = exports.Parser = exports.Kind = exports.StringCodec = exports.JSONCodec = exports.nkeyAuthenticator = exports.jwtAuthenticator = exports.credsAuthenticator = exports.Request = exports.checkUnsupportedOption = exports.checkOptions = exports.DataBuffer = exports.MuxSubscription = exports.Heartbeat = exports.MsgHdrsImpl = exports.Match = exports.headers = exports.canonicalMIMEHeaderKey = exports.timeout = exports.render = exports.extractProtocolMessage = exports.extend = exports.delay = exports.deferred = exports.ProtocolHandler = exports.INFO = exports.createInbox = exports.Connect = exports.setTransportFactory = exports.Subscriptions = exports.SubscriptionImpl = exports.MsgImpl = exports.Events = exports.Empty = exports.DebugEvents = exports.toJsMsg = exports.consumerOpts = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.DiscardPolicy = exports.DeliverPolicy = exports.AdvisoryKind = exports.AckPolicy = exports.NatsError = exports.ErrorCode = exports.nuid = exports.Nuid = exports.NatsConnectionImpl = void 0; | ||
exports.nanos = exports.millis = exports.TypedSubscription = exports.parseIP = exports.isIP = exports.TE = exports.TD = exports.Metric = exports.Bench = exports.writeAll = exports.readAll = exports.MAX_SIZE = void 0; | ||
exports.State = exports.Parser = exports.Kind = exports.StringCodec = exports.JSONCodec = exports.nkeyAuthenticator = exports.jwtAuthenticator = exports.credsAuthenticator = exports.Request = exports.checkUnsupportedOption = exports.checkOptions = exports.DataBuffer = exports.MuxSubscription = exports.Heartbeat = exports.MsgHdrsImpl = exports.Match = exports.headers = exports.canonicalMIMEHeaderKey = exports.timeout = exports.render = exports.extractProtocolMessage = exports.extend = exports.delay = exports.deferred = exports.ProtocolHandler = exports.INFO = exports.createInbox = exports.Connect = exports.setTransportFactory = exports.Subscriptions = exports.SubscriptionImpl = exports.MsgImpl = exports.JsHeaders = exports.Events = exports.Empty = exports.DebugEvents = exports.toJsMsg = exports.consumerOpts = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.DiscardPolicy = exports.DeliverPolicy = exports.AdvisoryKind = exports.AckPolicy = exports.NatsError = exports.ErrorCode = exports.nuid = exports.Nuid = exports.NatsConnectionImpl = void 0; | ||
exports.nanos = exports.millis = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.TypedSubscription = exports.parseIP = exports.isIP = exports.TE = exports.TD = exports.Metric = exports.Bench = exports.writeAll = exports.readAll = exports.MAX_SIZE = exports.DenoBuffer = void 0; | ||
var nats_1 = require("./nats"); | ||
@@ -40,2 +40,3 @@ Object.defineProperty(exports, "NatsConnectionImpl", { enumerable: true, get: function () { return nats_1.NatsConnectionImpl; } }); | ||
Object.defineProperty(exports, "Events", { enumerable: true, get: function () { return types_2.Events; } }); | ||
Object.defineProperty(exports, "JsHeaders", { enumerable: true, get: function () { return types_2.JsHeaders; } }); | ||
var msg_1 = require("./msg"); | ||
@@ -106,4 +107,6 @@ Object.defineProperty(exports, "MsgImpl", { enumerable: true, get: function () { return msg_1.MsgImpl; } }); | ||
var jsutil_1 = require("./jsutil"); | ||
Object.defineProperty(exports, "isFlowControlMsg", { enumerable: true, get: function () { return jsutil_1.isFlowControlMsg; } }); | ||
Object.defineProperty(exports, "isHeartbeatMsg", { enumerable: true, get: function () { return jsutil_1.isHeartbeatMsg; } }); | ||
Object.defineProperty(exports, "millis", { enumerable: true, get: function () { return jsutil_1.millis; } }); | ||
Object.defineProperty(exports, "nanos", { enumerable: true, get: function () { return jsutil_1.nanos; } }); | ||
//# sourceMappingURL=internal_mod.js.map |
@@ -35,2 +35,6 @@ "use strict"; | ||
opts = opts || {}; | ||
if (opts.domain) { | ||
opts.apiPrefix = `$JS.${opts.domain}.API`; | ||
delete opts.domain; | ||
} | ||
return util_1.extend({ apiPrefix: defaultPrefix, timeout: defaultTimeout }, opts); | ||
@@ -37,0 +41,0 @@ } |
@@ -45,2 +45,3 @@ "use strict"; | ||
PubHeaders["ExpectedLastMsgIdHdr"] = "Nats-Expected-Last-Msg-Id"; | ||
PubHeaders["ExpectedLastSubjectSequenceHdr"] = "Nats-Expected-Last-Subject-Sequence"; | ||
})(PubHeaders || (PubHeaders = {})); | ||
@@ -70,2 +71,5 @@ class JetStreamClientImpl extends jsbaseclient_api_1.BaseApiClient { | ||
} | ||
if (opts.expect.lastSubjectSequence) { | ||
mh.set(PubHeaders.ExpectedLastSubjectSequenceHdr, `${opts.expect.lastSubjectSequence}`); | ||
} | ||
} | ||
@@ -72,0 +76,0 @@ const to = opts.timeout || this.timeout; |
@@ -29,3 +29,5 @@ import { ConsumerConfig, ConsumerOpts, ConsumerOptsBuilder, JsMsgCallback } from "./types"; | ||
queue(n: string): void; | ||
idleHeartbeat(millis: number): void; | ||
flowControl(): void; | ||
} | ||
export declare function isConsumerOptsBuilder(o: ConsumerOptsBuilder | Partial<ConsumerOpts>): o is ConsumerOptsBuilderImpl; |
@@ -106,2 +106,8 @@ "use strict"; | ||
} | ||
idleHeartbeat(millis) { | ||
this.config.idle_heartbeat = jsutil_1.nanos(millis); | ||
} | ||
flowControl() { | ||
this.config.flow_control = true; | ||
} | ||
} | ||
@@ -108,0 +114,0 @@ exports.ConsumerOptsBuilderImpl = ConsumerOptsBuilderImpl; |
@@ -1,2 +0,2 @@ | ||
import { JetStreamOptions, Lister, NatsConnection, PurgeResponse, StoredMsg, StreamAPI, StreamConfig, StreamInfo, StreamInfoRequestOptions, StreamMsgResponse } from "./types"; | ||
import { JetStreamOptions, Lister, MsgRequest, NatsConnection, PurgeOpts, PurgeResponse, StoredMsg, StreamAPI, StreamConfig, StreamInfo, StreamInfoRequestOptions, StreamMsgResponse } from "./types"; | ||
import { BaseApiClient } from "./jsbaseclient_api"; | ||
@@ -11,5 +11,5 @@ import { MsgHdrs } from "./headers"; | ||
list(): Lister<StreamInfo>; | ||
purge(name: string): Promise<PurgeResponse>; | ||
purge(name: string, opts?: PurgeOpts): Promise<PurgeResponse>; | ||
deleteMessage(stream: string, seq: number, erase?: boolean): Promise<boolean>; | ||
getMessage(stream: string, seq: number): Promise<StoredMsg>; | ||
getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>; | ||
find(subject: string): Promise<string>; | ||
@@ -16,0 +16,0 @@ } |
@@ -73,6 +73,12 @@ "use strict"; | ||
} | ||
purge(name) { | ||
purge(name, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (opts) { | ||
const { keep, seq } = opts; | ||
if (typeof keep === "number" && typeof seq === "number") { | ||
throw new Error("can specify one of keep or seq"); | ||
} | ||
} | ||
jsutil_1.validateStreamName(name); | ||
const v = yield this._request(`${this.prefix}.STREAM.PURGE.${name}`); | ||
const v = yield this._request(`${this.prefix}.STREAM.PURGE.${name}`, opts); | ||
return v; | ||
@@ -93,7 +99,11 @@ }); | ||
} | ||
getMessage(stream, seq) { | ||
getMessage(stream, query) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// FIXME: remove this shim | ||
if (typeof query === "number") { | ||
console.log(`\u001B[33m [WARN] jsm.getMessage(number) is deprecated and will be removed on release - use \`{seq: number}\` as an argument \u001B[0m`); | ||
query = { seq: query }; | ||
} | ||
jsutil_1.validateStreamName(stream); | ||
const dr = { seq }; | ||
const r = yield this._request(`${this.prefix}.STREAM.MSG.GET.${stream}`, dr); | ||
const r = yield this._request(`${this.prefix}.STREAM.MSG.GET.${stream}`, query); | ||
const sm = r; | ||
@@ -100,0 +110,0 @@ return new StoredMsgImpl(sm); |
@@ -10,3 +10,4 @@ import { ConsumerConfig, Msg, Nanos } from "./types"; | ||
export declare function isFlowControlMsg(msg: Msg): boolean; | ||
export declare function isHeartbeatMsg(msg: Msg): boolean; | ||
export declare function checkJsError(msg: Msg): NatsError | null; | ||
export declare function checkJsErrorCode(code: number, description?: string): NatsError | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkJsErrorCode = exports.checkJsError = exports.isFlowControlMsg = exports.millis = exports.nanos = exports.defaultConsumer = exports.validateName = exports.validateStreamName = exports.validateDurableName = void 0; | ||
exports.checkJsErrorCode = exports.checkJsError = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.millis = exports.nanos = exports.defaultConsumer = exports.validateName = exports.validateStreamName = exports.validateDurableName = void 0; | ||
/* | ||
@@ -66,2 +66,7 @@ * Copyright 2021 The NATS Authors | ||
exports.isFlowControlMsg = isFlowControlMsg; | ||
function isHeartbeatMsg(msg) { | ||
var _a; | ||
return isFlowControlMsg(msg) && ((_a = msg.headers) === null || _a === void 0 ? void 0 : _a.description) === "Idle Heartbeat"; | ||
} | ||
exports.isHeartbeatMsg = isHeartbeatMsg; | ||
function checkJsError(msg) { | ||
@@ -68,0 +73,0 @@ const h = msg.headers; |
@@ -1,4 +0,2 @@ | ||
export { Bench, canonicalMIMEHeaderKey, createInbox, credsAuthenticator, DebugEvents, Empty, ErrorCode, Events, headers, JSONCodec, jwtAuthenticator, Match, NatsError, nkeyAuthenticator, Nuid, StringCodec, } from "./internal_mod"; | ||
export type { Authenticator, Codec, ConnectionOptions, Msg, MsgHdrs, NatsConnection, PublishOptions, RequestOptions, ServersChanged, Status, Sub, SubOpts, Subscription, SubscriptionOptions, } from "./internal_mod"; | ||
export { AckPolicy, AdvisoryKind, consumerOpts, DeliverPolicy, DiscardPolicy, millis, nanos, ReplayPolicy, RetentionPolicy, StorageType, toJsMsg, } from "./internal_mod"; | ||
export type { AccountLimits, ClusterInfo, 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 "./internal_mod"; | ||
export { AckPolicy, AdvisoryKind, Bench, canonicalMIMEHeaderKey, consumerOpts, createInbox, credsAuthenticator, DebugEvents, DeliverPolicy, DiscardPolicy, Empty, ErrorCode, Events, headers, isFlowControlMsg, isHeartbeatMsg, JsHeaders, JSONCodec, jwtAuthenticator, Match, millis, nanos, NatsError, nkeyAuthenticator, Nuid, nuid, ReplayPolicy, RetentionPolicy, StorageType, StringCodec, toJsMsg, } from "./internal_mod"; | ||
export type { AccountLimits, Authenticator, ClusterInfo, Codec, ConnectionOptions, Consumer, ConsumerConfig, ConsumerOpts, ConsumerOptsBuilder, DeliveryInfo, JetStreamAccountStats, JetStreamApiStats, JetStreamClient, JetStreamManager, JetStreamOptions, JetStreamPublishOptions, JetStreamPullSubscription, JetStreamSubscription, JetStreamSubscriptionOptions, JsMsg, JsMsgCallback, LastForMsgRequest, Lister, LostStreamData, Msg, MsgDeleteRequest, MsgHdrs, MsgRequest, Nanos, NatsConnection, PeerInfo, Placement, PublishOptions, PullOptions, RequestOptions, SeqMsgRequest, SequencePair, ServersChanged, Status, StoredMsg, StreamConfig, StreamInfo, StreamNames, StreamSource, StreamSourceInfo, StreamState, Sub, SubOpts, Subscription, SubscriptionOptions, } from "./internal_mod"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toJsMsg = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.nanos = exports.millis = exports.DiscardPolicy = exports.DeliverPolicy = exports.consumerOpts = exports.AdvisoryKind = exports.AckPolicy = exports.StringCodec = exports.Nuid = exports.nkeyAuthenticator = exports.NatsError = exports.Match = exports.jwtAuthenticator = exports.JSONCodec = exports.headers = exports.Events = exports.ErrorCode = exports.Empty = exports.DebugEvents = exports.credsAuthenticator = exports.createInbox = exports.canonicalMIMEHeaderKey = exports.Bench = void 0; | ||
exports.toJsMsg = exports.StringCodec = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.nuid = exports.Nuid = exports.nkeyAuthenticator = exports.NatsError = exports.nanos = exports.millis = exports.Match = exports.jwtAuthenticator = exports.JSONCodec = exports.JsHeaders = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.headers = exports.Events = exports.ErrorCode = exports.Empty = exports.DiscardPolicy = exports.DeliverPolicy = exports.DebugEvents = exports.credsAuthenticator = exports.createInbox = exports.consumerOpts = exports.canonicalMIMEHeaderKey = exports.Bench = exports.AdvisoryKind = exports.AckPolicy = void 0; | ||
var internal_mod_1 = require("./internal_mod"); | ||
Object.defineProperty(exports, "AckPolicy", { enumerable: true, get: function () { return internal_mod_1.AckPolicy; } }); | ||
Object.defineProperty(exports, "AdvisoryKind", { enumerable: true, get: function () { return internal_mod_1.AdvisoryKind; } }); | ||
Object.defineProperty(exports, "Bench", { enumerable: true, get: function () { return internal_mod_1.Bench; } }); | ||
Object.defineProperty(exports, "canonicalMIMEHeaderKey", { enumerable: true, get: function () { return internal_mod_1.canonicalMIMEHeaderKey; } }); | ||
Object.defineProperty(exports, "consumerOpts", { enumerable: true, get: function () { return internal_mod_1.consumerOpts; } }); | ||
Object.defineProperty(exports, "createInbox", { enumerable: true, get: function () { return internal_mod_1.createInbox; } }); | ||
Object.defineProperty(exports, "credsAuthenticator", { enumerable: true, get: function () { return internal_mod_1.credsAuthenticator; } }); | ||
Object.defineProperty(exports, "DebugEvents", { enumerable: true, get: function () { return internal_mod_1.DebugEvents; } }); | ||
Object.defineProperty(exports, "DeliverPolicy", { enumerable: true, get: function () { return internal_mod_1.DeliverPolicy; } }); | ||
Object.defineProperty(exports, "DiscardPolicy", { enumerable: true, get: function () { return internal_mod_1.DiscardPolicy; } }); | ||
Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return internal_mod_1.Empty; } }); | ||
@@ -14,21 +19,19 @@ Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return internal_mod_1.ErrorCode; } }); | ||
Object.defineProperty(exports, "headers", { enumerable: true, get: function () { return internal_mod_1.headers; } }); | ||
Object.defineProperty(exports, "isFlowControlMsg", { enumerable: true, get: function () { return internal_mod_1.isFlowControlMsg; } }); | ||
Object.defineProperty(exports, "isHeartbeatMsg", { enumerable: true, get: function () { return internal_mod_1.isHeartbeatMsg; } }); | ||
Object.defineProperty(exports, "JsHeaders", { enumerable: true, get: function () { return internal_mod_1.JsHeaders; } }); | ||
Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function () { return internal_mod_1.JSONCodec; } }); | ||
Object.defineProperty(exports, "jwtAuthenticator", { enumerable: true, get: function () { return internal_mod_1.jwtAuthenticator; } }); | ||
Object.defineProperty(exports, "Match", { enumerable: true, get: function () { return internal_mod_1.Match; } }); | ||
Object.defineProperty(exports, "millis", { enumerable: true, get: function () { return internal_mod_1.millis; } }); | ||
Object.defineProperty(exports, "nanos", { enumerable: true, get: function () { return internal_mod_1.nanos; } }); | ||
Object.defineProperty(exports, "NatsError", { enumerable: true, get: function () { return internal_mod_1.NatsError; } }); | ||
Object.defineProperty(exports, "nkeyAuthenticator", { enumerable: true, get: function () { return internal_mod_1.nkeyAuthenticator; } }); | ||
Object.defineProperty(exports, "Nuid", { enumerable: true, get: function () { return internal_mod_1.Nuid; } }); | ||
Object.defineProperty(exports, "nuid", { enumerable: true, get: function () { return internal_mod_1.nuid; } }); | ||
Object.defineProperty(exports, "ReplayPolicy", { enumerable: true, get: function () { return internal_mod_1.ReplayPolicy; } }); | ||
Object.defineProperty(exports, "RetentionPolicy", { enumerable: true, get: function () { return internal_mod_1.RetentionPolicy; } }); | ||
Object.defineProperty(exports, "StorageType", { enumerable: true, get: function () { return internal_mod_1.StorageType; } }); | ||
Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function () { return internal_mod_1.StringCodec; } }); | ||
var internal_mod_2 = require("./internal_mod"); | ||
Object.defineProperty(exports, "AckPolicy", { enumerable: true, get: function () { return internal_mod_2.AckPolicy; } }); | ||
Object.defineProperty(exports, "AdvisoryKind", { enumerable: true, get: function () { return internal_mod_2.AdvisoryKind; } }); | ||
Object.defineProperty(exports, "consumerOpts", { enumerable: true, get: function () { return internal_mod_2.consumerOpts; } }); | ||
Object.defineProperty(exports, "DeliverPolicy", { enumerable: true, get: function () { return internal_mod_2.DeliverPolicy; } }); | ||
Object.defineProperty(exports, "DiscardPolicy", { enumerable: true, get: function () { return internal_mod_2.DiscardPolicy; } }); | ||
Object.defineProperty(exports, "millis", { enumerable: true, get: function () { return internal_mod_2.millis; } }); | ||
Object.defineProperty(exports, "nanos", { enumerable: true, get: function () { return internal_mod_2.nanos; } }); | ||
Object.defineProperty(exports, "ReplayPolicy", { enumerable: true, get: function () { return internal_mod_2.ReplayPolicy; } }); | ||
Object.defineProperty(exports, "RetentionPolicy", { enumerable: true, get: function () { return internal_mod_2.RetentionPolicy; } }); | ||
Object.defineProperty(exports, "StorageType", { enumerable: true, get: function () { return internal_mod_2.StorageType; } }); | ||
Object.defineProperty(exports, "toJsMsg", { enumerable: true, get: function () { return internal_mod_2.toJsMsg; } }); | ||
Object.defineProperty(exports, "toJsMsg", { enumerable: true, get: function () { return internal_mod_1.toJsMsg; } }); | ||
//# sourceMappingURL=mod.js.map |
@@ -144,2 +144,3 @@ import { NatsError } from "./error"; | ||
export interface Sub<T> extends AsyncIterable<T> { | ||
closed: Promise<void>; | ||
unsubscribe(max?: number): void; | ||
@@ -180,2 +181,3 @@ drain(): Promise<void>; | ||
timeout?: number; | ||
domain?: string; | ||
} | ||
@@ -208,2 +210,3 @@ export interface JetStreamManager { | ||
lastSequence: number; | ||
lastSubjectSequence: number; | ||
}>; | ||
@@ -237,3 +240,2 @@ } | ||
mack: boolean; | ||
subQueue: string; | ||
stream: string; | ||
@@ -264,2 +266,4 @@ callbackFn?: JsMsgCallback; | ||
callback(fn: JsMsgCallback): void; | ||
idleHeartbeat(millis: number): void; | ||
flowControl(): void; | ||
} | ||
@@ -282,7 +286,7 @@ export interface Lister<T> { | ||
update(cfg: StreamConfig): Promise<StreamInfo>; | ||
purge(stream: string): Promise<PurgeResponse>; | ||
purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>; | ||
delete(stream: string): Promise<boolean>; | ||
list(): Lister<StreamInfo>; | ||
deleteMessage(stream: string, seq: number): Promise<boolean>; | ||
getMessage(stream: string, seq: number): Promise<StoredMsg>; | ||
deleteMessage(stream: string, seq: number, erase?: boolean): Promise<boolean>; | ||
getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>; | ||
find(subject: string): Promise<string>; | ||
@@ -380,12 +384,13 @@ } | ||
"template_owner"?: string; | ||
"duplicate_window"?: number; | ||
"duplicate_window"?: Nanos; | ||
placement?: Placement; | ||
mirror?: StreamSource; | ||
sources?: StreamSource[]; | ||
"max_msgs_per_subject"?: number; | ||
} | ||
export interface StreamSource { | ||
name: string; | ||
"opt_start_seq": number; | ||
"opt_start_time": string; | ||
"filter_subject": string; | ||
"opt_start_seq"?: number; | ||
"opt_start_time"?: string; | ||
"filter_subject"?: string; | ||
} | ||
@@ -460,2 +465,14 @@ export interface Placement { | ||
} | ||
export declare type PurgeOpts = PurgeBySeq | PurgeTrimOpts | PurgeBySubject; | ||
export declare type PurgeBySeq = { | ||
filter?: string; | ||
seq: number; | ||
}; | ||
export declare type PurgeTrimOpts = { | ||
filter?: string; | ||
keep: number; | ||
}; | ||
export declare type PurgeBySubject = { | ||
filter: string; | ||
}; | ||
export interface PurgeResponse extends Success { | ||
@@ -504,6 +521,10 @@ purged: number; | ||
export declare type SuccessResponse = ApiResponse & Success; | ||
export interface MsgRequest { | ||
export interface LastForMsgRequest { | ||
"last_by_subj": string; | ||
} | ||
export interface SeqMsgRequest { | ||
seq: number; | ||
} | ||
export interface MsgDeleteRequest extends MsgRequest { | ||
export declare type MsgRequest = SeqMsgRequest | LastForMsgRequest | number; | ||
export interface MsgDeleteRequest extends SeqMsgRequest { | ||
"no_erase"?: boolean; | ||
@@ -518,2 +539,3 @@ } | ||
limits: AccountLimits; | ||
domain?: string; | ||
} | ||
@@ -548,2 +570,4 @@ export interface JetStreamApiStats { | ||
"max_ack_pending"?: number; | ||
"idle_heartbeat"?: Nanos; | ||
"flow_control"?: boolean; | ||
} | ||
@@ -565,1 +589,6 @@ export interface Consumer { | ||
} | ||
export declare enum JsHeaders { | ||
StreamSourceHdr = "Nats-Stream-Source", | ||
LastConsumerSeqHdr = "Nats-Last-Consumer", | ||
LastStreamSeqHdr = "Nats-Last-Stream" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ReplayPolicy = exports.AckPolicy = exports.DeliverPolicy = exports.StorageType = exports.DiscardPolicy = exports.RetentionPolicy = exports.AdvisoryKind = exports.DEFAULT_MAX_PING_OUT = exports.DEFAULT_PING_INTERVAL = exports.DEFAULT_JITTER_TLS = exports.DEFAULT_JITTER = exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = exports.DEFAULT_RECONNECT_TIME_WAIT = exports.DEFAULT_HOST = exports.DEFAULT_PORT = exports.DebugEvents = exports.Events = exports.Empty = void 0; | ||
exports.JsHeaders = exports.ReplayPolicy = exports.AckPolicy = exports.DeliverPolicy = exports.StorageType = exports.DiscardPolicy = exports.RetentionPolicy = exports.AdvisoryKind = exports.DEFAULT_MAX_PING_OUT = exports.DEFAULT_PING_INTERVAL = exports.DEFAULT_JITTER_TLS = exports.DEFAULT_JITTER = exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = exports.DEFAULT_RECONNECT_TIME_WAIT = exports.DEFAULT_HOST = exports.DEFAULT_PORT = exports.DebugEvents = exports.Events = exports.Empty = void 0; | ||
exports.Empty = new Uint8Array(0); | ||
@@ -82,2 +82,11 @@ var Events; | ||
})(ReplayPolicy = exports.ReplayPolicy || (exports.ReplayPolicy = {})); | ||
var JsHeaders; | ||
(function (JsHeaders) { | ||
// set if message coming from a stream source format is `stream seq` | ||
JsHeaders["StreamSourceHdr"] = "Nats-Stream-Source"; | ||
// set for heartbeat messages | ||
JsHeaders["LastConsumerSeqHdr"] = "Nats-Last-Consumer"; | ||
// set for heartbeat messages | ||
JsHeaders["LastStreamSeqHdr"] = "Nats-Last-Stream"; | ||
})(JsHeaders = exports.JsHeaders || (exports.JsHeaders = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -45,3 +45,3 @@ "use strict"; | ||
const { readFile, existsSync } = require("fs"); | ||
const VERSION = "2.0.6"; | ||
const VERSION = "2.1.0"; | ||
const LANG = "nats.js"; | ||
@@ -48,0 +48,0 @@ class NodeTransport { |
{ | ||
"name": "nats", | ||
"version": "2.0.8", | ||
"version": "2.1.0", | ||
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system", | ||
@@ -44,7 +44,7 @@ "keywords": [ | ||
"clean": "shx rm -Rf ./lib/* ./nats-base-client ./.deps", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.0.8 https://github.com/nats-io/nats.deno.git", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.1.0 https://github.com/nats-io/nats.deno.git", | ||
"fmt": "deno fmt ./src/ ./examples/ ./test/", | ||
"prepack": "npm run clone-nbc && npm run cjs && npm run build", | ||
"prepack": "npm run clone-nbc && npm run cjs && npm run check-package && npm run build", | ||
"ava": "nyc ava --verbose -T 60000", | ||
"test": "npm run build && npm run ava", | ||
"test": "npm run check-package && npm run build && npm run ava", | ||
"debug-test": "node node_modules/.bin/ava --verbose -T 6500000 --match", | ||
@@ -55,3 +55,4 @@ "setup": "curl -fsSL https://deno.land/x/install/install.sh | sh", | ||
"cover:html": "nyc report --reporter=html && open coverage/index.html", | ||
"coveralls": "shx mkdir -p ./coverage && nyc report --reporter=text-lcov > ./coverage/lcov.info" | ||
"coveralls": "shx mkdir -p ./coverage && nyc report --reporter=text-lcov > ./coverage/lcov.info", | ||
"check-package": "deno run --allow-all bin/check-bundle-version.ts" | ||
}, | ||
@@ -58,0 +59,0 @@ "engines": { |
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
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
543306
9083