modern-treasury
Advanced tools
Comparing version 2.33.2 to 2.34.0
18
core.js
@@ -194,2 +194,3 @@ "use strict"; | ||
buildRequest(options, { retryCount = 0 } = {}) { | ||
options = { ...options }; | ||
const { method, path, query, headers: headers = {} } = options; | ||
@@ -205,5 +206,5 @@ const body = ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ? | ||
validatePositiveInteger('timeout', options.timeout); | ||
const timeout = options.timeout ?? this.timeout; | ||
options.timeout = options.timeout ?? this.timeout; | ||
const httpAgent = options.httpAgent ?? this.httpAgent ?? (0, index_1.getDefaultAgent)(url); | ||
const minAgentTimeout = timeout + 1000; | ||
const minAgentTimeout = options.timeout + 1000; | ||
if (typeof httpAgent?.options?.timeout === 'number' && | ||
@@ -232,3 +233,3 @@ minAgentTimeout > (httpAgent.options.timeout ?? 0)) { | ||
}; | ||
return { req, url, timeout }; | ||
return { req, url, timeout: options.timeout }; | ||
} | ||
@@ -247,5 +248,5 @@ buildHeaders({ options, headers, contentLength, retryCount, }) { | ||
} | ||
// Don't set the retry count header if it was already set or removed through default headers or by the | ||
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to | ||
// account for the removal case. | ||
// Don't set theses headers if they were already set or removed through default headers or by the caller. | ||
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account | ||
// for the removal case. | ||
if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-retry-count') === undefined && | ||
@@ -255,2 +256,7 @@ (0, exports.getHeader)(headers, 'x-stainless-retry-count') === undefined) { | ||
} | ||
if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-timeout') === undefined && | ||
(0, exports.getHeader)(headers, 'x-stainless-timeout') === undefined && | ||
options.timeout) { | ||
reqHeaders['x-stainless-timeout'] = String(options.timeout); | ||
} | ||
this.validateHeaders(reqHeaders, headers); | ||
@@ -257,0 +263,0 @@ return reqHeaders; |
{ | ||
"name": "modern-treasury", | ||
"version": "2.33.2", | ||
"version": "2.34.0", | ||
"description": "The official TypeScript library for the Modern Treasury API", | ||
@@ -90,15 +90,36 @@ "author": "Modern Treasury <sdk-feedback@moderntreasury.com>", | ||
"./*.mjs": { | ||
"types": "./*.d.ts", | ||
"default": "./*.mjs" | ||
"types": [ | ||
"./*.d.ts", | ||
"./*/index.d.ts" | ||
], | ||
"default": [ | ||
"./*.mjs", | ||
"./*/index.mjs" | ||
] | ||
}, | ||
"./*.js": { | ||
"types": "./*.d.ts", | ||
"default": "./*.js" | ||
"types": [ | ||
"./*.d.ts", | ||
"./*/index.d.ts" | ||
], | ||
"default": [ | ||
"./*.js", | ||
"./*/index.js" | ||
] | ||
}, | ||
"./*": { | ||
"types": "./*.d.ts", | ||
"require": "./*.js", | ||
"default": "./*.mjs" | ||
"types": [ | ||
"./*.d.ts", | ||
"./*/index.d.ts" | ||
], | ||
"require": [ | ||
"./*.js", | ||
"./*/index.js" | ||
], | ||
"default": [ | ||
"./*.mjs", | ||
"./*/index.mjs" | ||
] | ||
} | ||
} | ||
} |
@@ -283,2 +283,3 @@ import { VERSION } from './version'; | ||
): { req: RequestInit; url: string; timeout: number } { | ||
options = { ...options }; | ||
const { method, path, query, headers: headers = {} } = options; | ||
@@ -296,5 +297,5 @@ | ||
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); | ||
const timeout = options.timeout ?? this.timeout; | ||
options.timeout = options.timeout ?? this.timeout; | ||
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url); | ||
const minAgentTimeout = timeout + 1000; | ||
const minAgentTimeout = options.timeout + 1000; | ||
if ( | ||
@@ -328,3 +329,3 @@ typeof (httpAgent as any)?.options?.timeout === 'number' && | ||
return { req, url, timeout }; | ||
return { req, url, timeout: options.timeout }; | ||
} | ||
@@ -357,5 +358,5 @@ | ||
// Don't set the retry count header if it was already set or removed through default headers or by the | ||
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to | ||
// account for the removal case. | ||
// Don't set theses headers if they were already set or removed through default headers or by the caller. | ||
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account | ||
// for the removal case. | ||
if ( | ||
@@ -367,2 +368,9 @@ getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined && | ||
} | ||
if ( | ||
getHeader(defaultHeaders, 'x-stainless-timeout') === undefined && | ||
getHeader(headers, 'x-stainless-timeout') === undefined && | ||
options.timeout | ||
) { | ||
reqHeaders['x-stainless-timeout'] = String(options.timeout); | ||
} | ||
@@ -369,0 +377,0 @@ this.validateHeaders(reqHeaders, headers); |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '2.33.2'; // x-release-please-version | ||
export const VERSION = '2.34.0'; // x-release-please-version |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.33.2"; | ||
export declare const VERSION = "2.34.0"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '2.33.2'; // x-release-please-version | ||
exports.VERSION = '2.34.0'; // x-release-please-version | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2378991
45293