chargebee 3.24.0 → 3.25.0-beta.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.
Files changed (147) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +39 -0
  3. package/cjs/RequestWrapper.js +27 -0
  4. package/cjs/chargebee.cjs.js +3 -0
  5. package/cjs/chargebee.cjs.worker.js +2 -0
  6. package/cjs/chargebeeZodValidationError.js +18 -0
  7. package/cjs/createChargebee.js +5 -0
  8. package/cjs/environment.js +1 -1
  9. package/cjs/schema/addon.schema.js +153 -0
  10. package/cjs/schema/address.schema.js +35 -0
  11. package/cjs/schema/alert.schema.js +38 -0
  12. package/cjs/schema/attached_item.schema.js +58 -0
  13. package/cjs/schema/business_entity.schema.js +46 -0
  14. package/cjs/schema/card.schema.js +165 -0
  15. package/cjs/schema/comment.schema.js +69 -0
  16. package/cjs/schema/coupon.schema.js +209 -0
  17. package/cjs/schema/coupon_code.schema.js +14 -0
  18. package/cjs/schema/coupon_set.schema.js +28 -0
  19. package/cjs/schema/credit_note.schema.js +288 -0
  20. package/cjs/schema/currency.schema.js +32 -0
  21. package/cjs/schema/customer.schema.js +986 -0
  22. package/cjs/schema/customer_entitlement.schema.js +14 -0
  23. package/cjs/schema/differential_price.schema.js +68 -0
  24. package/cjs/schema/entitlement.schema.js +27 -0
  25. package/cjs/schema/entitlement_override.schema.js +33 -0
  26. package/cjs/schema/estimate.schema.js +1525 -0
  27. package/cjs/schema/export.schema.js +1545 -0
  28. package/cjs/schema/feature.schema.js +37 -0
  29. package/cjs/schema/gift.schema.js +277 -0
  30. package/cjs/schema/hosted_page.schema.js +1649 -0
  31. package/cjs/schema/in_app_subscription.schema.js +68 -0
  32. package/cjs/schema/index.js +80 -0
  33. package/cjs/schema/invoice.schema.js +1467 -0
  34. package/cjs/schema/item.schema.js +91 -0
  35. package/cjs/schema/item_entitlement.schema.js +45 -0
  36. package/cjs/schema/item_family.schema.js +21 -0
  37. package/cjs/schema/item_price.schema.js +190 -0
  38. package/cjs/schema/non_subscription.schema.js +28 -0
  39. package/cjs/schema/offer_event.schema.js +13 -0
  40. package/cjs/schema/offer_fulfillment.schema.js +20 -0
  41. package/cjs/schema/omnichannel_one_time_order.schema.js +26 -0
  42. package/cjs/schema/omnichannel_subscription.schema.js +89 -0
  43. package/cjs/schema/omnichannel_subscription_item.schema.js +13 -0
  44. package/cjs/schema/order.schema.js +273 -0
  45. package/cjs/schema/payment_intent.schema.js +117 -0
  46. package/cjs/schema/payment_schedule_scheme.schema.js +20 -0
  47. package/cjs/schema/payment_source.schema.js +358 -0
  48. package/cjs/schema/payment_voucher.schema.js +57 -0
  49. package/cjs/schema/personalized_offer.schema.js +28 -0
  50. package/cjs/schema/plan.schema.js +225 -0
  51. package/cjs/schema/portal_session.schema.js +22 -0
  52. package/cjs/schema/price_variant.schema.js +36 -0
  53. package/cjs/schema/pricing_page_session.schema.js +135 -0
  54. package/cjs/schema/promotional_credit.schema.js +78 -0
  55. package/cjs/schema/purchase.schema.js +272 -0
  56. package/cjs/schema/quote.schema.js +1557 -0
  57. package/cjs/schema/ramp.schema.js +209 -0
  58. package/cjs/schema/recorded_purchase.schema.js +32 -0
  59. package/cjs/schema/resource_migration.schema.js +14 -0
  60. package/cjs/schema/site_migration_detail.schema.js +81 -0
  61. package/cjs/schema/subscription.schema.js +2993 -0
  62. package/cjs/schema/subscription_entitlement.schema.js +25 -0
  63. package/cjs/schema/time_machine.schema.js +17 -0
  64. package/cjs/schema/transaction.schema.js +70 -0
  65. package/cjs/schema/unbilled_charge.schema.js +113 -0
  66. package/cjs/schema/usage.schema.js +93 -0
  67. package/cjs/schema/usage_charge.schema.js +17 -0
  68. package/cjs/schema/usage_event.schema.js +28 -0
  69. package/cjs/schema/usage_file.schema.js +13 -0
  70. package/cjs/schema/usage_summary.schema.js +17 -0
  71. package/cjs/schema/virtual_bank_account.schema.js +43 -0
  72. package/cjs/schema/webhook_endpoint.schema.js +504 -0
  73. package/cjs/validationLoader.js +59 -0
  74. package/esm/RequestWrapper.js +27 -0
  75. package/esm/chargebee.esm.js +2 -0
  76. package/esm/chargebee.esm.worker.js +1 -0
  77. package/esm/chargebeeZodValidationError.js +14 -0
  78. package/esm/createChargebee.js +5 -0
  79. package/esm/environment.js +1 -1
  80. package/esm/schema/addon.schema.js +150 -0
  81. package/esm/schema/address.schema.js +32 -0
  82. package/esm/schema/alert.schema.js +35 -0
  83. package/esm/schema/attached_item.schema.js +55 -0
  84. package/esm/schema/business_entity.schema.js +43 -0
  85. package/esm/schema/card.schema.js +162 -0
  86. package/esm/schema/comment.schema.js +66 -0
  87. package/esm/schema/coupon.schema.js +206 -0
  88. package/esm/schema/coupon_code.schema.js +11 -0
  89. package/esm/schema/coupon_set.schema.js +25 -0
  90. package/esm/schema/credit_note.schema.js +285 -0
  91. package/esm/schema/currency.schema.js +29 -0
  92. package/esm/schema/customer.schema.js +983 -0
  93. package/esm/schema/customer_entitlement.schema.js +11 -0
  94. package/esm/schema/differential_price.schema.js +65 -0
  95. package/esm/schema/entitlement.schema.js +24 -0
  96. package/esm/schema/entitlement_override.schema.js +30 -0
  97. package/esm/schema/estimate.schema.js +1522 -0
  98. package/esm/schema/export.schema.js +1542 -0
  99. package/esm/schema/feature.schema.js +34 -0
  100. package/esm/schema/gift.schema.js +274 -0
  101. package/esm/schema/hosted_page.schema.js +1646 -0
  102. package/esm/schema/in_app_subscription.schema.js +65 -0
  103. package/esm/schema/index.js +64 -0
  104. package/esm/schema/invoice.schema.js +1464 -0
  105. package/esm/schema/item.schema.js +88 -0
  106. package/esm/schema/item_entitlement.schema.js +42 -0
  107. package/esm/schema/item_family.schema.js +18 -0
  108. package/esm/schema/item_price.schema.js +187 -0
  109. package/esm/schema/non_subscription.schema.js +25 -0
  110. package/esm/schema/offer_event.schema.js +10 -0
  111. package/esm/schema/offer_fulfillment.schema.js +17 -0
  112. package/esm/schema/omnichannel_one_time_order.schema.js +23 -0
  113. package/esm/schema/omnichannel_subscription.schema.js +86 -0
  114. package/esm/schema/omnichannel_subscription_item.schema.js +10 -0
  115. package/esm/schema/order.schema.js +270 -0
  116. package/esm/schema/payment_intent.schema.js +114 -0
  117. package/esm/schema/payment_schedule_scheme.schema.js +17 -0
  118. package/esm/schema/payment_source.schema.js +355 -0
  119. package/esm/schema/payment_voucher.schema.js +54 -0
  120. package/esm/schema/personalized_offer.schema.js +25 -0
  121. package/esm/schema/plan.schema.js +222 -0
  122. package/esm/schema/portal_session.schema.js +19 -0
  123. package/esm/schema/price_variant.schema.js +33 -0
  124. package/esm/schema/pricing_page_session.schema.js +132 -0
  125. package/esm/schema/promotional_credit.schema.js +75 -0
  126. package/esm/schema/purchase.schema.js +269 -0
  127. package/esm/schema/quote.schema.js +1554 -0
  128. package/esm/schema/ramp.schema.js +206 -0
  129. package/esm/schema/recorded_purchase.schema.js +29 -0
  130. package/esm/schema/resource_migration.schema.js +11 -0
  131. package/esm/schema/site_migration_detail.schema.js +78 -0
  132. package/esm/schema/subscription.schema.js +2990 -0
  133. package/esm/schema/subscription_entitlement.schema.js +22 -0
  134. package/esm/schema/time_machine.schema.js +14 -0
  135. package/esm/schema/transaction.schema.js +67 -0
  136. package/esm/schema/unbilled_charge.schema.js +110 -0
  137. package/esm/schema/usage.schema.js +90 -0
  138. package/esm/schema/usage_charge.schema.js +14 -0
  139. package/esm/schema/usage_event.schema.js +25 -0
  140. package/esm/schema/usage_file.schema.js +10 -0
  141. package/esm/schema/usage_summary.schema.js +14 -0
  142. package/esm/schema/virtual_bank_account.schema.js +40 -0
  143. package/esm/schema/webhook_endpoint.schema.js +501 -0
  144. package/esm/validationLoader.js +56 -0
  145. package/package.json +4 -1
  146. package/types/core.d.ts +2 -0
  147. package/types/index.d.ts +16 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### v3.25.0-beta.1 (2026-05-14)
2
+ * * *
3
+
4
+ ### Experimental
5
+ - **Zod-backed request validation (beta)** — Enable `enableValidation` on the client to validate outgoing request payloads against generated Zod schemas before each API call; invalid payloads raise `ChargebeeZodValidationError` with the original `ZodError` for inspection.
6
+ - **Runtime dependency** — Added [`zod`](https://www.npmjs.com/package/zod) (v4) as a dependency to support the above.
7
+
8
+
1
9
  ### v3.24.0 (2026-05-04)
2
10
  * * *
3
11
  ### New Resources:
package/README.md CHANGED
@@ -124,6 +124,45 @@ try {
124
124
  }
125
125
  ```
126
126
 
127
+ ### Request parameter validation (Zod)
128
+
129
+ When `enableValidation` is set to `true`, the SDK validates parameters for **every** API request against Zod schemas **before** the HTTP call is made. If you omit the params object on a call, it is validated as `{}`. This is **off by default**. Schemas are included for API actions that support them; actions without a bundled schema behave as usual.
130
+
131
+ ```typescript
132
+ import Chargebee, { ChargebeeZodValidationError } from 'chargebee';
133
+
134
+ const chargebee = new Chargebee({
135
+ site: '{{site}}',
136
+ apiKey: '{{api-key}}',
137
+ enableValidation: true,
138
+ });
139
+
140
+ try {
141
+ await chargebee.customer.create({
142
+ id: 'a'.repeat(100),
143
+ auto_collection: 'invalid',
144
+ });
145
+ } catch (err) {
146
+ if (err instanceof ChargebeeZodValidationError) {
147
+ console.error(err.message);
148
+ console.error(err.actionName);
149
+ console.error(err.zodError.issues);
150
+ } else {
151
+ throw err;
152
+ }
153
+ }
154
+ ```
155
+
156
+ Invalid parameters produce a `ChargebeeZodValidationError`. The error message lists every problem (field path and message). You can also inspect `actionName` (the API action, for example `create`) and `zodError` (Zod’s `ZodError`, including `issues`) for structured handling.
157
+
158
+ **Example message:**
159
+
160
+ ```text
161
+ ChargebeeZodValidationError: [Chargebee] Validation failed for 'create': id: Too big: expected string to have <=50 characters; auto_collection: Invalid option: expected one of "on"|"off"
162
+ ```
163
+
164
+ The same `ChargebeeZodValidationError` shape applies to any action with a schema when parameters are invalid (for example bad filters or limits on `list`).
165
+
127
166
  ### Using filters in the List API
128
167
 
129
168
  For pagination, `offset` is the parameter that is being used. The value used for this parameter must be the value returned for `next_offset` parameter in the previous API call.
@@ -4,6 +4,8 @@ exports.RequestWrapper = void 0;
4
4
  const util_js_1 = require("./util.js");
5
5
  const coreCommon_js_1 = require("./coreCommon.js");
6
6
  const node_buffer_1 = require("node:buffer");
7
+ const chargebeeZodValidationError_js_1 = require("./chargebeeZodValidationError.js");
8
+ const validationLoader_js_1 = require("./validationLoader.js");
7
9
  class RequestWrapper {
8
10
  constructor(args, apiCall, envArg) {
9
11
  this.getRequest = () => {
@@ -23,6 +25,17 @@ class RequestWrapper {
23
25
  }
24
26
  return idParam;
25
27
  }
28
+ /**
29
+ * Validate parameters against the action's Zod schema when enableValidation is true.
30
+ * Query params are validated as `params ?? {}`; body params are validated when `params` is non-null.
31
+ * Throws a descriptive error listing every validation violation.
32
+ */
33
+ static _validateParams(params, schema, actionName) {
34
+ const result = schema.safeParse(params);
35
+ if (!result.success) {
36
+ throw new chargebeeZodValidationError_js_1.ChargebeeZodValidationError(actionName, result.error);
37
+ }
38
+ }
26
39
  static parseRetryAfter(retryAfter) {
27
40
  if (!retryAfter)
28
41
  return null;
@@ -42,6 +55,20 @@ class RequestWrapper {
42
55
  ? this.args[1]
43
56
  : this.args[0];
44
57
  let headers = this.apiCall.hasIdInUrl ? this.args[2] : this.args[1];
58
+ // Lazy-load Zod schema when enableValidation is true
59
+ if (env.enableValidation &&
60
+ this.apiCall.resourceKey &&
61
+ this.apiCall.actionName) {
62
+ const schema = await (0, validationLoader_js_1.getSchema)(this.apiCall.resourceKey, this.apiCall.actionName);
63
+ if (schema) {
64
+ if (this.apiCall.httpMethod === 'GET') {
65
+ RequestWrapper._validateParams(params !== null && params !== void 0 ? params : {}, schema, this.apiCall.methodName);
66
+ }
67
+ else if (params != null) {
68
+ RequestWrapper._validateParams(params, schema, this.apiCall.methodName);
69
+ }
70
+ }
71
+ }
45
72
  Object.assign(this.httpHeaders, headers);
46
73
  if (this.apiCall.httpMethod === 'POST' &&
47
74
  !this.httpHeaders['chargebee-idempotency-key'] &&
@@ -4,6 +4,7 @@ const createChargebee_js_1 = require("./createChargebee.js");
4
4
  const FetchClient_js_1 = require("./net/FetchClient.js");
5
5
  const handler_js_1 = require("./resources/webhook/handler.js");
6
6
  const auth_js_1 = require("./resources/webhook/auth.js");
7
+ const chargebeeZodValidationError_js_1 = require("./chargebeeZodValidationError.js");
7
8
  const httpClient = new FetchClient_js_1.FetchHttpClient();
8
9
  const Chargebee = (0, createChargebee_js_1.CreateChargebee)(httpClient);
9
10
  module.exports = Chargebee;
@@ -18,3 +19,5 @@ module.exports.WebhookError = handler_js_1.WebhookError;
18
19
  module.exports.WebhookAuthenticationError = handler_js_1.WebhookAuthenticationError;
19
20
  module.exports.WebhookPayloadValidationError = handler_js_1.WebhookPayloadValidationError;
20
21
  module.exports.WebhookPayloadParseError = handler_js_1.WebhookPayloadParseError;
22
+ // Export validation error class
23
+ module.exports.ChargebeeZodValidationError = chargebeeZodValidationError_js_1.ChargebeeZodValidationError;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebhookPayloadParseError = exports.WebhookPayloadValidationError = exports.WebhookAuthenticationError = exports.WebhookError = exports.basicAuthValidator = exports.WebhookContentType = exports.WebhookEventType = void 0;
4
4
  const createChargebee_js_1 = require("./createChargebee.js");
5
5
  const FetchClient_js_1 = require("./net/FetchClient.js");
6
+ const chargebeeZodValidationError_js_1 = require("./chargebeeZodValidationError.js");
6
7
  const httpClient = new FetchClient_js_1.FetchHttpClient();
7
8
  const Chargebee = (0, createChargebee_js_1.CreateChargebee)(httpClient);
8
9
  module.exports = Chargebee;
@@ -19,3 +20,4 @@ Object.defineProperty(exports, "WebhookError", { enumerable: true, get: function
19
20
  Object.defineProperty(exports, "WebhookAuthenticationError", { enumerable: true, get: function () { return handler_js_2.WebhookAuthenticationError; } });
20
21
  Object.defineProperty(exports, "WebhookPayloadValidationError", { enumerable: true, get: function () { return handler_js_2.WebhookPayloadValidationError; } });
21
22
  Object.defineProperty(exports, "WebhookPayloadParseError", { enumerable: true, get: function () { return handler_js_2.WebhookPayloadParseError; } });
23
+ module.exports.ChargebeeZodValidationError = chargebeeZodValidationError_js_1.ChargebeeZodValidationError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChargebeeZodValidationError = void 0;
4
+ class ChargebeeZodValidationError extends Error {
5
+ constructor(actionName, zodError) {
6
+ var _a;
7
+ const messages = zodError.issues
8
+ .map((e) => `${e.path.join('.')}: ${e.message}`)
9
+ .join('; ');
10
+ super(`[Chargebee] Validation failed for '${actionName}': ${messages}`);
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ this.name = 'ChargebeeZodValidationError';
13
+ this.actionName = actionName;
14
+ this.zodError = zodError;
15
+ (_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
16
+ }
17
+ }
18
+ exports.ChargebeeZodValidationError = ChargebeeZodValidationError;
@@ -96,6 +96,11 @@ const CreateChargebee = (httpClient) => {
96
96
  jsonKeys: metaArr[7],
97
97
  options: metaArr[8],
98
98
  };
99
+ if (this._env.enableValidation) {
100
+ // Store resource and action for lazy schema loading in RequestWrapper
101
+ apiCall.resourceKey = res;
102
+ apiCall.actionName = metaArr[0];
103
+ }
99
104
  this[res][apiCall.methodName] = this._createApiFunc(apiCall, this._env);
100
105
  }
101
106
  }
@@ -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.24.0',
14
+ clientVersion: 'v3.25.0-beta.1',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ // Generated Zod schemas: Addon
3
+ // Actions: create, update, copy
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CopyAddonBodySchema = exports.UpdateAddonBodySchema = exports.CreateAddonBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //Addon.create
9
+ const CreateAddonMetaDataSchema = zod_1.z.looseObject({});
10
+ const CreateAddonTiersSchema = zod_1.z.object({
11
+ starting_unit: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
12
+ ending_unit: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
13
+ price: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
14
+ starting_unit_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
15
+ ending_unit_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
16
+ price_in_decimal: zod_1.z.array(zod_1.z.string().max(39).optional()).optional(),
17
+ });
18
+ const CreateAddonTaxProvidersFieldsSchema = zod_1.z.object({
19
+ provider_name: zod_1.z.array(zod_1.z.string().max(50).optional()),
20
+ field_id: zod_1.z.array(zod_1.z.string().max(50).optional()),
21
+ field_value: zod_1.z.array(zod_1.z.string().max(50).optional()),
22
+ });
23
+ const CreateAddonBodySchema = zod_1.z.looseObject({
24
+ id: zod_1.z.string().max(100),
25
+ name: zod_1.z.string().max(100),
26
+ invoice_name: zod_1.z.string().max(100).optional(),
27
+ description: zod_1.z.string().max(2000).optional(),
28
+ charge_type: zod_1.z.enum(['recurring', 'non_recurring']),
29
+ price: zod_1.z.number().int().min(0).optional(),
30
+ currency_code: zod_1.z.string().max(3).optional(),
31
+ period: zod_1.z.number().int().min(1).optional(),
32
+ period_unit: zod_1.z
33
+ .enum(['day', 'week', 'month', 'year', 'not_applicable'])
34
+ .optional(),
35
+ pricing_model: zod_1.z
36
+ .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
37
+ .optional(),
38
+ type: zod_1.z
39
+ .enum(['on_off', 'quantity', 'tiered', 'volume', 'stairstep'])
40
+ .optional(),
41
+ unit: zod_1.z.string().max(30).optional(),
42
+ enabled_in_portal: zod_1.z.boolean().default(true).optional(),
43
+ taxable: zod_1.z.boolean().default(true).optional(),
44
+ tax_profile_id: zod_1.z.string().max(50).optional(),
45
+ avalara_sale_type: zod_1.z
46
+ .enum(['wholesale', 'retail', 'consumed', 'vendor_use'])
47
+ .optional(),
48
+ avalara_transaction_type: zod_1.z.number().int().optional(),
49
+ avalara_service_type: zod_1.z.number().int().optional(),
50
+ tax_code: zod_1.z.string().max(50).optional(),
51
+ hsn_code: zod_1.z.string().max(50).optional(),
52
+ taxjar_product_code: zod_1.z.string().max(50).optional(),
53
+ invoice_notes: zod_1.z.string().max(2000).optional(),
54
+ meta_data: CreateAddonMetaDataSchema.optional(),
55
+ sku: zod_1.z.string().max(100).optional(),
56
+ accounting_code: zod_1.z.string().max(100).optional(),
57
+ accounting_category1: zod_1.z.string().max(100).optional(),
58
+ accounting_category2: zod_1.z.string().max(100).optional(),
59
+ accounting_category3: zod_1.z.string().max(100).optional(),
60
+ accounting_category4: zod_1.z.string().max(100).optional(),
61
+ is_shippable: zod_1.z.boolean().default(false).optional(),
62
+ shipping_frequency_period: zod_1.z.number().int().min(1).optional(),
63
+ shipping_frequency_period_unit: zod_1.z
64
+ .enum(['year', 'month', 'week', 'day'])
65
+ .optional(),
66
+ included_in_mrr: zod_1.z.boolean().optional(),
67
+ show_description_in_invoices: zod_1.z.boolean().default(false).optional(),
68
+ show_description_in_quotes: zod_1.z.boolean().default(false).optional(),
69
+ price_in_decimal: zod_1.z.string().max(39).optional(),
70
+ proration_type: zod_1.z
71
+ .enum(['site_default', 'partial_term', 'full_term'])
72
+ .optional(),
73
+ status: zod_1.z.enum(['active', 'archived']).optional(),
74
+ tiers: CreateAddonTiersSchema.optional(),
75
+ tax_providers_fields: CreateAddonTaxProvidersFieldsSchema.optional(),
76
+ });
77
+ exports.CreateAddonBodySchema = CreateAddonBodySchema;
78
+ //Addon.update
79
+ const UpdateAddonMetaDataSchema = zod_1.z.looseObject({});
80
+ const UpdateAddonTiersSchema = zod_1.z.object({
81
+ starting_unit: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
82
+ ending_unit: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
83
+ price: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
84
+ starting_unit_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
85
+ ending_unit_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
86
+ price_in_decimal: zod_1.z.array(zod_1.z.string().max(39).optional()).optional(),
87
+ });
88
+ const UpdateAddonTaxProvidersFieldsSchema = zod_1.z.object({
89
+ provider_name: zod_1.z.array(zod_1.z.string().max(50).optional()),
90
+ field_id: zod_1.z.array(zod_1.z.string().max(50).optional()),
91
+ field_value: zod_1.z.array(zod_1.z.string().max(50).optional()),
92
+ });
93
+ const UpdateAddonBodySchema = zod_1.z.looseObject({
94
+ name: zod_1.z.string().max(100).optional(),
95
+ invoice_name: zod_1.z.string().max(100).optional(),
96
+ description: zod_1.z.string().max(2000).optional(),
97
+ charge_type: zod_1.z.enum(['recurring', 'non_recurring']).optional(),
98
+ price: zod_1.z.number().int().min(0).optional(),
99
+ currency_code: zod_1.z.string().max(3).optional(),
100
+ period: zod_1.z.number().int().min(1).optional(),
101
+ period_unit: zod_1.z
102
+ .enum(['day', 'week', 'month', 'year', 'not_applicable'])
103
+ .optional(),
104
+ pricing_model: zod_1.z
105
+ .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
106
+ .optional(),
107
+ type: zod_1.z
108
+ .enum(['on_off', 'quantity', 'tiered', 'volume', 'stairstep'])
109
+ .optional(),
110
+ unit: zod_1.z.string().max(30).optional(),
111
+ enabled_in_portal: zod_1.z.boolean().default(true).optional(),
112
+ taxable: zod_1.z.boolean().default(true).optional(),
113
+ tax_profile_id: zod_1.z.string().max(50).optional(),
114
+ avalara_sale_type: zod_1.z
115
+ .enum(['wholesale', 'retail', 'consumed', 'vendor_use'])
116
+ .optional(),
117
+ avalara_transaction_type: zod_1.z.number().int().optional(),
118
+ avalara_service_type: zod_1.z.number().int().optional(),
119
+ tax_code: zod_1.z.string().max(50).optional(),
120
+ hsn_code: zod_1.z.string().max(50).optional(),
121
+ taxjar_product_code: zod_1.z.string().max(50).optional(),
122
+ invoice_notes: zod_1.z.string().max(2000).optional(),
123
+ meta_data: UpdateAddonMetaDataSchema.optional(),
124
+ sku: zod_1.z.string().max(100).optional(),
125
+ accounting_code: zod_1.z.string().max(100).optional(),
126
+ accounting_category1: zod_1.z.string().max(100).optional(),
127
+ accounting_category2: zod_1.z.string().max(100).optional(),
128
+ accounting_category3: zod_1.z.string().max(100).optional(),
129
+ accounting_category4: zod_1.z.string().max(100).optional(),
130
+ is_shippable: zod_1.z.boolean().default(false).optional(),
131
+ shipping_frequency_period: zod_1.z.number().int().min(1).optional(),
132
+ shipping_frequency_period_unit: zod_1.z
133
+ .enum(['year', 'month', 'week', 'day'])
134
+ .optional(),
135
+ included_in_mrr: zod_1.z.boolean().optional(),
136
+ show_description_in_invoices: zod_1.z.boolean().default(false).optional(),
137
+ show_description_in_quotes: zod_1.z.boolean().default(false).optional(),
138
+ price_in_decimal: zod_1.z.string().max(39).optional(),
139
+ proration_type: zod_1.z
140
+ .enum(['site_default', 'partial_term', 'full_term'])
141
+ .optional(),
142
+ tiers: UpdateAddonTiersSchema.optional(),
143
+ tax_providers_fields: UpdateAddonTaxProvidersFieldsSchema.optional(),
144
+ });
145
+ exports.UpdateAddonBodySchema = UpdateAddonBodySchema;
146
+ //Addon.copy
147
+ const CopyAddonBodySchema = zod_1.z.looseObject({
148
+ from_site: zod_1.z.string().max(50),
149
+ id_at_from_site: zod_1.z.string().max(100),
150
+ id: zod_1.z.string().max(100).optional(),
151
+ for_site_merging: zod_1.z.boolean().default(false).optional(),
152
+ });
153
+ exports.CopyAddonBodySchema = CopyAddonBodySchema;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // Generated Zod schemas: Address
3
+ // Actions: retrieve, update
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UpdateAddressBodySchema = exports.RetrieveAddressBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //Address.retrieve
9
+ const RetrieveAddressBodySchema = zod_1.z.looseObject({
10
+ subscription_id: zod_1.z.string().max(50),
11
+ label: zod_1.z.string().max(50),
12
+ });
13
+ exports.RetrieveAddressBodySchema = RetrieveAddressBodySchema;
14
+ //Address.update
15
+ const UpdateAddressBodySchema = zod_1.z.looseObject({
16
+ subscription_id: zod_1.z.string().max(50),
17
+ label: zod_1.z.string().max(50),
18
+ first_name: zod_1.z.string().max(150).optional(),
19
+ last_name: zod_1.z.string().max(150).optional(),
20
+ email: zod_1.z.string().email().max(70).optional(),
21
+ company: zod_1.z.string().max(250).optional(),
22
+ phone: zod_1.z.string().max(50).optional(),
23
+ addr: zod_1.z.string().max(150).optional(),
24
+ extended_addr: zod_1.z.string().max(150).optional(),
25
+ extended_addr2: zod_1.z.string().max(150).optional(),
26
+ city: zod_1.z.string().max(50).optional(),
27
+ state_code: zod_1.z.string().max(50).optional(),
28
+ state: zod_1.z.string().max(50).optional(),
29
+ zip: zod_1.z.string().max(20).optional(),
30
+ country: zod_1.z.string().max(50).optional(),
31
+ validation_status: zod_1.z
32
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
33
+ .optional(),
34
+ });
35
+ exports.UpdateAddressBodySchema = UpdateAddressBodySchema;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ // Generated Zod schemas: Alert
3
+ // Actions: create, update
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UpdateAlertBodySchema = exports.CreateAlertBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //Alert.create
9
+ const CreateAlertThresholdSchema = zod_1.z.object({
10
+ mode: zod_1.z.enum(['absolute', 'percentage']),
11
+ value: zod_1.z.number(),
12
+ });
13
+ const CreateAlertFilterConditionsSchema = zod_1.z.object({
14
+ field: zod_1.z.array(zod_1.z.enum(['plan_price_id']).optional()).optional(),
15
+ operator: zod_1.z.array(zod_1.z.enum(['equals', 'not_equals']).optional()).optional(),
16
+ value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
17
+ });
18
+ const CreateAlertBodySchema = zod_1.z.looseObject({
19
+ type: zod_1.z.enum(['usage_exceeded']),
20
+ name: zod_1.z.string().max(50),
21
+ description: zod_1.z.string().max(65000).optional(),
22
+ metered_feature_id: zod_1.z.string().max(50),
23
+ subscription_id: zod_1.z.string().max(50).optional(),
24
+ meta: zod_1.z.string().max(65000).optional(),
25
+ threshold: CreateAlertThresholdSchema.optional(),
26
+ filter_conditions: CreateAlertFilterConditionsSchema.optional(),
27
+ });
28
+ exports.CreateAlertBodySchema = CreateAlertBodySchema;
29
+ //Alert.update
30
+ const UpdateAlertThresholdSchema = zod_1.z.object({
31
+ mode: zod_1.z.enum(['absolute', 'percentage']).optional(),
32
+ value: zod_1.z.number().optional(),
33
+ });
34
+ const UpdateAlertBodySchema = zod_1.z.looseObject({
35
+ status: zod_1.z.enum(['enabled', 'disabled']).optional(),
36
+ threshold: UpdateAlertThresholdSchema.optional(),
37
+ });
38
+ exports.UpdateAlertBodySchema = UpdateAlertBodySchema;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ // Generated Zod schemas: AttachedItem
3
+ // Actions: create, update, retrieve, delete
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DeleteAttachedItemBodySchema = exports.RetrieveAttachedItemBodySchema = exports.UpdateAttachedItemBodySchema = exports.CreateAttachedItemBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //AttachedItem.create
9
+ const CreateAttachedItemBodySchema = zod_1.z.looseObject({
10
+ item_id: zod_1.z.string().max(100),
11
+ type: zod_1.z.enum(['recommended', 'mandatory', 'optional']).optional(),
12
+ billing_cycles: zod_1.z.number().int().min(1).optional(),
13
+ quantity: zod_1.z.number().int().min(1).optional(),
14
+ quantity_in_decimal: zod_1.z.string().max(33).optional(),
15
+ charge_on_event: zod_1.z
16
+ .enum([
17
+ 'subscription_creation',
18
+ 'subscription_trial_start',
19
+ 'plan_activation',
20
+ 'subscription_activation',
21
+ 'contract_termination',
22
+ 'on_demand',
23
+ ])
24
+ .optional(),
25
+ charge_once: zod_1.z.boolean().optional(),
26
+ business_entity_id: zod_1.z.string().max(50).optional(),
27
+ });
28
+ exports.CreateAttachedItemBodySchema = CreateAttachedItemBodySchema;
29
+ //AttachedItem.update
30
+ const UpdateAttachedItemBodySchema = zod_1.z.looseObject({
31
+ parent_item_id: zod_1.z.string().max(100),
32
+ type: zod_1.z.enum(['recommended', 'mandatory', 'optional']).optional(),
33
+ billing_cycles: zod_1.z.number().int().min(1).optional(),
34
+ quantity: zod_1.z.number().int().min(1).optional(),
35
+ quantity_in_decimal: zod_1.z.string().max(33).optional(),
36
+ charge_on_event: zod_1.z
37
+ .enum([
38
+ 'subscription_creation',
39
+ 'subscription_trial_start',
40
+ 'plan_activation',
41
+ 'subscription_activation',
42
+ 'contract_termination',
43
+ 'on_demand',
44
+ ])
45
+ .optional(),
46
+ charge_once: zod_1.z.boolean().optional(),
47
+ });
48
+ exports.UpdateAttachedItemBodySchema = UpdateAttachedItemBodySchema;
49
+ //AttachedItem.retrieve
50
+ const RetrieveAttachedItemBodySchema = zod_1.z.looseObject({
51
+ parent_item_id: zod_1.z.string().max(100),
52
+ });
53
+ exports.RetrieveAttachedItemBodySchema = RetrieveAttachedItemBodySchema;
54
+ //AttachedItem.delete
55
+ const DeleteAttachedItemBodySchema = zod_1.z.looseObject({
56
+ parent_item_id: zod_1.z.string().max(100),
57
+ });
58
+ exports.DeleteAttachedItemBodySchema = DeleteAttachedItemBodySchema;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ // Generated Zod schemas: BusinessEntity
3
+ // Actions: createTransfers, getTransfers
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GetTransfersBusinessEntityBodySchema = exports.CreateTransfersBusinessEntityBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //BusinessEntity.createTransfers
9
+ const CreateTransfersBusinessEntityBodySchema = zod_1.z.looseObject({
10
+ active_resource_ids: zod_1.z.array(zod_1.z.string().max(50).optional()),
11
+ destination_business_entity_ids: zod_1.z.array(zod_1.z.string().max(50).optional()),
12
+ source_business_entity_ids: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
13
+ resource_types: zod_1.z.array(zod_1.z.string().max(50).optional()),
14
+ reason_codes: zod_1.z.array(zod_1.z.string().max(50).optional()),
15
+ });
16
+ exports.CreateTransfersBusinessEntityBodySchema = CreateTransfersBusinessEntityBodySchema;
17
+ //BusinessEntity.getTransfers
18
+ const GetTransfersBusinessEntityResourceTypeSchema = zod_1.z.object({
19
+ is: zod_1.z.string().min(1).optional(),
20
+ });
21
+ const GetTransfersBusinessEntityResourceIdSchema = zod_1.z.object({
22
+ is: zod_1.z.string().min(1).optional(),
23
+ });
24
+ const GetTransfersBusinessEntityActiveResourceIdSchema = zod_1.z.object({
25
+ is: zod_1.z.string().min(1).optional(),
26
+ });
27
+ const GetTransfersBusinessEntityCreatedAtSchema = zod_1.z.object({
28
+ after: zod_1.z.string().regex(RegExp('^d{10}$')).optional(),
29
+ before: zod_1.z.string().regex(RegExp('^d{10}$')).optional(),
30
+ on: zod_1.z.string().regex(RegExp('^d{10}$')).optional(),
31
+ between: zod_1.z.string().regex(RegExp('^[d{10},d{10}]$')).optional(),
32
+ });
33
+ const GetTransfersBusinessEntitySortBySchema = zod_1.z.looseObject({
34
+ asc: zod_1.z.enum(['created_at']).optional(),
35
+ desc: zod_1.z.enum(['created_at']).optional(),
36
+ });
37
+ const GetTransfersBusinessEntityBodySchema = zod_1.z.looseObject({
38
+ limit: zod_1.z.number().int().min(1).max(100).optional(),
39
+ offset: zod_1.z.string().max(1000).optional(),
40
+ resource_type: GetTransfersBusinessEntityResourceTypeSchema.optional(),
41
+ resource_id: GetTransfersBusinessEntityResourceIdSchema.optional(),
42
+ active_resource_id: GetTransfersBusinessEntityActiveResourceIdSchema.optional(),
43
+ created_at: GetTransfersBusinessEntityCreatedAtSchema.optional(),
44
+ sort_by: GetTransfersBusinessEntitySortBySchema.optional(),
45
+ });
46
+ exports.GetTransfersBusinessEntityBodySchema = GetTransfersBusinessEntityBodySchema;