From 3758b73eefc2014844529b975c01432268261bc7 Mon Sep 17 00:00:00 2001 From: Abraham Lopez <10536776+AbrahamLopez10@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:11:43 -0500 Subject: [PATCH] fix(opapi): include HTTP 424 in ApiError.status and add type guard (#511) --- opapi/package.json | 2 +- opapi/src/generators/errors.ts | 2 +- opapi/src/state.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opapi/package.json b/opapi/package.json index 2bf4841c..d023767e 100644 --- a/opapi/package.json +++ b/opapi/package.json @@ -1,6 +1,6 @@ { "name": "@bpinternal/opapi", - "version": "0.11.0", + "version": "0.11.1", "description": "", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/opapi/src/generators/errors.ts b/opapi/src/generators/errors.ts index 43da9283..d08d323f 100644 --- a/opapi/src/generators/errors.ts +++ b/opapi/src/generators/errors.ts @@ -18,7 +18,7 @@ const codes = { HTTP_STATUS_BAD_GATEWAY: 502, HTTP_STATUS_SERVICE_UNAVAILABLE: 503, HTTP_STATUS_GATEWAY_TIMEOUT: 504, -} as const +} as const satisfies Record export function generateErrors(errors: ApiError[]) { const types = errors.map((error) => error.type) diff --git a/opapi/src/state.ts b/opapi/src/state.ts index 8bec4d4b..8a2fe48c 100644 --- a/opapi/src/state.ts +++ b/opapi/src/state.ts @@ -44,7 +44,7 @@ const internalError: ApiError = { } export type ApiError = { - status: 400 | 401 | 402 | 403 | 404 | 405 | 408 | 409 | 413 | 415 | 429 | 500 | 501 | 502 | 503 | 504 + status: 400 | 401 | 402 | 403 | 404 | 405 | 408 | 409 | 413 | 415 | 424 | 429 | 500 | 501 | 502 | 503 | 504 type: string description: string }