diff --git a/core/deno.json b/core/deno.json index 64cce4a3..a7270a7d 100644 --- a/core/deno.json +++ b/core/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/nats-core", - "version": "3.0.0-29", + "version": "3.0.0-30", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" diff --git a/core/package.json b/core/package.json index 3e7bed37..28eccbb1 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/nats-core", - "version": "3.0.0-29", + "version": "3.0.0-30", "files": [ "lib/", "LICENSE", diff --git a/core/src/codec.ts b/core/src/codec.ts index 283adfe8..705e666a 100644 --- a/core/src/codec.ts +++ b/core/src/codec.ts @@ -13,9 +13,6 @@ * limitations under the License. */ -import { TD, TE } from "./encoders.ts"; -import { ErrorCode, NatsError } from "./core.ts"; - export interface Codec { /** * Encode T to an Uint8Array suitable for including in a message payload. @@ -29,50 +26,3 @@ export interface Codec { */ decode(a: Uint8Array): T; } - -/** - * Returns a {@link Codec} for encoding strings to a message payload - * and decoding message payloads into strings. - */ -export function StringCodec(): Codec { - return { - encode(d: string): Uint8Array { - return TE.encode(d); - }, - decode(a: Uint8Array): string { - return TD.decode(a); - }, - }; -} - -/** - * 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 - */ -export function JSONCodec( - reviver?: (this: unknown, key: string, value: unknown) => unknown, -): Codec { - return { - encode(d: T): Uint8Array { - try { - if (d === undefined) { - // @ts-ignore: json will not handle undefined - d = null; - } - return TE.encode(JSON.stringify(d)); - } catch (err) { - throw NatsError.errorForCode(ErrorCode.BadJson, err as Error); - } - }, - - decode(a: Uint8Array): T { - try { - return JSON.parse(TD.decode(a), reviver); - } catch (err) { - throw NatsError.errorForCode(ErrorCode.BadJson, err as Error); - } - }, - }; -} diff --git a/core/src/internal_mod.ts b/core/src/internal_mod.ts index 418f7e24..8520ac61 100644 --- a/core/src/internal_mod.ts +++ b/core/src/internal_mod.ts @@ -65,7 +65,6 @@ export { usernamePasswordAuthenticator, } from "./authenticator.ts"; export type { Codec } from "./codec.ts"; -export { JSONCodec, StringCodec } from "./codec.ts"; export * from "./nkeys.ts"; export { QueuedIteratorImpl } from "./queued_iterator.ts"; export type { MsgArg, ParserEvent } from "./parser.ts"; diff --git a/core/src/mod.ts b/core/src/mod.ts index 06d0bc81..e5a48bdb 100644 --- a/core/src/mod.ts +++ b/core/src/mod.ts @@ -28,7 +28,6 @@ export { ErrorCode, Events, headers, - JSONCodec, jwtAuthenticator, Match, Metric, @@ -41,7 +40,6 @@ export { Nuid, nuid, RequestStrategy, - StringCodec, syncIterator, tokenAuthenticator, usernamePasswordAuthenticator, diff --git a/core/src/msg.ts b/core/src/msg.ts index 6598cf86..9d5aef65 100644 --- a/core/src/msg.ts +++ b/core/src/msg.ts @@ -15,11 +15,10 @@ import { MsgHdrsImpl } from "./headers.ts"; import type { MsgArg } from "./parser.ts"; import { Empty, TD } from "./encoders.ts"; -import type { Codec } from "./codec.ts"; -import { JSONCodec } from "./codec.ts"; import type { Msg, MsgHdrs, + Payload, Publisher, RequestInfo, ReviverFn, @@ -43,7 +42,6 @@ export class MsgImpl implements Msg { _reply!: string; _subject!: string; publisher: Publisher; - static jc: Codec; constructor(msg: MsgArg, data: Uint8Array, publisher: Publisher) { this._msg = msg; @@ -90,7 +88,7 @@ export class MsgImpl implements Msg { // eslint-ignore-next-line @typescript-eslint/no-explicit-any respond( - data: Uint8Array = Empty, + data: Payload = Empty, opts?: { headers?: MsgHdrs; reply?: string }, ): boolean { if (this.reply) { @@ -108,7 +106,7 @@ export class MsgImpl implements Msg { } json(reviver?: ReviverFn): T { - return JSONCodec(reviver).decode(this.data); + return JSON.parse(this.string(), reviver); } string(): string { diff --git a/core/src/version.ts b/core/src/version.ts index 7cef50e1..14911460 100644 --- a/core/src/version.ts +++ b/core/src/version.ts @@ -1,2 +1,2 @@ // This file is generated - do not edit -export const version = "3.0.0-29"; +export const version = "3.0.0-30"; diff --git a/core/tests/auth_test.ts b/core/tests/auth_test.ts index 38369f45..89c1dd1d 100644 --- a/core/tests/auth_test.ts +++ b/core/tests/auth_test.ts @@ -48,7 +48,6 @@ import { jwtAuthenticator, nkeyAuthenticator, nkeys, - StringCodec, tokenAuthenticator, usernamePasswordAuthenticator, } from "../src/internal_mod.ts"; @@ -487,8 +486,7 @@ Deno.test("auth - creds authenticator validation", () => { `eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJqdGkiOiJFU1VQS1NSNFhGR0pLN0FHUk5ZRjc0STVQNTZHMkFGWERYQ01CUUdHSklKUEVNUVhMSDJBIiwiaWF0IjoxNTQ0MjE3NzU3LCJpc3MiOiJBQ1pTV0JKNFNZSUxLN1FWREVMTzY0VlgzRUZXQjZDWENQTUVCVUtBMzZNSkpRUlBYR0VFUTJXSiIsInN1YiI6IlVBSDQyVUc2UFY1NTJQNVNXTFdUQlAzSDNTNUJIQVZDTzJJRUtFWFVBTkpYUjc1SjYzUlE1V002IiwidHlwZSI6InVzZXIiLCJuYXRzIjp7InB1YiI6e30sInN1YiI6e319fQ.kCR9Erm9zzux4G6M-V2bp7wKMKgnSNqMBACX05nwePRWQa37aO_yObbhcJWFGYjo1Ix-oepOkoyVLxOJeuD8Bw`; const ukp = nkeys.createUser(); const upk = ukp.getPublicKey(); - const sc = StringCodec(); - const seed = sc.decode(ukp.getSeed()); + const seed = new TextDecoder().decode(ukp.getSeed()); function creds(ajwt = "", aseed = ""): string { return `-----BEGIN NATS USER JWT----- @@ -513,7 +511,7 @@ Deno.test("auth - creds authenticator validation", () => { tests.push([jwt, seed, true, "jwt and seed"]); tests.forEach((v) => { - const d = sc.encode(creds(v[0], v[1])); + const d = new TextEncoder().encode(creds(v[0], v[1])); try { const auth = credsAuthenticator(d); if (!v[2]) { diff --git a/core/tests/basics_test.ts b/core/tests/basics_test.ts index 487c561b..38c16f78 100644 --- a/core/tests/basics_test.ts +++ b/core/tests/basics_test.ts @@ -34,10 +34,8 @@ import { Feature, headers, isIP, - JSONCodec, nuid, RequestStrategy, - StringCodec, syncIterator, } from "../src/internal_mod.ts"; import type { @@ -238,7 +236,6 @@ Deno.test("basics - wildcard subscriptions", async () => { Deno.test("basics - correct data in message", async () => { const { ns, nc } = await _setup(connect); - const sc = StringCodec(); const subj = createInbox(); const mp = deferred(); const sub = nc.subscribe(subj); @@ -249,10 +246,10 @@ Deno.test("basics - correct data in message", async () => { } })().then(); - nc.publish(subj, sc.encode(subj)); + nc.publish(subj, subj); const m = await mp; assertEquals(m.subject, subj); - assertEquals(sc.decode(m.data), subj); + assertEquals(m.string(), subj); assertEquals(m.reply, ""); await cleanup(ns, nc); }); @@ -359,16 +356,15 @@ Deno.test("basics - unsubscribe stops messages", async () => { Deno.test("basics - request", async () => { const { ns, nc } = await _setup(connect); - const sc = StringCodec(); const s = createInbox(); const sub = nc.subscribe(s); (async () => { for await (const m of sub) { - m.respond(sc.encode("foo")); + m.respond("foo"); } })().then(); const msg = await nc.request(s); - assertEquals(sc.decode(msg.data), "foo"); + assertEquals(msg.string(), "foo"); await cleanup(ns, nc); }); @@ -415,10 +411,9 @@ Deno.test("basics - request cancel rejects", async () => { Deno.test("basics - old style requests", async () => { const { ns, nc } = await _setup(connect); - const sc = StringCodec(); nc.subscribe("q", { callback: (_err, msg) => { - msg.respond(sc.encode("hello")); + msg.respond("hello"); }, }); @@ -427,7 +422,7 @@ Deno.test("basics - old style requests", async () => { Empty, { reply: "bar", noMux: true, timeout: 1000 }, ); - assertEquals("hello", sc.decode(m.data)); + assertEquals("hello", m.string()); assertEquals("bar", m.subject); await cleanup(ns, nc); @@ -435,10 +430,9 @@ Deno.test("basics - old style requests", async () => { Deno.test("basics - request with custom subject", async () => { const { ns, nc } = await _setup(connect); - const sc = StringCodec(); nc.subscribe("q", { callback: (_err, msg) => { - msg.respond(sc.encode("hello")); + msg.respond("hello"); }, }); @@ -459,13 +453,12 @@ Deno.test("basics - request with custom subject", async () => { Deno.test("basics - request with headers", async () => { const { ns, nc } = await _setup(connect); - const sc = StringCodec(); const s = createInbox(); const sub = nc.subscribe(s); (async () => { for await (const m of sub) { const headerContent = m.headers?.get("test-header"); - m.respond(sc.encode(`header content: ${headerContent}`)); + m.respond(`header content: ${headerContent}`); } })().then(); const requestHeaders = headers(); @@ -474,19 +467,18 @@ Deno.test("basics - request with headers", async () => { headers: requestHeaders, timeout: 5000, }); - assertEquals(sc.decode(msg.data), "header content: Hello, world!"); + assertEquals(msg.string(), "header content: Hello, world!"); await cleanup(ns, nc); }); Deno.test("basics - request with headers and custom subject", async () => { const { ns, nc } = await _setup(connect); - const sc = StringCodec(); const s = createInbox(); const sub = nc.subscribe(s); (async () => { for await (const m of sub) { const headerContent = m.headers?.get("test-header"); - m.respond(sc.encode(`header content: ${headerContent}`)); + m.respond(`header content: ${headerContent}`); } })().then(); const requestHeaders = headers(); @@ -497,7 +489,7 @@ Deno.test("basics - request with headers and custom subject", async () => { reply: "reply-subject", noMux: true, }); - assertEquals(sc.decode(msg.data), "header content: Hello, world!"); + assertEquals(msg.string(), "header content: Hello, world!"); await cleanup(ns, nc); }); @@ -884,33 +876,31 @@ Deno.test("basics - create inbox", () => { Deno.test("basics - custom prefix", async () => { const { ns, nc } = await _setup(connect, {}, { inboxPrefix: "_x" }); - const jc = JSONCodec(); const subj = createInbox(); nc.subscribe(subj, { max: 1, callback: (_err, msg) => { - msg.respond(jc.encode(msg.reply!.startsWith("_x."))); + msg.respond(); }, }); const v = await nc.request(subj); - assert(jc.decode(v.data)); + assert(v.subject.startsWith("_x.")); await cleanup(ns, nc); }); Deno.test("basics - custom prefix noMux", async () => { const { ns, nc } = await _setup(connect, {}, { inboxPrefix: "_y" }); - const jc = JSONCodec(); const subj = createInbox(); nc.subscribe(subj, { max: 1, callback: (_err, msg) => { - msg.respond(jc.encode(msg.reply!.startsWith("_y."))); + msg.respond(); }, }); const v = await nc.request(subj); - assert(jc.decode(v.data)); + assert(v.subject.startsWith("_y.")); await cleanup(ns, nc); }); @@ -1072,12 +1062,10 @@ Deno.test("basics - request many sentinel", async () => { const nci = nc as NatsConnectionImpl; const subj = createInbox(); - const sc = StringCodec(); - const payload = sc.encode("hello"); nc.subscribe(subj, { callback: (_err, msg) => { for (let i = 0; i < 10; i++) { - msg.respond(payload); + msg.respond("hello"); } msg.respond(); }, @@ -1106,12 +1094,10 @@ Deno.test("basics - request many sentinel - partial response", async () => { const nci = nc as NatsConnectionImpl; const subj = createInbox(); - const sc = StringCodec(); - const payload = sc.encode("hello"); nc.subscribe(subj, { callback: (_err, msg) => { for (let i = 0; i < 10; i++) { - msg.respond(payload); + msg.respond("hello"); } }, }); @@ -1217,8 +1203,7 @@ Deno.test("basics - info", async () => { Deno.test("basics - initial connect error", async () => { const listener = Deno.listen({ port: 0 }); const port = (listener.addr as Deno.NetAddr).port; - const sc = StringCodec(); - const INFO = sc.encode( + const INFO = new TextEncoder().encode( `INFO {"server_id":"FAKE","server_name":"FAKE","version":"2.9.4","proto":1,"go":"go1.19.2","host":"127.0.0.1","port":${port},"headers":true,"max_payload":1048576,"jetstream":true,"client_id":4,"client_ip":"127.0.0.1"}\r\n`, ); @@ -1283,14 +1268,8 @@ Deno.test("basics - msg typed payload", async () => { }); assertEquals((await nc.request("echo", Empty)).string(), ""); - assertEquals( - (await nc.request("echo", StringCodec().encode("hello"))).string(), - "hello", - ); - assertEquals( - (await nc.request("echo", StringCodec().encode("5"))).string(), - "5", - ); + assertEquals((await nc.request("echo", "hello")).string(), "hello"); + assertEquals((await nc.request("echo", "5")).string(), "5"); await assertRejects( async () => { @@ -1298,32 +1277,24 @@ Deno.test("basics - msg typed payload", async () => { r.json(); }, Error, - "Bad JSON", + "Unexpected end of JSON input", ); + assertEquals((await nc.request("echo", JSON.stringify(null))).json(), null); + assertEquals((await nc.request("echo", JSON.stringify(5))).json(), 5); assertEquals( - (await nc.request("echo", JSONCodec().encode(null))).json(), - null, - ); - assertEquals( - (await nc.request("echo", JSONCodec().encode(undefined))).json(), - null, - ); - assertEquals((await nc.request("echo", JSONCodec().encode(5))).json(), 5); - assertEquals( - (await nc.request("echo", JSONCodec().encode("hello"))).json(), + (await nc.request("echo", JSON.stringify("hello"))).json(), "hello", ); + assertEquals((await nc.request("echo", JSON.stringify(["hello"]))).json(), [ + "hello", + ]); assertEquals( - (await nc.request("echo", JSONCodec().encode(["hello"]))).json(), - ["hello"], - ); - assertEquals( - (await nc.request("echo", JSONCodec().encode({ one: "two" }))).json(), + (await nc.request("echo", JSON.stringify({ one: "two" }))).json(), { one: "two" }, ); assertEquals( - (await nc.request("echo", JSONCodec().encode([{ one: "two" }]))).json(), + (await nc.request("echo", JSON.stringify([{ one: "two" }]))).json(), [{ one: "two" }], ); @@ -1408,7 +1379,7 @@ Deno.test("basics - json reviver", async () => { nc.subscribe(subj, { callback: (_err, msg) => { - msg.respond(JSONCodec().encode({ date: Date.now(), auth: true })); + msg.respond(JSON.stringify({ date: Date.now(), auth: true })); }, }); diff --git a/core/tests/codec_test.ts b/core/tests/codec_test.ts deleted file mode 100644 index 0f8e1d1f..00000000 --- a/core/tests/codec_test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020-2023 The NATS Authors - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { JSONCodec, StringCodec } from "@nats-io/nats-core"; -import { assertEquals } from "jsr:@std/assert"; - -Deno.test("codec - string", () => { - const sc = StringCodec(); - const d = sc.encode("hello"); - assertEquals(sc.decode(d), "hello"); -}); - -Deno.test("codec - json", () => { - const sc = JSONCodec(); - const o = { hello: "world" }; - const d = sc.encode(o); - assertEquals(sc.decode(d), o); -}); - -Deno.test("codec - json w/ reviver", () => { - // deno-lint-ignore no-explicit-any - const sc = JSONCodec((k: string, v: any) => k === "time" ? new Date(v) : v); - const o = { time: new Date() }; - const d = sc.encode(o); - assertEquals(sc.decode(d), o); -}); diff --git a/core/tests/doublesubs_test.ts b/core/tests/doublesubs_test.ts index aacba80b..a5cfa1de 100644 --- a/core/tests/doublesubs_test.ts +++ b/core/tests/doublesubs_test.ts @@ -20,7 +20,6 @@ import { Events, extend, headers, - StringCodec, } from "../src/internal_mod.ts"; import type { NatsConnectionImpl } from "../src/internal_mod.ts"; import { assertArrayIncludes, assertEquals } from "jsr:@std/assert"; @@ -77,7 +76,7 @@ async function runDoubleSubsTest(tls: boolean) { const bar = nc.subscribe("bar"); const baz = nc.subscribe("baz"); nc.publish("foo", Empty); - nc.publish("bar", StringCodec().encode("hello")); + nc.publish("bar", "hello"); const h = headers(); h.set("foo", "bar"); nc.publish("baz", Empty, { headers: h }); diff --git a/core/tests/drain_test.ts b/core/tests/drain_test.ts index 0c07bcfb..fe692945 100644 --- a/core/tests/drain_test.ts +++ b/core/tests/drain_test.ts @@ -13,7 +13,7 @@ * limitations under the License. */ import { assert, assertEquals, fail } from "jsr:@std/assert"; -import { createInbox, ErrorCode, StringCodec } from "../src/internal_mod.ts"; +import { createInbox, ErrorCode } from "../src/internal_mod.ts"; import type { Msg, NatsError } from "../src/internal_mod.ts"; import { assertThrowsAsyncErrorCode, @@ -133,12 +133,11 @@ Deno.test("drain - reject reqrep during connection drain", async () => { const nc2 = await connect({ port: ns.port }); const lock = Lock(); const subj = createInbox(); - const sc = StringCodec(); // start a service for replies await nc.subscribe(subj, { callback: (_, msg: Msg) => { if (msg.reply) { - msg.respond(sc.encode("ok")); + msg.respond("ok"); } }, }); diff --git a/core/tests/headers_test.ts b/core/tests/headers_test.ts index f4c4df6e..f104476d 100644 --- a/core/tests/headers_test.ts +++ b/core/tests/headers_test.ts @@ -23,7 +23,6 @@ import { MsgImpl, NatsError, Parser, - StringCodec, } from "../src/internal_mod.ts"; import type { NatsConnectionImpl, @@ -181,7 +180,7 @@ function status(code: number, description: string): Uint8Array { ? `NATS/1.0 ${code.toString()} ${description}`.trim() : "NATS/1.0"; const line = `${status}\r\n\r\n\r\n`; - return StringCodec().encode(line); + return new TextEncoder().encode(line); } function checkStatus(code = 200, description = "") { diff --git a/core/tests/json_test.ts b/core/tests/json_test.ts index 0e3c49a1..86126948 100644 --- a/core/tests/json_test.ts +++ b/core/tests/json_test.ts @@ -14,27 +14,14 @@ */ import { connect } from "./connect.ts"; import { assertEquals } from "jsr:@std/assert"; -import { createInbox, ErrorCode, JSONCodec } from "../src/internal_mod.ts"; +import { createInbox } from "../src/internal_mod.ts"; import type { Msg, NatsError } from "../src/internal_mod.ts"; import { Lock } from "test_helpers"; -import { assertThrowsErrorCode } from "../../test_helpers/asserts.ts"; import { _setup, cleanup } from "test_helpers"; -Deno.test("json - bad json error in callback", () => { - const o = {}; - //@ts-ignore: bad json - o.a = o; - - const jc = JSONCodec(); - assertThrowsErrorCode(() => { - jc.encode(o); - }, ErrorCode.BadJson); -}); - function macro(input: unknown) { return async () => { const { ns, nc } = await _setup(connect); - const jc = JSONCodec(); const lock = Lock(); const subj = createInbox(); nc.subscribe(subj, { @@ -44,13 +31,13 @@ function macro(input: unknown) { if (input === undefined) { input = null; } - assertEquals(jc.decode(msg.data), input); + assertEquals(msg.json(), input); lock.unlock(); }, max: 1, }); - nc.publish(subj, jc.encode(input)); + nc.publish(subj, JSON.stringify(input)); await nc.flush(); await lock; await cleanup(ns, nc); @@ -60,7 +47,6 @@ function macro(input: unknown) { Deno.test("json - string", macro("helloworld")); Deno.test("json - empty", macro("")); Deno.test("json - null", macro(null)); -Deno.test("json - undefined", macro(undefined)); Deno.test("json - number", macro(10)); Deno.test("json - false", macro(false)); Deno.test("json - true", macro(true)); diff --git a/core/tests/mrequest_test.ts b/core/tests/mrequest_test.ts index 5389e63f..01f24603 100644 --- a/core/tests/mrequest_test.ts +++ b/core/tests/mrequest_test.ts @@ -22,7 +22,6 @@ import { Empty, Events, RequestStrategy, - StringCodec, } from "../src/internal_mod.ts"; import { assert, assertEquals, assertRejects, fail } from "jsr:@std/assert"; @@ -118,12 +117,10 @@ async function requestManySentinel( const nci = nc as NatsConnectionImpl; const subj = createInbox(); - const sc = StringCodec(); - const payload = sc.encode("hello"); nc.subscribe(subj, { callback: (_err, msg) => { for (let i = 0; i < 10; i++) { - msg.respond(payload); + msg.respond("hello"); } if (!partial) { msg.respond(); diff --git a/core/tests/types_test.ts b/core/tests/types_test.ts index eedac8da..61a26c33 100644 --- a/core/tests/types_test.ts +++ b/core/tests/types_test.ts @@ -15,13 +15,7 @@ import { connect } from "./connect.ts"; import type { Msg, NatsConnection } from "../src/internal_mod.ts"; -import { - createInbox, - DataBuffer, - deferred, - JSONCodec, - StringCodec, -} from "../src/internal_mod.ts"; +import { createInbox, DataBuffer, deferred } from "../src/internal_mod.ts"; import { assert, assertEquals } from "jsr:@std/assert"; import { NatsServer } from "../../test_helpers/launcher.ts"; @@ -38,27 +32,25 @@ function mh(nc: NatsConnection, subj: string): Promise { Deno.test("types - json types", async () => { const ns = await NatsServer.start(); - const jc = JSONCodec(); const nc = await connect({ port: ns.port }); const subj = createInbox(); const dm = mh(nc, subj); - nc.publish(subj, jc.encode(6691)); + nc.publish(subj, JSON.stringify(6691)); const msg = await dm; - assertEquals(typeof jc.decode(msg.data), "number"); - assertEquals(jc.decode(msg.data), 6691); + assertEquals(typeof msg.json(), "number"); + assertEquals(msg.json(), 6691); await nc.close(); await ns.stop(); }); Deno.test("types - string types", async () => { const ns = await NatsServer.start(); - const sc = StringCodec(); const nc = await connect({ port: ns.port }); const subj = createInbox(); const dm = mh(nc, subj); - nc.publish(subj, sc.encode("hello world")); + nc.publish(subj, "hello world"); const msg = await dm; - assertEquals(sc.decode(msg.data), "hello world"); + assertEquals(msg.string(), "hello world"); await nc.close(); await ns.stop(); }); diff --git a/jetstream/deno.json b/jetstream/deno.json index 7533229d..098cfe63 100644 --- a/jetstream/deno.json +++ b/jetstream/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/jetstream", - "version": "3.0.0-14", + "version": "3.0.0-15", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" @@ -33,6 +33,6 @@ "test": "deno test -A --parallel --reload --trace-leaks --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30" } } diff --git a/jetstream/import_map.json b/jetstream/import_map.json index f09e94e2..bafe819c 100644 --- a/jetstream/import_map.json +++ b/jetstream/import_map.json @@ -2,8 +2,8 @@ "imports": { "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-29/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-30/internal", "test_helpers": "../test_helpers/mod.ts", "@std/io": "jsr:@std/io@0.224.0" } diff --git a/jetstream/package.json b/jetstream/package.json index 09c21942..f75421ff 100644 --- a/jetstream/package.json +++ b/jetstream/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/jetstream", - "version": "3.0.0-14", + "version": "3.0.0-15", "files": [ "lib/", "LICENSE", @@ -34,7 +34,7 @@ }, "description": "jetstream library - this library implements all the base functionality for NATS JetStream for javascript clients", "dependencies": { - "@nats-io/nats-core": "~3.0.0-29" + "@nats-io/nats-core": "~3.0.0-30" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/jetstream/src/consumer.ts b/jetstream/src/consumer.ts index 42fc347e..9f98ddb6 100644 --- a/jetstream/src/consumer.ts +++ b/jetstream/src/consumer.ts @@ -553,7 +553,7 @@ export class PullConsumerMessagesImpl extends QueuedIteratorImpl this._push(() => { nc.publish( subj, - this.consumer.api.jc.encode(opts), + JSON.stringify(opts), { reply: this.inbox }, ); this.notify(ConsumerDebugEvents.Next, opts); diff --git a/jetstream/src/jsbaseclient_api.ts b/jetstream/src/jsbaseclient_api.ts index 776ba895..4badfa40 100644 --- a/jetstream/src/jsbaseclient_api.ts +++ b/jetstream/src/jsbaseclient_api.ts @@ -19,10 +19,8 @@ import { Empty, ErrorCode, extend, - JSONCodec, } from "@nats-io/nats-core/internal"; import type { - Codec, Msg, NatsConnection, NatsConnectionImpl, @@ -58,7 +56,6 @@ export class BaseApiClientImpl { opts: JetStreamOptions; prefix: string; timeout: number; - jc: Codec; constructor(nc: NatsConnection, opts?: JetStreamOptions) { this.nc = nc as NatsConnectionImpl; @@ -66,7 +63,6 @@ export class BaseApiClientImpl { this._parseOpts(); this.prefix = this.opts.apiPrefix!; this.timeout = this.opts.timeout!; - this.jc = JSONCodec(); } getOptions(): JetStreamOptions { @@ -95,7 +91,7 @@ export class BaseApiClientImpl { let a: Uint8Array = Empty; if (data) { - a = this.jc.encode(data); + a = new TextEncoder().encode(JSON.stringify(data)); } let { retries } = opts as { @@ -143,7 +139,7 @@ export class BaseApiClientImpl { } parseJsResponse(m: Msg): unknown { - const v = this.jc.decode(m.data); + const v = JSON.parse(new TextDecoder().decode(m.data)); const r = v as ApiResponse; if (r.error) { const err = checkJsErrorCode(r.error.code, r.error.description); diff --git a/jetstream/src/jsm.ts b/jetstream/src/jsm.ts index 6eec8bf1..9cf213c9 100644 --- a/jetstream/src/jsm.ts +++ b/jetstream/src/jsm.ts @@ -31,7 +31,6 @@ import type { } from "@nats-io/nats-core"; import { Empty, - JSONCodec, QueuedIteratorImpl, RequestStrategy, TD, @@ -62,7 +61,7 @@ export class DirectStreamAPIImpl extends BaseApiClientImpl qq = null; } - const payload = qq ? this.jc.encode(qq) : Empty; + const payload = qq ? JSON.stringify(qq) : Empty; const pre = this.opts.apiPrefix || "$JS.API"; const subj = last_by_subj ? `${pre}.DIRECT.GET.${stream}.${last_by_subj}` @@ -184,7 +183,7 @@ export class DirectMsgImpl implements DirectMsg { } json(reviver?: ReviverFn): T { - return JSONCodec(reviver).decode(this.data); + return JSON.parse(new TextDecoder().decode(this.data), reviver); } string(): string { diff --git a/jetstream/src/jsmsg.ts b/jetstream/src/jsmsg.ts index 9acb29e8..c16d06fc 100644 --- a/jetstream/src/jsmsg.ts +++ b/jetstream/src/jsmsg.ts @@ -24,10 +24,8 @@ import type { import { DataBuffer, deferred, - JSONCodec, nanos, RequestOne, - StringCodec, } from "@nats-io/nats-core/internal"; import type { DeliveryInfo, PullOptions } from "./jsapi_types.ts"; @@ -280,9 +278,9 @@ export class JsMsgImpl implements JsMsg { } nak(millis?: number) { - let payload = NAK; + let payload: Uint8Array | string = NAK; if (millis) { - payload = StringCodec().encode( + payload = new TextEncoder().encode( `-NAK ${JSON.stringify({ delay: nanos(millis) })}`, ); } @@ -300,7 +298,7 @@ export class JsMsgImpl implements JsMsg { if (opts.expires && opts.expires > 0) { args.expires = nanos(opts.expires); } - const data = JSONCodec().encode(args); + const data = new TextEncoder().encode(JSON.stringify(args)); const payload = DataBuffer.concat(NXT, SPACE, data); const reqOpts = subj ? { reply: subj } as RequestOptions : undefined; this.msg.respond(payload, reqOpts); @@ -309,7 +307,7 @@ export class JsMsgImpl implements JsMsg { term(reason = "") { let term = TERM; if (reason?.length > 0) { - term = StringCodec().encode(`+TERM ${reason}`); + term = new TextEncoder().encode(`+TERM ${reason}`); } this.doAck(term); } diff --git a/jetstream/src/jsmstream_api.ts b/jetstream/src/jsmstream_api.ts index e989c656..547e0097 100644 --- a/jetstream/src/jsmstream_api.ts +++ b/jetstream/src/jsmstream_api.ts @@ -18,7 +18,6 @@ import { Empty, Feature, headers, - JSONCodec, MsgHdrsImpl, nanos, nuid, @@ -695,7 +694,7 @@ export class StoredMsgImpl implements StoredMsg { } json(reviver?: ReviverFn): T { - return JSONCodec(reviver).decode(this.data); + return JSON.parse(new TextDecoder().decode(this.data), reviver); } string(): string { diff --git a/jetstream/tests/fetch_test.ts b/jetstream/tests/fetch_test.ts index fd3c414c..6ed15812 100644 --- a/jetstream/tests/fetch_test.ts +++ b/jetstream/tests/fetch_test.ts @@ -22,13 +22,7 @@ import { } from "test_helpers"; import { initStream } from "./jstest_util.ts"; import { assertEquals, assertExists, assertRejects } from "jsr:@std/assert"; -import { - delay, - Empty, - nanos, - StringCodec, - syncIterator, -} from "@nats-io/nats-core"; +import { delay, Empty, nanos, syncIterator } from "@nats-io/nats-core"; import type { NatsConnectionImpl } from "@nats-io/nats-core/internal"; import { AckPolicy, @@ -92,11 +86,10 @@ Deno.test("fetch - exactly messages", async () => { const { ns, nc } = await _setup(connect, jetstreamServerConf()); const { stream, subj } = await initStream(nc); - const sc = StringCodec(); const js = jetstream(nc); await Promise.all( new Array(200).fill("a").map((_, idx) => { - return js.publish(subj, sc.encode(`${idx}`)); + return js.publish(subj, `${idx}`); }), ); diff --git a/jetstream/tests/jetstream_test.ts b/jetstream/tests/jetstream_test.ts index 32399858..9a8c1f86 100644 --- a/jetstream/tests/jetstream_test.ts +++ b/jetstream/tests/jetstream_test.ts @@ -32,10 +32,8 @@ import { delay, Empty, headers, - JSONCodec, nanos, nuid, - StringCodec, } from "@nats-io/nats-core"; import { assert, @@ -216,16 +214,15 @@ Deno.test("jetstream - get message last by subject", async () => { await jsm.streams.add({ name: stream, subjects: [`${stream}.*`] }); const js = jetstream(nc); - const sc = StringCodec(); - await js.publish(`${stream}.A`, sc.encode("a")); - await js.publish(`${stream}.A`, sc.encode("aa")); - await js.publish(`${stream}.B`, sc.encode("b")); - await js.publish(`${stream}.B`, sc.encode("bb")); + await js.publish(`${stream}.A`, "a"); + await js.publish(`${stream}.A`, "aa"); + await js.publish(`${stream}.B`, "b"); + await js.publish(`${stream}.B`, "bb"); const sm = await jsm.streams.getMessage(stream, { last_by_subj: `${stream}.A`, }); - assertEquals(sc.decode(sm.data), "aa"); + assertEquals(sm.string(), "aa"); await cleanup(ns, nc); }); @@ -334,11 +331,10 @@ Deno.test("jetstream - publish headers", async () => { Deno.test("jetstream - JSON", async () => { const { ns, nc } = await _setup(connect, jetstreamServerConf({})); const { stream, subj } = await initStream(nc); - const jc = JSONCodec(); const js = jetstream(nc); - const values = [undefined, null, true, "", ["hello"], { hello: "world" }]; + const values = [null, true, "", ["hello"], { hello: "world" }]; for (const v of values) { - await js.publish(subj, jc.encode(v)); + await js.publish(subj, JSON.stringify(v)); } const jsm = await jetstreamManager(nc); @@ -482,9 +478,8 @@ Deno.test("jetstream - seal", async () => { } const { stream, subj } = await initStream(nc); const js = jetstream(nc); - const sc = StringCodec(); - await js.publish(subj, sc.encode("hello")); - await js.publish(subj, sc.encode("second")); + await js.publish(subj, "hello"); + await js.publish(subj, "second"); const jsm = await jetstreamManager(nc); const si = await jsm.streams.info(stream); @@ -525,9 +520,8 @@ Deno.test("jetstream - deny delete", async () => { }); const js = jetstream(nc); - const sc = StringCodec(); - await js.publish(subj, sc.encode("hello")); - await js.publish(subj, sc.encode("second")); + await js.publish(subj, "hello"); + await js.publish(subj, "second"); const si = await jsm.streams.info(stream); assertEquals(si.config.deny_delete, true); @@ -559,9 +553,8 @@ Deno.test("jetstream - deny purge", async () => { }); const js = jetstream(nc); - const sc = StringCodec(); - await js.publish(subj, sc.encode("hello")); - await js.publish(subj, sc.encode("second")); + await js.publish(subj, "hello"); + await js.publish(subj, "second"); const si = await jsm.streams.info(stream); assertEquals(si.config.deny_purge, true); @@ -593,16 +586,15 @@ Deno.test("jetstream - rollup all", async () => { }); const js = jetstream(nc); - const jc = JSONCodec(); const buf = []; for (let i = 1; i < 11; i++) { - buf.push(js.publish(`${stream}.A`, jc.encode({ value: i }))); + buf.push(js.publish(`${stream}.A`, JSON.stringify({ value: i }))); } await Promise.all(buf); const h = headers(); h.set(JsHeaders.RollupHdr, JsHeaders.RollupValueAll); - await js.publish(`${stream}.summary`, jc.encode({ value: 42 }), { + await js.publish(`${stream}.summary`, JSON.stringify({ value: 42 }), { headers: h, }); @@ -627,11 +619,10 @@ Deno.test("jetstream - rollup subject", async () => { }); const js = jetstream(nc); - const jc = JSONCodec>(); const buf = []; for (let i = 1; i < 11; i++) { - buf.push(js.publish(`${stream}.A`, jc.encode({ value: i }))); - buf.push(js.publish(`${stream}.B`, jc.encode({ value: i }))); + buf.push(js.publish(`${stream}.A`, JSON.stringify({ value: i }))); + buf.push(js.publish(`${stream}.B`, JSON.stringify({ value: i }))); } await Promise.all(buf); @@ -647,7 +638,7 @@ Deno.test("jetstream - rollup subject", async () => { const h = headers(); h.set(JsHeaders.RollupHdr, JsHeaders.RollupValueSubject); - await js.publish(`${stream}.A`, jc.encode({ value: 0 }), { + await js.publish(`${stream}.A`, JSON.stringify({ value: 0 }), { headers: h, }); @@ -684,10 +675,9 @@ Deno.test("jetstream - no rollup", async () => { assertEquals(si.config.allow_rollup_hdrs, false); const js = jetstream(nc); - const jc = JSONCodec>(); const buf = []; for (let i = 1; i < 11; i++) { - buf.push(js.publish(`${stream}.A`, jc.encode({ value: i }))); + buf.push(js.publish(`${stream}.A`, JSON.stringify({ value: i }))); } await Promise.all(buf); @@ -695,7 +685,7 @@ Deno.test("jetstream - no rollup", async () => { h.set(JsHeaders.RollupHdr, JsHeaders.RollupValueSubject); await assertRejects( async () => { - await js.publish(`${stream}.A`, jc.encode({ value: 42 }), { + await js.publish(`${stream}.A`, JSON.stringify({ value: 42 }), { headers: h, }); }, @@ -936,8 +926,8 @@ Deno.test("jetstream - jsmsg decode", async () => { ack_policy: AckPolicy.Explicit, }); - await js.publish("a.a", StringCodec().encode("hello")); - await js.publish("a.a", JSONCodec().encode({ one: "two", a: [1, 2, 3] })); + await js.publish("a.a", "hello"); + await js.publish("a.a", JSON.stringify({ one: "two", a: [1, 2, 3] })); const c = await js.consumers.get(name, "me"); assertEquals((await c.next())?.string(), "hello"); diff --git a/jetstream/tests/jsm_test.ts b/jetstream/tests/jsm_test.ts index 45db99c9..a2ff776e 100644 --- a/jetstream/tests/jsm_test.ts +++ b/jetstream/tests/jsm_test.ts @@ -30,12 +30,10 @@ import { Empty, ErrorCode, headers, - JSONCodec, jwtAuthenticator, nanos, nkeys, nuid, - StringCodec, } from "@nats-io/nats-core"; import type { ConsumerConfig, @@ -736,24 +734,23 @@ Deno.test("jsm - get message", async () => { const { ns, nc } = await _setup(connect, jetstreamServerConf({})); const { stream, subj } = await initStream(nc); - const jc = JSONCodec(); const h = headers(); h.set("xxx", "a"); const js = jetstream(nc); - await js.publish(subj, jc.encode(1), { headers: h }); - await js.publish(subj, jc.encode(2)); + await js.publish(subj, JSON.stringify(1), { headers: h }); + await js.publish(subj, JSON.stringify(2)); const jsm = await jetstreamManager(nc); let sm = await jsm.streams.getMessage(stream, { seq: 1 }); assertEquals(sm.subject, subj); assertEquals(sm.seq, 1); - assertEquals(jc.decode(sm.data), 1); + assertEquals(sm.json(), 1); sm = await jsm.streams.getMessage(stream, { seq: 2 }); assertEquals(sm.subject, subj); assertEquals(sm.seq, 2); - assertEquals(jc.decode(sm.data), 2); + assertEquals(sm.json(), 2); const err = await assertRejects( async () => { @@ -773,9 +770,8 @@ Deno.test("jsm - get message payload", async () => { const { ns, nc } = await _setup(connect, jetstreamServerConf({})); const { stream, subj } = await initStream(nc); const js = jetstream(nc); - const sc = StringCodec(); await js.publish(subj, Empty, { msgID: "empty" }); - await js.publish(subj, sc.encode(""), { msgID: "empty2" }); + await js.publish(subj, "", { msgID: "empty2" }); const jsm = await jetstreamManager(nc); let sm = await jsm.streams.getMessage(stream, { seq: 1 }); @@ -787,7 +783,7 @@ Deno.test("jsm - get message payload", async () => { assertEquals(sm.subject, subj); assertEquals(sm.seq, 2); assertEquals(sm.data, Empty); - assertEquals(sc.decode(sm.data), ""); + assertEquals(sm.string(), ""); await cleanup(ns, nc); }); @@ -1200,14 +1196,12 @@ Deno.test("jsm - direct getMessage", async () => { allow_direct: true, }); - const sc = StringCodec(); - const js = jetstream(nc); - await js.publish("foo", sc.encode("a"), { expect: { lastSequence: 0 } }); - await js.publish("foo", sc.encode("b"), { expect: { lastSequence: 1 } }); - await js.publish("foo", sc.encode("c"), { expect: { lastSequence: 2 } }); - await js.publish("bar", sc.encode("d"), { expect: { lastSequence: 3 } }); - await js.publish("foo", sc.encode("e"), { expect: { lastSequence: 4 } }); + await js.publish("foo", "a", { expect: { lastSequence: 0 } }); + await js.publish("foo", "b", { expect: { lastSequence: 1 } }); + await js.publish("foo", "c", { expect: { lastSequence: 2 } }); + await js.publish("bar", "d", { expect: { lastSequence: 3 } }); + await js.publish("foo", "e", { expect: { lastSequence: 4 } }); let m = await jsm.direct.getMessage("A", { seq: 0, next_by_subj: "bar" }); assertEquals(m.seq, 4); @@ -1953,8 +1947,8 @@ Deno.test("jsm - direct msg decode", async () => { const js = jetstream(nc); await jsm.streams.add({ name, subjects: [`a.>`], allow_direct: true }); - await js.publish("a.a", StringCodec().encode("hello")); - await js.publish("a.a", JSONCodec().encode({ one: "two", a: [1, 2, 3] })); + await js.publish("a.a", "hello"); + await js.publish("a.a", JSON.stringify({ one: "two", a: [1, 2, 3] })); assertEquals( (await jsm.direct.getMessage(name, { seq: 1 })).string(), @@ -1975,8 +1969,8 @@ Deno.test("jsm - stored msg decode", async () => { const js = jetstream(nc); await jsm.streams.add({ name, subjects: [`a.>`], allow_direct: false }); - await js.publish("a.a", StringCodec().encode("hello")); - await js.publish("a.a", JSONCodec().encode({ one: "two", a: [1, 2, 3] })); + await js.publish("a.a", "hello"); + await js.publish("a.a", JSON.stringify({ one: "two", a: [1, 2, 3] })); assertEquals( (await jsm.streams.getMessage(name, { seq: 1 })).string(), diff --git a/jetstream/tests/jsmsg_test.ts b/jetstream/tests/jsmsg_test.ts index 0e9a2005..ab7c7090 100644 --- a/jetstream/tests/jsmsg_test.ts +++ b/jetstream/tests/jsmsg_test.ts @@ -20,7 +20,7 @@ import { StorageType, } from "../src/mod.ts"; -import { createInbox, Empty, nanos, StringCodec } from "@nats-io/nats-core"; +import { createInbox, Empty, nanos } from "@nats-io/nats-core"; import type { Msg } from "@nats-io/nats-core"; import type { MsgImpl } from "@nats-io/nats-core/internal"; @@ -133,7 +133,7 @@ Deno.test("jsmsg - acks", async () => { await nc.flush(); assertEquals(replies.length, 4); - const sc = StringCodec(); + const sc = new TextDecoder(); assertEquals(sc.decode(replies[0].data), "-NAK"); assertEquals(sc.decode(replies[1].data), "+WPI"); assertEquals(sc.decode(replies[2].data), "+TERM"); diff --git a/jetstream/tests/streams_test.ts b/jetstream/tests/streams_test.ts index 4bc7f411..25eb68d1 100644 --- a/jetstream/tests/streams_test.ts +++ b/jetstream/tests/streams_test.ts @@ -16,8 +16,6 @@ import { connect, notCompatible } from "test_helpers"; import { AckPolicy, jetstream, jetstreamManager } from "../src/mod.ts"; -import { JSONCodec } from "@nats-io/nats-core"; - import { assertEquals, assertExists, @@ -67,7 +65,7 @@ Deno.test("streams - consumers", async () => { // add a stream and a message const { stream, subj } = await initStream(nc); - await js.publish(subj, JSONCodec().encode({ hello: "world" })); + await js.publish(subj, JSON.stringify({ hello: "world" })); // retrieve the stream const s = await js.streams.get(stream); diff --git a/kv/deno.json b/kv/deno.json index d537e6b4..dbbccd06 100644 --- a/kv/deno.json +++ b/kv/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/kv", - "version": "3.0.0-11", + "version": "3.0.0-12", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" @@ -33,7 +33,7 @@ "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-14" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-15" } } diff --git a/kv/import_map.json b/kv/import_map.json index 0e765e3e..b0d4b9ee 100644 --- a/kv/import_map.json +++ b/kv/import_map.json @@ -1,9 +1,9 @@ { "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-29/internal", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-14", - "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-14/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-30/internal", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-15", + "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-15/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", diff --git a/kv/package.json b/kv/package.json index c528b27b..2c9c691a 100644 --- a/kv/package.json +++ b/kv/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/kv", - "version": "3.0.0-11", + "version": "3.0.0-12", "files": [ "lib/", "LICENSE", @@ -34,8 +34,8 @@ }, "description": "kv library - this library implements all the base functionality for NATS KV javascript clients", "dependencies": { - "@nats-io/jetstream": "~3.0.0-14", - "@nats-io/nats-core": "~3.0.0-29" + "@nats-io/jetstream": "~3.0.0-15", + "@nats-io/nats-core": "~3.0.0-30" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/kv/tests/kv_test.ts b/kv/tests/kv_test.ts index 1ffe8a18..c004636b 100644 --- a/kv/tests/kv_test.ts +++ b/kv/tests/kv_test.ts @@ -71,7 +71,6 @@ import { NatsServer, notCompatible, } from "test_helpers"; -import { JSONCodec } from "@nats-io/nats-core/internal"; import type { QueuedIteratorImpl } from "@nats-io/nats-core/internal"; import { Kvm } from "../src/kv.ts"; import { flakyTest } from "../../test_helpers/mod.ts"; @@ -1619,8 +1618,8 @@ Deno.test("kv - encoded entry", async () => { const js = jetstream(nc); const kv = await new Kvm(js).create("K"); await kv.put("a", "hello"); - await kv.put("b", JSONCodec().encode(5)); - await kv.put("c", JSONCodec().encode(["hello", 5])); + await kv.put("b", JSON.stringify(5)); + await kv.put("c", JSON.stringify(["hello", 5])); assertEquals((await kv.get("a"))?.string(), "hello"); assertEquals((await kv.get("b"))?.json(), 5); diff --git a/migration.md b/migration.md index 23aba0b1..0dbefe9c 100644 --- a/migration.md +++ b/migration.md @@ -79,6 +79,11 @@ these modules for cross-runtime consumption. removed, these were supporting legacy JetStream APIs. If you were using these internal types to transform the types in the subscription, take a look at [messagepipeline](https://github.com/synadia-io/orbit.js/tree/main/messagepipeline). +- The utilities `JSONCodec` and `StringCodec` have been removed, the `Msg` types + and derivatives can set string or Uint8Array payalods. To read payloads as + string or JSON use `string()` and `json()` methods. For publishing JSON + payloads, simply specify the output of `JSON.stringify()` to the publish + operation. ## Changes in JetStream diff --git a/obj/deno.json b/obj/deno.json index 3839b25c..42d2e23f 100644 --- a/obj/deno.json +++ b/obj/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/obj", - "version": "3.0.0-11", + "version": "3.0.0-12", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" @@ -33,7 +33,7 @@ "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-14" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-15" } } diff --git a/obj/import_map.json b/obj/import_map.json index 0e765e3e..b0d4b9ee 100644 --- a/obj/import_map.json +++ b/obj/import_map.json @@ -1,9 +1,9 @@ { "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-29/internal", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-14", - "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-14/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-30/internal", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-15", + "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-15/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", diff --git a/obj/package.json b/obj/package.json index d5d70a07..8d228e52 100644 --- a/obj/package.json +++ b/obj/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/obj", - "version": "3.0.0-11", + "version": "3.0.0-12", "files": [ "lib/", "LICENSE", @@ -34,8 +34,8 @@ }, "description": "obj library - this library implements all the base functionality for NATS objectstore for javascript clients", "dependencies": { - "@nats-io/jetstream": "~3.0.0-14", - "@nats-io/nats-core": "~3.0.0-29" + "@nats-io/jetstream": "~3.0.0-15", + "@nats-io/nats-core": "~3.0.0-30" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/obj/src/objectstore.ts b/obj/src/objectstore.ts index f3d97729..f6c37c3b 100644 --- a/obj/src/objectstore.ts +++ b/obj/src/objectstore.ts @@ -25,7 +25,6 @@ import { deferred, Feature, headers, - JSONCodec, MsgHdrsImpl, nuid, QueuedIteratorImpl, @@ -361,8 +360,7 @@ export class ObjectStoreImpl implements ObjectStore { const m = await this.jsm.streams.getMessage(this.stream, { last_by_subj: meta, }); - const jc = JSONCodec(); - const soi = jc.decode(m.data) as ServerObjectInfo; + const soi = m.json(); soi.revision = m.seq; return soi; } catch (err) { @@ -490,7 +488,7 @@ export class ObjectStoreImpl implements ObjectStore { h.set(JsHeaders.RollupHdr, JsHeaders.RollupValueSubject); // try to update the metadata - const pa = await this.js.publish(metaSubj, JSONCodec().encode(info), { + const pa = await this.js.publish(metaSubj, JSON.stringify(info), { headers: h, timeout, }); @@ -743,11 +741,10 @@ export class ObjectStoreImpl implements ObjectStore { info.chunks = 0; info.digest = ""; - const jc = JSONCodec(); const h = headers(); h.set(JsHeaders.RollupHdr, JsHeaders.RollupValueSubject); - await this.js.publish(this._metaSubject(info.name), jc.encode(info), { + await this.js.publish(this._metaSubject(info.name), JSON.stringify(info), { headers: h, }); return this.jsm.streams.purge(this.stream, { diff --git a/obj/tests/objectstore_test.ts b/obj/tests/objectstore_test.ts index bd00750f..85fafc58 100644 --- a/obj/tests/objectstore_test.ts +++ b/obj/tests/objectstore_test.ts @@ -35,7 +35,6 @@ import { nanos, nuid, SHA256, - StringCodec, } from "@nats-io/nats-core/internal"; import type { NatsConnectionImpl } from "@nats-io/nats-core/internal"; import type { ObjectInfo, ObjectStoreMeta } from "../src/types.ts"; @@ -216,8 +215,7 @@ Deno.test("objectstore - multi content", async () => { { name: "a.js", options: { max_chunk_size: 1 } }, readableStreamFrom(a), ); - const sc = StringCodec(); - const b = sc.encode("hello world from object store"); + const b = new TextEncoder().encode("hello world from object store"); await os.put( { name: "b.js", options: { max_chunk_size: nc.info!.max_payload } }, readableStreamFrom(b), @@ -293,17 +291,15 @@ Deno.test("objectstore - multi with delete", async () => { const objm = new Objm(nc); const os = await objm.create("test", { storage: StorageType.Memory }); - const sc = StringCodec(); - await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a!")), + readableStreamFrom(new TextEncoder().encode("a!")), ); const si = await os.status({ subjects_filter: ">" }); await os.put( { name: "b", options: { max_chunk_size: nc.info!.max_payload } }, - readableStreamFrom(sc.encode("b!")), + readableStreamFrom(new TextEncoder().encode("b!")), ); await os.get("b"); @@ -323,14 +319,31 @@ Deno.test("objectstore - object names", async () => { } const objm = new Objm(nc); const os = await objm.create("test", { storage: StorageType.Memory }); - const sc = StringCodec(); - await os.put({ name: "blob.txt" }, readableStreamFrom(sc.encode("A"))); - await os.put({ name: "foo bar" }, readableStreamFrom(sc.encode("A"))); - await os.put({ name: " " }, readableStreamFrom(sc.encode("A"))); - await os.put({ name: "*" }, readableStreamFrom(sc.encode("A"))); - await os.put({ name: ">" }, readableStreamFrom(sc.encode("A"))); + await os.put( + { name: "blob.txt" }, + readableStreamFrom(new TextEncoder().encode("A")), + ); + await os.put( + { name: "foo bar" }, + readableStreamFrom(new TextEncoder().encode("A")), + ); + await os.put( + { name: " " }, + readableStreamFrom(new TextEncoder().encode("A")), + ); + await os.put( + { name: "*" }, + readableStreamFrom(new TextEncoder().encode("A")), + ); + await os.put( + { name: ">" }, + readableStreamFrom(new TextEncoder().encode("A")), + ); await assertRejects(async () => { - await os.put({ name: "" }, readableStreamFrom(sc.encode("A"))); + await os.put( + { name: "" }, + readableStreamFrom(new TextEncoder().encode("A")), + ); }); await cleanup(ns, nc); }); @@ -342,9 +355,11 @@ Deno.test("objectstore - metadata", async () => { } const objm = new Objm(nc); const os = await objm.create("test", { storage: StorageType.Memory }); - const sc = StringCodec(); - await os.put({ name: "a" }, readableStreamFrom(sc.encode("A"))); + await os.put( + { name: "a" }, + readableStreamFrom(new TextEncoder().encode("A")), + ); // rename a let meta = { name: "b" } as ObjectStoreMeta; @@ -481,18 +496,20 @@ Deno.test("objectstore - watch initially empty", async () => { const infos = await os.list(); assertEquals(infos.length, 0); - const sc = StringCodec(); await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a")), + readableStreamFrom(new TextEncoder().encode("a")), ); await os.put( { name: "a" }, - readableStreamFrom(sc.encode("aa")), + readableStreamFrom(new TextEncoder().encode("aa")), ); - await os.put({ name: "b" }, readableStreamFrom(sc.encode("b"))); + await os.put( + { name: "b" }, + readableStreamFrom(new TextEncoder().encode("b")), + ); await done; @@ -515,15 +532,14 @@ Deno.test("objectstore - watch skip history", async () => { const objm = new Objm(nc); const os = await objm.create("test"); - const sc = StringCodec(); await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a")), + readableStreamFrom(new TextEncoder().encode("a")), ); await os.put( { name: "a" }, - readableStreamFrom(sc.encode("aa")), + readableStreamFrom(new TextEncoder().encode("aa")), ); const buf: ObjectInfo[] = []; @@ -541,7 +557,10 @@ Deno.test("objectstore - watch skip history", async () => { } })(); - await os.put({ name: "c" }, readableStreamFrom(sc.encode("c"))); + await os.put( + { name: "c" }, + readableStreamFrom(new TextEncoder().encode("c")), + ); await done; @@ -560,15 +579,14 @@ Deno.test("objectstore - watch history", async () => { const objm = new Objm(nc); const os = await objm.create("test"); - const sc = StringCodec(); await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a")), + readableStreamFrom(new TextEncoder().encode("a")), ); await os.put( { name: "a" }, - readableStreamFrom(sc.encode("aa")), + readableStreamFrom(new TextEncoder().encode("aa")), ); const buf: ObjectInfo[] = []; @@ -586,7 +604,10 @@ Deno.test("objectstore - watch history", async () => { } })(); - await os.put({ name: "c" }, readableStreamFrom(sc.encode("c"))); + await os.put( + { name: "c" }, + readableStreamFrom(new TextEncoder().encode("c")), + ); await done; @@ -607,10 +628,9 @@ Deno.test("objectstore - same store link", async () => { const objm = new Objm(nc); const os = await objm.create("test"); - const sc = StringCodec(); const src = await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a")), + readableStreamFrom(new TextEncoder().encode("a")), ); const oi = await os.link("ref", src); assertEquals(oi.options?.link?.bucket, src.bucket); @@ -635,10 +655,9 @@ Deno.test("objectstore - link of link rejected", async () => { const objm = new Objm(nc); const os = await objm.create("test"); - const sc = StringCodec(); const src = await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a")), + readableStreamFrom(new TextEncoder().encode("a")), ); const link = await os.link("ref", src); @@ -661,10 +680,9 @@ Deno.test("objectstore - external link", async () => { const objm = new Objm(nc); const os = await objm.create("test"); - const sc = StringCodec(); const src = await os.put( { name: "a" }, - readableStreamFrom(sc.encode("a")), + readableStreamFrom(new TextEncoder().encode("a")), ); const os2 = await objm.create("another"); @@ -793,9 +811,8 @@ Deno.test("objectstore - partials", async () => { } const objm = new Objm(nc); const os = await objm.create("test"); - const sc = StringCodec(); - const data = sc.encode("".padStart(7, "a")); + const data = new TextEncoder().encode("".padStart(7, "a")); const info = await os.put( { name: "test", options: { max_chunk_size: 2 } }, @@ -989,7 +1006,6 @@ Deno.test("objectstore - cannot put links", async () => { if (await notCompatible(ns, nc, "2.6.3")) { return; } - const sc = StringCodec(); const objm = new Objm(nc); const os = await objm.create("test"); @@ -1001,7 +1017,7 @@ Deno.test("objectstore - cannot put links", async () => { await assertRejects( async () => { - await os.put(mm, readableStreamFrom(sc.encode("a"))); + await os.put(mm, readableStreamFrom(new TextEncoder().encode("a"))); }, Error, "link cannot be set when putting the object in bucket", diff --git a/services/deno.json b/services/deno.json index 2c1e3ca7..ee58151d 100644 --- a/services/deno.json +++ b/services/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/services", - "version": "3.0.0-8", + "version": "3.0.0-9", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" @@ -33,6 +33,6 @@ "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30" } } diff --git a/services/import_map.json b/services/import_map.json index 26fb5eff..0c5e9ca1 100644 --- a/services/import_map.json +++ b/services/import_map.json @@ -1,7 +1,7 @@ { "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-29/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-30/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", diff --git a/services/package.json b/services/package.json index 20a5f2b9..d27e0f39 100644 --- a/services/package.json +++ b/services/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/services", - "version": "3.0.0-8", + "version": "3.0.0-9", "files": [ "lib/", "LICENSE", @@ -34,7 +34,7 @@ }, "description": "services library - this library implements all the base functionality for NATS services for javascript clients", "dependencies": { - "@nats-io/nats-core": "~3.0.0-29" + "@nats-io/nats-core": "~3.0.0-30" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/services/src/service.ts b/services/src/service.ts index 2071b5d7..fb6036e3 100644 --- a/services/src/service.ts +++ b/services/src/service.ts @@ -16,7 +16,6 @@ import { deferred, Empty, headers, - JSONCodec, nanos, nuid, parseSemVer, @@ -130,7 +129,7 @@ export class ServiceMsgImpl implements ServiceMsg { respondError( code: number, description: string, - data?: Uint8Array, + data?: Payload, opts?: PublishOptions, ): boolean { opts = opts || {}; @@ -488,14 +487,13 @@ export class ServiceImpl implements Service { } start(): Promise { - const jc = JSONCodec(); const statsHandler = (err: Error | null, msg: Msg): Promise => { if (err) { this.close(err); return Promise.reject(err); } return this.stats().then((s) => { - msg?.respond(jc.encode(s)); + msg?.respond(JSON.stringify(s)); return Promise.resolve(); }); }; @@ -505,11 +503,11 @@ export class ServiceImpl implements Service { this.close(err); return Promise.reject(err); } - msg?.respond(jc.encode(this.info())); + msg?.respond(JSON.stringify(this.info())); return Promise.resolve(); }; - const ping = jc.encode(this.ping()); + const ping = JSON.stringify(this.ping()); const pingHandler = (err: Error | null, msg: Msg): Promise => { if (err) { this.close(err).then().catch(); diff --git a/services/src/serviceclient.ts b/services/src/serviceclient.ts index b6def53e..92493102 100644 --- a/services/src/serviceclient.ts +++ b/services/src/serviceclient.ts @@ -14,7 +14,6 @@ */ import { Empty, - JSONCodec, QueuedIteratorImpl, RequestStrategy, } from "@nats-io/nats-core/internal"; @@ -79,13 +78,12 @@ export class ServiceClientImpl implements ServiceClient { id = "", ): Promise> { const iter = new QueuedIteratorImpl(); - const jc = JSONCodec(); const subj = ServiceImpl.controlSubject(v, name, id, this.prefix); const responses = await this.nc.requestMany(subj, Empty, this.opts); (async () => { for await (const m of responses) { try { - const s = jc.decode(m.data); + const s = m.json(); iter.push(s); } catch (err) { // @ts-ignore: pushing fn diff --git a/services/src/types.ts b/services/src/types.ts index b105381c..c3c777d3 100644 --- a/services/src/types.ts +++ b/services/src/types.ts @@ -2,6 +2,7 @@ import type { Msg, Nanos, NatsError, + Payload, PublishOptions, QueuedIterator, } from "@nats-io/nats-core"; @@ -10,7 +11,7 @@ export interface ServiceMsg extends Msg { respondError( code: number, description: string, - data?: Uint8Array, + data?: Payload, opts?: PublishOptions, ): boolean; } diff --git a/services/tests/service-check.ts b/services/tests/service-check.ts index 373b761b..8933a872 100644 --- a/services/tests/service-check.ts +++ b/services/tests/service-check.ts @@ -15,7 +15,7 @@ import { cli } from "https://deno.land/x/cobra@v0.0.9/mod.ts"; import { connect } from "jsr:@nats-io/nats-transport-deno@3.0.0-4"; -import { collect, parseSemVer, StringCodec } from "@nats-io/nats-core/internal"; +import { collect, parseSemVer } from "@nats-io/nats-core/internal"; import type { NatsConnection } from "@nats-io/nats-core/internal"; @@ -43,10 +43,10 @@ const root = cli({ let nc: NatsConnection | null = null; try { nc = await connect({ servers }); - await invoke(nc, name); - await checkPing(nc, name); - await checkInfo(nc, name); - await checkStats(nc, name); + await invoke(nc!, name); + await checkPing(nc!, name); + await checkInfo(nc!, name); + await checkStats(nc!, name); } catch (err) { cmd.stderr(err.message); console.log(err); @@ -154,7 +154,7 @@ async function invoke(nc: NatsConnection, name: string): Promise { // the service should throw/register an error if "error" is specified as payload proms = infos.map((v) => { - return nc.request(v.endpoints[0].subject, StringCodec().encode("error")); + return nc.request(v.endpoints[0].subject, "error"); }); responses = await Promise.all(proms); responses.forEach((m) => { @@ -168,14 +168,14 @@ async function invoke(nc: NatsConnection, name: string): Promise { proms = infos.map((v, idx) => { return nc.request( v.endpoints[0].subject, - StringCodec().encode(`hello ${idx}`), + `hello ${idx}`, ); }); responses = await Promise.all(proms); responses.forEach((m, idx) => { const r = `hello ${idx}`; assertEquals( - StringCodec().decode(m.data), + m.string(), r, `expected service response ${r}`, ); diff --git a/services/tests/service_test.ts b/services/tests/service_test.ts index 61570c20..6b490a1a 100644 --- a/services/tests/service_test.ts +++ b/services/tests/service_test.ts @@ -29,9 +29,7 @@ import { createInbox, delay, ErrorCode, - JSONCodec, nuid, - StringCodec, } from "@nats-io/nats-core/internal"; import type { Msg, @@ -102,7 +100,6 @@ Deno.test("service - bad name", async () => { Deno.test("service - client", async () => { const { ns, nc } = await _setup(connect, {}, {}); - const sc = StringCodec(); const subj = createInbox(); const svc = new Svc(nc); @@ -113,7 +110,7 @@ Deno.test("service - client", async () => { }) as ServiceImpl; srv.addEndpoint("hello", { handler: (_err, msg) => { - msg?.respond(sc.encode("hello")); + msg?.respond("hello"); }, subject: subj, }); @@ -687,9 +684,9 @@ Deno.test("service - cross platform service test", async () => { subject: createInbox(), handler: (_err, m): void => { if (m.data.length === 0) { - m.respondError(400, "need a string", JSONCodec().encode("")); + m.respondError(400, "need a string", JSON.stringify("")); } else { - if (StringCodec().decode(m.data) === "error") { + if (m.string() === "error") { throw new Error("service asked to throw an error"); } m.respond(m.data); @@ -723,9 +720,9 @@ Deno.test("service - cross platform service test", async () => { const { success, stderr, stdout } = await cmd.output(); if (!success) { - console.log(StringCodec().decode(stdout)); - console.log(StringCodec().decode(stderr)); - fail(StringCodec().decode(stderr)); + console.log(new TextDecoder().decode(stdout)); + console.log(new TextDecoder().decode(stderr)); + fail(new TextDecoder().decode(stderr)); } await nc.close(); @@ -746,7 +743,7 @@ Deno.test("service - stats name respects assigned name", async () => { const stats = await test.stats(); assertEquals(stats.name, "tEsT"); const r = await nc.request(`$SRV.PING.tEsT`); - const si = JSONCodec().decode(r.data); + const si = r.json(); assertEquals(si.name, "tEsT"); await cleanup(ns, nc); @@ -760,21 +757,20 @@ Deno.test("service - multiple endpoints", async () => { name: "multi", version: "0.0.1", }); - const sc = StringCodec(); ms.addEndpoint("hey", (_err, m) => { - m.respond(sc.encode("hi")); + m.respond("hi"); }); ms.addGroup("service").addEndpoint("echo", (_err, m) => { m.respond(m.data); }); let r = await nc.request(`hey`); - assertEquals(sc.decode(r.data), "hi"); - r = await nc.request(`service.echo`, sc.encode("yo!")); - assertEquals(sc.decode(r.data), "yo!"); + assertEquals(r.string(), "hi"); + r = await nc.request(`service.echo`, "yo!"); + assertEquals(r.string(), "yo!"); r = await nc.request(`$SRV.STATS`); - const stats = JSONCodec().decode(r.data) as ServiceStats; + const stats = r.json(); function t(name: string) { const v = stats.endpoints?.find((n) => { @@ -945,7 +941,7 @@ Deno.test("service - json reviver", async () => { }, }); - await nc.request("group.endpoint", JSONCodec().encode({ date: Date.now() })); + await nc.request("group.endpoint", JSON.stringify({ date: Date.now() })); await cleanup(ns, nc); }); diff --git a/transport-deno/deno.json b/transport-deno/deno.json index 915b5108..b7aaef40 100644 --- a/transport-deno/deno.json +++ b/transport-deno/deno.json @@ -20,7 +20,7 @@ }, "imports": { "@std/io": "jsr:@std/io@0.224.0", - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-29", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-30", "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2" } diff --git a/transport-node/package-lock.json b/transport-node/package-lock.json index 160d3e9b..68736119 100644 --- a/transport-node/package-lock.json +++ b/transport-node/package-lock.json @@ -1,12 +1,12 @@ { "name": "@nats-io/transport-node", - "version": "3.0.0-14", + "version": "3.0.0-15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@nats-io/transport-node", - "version": "3.0.0-14", + "version": "3.0.0-15", "license": "Apache-2.0", "dependencies": { "@nats-io/nats-core": "~3.0.0-20", diff --git a/transport-node/package.json b/transport-node/package.json index 68da683c..8bb3a98e 100644 --- a/transport-node/package.json +++ b/transport-node/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/transport-node", - "version": "3.0.0-14", + "version": "3.0.0-15", "description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system", "keywords": [ "nats", @@ -54,7 +54,7 @@ "node": ">= 18.0.0" }, "dependencies": { - "@nats-io/nats-core": "~3.0.0-29", + "@nats-io/nats-core": "~3.0.0-30", "@nats-io/nkeys": "~1.2.0-7", "@nats-io/nuid": "^2.0.1-2" }, diff --git a/transport-node/src/version.ts b/transport-node/src/version.ts index 0bf8b446..7e38d46f 100644 --- a/transport-node/src/version.ts +++ b/transport-node/src/version.ts @@ -1,2 +1,2 @@ // This file is generated - do not edit -export const version = "3.0.0-14"; +export const version = "3.0.0-15";