Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nats-io/nats-core

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nats-io/nats-core - npm Package Compare versions

Comparing version 3.0.0-29 to 3.0.0-30

12

lib/codec.d.ts

@@ -13,13 +13,1 @@ export interface Codec<T> {

}
/**
* Returns a {@link Codec} for encoding strings to a message payload
* and decoding message payloads into strings.
*/
export declare function StringCodec(): Codec<string>;
/**
* 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 declare function JSONCodec<T = unknown>(reviver?: (this: unknown, key: string, value: unknown) => unknown): Codec<T>;

@@ -17,50 +17,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.StringCodec = StringCodec;
exports.JSONCodec = JSONCodec;
const encoders_1 = require("./encoders");
const core_1 = require("./core");
/**
* Returns a {@link Codec} for encoding strings to a message payload
* and decoding message payloads into strings.
*/
function StringCodec() {
return {
encode(d) {
return encoders_1.TE.encode(d);
},
decode(a) {
return encoders_1.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
*/
function JSONCodec(reviver) {
return {
encode(d) {
try {
if (d === undefined) {
// @ts-ignore: json will not handle undefined
d = null;
}
return encoders_1.TE.encode(JSON.stringify(d));
}
catch (err) {
throw core_1.NatsError.errorForCode(core_1.ErrorCode.BadJson, err);
}
},
decode(a) {
try {
return JSON.parse(encoders_1.TD.decode(a), reviver);
}
catch (err) {
throw core_1.NatsError.errorForCode(core_1.ErrorCode.BadJson, err);
}
},
};
}
//# sourceMappingURL=codec.js.map

1

lib/internal_mod.d.ts

@@ -18,3 +18,2 @@ export { NatsConnectionImpl } from "./nats";

export type { Codec } from "./codec";
export { JSONCodec, StringCodec } from "./codec";
export * from "./nkeys";

@@ -21,0 +20,0 @@ export { QueuedIteratorImpl } from "./queued_iterator";

7

lib/internal_mod.js

@@ -31,4 +31,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Metric = exports.Bench = exports.writeAll = exports.readAll = exports.MAX_SIZE = exports.DenoBuffer = exports.State = exports.Parser = exports.Kind = exports.QueuedIteratorImpl = exports.StringCodec = exports.JSONCodec = exports.usernamePasswordAuthenticator = exports.tokenAuthenticator = exports.nkeyAuthenticator = exports.jwtAuthenticator = exports.credsAuthenticator = exports.RequestOne = exports.parseOptions = exports.defaultOptions = exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = exports.checkUnsupportedOption = exports.checkOptions = exports.buildAuthenticator = exports.DataBuffer = exports.MuxSubscription = exports.Heartbeat = exports.MsgHdrsImpl = exports.headers = exports.canonicalMIMEHeaderKey = exports.timeout = exports.SimpleMutex = exports.render = exports.nanos = exports.millis = exports.extend = exports.delay = exports.deferred = exports.deadline = exports.collect = exports.backoff = exports.ProtocolHandler = exports.INFO = exports.Connect = exports.setTransportFactory = exports.getResolveFn = exports.MsgImpl = exports.nuid = exports.Nuid = exports.NatsConnectionImpl = void 0;
exports.wsUrlParseFn = exports.wsconnect = exports.SHA256 = exports.Base64UrlPaddedCodec = exports.Base64UrlCodec = exports.Base64Codec = exports.Servers = exports.isIPV4OrHostname = exports.IdleHeartbeatMonitor = exports.Subscriptions = exports.SubscriptionImpl = exports.syncIterator = exports.RequestStrategy = exports.NatsError = exports.Match = exports.isNatsError = exports.Events = exports.ErrorCode = exports.DebugEvents = exports.createInbox = exports.protoLen = exports.extractProtocolMessage = exports.Empty = exports.parseSemVer = exports.Features = exports.Feature = exports.compare = exports.parseIP = exports.isIP = exports.ipV4 = exports.TE = exports.TD = void 0;
exports.TE = exports.TD = exports.Metric = exports.Bench = exports.writeAll = exports.readAll = exports.MAX_SIZE = exports.DenoBuffer = exports.State = exports.Parser = exports.Kind = exports.QueuedIteratorImpl = exports.usernamePasswordAuthenticator = exports.tokenAuthenticator = exports.nkeyAuthenticator = exports.jwtAuthenticator = exports.credsAuthenticator = exports.RequestOne = exports.parseOptions = exports.defaultOptions = exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = exports.checkUnsupportedOption = exports.checkOptions = exports.buildAuthenticator = exports.DataBuffer = exports.MuxSubscription = exports.Heartbeat = exports.MsgHdrsImpl = exports.headers = exports.canonicalMIMEHeaderKey = exports.timeout = exports.SimpleMutex = exports.render = exports.nanos = exports.millis = exports.extend = exports.delay = exports.deferred = exports.deadline = exports.collect = exports.backoff = exports.ProtocolHandler = exports.INFO = exports.Connect = exports.setTransportFactory = exports.getResolveFn = exports.MsgImpl = exports.nuid = exports.Nuid = exports.NatsConnectionImpl = void 0;
exports.wsUrlParseFn = exports.wsconnect = exports.SHA256 = exports.Base64UrlPaddedCodec = exports.Base64UrlCodec = exports.Base64Codec = exports.Servers = exports.isIPV4OrHostname = exports.IdleHeartbeatMonitor = exports.Subscriptions = exports.SubscriptionImpl = exports.syncIterator = exports.RequestStrategy = exports.NatsError = exports.Match = exports.isNatsError = exports.Events = exports.ErrorCode = exports.DebugEvents = exports.createInbox = exports.protoLen = exports.extractProtocolMessage = exports.Empty = exports.parseSemVer = exports.Features = exports.Feature = exports.compare = exports.parseIP = exports.isIP = exports.ipV4 = void 0;
var nats_1 = require("./nats");

@@ -85,5 +85,2 @@ Object.defineProperty(exports, "NatsConnectionImpl", { enumerable: true, get: function () { return nats_1.NatsConnectionImpl; } });

Object.defineProperty(exports, "usernamePasswordAuthenticator", { enumerable: true, get: function () { return authenticator_1.usernamePasswordAuthenticator; } });
var codec_1 = require("./codec");
Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function () { return codec_1.JSONCodec; } });
Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function () { return codec_1.StringCodec; } });
__exportStar(require("./nkeys"), exports);

@@ -90,0 +87,0 @@ var queued_iterator_1 = require("./queued_iterator");

@@ -1,2 +0,2 @@

export { backoff, Bench, buildAuthenticator, canonicalMIMEHeaderKey, createInbox, credsAuthenticator, deadline, DebugEvents, deferred, delay, Empty, ErrorCode, Events, headers, JSONCodec, jwtAuthenticator, Match, Metric, millis, MsgHdrsImpl, nanos, NatsError, nkeyAuthenticator, nkeys, Nuid, nuid, RequestStrategy, StringCodec, syncIterator, tokenAuthenticator, usernamePasswordAuthenticator, wsconnect, } from "./internal_mod";
export { backoff, Bench, buildAuthenticator, canonicalMIMEHeaderKey, createInbox, credsAuthenticator, deadline, DebugEvents, deferred, delay, Empty, ErrorCode, Events, headers, jwtAuthenticator, Match, Metric, millis, MsgHdrsImpl, nanos, NatsError, nkeyAuthenticator, nkeys, Nuid, nuid, RequestStrategy, syncIterator, tokenAuthenticator, usernamePasswordAuthenticator, wsconnect, } from "./internal_mod";
export type { ApiError, Auth, Authenticator, Backoff, BenchOpts, Codec, ConnectionOptions, Deferred, Delay, JwtAuth, Msg, MsgCallback, MsgHdrs, Nanos, NatsConnection, NKeyAuth, NoAuth, Payload, Perf, Publisher, PublishOptions, QueuedIterator, RequestManyOptions, RequestOptions, ReviverFn, ServerInfo, ServersChanged, Stats, Status, Sub, SubOpts, Subscription, SubscriptionOptions, SyncIterator, Timeout, TlsOptions, TokenAuth, UserPass, } from "./internal_mod";

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.wsconnect = exports.usernamePasswordAuthenticator = exports.tokenAuthenticator = exports.syncIterator = exports.StringCodec = exports.RequestStrategy = exports.nuid = exports.Nuid = exports.nkeys = exports.nkeyAuthenticator = exports.NatsError = exports.nanos = exports.MsgHdrsImpl = exports.millis = exports.Metric = exports.Match = exports.jwtAuthenticator = exports.JSONCodec = exports.headers = exports.Events = exports.ErrorCode = exports.Empty = exports.delay = exports.deferred = exports.DebugEvents = exports.deadline = exports.credsAuthenticator = exports.createInbox = exports.canonicalMIMEHeaderKey = exports.buildAuthenticator = exports.Bench = exports.backoff = void 0;
exports.wsconnect = exports.usernamePasswordAuthenticator = exports.tokenAuthenticator = exports.syncIterator = exports.RequestStrategy = exports.nuid = exports.Nuid = exports.nkeys = exports.nkeyAuthenticator = exports.NatsError = exports.nanos = exports.MsgHdrsImpl = exports.millis = exports.Metric = exports.Match = exports.jwtAuthenticator = exports.headers = exports.Events = exports.ErrorCode = exports.Empty = exports.delay = exports.deferred = exports.DebugEvents = exports.deadline = exports.credsAuthenticator = exports.createInbox = exports.canonicalMIMEHeaderKey = exports.buildAuthenticator = exports.Bench = exports.backoff = void 0;
var internal_mod_1 = require("./internal_mod");

@@ -34,3 +34,2 @@ Object.defineProperty(exports, "backoff", { enumerable: true, get: function () { return internal_mod_1.backoff; } });

Object.defineProperty(exports, "headers", { enumerable: true, get: function () { return internal_mod_1.headers; } });
Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function () { return internal_mod_1.JSONCodec; } });
Object.defineProperty(exports, "jwtAuthenticator", { enumerable: true, get: function () { return internal_mod_1.jwtAuthenticator; } });

@@ -48,3 +47,2 @@ Object.defineProperty(exports, "Match", { enumerable: true, get: function () { return internal_mod_1.Match; } });

Object.defineProperty(exports, "RequestStrategy", { enumerable: true, get: function () { return internal_mod_1.RequestStrategy; } });
Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function () { return internal_mod_1.StringCodec; } });
Object.defineProperty(exports, "syncIterator", { enumerable: true, get: function () { return internal_mod_1.syncIterator; } });

@@ -51,0 +49,0 @@ Object.defineProperty(exports, "tokenAuthenticator", { enumerable: true, get: function () { return internal_mod_1.tokenAuthenticator; } });

import type { MsgArg } from "./parser";
import type { Codec } from "./codec";
import type { Msg, MsgHdrs, Publisher, RequestInfo, ReviverFn } from "./core";
import type { Msg, MsgHdrs, Payload, Publisher, RequestInfo, ReviverFn } from "./core";
import { NatsError } from "./core";

@@ -13,3 +12,2 @@ export declare function isRequestError(msg: Msg): NatsError | null;

publisher: Publisher;
static jc: Codec<unknown>;
constructor(msg: MsgArg, data: Uint8Array, publisher: Publisher);

@@ -21,3 +19,3 @@ get subject(): string;

get data(): Uint8Array;
respond(data?: Uint8Array, opts?: {
respond(data?: Payload, opts?: {
headers?: MsgHdrs;

@@ -24,0 +22,0 @@ reply?: string;

@@ -21,3 +21,2 @@ "use strict";

const encoders_1 = require("./encoders");
const codec_1 = require("./codec");
const core_1 = require("./core");

@@ -40,3 +39,2 @@ function isRequestError(msg) {

publisher;
static jc;
constructor(msg, data, publisher) {

@@ -94,3 +92,3 @@ this._msg = msg;

json(reviver) {
return (0, codec_1.JSONCodec)(reviver).decode(this.data);
return JSON.parse(this.string(), reviver);
}

@@ -97,0 +95,0 @@ string() {

@@ -1,1 +0,1 @@

export declare const version = "3.0.0-29";
export declare const version = "3.0.0-30";

@@ -5,3 +5,3 @@ "use strict";

// This file is generated - do not edit
exports.version = "3.0.0-29";
exports.version = "3.0.0-30";
//# sourceMappingURL=version.js.map
{
"name": "@nats-io/nats-core",
"version": "3.0.0-29",
"version": "3.0.0-30",
"files": [

@@ -5,0 +5,0 @@ "lib/",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc