Skip to content

v0.4.0

Latest

Choose a tag to compare

@dillu24 dillu24 released this 16 Nov 11:05

Overview

New SDK surface:

  • quoteTimeout on quotes.get()
  • QUOTE_TIMEOUT error code, reported in quote.warnings

SDK 0.4.0 requires Pegaroute v0.9.3 for quoteTimeout.

npm install @pegaroute/sdk@0.4.0

0.4.0 is additive over 0.3.0. Existing calls remain valid.

Upgrading

quoteTimeout controls how long Pegaroute collects provider quotes:

  • omitted or 0: wait for every provider (the current behaviour)
  • positive: a collection window in seconds. The full window is used, then pending providers are ignored if at least one quote arrived
  • negative: return once that many valid quotes arrived, so -1 returns the first quote
const quote = await pr.quotes.get({ ...params, quoteTimeout: 5 });

for (const warning of quote.warnings) {
  if (warning.code === "QUOTE_TIMEOUT") {
    // This provider was still pending when collection stopped.
  }
}

This is separate from the client's HTTP timeoutMs, which bounds the whole request, so keep timeoutMs above the quote window.

Full changelog: v0.3.0...v0.4.0