Skip to content

Commit

Permalink
reference new moduled jetstream (#572)
Browse files Browse the repository at this point in the history
* [FIX] changes to match internals from js-module
  • Loading branch information
aricart committed May 30, 2023
1 parent 68732b4 commit 404ff95
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nats",
"version": "2.15.0",
"version": "2.15.0-0",
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system",
"keywords": [
"nats",
Expand Down Expand Up @@ -38,7 +38,7 @@
],
"scripts": {
"build": "tsc",
"cjs": "deno run --allow-all bin/cjs-fix-imports.ts -o nats-base-client/ ./.deps/nats.deno/nats-base-client/",
"cjs": "deno run --allow-all bin/cjs-fix-imports.ts -o nats-base-client/ ./.deps/nats.deno/nats-base-client/ && deno run --allow-all bin/cjs-fix-imports.ts -o jetstream/ ./.deps/nats.deno/jetstream/",
"clean": "shx rm -Rf ./lib/* ./nats-base-client ./.deps",
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch dev https://github.com/nats-io/nats.deno.git",
"fmt": "deno fmt ./src/ ./examples/ ./test/",
Expand Down
2 changes: 1 addition & 1 deletion src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ if (typeof globalThis.ReadableStream === "undefined") {
}

export { connect } from "./connect";
export * from "../nats-base-client/mod";
export * from "./nats-base-client";
1 change: 1 addition & 0 deletions src/nats-base-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
* limitations under the License.
*/
export * from "../nats-base-client/internal_mod";
export * from "../jetstream/internal_mod";
4 changes: 2 additions & 2 deletions src/node_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { resolve } = require("path");
const { readFile, existsSync } = require("fs");
const dns = require("dns");

const VERSION = "2.15.0";
const VERSION = "2.15.0-0";
const LANG = "nats.js";

export class NodeTransport implements Transport {
Expand Down Expand Up @@ -270,7 +270,7 @@ export class NodeTransport implements Transport {
});

this.socket.on("end", () => {
if(this.socket?.destroyed) {
if (this.socket?.destroyed) {
return;
}
this.socket?.write(new Uint8Array(0), () => {
Expand Down
16 changes: 11 additions & 5 deletions test/jetstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@
* limitations under the License.
*/
const test = require("ava");
const { connect, Empty, headers, nuid, StringCodec } = require(
const {
connect,
Empty,
headers,
nuid,
StringCodec,
AckPolicy,
consumerOpts,
} = require(
"../",
);
const { AckPolicy } = require("../lib/nats-base-client/types");
const { consumerOpts } = require("../lib/nats-base-client/jsconsumeropts");
const { delay } = require("../lib/nats-base-client/internal_mod");

const { delay, DataBuffer } = require("../lib/nats-base-client/internal_mod");
const { NatsServer } = require("./helpers/launcher");
const { jetstreamServerConf } = require("./helpers/jsutil");
const { DataBuffer } = require("../lib/nats-base-client/databuffer");
const { setTimeout } = require("timers");

test("jetstream - jsm", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion test/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const { resolve, join } = require("path");
const { readFileSync } = require("fs");
const { Lock } = require("./helpers/lock");
const { NatsServer } = require("./helpers/launcher");
const { buildAuthenticator } = require("../lib/nats-base-client/authenticator");
const { buildAuthenticator } = require("../lib/src/mod");
const { extend } = require("../lib/nats-base-client/util");
const { Connect } = require("../lib/nats-base-client/protocol");

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"removeComments": false
},
"include": [
"src"
"src",
],
"exclude": [
"test/**/*",
Expand Down

0 comments on commit 404ff95

Please sign in to comment.