@flexprice/sdk 2.1.34 → 2.1.36
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/README.md +39 -3
- package/docs/sdk/models/add-addon-ref.md +1 -0
- package/docs/sdk/models/add-addon-request.md +1 -0
- package/docs/sdk/models/add-addon-to-subscription-request.md +1 -0
- package/docs/sdk/models/coupon-ref.md +19 -0
- package/docs/sdk/models/create-credit-grant-request.md +1 -0
- package/docs/sdk/models/create-customer-request.md +7 -0
- package/docs/sdk/models/create-scheduled-task-request.md +1 -1
- package/docs/sdk/models/create-subscription-request.md +1 -0
- package/docs/sdk/models/customer-contact-person.md +25 -0
- package/docs/sdk/models/customer-response.md +2 -0
- package/docs/sdk/models/customer.md +2 -0
- package/docs/sdk/models/external-tax-details.md +25 -0
- package/docs/sdk/models/fx-conversion-source.md +18 -0
- package/docs/sdk/models/fx-conversion.md +21 -0
- package/docs/sdk/models/inline-fx-rate.md +17 -0
- package/docs/sdk/models/invoice-line-item-response.md +1 -0
- package/docs/sdk/models/invoice-response.md +1 -0
- package/docs/sdk/models/line-item-change.md +1 -0
- package/docs/sdk/models/modify-subscription-line-item.md +1 -0
- package/docs/sdk/models/scheduled-task-entity-type.md +1 -1
- package/docs/sdk/models/tax-applied-response.md +5 -1
- package/docs/sdk/models/tax-exemption-reason-code.md +2 -2
- package/docs/sdk/models/tax-jurisdiction.md +18 -0
- package/docs/sdk/models/tax-provider.md +17 -0
- package/docs/sdk/models/tax-rate-entity-type.md +1 -1
- package/docs/sdk/models/tax-reversal-mode.md +17 -0
- package/docs/sdk/models/tax-reversal.md +16 -0
- package/docs/sdk/models/tax-transaction-type.md +17 -0
- package/docs/sdk/models/top-up-coupon.md +17 -0
- package/docs/sdk/models/top-up-wallet-request.md +1 -0
- package/docs/sdk/models/update-customer-request-request.md +7 -1
- package/docs/sdk/models/update-customer-request.md +5 -1
- package/docs/sdk/models/update-subscription-line-item-request.md +20 -18
- package/docs/sdk/models/update-tenant-address.md +20 -0
- package/docs/sdk/models/update-tenant-billing-details.md +18 -0
- package/docs/sdk/models/update-tenant-request.md +5 -5
- package/docs/sdk/models/wallet-transaction-response.md +3 -0
- package/docs/sdk/models/wallet-tx-consumption.md +16 -0
- package/docs/sdk/models/wallet-tx-source-type.md +15 -0
- package/docs/sdk/models/webhook-dto-invoice-line-item.md +1 -0
- package/docs/sdk/models/webhook-dto-invoice.md +1 -0
- package/docs/sdk/models/webhook-dto-tax-applied.md +3 -0
- package/docs/sdk/models/webhook-dto-wallet-transaction.md +3 -0
- package/docs/sdks/customers/README.md +8 -2
- package/esm/hooks/auth-headers.d.ts +4 -0
- package/esm/hooks/auth-headers.d.ts.map +1 -0
- package/esm/hooks/auth-headers.js +35 -0
- package/esm/hooks/auth-headers.js.map +1 -0
- package/esm/hooks/registration.d.ts +2 -3
- package/esm/hooks/registration.d.ts.map +1 -1
- package/esm/hooks/registration.js +4 -4
- package/esm/hooks/registration.js.map +1 -1
- package/esm/lib/config.d.ts +7 -3
- package/esm/lib/config.d.ts.map +1 -1
- package/esm/lib/config.js +3 -3
- package/esm/lib/config.js.map +1 -1
- package/esm/sdk/models/add-addon-ref.d.ts +3 -0
- package/esm/sdk/models/add-addon-ref.d.ts.map +1 -1
- package/esm/sdk/models/add-addon-ref.js +2 -0
- package/esm/sdk/models/add-addon-ref.js.map +1 -1
- package/esm/sdk/models/add-addon-request.d.ts +6 -0
- package/esm/sdk/models/add-addon-request.d.ts.map +1 -1
- package/esm/sdk/models/add-addon-request.js +2 -0
- package/esm/sdk/models/add-addon-request.js.map +1 -1
- package/esm/sdk/models/add-addon-to-subscription-request.d.ts +6 -0
- package/esm/sdk/models/add-addon-to-subscription-request.d.ts.map +1 -1
- package/esm/sdk/models/add-addon-to-subscription-request.js +2 -0
- package/esm/sdk/models/add-addon-to-subscription-request.js.map +1 -1
- package/esm/sdk/models/address.d.ts +0 -12
- package/esm/sdk/models/address.d.ts.map +1 -1
- package/esm/sdk/models/address.js +0 -21
- package/esm/sdk/models/address.js.map +1 -1
- package/esm/sdk/models/coupon-ref.d.ts +20 -0
- package/esm/sdk/models/coupon-ref.d.ts.map +1 -0
- package/esm/sdk/models/coupon-ref.js +25 -0
- package/esm/sdk/models/coupon-ref.js.map +1 -0
- package/esm/sdk/models/create-credit-grant-request.d.ts +3 -0
- package/esm/sdk/models/create-credit-grant-request.d.ts.map +1 -1
- package/esm/sdk/models/create-credit-grant-request.js +3 -0
- package/esm/sdk/models/create-credit-grant-request.js.map +1 -1
- package/esm/sdk/models/create-customer-request.d.ts +11 -0
- package/esm/sdk/models/create-customer-request.d.ts.map +1 -1
- package/esm/sdk/models/create-customer-request.js +5 -0
- package/esm/sdk/models/create-customer-request.js.map +1 -1
- package/esm/sdk/models/create-subscription-request.d.ts +9 -0
- package/esm/sdk/models/create-subscription-request.d.ts.map +1 -1
- package/esm/sdk/models/create-subscription-request.js +3 -0
- package/esm/sdk/models/create-subscription-request.js.map +1 -1
- package/esm/sdk/models/customer-contact-person.d.ts +33 -0
- package/esm/sdk/models/customer-contact-person.d.ts.map +1 -0
- package/esm/sdk/models/customer-contact-person.js +50 -0
- package/esm/sdk/models/customer-contact-person.js.map +1 -0
- package/esm/sdk/models/customer-response.d.ts +6 -0
- package/esm/sdk/models/customer-response.d.ts.map +1 -1
- package/esm/sdk/models/customer-response.js +5 -0
- package/esm/sdk/models/customer-response.js.map +1 -1
- package/esm/sdk/models/customer.d.ts +6 -0
- package/esm/sdk/models/customer.d.ts.map +1 -1
- package/esm/sdk/models/customer.js +5 -0
- package/esm/sdk/models/customer.js.map +1 -1
- package/esm/sdk/models/external-tax-details.d.ts +66 -0
- package/esm/sdk/models/external-tax-details.d.ts.map +1 -0
- package/esm/sdk/models/external-tax-details.js +36 -0
- package/esm/sdk/models/external-tax-details.js.map +1 -0
- package/esm/sdk/models/fx-conversion-source.d.ts +13 -0
- package/esm/sdk/models/fx-conversion-source.d.ts.map +1 -0
- package/esm/sdk/models/fx-conversion-source.js +23 -0
- package/esm/sdk/models/fx-conversion-source.js.map +1 -0
- package/esm/sdk/models/fx-conversion.d.ts +33 -0
- package/esm/sdk/models/fx-conversion.d.ts.map +1 -0
- package/esm/sdk/models/fx-conversion.js +30 -0
- package/esm/sdk/models/fx-conversion.js.map +1 -0
- package/esm/sdk/models/index.d.ts +16 -0
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +16 -0
- package/esm/sdk/models/index.js.map +1 -1
- package/esm/sdk/models/inline-fx-rate.d.ts +16 -0
- package/esm/sdk/models/inline-fx-rate.d.ts.map +1 -0
- package/esm/sdk/models/inline-fx-rate.js +20 -0
- package/esm/sdk/models/inline-fx-rate.js.map +1 -0
- package/esm/sdk/models/invoice-line-item-response.d.ts +2 -0
- package/esm/sdk/models/invoice-line-item-response.d.ts.map +1 -1
- package/esm/sdk/models/invoice-line-item-response.js +3 -0
- package/esm/sdk/models/invoice-line-item-response.js.map +1 -1
- package/esm/sdk/models/invoice-response.d.ts +2 -0
- package/esm/sdk/models/invoice-response.d.ts.map +1 -1
- package/esm/sdk/models/invoice-response.js +3 -0
- package/esm/sdk/models/invoice-response.js.map +1 -1
- package/esm/sdk/models/line-item-change.d.ts +6 -0
- package/esm/sdk/models/line-item-change.d.ts.map +1 -1
- package/esm/sdk/models/line-item-change.js +2 -0
- package/esm/sdk/models/line-item-change.js.map +1 -1
- package/esm/sdk/models/modify-subscription-line-item.d.ts +3 -0
- package/esm/sdk/models/modify-subscription-line-item.d.ts.map +1 -1
- package/esm/sdk/models/modify-subscription-line-item.js +2 -0
- package/esm/sdk/models/modify-subscription-line-item.js.map +1 -1
- package/esm/sdk/models/scheduled-task-entity-type.d.ts +1 -0
- package/esm/sdk/models/scheduled-task-entity-type.d.ts.map +1 -1
- package/esm/sdk/models/scheduled-task-entity-type.js +1 -0
- package/esm/sdk/models/scheduled-task-entity-type.js.map +1 -1
- package/esm/sdk/models/tax-applied-response.d.ts +13 -0
- package/esm/sdk/models/tax-applied-response.d.ts.map +1 -1
- package/esm/sdk/models/tax-applied-response.js +10 -0
- package/esm/sdk/models/tax-applied-response.js.map +1 -1
- package/esm/sdk/models/tax-exemption-reason-code.d.ts +4 -0
- package/esm/sdk/models/tax-exemption-reason-code.d.ts.map +1 -1
- package/esm/sdk/models/tax-exemption-reason-code.js +4 -0
- package/esm/sdk/models/tax-exemption-reason-code.js.map +1 -1
- package/esm/sdk/models/tax-jurisdiction.d.ts +13 -0
- package/esm/sdk/models/tax-jurisdiction.d.ts.map +1 -0
- package/esm/sdk/models/tax-jurisdiction.js +22 -0
- package/esm/sdk/models/tax-jurisdiction.js.map +1 -0
- package/esm/sdk/models/tax-provider.d.ts +10 -0
- package/esm/sdk/models/tax-provider.d.ts.map +1 -0
- package/esm/sdk/models/tax-provider.js +11 -0
- package/esm/sdk/models/tax-provider.js.map +1 -0
- package/esm/sdk/models/tax-rate-entity-type.d.ts +1 -0
- package/esm/sdk/models/tax-rate-entity-type.d.ts.map +1 -1
- package/esm/sdk/models/tax-rate-entity-type.js +1 -0
- package/esm/sdk/models/tax-rate-entity-type.js.map +1 -1
- package/esm/sdk/models/tax-reversal-mode.d.ts +10 -0
- package/esm/sdk/models/tax-reversal-mode.d.ts.map +1 -0
- package/esm/sdk/models/tax-reversal-mode.js +11 -0
- package/esm/sdk/models/tax-reversal-mode.js.map +1 -0
- package/esm/sdk/models/tax-reversal.d.ts +12 -0
- package/esm/sdk/models/tax-reversal.d.ts.map +1 -0
- package/esm/sdk/models/tax-reversal.js +22 -0
- package/esm/sdk/models/tax-reversal.js.map +1 -0
- package/esm/sdk/models/tax-transaction-type.d.ts +10 -0
- package/esm/sdk/models/tax-transaction-type.d.ts.map +1 -0
- package/esm/sdk/models/tax-transaction-type.js +11 -0
- package/esm/sdk/models/tax-transaction-type.js.map +1 -0
- package/esm/sdk/models/tenant-billing-details.d.ts +1 -11
- package/esm/sdk/models/tenant-billing-details.d.ts.map +1 -1
- package/esm/sdk/models/tenant-billing-details.js +1 -15
- package/esm/sdk/models/tenant-billing-details.js.map +1 -1
- package/esm/sdk/models/top-up-coupon.d.ts +12 -0
- package/esm/sdk/models/top-up-coupon.d.ts.map +1 -0
- package/esm/sdk/models/top-up-coupon.js +17 -0
- package/esm/sdk/models/top-up-coupon.js.map +1 -0
- package/esm/sdk/models/top-up-wallet-request.d.ts +3 -0
- package/esm/sdk/models/top-up-wallet-request.d.ts.map +1 -1
- package/esm/sdk/models/top-up-wallet-request.js +2 -0
- package/esm/sdk/models/top-up-wallet-request.js.map +1 -1
- package/esm/sdk/models/update-customer-request.d.ts +11 -0
- package/esm/sdk/models/update-customer-request.d.ts.map +1 -1
- package/esm/sdk/models/update-customer-request.js +5 -0
- package/esm/sdk/models/update-customer-request.js.map +1 -1
- package/esm/sdk/models/update-subscription-line-item-request.d.ts +10 -0
- package/esm/sdk/models/update-subscription-line-item-request.d.ts.map +1 -1
- package/esm/sdk/models/update-subscription-line-item-request.js +4 -0
- package/esm/sdk/models/update-subscription-line-item-request.js.map +1 -1
- package/esm/sdk/models/update-tenant-address.d.ts +22 -0
- package/esm/sdk/models/update-tenant-address.d.ts.map +1 -0
- package/esm/sdk/models/update-tenant-address.js +27 -0
- package/esm/sdk/models/update-tenant-address.js.map +1 -0
- package/esm/sdk/models/update-tenant-billing-details.d.ts +19 -0
- package/esm/sdk/models/update-tenant-billing-details.d.ts.map +1 -0
- package/esm/sdk/models/update-tenant-billing-details.js +21 -0
- package/esm/sdk/models/update-tenant-billing-details.js.map +1 -0
- package/esm/sdk/models/update-tenant-request.d.ts +3 -3
- package/esm/sdk/models/update-tenant-request.d.ts.map +1 -1
- package/esm/sdk/models/update-tenant-request.js +2 -2
- package/esm/sdk/models/update-tenant-request.js.map +1 -1
- package/esm/sdk/models/wallet-transaction-response.d.ts +8 -0
- package/esm/sdk/models/wallet-transaction-response.d.ts.map +1 -1
- package/esm/sdk/models/wallet-transaction-response.js +8 -0
- package/esm/sdk/models/wallet-transaction-response.js.map +1 -1
- package/esm/sdk/models/wallet-tx-consumption.d.ts +11 -0
- package/esm/sdk/models/wallet-tx-consumption.d.ts.map +1 -0
- package/esm/sdk/models/wallet-tx-consumption.js +20 -0
- package/esm/sdk/models/wallet-tx-consumption.js.map +1 -0
- package/esm/sdk/models/wallet-tx-source-type.d.ts +9 -0
- package/esm/sdk/models/wallet-tx-source-type.d.ts.map +1 -0
- package/esm/sdk/models/wallet-tx-source-type.js +10 -0
- package/esm/sdk/models/wallet-tx-source-type.js.map +1 -0
- package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts +2 -0
- package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts.map +1 -1
- package/esm/sdk/models/webhook-dto-invoice-line-item.js +3 -0
- package/esm/sdk/models/webhook-dto-invoice-line-item.js.map +1 -1
- package/esm/sdk/models/webhook-dto-invoice.d.ts +2 -0
- package/esm/sdk/models/webhook-dto-invoice.d.ts.map +1 -1
- package/esm/sdk/models/webhook-dto-invoice.js +3 -0
- package/esm/sdk/models/webhook-dto-invoice.js.map +1 -1
- package/esm/sdk/models/webhook-dto-tax-applied.d.ts +6 -0
- package/esm/sdk/models/webhook-dto-tax-applied.d.ts.map +1 -1
- package/esm/sdk/models/webhook-dto-tax-applied.js +8 -0
- package/esm/sdk/models/webhook-dto-tax-applied.js.map +1 -1
- package/esm/sdk/models/webhook-dto-wallet-transaction.d.ts +5 -0
- package/esm/sdk/models/webhook-dto-wallet-transaction.d.ts.map +1 -1
- package/esm/sdk/models/webhook-dto-wallet-transaction.js +8 -0
- package/esm/sdk/models/webhook-dto-wallet-transaction.js.map +1 -1
- package/esm/types/smart-union.d.ts.map +1 -1
- package/esm/types/smart-union.js +13 -8
- package/esm/types/smart-union.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/hooks/auth-headers.ts +47 -0
- package/src/hooks/registration.ts +4 -4
- package/src/lib/config.ts +7 -3
- package/src/sdk/models/add-addon-ref.ts +8 -0
- package/src/sdk/models/add-addon-request.ts +11 -0
- package/src/sdk/models/add-addon-to-subscription-request.ts +11 -0
- package/src/sdk/models/address.ts +0 -35
- package/src/sdk/models/coupon-ref.ts +50 -0
- package/src/sdk/models/create-credit-grant-request.ts +8 -0
- package/src/sdk/models/create-customer-request.ts +19 -0
- package/src/sdk/models/create-subscription-request.ts +15 -0
- package/src/sdk/models/customer-contact-person.ts +101 -0
- package/src/sdk/models/customer-response.ts +15 -0
- package/src/sdk/models/customer.ts +15 -0
- package/src/sdk/models/external-tax-details.ts +113 -0
- package/src/sdk/models/fx-conversion-source.ts +46 -0
- package/src/sdk/models/fx-conversion.ts +72 -0
- package/src/sdk/models/index.ts +16 -0
- package/src/sdk/models/inline-fx-rate.ts +41 -0
- package/src/sdk/models/invoice-line-item-response.ts +4 -0
- package/src/sdk/models/invoice-response.ts +4 -0
- package/src/sdk/models/line-item-change.ts +11 -0
- package/src/sdk/models/modify-subscription-line-item.ts +8 -0
- package/src/sdk/models/scheduled-task-entity-type.ts +1 -0
- package/src/sdk/models/tax-applied-response.ts +26 -0
- package/src/sdk/models/tax-exemption-reason-code.ts +4 -0
- package/src/sdk/models/tax-jurisdiction.ts +45 -0
- package/src/sdk/models/tax-provider.ts +17 -0
- package/src/sdk/models/tax-rate-entity-type.ts +1 -0
- package/src/sdk/models/tax-reversal-mode.ts +19 -0
- package/src/sdk/models/tax-reversal.ts +43 -0
- package/src/sdk/models/tax-transaction-type.ts +19 -0
- package/src/sdk/models/tenant-billing-details.ts +1 -38
- package/src/sdk/models/top-up-coupon.ts +34 -0
- package/src/sdk/models/top-up-wallet-request.ts +8 -0
- package/src/sdk/models/update-customer-request.ts +19 -0
- package/src/sdk/models/update-subscription-line-item-request.ts +14 -0
- package/src/sdk/models/update-tenant-address.ts +58 -0
- package/src/sdk/models/update-tenant-billing-details.ts +52 -0
- package/src/sdk/models/update-tenant-request.ts +7 -7
- package/src/sdk/models/wallet-transaction-response.ts +22 -0
- package/src/sdk/models/wallet-tx-consumption.ts +41 -0
- package/src/sdk/models/wallet-tx-source-type.ts +16 -0
- package/src/sdk/models/webhook-dto-invoice-line-item.ts +4 -0
- package/src/sdk/models/webhook-dto-invoice.ts +4 -0
- package/src/sdk/models/webhook-dto-tax-applied.ts +17 -0
- package/src/sdk/models/webhook-dto-wallet-transaction.ts +19 -0
- package/src/types/smart-union.ts +17 -8
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
export type UpdateTenantAddress = {
|
|
9
|
+
addressCity?: string | undefined;
|
|
10
|
+
addressCountry?: string | undefined;
|
|
11
|
+
addressLine1?: string | undefined;
|
|
12
|
+
addressLine2?: string | undefined;
|
|
13
|
+
addressPostalCode?: string | undefined;
|
|
14
|
+
addressState?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export type UpdateTenantAddress$Outbound = {
|
|
19
|
+
address_city?: string | undefined;
|
|
20
|
+
address_country?: string | undefined;
|
|
21
|
+
address_line1?: string | undefined;
|
|
22
|
+
address_line2?: string | undefined;
|
|
23
|
+
address_postal_code?: string | undefined;
|
|
24
|
+
address_state?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const UpdateTenantAddress$outboundSchema: z.ZodMiniType<
|
|
29
|
+
UpdateTenantAddress$Outbound,
|
|
30
|
+
UpdateTenantAddress
|
|
31
|
+
> = z.pipe(
|
|
32
|
+
z.object({
|
|
33
|
+
addressCity: z.optional(z.string()),
|
|
34
|
+
addressCountry: z.optional(z.string()),
|
|
35
|
+
addressLine1: z.optional(z.string()),
|
|
36
|
+
addressLine2: z.optional(z.string()),
|
|
37
|
+
addressPostalCode: z.optional(z.string()),
|
|
38
|
+
addressState: z.optional(z.string()),
|
|
39
|
+
}),
|
|
40
|
+
z.transform((v) => {
|
|
41
|
+
return remap$(v, {
|
|
42
|
+
addressCity: "address_city",
|
|
43
|
+
addressCountry: "address_country",
|
|
44
|
+
addressLine1: "address_line1",
|
|
45
|
+
addressLine2: "address_line2",
|
|
46
|
+
addressPostalCode: "address_postal_code",
|
|
47
|
+
addressState: "address_state",
|
|
48
|
+
});
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export function updateTenantAddressToJSON(
|
|
53
|
+
updateTenantAddress: UpdateTenantAddress,
|
|
54
|
+
): string {
|
|
55
|
+
return JSON.stringify(
|
|
56
|
+
UpdateTenantAddress$outboundSchema.parse(updateTenantAddress),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import {
|
|
8
|
+
UpdateTenantAddress,
|
|
9
|
+
UpdateTenantAddress$Outbound,
|
|
10
|
+
UpdateTenantAddress$outboundSchema,
|
|
11
|
+
} from "./update-tenant-address.js";
|
|
12
|
+
|
|
13
|
+
export type UpdateTenantBillingDetails = {
|
|
14
|
+
address?: UpdateTenantAddress | undefined;
|
|
15
|
+
email?: string | undefined;
|
|
16
|
+
helpEmail?: string | undefined;
|
|
17
|
+
phone?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export type UpdateTenantBillingDetails$Outbound = {
|
|
22
|
+
address?: UpdateTenantAddress$Outbound | undefined;
|
|
23
|
+
email?: string | undefined;
|
|
24
|
+
help_email?: string | undefined;
|
|
25
|
+
phone?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const UpdateTenantBillingDetails$outboundSchema: z.ZodMiniType<
|
|
30
|
+
UpdateTenantBillingDetails$Outbound,
|
|
31
|
+
UpdateTenantBillingDetails
|
|
32
|
+
> = z.pipe(
|
|
33
|
+
z.object({
|
|
34
|
+
address: z.optional(UpdateTenantAddress$outboundSchema),
|
|
35
|
+
email: z.optional(z.string()),
|
|
36
|
+
helpEmail: z.optional(z.string()),
|
|
37
|
+
phone: z.optional(z.string()),
|
|
38
|
+
}),
|
|
39
|
+
z.transform((v) => {
|
|
40
|
+
return remap$(v, {
|
|
41
|
+
helpEmail: "help_email",
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export function updateTenantBillingDetailsToJSON(
|
|
47
|
+
updateTenantBillingDetails: UpdateTenantBillingDetails,
|
|
48
|
+
): string {
|
|
49
|
+
return JSON.stringify(
|
|
50
|
+
UpdateTenantBillingDetails$outboundSchema.parse(updateTenantBillingDetails),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
import * as z from "zod/v4-mini";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./tenant-billing-details.js";
|
|
8
|
+
UpdateTenantBillingDetails,
|
|
9
|
+
UpdateTenantBillingDetails$Outbound,
|
|
10
|
+
UpdateTenantBillingDetails$outboundSchema,
|
|
11
|
+
} from "./update-tenant-billing-details.js";
|
|
12
12
|
|
|
13
13
|
export type UpdateTenantRequest = {
|
|
14
|
-
billingDetails?:
|
|
14
|
+
billingDetails?: UpdateTenantBillingDetails | undefined;
|
|
15
15
|
metadata?: { [k: string]: string } | undefined;
|
|
16
16
|
name?: string | undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
20
20
|
export type UpdateTenantRequest$Outbound = {
|
|
21
|
-
billing_details?:
|
|
21
|
+
billing_details?: UpdateTenantBillingDetails$Outbound | undefined;
|
|
22
22
|
metadata?: { [k: string]: string } | undefined;
|
|
23
23
|
name?: string | undefined;
|
|
24
24
|
};
|
|
@@ -29,7 +29,7 @@ export const UpdateTenantRequest$outboundSchema: z.ZodMiniType<
|
|
|
29
29
|
UpdateTenantRequest
|
|
30
30
|
> = z.pipe(
|
|
31
31
|
z.object({
|
|
32
|
-
billingDetails: z.optional(
|
|
32
|
+
billingDetails: z.optional(UpdateTenantBillingDetails$outboundSchema),
|
|
33
33
|
metadata: z.optional(z.record(z.string(), z.string())),
|
|
34
34
|
name: z.optional(z.string()),
|
|
35
35
|
}),
|
|
@@ -30,13 +30,25 @@ import {
|
|
|
30
30
|
WalletResponse,
|
|
31
31
|
WalletResponse$inboundSchema,
|
|
32
32
|
} from "./wallet-response.js";
|
|
33
|
+
import {
|
|
34
|
+
WalletTxConsumption,
|
|
35
|
+
WalletTxConsumption$inboundSchema,
|
|
36
|
+
} from "./wallet-tx-consumption.js";
|
|
33
37
|
import {
|
|
34
38
|
WalletTxReferenceType,
|
|
35
39
|
WalletTxReferenceType$inboundSchema,
|
|
36
40
|
} from "./wallet-tx-reference-type.js";
|
|
41
|
+
import {
|
|
42
|
+
WalletTxSourceType,
|
|
43
|
+
WalletTxSourceType$inboundSchema,
|
|
44
|
+
} from "./wallet-tx-source-type.js";
|
|
37
45
|
|
|
38
46
|
export type WalletTransactionResponse = {
|
|
39
47
|
amount?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* ConsumptionBreakdown is set on debits: the credits drawn from each credit batch.
|
|
50
|
+
*/
|
|
51
|
+
consumptionBreakdown?: Array<WalletTxConsumption> | undefined;
|
|
40
52
|
/**
|
|
41
53
|
* conversion_rate is the conversion rate for the transaction to the currency
|
|
42
54
|
*/
|
|
@@ -70,6 +82,8 @@ export type WalletTransactionResponse = {
|
|
|
70
82
|
priority?: number | undefined;
|
|
71
83
|
referenceId?: string | undefined;
|
|
72
84
|
referenceType?: WalletTxReferenceType | undefined;
|
|
85
|
+
sourceId?: string | undefined;
|
|
86
|
+
sourceType?: WalletTxSourceType | undefined;
|
|
73
87
|
status?: Status | undefined;
|
|
74
88
|
tenantId?: string | undefined;
|
|
75
89
|
/**
|
|
@@ -92,6 +106,9 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
|
|
|
92
106
|
> = z.pipe(
|
|
93
107
|
z.object({
|
|
94
108
|
amount: types.optional(types.string()),
|
|
109
|
+
consumption_breakdown: types.optional(
|
|
110
|
+
z.array(WalletTxConsumption$inboundSchema),
|
|
111
|
+
),
|
|
95
112
|
conversion_rate: types.optional(types.string()),
|
|
96
113
|
created_at: types.optional(types.date()),
|
|
97
114
|
created_by: types.optional(types.string()),
|
|
@@ -113,6 +130,8 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
|
|
|
113
130
|
priority: types.optional(types.number()),
|
|
114
131
|
reference_id: types.optional(types.string()),
|
|
115
132
|
reference_type: types.optional(WalletTxReferenceType$inboundSchema),
|
|
133
|
+
source_id: types.optional(types.string()),
|
|
134
|
+
source_type: types.optional(WalletTxSourceType$inboundSchema),
|
|
116
135
|
status: types.optional(Status$inboundSchema),
|
|
117
136
|
tenant_id: types.optional(types.string()),
|
|
118
137
|
topup_conversion_rate: types.optional(types.string()),
|
|
@@ -126,6 +145,7 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
|
|
|
126
145
|
}),
|
|
127
146
|
z.transform((v) => {
|
|
128
147
|
return remap$(v, {
|
|
148
|
+
"consumption_breakdown": "consumptionBreakdown",
|
|
129
149
|
"conversion_rate": "conversionRate",
|
|
130
150
|
"created_at": "createdAt",
|
|
131
151
|
"created_by": "createdBy",
|
|
@@ -141,6 +161,8 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
|
|
|
141
161
|
"parent_transaction_id": "parentTransactionId",
|
|
142
162
|
"reference_id": "referenceId",
|
|
143
163
|
"reference_type": "referenceType",
|
|
164
|
+
"source_id": "sourceId",
|
|
165
|
+
"source_type": "sourceType",
|
|
144
166
|
"tenant_id": "tenantId",
|
|
145
167
|
"topup_conversion_rate": "topupConversionRate",
|
|
146
168
|
"transaction_reason": "transactionReason",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
11
|
+
|
|
12
|
+
export type WalletTxConsumption = {
|
|
13
|
+
creditTransactionId?: string | undefined;
|
|
14
|
+
credits?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const WalletTxConsumption$inboundSchema: z.ZodMiniType<
|
|
19
|
+
WalletTxConsumption,
|
|
20
|
+
unknown
|
|
21
|
+
> = z.pipe(
|
|
22
|
+
z.object({
|
|
23
|
+
credit_transaction_id: types.optional(types.string()),
|
|
24
|
+
credits: types.optional(types.string()),
|
|
25
|
+
}),
|
|
26
|
+
z.transform((v) => {
|
|
27
|
+
return remap$(v, {
|
|
28
|
+
"credit_transaction_id": "creditTransactionId",
|
|
29
|
+
});
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export function walletTxConsumptionFromJSON(
|
|
34
|
+
jsonString: string,
|
|
35
|
+
): SafeParseResult<WalletTxConsumption, SDKValidationError> {
|
|
36
|
+
return safeParse(
|
|
37
|
+
jsonString,
|
|
38
|
+
(x) => WalletTxConsumption$inboundSchema.parse(JSON.parse(x)),
|
|
39
|
+
`Failed to parse 'WalletTxConsumption' from JSON`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const WalletTxSourceType = {
|
|
9
|
+
Invoice: "INVOICE",
|
|
10
|
+
} as const;
|
|
11
|
+
export type WalletTxSourceType = ClosedEnum<typeof WalletTxSourceType>;
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const WalletTxSourceType$inboundSchema: z.ZodMiniEnum<
|
|
15
|
+
typeof WalletTxSourceType
|
|
16
|
+
> = z.enum(WalletTxSourceType);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
CommitmentInfo,
|
|
12
12
|
CommitmentInfo$inboundSchema,
|
|
13
13
|
} from "./commitment-info.js";
|
|
14
|
+
import { FxConversion, FxConversion$inboundSchema } from "./fx-conversion.js";
|
|
14
15
|
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
15
16
|
|
|
16
17
|
export type WebhookDtoInvoiceLineItem = {
|
|
@@ -21,6 +22,7 @@ export type WebhookDtoInvoiceLineItem = {
|
|
|
21
22
|
displayName?: string | undefined;
|
|
22
23
|
entityId?: string | undefined;
|
|
23
24
|
entityType?: string | undefined;
|
|
25
|
+
fxConversion?: FxConversion | undefined;
|
|
24
26
|
id?: string | undefined;
|
|
25
27
|
invoiceLevelDiscount?: string | undefined;
|
|
26
28
|
lineItemDiscount?: string | undefined;
|
|
@@ -52,6 +54,7 @@ export const WebhookDtoInvoiceLineItem$inboundSchema: z.ZodMiniType<
|
|
|
52
54
|
display_name: types.optional(types.string()),
|
|
53
55
|
entity_id: types.optional(types.string()),
|
|
54
56
|
entity_type: types.optional(types.string()),
|
|
57
|
+
fx_conversion: types.optional(FxConversion$inboundSchema),
|
|
55
58
|
id: types.optional(types.string()),
|
|
56
59
|
invoice_level_discount: types.optional(types.string()),
|
|
57
60
|
line_item_discount: types.optional(types.string()),
|
|
@@ -76,6 +79,7 @@ export const WebhookDtoInvoiceLineItem$inboundSchema: z.ZodMiniType<
|
|
|
76
79
|
"display_name": "displayName",
|
|
77
80
|
"entity_id": "entityId",
|
|
78
81
|
"entity_type": "entityType",
|
|
82
|
+
"fx_conversion": "fxConversion",
|
|
79
83
|
"invoice_level_discount": "invoiceLevelDiscount",
|
|
80
84
|
"line_item_discount": "lineItemDiscount",
|
|
81
85
|
"meter_display_name": "meterDisplayName",
|
|
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { FxConversion, FxConversion$inboundSchema } from "./fx-conversion.js";
|
|
10
11
|
import {
|
|
11
12
|
InvoiceStatus,
|
|
12
13
|
InvoiceStatus$inboundSchema,
|
|
@@ -55,6 +56,7 @@ export type WebhookDtoInvoice = {
|
|
|
55
56
|
dueDate?: Date | undefined;
|
|
56
57
|
environmentId?: string | undefined;
|
|
57
58
|
finalizedAt?: Date | undefined;
|
|
59
|
+
fxConversion?: FxConversion | undefined;
|
|
58
60
|
id?: string | undefined;
|
|
59
61
|
idempotencyKey?: string | undefined;
|
|
60
62
|
invoiceNumber?: string | undefined;
|
|
@@ -103,6 +105,7 @@ export const WebhookDtoInvoice$inboundSchema: z.ZodMiniType<
|
|
|
103
105
|
due_date: types.optional(types.date()),
|
|
104
106
|
environment_id: types.optional(types.string()),
|
|
105
107
|
finalized_at: types.optional(types.date()),
|
|
108
|
+
fx_conversion: types.optional(FxConversion$inboundSchema),
|
|
106
109
|
id: types.optional(types.string()),
|
|
107
110
|
idempotency_key: types.optional(types.string()),
|
|
108
111
|
invoice_number: types.optional(types.string()),
|
|
@@ -143,6 +146,7 @@ export const WebhookDtoInvoice$inboundSchema: z.ZodMiniType<
|
|
|
143
146
|
"due_date": "dueDate",
|
|
144
147
|
"environment_id": "environmentId",
|
|
145
148
|
"finalized_at": "finalizedAt",
|
|
149
|
+
"fx_conversion": "fxConversion",
|
|
146
150
|
"idempotency_key": "idempotencyKey",
|
|
147
151
|
"invoice_number": "invoiceNumber",
|
|
148
152
|
"invoice_pdf_url": "invoicePdfUrl",
|
|
@@ -7,8 +7,17 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import * as types from "../../types/primitives.js";
|
|
10
|
+
import {
|
|
11
|
+
ExternalTaxDetails,
|
|
12
|
+
ExternalTaxDetails$inboundSchema,
|
|
13
|
+
} from "./external-tax-details.js";
|
|
10
14
|
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
11
15
|
import { TaxBehavior, TaxBehavior$inboundSchema } from "./tax-behavior.js";
|
|
16
|
+
import { TaxProvider, TaxProvider$inboundSchema } from "./tax-provider.js";
|
|
17
|
+
import {
|
|
18
|
+
TaxTransactionType,
|
|
19
|
+
TaxTransactionType$inboundSchema,
|
|
20
|
+
} from "./tax-transaction-type.js";
|
|
12
21
|
import {
|
|
13
22
|
WebhookDtoTaxRate,
|
|
14
23
|
WebhookDtoTaxRate$inboundSchema,
|
|
@@ -17,12 +26,15 @@ import {
|
|
|
17
26
|
export type WebhookDtoTaxApplied = {
|
|
18
27
|
appliedAt?: Date | undefined;
|
|
19
28
|
currency?: string | undefined;
|
|
29
|
+
externalTaxDetails?: ExternalTaxDetails | undefined;
|
|
20
30
|
id?: string | undefined;
|
|
21
31
|
metadata?: { [k: string]: string } | undefined;
|
|
32
|
+
provider?: TaxProvider | undefined;
|
|
22
33
|
taxAmount?: string | undefined;
|
|
23
34
|
taxBehavior?: TaxBehavior | undefined;
|
|
24
35
|
taxRate?: WebhookDtoTaxRate | undefined;
|
|
25
36
|
taxRateId?: string | undefined;
|
|
37
|
+
taxTransactionType?: TaxTransactionType | undefined;
|
|
26
38
|
taxableAmount?: string | undefined;
|
|
27
39
|
};
|
|
28
40
|
|
|
@@ -34,21 +46,26 @@ export const WebhookDtoTaxApplied$inboundSchema: z.ZodMiniType<
|
|
|
34
46
|
z.object({
|
|
35
47
|
applied_at: types.optional(types.date()),
|
|
36
48
|
currency: types.optional(types.string()),
|
|
49
|
+
external_tax_details: types.optional(ExternalTaxDetails$inboundSchema),
|
|
37
50
|
id: types.optional(types.string()),
|
|
38
51
|
metadata: types.optional(z.record(z.string(), types.string())),
|
|
52
|
+
provider: types.optional(TaxProvider$inboundSchema),
|
|
39
53
|
tax_amount: types.optional(types.string()),
|
|
40
54
|
tax_behavior: types.optional(TaxBehavior$inboundSchema),
|
|
41
55
|
tax_rate: types.optional(WebhookDtoTaxRate$inboundSchema),
|
|
42
56
|
tax_rate_id: types.optional(types.string()),
|
|
57
|
+
tax_transaction_type: types.optional(TaxTransactionType$inboundSchema),
|
|
43
58
|
taxable_amount: types.optional(types.string()),
|
|
44
59
|
}),
|
|
45
60
|
z.transform((v) => {
|
|
46
61
|
return remap$(v, {
|
|
47
62
|
"applied_at": "appliedAt",
|
|
63
|
+
"external_tax_details": "externalTaxDetails",
|
|
48
64
|
"tax_amount": "taxAmount",
|
|
49
65
|
"tax_behavior": "taxBehavior",
|
|
50
66
|
"tax_rate": "taxRate",
|
|
51
67
|
"tax_rate_id": "taxRateId",
|
|
68
|
+
"tax_transaction_type": "taxTransactionType",
|
|
52
69
|
"taxable_amount": "taxableAmount",
|
|
53
70
|
});
|
|
54
71
|
}),
|
|
@@ -20,13 +20,22 @@ import {
|
|
|
20
20
|
TransactionType,
|
|
21
21
|
TransactionType$inboundSchema,
|
|
22
22
|
} from "./transaction-type.js";
|
|
23
|
+
import {
|
|
24
|
+
WalletTxConsumption,
|
|
25
|
+
WalletTxConsumption$inboundSchema,
|
|
26
|
+
} from "./wallet-tx-consumption.js";
|
|
23
27
|
import {
|
|
24
28
|
WalletTxReferenceType,
|
|
25
29
|
WalletTxReferenceType$inboundSchema,
|
|
26
30
|
} from "./wallet-tx-reference-type.js";
|
|
31
|
+
import {
|
|
32
|
+
WalletTxSourceType,
|
|
33
|
+
WalletTxSourceType$inboundSchema,
|
|
34
|
+
} from "./wallet-tx-source-type.js";
|
|
27
35
|
|
|
28
36
|
export type WebhookDtoWalletTransaction = {
|
|
29
37
|
amount?: string | undefined;
|
|
38
|
+
consumptionBreakdown?: Array<WalletTxConsumption> | undefined;
|
|
30
39
|
creditAmount?: string | undefined;
|
|
31
40
|
creditBalanceAfter?: string | undefined;
|
|
32
41
|
creditBalanceBefore?: string | undefined;
|
|
@@ -38,6 +47,8 @@ export type WebhookDtoWalletTransaction = {
|
|
|
38
47
|
metadata?: { [k: string]: string } | undefined;
|
|
39
48
|
referenceId?: string | undefined;
|
|
40
49
|
referenceType?: WalletTxReferenceType | undefined;
|
|
50
|
+
sourceId?: string | undefined;
|
|
51
|
+
sourceType?: WalletTxSourceType | undefined;
|
|
41
52
|
transactionReason?: TransactionReason | undefined;
|
|
42
53
|
transactionStatus?: TransactionStatus | undefined;
|
|
43
54
|
type?: TransactionType | undefined;
|
|
@@ -51,6 +62,9 @@ export const WebhookDtoWalletTransaction$inboundSchema: z.ZodMiniType<
|
|
|
51
62
|
> = z.pipe(
|
|
52
63
|
z.object({
|
|
53
64
|
amount: types.optional(types.string()),
|
|
65
|
+
consumption_breakdown: types.optional(
|
|
66
|
+
z.array(WalletTxConsumption$inboundSchema),
|
|
67
|
+
),
|
|
54
68
|
credit_amount: types.optional(types.string()),
|
|
55
69
|
credit_balance_after: types.optional(types.string()),
|
|
56
70
|
credit_balance_before: types.optional(types.string()),
|
|
@@ -62,6 +76,8 @@ export const WebhookDtoWalletTransaction$inboundSchema: z.ZodMiniType<
|
|
|
62
76
|
metadata: types.optional(z.record(z.string(), types.string())),
|
|
63
77
|
reference_id: types.optional(types.string()),
|
|
64
78
|
reference_type: types.optional(WalletTxReferenceType$inboundSchema),
|
|
79
|
+
source_id: types.optional(types.string()),
|
|
80
|
+
source_type: types.optional(WalletTxSourceType$inboundSchema),
|
|
65
81
|
transaction_reason: types.optional(TransactionReason$inboundSchema),
|
|
66
82
|
transaction_status: types.optional(TransactionStatus$inboundSchema),
|
|
67
83
|
type: types.optional(TransactionType$inboundSchema),
|
|
@@ -69,6 +85,7 @@ export const WebhookDtoWalletTransaction$inboundSchema: z.ZodMiniType<
|
|
|
69
85
|
}),
|
|
70
86
|
z.transform((v) => {
|
|
71
87
|
return remap$(v, {
|
|
88
|
+
"consumption_breakdown": "consumptionBreakdown",
|
|
72
89
|
"credit_amount": "creditAmount",
|
|
73
90
|
"credit_balance_after": "creditBalanceAfter",
|
|
74
91
|
"credit_balance_before": "creditBalanceBefore",
|
|
@@ -76,6 +93,8 @@ export const WebhookDtoWalletTransaction$inboundSchema: z.ZodMiniType<
|
|
|
76
93
|
"expiry_date": "expiryDate",
|
|
77
94
|
"reference_id": "referenceId",
|
|
78
95
|
"reference_type": "referenceType",
|
|
96
|
+
"source_id": "sourceId",
|
|
97
|
+
"source_type": "sourceType",
|
|
79
98
|
"transaction_reason": "transactionReason",
|
|
80
99
|
"transaction_status": "transactionStatus",
|
|
81
100
|
"wallet_id": "walletId",
|
package/src/types/smart-union.ts
CHANGED
|
@@ -31,28 +31,33 @@ export function smartUnion<
|
|
|
31
31
|
z.unknown(),
|
|
32
32
|
z.transform((input, ctx) => {
|
|
33
33
|
const candidates: Candidate[] = [];
|
|
34
|
-
const errors: z.core.$
|
|
34
|
+
const errors: z.core.$ZodRawIssue[][] = [];
|
|
35
35
|
|
|
36
36
|
const parentUnrecognizedCtr = startCountingUnrecognized();
|
|
37
37
|
const parentZeroDefaultCtr = startCountingDefaultToZeroValue();
|
|
38
38
|
|
|
39
39
|
// Filter out invalid options
|
|
40
|
-
for (const
|
|
40
|
+
for (const option of options) {
|
|
41
41
|
const unrecognizedCtr = startCountingUnrecognized();
|
|
42
42
|
const zeroDefaultCtr = startCountingDefaultToZeroValue();
|
|
43
|
-
const result = option.
|
|
43
|
+
const result = option._zod.run({ value: input, issues: [] }, {
|
|
44
|
+
async: false,
|
|
45
|
+
});
|
|
46
|
+
if (result instanceof Promise) {
|
|
47
|
+
throw new z.core.$ZodAsyncError();
|
|
48
|
+
}
|
|
44
49
|
const inexactCount = unrecognizedCtr.end();
|
|
45
50
|
const zeroDefaultCount = zeroDefaultCtr.end();
|
|
46
|
-
if (result.
|
|
51
|
+
if (result.issues.length === 0) {
|
|
47
52
|
candidates.push({
|
|
48
|
-
data: result.
|
|
53
|
+
data: result.value,
|
|
49
54
|
inexactCount,
|
|
50
55
|
zeroDefaultCount,
|
|
51
56
|
fieldCount: -1, // We'll count this later if needed
|
|
52
57
|
});
|
|
53
58
|
continue;
|
|
54
59
|
}
|
|
55
|
-
errors
|
|
60
|
+
errors.push(result.issues);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
// No valid options
|
|
@@ -62,9 +67,13 @@ export function smartUnion<
|
|
|
62
67
|
ctx.issues.push({
|
|
63
68
|
input: input,
|
|
64
69
|
code: "invalid_union",
|
|
65
|
-
errors: errors
|
|
70
|
+
errors: errors.map(issues =>
|
|
71
|
+
issues.map(issue =>
|
|
72
|
+
z.core.util.finalizeIssue(issue, {}, z.core.config())
|
|
73
|
+
)
|
|
74
|
+
),
|
|
66
75
|
});
|
|
67
|
-
return
|
|
76
|
+
return undefined;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
let best = candidates[0]!;
|