chargebee 3.30.1 → 3.32.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 +77 -0
- package/README.md +14 -0
- package/cjs/RequestWrapper.js +12 -1
- package/cjs/chargebee.cjs.js +1 -0
- package/cjs/createChargebee.js +5 -1
- package/cjs/environment.js +1 -1
- package/cjs/resources/api_endpoints.js +84 -2
- package/cjs/resources/webhook/eventType.js +4 -0
- package/cjs/schema/coupon.schema.js +1 -1
- package/cjs/schema/credit_note.schema.js +7 -2
- package/cjs/schema/credit_unit.schema.js +2 -2
- package/cjs/schema/entitlement.schema.js +4 -4
- package/cjs/schema/entitlement_override.schema.js +1 -1
- package/cjs/schema/estimate.schema.js +2 -2
- package/cjs/schema/event.schema.js +16 -0
- package/cjs/schema/export.schema.js +35 -3
- package/cjs/schema/hosted_page.schema.js +1 -0
- package/cjs/schema/index.js +1 -0
- package/cjs/schema/invoice.schema.js +11 -4
- package/cjs/schema/ledger_operation.schema.js +2 -2
- package/cjs/schema/meter.schema.js +1 -1
- package/cjs/schema/omnichannel_subscription.schema.js +6 -2
- package/cjs/schema/payment_intent.schema.js +4 -0
- package/cjs/schema/payment_source.schema.js +9 -2
- package/cjs/schema/pricing_page_session.schema.js +1 -1
- package/cjs/schema/quote.schema.js +60 -0
- package/cjs/schema/quote_entitlement.schema.js +25 -0
- package/cjs/schema/ramp.schema.js +2 -2
- package/cjs/schema/subscription.schema.js +2 -2
- package/cjs/schema/webhook_endpoint.schema.js +8 -0
- package/cjs/telemetry/index.js +13 -1
- package/cjs/telemetry/sdkTelemetryEmitter.js +64 -0
- package/cjs/telemetry/sdkTelemetryFeature.js +22 -0
- package/cjs/telemetry/sdkTelemetryHeader.js +15 -0
- package/cjs/telemetry/sdkTelemetryHeaderBuilder.js +34 -0
- package/cjs/telemetry/sdkTelemetryState.js +36 -0
- package/esm/RequestWrapper.js +13 -2
- package/esm/chargebee.esm.js +1 -1
- package/esm/createChargebee.js +5 -1
- package/esm/environment.js +1 -1
- package/esm/resources/api_endpoints.js +84 -2
- package/esm/resources/webhook/eventType.js +4 -0
- package/esm/schema/coupon.schema.js +1 -1
- package/esm/schema/credit_note.schema.js +6 -1
- package/esm/schema/credit_unit.schema.js +2 -2
- package/esm/schema/entitlement.schema.js +4 -4
- package/esm/schema/entitlement_override.schema.js +1 -1
- package/esm/schema/estimate.schema.js +2 -2
- package/esm/schema/event.schema.js +16 -0
- package/esm/schema/export.schema.js +34 -2
- package/esm/schema/hosted_page.schema.js +1 -0
- package/esm/schema/index.js +1 -0
- package/esm/schema/invoice.schema.js +10 -3
- package/esm/schema/ledger_operation.schema.js +2 -2
- package/esm/schema/meter.schema.js +1 -1
- package/esm/schema/omnichannel_subscription.schema.js +6 -2
- package/esm/schema/payment_intent.schema.js +4 -0
- package/esm/schema/payment_source.schema.js +8 -1
- package/esm/schema/pricing_page_session.schema.js +1 -1
- package/esm/schema/quote.schema.js +60 -0
- package/esm/schema/quote_entitlement.schema.js +22 -0
- package/esm/schema/ramp.schema.js +2 -2
- package/esm/schema/subscription.schema.js +2 -2
- package/esm/schema/webhook_endpoint.schema.js +8 -0
- package/esm/telemetry/index.js +5 -0
- package/esm/telemetry/sdkTelemetryEmitter.js +61 -0
- package/esm/telemetry/sdkTelemetryFeature.js +19 -0
- package/esm/telemetry/sdkTelemetryHeader.js +12 -0
- package/esm/telemetry/sdkTelemetryHeaderBuilder.js +31 -0
- package/esm/telemetry/sdkTelemetryState.js +32 -0
- package/package.json +5 -9
- package/types/core.d.ts +78 -3
- package/types/index.d.ts +15 -2
- package/types/resources/Content.d.ts +4 -0
- package/types/resources/CreditNote.d.ts +14 -0
- package/types/resources/Event.d.ts +4 -0
- package/types/resources/Export.d.ts +20 -0
- package/types/resources/GatewayPaymentMethodToken.d.ts +15 -0
- package/types/resources/HostedPage.d.ts +1 -0
- package/types/resources/Invoice.d.ts +17 -1
- package/types/resources/OmnichannelSubscriptionItemMetric.d.ts +18 -0
- package/types/resources/PaymentIntent.d.ts +14 -11
- package/types/resources/PaymentSource.d.ts +17 -0
- package/types/resources/PricingPageSession.d.ts +1 -1
- package/types/resources/Quote.d.ts +45 -0
- package/types/resources/QuoteEntitlement.d.ts +49 -0
- package/types/resources/QuotedRamp.d.ts +1 -0
- package/types/resources/VaultedPaymentMethod.d.ts +28 -0
- package/types/resources/WebhookEvent.d.ts +24 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Generated Zod schemas: Invoice
|
|
3
|
-
// Actions: create, createForChargeItemsAndCharges, charge, chargeAddon, createForChargeItem, stopDunning, pauseDunning, resumeDunning, importInvoice, applyPayments, deleteLineItems, applyCredits, list, invoicesForCustomer, invoicesForSubscription, retrieve, pdf, listPaymentReferenceNumbers, addCharge, addAddonCharge, addChargeItem, close, collectPayment, recordPayment, recordTaxWithheld, removeTaxWithheld, refund, recordRefund, removePayment, removeCreditNote, voidInvoice, writeOff, delete, updateDetails, applyPaymentScheduleScheme
|
|
3
|
+
// Actions: create, createForChargeItemsAndCharges, charge, chargeAddon, createForChargeItem, stopDunning, pauseDunning, resumeDunning, importInvoice, applyPayments, deleteLineItems, applyCredits, list, invoicesForCustomer, invoicesForSubscription, retrieve, pdf, listPaymentReferenceNumbers, addCharge, addAddonCharge, addChargeItem, close, collectPayment, recordPayment, recordTaxWithheld, removeTaxWithheld, refund, recordRefund, removePayment, removeCreditNote, voidInvoice, writeOff, voidBeforeCapture, delete, updateDetails, applyPaymentScheduleScheme
|
|
4
4
|
// Do not edit manually – regenerate via sdk-generator
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ApplyPaymentScheduleSchemeInvoiceBodySchema = exports.UpdateDetailsInvoiceBodySchema = exports.DeleteInvoiceBodySchema = exports.WriteOffInvoiceBodySchema = exports.VoidInvoiceInvoiceBodySchema = exports.RemoveCreditNoteInvoiceBodySchema = exports.RemovePaymentInvoiceBodySchema = exports.RecordRefundInvoiceBodySchema = exports.RefundInvoiceBodySchema = exports.RemoveTaxWithheldInvoiceBodySchema = exports.RecordTaxWithheldInvoiceBodySchema = exports.RecordPaymentInvoiceBodySchema = exports.CollectPaymentInvoiceBodySchema = exports.CloseInvoiceBodySchema = exports.AddChargeItemInvoiceBodySchema = exports.AddAddonChargeInvoiceBodySchema = exports.AddChargeInvoiceBodySchema = exports.ListPaymentReferenceNumbersInvoiceBodySchema = exports.PdfInvoiceBodySchema = exports.RetrieveInvoiceBodySchema = exports.InvoicesForSubscriptionInvoiceBodySchema = exports.InvoicesForCustomerInvoiceBodySchema = exports.ListInvoiceBodySchema = exports.ApplyCreditsInvoiceBodySchema = exports.DeleteLineItemsInvoiceBodySchema = exports.ApplyPaymentsInvoiceBodySchema = exports.ImportInvoiceInvoiceBodySchema = exports.ResumeDunningInvoiceBodySchema = exports.PauseDunningInvoiceBodySchema = exports.StopDunningInvoiceBodySchema = exports.CreateForChargeItemInvoiceBodySchema = exports.ChargeAddonInvoiceBodySchema = exports.ChargeInvoiceBodySchema = exports.CreateForChargeItemsAndChargesInvoiceBodySchema = exports.CreateInvoiceBodySchema = void 0;
|
|
6
|
+
exports.ApplyPaymentScheduleSchemeInvoiceBodySchema = exports.UpdateDetailsInvoiceBodySchema = exports.DeleteInvoiceBodySchema = exports.VoidBeforeCaptureInvoiceBodySchema = exports.WriteOffInvoiceBodySchema = exports.VoidInvoiceInvoiceBodySchema = exports.RemoveCreditNoteInvoiceBodySchema = exports.RemovePaymentInvoiceBodySchema = exports.RecordRefundInvoiceBodySchema = exports.RefundInvoiceBodySchema = exports.RemoveTaxWithheldInvoiceBodySchema = exports.RecordTaxWithheldInvoiceBodySchema = exports.RecordPaymentInvoiceBodySchema = exports.CollectPaymentInvoiceBodySchema = exports.CloseInvoiceBodySchema = exports.AddChargeItemInvoiceBodySchema = exports.AddAddonChargeInvoiceBodySchema = exports.AddChargeInvoiceBodySchema = exports.ListPaymentReferenceNumbersInvoiceBodySchema = exports.PdfInvoiceBodySchema = exports.RetrieveInvoiceBodySchema = exports.InvoicesForSubscriptionInvoiceBodySchema = exports.InvoicesForCustomerInvoiceBodySchema = exports.ListInvoiceBodySchema = exports.ApplyCreditsInvoiceBodySchema = exports.DeleteLineItemsInvoiceBodySchema = exports.ApplyPaymentsInvoiceBodySchema = exports.ImportInvoiceInvoiceBodySchema = exports.ResumeDunningInvoiceBodySchema = exports.PauseDunningInvoiceBodySchema = exports.StopDunningInvoiceBodySchema = exports.CreateForChargeItemInvoiceBodySchema = exports.ChargeAddonInvoiceBodySchema = exports.ChargeInvoiceBodySchema = exports.CreateForChargeItemsAndChargesInvoiceBodySchema = exports.CreateInvoiceBodySchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
//Invoice.create
|
|
9
9
|
const CreateInvoiceShippingAddressSchema = zod_1.z.object({
|
|
@@ -1424,12 +1424,12 @@ const PdfInvoiceBodySchema = zod_1.z.looseObject({
|
|
|
1424
1424
|
exports.PdfInvoiceBodySchema = PdfInvoiceBodySchema;
|
|
1425
1425
|
//Invoice.listPaymentReferenceNumbers
|
|
1426
1426
|
const ListPaymentReferenceNumbersInvoiceIdSchema = zod_1.z.object({
|
|
1427
|
-
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
1428
1427
|
is: zod_1.z.string().min(1).optional(),
|
|
1428
|
+
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
1429
1429
|
});
|
|
1430
1430
|
const ListPaymentReferenceNumbersInvoiceNumberSchema = zod_1.z.object({
|
|
1431
|
-
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
1432
1431
|
is: zod_1.z.string().min(1).optional(),
|
|
1432
|
+
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
1433
1433
|
});
|
|
1434
1434
|
const ListPaymentReferenceNumbersInvoicePaymentReferenceNumberItemSchema = zod_1.z.object({
|
|
1435
1435
|
number: ListPaymentReferenceNumbersInvoiceNumberSchema.optional(),
|
|
@@ -1682,6 +1682,13 @@ const WriteOffInvoiceBodySchema = zod_1.z.looseObject({
|
|
|
1682
1682
|
comment: zod_1.z.string().max(300).optional(),
|
|
1683
1683
|
});
|
|
1684
1684
|
exports.WriteOffInvoiceBodySchema = WriteOffInvoiceBodySchema;
|
|
1685
|
+
//Invoice.voidBeforeCapture
|
|
1686
|
+
const VoidBeforeCaptureInvoiceBodySchema = zod_1.z.looseObject({
|
|
1687
|
+
comment: zod_1.z.string().max(300).optional(),
|
|
1688
|
+
void_reason_code: zod_1.z.string().max(100).optional(),
|
|
1689
|
+
invoice_action: zod_1.z.enum(['void', 'write_off']).optional(),
|
|
1690
|
+
});
|
|
1691
|
+
exports.VoidBeforeCaptureInvoiceBodySchema = VoidBeforeCaptureInvoiceBodySchema;
|
|
1685
1692
|
//Invoice.delete
|
|
1686
1693
|
const DeleteInvoiceBodySchema = zod_1.z.looseObject({
|
|
1687
1694
|
comment: zod_1.z.string().max(300).optional(),
|
|
@@ -19,7 +19,7 @@ const ListLedgerOperationsLedgerOperationCreatedAtSchema = zod_1.z.object({
|
|
|
19
19
|
between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
|
|
20
20
|
});
|
|
21
21
|
const ListLedgerOperationsLedgerOperationTypeSchema = zod_1.z.object({
|
|
22
|
-
|
|
22
|
+
is: zod_1.z
|
|
23
23
|
.enum([
|
|
24
24
|
'allocation',
|
|
25
25
|
'capture',
|
|
@@ -32,7 +32,7 @@ const ListLedgerOperationsLedgerOperationTypeSchema = zod_1.z.object({
|
|
|
32
32
|
'adjustment',
|
|
33
33
|
])
|
|
34
34
|
.optional(),
|
|
35
|
-
|
|
35
|
+
in: zod_1.z
|
|
36
36
|
.enum([
|
|
37
37
|
'allocation',
|
|
38
38
|
'capture',
|
|
@@ -7,8 +7,8 @@ exports.ListMeterBodySchema = void 0;
|
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
//Meter.list
|
|
9
9
|
const ListMeterNameSchema = zod_1.z.object({
|
|
10
|
-
starts_with: zod_1.z.string().min(1).optional(),
|
|
11
10
|
is: zod_1.z.string().min(1).optional(),
|
|
11
|
+
starts_with: zod_1.z.string().min(1).optional(),
|
|
12
12
|
});
|
|
13
13
|
const ListMeterSortBySchema = zod_1.z.looseObject({
|
|
14
14
|
asc: zod_1.z.enum(['id', 'name', 'created_at', 'updated_at']).optional(),
|
|
@@ -34,12 +34,16 @@ const ListOmnichannelSubscriptionIdAtSourceSchema = zod_1.z.object({
|
|
|
34
34
|
not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
35
35
|
});
|
|
36
36
|
const ListOmnichannelSubscriptionUpdatedAtSchema = zod_1.z.object({
|
|
37
|
-
before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
38
37
|
after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
38
|
+
on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
39
|
+
before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
40
|
+
between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
|
|
39
41
|
});
|
|
40
42
|
const ListOmnichannelSubscriptionPurchasedAtSchema = zod_1.z.object({
|
|
41
|
-
before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
42
43
|
after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
44
|
+
on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
45
|
+
before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
46
|
+
between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
|
|
43
47
|
});
|
|
44
48
|
const ListOmnichannelSubscriptionSortBySchema = zod_1.z.looseObject({
|
|
45
49
|
asc: zod_1.z.enum(['created_at', 'updated_at']).optional(),
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.UpdatePaymentIntentBodySchema = exports.CreatePaymentIntentBodySchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
//PaymentIntent.create
|
|
9
|
+
const CreatePaymentIntentPaymentMethodOptionsSchema = zod_1.z.looseObject({});
|
|
9
10
|
const CreatePaymentIntentBodySchema = zod_1.z.looseObject({
|
|
10
11
|
business_entity_id: zod_1.z.string().max(50).optional(),
|
|
11
12
|
customer_id: zod_1.z.string().max(50).optional(),
|
|
@@ -72,9 +73,11 @@ const CreatePaymentIntentBodySchema = zod_1.z.looseObject({
|
|
|
72
73
|
.optional(),
|
|
73
74
|
success_url: zod_1.z.string().max(250).optional(),
|
|
74
75
|
failure_url: zod_1.z.string().max(250).optional(),
|
|
76
|
+
payment_method_options: CreatePaymentIntentPaymentMethodOptionsSchema.optional(),
|
|
75
77
|
});
|
|
76
78
|
exports.CreatePaymentIntentBodySchema = CreatePaymentIntentBodySchema;
|
|
77
79
|
//PaymentIntent.update
|
|
80
|
+
const UpdatePaymentIntentPaymentMethodOptionsSchema = zod_1.z.looseObject({});
|
|
78
81
|
const UpdatePaymentIntentBodySchema = zod_1.z.looseObject({
|
|
79
82
|
amount: zod_1.z.number().int().min(0).optional(),
|
|
80
83
|
currency_code: zod_1.z.string().max(3).optional(),
|
|
@@ -137,5 +140,6 @@ const UpdatePaymentIntentBodySchema = zod_1.z.looseObject({
|
|
|
137
140
|
.optional(),
|
|
138
141
|
success_url: zod_1.z.string().max(250).optional(),
|
|
139
142
|
failure_url: zod_1.z.string().max(250).optional(),
|
|
143
|
+
payment_method_options: UpdatePaymentIntentPaymentMethodOptionsSchema.optional(),
|
|
140
144
|
});
|
|
141
145
|
exports.UpdatePaymentIntentBodySchema = UpdatePaymentIntentBodySchema;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Generated Zod schemas: PaymentSource
|
|
3
|
-
// Actions: createUsingTempToken, createUsingPermanentToken, createUsingToken, createUsingPaymentIntent, createVoucherPaymentSource, createCard, createBankAccount, updateCard, updateBankAccount, verifyBankAccount, list, switchGatewayAccount, exportPaymentSource
|
|
3
|
+
// Actions: createUsingTempToken, createUsingPermanentToken, createUsingToken, createUsingPaymentIntent, createVoucherPaymentSource, createCard, createBankAccount, updateCard, updateBankAccount, verifyBankAccount, listGatewayTokensForPaymentSource, list, switchGatewayAccount, exportPaymentSource
|
|
4
4
|
// Do not edit manually – regenerate via sdk-generator
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ExportPaymentSourcePaymentSourceBodySchema = exports.SwitchGatewayAccountPaymentSourceBodySchema = exports.ListPaymentSourceBodySchema = exports.VerifyBankAccountPaymentSourceBodySchema = exports.UpdateBankAccountPaymentSourceBodySchema = exports.UpdateCardPaymentSourceBodySchema = exports.CreateBankAccountPaymentSourceBodySchema = exports.CreateCardPaymentSourceBodySchema = exports.CreateVoucherPaymentSourcePaymentSourceBodySchema = exports.CreateUsingPaymentIntentPaymentSourceBodySchema = exports.CreateUsingTokenPaymentSourceBodySchema = exports.CreateUsingPermanentTokenPaymentSourceBodySchema = exports.CreateUsingTempTokenPaymentSourceBodySchema = void 0;
|
|
6
|
+
exports.ExportPaymentSourcePaymentSourceBodySchema = exports.SwitchGatewayAccountPaymentSourceBodySchema = exports.ListPaymentSourceBodySchema = exports.ListGatewayTokensForPaymentSourcePaymentSourceBodySchema = exports.VerifyBankAccountPaymentSourceBodySchema = exports.UpdateBankAccountPaymentSourceBodySchema = exports.UpdateCardPaymentSourceBodySchema = exports.CreateBankAccountPaymentSourceBodySchema = exports.CreateCardPaymentSourceBodySchema = exports.CreateVoucherPaymentSourcePaymentSourceBodySchema = exports.CreateUsingPaymentIntentPaymentSourceBodySchema = exports.CreateUsingTokenPaymentSourceBodySchema = exports.CreateUsingPermanentTokenPaymentSourceBodySchema = exports.CreateUsingTempTokenPaymentSourceBodySchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
//PaymentSource.createUsingTempToken
|
|
9
9
|
const CreateUsingTempTokenPaymentSourceAdditionalInformationSchema = zod_1.z.looseObject({});
|
|
@@ -382,6 +382,13 @@ const VerifyBankAccountPaymentSourceBodySchema = zod_1.z.looseObject({
|
|
|
382
382
|
amount2: zod_1.z.number().int().min(0),
|
|
383
383
|
});
|
|
384
384
|
exports.VerifyBankAccountPaymentSourceBodySchema = VerifyBankAccountPaymentSourceBodySchema;
|
|
385
|
+
//PaymentSource.listGatewayTokensForPaymentSource
|
|
386
|
+
const ListGatewayTokensForPaymentSourcePaymentSourceBodySchema = zod_1.z.looseObject({
|
|
387
|
+
limit: zod_1.z.number().int().min(1).max(100).optional(),
|
|
388
|
+
offset: zod_1.z.string().max(1000).optional(),
|
|
389
|
+
include_deleted: zod_1.z.boolean().default(false).optional(),
|
|
390
|
+
});
|
|
391
|
+
exports.ListGatewayTokensForPaymentSourcePaymentSourceBodySchema = ListGatewayTokensForPaymentSourcePaymentSourceBodySchema;
|
|
385
392
|
//PaymentSource.list
|
|
386
393
|
const ListPaymentSourceCustomerIdSchema = zod_1.z.object({
|
|
387
394
|
is: zod_1.z.string().min(1).optional(),
|
|
@@ -8,7 +8,7 @@ const zod_1 = require("zod");
|
|
|
8
8
|
//PricingPageSession.createForNewSubscription
|
|
9
9
|
const CreateForNewSubscriptionPricingPageSessionCustomSchema = zod_1.z.looseObject({});
|
|
10
10
|
const CreateForNewSubscriptionPricingPageSessionPricingPageSchema = zod_1.z.object({
|
|
11
|
-
id: zod_1.z.string().max(50),
|
|
11
|
+
id: zod_1.z.string().max(50).optional(),
|
|
12
12
|
});
|
|
13
13
|
const CreateForNewSubscriptionPricingPageSessionSubscriptionSchema = zod_1.z.looseObject({
|
|
14
14
|
id: zod_1.z.string().max(50).optional(),
|
|
@@ -720,6 +720,7 @@ const CreateSubItemsForCustomerQuoteQuoteSubscriptionItemsSchema = zod_1.z.objec
|
|
|
720
720
|
.optional(),
|
|
721
721
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
722
722
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
723
|
+
description: zod_1.z.array(zod_1.z.string().max(2000).optional()).optional(),
|
|
723
724
|
ramp_tier_id: zod_1.z.array(zod_1.z.string().max(105).optional()).optional(),
|
|
724
725
|
});
|
|
725
726
|
const CreateSubItemsForCustomerQuoteQuoteDiscountsSchema = zod_1.z.object({
|
|
@@ -758,6 +759,19 @@ const CreateSubItemsForCustomerQuoteQuoteCouponsSchema = zod_1.z.object({
|
|
|
758
759
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
759
760
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
760
761
|
});
|
|
762
|
+
const CreateSubItemsForCustomerQuoteQuoteEntitlementOverridesSchema = zod_1.z.object({
|
|
763
|
+
feature_id: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
764
|
+
entity_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
|
|
765
|
+
entity_type: zod_1.z
|
|
766
|
+
.array(zod_1.z
|
|
767
|
+
.enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
|
|
768
|
+
.optional())
|
|
769
|
+
.optional(),
|
|
770
|
+
value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
771
|
+
is_enabled: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
|
|
772
|
+
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
773
|
+
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
774
|
+
});
|
|
761
775
|
const CreateSubItemsForCustomerQuoteQuoteBodySchema = zod_1.z.looseObject({
|
|
762
776
|
name: zod_1.z.string().max(100).optional(),
|
|
763
777
|
notes: zod_1.z.string().max(10000).optional(),
|
|
@@ -777,6 +791,7 @@ const CreateSubItemsForCustomerQuoteQuoteBodySchema = zod_1.z.looseObject({
|
|
|
777
791
|
discounts: CreateSubItemsForCustomerQuoteQuoteDiscountsSchema.optional(),
|
|
778
792
|
item_tiers: CreateSubItemsForCustomerQuoteQuoteItemTiersSchema.optional(),
|
|
779
793
|
coupons: CreateSubItemsForCustomerQuoteQuoteCouponsSchema.optional(),
|
|
794
|
+
entitlement_overrides: CreateSubItemsForCustomerQuoteQuoteEntitlementOverridesSchema.optional(),
|
|
780
795
|
});
|
|
781
796
|
exports.CreateSubItemsForCustomerQuoteQuoteBodySchema = CreateSubItemsForCustomerQuoteQuoteBodySchema;
|
|
782
797
|
//Quote.editCreateSubCustomerQuoteForItems
|
|
@@ -883,6 +898,7 @@ const EditCreateSubCustomerQuoteForItemsQuoteSubscriptionItemsSchema = zod_1.z.o
|
|
|
883
898
|
.optional(),
|
|
884
899
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
885
900
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
901
|
+
description: zod_1.z.array(zod_1.z.string().max(2000).optional()).optional(),
|
|
886
902
|
ramp_tier_id: zod_1.z.array(zod_1.z.string().max(105).optional()).optional(),
|
|
887
903
|
});
|
|
888
904
|
const EditCreateSubCustomerQuoteForItemsQuoteDiscountsSchema = zod_1.z.object({
|
|
@@ -921,6 +937,19 @@ const EditCreateSubCustomerQuoteForItemsQuoteCouponsSchema = zod_1.z.object({
|
|
|
921
937
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
922
938
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
923
939
|
});
|
|
940
|
+
const EditCreateSubCustomerQuoteForItemsQuoteEntitlementOverridesSchema = zod_1.z.object({
|
|
941
|
+
feature_id: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
942
|
+
entity_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
|
|
943
|
+
entity_type: zod_1.z
|
|
944
|
+
.array(zod_1.z
|
|
945
|
+
.enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
|
|
946
|
+
.optional())
|
|
947
|
+
.optional(),
|
|
948
|
+
value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
949
|
+
is_enabled: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
|
|
950
|
+
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
951
|
+
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
952
|
+
});
|
|
924
953
|
const EditCreateSubCustomerQuoteForItemsQuoteBodySchema = zod_1.z.looseObject({
|
|
925
954
|
notes: zod_1.z.string().max(10000).optional(),
|
|
926
955
|
expires_at: zod_1.z.number().int().optional(),
|
|
@@ -939,6 +968,7 @@ const EditCreateSubCustomerQuoteForItemsQuoteBodySchema = zod_1.z.looseObject({
|
|
|
939
968
|
discounts: EditCreateSubCustomerQuoteForItemsQuoteDiscountsSchema.optional(),
|
|
940
969
|
item_tiers: EditCreateSubCustomerQuoteForItemsQuoteItemTiersSchema.optional(),
|
|
941
970
|
coupons: EditCreateSubCustomerQuoteForItemsQuoteCouponsSchema.optional(),
|
|
971
|
+
entitlement_overrides: EditCreateSubCustomerQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
|
|
942
972
|
});
|
|
943
973
|
exports.EditCreateSubCustomerQuoteForItemsQuoteBodySchema = EditCreateSubCustomerQuoteForItemsQuoteBodySchema;
|
|
944
974
|
//Quote.updateSubscriptionQuoteForItems
|
|
@@ -1049,6 +1079,7 @@ const UpdateSubscriptionQuoteForItemsQuoteSubscriptionItemsSchema = zod_1.z.obje
|
|
|
1049
1079
|
item_type: zod_1.z.array(zod_1.z.enum(['plan', 'addon', 'charge']).optional()).optional(),
|
|
1050
1080
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1051
1081
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1082
|
+
description: zod_1.z.array(zod_1.z.string().max(2000).optional()).optional(),
|
|
1052
1083
|
ramp_tier_id: zod_1.z.array(zod_1.z.string().max(105).optional()).optional(),
|
|
1053
1084
|
});
|
|
1054
1085
|
const UpdateSubscriptionQuoteForItemsQuoteDiscountsSchema = zod_1.z.object({
|
|
@@ -1089,6 +1120,19 @@ const UpdateSubscriptionQuoteForItemsQuoteCouponsSchema = zod_1.z.object({
|
|
|
1089
1120
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1090
1121
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1091
1122
|
});
|
|
1123
|
+
const UpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema = zod_1.z.object({
|
|
1124
|
+
feature_id: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
1125
|
+
entity_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
|
|
1126
|
+
entity_type: zod_1.z
|
|
1127
|
+
.array(zod_1.z
|
|
1128
|
+
.enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
|
|
1129
|
+
.optional())
|
|
1130
|
+
.optional(),
|
|
1131
|
+
value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
1132
|
+
is_enabled: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
|
|
1133
|
+
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1134
|
+
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1135
|
+
});
|
|
1092
1136
|
const UpdateSubscriptionQuoteForItemsQuoteBodySchema = zod_1.z.looseObject({
|
|
1093
1137
|
name: zod_1.z.string().max(100).optional(),
|
|
1094
1138
|
notes: zod_1.z.string().max(10000).optional(),
|
|
@@ -1115,6 +1159,7 @@ const UpdateSubscriptionQuoteForItemsQuoteBodySchema = zod_1.z.looseObject({
|
|
|
1115
1159
|
discounts: UpdateSubscriptionQuoteForItemsQuoteDiscountsSchema.optional(),
|
|
1116
1160
|
item_tiers: UpdateSubscriptionQuoteForItemsQuoteItemTiersSchema.optional(),
|
|
1117
1161
|
coupons: UpdateSubscriptionQuoteForItemsQuoteCouponsSchema.optional(),
|
|
1162
|
+
entitlement_overrides: UpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
|
|
1118
1163
|
});
|
|
1119
1164
|
exports.UpdateSubscriptionQuoteForItemsQuoteBodySchema = UpdateSubscriptionQuoteForItemsQuoteBodySchema;
|
|
1120
1165
|
//Quote.editUpdateSubscriptionQuoteForItems
|
|
@@ -1226,6 +1271,7 @@ const EditUpdateSubscriptionQuoteForItemsQuoteSubscriptionItemsSchema = zod_1.z.
|
|
|
1226
1271
|
.optional(),
|
|
1227
1272
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1228
1273
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1274
|
+
description: zod_1.z.array(zod_1.z.string().max(2000).optional()).optional(),
|
|
1229
1275
|
ramp_tier_id: zod_1.z.array(zod_1.z.string().max(105).optional()).optional(),
|
|
1230
1276
|
});
|
|
1231
1277
|
const EditUpdateSubscriptionQuoteForItemsQuoteDiscountsSchema = zod_1.z.object({
|
|
@@ -1266,6 +1312,19 @@ const EditUpdateSubscriptionQuoteForItemsQuoteCouponsSchema = zod_1.z.object({
|
|
|
1266
1312
|
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1267
1313
|
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1268
1314
|
});
|
|
1315
|
+
const EditUpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema = zod_1.z.object({
|
|
1316
|
+
feature_id: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
1317
|
+
entity_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
|
|
1318
|
+
entity_type: zod_1.z
|
|
1319
|
+
.array(zod_1.z
|
|
1320
|
+
.enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
|
|
1321
|
+
.optional())
|
|
1322
|
+
.optional(),
|
|
1323
|
+
value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
|
|
1324
|
+
is_enabled: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
|
|
1325
|
+
start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1326
|
+
end_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
|
|
1327
|
+
});
|
|
1269
1328
|
const EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = zod_1.z.looseObject({
|
|
1270
1329
|
notes: zod_1.z.string().max(10000).optional(),
|
|
1271
1330
|
expires_at: zod_1.z.number().int().optional(),
|
|
@@ -1291,6 +1350,7 @@ const EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = zod_1.z.looseObject({
|
|
|
1291
1350
|
discounts: EditUpdateSubscriptionQuoteForItemsQuoteDiscountsSchema.optional(),
|
|
1292
1351
|
item_tiers: EditUpdateSubscriptionQuoteForItemsQuoteItemTiersSchema.optional(),
|
|
1293
1352
|
coupons: EditUpdateSubscriptionQuoteForItemsQuoteCouponsSchema.optional(),
|
|
1353
|
+
entitlement_overrides: EditUpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
|
|
1294
1354
|
});
|
|
1295
1355
|
exports.EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = EditUpdateSubscriptionQuoteForItemsQuoteBodySchema;
|
|
1296
1356
|
//Quote.createForChargeItemsAndCharges
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated Zod schemas: QuoteEntitlement
|
|
3
|
+
// Actions: listQuoteEntitlements
|
|
4
|
+
// Do not edit manually – regenerate via sdk-generator
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ListQuoteEntitlementsQuoteEntitlementBodySchema = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
//QuoteEntitlement.listQuoteEntitlements
|
|
9
|
+
const ListQuoteEntitlementsQuoteEntitlementEntityIdSchema = zod_1.z.object({
|
|
10
|
+
is: zod_1.z.string().min(1).optional(),
|
|
11
|
+
});
|
|
12
|
+
const ListQuoteEntitlementsQuoteEntitlementStartDateSchema = zod_1.z.object({
|
|
13
|
+
on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
14
|
+
});
|
|
15
|
+
const ListQuoteEntitlementsQuoteEntitlementEndDateSchema = zod_1.z.object({
|
|
16
|
+
on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
17
|
+
});
|
|
18
|
+
const ListQuoteEntitlementsQuoteEntitlementBodySchema = zod_1.z.looseObject({
|
|
19
|
+
limit: zod_1.z.number().int().min(1).max(100).optional(),
|
|
20
|
+
offset: zod_1.z.string().max(1000).optional(),
|
|
21
|
+
entity_id: ListQuoteEntitlementsQuoteEntitlementEntityIdSchema.optional(),
|
|
22
|
+
start_date: ListQuoteEntitlementsQuoteEntitlementStartDateSchema.optional(),
|
|
23
|
+
end_date: ListQuoteEntitlementsQuoteEntitlementEndDateSchema.optional(),
|
|
24
|
+
});
|
|
25
|
+
exports.ListQuoteEntitlementsQuoteEntitlementBodySchema = ListQuoteEntitlementsQuoteEntitlementBodySchema;
|
|
@@ -211,12 +211,12 @@ const UpdateRampBodySchema = zod_1.z.looseObject({
|
|
|
211
211
|
exports.UpdateRampBodySchema = UpdateRampBodySchema;
|
|
212
212
|
//Ramp.list
|
|
213
213
|
const ListRampStatusSchema = zod_1.z.object({
|
|
214
|
-
in: zod_1.z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
|
|
215
214
|
is: zod_1.z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
|
|
215
|
+
in: zod_1.z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
|
|
216
216
|
});
|
|
217
217
|
const ListRampSubscriptionIdSchema = zod_1.z.object({
|
|
218
|
-
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
219
218
|
is: zod_1.z.string().min(1).optional(),
|
|
219
|
+
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
|
|
220
220
|
});
|
|
221
221
|
const ListRampEffectiveFromSchema = zod_1.z.object({
|
|
222
222
|
after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
|
|
@@ -3282,7 +3282,7 @@ const CancelSubscriptionBodySchema = zod_1.z.looseObject({
|
|
|
3282
3282
|
end_of_term: zod_1.z.boolean().default(false).optional(),
|
|
3283
3283
|
cancel_at: zod_1.z.number().int().optional(),
|
|
3284
3284
|
credit_option_for_current_term_charges: zod_1.z
|
|
3285
|
-
.enum(['none', 'prorate', 'full'])
|
|
3285
|
+
.enum(['none', 'prorate', 'full', 'consumption_based'])
|
|
3286
3286
|
.optional(),
|
|
3287
3287
|
unbilled_charges_option: zod_1.z.enum(['invoice', 'delete']).optional(),
|
|
3288
3288
|
account_receivables_handling: zod_1.z
|
|
@@ -3327,7 +3327,7 @@ const CancelForItemsSubscriptionBodySchema = zod_1.z.looseObject({
|
|
|
3327
3327
|
end_of_term: zod_1.z.boolean().default(false).optional(),
|
|
3328
3328
|
cancel_at: zod_1.z.number().int().optional(),
|
|
3329
3329
|
credit_option_for_current_term_charges: zod_1.z
|
|
3330
|
-
.enum(['none', 'prorate', 'full'])
|
|
3330
|
+
.enum(['none', 'prorate', 'full', 'consumption_based'])
|
|
3331
3331
|
.optional(),
|
|
3332
3332
|
unbilled_charges_option: zod_1.z.enum(['invoice', 'delete']).optional(),
|
|
3333
3333
|
account_receivables_handling: zod_1.z
|
|
@@ -244,10 +244,14 @@ const CreateWebhookEndpointBodySchema = zod_1.z.looseObject({
|
|
|
244
244
|
'alert_status_changed',
|
|
245
245
|
'omnichannel_subscription_item_updated',
|
|
246
246
|
'omnichannel_subscription_item_recovered',
|
|
247
|
+
'omnichannel_subscription_item_mrr_updated',
|
|
247
248
|
'ledger_account_balance_updated',
|
|
248
249
|
'grant_blocks_created',
|
|
249
250
|
'grant_blocks_updated',
|
|
250
251
|
'ledger_updated',
|
|
252
|
+
'vault_token_created',
|
|
253
|
+
'vault_token_updated',
|
|
254
|
+
'vault_token_deleted',
|
|
251
255
|
'plan_created',
|
|
252
256
|
'plan_updated',
|
|
253
257
|
'plan_deleted',
|
|
@@ -495,10 +499,14 @@ const UpdateWebhookEndpointBodySchema = zod_1.z.looseObject({
|
|
|
495
499
|
'alert_status_changed',
|
|
496
500
|
'omnichannel_subscription_item_updated',
|
|
497
501
|
'omnichannel_subscription_item_recovered',
|
|
502
|
+
'omnichannel_subscription_item_mrr_updated',
|
|
498
503
|
'ledger_account_balance_updated',
|
|
499
504
|
'grant_blocks_created',
|
|
500
505
|
'grant_blocks_updated',
|
|
501
506
|
'ledger_updated',
|
|
507
|
+
'vault_token_created',
|
|
508
|
+
'vault_token_updated',
|
|
509
|
+
'vault_token_deleted',
|
|
502
510
|
'plan_created',
|
|
503
511
|
'plan_updated',
|
|
504
512
|
'plan_deleted',
|
package/cjs/telemetry/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Copyright 2026 Chargebee Inc.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.resolveChargebeeApiVersion = exports.extractRequestTelemetryError = exports.extractHttpStatusCode = exports.buildSpanName = exports.buildRequestTelemetryResult = exports.buildRequestTelemetryContext = exports.buildRequestStartSpanAttributes = exports.buildRequestHeaderSpanAttributes = exports.buildRequestEndSpanAttributes = exports.NoOpTelemetryAdapter = exports.NO_OP_TELEMETRY_ADAPTER = exports.TelemetryAttributeKeys = exports.TELEMETRY_SPAN_NAME_PREFIX = exports.HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX = exports.CHARGEBEE_TELEMETRY_HEADER_PREFIX = exports.CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX = exports.CHARGEBEE_SDK_NAME = void 0;
|
|
9
|
+
exports.attachSdkTelemetryHeader = exports.buildSdkTelemetryHeader = exports.SdkTelemetryState = exports.SdkTelemetryFeature = exports.SDK_TELEMETRY_MAX_HEADER_BYTES = exports.SDK_TELEMETRY_HEADER_NAME = exports.SDK_TELEMETRY_FEATURES_KEY = exports.resolveChargebeeApiVersion = exports.extractRequestTelemetryError = exports.extractHttpStatusCode = exports.buildSpanName = exports.buildRequestTelemetryResult = exports.buildRequestTelemetryContext = exports.buildRequestStartSpanAttributes = exports.buildRequestHeaderSpanAttributes = exports.buildRequestEndSpanAttributes = exports.NoOpTelemetryAdapter = exports.NO_OP_TELEMETRY_ADAPTER = exports.TelemetryAttributeKeys = exports.TELEMETRY_SPAN_NAME_PREFIX = exports.HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX = exports.CHARGEBEE_TELEMETRY_HEADER_PREFIX = exports.CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX = exports.CHARGEBEE_SDK_NAME = void 0;
|
|
10
10
|
var types_js_1 = require("./types.js");
|
|
11
11
|
Object.defineProperty(exports, "CHARGEBEE_SDK_NAME", { enumerable: true, get: function () { return types_js_1.CHARGEBEE_SDK_NAME; } });
|
|
12
12
|
Object.defineProperty(exports, "CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX", { enumerable: true, get: function () { return types_js_1.CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX; } });
|
|
@@ -26,3 +26,15 @@ Object.defineProperty(exports, "buildSpanName", { enumerable: true, get: functio
|
|
|
26
26
|
Object.defineProperty(exports, "extractHttpStatusCode", { enumerable: true, get: function () { return TelemetryAdapter_js_1.extractHttpStatusCode; } });
|
|
27
27
|
Object.defineProperty(exports, "extractRequestTelemetryError", { enumerable: true, get: function () { return TelemetryAdapter_js_1.extractRequestTelemetryError; } });
|
|
28
28
|
Object.defineProperty(exports, "resolveChargebeeApiVersion", { enumerable: true, get: function () { return TelemetryAdapter_js_1.resolveChargebeeApiVersion; } });
|
|
29
|
+
var sdkTelemetryHeader_js_1 = require("./sdkTelemetryHeader.js");
|
|
30
|
+
Object.defineProperty(exports, "SDK_TELEMETRY_FEATURES_KEY", { enumerable: true, get: function () { return sdkTelemetryHeader_js_1.SDK_TELEMETRY_FEATURES_KEY; } });
|
|
31
|
+
Object.defineProperty(exports, "SDK_TELEMETRY_HEADER_NAME", { enumerable: true, get: function () { return sdkTelemetryHeader_js_1.SDK_TELEMETRY_HEADER_NAME; } });
|
|
32
|
+
Object.defineProperty(exports, "SDK_TELEMETRY_MAX_HEADER_BYTES", { enumerable: true, get: function () { return sdkTelemetryHeader_js_1.SDK_TELEMETRY_MAX_HEADER_BYTES; } });
|
|
33
|
+
var sdkTelemetryFeature_js_1 = require("./sdkTelemetryFeature.js");
|
|
34
|
+
Object.defineProperty(exports, "SdkTelemetryFeature", { enumerable: true, get: function () { return sdkTelemetryFeature_js_1.SdkTelemetryFeature; } });
|
|
35
|
+
var sdkTelemetryState_js_1 = require("./sdkTelemetryState.js");
|
|
36
|
+
Object.defineProperty(exports, "SdkTelemetryState", { enumerable: true, get: function () { return sdkTelemetryState_js_1.SdkTelemetryState; } });
|
|
37
|
+
var sdkTelemetryHeaderBuilder_js_1 = require("./sdkTelemetryHeaderBuilder.js");
|
|
38
|
+
Object.defineProperty(exports, "buildSdkTelemetryHeader", { enumerable: true, get: function () { return sdkTelemetryHeaderBuilder_js_1.buildSdkTelemetryHeader; } });
|
|
39
|
+
var sdkTelemetryEmitter_js_1 = require("./sdkTelemetryEmitter.js");
|
|
40
|
+
Object.defineProperty(exports, "attachSdkTelemetryHeader", { enumerable: true, get: function () { return sdkTelemetryEmitter_js_1.attachSdkTelemetryHeader; } });
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated by Chargebee.
|
|
4
|
+
* For more information on how to make changes to this file, please see the README.
|
|
5
|
+
* Reach out to dx@chargebee.com for any questions.
|
|
6
|
+
* Copyright 2026 Chargebee Inc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.attachSdkTelemetryHeader = attachSdkTelemetryHeader;
|
|
10
|
+
const sdkTelemetryHeaderBuilder_js_1 = require("./sdkTelemetryHeaderBuilder.js");
|
|
11
|
+
const sdkTelemetryFeature_js_1 = require("./sdkTelemetryFeature.js");
|
|
12
|
+
const sdkTelemetryHeader_js_1 = require("./sdkTelemetryHeader.js");
|
|
13
|
+
/**
|
|
14
|
+
* Emits the anonymous SDK telemetry request header, independently of any customer telemetry
|
|
15
|
+
* adapter.
|
|
16
|
+
*
|
|
17
|
+
* On the first API call of a client instance, attaches {@code f;…} with enabled feature codes when
|
|
18
|
+
* any are present; omits the header when none are enabled. Later calls on the same client never
|
|
19
|
+
* attach again. SDK identity is correlated via User-Agent. Every failure path is swallowed and
|
|
20
|
+
* logged at WARNING: telemetry must never fail an API call.
|
|
21
|
+
*/
|
|
22
|
+
function attachSdkTelemetryHeader(env, headers) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (env.sdkTelemetryEnabled === false) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
if (!((_a = env.sdkTelemetryState) === null || _a === void 0 ? void 0 : _a.tryMarkEmitted())) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const headerValue = (0, sdkTelemetryHeaderBuilder_js_1.buildSdkTelemetryHeader)(resolveFeatures(env));
|
|
32
|
+
if (!headerValue) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
headers[sdkTelemetryHeader_js_1.SDK_TELEMETRY_HEADER_NAME] = headerValue;
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
logSuppressed('attach header', err);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Collects enabled feature codes for the current client configuration. */
|
|
42
|
+
function resolveFeatures(env) {
|
|
43
|
+
const features = [];
|
|
44
|
+
if (env.telemetryAdapter !== undefined) {
|
|
45
|
+
features.push(sdkTelemetryFeature_js_1.SdkTelemetryFeature.TELEMETRY_ADAPTER);
|
|
46
|
+
}
|
|
47
|
+
if (env.httpClientIsCustom) {
|
|
48
|
+
features.push(sdkTelemetryFeature_js_1.SdkTelemetryFeature.CUSTOM_TRANSPORT);
|
|
49
|
+
}
|
|
50
|
+
if (isRetryConfigActive(env)) {
|
|
51
|
+
features.push(sdkTelemetryFeature_js_1.SdkTelemetryFeature.RETRY_CONFIG);
|
|
52
|
+
}
|
|
53
|
+
return features;
|
|
54
|
+
}
|
|
55
|
+
/** Whether retries are enabled on the client. */
|
|
56
|
+
function isRetryConfigActive(env) {
|
|
57
|
+
var _a;
|
|
58
|
+
return ((_a = env.retryConfig) === null || _a === void 0 ? void 0 : _a.enabled) === true;
|
|
59
|
+
}
|
|
60
|
+
/** Logs a suppressed telemetry failure without affecting the API call. */
|
|
61
|
+
function logSuppressed(step, err) {
|
|
62
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
63
|
+
console.warn(`SDK telemetry could not ${step} (${message}); API call unaffected.`, err);
|
|
64
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated by Chargebee.
|
|
4
|
+
* For more information on how to make changes to this file, please see the README.
|
|
5
|
+
* Reach out to dx@chargebee.com for any questions.
|
|
6
|
+
* Copyright 2026 Chargebee Inc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SdkTelemetryFeature = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* SDK configuration features reported under the {@code f} segment of
|
|
12
|
+
* {@link SDK_TELEMETRY_HEADER_NAME}. Wire codes are maintained in sdk-generator.
|
|
13
|
+
*/
|
|
14
|
+
var SdkTelemetryFeature;
|
|
15
|
+
(function (SdkTelemetryFeature) {
|
|
16
|
+
/** Customer TelemetryAdapter configured. */
|
|
17
|
+
SdkTelemetryFeature["TELEMETRY_ADAPTER"] = "ta";
|
|
18
|
+
/** Custom HTTP client configured. */
|
|
19
|
+
SdkTelemetryFeature["CUSTOM_TRANSPORT"] = "ct";
|
|
20
|
+
/** Retries enabled on the client. */
|
|
21
|
+
SdkTelemetryFeature["RETRY_CONFIG"] = "rc";
|
|
22
|
+
})(SdkTelemetryFeature || (exports.SdkTelemetryFeature = SdkTelemetryFeature = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated by Chargebee.
|
|
4
|
+
* For more information on how to make changes to this file, please see the README.
|
|
5
|
+
* Reach out to dx@chargebee.com for any questions.
|
|
6
|
+
* Copyright 2026 Chargebee Inc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SDK_TELEMETRY_FEATURES_KEY = exports.SDK_TELEMETRY_MAX_HEADER_BYTES = exports.SDK_TELEMETRY_HEADER_NAME = void 0;
|
|
10
|
+
/** Constants for the anonymous SDK telemetry request header. */
|
|
11
|
+
exports.SDK_TELEMETRY_HEADER_NAME = 'x-chargebee-sdk-telemetry';
|
|
12
|
+
/** Defensive size cap; feature-only values are tiny. */
|
|
13
|
+
exports.SDK_TELEMETRY_MAX_HEADER_BYTES = 4096;
|
|
14
|
+
/** RFC 9651 sf-list item name for the features segment. */
|
|
15
|
+
exports.SDK_TELEMETRY_FEATURES_KEY = 'f';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated by Chargebee.
|
|
4
|
+
* For more information on how to make changes to this file, please see the README.
|
|
5
|
+
* Reach out to dx@chargebee.com for any questions.
|
|
6
|
+
* Copyright 2026 Chargebee Inc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.buildSdkTelemetryHeader = buildSdkTelemetryHeader;
|
|
10
|
+
const sdkTelemetryHeader_js_1 = require("./sdkTelemetryHeader.js");
|
|
11
|
+
/**
|
|
12
|
+
* Builds RFC 9651 values for {@link SDK_TELEMETRY_HEADER_NAME}: a features segment keyed by
|
|
13
|
+
* {@link SDK_TELEMETRY_FEATURES_KEY} with enabled feature codes as boolean params
|
|
14
|
+
* (for example {@code f;ta;rc}). Correlate SDK identity via User-Agent.
|
|
15
|
+
*/
|
|
16
|
+
function buildSdkTelemetryHeader(features) {
|
|
17
|
+
if (!features || features.length === 0) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
let value = sdkTelemetryHeader_js_1.SDK_TELEMETRY_FEATURES_KEY;
|
|
21
|
+
for (const feature of features) {
|
|
22
|
+
if (feature == null) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
value += `;${feature}`;
|
|
26
|
+
}
|
|
27
|
+
if (value.length === sdkTelemetryHeader_js_1.SDK_TELEMETRY_FEATURES_KEY.length) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (new TextEncoder().encode(value).length > sdkTelemetryHeader_js_1.SDK_TELEMETRY_MAX_HEADER_BYTES) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated by Chargebee.
|
|
4
|
+
* For more information on how to make changes to this file, please see the README.
|
|
5
|
+
* Reach out to dx@chargebee.com for any questions.
|
|
6
|
+
* Copyright 2026 Chargebee Inc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SdkTelemetryState = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Per-client gate so the SDK telemetry header is considered at most once per client instance.
|
|
12
|
+
*/
|
|
13
|
+
class SdkTelemetryState {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.emitted = false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Claims the single emission slot for this client. Returns true only for the first caller.
|
|
19
|
+
*/
|
|
20
|
+
tryMarkEmitted() {
|
|
21
|
+
if (this.emitted) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
this.emitted = true;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/** Whether this client has already considered emitting the telemetry header. */
|
|
28
|
+
hasEmitted() {
|
|
29
|
+
return this.emitted;
|
|
30
|
+
}
|
|
31
|
+
/** Clears the emission gate (tests only). */
|
|
32
|
+
clear() {
|
|
33
|
+
this.emitted = false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.SdkTelemetryState = SdkTelemetryState;
|
package/esm/RequestWrapper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extend, callbackifyPromise, getApiURL, encodeListParams, encodeParams, serialize, getHost, log, generateUUIDv4 as uuidv4, } from './util.js';
|
|
2
|
-
import { buildRequestTelemetryContext, buildRequestTelemetryResult, extractHttpStatusCode, extractRequestTelemetryError, resolveChargebeeApiVersion, } from './telemetry/index.js';
|
|
2
|
+
import { buildRequestTelemetryContext, buildRequestTelemetryResult, extractHttpStatusCode, extractRequestTelemetryError, resolveChargebeeApiVersion, attachSdkTelemetryHeader, } from './telemetry/index.js';
|
|
3
3
|
import { handleResponse } from './coreCommon.js';
|
|
4
4
|
import { Buffer } from 'node:buffer';
|
|
5
5
|
import { ChargebeeZodValidationError } from './chargebeeZodValidationError.js';
|
|
@@ -65,6 +65,15 @@ export class RequestWrapper {
|
|
|
65
65
|
if (this.envArg.telemetryAdapter !== undefined) {
|
|
66
66
|
_env.telemetryAdapter = this.envArg.telemetryAdapter;
|
|
67
67
|
}
|
|
68
|
+
if (this.envArg.sdkTelemetryState !== undefined) {
|
|
69
|
+
_env.sdkTelemetryState = this.envArg.sdkTelemetryState;
|
|
70
|
+
}
|
|
71
|
+
if (this.envArg.sdkTelemetryEnabled !== undefined) {
|
|
72
|
+
_env.sdkTelemetryEnabled = this.envArg.sdkTelemetryEnabled;
|
|
73
|
+
}
|
|
74
|
+
if (this.envArg.httpClientIsCustom !== undefined) {
|
|
75
|
+
_env.httpClientIsCustom = this.envArg.httpClientIsCustom;
|
|
76
|
+
}
|
|
68
77
|
const env = _env;
|
|
69
78
|
const retryConfig = Object.assign({ enabled: false, maxRetries: 3, delayMs: 200, retryOn: [500, 502, 503, 504] }, env.retryConfig);
|
|
70
79
|
const urlIdParam = this.apiCall.hasIdInUrl ? this.args[0] : null;
|
|
@@ -139,6 +148,7 @@ export class RequestWrapper {
|
|
|
139
148
|
: encodeParams(requestParams, undefined, undefined, undefined, jsonKeys);
|
|
140
149
|
}
|
|
141
150
|
const requestHeaders = Object.assign(Object.assign({}, this.httpHeaders), telemetryHeaders);
|
|
151
|
+
attachSdkTelemetryHeader(env, requestHeaders);
|
|
142
152
|
const contentType = this.apiCall.isJsonRequest
|
|
143
153
|
? 'application/json;charset=UTF-8'
|
|
144
154
|
: 'application/x-www-form-urlencoded; charset=utf-8';
|
|
@@ -261,9 +271,10 @@ export class RequestWrapper {
|
|
|
261
271
|
throw err;
|
|
262
272
|
}
|
|
263
273
|
};
|
|
264
|
-
const
|
|
274
|
+
const executeCall = () => telemetryAdapter !== undefined
|
|
265
275
|
? runWithTelemetry(telemetryAdapter)
|
|
266
276
|
: withRetry(0, requestStartTime);
|
|
277
|
+
const promise = executeCall();
|
|
267
278
|
return callbackifyPromise(promise);
|
|
268
279
|
}
|
|
269
280
|
_createHeaders(httpHeaders) {
|