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 CHANGED
@@ -1,3 +1,10 @@
1
+ ### v3.10.0 (2025-06-30)
2
+ * * *
3
+
4
+ ### New Features
5
+ * Added `userAgentSuffix` to the environment config to allow appending custom text to the `User-Agent` header.
6
+
7
+
1
8
  ### v3.9.0 (2025-06-23)
2
9
  * * *
3
10
 
@@ -33,8 +33,9 @@ class RequestWrapper {
33
33
  return null;
34
34
  }
35
35
  async request() {
36
- let env = {};
37
- (0, util_js_1.extend)(true, env, this.envArg);
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': 'Chargebee-NodeJs-Client ' + env.clientVersion,
83
+ 'User-Agent': userAgent,
82
84
  'Lang-Version': typeof process === 'undefined' ? '' : process.version,
83
85
  });
84
86
  if (attempt > 0) {
@@ -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.9.0',
14
+ clientVersion: 'v3.10.0',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -30,8 +30,9 @@ export class RequestWrapper {
30
30
  return null;
31
31
  }
32
32
  async request() {
33
- let env = {};
34
- extend(true, env, this.envArg);
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': 'Chargebee-NodeJs-Client ' + env.clientVersion,
80
+ 'User-Agent': userAgent,
79
81
  'Lang-Version': typeof process === 'undefined' ? '' : process.version,
80
82
  });
81
83
  if (attempt > 0) {
@@ -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.9.0',
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
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 = {