chargebee 3.30.0 → 3.30.1

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,8 @@
1
+ ### v3.30.1 (2026-08-11)
2
+ * * *
3
+ ### Bug Fixes:
4
+ - Filter operators `in`, `not_in` and `between` are now sent as a single form field on POST requests, matching the behaviour on list requests. Filters on export operations, such as `subscription[updated_at][between]`, were index-encoded and therefore ignored by the API.
5
+
1
6
  ### v3.30.0 (2026-07-30)
2
7
  * * *
3
8
  ### New Resources:
@@ -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.30.0',
14
+ clientVersion: 'v3.30.1',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
package/cjs/util.js CHANGED
@@ -124,9 +124,11 @@ function getApiURL(env, urlPrefix, urlSuffix, urlIdParam) {
124
124
  : '') +
125
125
  (urlSuffix !== null ? urlSuffix : ''));
126
126
  }
127
+ // Filter operators whose value is the whole array, sent as a single field
128
+ // (e.g. updated_at[between]=[1704067200,1717199999]).
129
+ const arrayOperators = ['in', 'not_in', 'between'];
127
130
  function serialize(paramObj) {
128
131
  let key, value;
129
- let array_ops = ['in', 'not_in', 'between'];
130
132
  for (key in paramObj) {
131
133
  value = paramObj[key];
132
134
  if (typeof value === 'object' && (0, exports.isObject)(value)) {
@@ -135,7 +137,7 @@ function serialize(paramObj) {
135
137
  for (child_key in value) {
136
138
  key = key + '[' + child_key + ']';
137
139
  paramObj[key] = value[child_key];
138
- if (array_ops.includes(child_key)) {
140
+ if (arrayOperators.includes(child_key)) {
139
141
  paramObj[key] = JSON.stringify(value[child_key]);
140
142
  }
141
143
  }
@@ -190,6 +192,14 @@ function encodeParams(paramObj, serialized, scope, index, jsonKeys, level = 0) {
190
192
  }
191
193
  serialized.push(encodeURIComponent(key) + '=' + attrVal);
192
194
  }
195
+ else if ((0, exports.isArray)(value) && arrayOperators.includes(originalKey)) {
196
+ // An empty filter is not a filter, so leave it out of the request.
197
+ if (value.length > 0) {
198
+ serialized.push(encodeURIComponent(key) +
199
+ '=' +
200
+ encodeURIComponent(JSON.stringify(value)));
201
+ }
202
+ }
193
203
  else if ((0, exports.isArray)(value) &&
194
204
  !(jsonKeys && jsonKeys[originalKey] === level)) {
195
205
  for (let arrIdx = 0; arrIdx < value.length; arrIdx++) {
@@ -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.30.0',
11
+ clientVersion: 'v3.30.1',
12
12
  port: DEFAULT_PORT,
13
13
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
14
14
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
package/esm/util.js CHANGED
@@ -106,9 +106,11 @@ export function getApiURL(env, urlPrefix, urlSuffix, urlIdParam) {
106
106
  : '') +
107
107
  (urlSuffix !== null ? urlSuffix : ''));
108
108
  }
109
+ // Filter operators whose value is the whole array, sent as a single field
110
+ // (e.g. updated_at[between]=[1704067200,1717199999]).
111
+ const arrayOperators = ['in', 'not_in', 'between'];
109
112
  export function serialize(paramObj) {
110
113
  let key, value;
111
- let array_ops = ['in', 'not_in', 'between'];
112
114
  for (key in paramObj) {
113
115
  value = paramObj[key];
114
116
  if (typeof value === 'object' && isObject(value)) {
@@ -117,7 +119,7 @@ export function serialize(paramObj) {
117
119
  for (child_key in value) {
118
120
  key = key + '[' + child_key + ']';
119
121
  paramObj[key] = value[child_key];
120
- if (array_ops.includes(child_key)) {
122
+ if (arrayOperators.includes(child_key)) {
121
123
  paramObj[key] = JSON.stringify(value[child_key]);
122
124
  }
123
125
  }
@@ -172,6 +174,14 @@ export function encodeParams(paramObj, serialized, scope, index, jsonKeys, level
172
174
  }
173
175
  serialized.push(encodeURIComponent(key) + '=' + attrVal);
174
176
  }
177
+ else if (isArray(value) && arrayOperators.includes(originalKey)) {
178
+ // An empty filter is not a filter, so leave it out of the request.
179
+ if (value.length > 0) {
180
+ serialized.push(encodeURIComponent(key) +
181
+ '=' +
182
+ encodeURIComponent(JSON.stringify(value)));
183
+ }
184
+ }
175
185
  else if (isArray(value) &&
176
186
  !(jsonKeys && jsonKeys[originalKey] === level)) {
177
187
  for (let arrIdx = 0; arrIdx < value.length; arrIdx++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.30.0",
3
+ "version": "3.30.1",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",