network-services
Advanced tools
Comparing version 1.0.0 to 1.0.1
"use strict"; | ||
/* eslint-disable no-empty */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +3,0 @@ exports.BufferMux = void 0; |
@@ -33,4 +33,4 @@ /// <reference types="node" /> | ||
connect(stream: stream.Duplex): void; | ||
onCallMessage(mux: Mux, message: CallMessage): Promise<void>; | ||
onResultMessage(message: ResultMessage): void; | ||
protected onCallMessage(mux: Mux, message: CallMessage): Promise<void>; | ||
protected onResultMessage(message: ResultMessage): void; | ||
protected startWorker(): Promise<threads.Worker>; | ||
@@ -37,0 +37,0 @@ } |
@@ -11,2 +11,3 @@ /// <reference types="node" /> | ||
export declare class Service { | ||
static streams: WeakSet<stream.Duplex>; | ||
mux: Mux; | ||
@@ -13,0 +14,0 @@ serviceAPI?: ServiceAPI; |
@@ -10,2 +10,3 @@ "use strict"; | ||
class Service { | ||
static streams = new WeakSet(); | ||
mux; | ||
@@ -16,2 +17,8 @@ serviceAPI; | ||
constructor(stream, options) { | ||
if (Service.streams.has(stream)) { | ||
throw new errors_1.InstantiationError(`The stream.Duplex instance has already been associated with a Service.`); | ||
} | ||
else { | ||
Service.streams.add(stream); | ||
} | ||
if (options?.muxClass) { | ||
@@ -29,4 +36,3 @@ this.mux = new options.muxClass(stream, options); | ||
if (!this.serviceApp) { | ||
const serviceApp = new service_app_1.ServiceApp(app, this.mux, options); | ||
this.serviceApp = serviceApp; | ||
const serviceApp = this.serviceApp = new service_app_1.ServiceApp(app, this.mux, options); | ||
return serviceApp; | ||
@@ -40,4 +46,3 @@ } | ||
if (!this.serviceAPI) { | ||
const serviceAPI = new service_api_1.ServiceAPI(this.mux, options); | ||
this.serviceAPI = serviceAPI; | ||
const serviceAPI = this.serviceAPI = new service_api_1.ServiceAPI(this.mux, options); | ||
let props = []; | ||
@@ -44,0 +49,0 @@ const handler = { |
{ | ||
"name": "network-services", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
72718
1106