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

network-services

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

network-services - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

11

dist/index.d.ts

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

import { createService, Service } from "./service";
import { ServiceApp } from "./service_app";
import { ServiceAPI } from "./service_api";
import { createService, Service, ServiceOptions } from "./service";
import { ServiceApp, ServiceAppOptions } from "./service_app";
import { ServiceAPI, ServiceAPIOptions } from "./service_api";
import { CallTimeoutError, StreamClosedError, PropertyPathError, NotImplementedError, InstantiationError, QueueSizeLimitError } from "./errors";

@@ -8,2 +8,5 @@ import { Async } from "./types";

import { IdentifierGenerator, NumericIdentifierGenerator } from "./identifier_generator";
export { createService, Service, ServiceApp, ServiceAPI, Async, IdentifierGenerator, NumericIdentifierGenerator, CallMessage, ResultMessage, CallTimeoutError, InstantiationError, QueueSizeLimitError, NotImplementedError, PropertyPathError, StreamClosedError, };
import { Mux, MuxOptions, MuxConstructor } from "./mux";
import { BufferMux } from "./buffer_mux";
import { ObjectMux } from "./object_mux";
export { createService, Service, ServiceOptions, ServiceApp, ServiceAppOptions, ServiceAPI, ServiceAPIOptions, Mux, MuxOptions, MuxConstructor, BufferMux, ObjectMux, Async, IdentifierGenerator, NumericIdentifierGenerator, CallMessage, ResultMessage, CallTimeoutError, InstantiationError, QueueSizeLimitError, NotImplementedError, PropertyPathError, StreamClosedError };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamClosedError = exports.PropertyPathError = exports.NotImplementedError = exports.QueueSizeLimitError = exports.InstantiationError = exports.CallTimeoutError = exports.ResultMessage = exports.CallMessage = exports.NumericIdentifierGenerator = exports.ServiceAPI = exports.ServiceApp = exports.Service = exports.createService = void 0;
exports.StreamClosedError = exports.PropertyPathError = exports.NotImplementedError = exports.QueueSizeLimitError = exports.InstantiationError = exports.CallTimeoutError = exports.ResultMessage = exports.CallMessage = exports.NumericIdentifierGenerator = exports.ObjectMux = exports.BufferMux = exports.Mux = exports.ServiceAPI = exports.ServiceApp = exports.Service = exports.createService = void 0;
const service_1 = require("./service");

@@ -23,1 +23,7 @@ Object.defineProperty(exports, "createService", { enumerable: true, get: function () { return service_1.createService; } });

Object.defineProperty(exports, "NumericIdentifierGenerator", { enumerable: true, get: function () { return identifier_generator_1.NumericIdentifierGenerator; } });
const mux_1 = require("./mux");
Object.defineProperty(exports, "Mux", { enumerable: true, get: function () { return mux_1.Mux; } });
const buffer_mux_1 = require("./buffer_mux");
Object.defineProperty(exports, "BufferMux", { enumerable: true, get: function () { return buffer_mux_1.BufferMux; } });
const object_mux_1 = require("./object_mux");
Object.defineProperty(exports, "ObjectMux", { enumerable: true, get: function () { return object_mux_1.ObjectMux; } });

@@ -7,3 +7,2 @@ /// <reference types="node" />

import { CallMessage, ResultMessage } from './messages';
import { IdentifierGenerator } from './identifier_generator';
export interface MuxConstructor {

@@ -15,3 +14,2 @@ new (stream: stream.Duplex, options?: MuxOptions): Mux;

egressQueueSizeLimit?: number;
identifierGenerator?: IdentifierGenerator;
}

@@ -22,3 +20,2 @@ export declare abstract class Mux extends events.EventEmitter {

egressQueueSizeLimit?: number;
identifierGenerator?: IdentifierGenerator;
constructor(stream: stream.Duplex, options?: MuxOptions);

@@ -25,0 +22,0 @@ abstract mux(message: CallMessage | ResultMessage): void;

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

egressQueueSizeLimit;
identifierGenerator;
constructor(stream, options) {

@@ -35,0 +34,0 @@ super();

@@ -8,3 +8,2 @@ /// <reference types="node" />

egressQueue?: Array<CallMessage | ResultMessage>;
stream: stream.Duplex;
constructor(stream: stream.Duplex, options?: MuxOptions);

@@ -11,0 +10,0 @@ mux(message: CallMessage | ResultMessage): void;

@@ -9,7 +9,5 @@ "use strict";

egressQueue = [];
stream;
constructor(stream, options) {
super(stream, options);
this.egressQueueSizeLimit = options?.egressQueueSizeLimit;
this.stream = stream;
if (stream.listenerCount('error') === 0) {

@@ -16,0 +14,0 @@ stream.on('error', console.error);

@@ -25,5 +25,4 @@ /// <reference types="node" />

mux: Mux;
timeout?: number;
identifierGenerator: IdentifierGenerator;
timeout?: number;
egressBufferLimit?: number;
constructor(mux: Mux, options?: ServiceAPIOptions);

@@ -30,0 +29,0 @@ call(props: Array<string>, ...args: Array<unknown>): Promise<unknown>;

@@ -24,5 +24,4 @@ "use strict";

mux;
timeout;
identifierGenerator;
timeout;
egressBufferLimit;
constructor(mux, options) {

@@ -29,0 +28,0 @@ this.timeout = options?.timeout;

/// <reference types="node" />
import * as stream from 'stream';
import { ServiceApp, ServiceAppOptions } from './service_app';
import { ServiceAPIOptions } from './service_api';
import { ServiceAPI, ServiceAPIOptions } from './service_api';
import { Async } from './types';

@@ -13,4 +13,4 @@ import { Mux, MuxConstructor, MuxOptions } from './mux';

messageSize: number;
hasApp: boolean;
hasAPI: boolean;
serviceAPI?: ServiceAPI;
serviceApp?: ServiceApp<any>;
constructor(stream: stream.Duplex, options?: ServiceOptions & MuxOptions);

@@ -17,0 +17,0 @@ createServiceApp<T extends object>(app: T, options?: ServiceAppOptions<T>): ServiceApp<T>;

@@ -12,4 +12,5 @@ "use strict";

messageSize = 0;
hasApp = false;
hasAPI = false;
serviceAPI;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
serviceApp;
constructor(stream, options) {

@@ -27,5 +28,6 @@ if (options?.muxClass) {

createServiceApp(app, options) {
if (!this.hasApp) {
this.hasApp = true;
return new service_app_1.ServiceApp(app, this.mux, options);
if (!this.serviceApp) {
const serviceApp = new service_app_1.ServiceApp(app, this.mux, options);
this.serviceApp = serviceApp;
return serviceApp;
}

@@ -37,4 +39,5 @@ else {

createServiceAPI(options) {
if (!this.hasAPI) {
if (!this.serviceAPI) {
const serviceAPI = new service_api_1.ServiceAPI(this.mux, options);
this.serviceAPI = serviceAPI;
let props = [];

@@ -41,0 +44,0 @@ const handler = {

{
"name": "network-services",
"version": "0.2.1",
"version": "0.3.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -116,3 +116,2 @@ # *Network⬄Services*

- `egressQueueSizeLimit` `<number>` An optional egress buffer size limit in bytes. This argument specifies the limit on buffered data that may accumulate from calls *to* the remote Service App and return values *to* the remote Service API. If the size of the egress buffer exceeds this value, a `QueueSizeLimitError` will be thrown and the stream will close. **Default:** `undefined` (i.e., no limit).
- `identifierGenerator` `<IdentifierGenerator>` An optional class instance that implements the `network-services.IdentifierGenerator` interface. This class instance will be used in order to generate an unique identifier for each API call. The default `network-services.NumericIdentifierGenerator` will work for the common case; however, a more robust solution may be required for certain custom `net.Duplex` implementations. **Default:** `network-services.NumericIdentifierGenerator`
- `muxClass` `<MuxConstructor>` An optional `Mux` implementation. For example, you can extend the default `network-services.BufferMux` and override the `serializeMessage` and `deserializeMessage` methods in order to implement a custom [message protocol](#message-protocol).

@@ -131,2 +130,3 @@ - Returns: `<Service>`

- `timeout` `<number>` Optional argument in milliseconds that specifies the `timeout` for function calls. **Default:** `undefined` (i.e., no timeout).
- `identifierGenerator` `<IdentifierGenerator>` An optional instance of a class that implements the `network-services.IdentifierGenerator` interface. This class instance will be used in order to generate an unique identifier for each API call. The default `network-services.NumericIdentifierGenerator` will work for the common case; however, a more robust solution may be required for certain custom `net.Duplex` implementations. **Default:** `network-services.NumericIdentifierGenerator`

@@ -133,0 +133,0 @@ - Returns: `<Async<T>>` A `Proxy` of type `<T>` that consists of asynchronous analogues of methods in `<T>`.

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