@sp-api-sdk/auth
Advanced tools
Comparing version 1.8.4 to 1.9.0
@@ -5,3 +5,3 @@ { | ||
"description": "Amazon Selling Partner API authentication helper class", | ||
"version": "1.8.3", | ||
"version": "1.8.4", | ||
"main": "dist/cjs/index.js", | ||
@@ -29,5 +29,5 @@ "module": "dist/es/index.js", | ||
"dependencies": { | ||
"@aws-sdk/client-sts": "^3.25.0", | ||
"@aws-sdk/client-sts": "^3.27.0", | ||
"got": "^11.8.2", | ||
"type-fest": "^2.0.0" | ||
"type-fest": "^2.1.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "repository": { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AccessTokenError = void 0; | ||
class AccessTokenError extends Error { | ||
const error_1 = require("../error"); | ||
class AccessTokenError extends error_1.SellingPartnerApiAuthError { | ||
constructor(message, meta) { | ||
super(message); | ||
this.name = 'AccessTokenError'; | ||
this.code = 'ACCESS_TOKEN_ERROR'; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
this.meta = meta; | ||
} | ||
get name() { | ||
return this.constructor.name; | ||
} | ||
} | ||
exports.AccessTokenError = AccessTokenError; |
@@ -39,3 +39,3 @@ "use strict"; | ||
if (!this.value) { | ||
throw new error_1.AccessTokenError('Unknown Error'); | ||
throw new error_1.AccessTokenError('Receive invalid token', { token: this.value }); | ||
} | ||
@@ -49,3 +49,6 @@ this.expirationDate = new Date(); | ||
} | ||
throw new error_1.AccessTokenError('Unknown Error'); | ||
if (error instanceof Error) { | ||
throw new error_1.AccessTokenError(error.message); | ||
} | ||
throw new error_1.AccessTokenError(`Unknown error: ${error}`); | ||
} | ||
@@ -52,0 +55,0 @@ } |
@@ -5,7 +5,10 @@ "use strict"; | ||
class SellingPartnerApiAuthError extends Error { | ||
constructor(message) { | ||
constructor(message, code = 'SELLING_PARTNER_API_AUTH_ERROR') { | ||
super(message); | ||
this.name = 'SellingPartnerApiAuthError'; | ||
this.code = code; | ||
} | ||
get name() { | ||
return this.constructor.name; | ||
} | ||
} | ||
exports.SellingPartnerApiAuthError = SellingPartnerApiAuthError; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SecurityTokenServiceError = void 0; | ||
class SecurityTokenServiceError extends Error { | ||
const error_1 = require("../error"); | ||
class SecurityTokenServiceError extends error_1.SellingPartnerApiAuthError { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'SecurityTokenServiceError'; | ||
this.code = 'SECURITY_TOKEN_SERVICE_ERROR'; | ||
} | ||
get name() { | ||
return this.constructor.name; | ||
} | ||
} | ||
exports.SecurityTokenServiceError = SecurityTokenServiceError; |
@@ -5,3 +5,3 @@ { | ||
"description": "Amazon Selling Partner API authentication helper class", | ||
"version": "1.8.3", | ||
"version": "1.8.4", | ||
"main": "dist/cjs/index.js", | ||
@@ -29,5 +29,5 @@ "module": "dist/es/index.js", | ||
"dependencies": { | ||
"@aws-sdk/client-sts": "^3.25.0", | ||
"@aws-sdk/client-sts": "^3.27.0", | ||
"got": "^11.8.2", | ||
"type-fest": "^2.0.0" | ||
"type-fest": "^2.1.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "repository": { |
@@ -1,8 +0,12 @@ | ||
export class AccessTokenError extends Error { | ||
import { SellingPartnerApiAuthError } from '../error'; | ||
export class AccessTokenError extends SellingPartnerApiAuthError { | ||
constructor(message, meta) { | ||
super(message); | ||
this.name = 'AccessTokenError'; | ||
this.code = 'ACCESS_TOKEN_ERROR'; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
this.meta = meta; | ||
} | ||
get name() { | ||
return this.constructor.name; | ||
} | ||
} |
@@ -35,3 +35,3 @@ import got, { RequestError } from 'got'; | ||
if (!this.value) { | ||
throw new AccessTokenError('Unknown Error'); | ||
throw new AccessTokenError('Receive invalid token', { token: this.value }); | ||
} | ||
@@ -45,3 +45,6 @@ this.expirationDate = new Date(); | ||
} | ||
throw new AccessTokenError('Unknown Error'); | ||
if (error instanceof Error) { | ||
throw new AccessTokenError(error.message); | ||
} | ||
throw new AccessTokenError(`Unknown error: ${error}`); | ||
} | ||
@@ -48,0 +51,0 @@ } |
export class SellingPartnerApiAuthError extends Error { | ||
constructor(message) { | ||
constructor(message, code = 'SELLING_PARTNER_API_AUTH_ERROR') { | ||
super(message); | ||
this.name = 'SellingPartnerApiAuthError'; | ||
this.code = code; | ||
} | ||
get name() { | ||
return this.constructor.name; | ||
} | ||
} |
@@ -1,6 +0,10 @@ | ||
export class SecurityTokenServiceError extends Error { | ||
import { SellingPartnerApiAuthError } from '../error'; | ||
export class SecurityTokenServiceError extends SellingPartnerApiAuthError { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'SecurityTokenServiceError'; | ||
this.code = 'SECURITY_TOKEN_SERVICE_ERROR'; | ||
} | ||
get name() { | ||
return this.constructor.name; | ||
} | ||
} |
@@ -1,4 +0,6 @@ | ||
export declare class AccessTokenError extends Error { | ||
import { SellingPartnerApiAuthError } from '../error'; | ||
export declare class AccessTokenError extends SellingPartnerApiAuthError { | ||
readonly meta?: any; | ||
constructor(message: string, meta?: any); | ||
get name(): string; | ||
} |
@@ -0,3 +1,7 @@ | ||
declare type SellingPartnerApiAuthErrorCode = 'ACCESS_TOKEN_ERROR' | 'SECURITY_TOKEN_SERVICE_ERROR' | 'SELLING_PARTNER_API_AUTH_ERROR'; | ||
export declare class SellingPartnerApiAuthError extends Error { | ||
constructor(message: string); | ||
code: SellingPartnerApiAuthErrorCode; | ||
constructor(message: string, code?: SellingPartnerApiAuthErrorCode); | ||
get name(): string; | ||
} | ||
export {}; |
@@ -1,3 +0,5 @@ | ||
export declare class SecurityTokenServiceError extends Error { | ||
import { SellingPartnerApiAuthError } from '../error'; | ||
export declare class SecurityTokenServiceError extends SellingPartnerApiAuthError { | ||
constructor(message: string); | ||
get name(): string; | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "Amazon Selling Partner API authentication helper class", | ||
"version": "1.8.4", | ||
"version": "1.9.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -29,5 +29,5 @@ "module": "dist/es/index.js", | ||
"dependencies": { | ||
"@aws-sdk/client-sts": "^3.25.0", | ||
"@aws-sdk/client-sts": "^3.27.0", | ||
"got": "^11.8.2", | ||
"type-fest": "^2.0.0" | ||
"type-fest": "^2.1.0" | ||
}, | ||
@@ -53,3 +53,3 @@ "repository": { | ||
], | ||
"gitHead": "3b2a61e225ed988547320fae35f085582caf67e4" | ||
"gitHead": "ccc62c529fc5f4525803ade1bbabdfc5aafc561f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
128081
570
Updated@aws-sdk/client-sts@^3.27.0
Updatedtype-fest@^2.1.0