@sp-api-sdk/vendor-direct-fulfillment-payments-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.VendorDirectFulfillmentPaymentsApiClient = 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/directFulfillment/payments/v1/invoices$'), | ||
@@ -17,23 +16,7 @@ rate: 10, | ||
class VendorDirectFulfillmentPaymentsApiClient extends api_model_1.VendorInvoiceApi { | ||
constructor(parameters) { | ||
const config = common_1.sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new error_1.VendorDirectFulfillmentPaymentsApiError(`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.VendorDirectFulfillmentPaymentsApiClient = VendorDirectFulfillmentPaymentsApiClient; |
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, VendorInvoiceApi } from './api-model'; | ||
import { VendorDirectFulfillmentPaymentsApiError } from './error'; | ||
export const clientRateLimits = [ | ||
{ | ||
method: 'post', | ||
// eslint-disable-next-line prefer-regex-literals | ||
urlRegex: new RegExp('^/vendor/directFulfillment/payments/v1/invoices$'), | ||
@@ -14,22 +13,6 @@ rate: 10, | ||
export class VendorDirectFulfillmentPaymentsApiClient extends VendorInvoiceApi { | ||
constructor(parameters) { | ||
const config = sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new VendorDirectFulfillmentPaymentsApiError(`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 { VendorInvoiceApi } 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 VendorDirectFulfillmentPaymentsApiClient extends VendorInvoiceApi { | ||
constructor(parameters: ClientParameters); | ||
constructor(configuration: ClientConfiguration); | ||
} |
@@ -5,6 +5,7 @@ { | ||
"description": "The Selling Partner API for Direct Fulfillment Payments provides programmatic access to a direct fulfillment vendor's invoice 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-direct-fulfillment-payments-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 VendorDirectFulfillmentPaymentsApiClient({ | ||
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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105
90143
72
2383
Updated@sp-api-sdk/auth@^1.9.13
Updated@sp-api-sdk/common@^1.8.0