Comparing version 2.7.1 to 2.8.0
export interface Codec<T> { | ||
/** | ||
* Encode T to an Uint8Array suitable for including in a message payload. | ||
* @param d | ||
*/ | ||
encode(d: T): Uint8Array; | ||
/** | ||
* Decode an Uint8Array from a message payload into a T | ||
* @param a | ||
*/ | ||
decode(a: Uint8Array): T; | ||
} | ||
/** | ||
* Returns a {@link Codec} for encoding strings to a message payload | ||
* and decoding message payloads into strings. | ||
* @constructor | ||
*/ | ||
export declare function StringCodec(): Codec<string>; | ||
/** | ||
* Returns a {@link Codec} for encoding JavaScript object to JSON and | ||
* serialize them to an Uint8Array, and conversely, from an | ||
* Uint8Array to JSON to a JavaScript Object. | ||
* @param reviver | ||
* @constructor | ||
*/ | ||
export declare function JSONCodec<T = unknown>(reviver?: (this: unknown, key: string, value: unknown) => unknown): Codec<T>; |
@@ -20,2 +20,7 @@ "use strict"; | ||
const encoders_1 = require("./encoders"); | ||
/** | ||
* Returns a {@link Codec} for encoding strings to a message payload | ||
* and decoding message payloads into strings. | ||
* @constructor | ||
*/ | ||
function StringCodec() { | ||
@@ -32,2 +37,9 @@ return { | ||
exports.StringCodec = StringCodec; | ||
/** | ||
* Returns a {@link Codec} for encoding JavaScript object to JSON and | ||
* serialize them to an Uint8Array, and conversely, from an | ||
* Uint8Array to JSON to a JavaScript Object. | ||
* @param reviver | ||
* @constructor | ||
*/ | ||
function JSONCodec(reviver) { | ||
@@ -34,0 +46,0 @@ return { |
@@ -10,2 +10,3 @@ export declare class DataBuffer { | ||
pack(): void; | ||
shift(): Uint8Array; | ||
drain(n?: number): Uint8Array; | ||
@@ -12,0 +13,0 @@ fill(a: Uint8Array, ...bufs: Uint8Array[]): void; |
@@ -62,2 +62,12 @@ "use strict"; | ||
} | ||
shift() { | ||
if (this.buffers.length) { | ||
const a = this.buffers.shift(); | ||
if (a) { | ||
this.byteLength -= a.length; | ||
return a; | ||
} | ||
} | ||
return new Uint8Array(0); | ||
} | ||
drain(n) { | ||
@@ -64,0 +74,0 @@ if (this.buffers.length) { |
@@ -43,2 +43,4 @@ export interface MsgHdrs extends Iterable<[string, string[]]> { | ||
get status(): string; | ||
toRecord(): Record<string, string[]>; | ||
static fromRecord(r: Record<string, string[]>): MsgHdrs; | ||
} |
@@ -241,4 +241,18 @@ "use strict"; | ||
} | ||
toRecord() { | ||
const data = {}; | ||
this.keys().forEach((v) => { | ||
data[v] = this.values(v); | ||
}); | ||
return data; | ||
} | ||
static fromRecord(r) { | ||
const h = new MsgHdrsImpl(); | ||
for (const k in r) { | ||
h.headers.set(k, r[k]); | ||
} | ||
return h; | ||
} | ||
} | ||
exports.MsgHdrsImpl = MsgHdrsImpl; | ||
//# sourceMappingURL=headers.js.map |
export declare function ipV4(a: number, b: number, c: number, d: number): Uint8Array; | ||
export declare function isIP(h: string): boolean; | ||
export declare function parseIP(h: string): (Uint8Array | undefined); | ||
export declare function parseIP(h: string): Uint8Array | undefined; |
@@ -40,2 +40,4 @@ "use strict"; | ||
const kv_1 = require("./kv"); | ||
const semver_1 = require("./semver"); | ||
const objectstore_1 = require("./objectstore"); | ||
var PubHeaders; | ||
@@ -52,3 +54,2 @@ (function (PubHeaders) { | ||
this.js = js; | ||
jetstreamPreview(this.js.nc); | ||
} | ||
@@ -61,2 +62,6 @@ kv(name, opts = {}) { | ||
} | ||
os(name, opts = {}) { | ||
jetstreamPreview(this.js.nc); | ||
return objectstore_1.ObjectStoreImpl.create(this.js, name, opts); | ||
} | ||
} | ||
@@ -101,3 +106,22 @@ class JetStreamClientImpl extends jsbaseclient_api_1.BaseApiClient { | ||
} | ||
const r = yield this.nc.request(subj, data, ro); | ||
let { retries, retry_delay } = opts; | ||
retries = retries || 1; | ||
retry_delay = retry_delay || 250; | ||
let r; | ||
for (let i = 0; i < retries; i++) { | ||
try { | ||
r = yield this.nc.request(subj, data, ro); | ||
// if here we succeeded | ||
break; | ||
} | ||
catch (err) { | ||
const ne = err; | ||
if (ne.code === "503" && i + 1 < retries) { | ||
yield (0, util_1.delay)(retry_delay); | ||
} | ||
else { | ||
throw err; | ||
} | ||
} | ||
} | ||
const pa = this.parseJsResponse(r); | ||
@@ -143,7 +167,18 @@ if (pa.stream === "") { | ||
fetch(stream, durable, opts = {}) { | ||
var _a; | ||
(0, jsutil_1.validateStreamName)(stream); | ||
(0, jsutil_1.validateDurableName)(durable); | ||
let timer = null; | ||
const trackBytes = ((_a = opts.max_bytes) !== null && _a !== void 0 ? _a : 0) > 0; | ||
let receivedBytes = 0; | ||
const max_bytes = trackBytes ? opts.max_bytes : 0; | ||
const args = {}; | ||
args.batch = opts.batch || 1; | ||
if (max_bytes) { | ||
const fv = this.nc.protocol.features.get(semver_1.Feature.JS_PULL_MAX_BYTES); | ||
if (!fv.ok) { | ||
throw new Error(`max_bytes is only supported on servers ${fv.min} or better`); | ||
} | ||
args.max_bytes = max_bytes; | ||
} | ||
args.no_wait = opts.no_wait || false; | ||
@@ -167,2 +202,5 @@ if (args.no_wait && args.expires) { | ||
if (m) { | ||
if (trackBytes) { | ||
receivedBytes += m.data.length; | ||
} | ||
received++; | ||
@@ -175,3 +213,4 @@ if (timer && m.info.pending === 0) { | ||
// or there are no more stop the iterator | ||
if (qi.getPending() === 1 && m.info.pending === 0 || wants === received) { | ||
if (qi.getPending() === 1 && m.info.pending === 0 || wants === received || | ||
(max_bytes > 0 && receivedBytes >= max_bytes)) { | ||
qi.stop(); | ||
@@ -193,6 +232,4 @@ } | ||
} | ||
if ((0, error_1.isNatsError)(err) && | ||
(err.code === error_1.ErrorCode.JetStream404NoMessages || | ||
err.code === error_1.ErrorCode.JetStream408RequestTimeout)) { | ||
qi.stop(); | ||
if ((0, error_1.isNatsError)(err)) { | ||
qi.stop(hideNonTerminalJsErrors(err) === null ? undefined : err); | ||
} | ||
@@ -351,2 +388,7 @@ else { | ||
jsi.attached = true; | ||
// if not a durable capture the name of the ephemeral so | ||
// that consumerInfo from the sub will work | ||
if (!jsi.config.durable_name) { | ||
jsi.name = info.name; | ||
} | ||
} | ||
@@ -527,3 +569,3 @@ } | ||
pull(opts = { batch: 1 }) { | ||
var _a; | ||
var _a, _b; | ||
const { stream, config, name } = this.sub.info; | ||
@@ -534,2 +576,9 @@ const consumer = (_a = config.durable_name) !== null && _a !== void 0 ? _a : name; | ||
args.no_wait = opts.no_wait || false; | ||
if (((_b = opts.max_bytes) !== null && _b !== void 0 ? _b : 0) > 0) { | ||
const fv = this.js.nc.protocol.features.get(semver_1.Feature.JS_PULL_MAX_BYTES); | ||
if (!fv.ok) { | ||
throw new Error(`max_bytes is only supported on servers ${fv.min} or better`); | ||
} | ||
args.max_bytes = opts.max_bytes; | ||
} | ||
if (opts.expires && opts.expires > 0) { | ||
@@ -573,13 +622,23 @@ args.expires = (0, jsutil_1.nanos)(opts.expires); | ||
if (ne !== null) { | ||
return [hideNonTerminalJsErrors(ne), null]; | ||
} | ||
// assuming that the protocolFilterFn is set | ||
return [null, (0, jsmsg_1.toJsMsg)(msg)]; | ||
} | ||
function hideNonTerminalJsErrors(ne) { | ||
if (ne !== null) { | ||
switch (ne.code) { | ||
case error_1.ErrorCode.JetStream404NoMessages: | ||
case error_1.ErrorCode.JetStream408RequestTimeout: | ||
return null; | ||
case error_1.ErrorCode.JetStream409: | ||
return [null, null]; | ||
if ((0, jsutil_1.isTerminal409)(ne)) { | ||
return ne; | ||
} | ||
return null; | ||
default: | ||
return [ne, null]; | ||
return ne; | ||
} | ||
} | ||
// assuming that the protocolFilterFn is set | ||
return [null, (0, jsmsg_1.toJsMsg)(msg)]; | ||
return null; | ||
} | ||
@@ -599,6 +658,6 @@ function autoAckJsMsg(data) { | ||
if (lang) { | ||
console.log(`\u001B[33m >> jetstream's materialized views functionality in ${lang} is beta functionality \u001B[0m`); | ||
console.log(`\u001B[33m >> jetstream's materialized views object store functionality in ${lang} is beta functionality \u001B[0m`); | ||
} | ||
else { | ||
console.log(`\u001B[33m >> jetstream's materialized views functionality is beta functionality \u001B[0m`); | ||
console.log(`\u001B[33m >> jetstream's materialized views object store functionality is beta functionality \u001B[0m`); | ||
} | ||
@@ -605,0 +664,0 @@ } |
@@ -49,3 +49,5 @@ import { ConsumerConfig, ConsumerOpts, ConsumerOptsBuilder, JsMsgCallback } from "./types"; | ||
maxPullRequestExpires(millis: number): this; | ||
memory(): this; | ||
numReplicas(n: number): this; | ||
} | ||
export declare function isConsumerOptsBuilder(o: ConsumerOptsBuilder | Partial<ConsumerOpts>): o is ConsumerOptsBuilderImpl; |
@@ -204,2 +204,10 @@ "use strict"; | ||
} | ||
memory() { | ||
this.config.mem_storage = true; | ||
return this; | ||
} | ||
numReplicas(n) { | ||
this.config.num_replicas = n; | ||
return this; | ||
} | ||
} | ||
@@ -206,0 +214,0 @@ exports.ConsumerOptsBuilderImpl = ConsumerOptsBuilderImpl; |
@@ -1,2 +0,2 @@ | ||
import { Advisory, ConsumerAPI, JetStreamAccountStats, JetStreamManager, JetStreamOptions, NatsConnection, StreamAPI } from "./types"; | ||
import { Advisory, ConsumerAPI, DirectStreamAPI, JetStreamAccountStats, JetStreamManager, JetStreamOptions, NatsConnection, StreamAPI } from "./types"; | ||
import { BaseApiClient } from "./jsbaseclient_api"; | ||
@@ -6,2 +6,3 @@ export declare class JetStreamManagerImpl extends BaseApiClient implements JetStreamManager { | ||
consumers: ConsumerAPI; | ||
direct: DirectStreamAPI; | ||
constructor(nc: NatsConnection, opts?: JetStreamOptions); | ||
@@ -8,0 +9,0 @@ getAccountInfo(): Promise<JetStreamAccountStats>; |
"use strict"; | ||
/* | ||
* Copyright 2021 The NATS Authors | ||
* Copyright 2021-2022 The NATS Authors | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -31,2 +31,3 @@ * you may not use this file except in compliance with the License. | ||
const queued_iterator_1 = require("./queued_iterator"); | ||
const jsmdirect_api_1 = require("./jsmdirect_api"); | ||
class JetStreamManagerImpl extends jsbaseclient_api_1.BaseApiClient { | ||
@@ -37,2 +38,3 @@ constructor(nc, opts) { | ||
this.consumers = new jsmconsumer_api_1.ConsumerAPIImpl(nc, opts); | ||
this.direct = new jsmdirect_api_1.DirectStreamAPIImpl(nc, opts); | ||
} | ||
@@ -39,0 +41,0 @@ getAccountInfo() { |
@@ -1,2 +0,2 @@ | ||
import { DeliveryInfo, JsMsg, Msg, NextRequest } from "./types"; | ||
import { DeliveryInfo, JsMsg, Msg, PullOptions } from "./types"; | ||
import { MsgHdrs } from "./headers"; | ||
@@ -25,4 +25,4 @@ export declare const ACK: Uint8Array; | ||
working(): void; | ||
next(subj: string, opts?: Partial<NextRequest>): void; | ||
next(subj: string, opts?: Partial<PullOptions>): void; | ||
term(): void; | ||
} |
"use strict"; | ||
/* | ||
* Copyright 2021 The NATS Authors | ||
* Copyright 2021-2022 The NATS Authors | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -62,5 +62,5 @@ * you may not use this file except in compliance with the License. | ||
(0, jsutil_1.validateStreamName)(name); | ||
const ncfg = cfg; | ||
ncfg.name = name; | ||
const r = yield this._request(`${this.prefix}.STREAM.UPDATE.${name}`, ncfg); | ||
const old = yield this.info(name); | ||
const update = Object.assign(old.config, cfg); | ||
const r = yield this._request(`${this.prefix}.STREAM.UPDATE.${name}`, update); | ||
const si = r; | ||
@@ -141,3 +141,3 @@ this._fixInfo(si); | ||
this.seq = smr.message.seq; | ||
this.time = new Date(smr.message.time); | ||
this.time = new Date(Date.parse(smr.message.time)); | ||
this.data = smr.message.data ? this._parse(smr.message.data) : types_1.Empty; | ||
@@ -144,0 +144,0 @@ if (smr.message.hdrs) { |
@@ -7,7 +7,33 @@ import { ConsumerConfig, Msg, Nanos } from "./types"; | ||
export declare function defaultConsumer(name: string, opts?: Partial<ConsumerConfig>): ConsumerConfig; | ||
/** | ||
* Converts the specified millis into Nanos | ||
* @param millis | ||
*/ | ||
export declare function nanos(millis: number): Nanos; | ||
/** | ||
* Convert the specified Nanos into millis | ||
* @param ns | ||
*/ | ||
export declare function millis(ns: Nanos): number; | ||
/** | ||
* Returns true if the message is a flow control message | ||
* @param msg | ||
*/ | ||
export declare function isFlowControlMsg(msg: Msg): boolean; | ||
/** | ||
* Returns true if the message is a heart beat message | ||
* @param msg | ||
*/ | ||
export declare function isHeartbeatMsg(msg: Msg): boolean; | ||
export declare function checkJsError(msg: Msg): NatsError | null; | ||
export declare enum Js409Errors { | ||
MaxBatchExceeded = "exceeded maxrequestbatch of", | ||
MaxExpiresExceeded = "exceeded maxrequestexpires of", | ||
MaxBytesExceeded = "exceeded maxrequestmaxbytes of", | ||
MaxMessageSizeExceeded = "message size exceeds maxbytes", | ||
PushConsumer = "consumer is push based", | ||
MaxWaitingExceeded = "exceeded maxwaiting" | ||
} | ||
export declare function setMaxWaitingToFail(tf: boolean): void; | ||
export declare function isTerminal409(err: NatsError): boolean; | ||
export declare function checkJsErrorCode(code: number, description?: string): NatsError | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkJsErrorCode = exports.checkJsError = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.millis = exports.nanos = exports.defaultConsumer = exports.validateName = exports.validateStreamName = exports.validateDurableName = void 0; | ||
exports.checkJsErrorCode = exports.isTerminal409 = exports.setMaxWaitingToFail = exports.Js409Errors = exports.checkJsError = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.millis = exports.nanos = exports.defaultConsumer = exports.validateName = exports.validateStreamName = exports.validateDurableName = void 0; | ||
/* | ||
@@ -50,2 +50,6 @@ * Copyright 2021 The NATS Authors | ||
exports.defaultConsumer = defaultConsumer; | ||
/** | ||
* Converts the specified millis into Nanos | ||
* @param millis | ||
*/ | ||
function nanos(millis) { | ||
@@ -55,2 +59,6 @@ return millis * 1000000; | ||
exports.nanos = nanos; | ||
/** | ||
* Convert the specified Nanos into millis | ||
* @param ns | ||
*/ | ||
function millis(ns) { | ||
@@ -60,2 +68,6 @@ return Math.floor(ns / 1000000); | ||
exports.millis = millis; | ||
/** | ||
* Returns true if the message is a flow control message | ||
* @param msg | ||
*/ | ||
function isFlowControlMsg(msg) { | ||
@@ -72,2 +84,6 @@ if (msg.data.length > 0) { | ||
exports.isFlowControlMsg = isFlowControlMsg; | ||
/** | ||
* Returns true if the message is a heart beat message | ||
* @param msg | ||
*/ | ||
function isHeartbeatMsg(msg) { | ||
@@ -87,5 +103,38 @@ var _a; | ||
} | ||
return checkJsErrorCode(h.code, h.status); | ||
return checkJsErrorCode(h.code, h.description); | ||
} | ||
exports.checkJsError = checkJsError; | ||
var Js409Errors; | ||
(function (Js409Errors) { | ||
Js409Errors["MaxBatchExceeded"] = "exceeded maxrequestbatch of"; | ||
Js409Errors["MaxExpiresExceeded"] = "exceeded maxrequestexpires of"; | ||
Js409Errors["MaxBytesExceeded"] = "exceeded maxrequestmaxbytes of"; | ||
Js409Errors["MaxMessageSizeExceeded"] = "message size exceeds maxbytes"; | ||
Js409Errors["PushConsumer"] = "consumer is push based"; | ||
Js409Errors["MaxWaitingExceeded"] = "exceeded maxwaiting"; | ||
})(Js409Errors = exports.Js409Errors || (exports.Js409Errors = {})); | ||
let MAX_WAITING_FAIL = false; | ||
function setMaxWaitingToFail(tf) { | ||
MAX_WAITING_FAIL = tf; | ||
} | ||
exports.setMaxWaitingToFail = setMaxWaitingToFail; | ||
function isTerminal409(err) { | ||
if (err.code !== error_1.ErrorCode.JetStream409) { | ||
return false; | ||
} | ||
const fatal = [ | ||
Js409Errors.MaxBatchExceeded, | ||
Js409Errors.MaxExpiresExceeded, | ||
Js409Errors.MaxBytesExceeded, | ||
Js409Errors.MaxMessageSizeExceeded, | ||
Js409Errors.PushConsumer, | ||
]; | ||
if (MAX_WAITING_FAIL) { | ||
fatal.push(Js409Errors.MaxWaitingExceeded); | ||
} | ||
return fatal.find((s) => { | ||
return err.message.indexOf(s) !== -1; | ||
}) !== undefined; | ||
} | ||
exports.isTerminal409 = isTerminal409; | ||
function checkJsErrorCode(code, description = "") { | ||
@@ -104,3 +153,5 @@ if (code < 300) { | ||
case 409: | ||
// the description can be exceeded max waiting or max ack pending | ||
// the description can be exceeded max waiting or max ack pending, which are | ||
// recoverable, but can also be terminal errors where the request exceeds | ||
// some value in the consumer configuration | ||
return new error_1.NatsError(description, error_1.ErrorCode.JetStream409); | ||
@@ -107,0 +158,0 @@ case 503: |
@@ -17,2 +17,3 @@ import { callbackFn, ConsumerConfig, JetStreamClient, JetStreamManager, JsMsg, KV, KvCodec, KvCodecs, KvEntry, KvOptions, KvPutOptions, KvRemove, KvStatus, PurgeOpts, PurgeResponse, StoredMsg } from "./types"; | ||
bucket: string; | ||
direct: boolean; | ||
codec: KvCodecs; | ||
@@ -19,0 +20,0 @@ _prefixLen: number; |
@@ -165,2 +165,3 @@ "use strict"; | ||
static bind(js, name, opts = {}) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -174,2 +175,3 @@ const jsi = js; | ||
bucket.codec = opts.codec || NoopKvCodecs(); | ||
bucket.direct = (_a = info.config.allow_direct) !== null && _a !== void 0 ? _a : false; | ||
return bucket; | ||
@@ -179,3 +181,3 @@ }); | ||
init(opts = {}) { | ||
var _a; | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -189,5 +191,25 @@ const bo = Object.assign(defaultBucketOpts(), opts); | ||
sc.max_msgs_per_subject = bo.history; | ||
sc.max_bytes = bo.maxBucketSize; | ||
if (bo.maxBucketSize) { | ||
bo.max_bytes = bo.maxBucketSize; | ||
} | ||
if (bo.max_bytes) { | ||
sc.max_bytes = bo.max_bytes; | ||
} | ||
sc.max_msg_size = bo.maxValueSize; | ||
sc.storage = bo.storage; | ||
const location = (_b = opts.placementCluster) !== null && _b !== void 0 ? _b : ""; | ||
if (location) { | ||
opts.placement = {}; | ||
opts.placement.cluster = location; | ||
opts.placement.tags = []; | ||
} | ||
if (opts.placement) { | ||
sc.placement = opts.placement; | ||
} | ||
if (opts.republish) { | ||
sc.republish = opts.republish; | ||
} | ||
if (opts.description) { | ||
sc.description = opts.description; | ||
} | ||
const nci = this.js.nc; | ||
@@ -197,2 +219,5 @@ const have = nci.getServerVersion(); | ||
sc.discard = discardNew ? types_1.DiscardPolicy.New : types_1.DiscardPolicy.Old; | ||
const direct = have ? (0, semver_1.compare)(have, (0, semver_1.parseSemVer)("2.8.5")) >= 0 : false; | ||
sc.allow_direct = opts.allow_direct ? direct : false; | ||
this.direct = sc.allow_direct; | ||
sc.num_replicas = bo.replicas; | ||
@@ -329,4 +354,11 @@ if (bo.ttl) { | ||
} | ||
let sm; | ||
try { | ||
const sm = yield this.jsm.streams.getMessage(this.bucketName(), arg); | ||
if (this.direct) { | ||
const jsmi = this.jsm; | ||
sm = yield jsmi.direct.getMessage(this.bucketName(), arg); | ||
} | ||
else { | ||
sm = yield this.jsm.streams.getMessage(this.bucketName(), arg); | ||
} | ||
const ke = this.smToEntry(sm); | ||
@@ -339,3 +371,3 @@ if (ke.key !== ek) { | ||
catch (err) { | ||
if (err.message === "no message found") { | ||
if (err.code === mod_1.ErrorCode.JetStream404NoMessages) { | ||
return null; | ||
@@ -663,5 +695,7 @@ } | ||
history: si.config.max_msgs_per_subject, | ||
ttl: si.config.max_age, | ||
ttl: (0, jsutil_1.millis)(si.config.max_age), | ||
bucket_location: cluster, | ||
backingStore: si.config.storage, | ||
storage: si.config.storage, | ||
replicas: si.config.num_replicas, | ||
}; | ||
@@ -668,0 +702,0 @@ }); |
@@ -6,3 +6,3 @@ import { Msg } from "./types"; | ||
import { NatsError } from "./error"; | ||
export declare function isRequestError(msg: Msg): (NatsError | null); | ||
export declare function isRequestError(msg: Msg): NatsError | null; | ||
export declare class MsgImpl implements Msg { | ||
@@ -19,3 +19,3 @@ _headers?: MsgHdrs; | ||
get sid(): number; | ||
get headers(): (MsgHdrs | undefined); | ||
get headers(): MsgHdrs | undefined; | ||
get data(): Uint8Array; | ||
@@ -22,0 +22,0 @@ respond(data?: Uint8Array, opts?: { |
@@ -30,3 +30,3 @@ import { ProtocolHandler } from "./protocol"; | ||
status(): AsyncIterable<Status>; | ||
get info(): (ServerInfo | undefined); | ||
get info(): ServerInfo | undefined; | ||
stats(): Stats; | ||
@@ -33,0 +33,0 @@ jetstreamManager(opts?: JetStreamOptions): Promise<JetStreamManager>; |
@@ -160,7 +160,13 @@ "use strict"; | ||
} | ||
// the iterator for user results | ||
const qi = new queued_iterator_1.QueuedIteratorImpl(); | ||
const stop = () => { | ||
qi.stop(); | ||
}; | ||
const callback = (err, msg) => { | ||
function stop() { | ||
//@ts-ignore: stop function | ||
qi.push(() => { | ||
qi.stop(); | ||
}); | ||
} | ||
// callback for the subscription or the mux handler | ||
// simply pushes errors and messages into the iterator | ||
function callback(err, msg) { | ||
if (err || msg === null) { | ||
@@ -171,4 +177,3 @@ // FIXME: the stop function should not require commenting | ||
} | ||
//@ts-ignore: stop function after consuming | ||
qi.push(stop); | ||
stop(); | ||
} | ||
@@ -178,20 +183,111 @@ else { | ||
} | ||
}; | ||
const rmo = opts; | ||
rmo.callback = callback; | ||
qi.iterClosed.then(() => { | ||
r.cancel(); | ||
}).catch((err) => { | ||
r.cancel(err); | ||
}); | ||
const r = new request_1.RequestMany(this.protocol.muxSubscriptions, subject, rmo); | ||
this.protocol.request(r); | ||
try { | ||
this.publish(subject, data, { | ||
reply: `${this.protocol.muxSubscriptions.baseInbox}${r.token}`, | ||
headers: opts.headers, | ||
} | ||
if (opts.noMux) { | ||
// we setup a subscription and manage it | ||
const stack = new Error().stack; | ||
let max = typeof opts.maxMessages === "number" && opts.maxMessages > 0 | ||
? opts.maxMessages | ||
: -1; | ||
const sub = this.subscribe((0, protocol_1.createInbox)(this.options.inboxPrefix), { | ||
callback: (err, msg) => { | ||
var _a; | ||
// we only expect runtime errors or a no responders | ||
if (msg.data.length === 0 && | ||
((_a = msg === null || msg === void 0 ? void 0 : msg.headers) === null || _a === void 0 ? void 0 : _a.status) === error_1.ErrorCode.NoResponders) { | ||
err = error_1.NatsError.errorForCode(error_1.ErrorCode.NoResponders); | ||
} | ||
// augment any error with the current stack to provide context | ||
// for the error on the suer code | ||
if (err) { | ||
err.stack += `\n\n${stack}`; | ||
cancel(err); | ||
return; | ||
} | ||
// push the message | ||
callback(null, msg); | ||
// see if the m request is completed | ||
if (opts.strategy === types_1.RequestStrategy.Count) { | ||
max--; | ||
if (max === 0) { | ||
cancel(); | ||
} | ||
} | ||
if (opts.strategy === types_1.RequestStrategy.JitterTimer) { | ||
clearTimers(); | ||
timer = setTimeout(() => { | ||
cancel(); | ||
}, 300); | ||
} | ||
if (opts.strategy === types_1.RequestStrategy.SentinelMsg) { | ||
if (msg && msg.data.length === 0) { | ||
cancel(); | ||
} | ||
} | ||
}, | ||
}); | ||
sub.closed | ||
.then(() => { | ||
stop(); | ||
}) | ||
.catch((err) => { | ||
qi.push(err); | ||
stop(); | ||
}); | ||
const cancel = (err) => { | ||
if (err) { | ||
qi.push(err); | ||
} | ||
clearTimers(); | ||
sub.drain() | ||
.then(() => { | ||
stop(); | ||
}) | ||
.catch((_err) => { | ||
stop(); | ||
}); | ||
}; | ||
qi.iterClosed | ||
.then(() => { | ||
clearTimers(); | ||
sub === null || sub === void 0 ? void 0 : sub.unsubscribe(); | ||
}) | ||
.catch((_err) => { | ||
clearTimers(); | ||
sub === null || sub === void 0 ? void 0 : sub.unsubscribe(); | ||
}); | ||
try { | ||
this.publish(subject, types_1.Empty, { reply: sub.getSubject() }); | ||
} | ||
catch (err) { | ||
cancel(err); | ||
} | ||
let timer = setTimeout(() => { | ||
cancel(); | ||
}, opts.maxWait); | ||
const clearTimers = () => { | ||
if (timer) { | ||
clearTimeout(timer); | ||
} | ||
}; | ||
} | ||
catch (err) { | ||
r.cancel(err); | ||
else { | ||
// the ingestion is the RequestMany | ||
const rmo = opts; | ||
rmo.callback = callback; | ||
qi.iterClosed.then(() => { | ||
r.cancel(); | ||
}).catch((err) => { | ||
r.cancel(err); | ||
}); | ||
const r = new request_1.RequestMany(this.protocol.muxSubscriptions, subject, rmo); | ||
this.protocol.request(r); | ||
try { | ||
this.publish(subject, data, { | ||
reply: `${this.protocol.muxSubscriptions.baseInbox}${r.token}`, | ||
headers: opts.headers, | ||
}); | ||
} | ||
catch (err) { | ||
r.cancel(err); | ||
} | ||
} | ||
@@ -198,0 +294,0 @@ return Promise.resolve(qi); |
@@ -26,21 +26,15 @@ /* | ||
const totalLen = preLen + seqLen; | ||
const cryptoObj = initCrypto(); | ||
function initCrypto() { | ||
let cryptoObj = null; | ||
if (typeof globalThis !== "undefined") { | ||
if ("crypto" in globalThis && globalThis.crypto.getRandomValues) { | ||
cryptoObj = globalThis.crypto; | ||
} | ||
function _getRandomValues(a) { | ||
for (let i = 0; i < a.length; i++) { | ||
a[i] = Math.floor(Math.random() * 255); | ||
} | ||
if (!cryptoObj) { | ||
// shim it | ||
cryptoObj = { | ||
getRandomValues: function (array) { | ||
for (let i = 0; i < array.length; i++) { | ||
array[i] = Math.floor(Math.random() * 255); | ||
} | ||
}, | ||
}; | ||
} | ||
function fillRandom(a) { | ||
var _a; | ||
if ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.getRandomValues) { | ||
globalThis.crypto.getRandomValues(a); | ||
} | ||
return cryptoObj; | ||
else { | ||
_getRandomValues(a); | ||
} | ||
} | ||
@@ -84,3 +78,3 @@ /** | ||
const cbuf = new Uint8Array(preLen); | ||
cryptoObj.getRandomValues(cbuf); | ||
fillRandom(cbuf); | ||
for (let i = 0; i < preLen; i++) { | ||
@@ -87,0 +81,0 @@ const di = cbuf[i] % base; |
@@ -101,7 +101,8 @@ "use strict"; | ||
function checkOptions(info, options) { | ||
const { proto, tls_required: tlsRequired } = info; | ||
const { proto, tls_required: tlsRequired, tls_available: tlsAvailable } = info; | ||
if ((proto === undefined || proto < 1) && options.noEcho) { | ||
throw new error_1.NatsError("noEcho", error_1.ErrorCode.ServerOptionNotAvailable); | ||
} | ||
if (options.tls && !tlsRequired) { | ||
const tls = tlsRequired || tlsAvailable || false; | ||
if (options.tls && !tls) { | ||
throw new error_1.NatsError("tls", error_1.ErrorCode.ServerOptionNotAvailable); | ||
@@ -108,0 +109,0 @@ } |
@@ -15,2 +15,3 @@ import { ConnectionOptions, PublishOptions, Server, ServerInfo, Status, Subscription } from "./types"; | ||
import { MsgArg, Parser, ParserEvent } from "./parser"; | ||
import { Features } from "./semver"; | ||
export declare const INFO: RegExp; | ||
@@ -74,2 +75,3 @@ export declare function createInbox(prefix?: string): string; | ||
server: ServerImpl; | ||
features: Features; | ||
constructor(options: ConnectionOptions, publisher: Publisher); | ||
@@ -95,3 +97,3 @@ resetOutbound(): void; | ||
push(e: ParserEvent): void; | ||
sendCommand(cmd: (string | Uint8Array), ...payloads: Uint8Array[]): void; | ||
sendCommand(cmd: string | Uint8Array, ...payloads: Uint8Array[]): void; | ||
publish(subject: string, data: Uint8Array, options?: PublishOptions): void; | ||
@@ -98,0 +100,0 @@ request(r: Request): Request; |
@@ -49,2 +49,3 @@ "use strict"; | ||
const encoders_1 = require("./encoders"); | ||
const semver_1 = require("./semver"); | ||
const FLUSH_THRESHOLD = 1024 * 32; | ||
@@ -99,2 +100,3 @@ exports.INFO = /^INFO\s+([^\r\n]+)\r\n/i; | ||
this.pendingLimit = options.pendingLimit || this.pendingLimit; | ||
this.features = new semver_1.Features({ major: 0, minor: 0, micro: 0 }); | ||
const servers = typeof options.servers === "string" | ||
@@ -413,2 +415,3 @@ ? [options.servers] | ||
if (!this.infoReceived) { | ||
this.features = new semver_1.Features((0, semver_1.parseSemVer)(info.version)); | ||
this.infoReceived = true; | ||
@@ -415,0 +418,0 @@ if (this.transport.isEncrypted()) { |
@@ -8,1 +8,18 @@ export declare type SemVer = { | ||
export declare function compare(a: SemVer, b: SemVer): number; | ||
export declare enum Feature { | ||
JS_PULL_MAX_BYTES = "js_pull_max_bytes" | ||
} | ||
declare type FeatureVersion = { | ||
ok: boolean; | ||
min: string; | ||
}; | ||
export declare class Features { | ||
server: SemVer; | ||
features: Map<Feature, FeatureVersion>; | ||
constructor(v: SemVer); | ||
set(f: Feature, requires: string): void; | ||
get(f: Feature): FeatureVersion; | ||
supports(f: Feature): boolean; | ||
require(v: SemVer | string): boolean; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.compare = exports.parseSemVer = void 0; | ||
exports.Features = exports.Feature = exports.compare = exports.parseSemVer = void 0; | ||
function parseSemVer(s) { | ||
@@ -32,2 +32,32 @@ const m = s.match(/(\d+).(\d+).(\d+)/); | ||
exports.compare = compare; | ||
var Feature; | ||
(function (Feature) { | ||
Feature["JS_PULL_MAX_BYTES"] = "js_pull_max_bytes"; | ||
})(Feature = exports.Feature || (exports.Feature = {})); | ||
class Features { | ||
constructor(v) { | ||
this.features = new Map(); | ||
this.server = v; | ||
this.set(Feature.JS_PULL_MAX_BYTES, "2.8.3"); | ||
} | ||
set(f, requires) { | ||
this.features.set(f, { | ||
min: requires, | ||
ok: compare(this.server, parseSemVer(requires)) >= 0, | ||
}); | ||
} | ||
get(f) { | ||
return this.features.get(f) || { min: "unknown", ok: false }; | ||
} | ||
supports(f) { | ||
return this.get(f).ok; | ||
} | ||
require(v) { | ||
if (typeof v === "string") { | ||
v = parseSemVer(v); | ||
} | ||
return compare(this.server, v) >= 0; | ||
} | ||
} | ||
exports.Features = Features; | ||
//# sourceMappingURL=semver.js.map |
@@ -112,6 +112,6 @@ "use strict"; | ||
if (this.protocol.isClosed()) { | ||
throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); | ||
return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed)); | ||
} | ||
if (this.isClosed()) { | ||
throw error_1.NatsError.errorForCode(error_1.ErrorCode.SubClosed); | ||
return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.SubClosed)); | ||
} | ||
@@ -118,0 +118,0 @@ if (!this.drained) { |
@@ -12,3 +12,3 @@ import type { SubscriptionImpl } from "./subscription"; | ||
getMux(): SubscriptionImpl | null; | ||
get(sid: number): (SubscriptionImpl | undefined); | ||
get(sid: number): SubscriptionImpl | undefined; | ||
resub(s: SubscriptionImpl): SubscriptionImpl; | ||
@@ -15,0 +15,0 @@ all(): (SubscriptionImpl)[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.JsHeaders = exports.ReplayPolicy = exports.AckPolicy = exports.DeliverPolicy = exports.StorageType = exports.DiscardPolicy = exports.RetentionPolicy = exports.AdvisoryKind = exports.RequestStrategy = 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.RepublishHeaders = exports.DirectMsgHeaders = exports.JsHeaders = exports.ReplayPolicy = exports.AckPolicy = exports.DeliverPolicy = exports.StorageType = exports.DiscardPolicy = exports.RetentionPolicy = exports.AdvisoryKind = exports.RequestStrategy = 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); | ||
/** | ||
* Events reported by the {@link NatsConnection.status} iterator. | ||
*/ | ||
var Events; | ||
(function (Events) { | ||
/** Client disconnected */ | ||
Events["Disconnect"] = "disconnect"; | ||
/** Client reconnected */ | ||
Events["Reconnect"] = "reconnect"; | ||
/** Client received a cluster update */ | ||
Events["Update"] = "update"; | ||
/** Client received a signal telling it that the server is transitioning to Lame Duck Mode */ | ||
Events["LDM"] = "ldm"; | ||
/** Client received an async error from the server */ | ||
Events["Error"] = "error"; | ||
})(Events = exports.Events || (exports.Events = {})); | ||
/** | ||
* Other events that can be reported by the {@link NatsConnection.status} iterator. | ||
* These can usually be safely ignored, as higher-order functionality of the client | ||
* will handle them. | ||
*/ | ||
var DebugEvents; | ||
@@ -36,2 +49,5 @@ (function (DebugEvents) { | ||
})(RequestStrategy = exports.RequestStrategy || (exports.RequestStrategy = {})); | ||
/** | ||
* The different kinds of Advisories | ||
*/ | ||
var AdvisoryKind; | ||
@@ -56,4 +72,13 @@ (function (AdvisoryKind) { | ||
(function (RetentionPolicy) { | ||
/** | ||
* Retain messages until the limits are reached, then trigger the discard policy. | ||
*/ | ||
RetentionPolicy["Limits"] = "limits"; | ||
/** | ||
* Retain messages while there is consumer interest on the particular subject. | ||
*/ | ||
RetentionPolicy["Interest"] = "interest"; | ||
/** | ||
* Retain messages until acknowledged | ||
*/ | ||
RetentionPolicy["Workqueue"] = "workqueue"; | ||
@@ -63,3 +88,9 @@ })(RetentionPolicy = exports.RetentionPolicy || (exports.RetentionPolicy = {})); | ||
(function (DiscardPolicy) { | ||
/** | ||
* Discard old messages to make room for the new ones | ||
*/ | ||
DiscardPolicy["Old"] = "old"; | ||
/** | ||
* Discard the new messages | ||
*/ | ||
DiscardPolicy["New"] = "new"; | ||
@@ -69,3 +100,9 @@ })(DiscardPolicy = exports.DiscardPolicy || (exports.DiscardPolicy = {})); | ||
(function (StorageType) { | ||
/** | ||
* Store persistently on files | ||
*/ | ||
StorageType["File"] = "file"; | ||
/** | ||
* Store in server memory - doesn't survive server restarts | ||
*/ | ||
StorageType["Memory"] = "memory"; | ||
@@ -75,7 +112,25 @@ })(StorageType = exports.StorageType || (exports.StorageType = {})); | ||
(function (DeliverPolicy) { | ||
/** | ||
* Deliver all messages | ||
*/ | ||
DeliverPolicy["All"] = "all"; | ||
/** | ||
* Deliver starting with the last message | ||
*/ | ||
DeliverPolicy["Last"] = "last"; | ||
/** | ||
* Deliver starting with new messages | ||
*/ | ||
DeliverPolicy["New"] = "new"; | ||
/** | ||
* Deliver starting with the specified sequence | ||
*/ | ||
DeliverPolicy["StartSequence"] = "by_start_sequence"; | ||
/** | ||
* Deliver starting with the specified time | ||
*/ | ||
DeliverPolicy["StartTime"] = "by_start_time"; | ||
/** | ||
* Deliver starting with the last messages for every subject | ||
*/ | ||
DeliverPolicy["LastPerSubject"] = "last_per_subject"; | ||
@@ -85,5 +140,17 @@ })(DeliverPolicy = exports.DeliverPolicy || (exports.DeliverPolicy = {})); | ||
(function (AckPolicy) { | ||
/** | ||
* Messages don't need to be Ack'ed. | ||
*/ | ||
AckPolicy["None"] = "none"; | ||
/** | ||
* Ack, acknowledges all messages with a lower sequence | ||
*/ | ||
AckPolicy["All"] = "all"; | ||
/** | ||
* All sequences must be explicitly acknowledged | ||
*/ | ||
AckPolicy["Explicit"] = "explicit"; | ||
/** | ||
* @ignore | ||
*/ | ||
AckPolicy["NotSet"] = ""; | ||
@@ -93,3 +160,9 @@ })(AckPolicy = exports.AckPolicy || (exports.AckPolicy = {})); | ||
(function (ReplayPolicy) { | ||
/** | ||
* Replays messages as fast as possible | ||
*/ | ||
ReplayPolicy["Instant"] = "instant"; | ||
/** | ||
* Replays messages following the original delay between messages | ||
*/ | ||
ReplayPolicy["Original"] = "original"; | ||
@@ -99,11 +172,21 @@ })(ReplayPolicy = exports.ReplayPolicy || (exports.ReplayPolicy = {})); | ||
(function (JsHeaders) { | ||
// set if message coming from a stream source format is `stream seq` | ||
/** | ||
* Set if message is from a stream source - format is `stream seq` | ||
*/ | ||
JsHeaders["StreamSourceHdr"] = "Nats-Stream-Source"; | ||
// set for heartbeat messages | ||
/** | ||
* Set for heartbeat messages | ||
*/ | ||
JsHeaders["LastConsumerSeqHdr"] = "Nats-Last-Consumer"; | ||
// set for heartbeat messages | ||
/** | ||
* Set for heartbeat messages | ||
*/ | ||
JsHeaders["LastStreamSeqHdr"] = "Nats-Last-Stream"; | ||
// set for heartbeat messages if stalled | ||
/** | ||
* Set for heartbeat messages if the consumer is stalled | ||
*/ | ||
JsHeaders["ConsumerStalledHdr"] = "Nats-Consumer-Stalled"; | ||
// set for headers_only consumers indicates number | ||
/** | ||
* Set for headers_only consumers indicates the number of bytes in the payload | ||
*/ | ||
JsHeaders["MessageSizeHdr"] = "Nats-Msg-Size"; | ||
@@ -117,2 +200,32 @@ // rollup header | ||
})(JsHeaders = exports.JsHeaders || (exports.JsHeaders = {})); | ||
var DirectMsgHeaders; | ||
(function (DirectMsgHeaders) { | ||
DirectMsgHeaders["Stream"] = "Nats-Stream"; | ||
DirectMsgHeaders["Sequence"] = "Nats-Sequence"; | ||
DirectMsgHeaders["TimeStamp"] = "Nats-Time-Stamp"; | ||
DirectMsgHeaders["Subject"] = "Nats-Subject"; | ||
})(DirectMsgHeaders = exports.DirectMsgHeaders || (exports.DirectMsgHeaders = {})); | ||
var RepublishHeaders; | ||
(function (RepublishHeaders) { | ||
/** | ||
* The source stream of the message | ||
*/ | ||
RepublishHeaders["Stream"] = "Nats-Stream"; | ||
/** | ||
* The original subject of the message | ||
*/ | ||
RepublishHeaders["Subject"] = "Nats-Subject"; | ||
/** | ||
* The sequence of the republished message | ||
*/ | ||
RepublishHeaders["Sequence"] = "Nats-Sequence"; | ||
/** | ||
* The stream sequence id of the last message ingested to the same original subject (or 0 if none or deleted) | ||
*/ | ||
RepublishHeaders["LastSequence"] = "Nats-Last-Sequence"; | ||
/** | ||
* The size in bytes of the message's body - Only if {@link Republish.headers_only} is set. | ||
*/ | ||
RepublishHeaders["Size"] = "Nats-Msg-Size"; | ||
})(RepublishHeaders = exports.RepublishHeaders || (exports.RepublishHeaders = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -28,5 +28,17 @@ import { QueuedIterator } from "./queued_iterator"; | ||
export interface Deferred<T> extends Promise<T> { | ||
/** | ||
* Resolves the Deferred to a value T | ||
* @param value | ||
*/ | ||
resolve: (value?: T | PromiseLike<T>) => void; | ||
/** | ||
* Rejects the Deferred | ||
* @param reason | ||
*/ | ||
reject: (reason?: any) => void; | ||
} | ||
/** | ||
* Returns a Promise that has a resolve/reject methods that can | ||
* be used to resolve and defer the Deferred. | ||
*/ | ||
export declare function deferred<T>(): Deferred<T>; | ||
@@ -33,0 +45,0 @@ export declare function shuffle<T>(a: T[]): T[]; |
@@ -115,2 +115,6 @@ "use strict"; | ||
exports.delay = delay; | ||
/** | ||
* Returns a Promise that has a resolve/reject methods that can | ||
* be used to resolve and defer the Deferred. | ||
*/ | ||
function deferred() { | ||
@@ -117,0 +121,0 @@ let methods = {}; |
@@ -19,3 +19,3 @@ "use strict"; | ||
/* | ||
* Copyright 2020 The NATS Authors | ||
* Copyright 2020-2022 The NATS Authors | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -38,2 +38,10 @@ * you may not use this file except in compliance with the License. | ||
} | ||
if (typeof globalThis.crypto === "undefined") { | ||
const c = require("crypto"); | ||
global.crypto = c.webcrypto; | ||
} | ||
if (typeof globalThis.ReadableStream === "undefined") { | ||
const streams = require("web-streams-polyfill/ponyfill"); | ||
global.ReadableStream = streams.ReadableStream; | ||
} | ||
var connect_1 = require("./connect"); | ||
@@ -40,0 +48,0 @@ Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connect_1.connect; } }); |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Deferred, ServerInfo, Transport } from "./nats-base-client"; | ||
@@ -3,0 +5,0 @@ import type { ConnectionOptions } from "./nats-base-client"; |
@@ -46,3 +46,3 @@ "use strict"; | ||
const dns = require("dns"); | ||
const VERSION = "2.7.1"; | ||
const VERSION = "2.8.0"; | ||
const LANG = "nats.js"; | ||
@@ -68,4 +68,5 @@ class NodeTransport { | ||
(0, nats_base_client_1.checkOptions)(info, options); | ||
const { tls_required: tlsRequired } = info; | ||
if (tlsRequired) { | ||
const { tls_required: tlsRequired, tls_available: tlsAvailable } = info; | ||
const desired = tlsAvailable === true && options.tls !== null; | ||
if (tlsRequired || desired) { | ||
this.socket = yield this.startTLS(); | ||
@@ -72,0 +73,0 @@ } |
{ | ||
"name": "nats", | ||
"version": "2.7.1", | ||
"version": "2.8.0", | ||
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"clean": "shx rm -Rf ./lib/* ./nats-base-client ./.deps", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.7.1 https://github.com/nats-io/nats.deno.git", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.8.0 https://github.com/nats-io/nats.deno.git", | ||
"fmt": "deno fmt ./src/ ./examples/ ./test/", | ||
@@ -61,13 +61,14 @@ "prepack": "npm run clone-nbc && npm run cjs && npm run check-package && npm run build", | ||
"dependencies": { | ||
"nkeys.js": "^1.0.0-9" | ||
"nkeys.js": "1.0.3", | ||
"web-streams-polyfill": "^3.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.27", | ||
"@types/node": "^18.0.0", | ||
"ava": "^4.2.0", | ||
"minimist": "^1.2.5", | ||
"nats-jwt": "^0.0.1", | ||
"nats-jwt": "^0.0.3-1", | ||
"nyc": "^15.1.0", | ||
"shx": "^0.3.3", | ||
"tslint": "^6.1.3", | ||
"typescript": "^4.1.3" | ||
"typescript": "^4.7.x" | ||
}, | ||
@@ -74,0 +75,0 @@ "typings": "./lib/src/mod.d.ts", |
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
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 too big to display
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
817525
154
14067
2
+ Addedweb-streams-polyfill@^3.2.1
+ Addednkeys.js@1.0.3(transitive)
+ Addedweb-streams-polyfill@3.3.3(transitive)
- Removednkeys.js@1.1.0(transitive)
Updatednkeys.js@1.0.3