Comparing version 2.12.0 to 2.12.1
@@ -404,3 +404,30 @@ "use strict"; | ||
create(k, data) { | ||
return this.put(k, data, { previousSeq: 0 }); | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let firstErr; | ||
try { | ||
const n = yield this.put(k, data, { previousSeq: 0 }); | ||
return Promise.resolve(n); | ||
} | ||
catch (err) { | ||
firstErr = err; | ||
if (((_a = err === null || err === void 0 ? void 0 : err.api_error) === null || _a === void 0 ? void 0 : _a.err_code) !== 10071) { | ||
return Promise.reject(err); | ||
} | ||
} | ||
let rev = 0; | ||
try { | ||
const e = yield this.get(k); | ||
if ((e === null || e === void 0 ? void 0 : e.operation) === "DEL" || (e === null || e === void 0 ? void 0 : e.operation) === "PURGE") { | ||
rev = e !== null ? e.revision : 0; | ||
return this.update(k, data, rev); | ||
} | ||
else { | ||
return Promise.reject(firstErr); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
@@ -407,0 +434,0 @@ update(k, data, version) { |
@@ -39,7 +39,16 @@ "use strict"; | ||
const c = require("crypto"); | ||
// this will patch to undefined if webcrypto is not available (node 14) | ||
// views will toss if crypto is not available | ||
global.crypto = c.webcrypto; | ||
} | ||
if (typeof globalThis.ReadableStream === "undefined") { | ||
const streams = require("web-streams-polyfill/ponyfill"); | ||
global.ReadableStream = streams.ReadableStream; | ||
// @ts-ignore: node global | ||
const chunks = process.versions.node.split("."); | ||
const v = parseInt(chunks[0]); | ||
if (v >= 16) { | ||
// this won't mess up fetch | ||
const streams = require("stream/web"); | ||
// views will toss if ReadableStream is not available | ||
global.ReadableStream = streams.ReadableStream; | ||
} | ||
} | ||
@@ -46,0 +55,0 @@ var connect_1 = require("./connect"); |
@@ -46,3 +46,3 @@ "use strict"; | ||
const dns = require("dns"); | ||
const VERSION = "2.12.0"; | ||
const VERSION = "2.12.1"; | ||
const LANG = "nats.js"; | ||
@@ -49,0 +49,0 @@ class NodeTransport { |
{ | ||
"name": "nats", | ||
"version": "2.12.0", | ||
"version": "2.12.1", | ||
"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.12.0 https://github.com/nats-io/nats.deno.git", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.12.1 https://github.com/nats-io/nats.deno.git", | ||
"fmt": "deno fmt ./src/ ./examples/ ./test/", | ||
@@ -61,4 +61,3 @@ "prepack": "npm run clone-nbc && npm run cjs && npm run check-package && npm run build", | ||
"dependencies": { | ||
"nkeys.js": "1.0.5", | ||
"web-streams-polyfill": "^3.2.1" | ||
"nkeys.js": "1.0.5" | ||
}, | ||
@@ -65,0 +64,0 @@ "devDependencies": { |
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
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
949622
1
16378
- Removedweb-streams-polyfill@^3.2.1
- Removedweb-streams-polyfill@3.3.3(transitive)