New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@qvac/response

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qvac/response

Response class for QVAC

latest
npmnpm
Version
0.1.2
Version published
Maintainers
2
Created
Source

@qvac/response

This library defines the response object used by the QVAC API. All responses from QVAC actions—such as inference, training, etc.—are returned as an instance of QvacResponse. The class now supports not only output streaming and cancellation, but also pausing and resuming the linked execution process. It also provides a chainable finish hook with a separate await() method to retrieve the final outputs.

Installation

npm i @qvac/response

Usage

Creating a Response Instance

When instantiating a QvacResponse, you must supply handler functions for canceling, pausing, and continuing the underlying process. For example:

const QvacResponse = require('@qvac/response')

const response = new QvacResponse({
  cancelHandler: async () => {
    // Logic to cancel the process
  },
  pauseHandler: async () => {
    // Logic to pause the process
  },
  continueHandler: async () => {
    // Logic to continue the process after a pause
  }
}, 
100 // pollInterval nterval 100 by default
)

Reading Response Output

You can consume the output updates as they arrive using the async iterator:

for await (const output of response.iterate()) {
  console.log('Received update:', output)
}

Or, you can register a callback to be notified of each update:

response.onUpdate((output) => {
  console.log('Update:', output)
})

Handling Completion with onFinish and await()

The finish hook is now chainable via onFinish(). You can await for the response to finish and retrieve the final outputs by calling the await() method. For example:

response
  .onFinish((finalOutputs) => {
    console.log('Final outputs via onFinish callback:', finalOutputs)
  })
  .onUpdate((output) => {
    console.log('Intermediate update:', output)
  })
  
  (...)
  //You can chain the await() method or later in your code await the promise to finish:
  await response.await()

Or directly await the method and get the final response

const finalOutputs = response.await()
console.log('Final outputs via await():', finalOutputs)

Canceling the Process

To cancel the linked execution process:

response.cancel()

Pausing and Continuing

You can pause the execution process and later continue it:

// To pause:
await response.pause()
console.log('Response paused:', response.getStatus())

// To continue:
await response.continue()
console.log('Response resumed:', response.getStatus())

Checking the Current Status

You can always check the current status of the response:

console.log('Current status:', response.getStatus())
// Possible statuses include: 'running', 'paused', 'ended', 'errored', 'cancelled'

Keywords

tether

FAQs

Package last updated on 12 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts