New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nats-io/nats-core

Package Overview
Dependencies
Maintainers
0
Versions
36
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-28 to 3.0.0-29

4

lib/internal_mod.d.ts
export { NatsConnectionImpl } from "./nats";
export { Nuid, nuid } from "./nuid";
export type { TypedSubscriptionOptions } from "./types";
export { MsgImpl } from "./msg";

@@ -21,3 +20,2 @@ export { getResolveFn, setTransportFactory } from "./transport";

export * from "./nkeys";
export type { DispatchedFn, IngestionFilterFn, IngestionFilterFnResult, ProtocolFilterFn, } from "./queued_iterator";
export { QueuedIteratorImpl } from "./queued_iterator";

@@ -31,4 +29,2 @@ export type { MsgArg, ParserEvent } from "./parser";

export { ipV4, isIP, parseIP } from "./ipparser";
export { checkFn, TypedSubscription } from "./typedsub";
export type { MsgAdapter, TypedCallback } from "./typedsub";
export type { SemVer } from "./semver";

@@ -35,0 +31,0 @@ export { compare, Feature, Features, parseSemVer } from "./semver";

5

lib/internal_mod.js

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

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.TypedSubscription = exports.checkFn = exports.parseIP = exports.isIP = exports.ipV4 = exports.TE = exports.TD = 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;
var nats_1 = require("./nats");

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

Object.defineProperty(exports, "parseIP", { enumerable: true, get: function () { return ipparser_1.parseIP; } });
var typedsub_1 = require("./typedsub");
Object.defineProperty(exports, "checkFn", { enumerable: true, get: function () { return typedsub_1.checkFn; } });
Object.defineProperty(exports, "TypedSubscription", { enumerable: true, get: function () { return typedsub_1.TypedSubscription; } });
var semver_1 = require("./semver");

@@ -115,0 +112,0 @@ Object.defineProperty(exports, "compare", { enumerable: true, get: function () { return semver_1.compare; } });

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 type { ApiError, Auth, Authenticator, Backoff, BenchOpts, Codec, ConnectionOptions, Deferred, Delay, DispatchedFn, IngestionFilterFn, IngestionFilterFnResult, JwtAuth, Msg, MsgAdapter, MsgCallback, MsgHdrs, Nanos, NatsConnection, NKeyAuth, NoAuth, Payload, Perf, ProtocolFilterFn, Publisher, PublishOptions, QueuedIterator, RequestManyOptions, RequestOptions, ReviverFn, ServerInfo, ServersChanged, Stats, Status, Sub, SubOpts, Subscription, SubscriptionOptions, SyncIterator, Timeout, TlsOptions, TokenAuth, TypedCallback, TypedSubscriptionOptions, UserPass, } 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";

@@ -6,3 +6,2 @@ import type { Transport } from "./transport";

import type { ServerImpl } from "./servers";
import type { DispatchedFn, IngestionFilterFn, ProtocolFilterFn } from "./queued_iterator";
import { QueuedIteratorImpl } from "./queued_iterator";

@@ -53,7 +52,2 @@ import { MuxSubscription } from "./muxsubscription";

constructor(protocol: ProtocolHandler, subject: string, opts?: SubscriptionOptions);
setPrePostHandlers(opts: {
ingestionFilterFn?: IngestionFilterFn<Msg>;
protocolFilterFn?: ProtocolFilterFn<Msg>;
dispatchedFn?: DispatchedFn<Msg>;
}): void;
callback(err: NatsError | null, msg: Msg): void;

@@ -60,0 +54,0 @@ close(): void;

@@ -114,30 +114,2 @@ "use strict";

}
setPrePostHandlers(opts) {
if (this.noIterator) {
const uc = this.callback;
const ingestion = opts.ingestionFilterFn
? opts.ingestionFilterFn
: () => {
return { ingest: true, protocol: false };
};
const filter = opts.protocolFilterFn ? opts.protocolFilterFn : () => {
return true;
};
const dispatched = opts.dispatchedFn ? opts.dispatchedFn : () => { };
this.callback = (err, msg) => {
const { ingest } = ingestion(msg);
if (!ingest) {
return;
}
if (filter(msg)) {
uc(err, msg);
dispatched(msg);
}
};
}
else {
this.protocolFilterFn = opts.protocolFilterFn;
this.dispatchedFn = opts.dispatchedFn;
}
}
callback(err, msg) {

@@ -144,0 +116,0 @@ this.cancelTimeout();

import type { Deferred } from "./util";
import type { QueuedIterator } from "./core";
import type { CallbackFn, Dispatcher } from "./core";
export type IngestionFilterFnResult = {
ingest: boolean;
protocol: boolean;
};
/**
* IngestionFilterFn prevents a value from being ingested by the
* iterator. It is executed on `push`. If ingest is false the value
* shouldn't be pushed. If protcol is true, the value is a protcol
* value
*
* @param: data is the value
* @src: is the source of the data if set.
*/
export type IngestionFilterFn<T = unknown> = (data: T | null, src?: unknown) => IngestionFilterFnResult;
/**
* ProtocolFilterFn allows filtering of values that shouldn't be presented
* to the iterator. ProtocolFilterFn is executed when a value is about to be presented
*
* @param data: the value
* @returns boolean: true if the value should presented to the iterator
*/
export type ProtocolFilterFn<T = unknown> = (data: T | null) => boolean;
/**
* DispatcherFn allows for values to be processed after being presented
* to the iterator. Note that if the ProtocolFilter rejected the value
* it will _not_ be presented to the DispatchedFn. Any processing should
* instead have been handled by the ProtocolFilterFn.
* @param data: the value
*/
export type DispatchedFn<T = unknown> = (data: T | null) => void;
export declare class QueuedIteratorImpl<T> implements QueuedIterator<T>, Dispatcher<T> {

@@ -45,5 +15,2 @@ inflight: number;

pendingFiltered: number;
ingestionFilterFn?: IngestionFilterFn<T>;
protocolFilterFn?: ProtocolFilterFn<T>;
dispatchedFn?: DispatchedFn<T>;
ctx?: unknown;

@@ -53,2 +20,3 @@ _data?: unknown;

time: number;
profile: boolean;
yielding: boolean;

@@ -55,0 +23,0 @@ didBreak: boolean;

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

processed;
// FIXME: this is updated by the protocol
// this is updated by the protocol
received;

@@ -19,5 +19,2 @@ noIterator;

pendingFiltered;
ingestionFilterFn;
protocolFilterFn;
dispatchedFn;
ctx;

@@ -27,2 +24,3 @@ _data; //data is for use by extenders in any way they like

time;
profile;
yielding;

@@ -44,2 +42,3 @@ didBreak;

this.didBreak = false;
this.profile = false;
}

@@ -68,18 +67,4 @@ [Symbol.asyncIterator]() {

}
if (typeof v === "function") {
this.yields.push(v);
this.signal.resolve();
return;
}
const { ingest, protocol } = this.ingestionFilterFn
? this.ingestionFilterFn(v, this.ctx || this)
: { ingest: true, protocol: false };
if (ingest) {
if (protocol) {
this.filtered++;
this.pendingFiltered++;
}
this.yields.push(v);
this.signal.resolve();
}
this.yields.push(v);
this.signal.resolve();
}

@@ -122,18 +107,6 @@ async *iterate() {

}
// only pass messages that pass the filter
const ok = this.protocolFilterFn
? this.protocolFilterFn(yields[i])
: true;
if (ok) {
this.processed++;
const start = Date.now();
yield yields[i];
this.time = Date.now() - start;
if (this.dispatchedFn && yields[i]) {
this.dispatchedFn(yields[i]);
}
}
else {
this.pendingFiltered--;
}
this.processed++;
const start = this.profile ? Date.now() : 0;
yield yields[i];
this.time = this.profile ? Date.now() - start : 0;
this.inflight--;

@@ -140,0 +113,0 @@ }

export type { ApiError, Dispatcher, MsgHdrs, QueuedIterator } from "./core";
export { NatsError } from "./core";
export type { TypedSubscriptionOptions } from "./typedsub";
export { Empty } from "./encoders";

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

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

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

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

@@ -41,7 +41,7 @@ "lib/",

"devDependencies": {
"@types/node": "^22.0.0",
"@types/node": "^22.7.6",
"shx": "^0.3.4",
"typedoc": "^0.26.5",
"typedoc": "^0.26.10",
"typescript": "^5.5.4"
}
}
}

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