You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@platformatic/itc

Package Overview
Dependencies
Maintainers
9
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/itc - npm Package Compare versions

Comparing version
3.14.0
to
3.15.0
+15
-8
lib/index.js

@@ -182,3 +182,3 @@ import { Unpromise } from '@watchable/unpromise'

export class ITC extends EventEmitter {
#requestEmitter
#waitingRequests
#handlers

@@ -204,3 +204,3 @@ #listening

this.port = port
this.#requestEmitter = new EventEmitter()
this.#waitingRequests = new Map()
this.#handlers = new Map()

@@ -212,5 +212,2 @@ this.#listening = false

// Make sure the emitter handle a lot of listeners at once before raising a warning
this.#requestEmitter.setMaxListeners(1e3)
/*

@@ -249,2 +246,3 @@ There some contexts in which a message is sent and the event loop empties up while waiting for a response.

let reqId
try {

@@ -256,5 +254,7 @@ this._enableKeepAlive()

const responsePromise = once(this.#requestEmitter, request.reqId).then(([response]) => response)
const promiseWithResolvers = Promise.withResolvers()
reqId = request.reqId
this.#waitingRequests.set(request.reqId, promiseWithResolvers)
const { error, data } = await Unpromise.race([responsePromise, this.#closePromise])
const { error, data } = await Unpromise.race([promiseWithResolvers.promise, this.#closePromise])

@@ -264,2 +264,4 @@ if (error !== null) throw error

} finally {
// Clean up the waiting requests map even if an error occurred
this.#waitingRequests.delete(reqId)
this._manageKeepAlive()

@@ -397,3 +399,8 @@ }

_emitResponse (response) {
this.#requestEmitter.emit(response.reqId, response)
const pending = this.#waitingRequests.get(response.reqId)
if (!pending) {
return
}
pending.resolve(response)
}

@@ -400,0 +407,0 @@

{
"name": "@platformatic/itc",
"version": "3.14.0",
"version": "3.15.0",
"description": "",

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