@flexprice/sdk 2.1.34 → 2.1.35
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/create-customer-request.md +1 -0
- package/docs/sdk/models/create-subscription-request.md +1 -0
- package/docs/sdk/models/customer-response.md +1 -0
- package/docs/sdk/models/customer.md +1 -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/update-customer-request.md +1 -0
- 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/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/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/create-customer-request.d.ts +5 -0
- package/esm/sdk/models/create-customer-request.d.ts.map +1 -1
- package/esm/sdk/models/create-customer-request.js +2 -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-response.d.ts +4 -0
- package/esm/sdk/models/customer-response.d.ts.map +1 -1
- package/esm/sdk/models/customer-response.js +2 -0
- package/esm/sdk/models/customer-response.js.map +1 -1
- package/esm/sdk/models/customer.d.ts +4 -0
- package/esm/sdk/models/customer.d.ts.map +1 -1
- package/esm/sdk/models/customer.js +2 -0
- package/esm/sdk/models/customer.js.map +1 -1
- 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 +5 -0
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +5 -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/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/update-customer-request.d.ts +5 -0
- package/esm/sdk/models/update-customer-request.d.ts.map +1 -1
- package/esm/sdk/models/update-customer-request.js +2 -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/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/address.ts +0 -35
- package/src/sdk/models/create-customer-request.ts +7 -0
- package/src/sdk/models/create-subscription-request.ts +15 -0
- package/src/sdk/models/customer-response.ts +6 -0
- package/src/sdk/models/customer.ts +6 -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 +5 -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/tenant-billing-details.ts +1 -38
- package/src/sdk/models/update-customer-request.ts +7 -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/types/smart-union.ts +17 -8
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
CustomCurrencyLineItem,
|
|
16
16
|
CustomCurrencyLineItem$inboundSchema,
|
|
17
17
|
} from "./custom-currency-line-item.js";
|
|
18
|
+
import { FxConversion, FxConversion$inboundSchema } from "./fx-conversion.js";
|
|
18
19
|
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
19
20
|
import {
|
|
20
21
|
SourceUsageItem,
|
|
@@ -45,6 +46,7 @@ export type InvoiceLineItemResponse = {
|
|
|
45
46
|
entityId?: string | undefined;
|
|
46
47
|
entityType?: string | undefined;
|
|
47
48
|
environmentId?: string | undefined;
|
|
49
|
+
fxConversion?: FxConversion | undefined;
|
|
48
50
|
id?: string | undefined;
|
|
49
51
|
invoiceId?: string | undefined;
|
|
50
52
|
/**
|
|
@@ -115,6 +117,7 @@ export const InvoiceLineItemResponse$inboundSchema: z.ZodMiniType<
|
|
|
115
117
|
entity_id: types.optional(types.string()),
|
|
116
118
|
entity_type: types.optional(types.string()),
|
|
117
119
|
environment_id: types.optional(types.string()),
|
|
120
|
+
fx_conversion: types.optional(FxConversion$inboundSchema),
|
|
118
121
|
id: types.optional(types.string()),
|
|
119
122
|
invoice_id: types.optional(types.string()),
|
|
120
123
|
invoice_level_discount: types.optional(types.string()),
|
|
@@ -154,6 +157,7 @@ export const InvoiceLineItemResponse$inboundSchema: z.ZodMiniType<
|
|
|
154
157
|
"entity_id": "entityId",
|
|
155
158
|
"entity_type": "entityType",
|
|
156
159
|
"environment_id": "environmentId",
|
|
160
|
+
"fx_conversion": "fxConversion",
|
|
157
161
|
"invoice_id": "invoiceId",
|
|
158
162
|
"invoice_level_discount": "invoiceLevelDiscount",
|
|
159
163
|
"line_item_discount": "lineItemDiscount",
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
CustomerResponse,
|
|
24
24
|
CustomerResponse$inboundSchema,
|
|
25
25
|
} from "./customer-response.js";
|
|
26
|
+
import { FxConversion, FxConversion$inboundSchema } from "./fx-conversion.js";
|
|
26
27
|
import {
|
|
27
28
|
InvoiceLineItemResponse,
|
|
28
29
|
InvoiceLineItemResponse$inboundSchema,
|
|
@@ -124,6 +125,7 @@ export type InvoiceResponse = {
|
|
|
124
125
|
* finalized_at is the timestamp when this invoice was finalized and made ready for payment
|
|
125
126
|
*/
|
|
126
127
|
finalizedAt?: Date | undefined;
|
|
128
|
+
fxConversion?: FxConversion | undefined;
|
|
127
129
|
/**
|
|
128
130
|
* id is the unique identifier for this invoice
|
|
129
131
|
*/
|
|
@@ -273,6 +275,7 @@ export const InvoiceResponse$inboundSchema: z.ZodMiniType<
|
|
|
273
275
|
due_date: types.optional(types.date()),
|
|
274
276
|
environment_id: types.optional(types.string()),
|
|
275
277
|
finalized_at: types.optional(types.date()),
|
|
278
|
+
fx_conversion: types.optional(FxConversion$inboundSchema),
|
|
276
279
|
id: types.optional(types.string()),
|
|
277
280
|
idempotency_key: types.optional(types.string()),
|
|
278
281
|
invoice_number: types.optional(types.string()),
|
|
@@ -332,6 +335,7 @@ export const InvoiceResponse$inboundSchema: z.ZodMiniType<
|
|
|
332
335
|
"due_date": "dueDate",
|
|
333
336
|
"environment_id": "environmentId",
|
|
334
337
|
"finalized_at": "finalizedAt",
|
|
338
|
+
"fx_conversion": "fxConversion",
|
|
335
339
|
"idempotency_key": "idempotencyKey",
|
|
336
340
|
"invoice_number": "invoiceNumber",
|
|
337
341
|
"invoice_pdf_url": "invoicePdfUrl",
|
|
@@ -7,12 +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 {
|
|
11
|
-
Address,
|
|
12
|
-
Address$inboundSchema,
|
|
13
|
-
Address$Outbound,
|
|
14
|
-
Address$outboundSchema,
|
|
15
|
-
} from "./address.js";
|
|
10
|
+
import { Address, Address$inboundSchema } from "./address.js";
|
|
16
11
|
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
17
12
|
|
|
18
13
|
export type TenantBillingDetails = {
|
|
@@ -39,39 +34,7 @@ export const TenantBillingDetails$inboundSchema: z.ZodMiniType<
|
|
|
39
34
|
});
|
|
40
35
|
}),
|
|
41
36
|
);
|
|
42
|
-
/** @internal */
|
|
43
|
-
export type TenantBillingDetails$Outbound = {
|
|
44
|
-
address?: Address$Outbound | undefined;
|
|
45
|
-
email?: string | undefined;
|
|
46
|
-
help_email?: string | undefined;
|
|
47
|
-
phone?: string | undefined;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/** @internal */
|
|
51
|
-
export const TenantBillingDetails$outboundSchema: z.ZodMiniType<
|
|
52
|
-
TenantBillingDetails$Outbound,
|
|
53
|
-
TenantBillingDetails
|
|
54
|
-
> = z.pipe(
|
|
55
|
-
z.object({
|
|
56
|
-
address: z.optional(Address$outboundSchema),
|
|
57
|
-
email: z.optional(z.string()),
|
|
58
|
-
helpEmail: z.optional(z.string()),
|
|
59
|
-
phone: z.optional(z.string()),
|
|
60
|
-
}),
|
|
61
|
-
z.transform((v) => {
|
|
62
|
-
return remap$(v, {
|
|
63
|
-
helpEmail: "help_email",
|
|
64
|
-
});
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
37
|
|
|
68
|
-
export function tenantBillingDetailsToJSON(
|
|
69
|
-
tenantBillingDetails: TenantBillingDetails,
|
|
70
|
-
): string {
|
|
71
|
-
return JSON.stringify(
|
|
72
|
-
TenantBillingDetails$outboundSchema.parse(tenantBillingDetails),
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
38
|
export function tenantBillingDetailsFromJSON(
|
|
76
39
|
jsonString: string,
|
|
77
40
|
): SafeParseResult<TenantBillingDetails, SDKValidationError> {
|
|
@@ -39,6 +39,10 @@ export type UpdateCustomerRequest = {
|
|
|
39
39
|
* address_state is the updated state, province, or region name with maximum 100 characters
|
|
40
40
|
*/
|
|
41
41
|
addressState?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* billing_currency updates the invoicing currency; send "" to clear it back to the charge currency
|
|
44
|
+
*/
|
|
45
|
+
billingCurrency?: string | undefined;
|
|
42
46
|
/**
|
|
43
47
|
* contact is the updated contact number for the customer (e.g. phone)
|
|
44
48
|
*/
|
|
@@ -80,6 +84,7 @@ export type UpdateCustomerRequest$Outbound = {
|
|
|
80
84
|
address_line2?: string | undefined;
|
|
81
85
|
address_postal_code?: string | undefined;
|
|
82
86
|
address_state?: string | undefined;
|
|
87
|
+
billing_currency?: string | undefined;
|
|
83
88
|
contact?: string | undefined;
|
|
84
89
|
email?: string | undefined;
|
|
85
90
|
external_id?: string | undefined;
|
|
@@ -104,6 +109,7 @@ export const UpdateCustomerRequest$outboundSchema: z.ZodMiniType<
|
|
|
104
109
|
addressLine2: z.optional(z.string()),
|
|
105
110
|
addressPostalCode: z.optional(z.string()),
|
|
106
111
|
addressState: z.optional(z.string()),
|
|
112
|
+
billingCurrency: z.optional(z.string()),
|
|
107
113
|
contact: z.optional(z.string()),
|
|
108
114
|
email: z.optional(z.string()),
|
|
109
115
|
externalId: z.optional(z.string()),
|
|
@@ -123,6 +129,7 @@ export const UpdateCustomerRequest$outboundSchema: z.ZodMiniType<
|
|
|
123
129
|
addressLine2: "address_line2",
|
|
124
130
|
addressPostalCode: "address_postal_code",
|
|
125
131
|
addressState: "address_state",
|
|
132
|
+
billingCurrency: "billing_currency",
|
|
126
133
|
externalId: "external_id",
|
|
127
134
|
integrationEntityMapping: "integration_entity_mapping",
|
|
128
135
|
taxTreatment: "tax_treatment",
|
|
@@ -60,6 +60,14 @@ export type UpdateSubscriptionLineItemRequest = {
|
|
|
60
60
|
* Metadata for the new line item
|
|
61
61
|
*/
|
|
62
62
|
metadata?: { [k: string]: string } | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* PriceUnitAmount is the amount for a CUSTOM price unit price (FLAT_FEE/PACKAGE billing models)
|
|
65
|
+
*/
|
|
66
|
+
priceUnitAmount?: string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* PriceUnitTiers are the tiers for a CUSTOM price unit price (TIERED billing model)
|
|
69
|
+
*/
|
|
70
|
+
priceUnitTiers?: Array<CreatePriceTier> | undefined;
|
|
63
71
|
tierMode?: BillingTier | undefined;
|
|
64
72
|
/**
|
|
65
73
|
* Tiers determines the pricing tiers for this line item
|
|
@@ -83,6 +91,8 @@ export type UpdateSubscriptionLineItemRequest$Outbound = {
|
|
|
83
91
|
commitment_windowed?: boolean | undefined;
|
|
84
92
|
effective_from?: string | undefined;
|
|
85
93
|
metadata?: { [k: string]: string } | undefined;
|
|
94
|
+
price_unit_amount?: string | undefined;
|
|
95
|
+
price_unit_tiers?: Array<CreatePriceTier$Outbound> | undefined;
|
|
86
96
|
tier_mode?: string | undefined;
|
|
87
97
|
tiers?: Array<CreatePriceTier$Outbound> | undefined;
|
|
88
98
|
transform_quantity?: PriceTransformQuantity$Outbound | undefined;
|
|
@@ -109,6 +119,8 @@ export const UpdateSubscriptionLineItemRequest$outboundSchema: z.ZodMiniType<
|
|
|
109
119
|
commitmentWindowed: z.optional(z.boolean()),
|
|
110
120
|
effectiveFrom: z.optional(z.string()),
|
|
111
121
|
metadata: z.optional(z.record(z.string(), z.string())),
|
|
122
|
+
priceUnitAmount: z.optional(z.string()),
|
|
123
|
+
priceUnitTiers: z.optional(z.array(CreatePriceTier$outboundSchema)),
|
|
112
124
|
tierMode: z.optional(BillingTier$outboundSchema),
|
|
113
125
|
tiers: z.optional(z.array(CreatePriceTier$outboundSchema)),
|
|
114
126
|
transformQuantity: z.optional(PriceTransformQuantity$outboundSchema),
|
|
@@ -126,6 +138,8 @@ export const UpdateSubscriptionLineItemRequest$outboundSchema: z.ZodMiniType<
|
|
|
126
138
|
commitmentType: "commitment_type",
|
|
127
139
|
commitmentWindowed: "commitment_windowed",
|
|
128
140
|
effectiveFrom: "effective_from",
|
|
141
|
+
priceUnitAmount: "price_unit_amount",
|
|
142
|
+
priceUnitTiers: "price_unit_tiers",
|
|
129
143
|
tierMode: "tier_mode",
|
|
130
144
|
transformQuantity: "transform_quantity",
|
|
131
145
|
});
|
|
@@ -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
|
}),
|
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]!;
|