@chargebee/code-sample-generator 0.5.6 → 0.5.7
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/dist/browser.js +2 -2
- package/dist/{generate-from-sample-BTD9cuMQ.js → generate-from-sample-D12rHcmw.js} +128 -30
- package/dist/{generate-from-sample-BTD9cuMQ.js.map → generate-from-sample-D12rHcmw.js.map} +1 -1
- package/dist/generated/ops/operation-params.d.ts +6 -6
- package/dist/generated/ops/operation-params.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_webhook_endpoint.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_events.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/update_a_webhook_endpoint.d.ts.map +1 -1
- package/dist/generators/dotnet.d.ts.map +1 -1
- package/dist/generators/java/utils.d.ts.map +1 -1
- package/dist/generators/java/v4.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as getOperationIdsForVersion, r as getOperationIds, c as getOperation, g as generateFromSample } from "./generate-from-sample-
|
|
2
|
-
import { n, A, i, j, k, h, D, o, G, q, l, T, u, m } from "./generate-from-sample-
|
|
1
|
+
import { t as getOperationIdsForVersion, r as getOperationIds, c as getOperation, g as generateFromSample } from "./generate-from-sample-D12rHcmw.js";
|
|
2
|
+
import { n, A, i, j, k, h, D, o, G, q, l, T, u, m } from "./generate-from-sample-D12rHcmw.js";
|
|
3
3
|
function validateOperationId(id, version) {
|
|
4
4
|
if (version) {
|
|
5
5
|
const ops = getOperationIdsForVersion(version);
|
|
@@ -33991,10 +33991,10 @@ const descriptor$8Q = {
|
|
|
33991
33991
|
"f": "S",
|
|
33992
33992
|
"fn": "StringFilter",
|
|
33993
33993
|
"p": {
|
|
33994
|
-
"
|
|
33994
|
+
"is": {
|
|
33995
33995
|
"t": "str"
|
|
33996
33996
|
},
|
|
33997
|
-
"
|
|
33997
|
+
"in": {
|
|
33998
33998
|
"t": "str"
|
|
33999
33999
|
}
|
|
34000
34000
|
}
|
|
@@ -48477,10 +48477,10 @@ const descriptor$8j = {
|
|
|
48477
48477
|
"f": "S",
|
|
48478
48478
|
"fn": "StringFilter",
|
|
48479
48479
|
"p": {
|
|
48480
|
-
"
|
|
48480
|
+
"is": {
|
|
48481
48481
|
"t": "str"
|
|
48482
48482
|
},
|
|
48483
|
-
"
|
|
48483
|
+
"in": {
|
|
48484
48484
|
"t": "str"
|
|
48485
48485
|
}
|
|
48486
48486
|
}
|
|
@@ -52463,10 +52463,10 @@ const descriptor$88 = {
|
|
|
52463
52463
|
"fn": "StringFilter",
|
|
52464
52464
|
"mm": "invoices",
|
|
52465
52465
|
"p": {
|
|
52466
|
-
"
|
|
52466
|
+
"is": {
|
|
52467
52467
|
"t": "str"
|
|
52468
52468
|
},
|
|
52469
|
-
"
|
|
52469
|
+
"in": {
|
|
52470
52470
|
"t": "str"
|
|
52471
52471
|
}
|
|
52472
52472
|
}
|
|
@@ -52481,10 +52481,10 @@ const descriptor$88 = {
|
|
|
52481
52481
|
"s": true,
|
|
52482
52482
|
"mm": "payment_reference_numbers",
|
|
52483
52483
|
"p": {
|
|
52484
|
-
"
|
|
52484
|
+
"is": {
|
|
52485
52485
|
"t": "str"
|
|
52486
52486
|
},
|
|
52487
|
-
"
|
|
52487
|
+
"in": {
|
|
52488
52488
|
"t": "str"
|
|
52489
52489
|
}
|
|
52490
52490
|
}
|
|
@@ -74345,7 +74345,9 @@ const descriptor$4T = {
|
|
|
74345
74345
|
"omnichannel_subscription_item_pause_scheduled",
|
|
74346
74346
|
"omnichannel_subscription_moved_in",
|
|
74347
74347
|
"omnichannel_transaction_created",
|
|
74348
|
-
"alert_status_changed"
|
|
74348
|
+
"alert_status_changed",
|
|
74349
|
+
"omnichannel_subscription_item_updated",
|
|
74350
|
+
"omnichannel_subscription_item_recovered"
|
|
74349
74351
|
],
|
|
74350
74352
|
"g": true,
|
|
74351
74353
|
"x": true,
|
|
@@ -103847,7 +103849,9 @@ const descriptor$2$ = {
|
|
|
103847
103849
|
"omnichannel_subscription_item_pause_scheduled",
|
|
103848
103850
|
"omnichannel_subscription_moved_in",
|
|
103849
103851
|
"omnichannel_transaction_created",
|
|
103850
|
-
"alert_status_changed"
|
|
103852
|
+
"alert_status_changed",
|
|
103853
|
+
"omnichannel_subscription_item_updated",
|
|
103854
|
+
"omnichannel_subscription_item_recovered"
|
|
103851
103855
|
],
|
|
103852
103856
|
"g": true,
|
|
103853
103857
|
"x": true,
|
|
@@ -104066,7 +104070,9 @@ const descriptor$2$ = {
|
|
|
104066
104070
|
"omnichannel_subscription_item_pause_scheduled",
|
|
104067
104071
|
"omnichannel_subscription_moved_in",
|
|
104068
104072
|
"omnichannel_transaction_created",
|
|
104069
|
-
"alert_status_changed"
|
|
104073
|
+
"alert_status_changed",
|
|
104074
|
+
"omnichannel_subscription_item_updated",
|
|
104075
|
+
"omnichannel_subscription_item_recovered"
|
|
104070
104076
|
],
|
|
104071
104077
|
"g": true,
|
|
104072
104078
|
"x": true,
|
|
@@ -104285,7 +104291,9 @@ const descriptor$2$ = {
|
|
|
104285
104291
|
"omnichannel_subscription_item_pause_scheduled",
|
|
104286
104292
|
"omnichannel_subscription_moved_in",
|
|
104287
104293
|
"omnichannel_transaction_created",
|
|
104288
|
-
"alert_status_changed"
|
|
104294
|
+
"alert_status_changed",
|
|
104295
|
+
"omnichannel_subscription_item_updated",
|
|
104296
|
+
"omnichannel_subscription_item_recovered"
|
|
104289
104297
|
],
|
|
104290
104298
|
"g": true,
|
|
104291
104299
|
"x": true,
|
|
@@ -104504,7 +104512,9 @@ const descriptor$2$ = {
|
|
|
104504
104512
|
"omnichannel_subscription_item_pause_scheduled",
|
|
104505
104513
|
"omnichannel_subscription_moved_in",
|
|
104506
104514
|
"omnichannel_transaction_created",
|
|
104507
|
-
"alert_status_changed"
|
|
104515
|
+
"alert_status_changed",
|
|
104516
|
+
"omnichannel_subscription_item_updated",
|
|
104517
|
+
"omnichannel_subscription_item_recovered"
|
|
104508
104518
|
],
|
|
104509
104519
|
"g": true,
|
|
104510
104520
|
"x": true,
|
|
@@ -117939,7 +117949,9 @@ const descriptor$q = {
|
|
|
117939
117949
|
"omnichannel_subscription_item_pause_scheduled",
|
|
117940
117950
|
"omnichannel_subscription_moved_in",
|
|
117941
117951
|
"omnichannel_transaction_created",
|
|
117942
|
-
"alert_status_changed"
|
|
117952
|
+
"alert_status_changed",
|
|
117953
|
+
"omnichannel_subscription_item_updated",
|
|
117954
|
+
"omnichannel_subscription_item_recovered"
|
|
117943
117955
|
],
|
|
117944
117956
|
"g": true,
|
|
117945
117957
|
"x": true,
|
|
@@ -122918,6 +122930,23 @@ function formatFilter$1(filter, schemaLookup, resourcePascal) {
|
|
|
122918
122930
|
);
|
|
122919
122931
|
return `.${fieldMethod2}().${operatorMethod2}(${elements.join(", ")})`;
|
|
122920
122932
|
}
|
|
122933
|
+
const filterType2 = filter.schema?.sdkFilterName;
|
|
122934
|
+
if (operator2 === "between" && arrayItems2 !== null && arrayItems2.length === 2) {
|
|
122935
|
+
if (filterType2 === "TimestampFilter") {
|
|
122936
|
+
const elements = arrayItems2.map((el) => {
|
|
122937
|
+
const num = typeof el === "number" ? el : parseInt(String(el), 10);
|
|
122938
|
+
return `new DateTime(${num})`;
|
|
122939
|
+
});
|
|
122940
|
+
return `.${fieldMethod2}().${operatorMethod2}(${elements.join(", ")})`;
|
|
122941
|
+
}
|
|
122942
|
+
if (filterType2 === "NumberFilter") {
|
|
122943
|
+
const elements = arrayItems2.map((el) => {
|
|
122944
|
+
const num = typeof el === "number" ? el : parseInt(String(el), 10);
|
|
122945
|
+
return String(num);
|
|
122946
|
+
});
|
|
122947
|
+
return `.${fieldMethod2}().${operatorMethod2}(${elements.join(", ")})`;
|
|
122948
|
+
}
|
|
122949
|
+
}
|
|
122921
122950
|
const operatorSubSchema2 = filter.schema?.properties?.[operator2];
|
|
122922
122951
|
const formatted2 = formatDotnetValue(
|
|
122923
122952
|
filter.value,
|
|
@@ -122960,6 +122989,25 @@ function formatFilter$1(filter, schemaLookup, resourcePascal) {
|
|
|
122960
122989
|
const operatorMethod2 = toPascalCase(operator);
|
|
122961
122990
|
return `.${fieldMethod2}().${operatorMethod2}(${elements.join(", ")})`;
|
|
122962
122991
|
}
|
|
122992
|
+
const filterType = filter.schema?.sdkFilterName;
|
|
122993
|
+
if (operator === "between" && arrayItems !== null && arrayItems.length === 2) {
|
|
122994
|
+
const fieldMethod2 = toPascalCase(fieldName);
|
|
122995
|
+
const operatorMethod2 = toPascalCase(operator);
|
|
122996
|
+
if (filterType === "TimestampFilter") {
|
|
122997
|
+
const elements = arrayItems.map((el) => {
|
|
122998
|
+
const num = typeof el === "number" ? el : parseInt(String(el), 10);
|
|
122999
|
+
return `new DateTime(${num})`;
|
|
123000
|
+
});
|
|
123001
|
+
return `.${fieldMethod2}().${operatorMethod2}(${elements.join(", ")})`;
|
|
123002
|
+
}
|
|
123003
|
+
if (filterType === "NumberFilter") {
|
|
123004
|
+
const elements = arrayItems.map((el) => {
|
|
123005
|
+
const num = typeof el === "number" ? el : parseInt(String(el), 10);
|
|
123006
|
+
return String(num);
|
|
123007
|
+
});
|
|
123008
|
+
return `.${fieldMethod2}().${operatorMethod2}(${elements.join(", ")})`;
|
|
123009
|
+
}
|
|
123010
|
+
}
|
|
122963
123011
|
const operatorSubSchema = filter.schema?.properties?.[operator];
|
|
122964
123012
|
const formatted = formatDotnetValue(
|
|
122965
123013
|
filter.value,
|
|
@@ -124248,7 +124296,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
|
|
|
124248
124296
|
defaultEnumPrefix = singularize(operationMethodPascal);
|
|
124249
124297
|
}
|
|
124250
124298
|
let formattedValue;
|
|
124251
|
-
const
|
|
124299
|
+
const parseArrayValue2 = (value) => {
|
|
124252
124300
|
if (Array.isArray(value)) return value;
|
|
124253
124301
|
if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
|
|
124254
124302
|
try {
|
|
@@ -124269,7 +124317,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
|
|
|
124269
124317
|
filter.filterOperator
|
|
124270
124318
|
);
|
|
124271
124319
|
if (resolved) {
|
|
124272
|
-
const arrayValue =
|
|
124320
|
+
const arrayValue = parseArrayValue2(filter.value);
|
|
124273
124321
|
if (arrayValue && arrayValue.length > 0) {
|
|
124274
124322
|
formattedValue = arrayValue.map((v) => formatJavaV3Enum(resolved, String(v), resource, schema)).join(", ");
|
|
124275
124323
|
} else if (typeof filter.value === "string") {
|
|
@@ -124284,7 +124332,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
|
|
|
124284
124332
|
}
|
|
124285
124333
|
} else {
|
|
124286
124334
|
const enumClass = schema?.sdkEnumName || toPascalCase(enumFieldName);
|
|
124287
|
-
const arrayValue =
|
|
124335
|
+
const arrayValue = parseArrayValue2(filter.value);
|
|
124288
124336
|
if (arrayValue && arrayValue.length > 0) {
|
|
124289
124337
|
if (isKnownGlobalEnum) {
|
|
124290
124338
|
formattedValue = arrayValue.map((v) => `${enumClass}.${String(v).toUpperCase()}`).join(", ");
|
|
@@ -124306,7 +124354,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
|
|
|
124306
124354
|
}
|
|
124307
124355
|
} else if (isEnumField) {
|
|
124308
124356
|
const enumClass = schema?.sdkEnumName || toPascalCase(enumFieldName);
|
|
124309
|
-
const arrayValue =
|
|
124357
|
+
const arrayValue = parseArrayValue2(filter.value);
|
|
124310
124358
|
if (arrayValue && arrayValue.length > 0) {
|
|
124311
124359
|
if (schema?.isGlobalEnum) {
|
|
124312
124360
|
formattedValue = arrayValue.map((v) => `${enumClass}.${String(v).toUpperCase()}`).join(", ");
|
|
@@ -124326,25 +124374,52 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
|
|
|
124326
124374
|
formattedValue = formatJavaValue(filter.value);
|
|
124327
124375
|
}
|
|
124328
124376
|
} else if (filter.filterType === "NumberFilter") {
|
|
124329
|
-
const
|
|
124330
|
-
if (
|
|
124331
|
-
|
|
124332
|
-
|
|
124333
|
-
|
|
124377
|
+
const isBetweenOperator = operator === "between";
|
|
124378
|
+
if (isBetweenOperator) {
|
|
124379
|
+
const arrayValue = parseArrayValue2(filter.value);
|
|
124380
|
+
if (arrayValue && arrayValue.length === 2) {
|
|
124381
|
+
formattedValue = arrayValue.map((v) => {
|
|
124382
|
+
const num = typeof v === "number" ? v : parseInt(String(v), 10);
|
|
124383
|
+
return Number.isInteger(num) ? `${num}L` : String(num);
|
|
124384
|
+
}).join(", ");
|
|
124385
|
+
} else {
|
|
124386
|
+
formattedValue = formatJavaValue(filter.value);
|
|
124387
|
+
}
|
|
124334
124388
|
} else {
|
|
124335
|
-
|
|
124389
|
+
const value = filter.value;
|
|
124390
|
+
if (typeof value === "number") {
|
|
124391
|
+
formattedValue = Number.isInteger(value) ? `${value}L` : String(value);
|
|
124392
|
+
} else if (typeof value === "string" && /^-?\d+$/.test(value)) {
|
|
124393
|
+
formattedValue = `${value}L`;
|
|
124394
|
+
} else {
|
|
124395
|
+
formattedValue = formatJavaValue(filter.value);
|
|
124396
|
+
}
|
|
124336
124397
|
}
|
|
124337
124398
|
} else if (filter.filterType === "TimestampFilter") {
|
|
124338
|
-
const
|
|
124339
|
-
if (
|
|
124340
|
-
|
|
124399
|
+
const isBetweenOperator = operator === "between";
|
|
124400
|
+
if (isBetweenOperator) {
|
|
124401
|
+
const arrayValue = parseArrayValue2(filter.value);
|
|
124402
|
+
if (arrayValue && arrayValue.length === 2) {
|
|
124403
|
+
formattedValue = arrayValue.map((v) => {
|
|
124404
|
+
const num = typeof v === "number" ? v : parseInt(String(v), 10);
|
|
124405
|
+
return `new Timestamp(${num}L * 1000)`;
|
|
124406
|
+
}).join(", ");
|
|
124407
|
+
} else {
|
|
124408
|
+
formattedValue = formatJavaValue(filter.value);
|
|
124409
|
+
}
|
|
124341
124410
|
} else {
|
|
124342
|
-
|
|
124411
|
+
const value = filter.value;
|
|
124412
|
+
if (typeof value === "number" || typeof value === "string" && /^\d+$/.test(String(value))) {
|
|
124413
|
+
const num = typeof value === "number" ? value : parseInt(String(value), 10);
|
|
124414
|
+
formattedValue = `new Timestamp(${num}L * 1000)`;
|
|
124415
|
+
} else {
|
|
124416
|
+
formattedValue = formatJavaValue(filter.value);
|
|
124417
|
+
}
|
|
124343
124418
|
}
|
|
124344
124419
|
} else {
|
|
124345
124420
|
const isInOperator = operator === "in" || operator === "not_in";
|
|
124346
124421
|
if (isInOperator) {
|
|
124347
|
-
const arrayValue =
|
|
124422
|
+
const arrayValue = parseArrayValue2(filter.value);
|
|
124348
124423
|
if (arrayValue && arrayValue.length > 0) {
|
|
124349
124424
|
formattedValue = arrayValue.map((v) => formatJavaValue(v)).join(", ");
|
|
124350
124425
|
} else {
|
|
@@ -125266,6 +125341,17 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
|
|
|
125266
125341
|
lines.push("}");
|
|
125267
125342
|
return lines.join("\n");
|
|
125268
125343
|
}
|
|
125344
|
+
function parseArrayValue(value) {
|
|
125345
|
+
if (Array.isArray(value)) return value;
|
|
125346
|
+
if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
|
|
125347
|
+
try {
|
|
125348
|
+
const parsed = JSON.parse(value);
|
|
125349
|
+
if (Array.isArray(parsed)) return parsed;
|
|
125350
|
+
} catch {
|
|
125351
|
+
}
|
|
125352
|
+
}
|
|
125353
|
+
return null;
|
|
125354
|
+
}
|
|
125269
125355
|
function formatFilterMethodV4Style(filter, paramsClassName) {
|
|
125270
125356
|
const match = filter.key.match(/^([^[]+)\[([^\]]+)\]$/);
|
|
125271
125357
|
if (!match) {
|
|
@@ -125284,6 +125370,18 @@ function formatFilterMethodV4Style(filter, paramsClassName) {
|
|
|
125284
125370
|
const sortFieldMethod = String(filter.value);
|
|
125285
125371
|
return [`.${fieldMethod}()`, `.${sortFieldMethod}()`, `.${operator}()`];
|
|
125286
125372
|
}
|
|
125373
|
+
if (operator === "between") {
|
|
125374
|
+
const arrayValue = parseArrayValue(filter.value);
|
|
125375
|
+
if (arrayValue && arrayValue.length === 2) {
|
|
125376
|
+
if (filter.filterType === "TimestampFilter" || filter.filterType === "NumberFilter") {
|
|
125377
|
+
const elements = arrayValue.map((el) => {
|
|
125378
|
+
const num = typeof el === "number" ? el : parseInt(String(el), 10);
|
|
125379
|
+
return `${num}L`;
|
|
125380
|
+
});
|
|
125381
|
+
return [`.${fieldMethod}()`, `.${operator}(${elements.join(", ")})`];
|
|
125382
|
+
}
|
|
125383
|
+
}
|
|
125384
|
+
}
|
|
125287
125385
|
const formattedValue = formatFilterValueV4(
|
|
125288
125386
|
filter.value,
|
|
125289
125387
|
filter.filterType,
|
|
@@ -129128,4 +129226,4 @@ export {
|
|
|
129128
129226
|
isValid as y,
|
|
129129
129227
|
validateParams as z
|
|
129130
129228
|
};
|
|
129131
|
-
//# sourceMappingURL=generate-from-sample-
|
|
129229
|
+
//# sourceMappingURL=generate-from-sample-D12rHcmw.js.map
|