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

@peerbit/stream-interface

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peerbit/stream-interface - npm Package Compare versions

Comparing version 3.0.9 to 4.0.0

11

lib/esm/messages.d.ts

@@ -68,2 +68,11 @@ import { Uint8ArrayList } from "uint8arraylist";

}
export type WithTo = {
to?: (string | PublicSignKey | PeerId)[] | Set<string>;
};
export type WithMode = {
mode?: SilentDelivery | SeekDelivery | AcknowledgeDelivery | AnyWhere;
};
export type PriorityOptions = {
priority?: number;
};
export declare class MessageHeader<T extends DeliveryMode = DeliveryMode> {

@@ -76,2 +85,3 @@ private _id;

mode: T;
priority?: number;
signatures: Signatures | undefined;

@@ -84,2 +94,3 @@ constructor(properties: {

mode: T;
priority?: number;
});

@@ -86,0 +97,0 @@ get id(): Uint8Array;

@@ -222,2 +222,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

export { MultiAddrinfo };
const getDefaultPriorityFromMode = (mode) => {
if (mode instanceof SilentDelivery) {
return 0;
}
if (mode instanceof AnyWhere) {
return 0;
}
if (mode instanceof SeekDelivery) {
return 1;
}
if (mode instanceof AcknowledgeDelivery) {
return 1;
}
if (mode instanceof TracedDelivery) {
return 1;
}
throw new Error("Unexpected mode: " + mode.constructor.name);
};
let MessageHeader = class MessageHeader {

@@ -231,2 +249,4 @@ _id;

mode;
// Priority. Lower hgher. used for implementing optimistic empool behaviour
priority;
// Not signed, since we might want to modify it during transit

@@ -242,2 +262,6 @@ signatures;

this.mode = properties.mode;
this.priority =
properties.priority != null
? properties.priority
: getDefaultPriorityFromMode(this.mode);
}

@@ -279,2 +303,6 @@ get id() {

__decorate([
field({ type: "u32" }),
__metadata("design:type", Number)
], MessageHeader.prototype, "priority", void 0);
__decorate([
field({ type: option(Signatures) }),

@@ -281,0 +309,0 @@ __metadata("design:type", Object)

4

package.json
{
"name": "@peerbit/stream-interface",
"version": "3.0.9",
"version": "4.0.0",
"description": "Block store streaming",

@@ -55,3 +55,3 @@ "type": "module",

},
"gitHead": "9b281c236fbc086bbf7cd585e66a07bbc9e3ac17"
"gitHead": "9536898b1f74d42c4f97183b864945fa29422d3e"
}

@@ -221,2 +221,33 @@ import {

export type WithTo = {
to?: (string | PublicSignKey | PeerId)[] | Set<string>;
};
export type WithMode = {
mode?: SilentDelivery | SeekDelivery | AcknowledgeDelivery | AnyWhere;
};
export type PriorityOptions = {
priority?: number;
};
const getDefaultPriorityFromMode = (mode: DeliveryMode) => {
if (mode instanceof SilentDelivery) {
return 0;
}
if (mode instanceof AnyWhere) {
return 0;
}
if (mode instanceof SeekDelivery) {
return 1;
}
if (mode instanceof AcknowledgeDelivery) {
return 1;
}
if (mode instanceof TracedDelivery) {
return 1;
}
throw new Error("Unexpected mode: " + mode.constructor.name);
};
@variant(0)

@@ -243,2 +274,6 @@ export class MessageHeader<T extends DeliveryMode = DeliveryMode> {

// Priority. Lower hgher. used for implementing optimistic empool behaviour
@field({ type: "u32" })
priority?: number;
// Not signed, since we might want to modify it during transit

@@ -254,2 +289,3 @@ @field({ type: option(Signatures) })

mode: T;
priority?: number;
}) {

@@ -263,2 +299,6 @@ this._id = properties?.id || randomBytes(ID_LENGTH);

this.mode = properties.mode;
this.priority =
properties.priority != null
? properties.priority
: getDefaultPriorityFromMode(this.mode);
}

@@ -265,0 +305,0 @@

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