From 611953e2f3b7d361ab8bb07049f45daa24cabbc0 Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Thu, 5 Sep 2024 14:58:02 +0700 Subject: [PATCH] fix: build --- package-lock.json | 50 +++++++++++++++++++++++++------------ package.json | 4 +-- src/errors.ts | 4 +-- src/http-client.ts | 8 +++--- src/operations/operation.ts | 6 ++--- 5 files changed, 45 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b097cd95..5483ce668 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.8.3", "license": "MIT", "dependencies": { - "@scaleleap/amazon-marketplaces": "^17.1.0", + "@scaleleap/amazon-marketplaces": "^18.0.1", "agentkeepalive": "4.5.0", "axios": "0.28.1", "client-oauth2": "4.3.3", @@ -31,7 +31,7 @@ "@scaleleap/semantic-release-config": "1.1.41", "@types/jest": "27.4.0", "@types/lodash": "4.17.7", - "@types/node": "16.11.21", + "@types/node": "18.19.50", "@typescript-eslint/eslint-plugin": "7.16.1", "@typescript-eslint/parser": "7.16.1", "eslint": "9.9.0", @@ -2462,9 +2462,9 @@ } }, "node_modules/@scaleleap/amazon-marketplaces": { - "version": "17.3.1", - "resolved": "https://registry.npmjs.org/@scaleleap/amazon-marketplaces/-/amazon-marketplaces-17.3.1.tgz", - "integrity": "sha512-uf8MYrmzvOIIscW8pJyRj5X+TcyLZex2FsMDOqIrurtF3hCIp3MlHzHYGCQUevdRnS9Bs+7swn8vTUcgSvUSDw==", + "version": "18.0.1", + "resolved": "https://registry.npmjs.org/@scaleleap/amazon-marketplaces/-/amazon-marketplaces-18.0.1.tgz", + "integrity": "sha512-iPpyeXaAM7xAAPqysbuGEHOBXEJZ3psYiNaJhNGPfLLs0RlmrjevAXRBbyiqeXyVpYyFBkC4kHoFZlwF52HXRA==", "dependencies": { "@lavadrop/ensure": "1.0.0" } @@ -3206,10 +3206,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.11.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.21.tgz", - "integrity": "sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A==", - "dev": true + "version": "18.19.50", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.50.tgz", + "integrity": "sha512-xonK+NRrMBRtkL1hVCc3G+uXtjh1Al4opBLjqVmipe5ZAaBYWW6cNAiBVZ1BvmkBhep698rP3UM3aRAdSALuhg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/normalize-package-data": { "version": "2.4.0", @@ -18205,6 +18208,12 @@ "node": ">=0.8.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/unified": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz", @@ -20842,9 +20851,9 @@ } }, "@scaleleap/amazon-marketplaces": { - "version": "17.3.1", - "resolved": "https://registry.npmjs.org/@scaleleap/amazon-marketplaces/-/amazon-marketplaces-17.3.1.tgz", - "integrity": "sha512-uf8MYrmzvOIIscW8pJyRj5X+TcyLZex2FsMDOqIrurtF3hCIp3MlHzHYGCQUevdRnS9Bs+7swn8vTUcgSvUSDw==", + "version": "18.0.1", + "resolved": "https://registry.npmjs.org/@scaleleap/amazon-marketplaces/-/amazon-marketplaces-18.0.1.tgz", + "integrity": "sha512-iPpyeXaAM7xAAPqysbuGEHOBXEJZ3psYiNaJhNGPfLLs0RlmrjevAXRBbyiqeXyVpYyFBkC4kHoFZlwF52HXRA==", "requires": { "@lavadrop/ensure": "1.0.0" } @@ -21444,10 +21453,13 @@ "dev": true }, "@types/node": { - "version": "16.11.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.21.tgz", - "integrity": "sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A==", - "dev": true + "version": "18.19.50", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.50.tgz", + "integrity": "sha512-xonK+NRrMBRtkL1hVCc3G+uXtjh1Al4opBLjqVmipe5ZAaBYWW6cNAiBVZ1BvmkBhep698rP3UM3aRAdSALuhg==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@types/normalize-package-data": { "version": "2.4.0", @@ -32564,6 +32576,12 @@ "dev": true, "optional": true }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "unified": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz", diff --git a/package.json b/package.json index 4e2f6665b..14811e5bb 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "author": "", "license": "MIT", "dependencies": { - "@scaleleap/amazon-marketplaces": "^17.1.0", + "@scaleleap/amazon-marketplaces": "^18.0.1", "agentkeepalive": "4.5.0", "axios": "0.28.1", "client-oauth2": "4.3.3", @@ -53,7 +53,7 @@ "@scaleleap/semantic-release-config": "1.1.41", "@types/jest": "27.4.0", "@types/lodash": "4.17.7", - "@types/node": "16.11.21", + "@types/node": "18.19.50", "@typescript-eslint/eslint-plugin": "7.16.1", "@typescript-eslint/parser": "7.16.1", "eslint": "9.9.0", diff --git a/src/errors.ts b/src/errors.ts index 5986a2b3c..b5b4a30f8 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -42,12 +42,12 @@ export class SnapshotDownloadError extends ExtendableError { export class GenericError extends ExtendableError { public code: string - public requestId: string + public requestId: unknown; public constructor(err: ErrorObject, headers: Headers) { super(err.details) this.code = err.code - this.requestId = headers['x-amz-request-id'] || headers['x-amz-rid'] || '' + this.requestId = headers['x-amz-request-id'] ?? headers['x-amz-rid'] ?? '' } } diff --git a/src/http-client.ts b/src/http-client.ts index 578f0fc7c..50ec73902 100644 --- a/src/http-client.ts +++ b/src/http-client.ts @@ -1,4 +1,4 @@ -import { axios, Method, AxiosResponse } from './axios' +import { axios, Method, AxiosResponse, AxiosRequestHeaders } from './axios' import HttpStatus from 'http-status-codes' import { JSON_CONTENT_TYPE } from './constants' @@ -15,7 +15,7 @@ export interface HttpClientAuth { export type RequestBody = object | object[] -export type Headers = Record +export type Headers = AxiosRequestHeaders interface HttpClientRequestParams { method: Method @@ -195,7 +195,7 @@ export class HttpClient { // if any failures are detected this.handleApiResponse(res) - const location: string | null = res.headers['location'] + const location: string | undefined = res.headers['location'] if (res.status !== this.httpStatus.TEMPORARY_REDIRECT || !location) { throw new InvalidProgramStateError(['Expected a signed URL.', res.statusText].join(' ')) } @@ -209,7 +209,7 @@ export class HttpClient { } const buffer = Buffer.from(download.data) - const contentType: string = download.headers['content-type'] + const contentType: string | undefined = download.headers['content-type'] const bufferToJson = (buf: Buffer): T => { return JSON.parse(buf.toString()) diff --git a/src/operations/operation.ts b/src/operations/operation.ts index b2351e793..fdae69442 100644 --- a/src/operations/operation.ts +++ b/src/operations/operation.ts @@ -13,7 +13,7 @@ export type WithOperationParameterKeys = { [K in keyof T]: OperationParameterValues } -export type OperationParameterTransformer = ( +export type OperationParameterTransformer = ( // eslint-disable-next-line no-unused-vars originalQuery: T, // eslint-disable-next-line no-unused-vars @@ -50,11 +50,11 @@ export class Operation { return `${resource}?${stringify(transformer(originalQuery, clonedQuery))}` } - private hasKey(obj: T, key: string | number | symbol): key is keyof T { + private hasKey(obj: T, key: string | number | symbol): key is keyof T { return key in obj } - protected paramsFilterTransformerReal( + protected paramsFilterTransformerReal( params: T, keys?: string[], ): WithOperationParameterKeys {