Skip to content

v0.11.0

Choose a tag to compare

@nmajor nmajor released this 10 Nov 23:18
· 1 commit to main since this release
  • Breaking: discriminated unions narrow on their discriminator. Item, Entity and BatchResult are now unions of the kinds this SDK models, so if (item.objectType === "qbd_service_item") or a switch gives a ServiceItem; before, the fallback stayed in the union and the narrowed value was ServiceItem | UnrecognizedItem. The fallbacks UnrecognizedItem, UnrecognizedEntity and UnknownBatchResult are separate types, and new type guards test each kind: isServiceItem(item), isVendor(entity), isBatchCustomerCreateResult(result) and so on, plus isUnrecognizedItem, isUnrecognizedEntity and isUnknownBatchResult for a kind this SDK does not model. Such a kind still arrives unchanged at runtime. Migration: test it with the fallback guard before narrowing (if (isUnrecognizedItem(item)) { ... }), instead of comparing objectType with "qbd_unrecognized_item" or another string this SDK does not list (a type error now), assigning an UnrecognizedItem to Item, or reading fields in the default branch of a switch over every kind (the value is never there).
  • Breaking: a write whose outcome was unknown and that the platform later recovered (request succeeded, outcome applied, recovered: true, result null, recoveredObjectId set) throws the new ResultUnavailableError from RequestHandle.wait(), RequestHandle.result() and the long poll after 504 QBD_REQUEST_TIMEOUT. They returned null typed as the result. The error is an InternalError with requestId, outcome applied, retryable false and recoveredObjectId; retrieve the object by that ID and do not send the write again. This holds also when the result is past retention (resultExpired true).
  • 500 INTERNAL_ERROR with details.reason result_unavailable (the result is no longer available) throws ResultUnavailableError (recoveredObjectId null) and is never retried, even when Daapi-Should-Retry says true. For a write that was applied (outcome: applied), never send it again and read the object instead; for a read (outcome: not_applicable), it is safe to send the read again.
  • client.qbd.priceLevels.list() accepts itemId, an alias of itemIds with Conductor's name for this filter, so Conductor code ports unchanged. Both take one item ID; sending both with different values returns 400 INVALID_PARAMETER. Batch members (BatchPriceLevelListInputQuery) accept it too.

All versions: CHANGELOG.md.