Skip to content

Commit

Permalink
[REFACTOR] moved content into transport-deno in preparation of monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Jul 8, 2024
1 parent 661876f commit 88b455f
Show file tree
Hide file tree
Showing 52 changed files with 125 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .gitignore → transport-node/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.deps/
.DS_Store
.idea
../.idea
.nyc_output/
benchmark/
coverage/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md → transport-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A Node.js client for the [NATS messaging system](https://nats.io).

[![License](https://img.shields.io/badge/Licence-Apache%202.0-blue.svg)](./LICENSE)
[![License](https://img.shields.io/badge/Licence-Apache%202.0-blue.svg)](LICENSE)
![NATS.js CI](https://github.com/nats-io/nats.js/workflows/NATS.js%20CI/badge.svg)
[![npm](https://img.shields.io/npm/v/nats.svg)](https://www.npmjs.com/package/nats)
[![npm](https://img.shields.io/npm/dt/nats.svg)](https://www.npmjs.com/package/nats)
Expand Down Expand Up @@ -137,7 +137,7 @@ const sub = nc.subscribe("hello");
nc.publish("hello", sc.encode("world"));
nc.publish("hello", sc.encode("again"));

// we want to insure that messages that are in flight
// we want to ensure that messages that are in flight
// get processed, so we are going to drain the
// connection. Drain is the same as close, but makes
// sure that all messages in flight get seen
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/bench.js → transport-node/examples/bench.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const parse = require("minimist");
const { Nuid, connect } = require("../");
const { Nuid, connect } = require("../index");
const { Bench, Metric } = require("../lib/nats-base-client/bench");

const defaults = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const parse = require("minimist");
const { connect } = require("../");
const { connect } = require("../index");

const argv = parse(
process.argv.slice(2),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const parse = require("minimist");
const { connect, StringCodec, headers, credsAuthenticator } = require("../");
const { connect, StringCodec, headers, credsAuthenticator } = require("../index");
const { delay } = require("./util");
const fs = require("fs");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const parse = require("minimist");
const { connect, StringCodec, headers, credsAuthenticator } = require("../");
const { connect, StringCodec, headers, credsAuthenticator } = require("../index");
const fs = require("fs");

const argv = parse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const parse = require("minimist");
const { connect, StringCodec, headers, credsAuthenticator } = require("../");
const { connect, StringCodec, headers, credsAuthenticator } = require("../index");
const { delay } = require("./util");
const fs = require("fs");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const parse = require("minimist");
const { connect, StringCodec, credsAuthenticator } = require("../");
const { connect, StringCodec, credsAuthenticator } = require("../index");
const fs = require("fs");

const argv = parse(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
69 changes: 60 additions & 9 deletions package-lock.json → transport-node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions package.json → transport-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"types": "lib/src/mod.d.ts",
"files": [
"lib/",
"examples/",
"transport-node/examples/",
"OWNERS.md",
"CODE-OF-CONDUCT.md",
"LICENSE",
Expand All @@ -39,17 +39,17 @@
"scripts": {
"build": "tsc",
"clean": "shx rm -Rf ./lib/*",
"fmt": "deno fmt ./src/ ./examples/ ./test/",
"fmt": "deno fmt src transport-node/examples/ transport-node/test/",
"prepack": "npm run check-package && npm run build",
"ava": "nyc ava --verbose -T 60000",
"test": "npm run check-package && npm run build && npm run ava",
"debug-test": "node node_modules/.bin/ava --verbose -T 6500000 --match",
"debug-test": "node ../node_modules/.bin/ava --verbose -T 6500000 --match",
"setup": "curl -fsSL https://deno.land/x/install/install.sh | sh",
"setup_win": "choco install deno",
"cover:html": "nyc report --reporter=html && open coverage/index.html",
"cover:html": "/nyc report --reporter=html && open coverage/index.html",
"coveralls": "shx mkdir -p ./coverage && nyc report --reporter=text-lcov > ./coverage/lcov.info",
"check-package": "deno run --allow-all bin/check-bundle-version.ts",
"version": "deno run -A bin/update-transport-version.ts && git add src/node_transport.ts",
"version": "deno run -A bin/update-transport-version.ts && git add transport-node/src/node_transport.ts",
"postversion": "git push && git push --tags",
"bump-qualifier": "npm version prerelease --no-commit-hooks --no-git-tag-version",
"bump-release": "npm version patch --no-commit-hooks --no-git-tag-version"
Expand All @@ -59,8 +59,8 @@
},
"dependencies": {
"@nats-io/nats-core": "^3.0.0-17",
"nkeys.js": "^1.2.0-4",
"nuid": "^2.0.1-2"
"@nats-io/nkeys": "^1.2.0-4",
"@nats-io/nuid": "^2.0.1-2"
},
"devDependencies": {
"@types/node": "^20.12.12",
Expand All @@ -69,7 +69,10 @@
"nats-jwt": "^0.0.9",
"nyc": "^15.1.0",
"shx": "^0.3.3",
"typescript": "5.4.5"
"typescript": "5.4.5",
"@nats-io/jetstream": "^3.0.0-3",
"@nats-io/kv": "^3.0.0-2",
"@nats-io/obj": "^3.0.0-1"
},
"typings": "./lib/src/mod.d.ts",
"ava": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import {
Deferred,
deferred,
ErrorCode,
extend,
extractProtocolMessage,
INFO,
NatsError,
render,
ServerInfo,
Transport,
extend,
} from "./nats-base-client";

import type { ConnectionOptions } from "./nats-base-client";
Expand Down
10 changes: 4 additions & 6 deletions test/auth.js → transport-node/test/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@
* limitations under the License.
*/
const test = require("ava");

const {
credsAuthenticator,
deferred,
ErrorCode,
Events,
jwtAuthenticator,
nkeyAuthenticator,
} = require(
"@nats-io/nats-core/internal",
);

const {connect} = require("../src/mod.ts");
const { nkeys } = require("nkeys.js");
nkeys,
} = require("@nats-io/nats-core");
const { connect } = require("../index")
const { NatsServer } = require("./helpers/launcher");
const {
createOperator,
Expand Down
2 changes: 1 addition & 1 deletion test/autounsub.js → transport-node/test/autounsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
const test = require("ava");
const { connect, ErrorCode, createInbox, Empty } = require(
"../",
"../index",
);
const { Lock } = require("./helpers/lock");

Expand Down
10 changes: 6 additions & 4 deletions test/basics.js → transport-node/test/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const {
StringCodec,
Empty,
jwtAuthenticator,
AckPolicy,
} = require(
"../lib/src/mod",
"../lib/mod",
);

const {AckPolicy, jetstream, jetstreamManager} = require("@nats-io/jetstream");

const net = require("net");

const { deferred, delay, nuid } = require(
Expand Down Expand Up @@ -765,15 +767,15 @@ test("basics - js fetch on stopped server doesn't close", async (t) => {
}
})().then();

const jsm = await nc.jetstreamManager();
const jsm = await jetstreamManager(nc);
const si = await jsm.streams.add({ name: nuid.next(), subjects: ["test"] });
const { name: stream } = si.config;
await jsm.consumers.add(stream, {
durable_name: "dur",
ack_policy: AckPolicy.Explicit,
});

const js = nc.jetstream();
const js = jetstream(nc);
setTimeout(() => {
ns.stop();
}, 2000);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/clobber.js → transport-node/test/clobber.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
const test = require("ava");
const {
createInbox,
} = require("../");
} = require("../index");
const { NatsServer } = require("./helpers/launcher");
const { connect } = require("../");
const { connect } = require("../index");
const { DataBuffer } = require("@nats-io/nats-core/internal");

function makeBuffer(N) {
Expand Down
2 changes: 1 addition & 1 deletion test/heartbeats.js → transport-node/test/heartbeats.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
const test = require("ava");
// install globals
require("../");
require("../index");
const { deferred, delay, DebugEvents, Heartbeat } = require(
"@nats-io/nats-core/internal",
);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 88b455f

Please sign in to comment.