Comparing version 2.0.2 to 2.0.3-1
@@ -34,3 +34,3 @@ "use strict"; | ||
function defaultJsOptions(opts) { | ||
opts = opts !== null && opts !== void 0 ? opts : {}; | ||
opts = opts || {}; | ||
return util_1.extend({ apiPrefix: defaultPrefix, timeout: defaultTimeout }, opts); | ||
@@ -37,0 +37,0 @@ } |
@@ -52,7 +52,6 @@ "use strict"; | ||
publish(subj, data = types_1.Empty, opts) { | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
opts = opts !== null && opts !== void 0 ? opts : {}; | ||
opts.expect = (_a = opts.expect) !== null && _a !== void 0 ? _a : {}; | ||
const mh = (_b = opts === null || opts === void 0 ? void 0 : opts.headers) !== null && _b !== void 0 ? _b : headers_1.headers(); | ||
opts = opts || {}; | ||
opts.expect = opts.expect || {}; | ||
const mh = (opts === null || opts === void 0 ? void 0 : opts.headers) || headers_1.headers(); | ||
if (opts) { | ||
@@ -72,3 +71,3 @@ if (opts.msgID) { | ||
} | ||
const to = (_c = opts.timeout) !== null && _c !== void 0 ? _c : this.timeout; | ||
const to = opts.timeout || this.timeout; | ||
const ro = {}; | ||
@@ -94,5 +93,3 @@ if (to) { | ||
jsutil_1.validateDurableName(durable); | ||
const msg = yield this.nc.request( | ||
// FIXME: specify expires | ||
`${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`, this.jc.encode({ no_wait: true, batch: 1, expires: jsutil_1.nanos(this.timeout) }), { noMux: true, timeout: this.timeout }); | ||
const msg = yield this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`, this.jc.encode({ no_wait: true, batch: 1, expires: jsutil_1.nanos(this.timeout) }), { noMux: true, timeout: this.timeout }); | ||
const err = jsutil_1.checkJsError(msg); | ||
@@ -115,3 +112,2 @@ if (err) { | ||
fetch(stream, durable, opts = {}) { | ||
var _a, _b, _c; | ||
jsutil_1.validateStreamName(stream); | ||
@@ -121,5 +117,5 @@ jsutil_1.validateDurableName(durable); | ||
const args = {}; | ||
args.batch = (_a = opts.batch) !== null && _a !== void 0 ? _a : 1; | ||
args.no_wait = (_b = opts.no_wait) !== null && _b !== void 0 ? _b : false; | ||
const expires = (_c = opts.expires) !== null && _c !== void 0 ? _c : 0; | ||
args.batch = opts.batch || 1; | ||
args.no_wait = opts.no_wait || false; | ||
const expires = opts.expires || 0; | ||
if (expires) { | ||
@@ -245,3 +241,2 @@ args.expires = jsutil_1.nanos(expires); | ||
_processOptions(subject, opts = jsconsumeropts_1.consumerOpts()) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -252,3 +247,3 @@ const jsi = (jsconsumeropts_1.isConsumerOptsBuilder(opts) | ||
jsi.api = this; | ||
jsi.config = (_a = jsi.config) !== null && _a !== void 0 ? _a : {}; | ||
jsi.config = jsi.config || {}; | ||
jsi.stream = jsi.stream ? jsi.stream : yield this.findStream(subject); | ||
@@ -279,3 +274,4 @@ jsi.attached = false; | ||
} | ||
jsi.deliver = (_b = jsi.config.deliver_subject) !== null && _b !== void 0 ? _b : protocol_1.createInbox(this.nc.options.inboxPrefix); | ||
jsi.deliver = jsi.config.deliver_subject || | ||
protocol_1.createInbox(this.nc.options.inboxPrefix); | ||
return jsi; | ||
@@ -285,3 +281,2 @@ }); | ||
_buildTypedSubscriptionOpts(jsi) { | ||
var _a; | ||
const so = {}; | ||
@@ -295,3 +290,3 @@ so.adapter = msgAdapter(jsi.callbackFn === undefined); | ||
} | ||
so.max = (_a = jsi.max) !== null && _a !== void 0 ? _a : 0; | ||
so.max = jsi.max || 0; | ||
return so; | ||
@@ -328,3 +323,2 @@ } | ||
destroy() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -335,3 +329,3 @@ if (!this.isClosed()) { | ||
const jinfo = this.sub.info; | ||
const name = (_a = jinfo.config.durable_name) !== null && _a !== void 0 ? _a : jinfo.name; | ||
const name = jinfo.config.durable_name || jinfo.name; | ||
const subj = `${jinfo.api.prefix}.CONSUMER.DELETE.${jinfo.stream}.${name}`; | ||
@@ -342,6 +336,5 @@ yield jinfo.api._request(subj); | ||
consumerInfo() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const jinfo = this.sub.info; | ||
const name = (_a = jinfo.config.durable_name) !== null && _a !== void 0 ? _a : jinfo.name; | ||
const name = jinfo.config.durable_name || jinfo.name; | ||
const subj = `${jinfo.api.prefix}.CONSUMER.INFO.${jinfo.stream}.${name}`; | ||
@@ -357,8 +350,7 @@ return yield jinfo.api._request(subj); | ||
pull(opts = { batch: 1 }) { | ||
var _a, _b; | ||
const { stream, config } = this.sub.info; | ||
const consumer = config.durable_name; | ||
const args = {}; | ||
args.batch = (_a = opts.batch) !== null && _a !== void 0 ? _a : 1; | ||
args.no_wait = (_b = opts.no_wait) !== null && _b !== void 0 ? _b : false; | ||
args.batch = opts.batch || 1; | ||
args.no_wait = opts.no_wait || false; | ||
// FIXME: this is nanos | ||
@@ -365,0 +357,0 @@ if (opts.expires && opts.expires > 0) { |
@@ -70,4 +70,3 @@ "use strict"; | ||
get reply() { | ||
var _a; | ||
return (_a = this.msg.reply) !== null && _a !== void 0 ? _a : ""; | ||
return this.msg.reply || ""; | ||
} | ||
@@ -74,0 +73,0 @@ get seq() { |
@@ -40,2 +40,5 @@ "use strict"; | ||
this.stop(err); | ||
if (this.noIterator) { | ||
this.callback(err, {}); | ||
} | ||
}); | ||
@@ -42,0 +45,0 @@ } |
@@ -45,3 +45,3 @@ "use strict"; | ||
const { readFile, existsSync } = require("fs"); | ||
const VERSION = "2.0.2"; | ||
const VERSION = "2.0.3-1"; | ||
const LANG = "nats.js"; | ||
@@ -48,0 +48,0 @@ class NodeTransport { |
{ | ||
"name": "nats", | ||
"version": "2.0.2", | ||
"version": "2.0.3-1", | ||
"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.2 https://github.com/nats-io/nats.deno.git", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch sub-timeouts 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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
532311
8912
1