chargebee 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/cjs/RequestWrapper.js +5 -3
- package/cjs/environment.js +1 -1
- package/esm/RequestWrapper.js +5 -3
- package/esm/environment.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +5 -0
package/CHANGELOG.md
CHANGED
package/cjs/RequestWrapper.js
CHANGED
|
@@ -33,8 +33,9 @@ class RequestWrapper {
|
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
async request() {
|
|
36
|
-
let
|
|
37
|
-
(0, util_js_1.extend)(true,
|
|
36
|
+
let _env = {};
|
|
37
|
+
(0, util_js_1.extend)(true, _env, this.envArg);
|
|
38
|
+
const env = _env;
|
|
38
39
|
const retryConfig = Object.assign({ enabled: false, maxRetries: 3, delayMs: 200, retryOn: [500, 502, 503, 504] }, env.retryConfig);
|
|
39
40
|
const urlIdParam = this.apiCall.hasIdInUrl ? this.args[0] : null;
|
|
40
41
|
let params = this.apiCall.hasIdInUrl
|
|
@@ -74,11 +75,12 @@ class RequestWrapper {
|
|
|
74
75
|
const contentType = this.apiCall.isJsonRequest
|
|
75
76
|
? 'application/json;charset=UTF-8'
|
|
76
77
|
: 'application/x-www-form-urlencoded; charset=utf-8';
|
|
78
|
+
const userAgent = `Chargebee-NodeJs-Client ${env.clientVersion}${env.userAgentSuffix ? ';' + env.userAgentSuffix : ''}`;
|
|
77
79
|
(0, util_js_1.extend)(true, requestHeaders, {
|
|
78
80
|
Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'),
|
|
79
81
|
Accept: 'application/json',
|
|
80
82
|
'Content-Type': contentType,
|
|
81
|
-
'User-Agent':
|
|
83
|
+
'User-Agent': userAgent,
|
|
82
84
|
'Lang-Version': typeof process === 'undefined' ? '' : process.version,
|
|
83
85
|
});
|
|
84
86
|
if (attempt > 0) {
|
package/cjs/environment.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.Environment = {
|
|
|
11
11
|
hostSuffix: '.chargebee.com',
|
|
12
12
|
apiPath: '/api/v2',
|
|
13
13
|
timeout: DEFAULT_TIME_OUT,
|
|
14
|
-
clientVersion: 'v3.
|
|
14
|
+
clientVersion: 'v3.10.0',
|
|
15
15
|
port: DEFAULT_PORT,
|
|
16
16
|
timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
|
|
17
17
|
exportWaitInMillis: DEFAULT_EXPORT_WAIT,
|
package/esm/RequestWrapper.js
CHANGED
|
@@ -30,8 +30,9 @@ export class RequestWrapper {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
async request() {
|
|
33
|
-
let
|
|
34
|
-
extend(true,
|
|
33
|
+
let _env = {};
|
|
34
|
+
extend(true, _env, this.envArg);
|
|
35
|
+
const env = _env;
|
|
35
36
|
const retryConfig = Object.assign({ enabled: false, maxRetries: 3, delayMs: 200, retryOn: [500, 502, 503, 504] }, env.retryConfig);
|
|
36
37
|
const urlIdParam = this.apiCall.hasIdInUrl ? this.args[0] : null;
|
|
37
38
|
let params = this.apiCall.hasIdInUrl
|
|
@@ -71,11 +72,12 @@ export class RequestWrapper {
|
|
|
71
72
|
const contentType = this.apiCall.isJsonRequest
|
|
72
73
|
? 'application/json;charset=UTF-8'
|
|
73
74
|
: 'application/x-www-form-urlencoded; charset=utf-8';
|
|
75
|
+
const userAgent = `Chargebee-NodeJs-Client ${env.clientVersion}${env.userAgentSuffix ? ';' + env.userAgentSuffix : ''}`;
|
|
74
76
|
extend(true, requestHeaders, {
|
|
75
77
|
Authorization: 'Basic ' + Buffer.from(env.apiKey + ':').toString('base64'),
|
|
76
78
|
Accept: 'application/json',
|
|
77
79
|
'Content-Type': contentType,
|
|
78
|
-
'User-Agent':
|
|
80
|
+
'User-Agent': userAgent,
|
|
79
81
|
'Lang-Version': typeof process === 'undefined' ? '' : process.version,
|
|
80
82
|
});
|
|
81
83
|
if (attempt > 0) {
|
package/esm/environment.js
CHANGED
|
@@ -8,7 +8,7 @@ export const Environment = {
|
|
|
8
8
|
hostSuffix: '.chargebee.com',
|
|
9
9
|
apiPath: '/api/v2',
|
|
10
10
|
timeout: DEFAULT_TIME_OUT,
|
|
11
|
-
clientVersion: 'v3.
|
|
11
|
+
clientVersion: 'v3.10.0',
|
|
12
12
|
port: DEFAULT_PORT,
|
|
13
13
|
timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
|
|
14
14
|
exportWaitInMillis: DEFAULT_EXPORT_WAIT,
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -132,6 +132,11 @@ export type Config = {
|
|
|
132
132
|
* @enableDebugLogs whether to enable debug logs, default value is false
|
|
133
133
|
*/
|
|
134
134
|
enableDebugLogs?: boolean;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @userAgentSuffix optional string appended to the User-Agent header for additional logging
|
|
138
|
+
*/
|
|
139
|
+
userAgentSuffix?: string;
|
|
135
140
|
};
|
|
136
141
|
|
|
137
142
|
export type RetryConfig = {
|