From 9f047fb52fc4c21f97a94cfd6833e4774c764ca2 Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Mon, 2 Dec 2024 12:04:24 -0600 Subject: [PATCH] change(core|obj): move SHA256 to objectstore module (#157) Signed-off-by: Alberto Ricart --- core/deno.json | 2 +- core/package.json | 2 +- core/src/internal_mod.ts | 2 -- core/src/version.ts | 2 +- jetstream/deno.json | 4 ++-- jetstream/import_map.json | 4 ++-- jetstream/package.json | 4 ++-- kv/deno.json | 4 ++-- kv/import_map.json | 8 ++++---- kv/package.json | 4 ++-- migration.md | 1 + obj/deno.json | 6 +++--- obj/import_map.json | 8 ++++---- obj/package.json | 6 +++--- obj/src/internal_mod.ts | 2 ++ obj/src/objectstore.ts | 2 +- {core => obj}/src/sha256.ts | 0 obj/tests/objectstore_test.ts | 2 +- services/deno.json | 2 +- services/import_map.json | 4 ++-- services/package.json | 2 +- transport-deno/deno.json | 2 +- transport-node/package.json | 8 ++++---- transport-node/src/version.ts | 2 +- 24 files changed, 42 insertions(+), 41 deletions(-) rename {core => obj}/src/sha256.ts (100%) diff --git a/core/deno.json b/core/deno.json index d2e58d9a..088ea819 100644 --- a/core/deno.json +++ b/core/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/nats-core", - "version": "3.0.0-45", + "version": "3.0.0-46", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" diff --git a/core/package.json b/core/package.json index b14000ff..ffa375db 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/nats-core", - "version": "3.0.0-45", + "version": "3.0.0-46", "files": [ "lib/", "LICENSE", diff --git a/core/src/internal_mod.ts b/core/src/internal_mod.ts index 9e30c852..f92f3d73 100644 --- a/core/src/internal_mod.ts +++ b/core/src/internal_mod.ts @@ -140,8 +140,6 @@ export { isIPV4OrHostname, Servers } from "./servers.ts"; export { Base64Codec, Base64UrlCodec, Base64UrlPaddedCodec } from "./base64.ts"; -export { SHA256 } from "./sha256.ts"; - export { wsconnect, wsUrlParseFn } from "./ws_transport.ts"; export { diff --git a/core/src/version.ts b/core/src/version.ts index a5db8198..d6e1f155 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-45"; +export const version = "3.0.0-46"; diff --git a/jetstream/deno.json b/jetstream/deno.json index 10058731..2e2231e8 100644 --- a/jetstream/deno.json +++ b/jetstream/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/jetstream", - "version": "3.0.0-32", + "version": "3.0.0-33", "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-45" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46" } } diff --git a/jetstream/import_map.json b/jetstream/import_map.json index d35f0154..d7be82d2 100644 --- a/jetstream/import_map.json +++ b/jetstream/import_map.json @@ -2,8 +2,8 @@ "imports": { "@nats-io/nkeys": "jsr:@nats-io/nkeys@~2.0.0-3", "@nats-io/nuid": "jsr:@nats-io/nuid@~2.0.1-2", - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-45", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-45/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-46/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 ea2ea203..eb113b89 100644 --- a/jetstream/package.json +++ b/jetstream/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/jetstream", - "version": "3.0.0-32", + "version": "3.0.0-33", "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-45" + "@nats-io/nats-core": "3.0.0-46" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/kv/deno.json b/kv/deno.json index f2300a6d..e300c4a1 100644 --- a/kv/deno.json +++ b/kv/deno.json @@ -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-45", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-32" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-33" } } diff --git a/kv/import_map.json b/kv/import_map.json index 18d35cf9..2550d0ae 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-45", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-45/internal", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-32", - "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-32/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-46/internal", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-33", + "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-33/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@~2.0.0-3", "@nats-io/nuid": "jsr:@nats-io/nuid@~2.0.1-2", diff --git a/kv/package.json b/kv/package.json index 4ce7a37c..b0d56b88 100644 --- a/kv/package.json +++ b/kv/package.json @@ -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-32", - "@nats-io/nats-core": "3.0.0-45" + "@nats-io/jetstream": "3.0.0-33", + "@nats-io/nats-core": "3.0.0-46" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/migration.md b/migration.md index 3eec70f4..bf12c61a 100644 --- a/migration.md +++ b/migration.md @@ -102,6 +102,7 @@ these modules for cross-runtime consumption. - RequestStrategy "Jitter" is now called "stall" to adopt the term used by new implementations in other clients and the RequestStrategy enum is now a type alias to simple strings "timer", "count", "stall", "sentinel". +- `SHA256` a support type for object store has been moved to @nats-io/obj ## Changes in JetStream diff --git a/obj/deno.json b/obj/deno.json index 018bdbe2..7596b5ed 100644 --- a/obj/deno.json +++ b/obj/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/obj", - "version": "3.0.0-27", + "version": "3.0.0-28", "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-45", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-32" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-33" } } diff --git a/obj/import_map.json b/obj/import_map.json index 18d35cf9..2550d0ae 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-45", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-45/internal", - "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-32", - "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-32/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-46/internal", + "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-33", + "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-33/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@~2.0.0-3", "@nats-io/nuid": "jsr:@nats-io/nuid@~2.0.1-2", diff --git a/obj/package.json b/obj/package.json index 06a5d7a9..44de5fe7 100644 --- a/obj/package.json +++ b/obj/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/obj", - "version": "3.0.0-27", + "version": "3.0.0-28", "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-32", - "@nats-io/nats-core": "3.0.0-45" + "@nats-io/jetstream": "3.0.0-33", + "@nats-io/nats-core": "3.0.0-46" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/obj/src/internal_mod.ts b/obj/src/internal_mod.ts index 6e950a37..06d6f66c 100644 --- a/obj/src/internal_mod.ts +++ b/obj/src/internal_mod.ts @@ -15,3 +15,5 @@ export type { export { StorageType } from "./types.ts"; export { Objm } from "./objectstore.ts"; + +export { SHA256, sha256 } from "./sha256.ts"; diff --git a/obj/src/objectstore.ts b/obj/src/objectstore.ts index e4f3b65b..d506645b 100644 --- a/obj/src/objectstore.ts +++ b/obj/src/objectstore.ts @@ -27,7 +27,6 @@ import { MsgHdrsImpl, nuid, QueuedIteratorImpl, - SHA256, } from "@nats-io/nats-core/internal"; import type { @@ -70,6 +69,7 @@ import type { ObjectStoreStatus, ObjectWatchInfo, } from "./types.ts"; +import { SHA256 } from "./sha256.ts"; export const osPrefix = "OBJ_"; export const digestType = "SHA-256="; diff --git a/core/src/sha256.ts b/obj/src/sha256.ts similarity index 100% rename from core/src/sha256.ts rename to obj/src/sha256.ts diff --git a/obj/tests/objectstore_test.ts b/obj/tests/objectstore_test.ts index abb8294d..6ec749e3 100644 --- a/obj/tests/objectstore_test.ts +++ b/obj/tests/objectstore_test.ts @@ -33,13 +33,13 @@ import { headers, nanos, nuid, - SHA256, } from "@nats-io/nats-core/internal"; import type { NatsConnectionImpl } from "@nats-io/nats-core/internal"; import type { ObjectInfo, ObjectStoreMeta } from "../src/types.ts"; import { jetstreamManager, StorageType } from "@nats-io/jetstream"; import { equals } from "https://deno.land/std@0.221.0/bytes/mod.ts"; import { digestType, Objm } from "../src/objectstore.ts"; +import { SHA256 } from "../src/sha256.ts"; function readableStreamFrom(data: Uint8Array): ReadableStream { return new ReadableStream({ diff --git a/services/deno.json b/services/deno.json index e0be7992..b4ad4514 100644 --- a/services/deno.json +++ b/services/deno.json @@ -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-45" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46" } } diff --git a/services/import_map.json b/services/import_map.json index 64df2ea5..78be4928 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-45", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-45/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-46/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@~2.0.0-3", "@nats-io/nuid": "jsr:@nats-io/nuid@~2.0.1-2", diff --git a/services/package.json b/services/package.json index b687f247..a870fe8a 100644 --- a/services/package.json +++ b/services/package.json @@ -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-45" + "@nats-io/nats-core": "3.0.0-46" }, "devDependencies": { "@types/node": "^22.7.6", diff --git a/transport-deno/deno.json b/transport-deno/deno.json index e85a839e..dcb3cdef 100644 --- a/transport-deno/deno.json +++ b/transport-deno/deno.json @@ -20,7 +20,7 @@ }, "imports": { "@std/io": "jsr:@std/io@0.225.0", - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-45", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-46", "@nats-io/nkeys": "jsr:@nats-io/nkeys@~2.0.0-3", "@nats-io/nuid": "jsr:@nats-io/nuid@~2.0.1-2" } diff --git a/transport-node/package.json b/transport-node/package.json index 30968861..31c4d0c6 100644 --- a/transport-node/package.json +++ b/transport-node/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/transport-node", - "version": "3.0.0-30", + "version": "3.0.0-31", "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-45", + "@nats-io/nats-core": "3.0.0-46", "@nats-io/nkeys": "2.0.0-3", "@nats-io/nuid": "2.0.1-2" }, @@ -63,8 +63,8 @@ "minimist": "^1.2.8", "shx": "^0.3.3", "typescript": "5.6.3", - "@nats-io/jetstream": "3.0.0-32", + "@nats-io/jetstream": "3.0.0-33", "@nats-io/kv": "3.0.0-26", - "@nats-io/obj": "3.0.0-27" + "@nats-io/obj": "3.0.0-28" } } diff --git a/transport-node/src/version.ts b/transport-node/src/version.ts index 14911460..99c9f13d 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-30"; +export const version = "3.0.0-31";