chargebee
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -14,3 +14,3 @@ "use strict"; | ||
timeout: DEFAULT_TIME_OUT, | ||
clientVersion: 'v3.2.0', | ||
clientVersion: 'v3.2.1', | ||
port: DEFAULT_PORT, | ||
@@ -17,0 +17,0 @@ timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT, |
@@ -14,6 +14,11 @@ "use strict"; | ||
}; | ||
const response = globalThis.AbortController | ||
? await this.fetchWithAbortTimeout(url, fetchOptions, props.timeout) | ||
: await this.fetchWithTimeout(url, fetchOptions, props.timeout); | ||
return new FetchHttpClientResponse(response); | ||
try { | ||
const response = globalThis.AbortController | ||
? await this.fetchWithAbortTimeout(url, fetchOptions, props.timeout) | ||
: await this.fetchWithTimeout(url, fetchOptions, props.timeout); | ||
return new FetchHttpClientResponse(response); | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
} | ||
@@ -48,16 +53,18 @@ _createHeaders(httpHeaders) { | ||
}, timeout); | ||
const fetchPromise = fetch(url, Object.assign(Object.assign({}, fetchOptions), { signal: abort.signal })); | ||
fetchPromise.finally(() => { | ||
if (timeoutId) { | ||
clearTimeout(timeoutId); | ||
} | ||
}); | ||
return fetchPromise.catch((err) => { | ||
try { | ||
return await fetch(url, Object.assign(Object.assign({}, fetchOptions), { signal: abort.signal })); | ||
} | ||
catch (err) { | ||
if (err.name === 'AbortError') { | ||
throw ClientInterface_js_1.HttpClient.timeOutError(); | ||
return Promise.reject(ClientInterface_js_1.HttpClient.timeOutError()); | ||
} | ||
else { | ||
throw err; | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
finally { | ||
if (timeoutId) { | ||
clearTimeout(timeoutId); | ||
} | ||
} | ||
} | ||
@@ -64,0 +71,0 @@ } |
@@ -44,38 +44,43 @@ "use strict"; | ||
} | ||
let path = (0, util_js_1.getApiURL)(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam); | ||
if (typeof params === 'undefined' || params === null) { | ||
params = {}; | ||
} | ||
if (this.apiCall.httpMethod === 'GET') { | ||
params = (0, util_js_1.serialize)(params); | ||
let queryParam = this.apiCall.isListReq | ||
? (0, util_js_1.encodeListParams)(params) | ||
: (0, util_js_1.encodeParams)(params); | ||
path += '?' + queryParam; | ||
params = {}; | ||
} | ||
let data = (0, util_js_1.encodeParams)(params); | ||
if (data.length) { | ||
try { | ||
let path = (0, util_js_1.getApiURL)(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam); | ||
if (typeof params === 'undefined' || params === null) { | ||
params = {}; | ||
} | ||
if (this.apiCall.httpMethod === 'GET') { | ||
params = (0, util_js_1.serialize)(params); | ||
let queryParam = this.apiCall.isListReq | ||
? (0, util_js_1.encodeListParams)(params) | ||
: (0, util_js_1.encodeParams)(params); | ||
path += '?' + queryParam; | ||
params = {}; | ||
} | ||
let data = (0, util_js_1.encodeParams)(params); | ||
if (data.length) { | ||
(0, util_js_1.extend)(true, this.httpHeaders, { | ||
'Content-Length': data.length, | ||
}); | ||
} | ||
(0, util_js_1.extend)(true, this.httpHeaders, { | ||
'Content-Length': data.length, | ||
Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'), | ||
Accept: 'application/json', | ||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', | ||
'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion, | ||
'Lang-Version': typeof process === 'undefined' ? '' : process.version, | ||
}); | ||
const resp = await this.envArg.httpClient.makeApiRequest({ | ||
host: (0, util_js_1.getHost)(env), | ||
port: env.port, | ||
path, | ||
method: this.apiCall.httpMethod, | ||
protocol: env.protocol, | ||
headers: this.httpHeaders, | ||
data: data, | ||
timeout: env.timeout, | ||
}); | ||
(0, coreCommon_js_1.handleResponse)(callBackWrapper, resp); | ||
} | ||
(0, util_js_1.extend)(true, this.httpHeaders, { | ||
Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'), | ||
Accept: 'application/json', | ||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', | ||
'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion, | ||
'Lang-Version': typeof process === 'undefined' ? '' : process.version, | ||
}); | ||
const resp = await this.envArg.httpClient.makeApiRequest({ | ||
host: (0, util_js_1.getHost)(env), | ||
port: env.port, | ||
path, | ||
method: this.apiCall.httpMethod, | ||
protocol: env.protocol, | ||
headers: this.httpHeaders, | ||
data: data, | ||
timeout: env.timeout, | ||
}); | ||
(0, coreCommon_js_1.handleResponse)(callBackWrapper, resp); | ||
catch (err) { | ||
callBackWrapper(err, null); | ||
} | ||
}); | ||
@@ -82,0 +87,0 @@ return (0, util_js_1.callbackifyPromise)(promise); |
@@ -11,3 +11,3 @@ const DEFAULT_PROTOCOL = 'https'; | ||
timeout: DEFAULT_TIME_OUT, | ||
clientVersion: 'v3.2.0', | ||
clientVersion: 'v3.2.1', | ||
port: DEFAULT_PORT, | ||
@@ -14,0 +14,0 @@ timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT, |
@@ -11,6 +11,11 @@ import { HttpClient, HttpClientResponse, } from './ClientInterface.js'; | ||
}; | ||
const response = globalThis.AbortController | ||
? await this.fetchWithAbortTimeout(url, fetchOptions, props.timeout) | ||
: await this.fetchWithTimeout(url, fetchOptions, props.timeout); | ||
return new FetchHttpClientResponse(response); | ||
try { | ||
const response = globalThis.AbortController | ||
? await this.fetchWithAbortTimeout(url, fetchOptions, props.timeout) | ||
: await this.fetchWithTimeout(url, fetchOptions, props.timeout); | ||
return new FetchHttpClientResponse(response); | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
} | ||
@@ -45,16 +50,18 @@ _createHeaders(httpHeaders) { | ||
}, timeout); | ||
const fetchPromise = fetch(url, Object.assign(Object.assign({}, fetchOptions), { signal: abort.signal })); | ||
fetchPromise.finally(() => { | ||
if (timeoutId) { | ||
clearTimeout(timeoutId); | ||
} | ||
}); | ||
return fetchPromise.catch((err) => { | ||
try { | ||
return await fetch(url, Object.assign(Object.assign({}, fetchOptions), { signal: abort.signal })); | ||
} | ||
catch (err) { | ||
if (err.name === 'AbortError') { | ||
throw HttpClient.timeOutError(); | ||
return Promise.reject(HttpClient.timeOutError()); | ||
} | ||
else { | ||
throw err; | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
finally { | ||
if (timeoutId) { | ||
clearTimeout(timeoutId); | ||
} | ||
} | ||
} | ||
@@ -61,0 +68,0 @@ } |
@@ -41,38 +41,43 @@ import { extend, callbackifyPromise, getApiURL, encodeListParams, encodeParams, serialize, getHost, } from './util.js'; | ||
} | ||
let path = getApiURL(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam); | ||
if (typeof params === 'undefined' || params === null) { | ||
params = {}; | ||
} | ||
if (this.apiCall.httpMethod === 'GET') { | ||
params = serialize(params); | ||
let queryParam = this.apiCall.isListReq | ||
? encodeListParams(params) | ||
: encodeParams(params); | ||
path += '?' + queryParam; | ||
params = {}; | ||
} | ||
let data = encodeParams(params); | ||
if (data.length) { | ||
try { | ||
let path = getApiURL(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam); | ||
if (typeof params === 'undefined' || params === null) { | ||
params = {}; | ||
} | ||
if (this.apiCall.httpMethod === 'GET') { | ||
params = serialize(params); | ||
let queryParam = this.apiCall.isListReq | ||
? encodeListParams(params) | ||
: encodeParams(params); | ||
path += '?' + queryParam; | ||
params = {}; | ||
} | ||
let data = encodeParams(params); | ||
if (data.length) { | ||
extend(true, this.httpHeaders, { | ||
'Content-Length': data.length, | ||
}); | ||
} | ||
extend(true, this.httpHeaders, { | ||
'Content-Length': data.length, | ||
Authorization: 'Basic ' + Buffer.from(env.apiKey + ':').toString('base64'), | ||
Accept: 'application/json', | ||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', | ||
'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion, | ||
'Lang-Version': typeof process === 'undefined' ? '' : process.version, | ||
}); | ||
const resp = await this.envArg.httpClient.makeApiRequest({ | ||
host: getHost(env), | ||
port: env.port, | ||
path, | ||
method: this.apiCall.httpMethod, | ||
protocol: env.protocol, | ||
headers: this.httpHeaders, | ||
data: data, | ||
timeout: env.timeout, | ||
}); | ||
handleResponse(callBackWrapper, resp); | ||
} | ||
extend(true, this.httpHeaders, { | ||
Authorization: 'Basic ' + Buffer.from(env.apiKey + ':').toString('base64'), | ||
Accept: 'application/json', | ||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', | ||
'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion, | ||
'Lang-Version': typeof process === 'undefined' ? '' : process.version, | ||
}); | ||
const resp = await this.envArg.httpClient.makeApiRequest({ | ||
host: getHost(env), | ||
port: env.port, | ||
path, | ||
method: this.apiCall.httpMethod, | ||
protocol: env.protocol, | ||
headers: this.httpHeaders, | ||
data: data, | ||
timeout: env.timeout, | ||
}); | ||
handleResponse(callBackWrapper, resp); | ||
catch (err) { | ||
callBackWrapper(err, null); | ||
} | ||
}); | ||
@@ -79,0 +84,0 @@ return callbackifyPromise(promise); |
{ | ||
"name": "chargebee", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "A library for integrating with Chargebee.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -22,2 +22,3 @@ ///<reference path='./../core.d.ts'/> | ||
api_version?: ApiVersionEnum; | ||
content: any; | ||
origin_user?: string; | ||
@@ -24,0 +25,0 @@ } |
@@ -31,2 +31,3 @@ ///<reference path='./../core.d.ts'/> | ||
expires_at?: number; | ||
content: any; | ||
updated_at?: number; | ||
@@ -33,0 +34,0 @@ resource_version?: number; |
Sorry, the diff of this file is too big to display
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
847711
20922