Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentoanit committed Sep 5, 2024
1 parent 8c81e17 commit 8c3ec35
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 20 deletions.
36 changes: 27 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? ''
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/http-client.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -15,7 +15,7 @@ export interface HttpClientAuth {

export type RequestBody = object | object[]

export type Headers = Record<string, string>
export type Headers = AxiosRequestHeaders

interface HttpClientRequestParams {
method: Method
Expand Down Expand Up @@ -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(' '))
}
Expand All @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions src/operations/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type WithOperationParameterKeys<T extends OperationParameter> = {
[K in keyof T]: OperationParameterValues
}

export type OperationParameterTransformer<T> = (
export type OperationParameterTransformer<T extends OperationParameter> = (
// eslint-disable-next-line no-unused-vars
originalQuery: T,
// eslint-disable-next-line no-unused-vars
Expand Down Expand Up @@ -50,11 +50,11 @@ export class Operation {
return `${resource}?${stringify(transformer(originalQuery, clonedQuery))}`
}

private hasKey<T>(obj: T, key: string | number | symbol): key is keyof T {
private hasKey<T extends object>(obj: T, key: string | number | symbol): key is keyof T {
return key in obj
}

protected paramsFilterTransformerReal<T>(
protected paramsFilterTransformerReal<T extends OperationParameter>(
params: T,
keys?: string[],
): WithOperationParameterKeys<T> {
Expand Down

0 comments on commit 8c3ec35

Please sign in to comment.