@sp-api-sdk/vendor-invoices-api-v1
Advanced tools
Comparing version 1.7.3 to 1.8.0
@@ -5,3 +5,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("./src/client"), exports); | ||
tslib_1.__exportStar(require("./src/error"), exports); | ||
tslib_1.__exportStar(require("./src/api-model/models"), exports); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VendorInvoicesApiClient = exports.clientRateLimits = void 0; | ||
/* eslint-disable prefer-regex-literals */ | ||
const common_1 = require("@sp-api-sdk/common"); | ||
const api_model_1 = require("./api-model"); | ||
const error_1 = require("./error"); | ||
exports.clientRateLimits = [ | ||
{ | ||
method: 'post', | ||
// eslint-disable-next-line prefer-regex-literals | ||
urlRegex: new RegExp('^/vendor/payments/v1/invoices$'), | ||
@@ -17,23 +16,7 @@ rate: 10, | ||
class VendorInvoicesApiClient extends api_model_1.VendorPaymentsApi { | ||
constructor(parameters) { | ||
const config = common_1.sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new error_1.VendorInvoicesApiError(`Unknown region: ${parameters.region}`); | ||
} | ||
const { rateLimiting, ...clientParameters } = parameters; | ||
const axiosParameters = { | ||
...clientParameters, | ||
region: config.awsRegion, | ||
}; | ||
if (rateLimiting?.retry) { | ||
axiosParameters.rateLimits = exports.clientRateLimits; | ||
axiosParameters.onRetry = rateLimiting.onRetry; | ||
} | ||
const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters); | ||
const configuration = new api_model_1.Configuration(); | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = config.endpoints[environment]; | ||
super(configuration, endpoint, axiosInstance); | ||
constructor(configuration) { | ||
const { axios, endpoint } = (0, common_1.createAxiosInstance)(configuration, exports.clientRateLimits); | ||
super(new api_model_1.Configuration(), endpoint, axios); | ||
} | ||
} | ||
exports.VendorInvoicesApiClient = VendorInvoicesApiClient; |
export * from './src/client'; | ||
export * from './src/error'; | ||
export * from './src/api-model/models'; |
@@ -1,8 +0,7 @@ | ||
/* eslint-disable prefer-regex-literals */ | ||
import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common'; | ||
import { createAxiosInstance } from '@sp-api-sdk/common'; | ||
import { Configuration, VendorPaymentsApi } from './api-model'; | ||
import { VendorInvoicesApiError } from './error'; | ||
export const clientRateLimits = [ | ||
{ | ||
method: 'post', | ||
// eslint-disable-next-line prefer-regex-literals | ||
urlRegex: new RegExp('^/vendor/payments/v1/invoices$'), | ||
@@ -14,22 +13,6 @@ rate: 10, | ||
export class VendorInvoicesApiClient extends VendorPaymentsApi { | ||
constructor(parameters) { | ||
const config = sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new VendorInvoicesApiError(`Unknown region: ${parameters.region}`); | ||
} | ||
const { rateLimiting, ...clientParameters } = parameters; | ||
const axiosParameters = { | ||
...clientParameters, | ||
region: config.awsRegion, | ||
}; | ||
if (rateLimiting?.retry) { | ||
axiosParameters.rateLimits = clientRateLimits; | ||
axiosParameters.onRetry = rateLimiting.onRetry; | ||
} | ||
const axiosInstance = createAxiosInstance(axiosParameters); | ||
const configuration = new Configuration(); | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = config.endpoints[environment]; | ||
super(configuration, endpoint, axiosInstance); | ||
constructor(configuration) { | ||
const { axios, endpoint } = createAxiosInstance(configuration, clientRateLimits); | ||
super(new Configuration(), endpoint, axios); | ||
} | ||
} |
export * from './src/client'; | ||
export * from './src/error'; | ||
export * from './src/api-model/models'; |
@@ -1,13 +0,6 @@ | ||
import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common'; | ||
import { type ClientConfiguration, type RateLimit } from '@sp-api-sdk/common'; | ||
import { VendorPaymentsApi } from './api-model'; | ||
export declare const clientRateLimits: RateLimit[]; | ||
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> { | ||
region: SellingPartnerRegion; | ||
rateLimiting?: { | ||
retry: boolean; | ||
onRetry?: OnRetryHandler; | ||
}; | ||
} | ||
export declare class VendorInvoicesApiClient extends VendorPaymentsApi { | ||
constructor(parameters: ClientParameters); | ||
constructor(configuration: ClientConfiguration); | ||
} |
@@ -5,6 +5,7 @@ { | ||
"description": "The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.", | ||
"version": "1.7.3", | ||
"version": "1.8.0", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/es/index.js", | ||
"types": "dist/types/index.d.ts", | ||
"typedocMain": "./index.ts", | ||
"license": "MIT", | ||
@@ -30,4 +31,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"@sp-api-sdk/auth": "^1.9.12", | ||
"@sp-api-sdk/common": "^1.7.14", | ||
"@sp-api-sdk/auth": "^1.9.13", | ||
"@sp-api-sdk/common": "^1.8.0", | ||
"axios": "^0.27.2" | ||
@@ -54,3 +55,3 @@ }, | ||
], | ||
"gitHead": "e6a6c9da0de5a001da60b1d3f34a3796a3adab0d" | ||
"gitHead": "975705017de9384bf28b85e97d93f866d4d71611" | ||
} |
@@ -67,2 +67,25 @@ # `vendor-invoices-api-v1` | ||
## Logging | ||
You can enable logging for both SP-API requests and responses by configuring the `logging.request` and `logging.response` properties. | ||
```javascript | ||
const client = new VendorInvoicesApiClient({ | ||
auth, | ||
region: 'eu', | ||
logging: { | ||
request: { | ||
logger: console.debug | ||
}, | ||
response: { | ||
logger: console.debug | ||
} | ||
}, | ||
}) | ||
``` | ||
Specifying `true` will use the default options, specifying an object will allow you to override the default options. | ||
This uses [axios-logger](https://github.com/hg-pyun/axios-logger) under the hood. | ||
## License | ||
@@ -69,0 +92,0 @@ |
105
102420
81
2789
+ Added@aws-sdk/client-sso-oidc@3.592.0(transitive)
+ Added@aws-sdk/client-sts@3.592.0(transitive)
+ Added@aws-sdk/core@3.592.0(transitive)
- Removed@aws-sdk/client-sso@3.590.0(transitive)
- Removed@aws-sdk/client-sso-oidc@3.590.0(transitive)
- Removed@aws-sdk/client-sts@3.590.0(transitive)
- Removed@aws-sdk/core@3.588.0(transitive)
- Removed@aws-sdk/credential-provider-env@3.587.0(transitive)
- Removed@aws-sdk/credential-provider-http@3.587.0(transitive)
- Removed@aws-sdk/credential-provider-ini@3.590.0(transitive)
- Removed@aws-sdk/credential-provider-node@3.590.0(transitive)
- Removed@aws-sdk/credential-provider-process@3.587.0(transitive)
- Removed@aws-sdk/credential-provider-sso@3.590.0(transitive)
- Removed@aws-sdk/credential-provider-web-identity@3.587.0(transitive)
- Removed@aws-sdk/token-providers@3.587.0(transitive)
Updated@sp-api-sdk/auth@^1.9.13
Updated@sp-api-sdk/common@^1.8.0