diff --git a/integration-tests-definitions/json-schemas/address.json b/integration-tests-definitions/json-schemas/address.json new file mode 100644 index 000000000..6a8d62f52 --- /dev/null +++ b/integration-tests-definitions/json-schemas/address.json @@ -0,0 +1,8 @@ +{ + "type": "object", + "properties": { + "street": { "type": "string" }, + "city": { "type": "string" } + }, + "required": ["street", "city"] +} diff --git a/integration-tests-definitions/json-schemas/user.json b/integration-tests-definitions/json-schemas/user.json new file mode 100644 index 000000000..fe11fffbc --- /dev/null +++ b/integration-tests-definitions/json-schemas/user.json @@ -0,0 +1,9 @@ +{ + "type": "object", + "properties": { + "name": { "type": "string" }, + "address": { "$ref": "./address.json" }, + "self": { "$ref": "./user.json" } + }, + "required": ["name"] +} diff --git a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts index 05beefd39..50fe730a6 100644 --- a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts +++ b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts @@ -705,13 +705,13 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), - result: s_Widget.optional(), + error: s_Azure_Core_Foundations_Error.optional(), + result: z.lazy(() => s_Widget.optional()), }), z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ]), ], @@ -963,7 +963,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ], ], @@ -1252,7 +1252,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), result: s_WidgetRepairRequest.optional(), }), ], @@ -1330,7 +1330,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), result: z .object({ requestState: s_WidgetRepairState, @@ -1431,8 +1431,8 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), - result: s_WidgetPart.optional(), + error: s_Azure_Core_Foundations_Error.optional(), + result: z.lazy(() => s_WidgetPart.optional()), }), ], ], @@ -1822,7 +1822,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ], ], @@ -1904,8 +1904,8 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), - result: s_Manufacturer.optional(), + error: s_Azure_Core_Foundations_Error.optional(), + result: z.lazy(() => s_Manufacturer.optional()), }), ], ], @@ -2166,7 +2166,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ], ], diff --git a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts index ca38c6b1d..00f8604d5 100644 --- a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts +++ b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts @@ -4,20 +4,11 @@ import {z} from "zod/v4" import type { - t_Azure_Core_Foundations_Error, - t_Azure_Core_Foundations_ErrorResponse, - t_Azure_Core_Foundations_InnerError, + t_PagedManufacturer, + t_PagedWidget, + t_PagedWidgetPart, } from "./models.ts" -export const s_Azure_Core_Foundations_OperationState = z.union([ - z.enum(["NotStarted", "Running", "Succeeded", "Failed", "Canceled"]), - z.string(), -]) - -export const s_Azure_Core_eTag = z.string() - -export const s_Azure_Core_uuid = z.string() - export const s_WidgetAnalytics = z.object({ id: z.literal("current"), useCount: z.coerce.number(), @@ -41,11 +32,36 @@ export const s_WidgetRepairState = z.union([ z.enum(["Succeeded", "Failed", "Canceled", "SentToManufacturer"]), ]) -export const s_Manufacturer = z.object({ - id: z.string(), - name: z.string(), - address: z.string(), - etag: s_Azure_Core_eTag, +export const s_WidgetCreateOrUpdate = z.object({ + color: s_WidgetColor.optional(), + manufacturerId: z.string().optional(), +}) + +export const s_WidgetRepairRequest = z.object({ + requestState: s_WidgetRepairState, + scheduledDateTime: z.iso.datetime({offset: true}), + createdDateTime: z.iso.datetime({offset: true}), + updatedDateTime: z.iso.datetime({offset: true}), + completedDateTime: z.iso.datetime({offset: true}), +}) + +export const s_Azure_Core_uuid = z.string() + +export const s_Azure_Core_Foundations_ErrorResponse = z.object({ + error: s_Azure_Core_Foundations_Error, +}) + +export const s_Azure_Core_Foundations_OperationState = z.union([ + z.enum(["NotStarted", "Running", "Succeeded", "Failed", "Canceled"]), + z.string(), +]) + +export const s_Azure_Core_Foundations_Error = z.object({ + code: z.string(), + message: z.string(), + target: z.string().optional(), + details: z.array(s_Azure_Core_Foundations_Error).optional(), + innererror: s_Azure_Core_Foundations_InnerError.optional(), }) export const s_Widget = z.object({ @@ -55,9 +71,9 @@ export const s_Widget = z.object({ etag: s_Azure_Core_eTag, }) -export const s_WidgetCreateOrUpdate = z.object({ - color: s_WidgetColor.optional(), - manufacturerId: z.string().optional(), +export const s_PagedWidget: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_Widget)), + nextLink: z.string().optional(), }) export const s_WidgetPart = z.object({ @@ -67,43 +83,26 @@ export const s_WidgetPart = z.object({ etag: s_Azure_Core_eTag, }) -export const s_WidgetRepairRequest = z.object({ - requestState: s_WidgetRepairState, - scheduledDateTime: z.iso.datetime({offset: true}), - createdDateTime: z.iso.datetime({offset: true}), - updatedDateTime: z.iso.datetime({offset: true}), - completedDateTime: z.iso.datetime({offset: true}), +export const s_PagedWidgetPart: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_WidgetPart)), + nextLink: z.string().optional(), }) -export const s_PagedManufacturer = z.object({ - value: z.array(s_Manufacturer), - nextLink: z.string().optional(), +export const s_Manufacturer = z.object({ + id: z.string(), + name: z.string(), + address: z.string(), + etag: s_Azure_Core_eTag, }) -export const s_PagedWidget = z.object({ - value: z.array(s_Widget), +export const s_PagedManufacturer: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_Manufacturer)), nextLink: z.string().optional(), }) -export const s_PagedWidgetPart = z.object({ - value: z.array(s_WidgetPart), - nextLink: z.string().optional(), +export const s_Azure_Core_Foundations_InnerError = z.object({ + code: z.string().optional(), + innererror: s_Azure_Core_Foundations_InnerError.optional(), }) -export const s_Azure_Core_Foundations_ErrorResponse: z.ZodType = - z.object({error: z.lazy(() => s_Azure_Core_Foundations_Error)}) - -export const s_Azure_Core_Foundations_Error: z.ZodType = - z.object({ - code: z.string(), - message: z.string(), - target: z.string().optional(), - details: z.array(z.lazy(() => s_Azure_Core_Foundations_Error)).optional(), - innererror: z.lazy(() => s_Azure_Core_Foundations_InnerError.optional()), - }) - -export const s_Azure_Core_Foundations_InnerError: z.ZodType = - z.object({ - code: z.string().optional(), - innererror: z.lazy(() => s_Azure_Core_Foundations_InnerError.optional()), - }) +export const s_Azure_Core_eTag = z.string() diff --git a/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts index a351031a1..b35b2c991 100644 --- a/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts +++ b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts @@ -3,10 +3,7 @@ /* eslint-disable */ import {z} from "zod/v4" -import type { - t_Azure_ResourceManager_CommonTypes_ErrorDetail, - t_Azure_ResourceManager_CommonTypes_ErrorResponse, -} from "./models.ts" +import type {t_EmployeeListResult} from "./models.ts" export const PermissiveBoolean = z.preprocess((value) => { if (typeof value === "string" && (value === "true" || value === "false")) { @@ -17,38 +14,6 @@ export const PermissiveBoolean = z.preprocess((value) => { return value }, z.boolean()) -export const s_Azure_Core_armResourceType = z.string() - -export const s_Azure_Core_azureLocation = z.string() - -export const s_Azure_Core_uuid = z.string() - -export const s_Azure_ResourceManager_CommonTypes_ActionType = z.union([ - z.literal("Internal"), - z.string(), -]) - -export const s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = z.object( - {type: z.string().optional(), info: z.unknown().optional()}, -) - -export const s_Azure_ResourceManager_CommonTypes_OperationDisplay = z.object({ - provider: z.string().optional(), - resource: z.string().optional(), - operation: z.string().optional(), - description: z.string().optional(), -}) - -export const s_Azure_ResourceManager_CommonTypes_Origin = z.union([ - z.enum(["user", "system", "user,system"]), - z.string(), -]) - -export const s_Azure_ResourceManager_CommonTypes_createdByType = z.union([ - z.enum(["User", "Application", "ManagedIdentity", "Key"]), - z.string(), -]) - export const s_EmployeeUpdateProperties = z.object({ age: z.coerce.number().optional(), city: z.string().optional(), @@ -72,24 +37,6 @@ export const s_ProvisioningState = z.union([ ]), ]) -export const s_Azure_ResourceManager_CommonTypes_Operation = z.object({ - name: z.string().optional(), - isDataAction: PermissiveBoolean.optional(), - display: s_Azure_ResourceManager_CommonTypes_OperationDisplay.optional(), - origin: s_Azure_ResourceManager_CommonTypes_Origin.optional(), - actionType: s_Azure_ResourceManager_CommonTypes_ActionType.optional(), -}) - -export const s_Azure_ResourceManager_CommonTypes_SystemData = z.object({ - createdBy: z.string().optional(), - createdByType: s_Azure_ResourceManager_CommonTypes_createdByType.optional(), - createdAt: z.iso.datetime({offset: true}).optional(), - lastModifiedBy: z.string().optional(), - lastModifiedByType: - s_Azure_ResourceManager_CommonTypes_createdByType.optional(), - lastModifiedAt: z.iso.datetime({offset: true}).optional(), -}) - export const s_EmployeeProperties = z.object({ age: z.coerce.number().optional(), city: z.string().optional(), @@ -102,50 +49,94 @@ export const s_EmployeeUpdate = z.object({ properties: s_EmployeeUpdateProperties.optional(), }) -export const s_Azure_ResourceManager_CommonTypes_Resource = z.object({ - id: z.string().optional(), - name: z.string().optional(), - type: s_Azure_Core_armResourceType.optional(), - systemData: s_Azure_ResourceManager_CommonTypes_SystemData.optional(), -}) - export const s_OperationListResult = z.object({ value: z.array(s_Azure_ResourceManager_CommonTypes_Operation), nextLink: z.string().optional(), }) -export const s_Azure_ResourceManager_CommonTypes_TrackedResource = - s_Azure_ResourceManager_CommonTypes_Resource.extend({ - tags: z.record(z.string(), z.string()).optional(), - location: s_Azure_Core_azureLocation, - }) +export const s_Azure_ResourceManager_CommonTypes_ErrorResponse = z.object({ + error: s_Azure_ResourceManager_CommonTypes_ErrorDetail.optional(), +}) + +export const s_Azure_Core_uuid = z.string() export const s_Employee = z.intersection( s_Azure_ResourceManager_CommonTypes_TrackedResource, z.object({properties: s_EmployeeProperties.optional()}), ) -export const s_EmployeeListResult = z.object({ - value: z.array(s_Employee), +export const s_EmployeeListResult: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_Employee)), nextLink: z.string().optional(), }) -export const s_Azure_ResourceManager_CommonTypes_ErrorResponse: z.ZodType = - z.object({ - error: z.lazy(() => - s_Azure_ResourceManager_CommonTypes_ErrorDetail.optional(), - ), - }) +export const s_Azure_ResourceManager_CommonTypes_Operation = z.object({ + name: z.string().optional(), + isDataAction: PermissiveBoolean.optional(), + display: s_Azure_ResourceManager_CommonTypes_OperationDisplay.optional(), + origin: s_Azure_ResourceManager_CommonTypes_Origin.optional(), + actionType: s_Azure_ResourceManager_CommonTypes_ActionType.optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_ErrorDetail = z.object({ + code: z.string().optional(), + message: z.string().optional(), + target: z.string().optional(), + details: z.array(s_Azure_ResourceManager_CommonTypes_ErrorDetail).optional(), + additionalInfo: z + .array(s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo) + .optional(), +}) -export const s_Azure_ResourceManager_CommonTypes_ErrorDetail: z.ZodType = - z.object({ - code: z.string().optional(), - message: z.string().optional(), - target: z.string().optional(), - details: z - .array(z.lazy(() => s_Azure_ResourceManager_CommonTypes_ErrorDetail)) - .optional(), - additionalInfo: z - .array(s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo) - .optional(), +export const s_Azure_ResourceManager_CommonTypes_TrackedResource = + s_Azure_ResourceManager_CommonTypes_Resource.extend({ + tags: z.record(z.string(), z.string()).optional(), + location: s_Azure_Core_azureLocation, }) + +export const s_Azure_ResourceManager_CommonTypes_OperationDisplay = z.object({ + provider: z.string().optional(), + resource: z.string().optional(), + operation: z.string().optional(), + description: z.string().optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_Origin = z.union([ + z.enum(["user", "system", "user,system"]), + z.string(), +]) + +export const s_Azure_ResourceManager_CommonTypes_ActionType = z.union([ + z.literal("Internal"), + z.string(), +]) + +export const s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = z.object( + {type: z.string().optional(), info: z.unknown().optional()}, +) + +export const s_Azure_ResourceManager_CommonTypes_Resource = z.object({ + id: z.string().optional(), + name: z.string().optional(), + type: s_Azure_Core_armResourceType.optional(), + systemData: s_Azure_ResourceManager_CommonTypes_SystemData.optional(), +}) + +export const s_Azure_Core_azureLocation = z.string() + +export const s_Azure_Core_armResourceType = z.string() + +export const s_Azure_ResourceManager_CommonTypes_SystemData = z.object({ + createdBy: z.string().optional(), + createdByType: s_Azure_ResourceManager_CommonTypes_createdByType.optional(), + createdAt: z.iso.datetime({offset: true}).optional(), + lastModifiedBy: z.string().optional(), + lastModifiedByType: + s_Azure_ResourceManager_CommonTypes_createdByType.optional(), + lastModifiedAt: z.iso.datetime({offset: true}).optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_createdByType = z.union([ + z.enum(["User", "Application", "ManagedIdentity", "Key"]), + z.string(), +]) diff --git a/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts b/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts index 5ba235076..74d475f69 100644 --- a/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts +++ b/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts @@ -16498,7 +16498,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_billing_alert)), + data: z.array(s_billing_alert), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000).regex(new RegExp("^/v1/billing/alerts")), @@ -17004,7 +17004,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_billing_credit_balance_transaction)), + data: z.array(s_billing_credit_balance_transaction), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -17214,7 +17214,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_billing_credit_grant)), + data: z.array(s_billing_credit_grant), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -19565,7 +19565,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_checkout_session)), + data: z.array(s_checkout_session), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -27904,7 +27904,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_financial_connections_account)), + data: z.array(s_financial_connections_account), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -31954,7 +31954,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_authorization)), + data: z.array(s_issuing_authorization), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -32363,7 +32363,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_cardholder)), + data: z.array(s_issuing_cardholder), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -32692,7 +32692,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_card)), + data: z.array(s_issuing_card), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000).regex(new RegExp("^/v1/issuing/cards")), @@ -33021,7 +33021,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_dispute)), + data: z.array(s_issuing_dispute), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000).regex(new RegExp("^/v1/issuing/disputes")), @@ -33380,7 +33380,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_personalization_design)), + data: z.array(s_issuing_personalization_design), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -34046,7 +34046,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_token)), + data: z.array(s_issuing_token), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -34307,7 +34307,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_transaction)), + data: z.array(s_issuing_transaction), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -34703,7 +34703,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_financial_connections_account)), + data: z.array(s_financial_connections_account), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -39936,7 +39936,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(s_product_feature), + data: z.array(z.lazy(() => s_product_feature)), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -41298,7 +41298,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_radar_early_fraud_warning)), + data: z.array(s_radar_early_fraud_warning), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -42582,7 +42582,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_reporting_report_run)), + data: z.array(s_reporting_report_run), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -48186,7 +48186,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_terminal_configuration)), + data: z.array(s_terminal_configuration), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -48403,10 +48403,7 @@ export function createRouter( [ [ "200", - z.union([ - z.lazy(() => s_terminal_configuration), - s_deleted_terminal_configuration, - ]), + z.union([s_terminal_configuration, s_deleted_terminal_configuration]), ], ], s_error, @@ -48486,10 +48483,7 @@ export function createRouter( [ [ "200", - z.union([ - z.lazy(() => s_terminal_configuration), - s_deleted_terminal_configuration, - ]), + z.union([s_terminal_configuration, s_deleted_terminal_configuration]), ], ], s_error, @@ -49016,7 +49010,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_terminal_reader)), + data: z.array(s_terminal_reader), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -49229,12 +49223,7 @@ export function createRouter( const getTerminalReadersReaderResponseBodyValidator = responseValidationFactory( - [ - [ - "200", - z.union([z.lazy(() => s_terminal_reader), s_deleted_terminal_reader]), - ], - ], + [["200", z.union([s_terminal_reader, s_deleted_terminal_reader])]], s_error, ) @@ -49300,12 +49289,7 @@ export function createRouter( const postTerminalReadersReaderResponseBodyValidator = responseValidationFactory( - [ - [ - "200", - z.union([z.lazy(() => s_terminal_reader), s_deleted_terminal_reader]), - ], - ], + [["200", z.union([s_terminal_reader, s_deleted_terminal_reader])]], s_error, ) @@ -53575,7 +53559,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_credit_reversal)), + data: z.array(s_treasury_credit_reversal), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -53826,7 +53810,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_debit_reversal)), + data: z.array(s_treasury_debit_reversal), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -54611,7 +54595,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_inbound_transfer)), + data: z.array(s_treasury_inbound_transfer), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -54922,7 +54906,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_outbound_payment)), + data: z.array(s_treasury_outbound_payment), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -55244,7 +55228,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_outbound_transfer)), + data: z.array(s_treasury_outbound_transfer), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -55557,7 +55541,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_received_credit)), + data: z.array(s_treasury_received_credit), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -55757,7 +55741,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_received_debit)), + data: z.array(s_treasury_received_debit), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -55968,7 +55952,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_transaction_entry)), + data: z.array(s_treasury_transaction_entry), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -56223,7 +56207,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_transaction)), + data: z.array(s_treasury_transaction), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), diff --git a/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts index c19d1ac09..58cdcb6fd 100644 --- a/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts +++ b/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts @@ -31,6 +31,7 @@ import type { t_charge, t_charge_transfer_data, t_checkout_session, + t_climate_order, t_confirmation_token, t_confirmation_tokens_resource_payment_method_preview, t_connect_account_reference, @@ -76,7 +77,6 @@ import type { t_invoices_resource_from_invoice, t_invoices_resource_pretax_credit_amount, t_issuing_authorization, - t_issuing_card, t_issuing_cardholder, t_issuing_cardholder_id_document, t_issuing_cardholder_individual, @@ -92,7 +92,6 @@ import type { t_issuing_dispute_other_evidence, t_issuing_dispute_service_not_as_described_evidence, t_issuing_personalization_design, - t_issuing_token, t_issuing_transaction, t_item, t_legal_entity_company, @@ -203,20 +202,14 @@ import type { t_transfer, t_transfer_data, t_transfer_reversal, - t_treasury_credit_reversal, - t_treasury_debit_reversal, t_treasury_inbound_transfer, t_treasury_outbound_payment, - t_treasury_outbound_payments_resource_returned_status, t_treasury_outbound_transfer, - t_treasury_outbound_transfers_resource_returned_details, t_treasury_received_credit, t_treasury_received_credits_resource_linked_flows, t_treasury_received_credits_resource_source_flows_details, - t_treasury_received_debit, t_treasury_transaction, t_treasury_transaction_entry, - t_treasury_transactions_resource_flow_details, } from "./models.ts" export const PermissiveBoolean = z.preprocess((value) => { @@ -647,26 +640,6 @@ export const s_billing_credit_grants_resource_monetary_amount = z.object({ value: z.coerce.number(), }) -export const s_billing_meter_event = z.object({ - created: z.coerce.number(), - event_name: z.string().max(100), - identifier: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("billing.meter_event"), - payload: z.record(z.string(), z.string().max(100)), - timestamp: z.coerce.number(), -}) - -export const s_billing_meter_event_summary = z.object({ - aggregated_value: z.coerce.number(), - end_time: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - meter: z.string().max(5000), - object: z.literal("billing.meter_event_summary"), - start_time: z.coerce.number(), -}) - export const s_billing_meter_resource_aggregation_settings = z.object({ formula: z.enum(["count", "last", "sum"]), }) @@ -1222,18 +1195,6 @@ export const s_deleted_product_feature = z.object({ object: z.literal("product_feature"), }) -export const s_deleted_radar_value_list = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("radar.value_list"), -}) - -export const s_deleted_radar_value_list_item = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("radar.value_list_item"), -}) - export const s_deleted_subscription_item = z.object({ deleted: PermissiveLiteralTrue, id: z.string().max(5000), @@ -1246,52 +1207,6 @@ export const s_deleted_tax_id = z.object({ object: z.literal("tax_id"), }) -export const s_deleted_terminal_configuration = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("terminal.configuration"), -}) - -export const s_deleted_terminal_location = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("terminal.location"), -}) - -export const s_deleted_terminal_reader = z.object({ - deleted: PermissiveLiteralTrue, - device_type: z.enum([ - "bbpos_chipper2x", - "bbpos_wisepad3", - "bbpos_wisepos_e", - "mobile_phone_reader", - "simulated_stripe_s700", - "simulated_stripe_s710", - "simulated_verifone_m425", - "simulated_verifone_p630", - "simulated_verifone_ux700", - "simulated_verifone_v660p", - "simulated_wisepos_e", - "stripe_m2", - "stripe_s700", - "stripe_s710", - "verifone_P400", - "verifone_m425", - "verifone_p630", - "verifone_ux700", - "verifone_v660p", - ]), - id: z.string().max(5000), - object: z.literal("terminal.reader"), - serial_number: z.string().max(5000), -}) - -export const s_deleted_test_helpers_test_clock = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("test_helpers.test_clock"), -}) - export const s_deleted_webhook_endpoint = z.object({ deleted: PermissiveLiteralTrue, id: z.string().max(5000), @@ -1365,16 +1280,6 @@ export const s_email_sent = z.object({ email_sent_to: z.string().max(5000), }) -export const s_entitlements_feature = z.object({ - active: PermissiveBoolean, - id: z.string().max(5000), - livemode: PermissiveBoolean, - lookup_key: z.string().max(5000), - metadata: z.record(z.string(), z.string().max(500)), - name: z.string().max(80), - object: z.literal("entitlements.feature"), -}) - export const s_ephemeral_key = z.object({ created: z.coerce.number(), expires: z.coerce.number(), @@ -1398,17 +1303,6 @@ export const s_fee = z.object({ type: z.string().max(5000), }) -export const s_financial_connections_account_owner = z.object({ - email: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - name: z.string().max(5000), - object: z.literal("financial_connections.account_owner"), - ownership: z.string().max(5000), - phone: z.string().max(5000).nullable().optional(), - raw_address: z.string().max(5000).nullable().optional(), - refreshed_at: z.coerce.number().nullable().optional(), -}) - export const s_financial_reporting_finance_report_run_run_parameters = z.object( { columns: z.array(z.string().max(5000)).optional(), @@ -2903,26 +2797,6 @@ export const s_issuing_physical_bundle_features = z.object({ second_line: z.enum(["optional", "required", "unsupported"]), }) -export const s_issuing_settlement = z.object({ - bin: z.string().max(5000), - clearing_date: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - id: z.string().max(5000), - interchange_fees_amount: z.coerce.number(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - net_total_amount: z.coerce.number(), - network: z.enum(["maestro", "mastercard", "visa"]), - network_fees_amount: z.coerce.number(), - network_settlement_identifier: z.string().max(5000), - object: z.literal("issuing.settlement"), - settlement_service: z.string().max(5000), - status: z.enum(["complete", "pending"]), - transaction_amount: z.coerce.number(), - transaction_count: z.coerce.number(), -}) - export const s_issuing_transaction_amount_details = z.object({ atm_fee: z.coerce.number().nullable().optional(), cashback_amount: z.coerce.number().nullable().optional(), @@ -6119,16 +5993,6 @@ export const s_radar_review_resource_session = z.object({ version: z.string().max(5000).nullable().optional(), }) -export const s_radar_value_list_item = z.object({ - created: z.coerce.number(), - created_by: z.string().max(5000), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("radar.value_list_item"), - value: z.string().max(5000), - value_list: z.string().max(5000), -}) - export const s_received_payment_method_details_financial_account = z.object({ id: z.string().max(5000), network: z.literal("stripe"), @@ -6218,18 +6082,6 @@ export const s_refund_destination_details_us_bank_transfer = z.object({ reference_status: z.string().max(5000).nullable().optional(), }) -export const s_reporting_report_type = z.object({ - data_available_end: z.coerce.number(), - data_available_start: z.coerce.number(), - default_columns: z.array(z.string().max(5000)).nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("reporting.report_type"), - updated: z.coerce.number(), - version: z.coerce.number(), -}) - export const s_reserve_transaction = z.object({ amount: z.coerce.number(), currency: z.string(), @@ -6489,15 +6341,6 @@ export const s_sigma_scheduled_query_run_error = z.object({ message: z.string().max(5000), }) -export const s_sigma_sigma_api_query = z.object({ - created: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("sigma.sigma_api_query"), - sql: z.string().max(5000), -}) - export const s_smor_resource_managed_payments = z.object({ enabled: PermissiveBoolean, }) @@ -7175,12 +7018,6 @@ export const s_terminal_configuration_configuration_resource_personal_psk_wifi = export const s_terminal_configuration_configuration_resource_reboot_window = z.object({end_hour: z.coerce.number(), start_hour: z.coerce.number()}) -export const s_terminal_connection_token = z.object({ - location: z.string().max(5000).optional(), - object: z.literal("terminal.connection_token"), - secret: z.string().max(5000), -}) - export const s_terminal_onboarding_link_apple_terms_and_conditions = z.object({ allow_relinking: PermissiveBoolean.nullable().optional(), merchant_display_name: z.string().max(5000), @@ -7255,8 +7092,6 @@ export const s_terminal_reader_reader_resource_toggle = z.object({ value: z.enum(["disabled", "enabled"]).nullable().optional(), }) -export const s_terminal_refund = z.record(z.string(), z.unknown()) - export const s_three_d_secure_details = z.object({ authentication_flow: z .enum(["challenge", "frictionless"]) @@ -7759,18 +7594,6 @@ export const s_amazon_pay_underlying_payment_method_funding_details = z.object({ type: z.literal("card").nullable().optional(), }) -export const s_apps_secret = z.object({ - created: z.coerce.number(), - deleted: PermissiveBoolean.optional(), - expires_at: z.coerce.number().nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("apps.secret"), - payload: z.string().max(5000).nullable().optional(), - scope: s_secret_service_resource_scope, -}) - export const s_balance_amount = z.object({ amount: z.coerce.number(), currency: z.string(), @@ -7859,33 +7682,6 @@ export const s_billing_details = z.object({ tax_id: z.string().max(5000).nullable().optional(), }) -export const s_billing_meter = z.object({ - created: z.coerce.number(), - customer_mapping: s_billing_meter_resource_customer_mapping_settings, - default_aggregation: s_billing_meter_resource_aggregation_settings, - display_name: z.string().max(5000), - event_name: z.string().max(5000), - event_time_window: z.enum(["day", "hour"]).nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("billing.meter"), - status: z.enum(["active", "inactive"]), - status_transitions: s_billing_meter_resource_billing_meter_status_transitions, - updated: z.coerce.number(), - value_settings: s_billing_meter_resource_billing_meter_value, -}) - -export const s_billing_meter_event_adjustment = z.object({ - cancel: s_billing_meter_resource_billing_meter_event_adjustment_cancel - .nullable() - .optional(), - event_name: z.string().max(100), - livemode: PermissiveBoolean, - object: z.literal("billing.meter_event_adjustment"), - status: z.enum(["complete", "pending"]), - type: z.literal("cancel"), -}) - export const s_cash_balance = z.object({ available: z.record(z.string(), z.coerce.number()).nullable().optional(), customer: z.string().max(5000), @@ -7994,21 +7790,6 @@ export const s_checkout_upi_payment_method_options = z.object({ setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), }) -export const s_climate_supplier = z.object({ - id: z.string().max(5000), - info_url: z.string().max(5000), - livemode: PermissiveBoolean, - locations: z.array(s_climate_removals_location), - name: z.string().max(5000), - object: z.literal("climate.supplier"), - removal_pathway: z.enum([ - "biomass_carbon_removal_and_storage", - "direct_air_capture", - "enhanced_weathering", - "marine_carbon_removal", - ]), -}) - export const s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance = z.object({ online: @@ -8240,14 +8021,6 @@ export const s_dispute_visa_compelling_evidence3_prior_undisputed_transaction = .optional(), }) -export const s_entitlements_active_entitlement = z.object({ - feature: z.union([z.string().max(5000), s_entitlements_feature]), - id: z.string().max(5000), - livemode: PermissiveBoolean, - lookup_key: z.string().max(5000), - object: z.literal("entitlements.active_entitlement"), -}) - export const s_event = z.object({ account: z.string().max(5000).optional(), api_version: z.string().max(5000).nullable().optional(), @@ -8269,34 +8042,6 @@ export const s_external_account_requirements = z.object({ pending_verification: z.array(z.string().max(5000)).nullable().optional(), }) -export const s_financial_connections_account_ownership = z.object({ - created: z.coerce.number(), - id: z.string().max(5000), - object: z.literal("financial_connections.account_ownership"), - owners: z.object({ - data: z.array(s_financial_connections_account_owner), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z.string().max(5000), - }), -}) - -export const s_financial_connections_transaction = z.object({ - account: z.string().max(5000), - amount: z.coerce.number(), - currency: z.string().max(5000), - description: z.string().max(5000), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("financial_connections.transaction"), - status: z.enum(["pending", "posted", "void"]), - status_transitions: - s_bank_connections_resource_transaction_resource_status_transitions, - transacted_at: z.coerce.number(), - transaction_refresh: z.string().max(5000), - updated: z.coerce.number(), -}) - export const s_forwarded_request_details = z.object({ body: z.string().max(5000), headers: z.array(s_forwarded_request_header), @@ -9956,16 +9701,6 @@ export const s_issuing_network_token_wallet_provider = z.object({ suggested_decision_version: z.string().max(5000).optional(), }) -export const s_issuing_physical_bundle = z.object({ - features: s_issuing_physical_bundle_features, - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("issuing.physical_bundle"), - status: z.enum(["active", "inactive", "review"]), - type: z.enum(["custom", "standard"]), -}) - export const s_issuing_transaction_fleet_reported_breakdown = z.object({ fuel: s_issuing_transaction_fleet_fuel_price_data.nullable().optional(), non_fuel: s_issuing_transaction_fleet_non_fuel_price_data @@ -10662,13 +10397,6 @@ export const s_portal_subscription_update_product = z.object({ product: z.string().max(5000), }) -export const s_product_feature = z.object({ - entitlement_feature: s_entitlements_feature, - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("product_feature"), -}) - export const s_promotion_codes_resource_restrictions = z.object({ currency_options: z .record(z.string(), s_promotion_code_currency_option) @@ -10683,37 +10411,6 @@ export const s_quotes_resource_subscription_data_billing_mode = z.object({ type: z.enum(["classic", "flexible"]), }) -export const s_radar_value_list = z.object({ - alias: z.string().max(5000), - created: z.coerce.number(), - created_by: z.string().max(5000), - id: z.string().max(5000), - item_type: z.enum([ - "account", - "card_bin", - "card_fingerprint", - "case_sensitive_string", - "country", - "crypto_fingerprint", - "customer_id", - "email", - "ip_address", - "sepa_debit_fingerprint", - "string", - "us_bank_account_fingerprint", - ]), - list_items: z.object({ - data: z.array(s_radar_value_list_item), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z.string().max(5000), - }), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - name: z.string().max(5000), - object: z.literal("radar.value_list"), -}) - export const s_refund_destination_details = z.object({ affirm: s_destination_details_unimplemented.optional(), afterpay_clearpay: s_destination_details_unimplemented.optional(), @@ -11130,24 +10827,6 @@ export const s_tax_rate = z.object({ .optional(), }) -export const s_tax_transaction_line_item = z.object({ - amount: z.coerce.number(), - amount_tax: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("tax.transaction_line_item"), - product: z.string().max(5000).nullable().optional(), - quantity: z.coerce.number(), - reference: z.string().max(5000), - reversal: s_tax_product_resource_tax_transaction_line_item_resource_reversal - .nullable() - .optional(), - tax_behavior: z.enum(["exclusive", "inclusive"]), - tax_code: z.string().max(5000), - type: z.enum(["reversal", "transaction"]), -}) - export const s_terminal_configuration_configuration_resource_tipping = z.object( { aed: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), @@ -11185,21 +10864,6 @@ export const s_terminal_configuration_configuration_resource_wifi_config = type: z.enum(["enterprise_eap_peap", "enterprise_eap_tls", "personal_psk"]), }) -export const s_terminal_location = z.object({ - address: s_address, - address_kana: s_legal_entity_japan_address.optional(), - address_kanji: s_legal_entity_japan_address.optional(), - configuration_overrides: z.string().max(5000).optional(), - display_name: z.string().max(5000), - display_name_kana: z.string().max(5000).optional(), - display_name_kanji: z.string().max(5000).optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - object: z.literal("terminal.location"), - phone: z.string().max(5000).optional(), -}) - export const s_terminal_onboarding_link_link_options = z.object({ apple_terms_and_conditions: s_terminal_onboarding_link_apple_terms_and_conditions.nullable().optional(), @@ -11375,29 +11039,6 @@ export const s_checkout_us_bank_account_payment_method_options = z.object({ verification_method: z.enum(["automatic", "instant"]).optional(), }) -export const s_climate_product = z.object({ - created: z.coerce.number(), - current_prices_per_metric_ton: z.record( - z.string(), - s_climate_removals_products_price, - ), - delivery_year: z.coerce.number().nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metric_tons_available: z.string(), - name: z.string().max(5000), - object: z.literal("climate.product"), - suppliers: z.array(s_climate_supplier), -}) - -export const s_climate_removals_order_deliveries = z.object({ - delivered_at: z.coerce.number(), - location: s_climate_removals_location.nullable().optional(), - metric_tons: z.string().max(5000), - registry_url: z.string().max(5000).nullable().optional(), - supplier: s_climate_supplier, -}) - export const s_confirmation_tokens_resource_mandate_data = z.object({ customer_acceptance: s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance, @@ -11497,28 +11138,6 @@ export const s_dispute_evidence_details = z.object({ submission_count: z.coerce.number(), }) -export const s_forwarding_request = z.object({ - created: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("forwarding.request"), - payment_method: z.string().max(5000), - replacements: z.array( - z.enum([ - "card_cvc", - "card_expiry", - "card_number", - "cardholder_name", - "request_signature", - ]), - ), - request_context: s_forwarded_request_context.nullable().optional(), - request_details: s_forwarded_request_details.nullable().optional(), - response_details: s_forwarded_response_details.nullable().optional(), - url: z.string().max(5000).nullable().optional(), -}) - export const s_funding_instructions_bank_transfer_financial_address = z.object({ aba: s_funding_instructions_bank_transfer_aba_record.optional(), iban: s_funding_instructions_bank_transfer_iban_record.optional(), @@ -11543,23 +11162,6 @@ export const s_funding_instructions_bank_transfer_financial_address = z.object({ zengin: s_funding_instructions_bank_transfer_zengin_record.optional(), }) -export const s_identity_verification_report = z.object({ - client_reference_id: z.string().max(5000).nullable().optional(), - created: z.coerce.number(), - document: s_gelato_document_report.optional(), - email: s_gelato_email_report.optional(), - id: z.string().max(5000), - id_number: s_gelato_id_number_report.optional(), - livemode: PermissiveBoolean, - object: z.literal("identity.verification_report"), - options: s_gelato_verification_report_options.optional(), - phone: s_gelato_phone_report.optional(), - selfie: s_gelato_selfie_report.optional(), - type: z.enum(["document", "id_number", "verification_flow"]), - verification_flow: z.string().max(5000).optional(), - verification_session: z.string().max(5000).nullable().optional(), -}) - export const s_insights_resources_payment_evaluation_event = z.object({ dispute_opened: s_insights_resources_payment_evaluation_dispute_opened.optional(), @@ -12246,35 +11848,6 @@ export const s_source_order = z.object({ shipping: s_shipping.optional(), }) -export const s_tax_association = z.object({ - calculation: z.string().max(5000), - id: z.string().max(5000), - object: z.literal("tax.association"), - payment_intent: z.string().max(5000), - tax_transaction_attempts: z - .array(s_tax_product_resource_tax_association_transaction_attempts) - .nullable() - .optional(), -}) - -export const s_tax_calculation_line_item = z.object({ - amount: z.coerce.number(), - amount_tax: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("tax.calculation_line_item"), - product: z.string().max(5000).nullable().optional(), - quantity: z.coerce.number(), - reference: z.string().max(5000), - tax_behavior: z.enum(["exclusive", "inclusive"]), - tax_breakdown: z - .array(s_tax_product_resource_line_item_tax_breakdown) - .nullable() - .optional(), - tax_code: z.string().max(5000), -}) - export const s_tax_product_registrations_resource_country_options_united_states = z.object({ local_amusement_tax: @@ -12328,61 +11901,6 @@ export const s_tax_product_resource_tax_calculation_shipping_cost = z.object({ tax_code: z.string().max(5000), }) -export const s_tax_settings = z.object({ - defaults: s_tax_product_resource_tax_settings_defaults, - head_office: s_tax_product_resource_tax_settings_head_office - .nullable() - .optional(), - livemode: PermissiveBoolean, - object: z.literal("tax.settings"), - status: z.enum(["active", "pending"]), - status_details: s_tax_product_resource_tax_settings_status_details, -}) - -export const s_tax_transaction = z.object({ - created: z.coerce.number(), - currency: z.string().max(5000), - customer: z.string().max(5000).nullable().optional(), - customer_details: s_tax_product_resource_customer_details, - id: z.string().max(5000), - line_items: z - .object({ - data: z.array(s_tax_transaction_line_item), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z - .string() - .max(5000) - .regex(new RegExp("^/v1/tax/transactions/[^/]+/line_items")), - }) - .nullable() - .optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("tax.transaction"), - posted_at: z.coerce.number(), - reference: z.string().max(5000), - reversal: s_tax_product_resource_tax_transaction_resource_reversal - .nullable() - .optional(), - ship_from_details: s_tax_product_resource_ship_from_details - .nullable() - .optional(), - shipping_cost: s_tax_product_resource_tax_transaction_shipping_cost - .nullable() - .optional(), - tax_date: z.coerce.number(), - type: z.enum(["reversal", "transaction"]), -}) - -export const s_terminal_onboarding_link = z.object({ - link_options: s_terminal_onboarding_link_link_options, - link_type: z.literal("apple_terms_and_conditions"), - object: z.literal("terminal.onboarding_link"), - on_behalf_of: z.string().max(5000).nullable().optional(), - redirect_url: z.string().max(5000), -}) - export const s_terminal_reader_reader_resource_input = z.object({ custom_text: s_terminal_reader_reader_resource_custom_text .nullable() @@ -12408,18 +11926,6 @@ export const s_terminal_reader_reader_resource_set_reader_display_action = type: z.literal("cart"), }) -export const s_test_helpers_test_clock = z.object({ - created: z.coerce.number(), - deletes_after: z.coerce.number(), - frozen_time: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000).nullable().optional(), - object: z.literal("test_helpers.test_clock"), - status: z.enum(["advancing", "internal_failure", "ready"]), - status_details: s_billing_clocks_resource_status_details_status_details, -}) - export const s_treasury_financial_accounts_resource_financial_addresses_features = z.object({ aba: s_treasury_financial_accounts_resource_aba_toggle_settings.optional(), @@ -12577,40 +12083,6 @@ export const s_checkout_session_payment_method_options = z.object({ us_bank_account: s_checkout_us_bank_account_payment_method_options.optional(), }) -export const s_climate_order = z.object({ - amount_fees: z.coerce.number(), - amount_subtotal: z.coerce.number(), - amount_total: z.coerce.number(), - beneficiary: s_climate_removals_beneficiary.optional(), - canceled_at: z.coerce.number().nullable().optional(), - cancellation_reason: z - .enum(["expired", "product_unavailable", "requested"]) - .nullable() - .optional(), - certificate: z.string().max(5000).nullable().optional(), - confirmed_at: z.coerce.number().nullable().optional(), - created: z.coerce.number(), - currency: z.string().max(5000), - delayed_at: z.coerce.number().nullable().optional(), - delivered_at: z.coerce.number().nullable().optional(), - delivery_details: z.array(s_climate_removals_order_deliveries), - expected_delivery_year: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - metric_tons: z.string(), - object: z.literal("climate.order"), - product: z.union([z.string().max(5000), s_climate_product]), - product_substituted_at: z.coerce.number().nullable().optional(), - status: z.enum([ - "awaiting_funds", - "canceled", - "confirmed", - "delivered", - "open", - ]), -}) - export const s_confirmation_tokens_resource_payment_method_options = z.object({ card: s_confirmation_tokens_resource_payment_method_options_resource_card .nullable() @@ -12631,32 +12103,6 @@ export const s_funding_instructions_bank_transfer = z.object({ type: z.enum(["eu_bank_transfer", "jp_bank_transfer"]), }) -export const s_identity_verification_session = z.object({ - client_reference_id: z.string().max(5000).nullable().optional(), - client_secret: z.string().max(5000).nullable().optional(), - created: z.coerce.number(), - id: z.string().max(5000), - last_error: s_gelato_session_last_error.nullable().optional(), - last_verification_report: z - .union([z.string().max(5000), s_identity_verification_report]) - .nullable() - .optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - object: z.literal("identity.verification_session"), - options: s_gelato_verification_session_options.nullable().optional(), - provided_details: s_gelato_provided_details.nullable().optional(), - redaction: s_verification_session_redaction.nullable().optional(), - related_customer: z.string().max(5000).nullable().optional(), - related_customer_account: z.string().max(5000).nullable().optional(), - related_person: s_gelato_related_person.optional(), - status: z.enum(["canceled", "processing", "requires_input", "verified"]), - type: z.enum(["document", "id_number", "verification_flow"]), - url: z.string().max(5000).nullable().optional(), - verification_flow: z.string().max(5000).optional(), - verified_outputs: s_gelato_verified_outputs.nullable().optional(), -}) - export const s_invoices_payment_method_options = z.object({ acss_debit: s_invoice_payment_method_options_acss_debit.nullable().optional(), bancontact: s_invoice_payment_method_options_bancontact.nullable().optional(), @@ -13310,39 +12756,6 @@ export const s_subscriptions_resource_payment_method_options = z.object({ .optional(), }) -export const s_tax_calculation = z.object({ - amount_total: z.coerce.number(), - currency: z.string().max(5000), - customer: z.string().max(5000).nullable().optional(), - customer_details: s_tax_product_resource_customer_details, - expires_at: z.coerce.number().nullable().optional(), - id: z.string().max(5000).nullable().optional(), - line_items: z - .object({ - data: z.array(s_tax_calculation_line_item), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z - .string() - .max(5000) - .regex(new RegExp("^/v1/tax/calculations/[^/]+/line_items")), - }) - .nullable() - .optional(), - livemode: PermissiveBoolean, - object: z.literal("tax.calculation"), - ship_from_details: s_tax_product_resource_ship_from_details - .nullable() - .optional(), - shipping_cost: s_tax_product_resource_tax_calculation_shipping_cost - .nullable() - .optional(), - tax_amount_exclusive: z.coerce.number(), - tax_amount_inclusive: z.coerce.number(), - tax_breakdown: z.array(s_tax_product_resource_tax_breakdown), - tax_date: z.coerce.number(), -}) - export const s_tax_product_registrations_resource_country_options = z.object({ ae: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), al: s_tax_product_registrations_resource_country_options_default.optional(), @@ -13454,44 +12867,6 @@ export const s_terminal_reader_reader_resource_collect_inputs_action = z.object( }, ) -export const s_treasury_financial_account_features = z.object({ - card_issuing: - s_treasury_financial_accounts_resource_toggle_settings.optional(), - deposit_insurance: - s_treasury_financial_accounts_resource_toggle_settings.optional(), - financial_addresses: - s_treasury_financial_accounts_resource_financial_addresses_features.optional(), - inbound_transfers: - s_treasury_financial_accounts_resource_inbound_transfers.optional(), - intra_stripe_flows: - s_treasury_financial_accounts_resource_toggle_settings.optional(), - object: z.literal("treasury.financial_account_features"), - outbound_payments: - s_treasury_financial_accounts_resource_outbound_payments.optional(), - outbound_transfers: - s_treasury_financial_accounts_resource_outbound_transfers.optional(), -}) - -export const s_billing_portal_configuration = z.object({ - active: PermissiveBoolean, - application: z - .union([z.string().max(5000), s_application, s_deleted_application]) - .nullable() - .optional(), - business_profile: s_portal_business_profile, - created: z.coerce.number(), - default_return_url: z.string().max(5000).nullable().optional(), - features: s_portal_features, - id: z.string().max(5000), - is_default: PermissiveBoolean, - livemode: PermissiveBoolean, - login_page: s_portal_login_page, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - name: z.string().max(5000).nullable().optional(), - object: z.literal("billing_portal.configuration"), - updated: z.coerce.number(), -}) - export const s_funding_instructions = z.object({ bank_transfer: s_funding_instructions_bank_transfer, currency: z.string().max(5000), @@ -13677,161 +13052,6 @@ export const s_subscriptions_resource_payment_settings = z.object({ .optional(), }) -export const s_tax_registration = z.object({ - active_from: z.coerce.number(), - country: z.string().max(5000), - country_options: s_tax_product_registrations_resource_country_options, - created: z.coerce.number(), - expires_at: z.coerce.number().nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("tax.registration"), - status: z.enum(["active", "expired", "scheduled"]), -}) - -export const s_treasury_financial_account = z.object({ - active_features: z - .array( - z.enum([ - "card_issuing", - "deposit_insurance", - "financial_addresses.aba", - "financial_addresses.aba.forwarding", - "inbound_transfers.ach", - "intra_stripe_flows", - "outbound_payments.ach", - "outbound_payments.us_domestic_wire", - "outbound_transfers.ach", - "outbound_transfers.us_domestic_wire", - "remote_deposit_capture", - ]), - ) - .optional(), - balance: s_treasury_financial_accounts_resource_balance, - country: z.string().max(5000), - created: z.coerce.number(), - features: s_treasury_financial_account_features.optional(), - financial_addresses: z.array( - s_treasury_financial_accounts_resource_financial_address, - ), - id: z.string().max(5000), - is_default: PermissiveBoolean.optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - nickname: z.string().max(5000).nullable().optional(), - object: z.literal("treasury.financial_account"), - pending_features: z - .array( - z.enum([ - "card_issuing", - "deposit_insurance", - "financial_addresses.aba", - "financial_addresses.aba.forwarding", - "inbound_transfers.ach", - "intra_stripe_flows", - "outbound_payments.ach", - "outbound_payments.us_domestic_wire", - "outbound_transfers.ach", - "outbound_transfers.us_domestic_wire", - "remote_deposit_capture", - ]), - ) - .optional(), - platform_restrictions: - s_treasury_financial_accounts_resource_platform_restrictions - .nullable() - .optional(), - restricted_features: z - .array( - z.enum([ - "card_issuing", - "deposit_insurance", - "financial_addresses.aba", - "financial_addresses.aba.forwarding", - "inbound_transfers.ach", - "intra_stripe_flows", - "outbound_payments.ach", - "outbound_payments.us_domestic_wire", - "outbound_transfers.ach", - "outbound_transfers.us_domestic_wire", - "remote_deposit_capture", - ]), - ) - .optional(), - status: z.enum(["closed", "open"]), - status_details: s_treasury_financial_accounts_resource_status_details, - supported_currencies: z.array(z.string()), -}) - -export const s_billing_portal_session = z.object({ - configuration: z.union([ - z.string().max(5000), - s_billing_portal_configuration, - ]), - created: z.coerce.number(), - customer: z.string().max(5000), - customer_account: z.string().max(5000).nullable().optional(), - flow: s_portal_flows_flow.nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - locale: z - .enum([ - "auto", - "bg", - "cs", - "da", - "de", - "el", - "en", - "en-AU", - "en-CA", - "en-GB", - "en-IE", - "en-IN", - "en-NZ", - "en-SG", - "es", - "es-419", - "et", - "fi", - "fil", - "fr", - "fr-CA", - "hr", - "hu", - "id", - "it", - "ja", - "ko", - "lt", - "lv", - "ms", - "mt", - "nb", - "nl", - "pl", - "pt", - "pt-BR", - "ro", - "ru", - "sk", - "sl", - "sv", - "th", - "tr", - "vi", - "zh", - "zh-HK", - "zh-TW", - ]) - .nullable() - .optional(), - object: z.literal("billing_portal.session"), - on_behalf_of: z.string().max(5000).nullable().optional(), - return_url: z.string().max(5000).nullable().optional(), - url: z.string().max(5000), -}) - export const s_account: z.ZodType = z.object({ business_profile: s_account_business_profile.nullable().optional(), business_type: z @@ -16588,6 +15808,18 @@ export const s_PostApplicationFeesIdRefundsRequestBody = z.object({ metadata: z.record(z.string(), z.string()).optional(), }) +export const s_apps_secret = z.object({ + created: z.coerce.number(), + deleted: PermissiveBoolean.optional(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("apps.secret"), + payload: z.string().max(5000).nullable().optional(), + scope: s_secret_service_resource_scope, +}) + export const s_PostAppsSecretsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), expires_at: z.coerce.number().optional(), @@ -16637,9 +15869,9 @@ export const s_balance_transaction: z.ZodType = z.object( z.lazy(() => s_customer_cash_balance_transaction), z.lazy(() => s_dispute), z.lazy(() => s_fee_refund), - z.lazy(() => s_issuing_authorization), - z.lazy(() => s_issuing_dispute), - z.lazy(() => s_issuing_transaction), + s_issuing_authorization, + s_issuing_dispute, + s_issuing_transaction, z.lazy(() => s_payout), z.lazy(() => s_refund), s_reserve_transaction, @@ -16845,10 +16077,7 @@ export const s_billing_credit_balance_transaction: z.ZodType s_billing_credit_grants_resource_balance_credit) .nullable() .optional(), - credit_grant: z.union([ - z.string().max(5000), - z.lazy(() => s_billing_credit_grant), - ]), + credit_grant: z.union([z.string().max(5000), s_billing_credit_grant]), debit: z .lazy(() => s_billing_credit_grants_resource_balance_debit) .nullable() @@ -16937,6 +16166,17 @@ export const s_PostBillingMeterEventAdjustmentsRequestBody = z.object({ type: z.literal("cancel"), }) +export const s_billing_meter_event_adjustment = z.object({ + cancel: s_billing_meter_resource_billing_meter_event_adjustment_cancel + .nullable() + .optional(), + event_name: z.string().max(100), + livemode: PermissiveBoolean, + object: z.literal("billing.meter_event_adjustment"), + status: z.enum(["complete", "pending"]), + type: z.literal("cancel"), +}) + export const s_PostBillingMeterEventsRequestBody = z.object({ event_name: z.string().max(100), expand: z.array(z.string().max(5000)).optional(), @@ -16945,6 +16185,32 @@ export const s_PostBillingMeterEventsRequestBody = z.object({ timestamp: z.coerce.number().optional(), }) +export const s_billing_meter_event = z.object({ + created: z.coerce.number(), + event_name: z.string().max(100), + identifier: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("billing.meter_event"), + payload: z.record(z.string(), z.string().max(100)), + timestamp: z.coerce.number(), +}) + +export const s_billing_meter = z.object({ + created: z.coerce.number(), + customer_mapping: s_billing_meter_resource_customer_mapping_settings, + default_aggregation: s_billing_meter_resource_aggregation_settings, + display_name: z.string().max(5000), + event_name: z.string().max(5000), + event_time_window: z.enum(["day", "hour"]).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("billing.meter"), + status: z.enum(["active", "inactive"]), + status_transitions: s_billing_meter_resource_billing_meter_status_transitions, + updated: z.coerce.number(), + value_settings: s_billing_meter_resource_billing_meter_value, +}) + export const s_PostBillingMetersRequestBody = z.object({ customer_mapping: z .object({event_payload_key: z.string().max(100), type: z.literal("by_id")}) @@ -16966,10 +16232,40 @@ export const s_PostBillingMetersIdDeactivateRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_billing_meter_event_summary = z.object({ + aggregated_value: z.coerce.number(), + end_time: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + meter: z.string().max(5000), + object: z.literal("billing.meter_event_summary"), + start_time: z.coerce.number(), +}) + export const s_PostBillingMetersIdReactivateRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_billing_portal_configuration = z.object({ + active: PermissiveBoolean, + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + business_profile: s_portal_business_profile, + created: z.coerce.number(), + default_return_url: z.string().max(5000).nullable().optional(), + features: s_portal_features, + id: z.string().max(5000), + is_default: PermissiveBoolean, + livemode: PermissiveBoolean, + login_page: s_portal_login_page, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + object: z.literal("billing_portal.configuration"), + updated: z.coerce.number(), +}) + export const s_PostBillingPortalConfigurationsRequestBody = z.object({ business_profile: z .object({ @@ -17344,6 +16640,75 @@ export const s_PostBillingPortalSessionsRequestBody = z.object({ return_url: z.string().optional(), }) +export const s_billing_portal_session = z.object({ + configuration: z.union([ + z.string().max(5000), + s_billing_portal_configuration, + ]), + created: z.coerce.number(), + customer: z.string().max(5000), + customer_account: z.string().max(5000).nullable().optional(), + flow: s_portal_flows_flow.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + locale: z + .enum([ + "auto", + "bg", + "cs", + "da", + "de", + "el", + "en", + "en-AU", + "en-CA", + "en-GB", + "en-IE", + "en-IN", + "en-NZ", + "en-SG", + "es", + "es-419", + "et", + "fi", + "fil", + "fr", + "fr-CA", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "ms", + "mt", + "nb", + "nl", + "pl", + "pt", + "pt-BR", + "ro", + "ru", + "sk", + "sl", + "sv", + "th", + "tr", + "vi", + "zh", + "zh-HK", + "zh-TW", + ]) + .nullable() + .optional(), + object: z.literal("billing_portal.session"), + on_behalf_of: z.string().max(5000).nullable().optional(), + return_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000), +}) + export const s_charge: z.ZodType = z.object({ amount: z.coerce.number(), amount_captured: z.coerce.number(), @@ -19571,6 +18936,40 @@ export const s_item: z.ZodType = z.object({ taxes: z.array(s_line_items_tax_amount).optional(), }) +export const s_climate_order: z.ZodType = z.object({ + amount_fees: z.coerce.number(), + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + beneficiary: s_climate_removals_beneficiary.optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_reason: z + .enum(["expired", "product_unavailable", "requested"]) + .nullable() + .optional(), + certificate: z.string().max(5000).nullable().optional(), + confirmed_at: z.coerce.number().nullable().optional(), + created: z.coerce.number(), + currency: z.string().max(5000), + delayed_at: z.coerce.number().nullable().optional(), + delivered_at: z.coerce.number().nullable().optional(), + delivery_details: z.array(z.lazy(() => s_climate_removals_order_deliveries)), + expected_delivery_year: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + metric_tons: z.string(), + object: z.literal("climate.order"), + product: z.union([z.string().max(5000), s_climate_product]), + product_substituted_at: z.coerce.number().nullable().optional(), + status: z.enum([ + "awaiting_funds", + "canceled", + "confirmed", + "delivered", + "open", + ]), +}) + export const s_PostClimateOrdersRequestBody = z.object({ amount: z.coerce.number().optional(), beneficiary: z.object({public_name: z.string().max(5000)}).optional(), @@ -19596,6 +18995,36 @@ export const s_PostClimateOrdersOrderCancelRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_climate_product = z.object({ + created: z.coerce.number(), + current_prices_per_metric_ton: z.record( + z.string(), + s_climate_removals_products_price, + ), + delivery_year: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metric_tons_available: z.string(), + name: z.string().max(5000), + object: z.literal("climate.product"), + suppliers: z.array(s_climate_supplier), +}) + +export const s_climate_supplier = z.object({ + id: z.string().max(5000), + info_url: z.string().max(5000), + livemode: PermissiveBoolean, + locations: z.array(s_climate_removals_location), + name: z.string().max(5000), + object: z.literal("climate.supplier"), + removal_pathway: z.enum([ + "biomass_carbon_removal_and_storage", + "direct_air_capture", + "enhanced_weathering", + "marine_carbon_removal", + ]), +}) + export const s_confirmation_token: z.ZodType = z.object({ created: z.coerce.number(), expires_at: z.coerce.number().nullable().optional(), @@ -20310,7 +19739,7 @@ export const s_customer_balance_transaction: z.ZodType s_checkout_session)]) + .union([z.string().max(5000), s_checkout_session]) .nullable() .optional(), created: z.coerce.number(), @@ -22336,6 +21765,24 @@ export const s_PostDisputesDisputeCloseRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_entitlements_active_entitlement = z.object({ + feature: z.union([z.string().max(5000), s_entitlements_feature]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000), + object: z.literal("entitlements.active_entitlement"), +}) + +export const s_entitlements_feature = z.object({ + active: PermissiveBoolean, + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000), + metadata: z.record(z.string(), z.string().max(500)), + name: z.string().max(80), + object: z.literal("entitlements.feature"), +}) + export const s_PostEntitlementsFeaturesRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), lookup_key: z.string().max(80), @@ -22522,6 +21969,17 @@ export const s_financial_connections_account: z.ZodType s_financial_connections_account)), + data: z.array(s_financial_connections_account), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -22604,6 +22062,44 @@ export const s_financial_connections_session: z.ZodType = "swipe", ]), balance_transactions: z.array(z.lazy(() => s_balance_transaction)), - card: z.lazy(() => s_issuing_card), + card: s_issuing_card, card_presence: z.enum(["not_present", "present"]).nullable().optional(), cardholder: z - .union([z.string().max(5000), z.lazy(() => s_issuing_cardholder)]) + .union([z.string().max(5000), s_issuing_cardholder]) .nullable() .optional(), created: z.coerce.number(), @@ -24861,10 +24400,10 @@ export const s_issuing_authorization: z.ZodType = request_history: z.array(s_issuing_authorization_request), status: z.enum(["closed", "expired", "pending", "reversed"]), token: z - .union([z.string().max(5000), z.lazy(() => s_issuing_token)]) + .union([z.string().max(5000), s_issuing_token]) .nullable() .optional(), - transactions: z.array(z.lazy(() => s_issuing_transaction)), + transactions: z.array(s_issuing_transaction), treasury: s_issuing_authorization_treasury.nullable().optional(), verification_data: s_issuing_authorization_verification_data, verified_by_fraud_challenge: PermissiveBoolean.nullable().optional(), @@ -26900,13 +26439,13 @@ export const s_PostIssuingCardholdersCardholderRequestBody = z.object({ status: z.enum(["active", "inactive"]).optional(), }) -export const s_issuing_card: z.ZodType = z.object({ +export const s_issuing_card = z.object({ brand: z.string().max(5000), cancellation_reason: z .enum(["design_rejected", "fulfillment_error", "lost", "stolen"]) .nullable() .optional(), - cardholder: z.lazy(() => s_issuing_cardholder), + cardholder: s_issuing_cardholder, created: z.coerce.number(), currency: z.string(), cvc: z.string().max(5000).optional(), @@ -26922,18 +26461,15 @@ export const s_issuing_card: z.ZodType = z.object({ number: z.string().max(5000).optional(), object: z.literal("issuing.card"), personalization_design: z - .union([ - z.string().max(5000), - z.lazy(() => s_issuing_personalization_design), - ]) + .union([z.string().max(5000), s_issuing_personalization_design]) .nullable() .optional(), replaced_by: z - .union([z.string().max(5000), z.lazy(() => s_issuing_card)]) + .union([z.string().max(5000), s_issuing_card]) .nullable() .optional(), replacement_for: z - .union([z.string().max(5000), z.lazy(() => s_issuing_card)]) + .union([z.string().max(5000), s_issuing_card]) .nullable() .optional(), replacement_reason: z @@ -28937,10 +28473,7 @@ export const s_issuing_dispute: z.ZodType = z.object({ metadata: z.record(z.string(), z.string().max(500)), object: z.literal("issuing.dispute"), status: z.enum(["expired", "lost", "submitted", "unsubmitted", "won"]), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_issuing_transaction), - ]), + transaction: z.union([z.string().max(5000), s_issuing_transaction]), treasury: s_issuing_dispute_treasury.nullable().optional(), }) @@ -29355,13 +28888,43 @@ export const s_PostIssuingPersonalizationDesignsPersonalizationDesignRequestBody transfer_lookup_key: PermissiveBoolean.optional(), }) +export const s_issuing_physical_bundle = z.object({ + features: s_issuing_physical_bundle_features, + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("issuing.physical_bundle"), + status: z.enum(["active", "inactive", "review"]), + type: z.enum(["custom", "standard"]), +}) + +export const s_issuing_settlement = z.object({ + bin: z.string().max(5000), + clearing_date: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + id: z.string().max(5000), + interchange_fees_amount: z.coerce.number(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + net_total_amount: z.coerce.number(), + network: z.enum(["maestro", "mastercard", "visa"]), + network_fees_amount: z.coerce.number(), + network_settlement_identifier: z.string().max(5000), + object: z.literal("issuing.settlement"), + settlement_service: z.string().max(5000), + status: z.enum(["complete", "pending"]), + transaction_amount: z.coerce.number(), + transaction_count: z.coerce.number(), +}) + export const s_PostIssuingSettlementsSettlementRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), metadata: z.record(z.string(), z.string()).optional(), }) -export const s_issuing_token: z.ZodType = z.object({ - card: z.union([z.string().max(5000), z.lazy(() => s_issuing_card)]), +export const s_issuing_token = z.object({ + card: z.union([z.string().max(5000), s_issuing_card]), created: z.coerce.number(), device_fingerprint: z.string().max(5000).nullable().optional(), id: z.string().max(5000), @@ -29387,22 +28950,22 @@ export const s_issuing_transaction: z.ZodType = z.object( amount: z.coerce.number(), amount_details: s_issuing_transaction_amount_details.nullable().optional(), authorization: z - .union([z.string().max(5000), z.lazy(() => s_issuing_authorization)]) + .union([z.string().max(5000), s_issuing_authorization]) .nullable() .optional(), balance_transaction: z .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) .nullable() .optional(), - card: z.union([z.string().max(5000), z.lazy(() => s_issuing_card)]), + card: z.union([z.string().max(5000), s_issuing_card]), cardholder: z - .union([z.string().max(5000), z.lazy(() => s_issuing_cardholder)]) + .union([z.string().max(5000), s_issuing_cardholder]) .nullable() .optional(), created: z.coerce.number(), currency: z.string(), dispute: z - .union([z.string().max(5000), z.lazy(() => s_issuing_dispute)]) + .union([z.string().max(5000), s_issuing_dispute]) .nullable() .optional(), id: z.string().max(5000), @@ -29417,7 +28980,7 @@ export const s_issuing_transaction: z.ZodType = z.object( .nullable() .optional(), token: z - .union([z.string().max(5000), z.lazy(() => s_issuing_token)]) + .union([z.string().max(5000), s_issuing_token]) .nullable() .optional(), treasury: s_issuing_transaction_treasury.nullable().optional(), @@ -37408,6 +36971,13 @@ export const s_PostProductsIdRequestBody = z.object({ url: z.union([z.string(), z.literal("")]).optional(), }) +export const s_product_feature = z.object({ + entitlement_feature: s_entitlements_feature, + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("product_feature"), +}) + export const s_PostProductsProductFeaturesRequestBody = z.object({ entitlement_feature: z.string().max(5000), expand: z.array(z.string().max(5000)).optional(), @@ -37940,12 +37510,59 @@ export const s_radar_payment_evaluation: z.ZodType = signals: s_insights_resources_payment_evaluation_signals, }) +export const s_radar_value_list_item = z.object({ + created: z.coerce.number(), + created_by: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("radar.value_list_item"), + value: z.string().max(5000), + value_list: z.string().max(5000), +}) + export const s_PostRadarValueListItemsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), value: z.string().max(800), value_list: z.string().max(5000), }) +export const s_deleted_radar_value_list_item = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("radar.value_list_item"), +}) + +export const s_radar_value_list = z.object({ + alias: z.string().max(5000), + created: z.coerce.number(), + created_by: z.string().max(5000), + id: z.string().max(5000), + item_type: z.enum([ + "account", + "card_bin", + "card_fingerprint", + "case_sensitive_string", + "country", + "crypto_fingerprint", + "customer_id", + "email", + "ip_address", + "sepa_debit_fingerprint", + "string", + "us_bank_account_fingerprint", + ]), + list_items: z.object({ + data: z.array(s_radar_value_list_item), + has_more: PermissiveBoolean, + object: z.literal("list"), + url: z.string().max(5000), + }), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + name: z.string().max(5000), + object: z.literal("radar.value_list"), +}) + export const s_PostRadarValueListsRequestBody = z.object({ alias: z.string().max(100), expand: z.array(z.string().max(5000)).optional(), @@ -37969,6 +37586,12 @@ export const s_PostRadarValueListsRequestBody = z.object({ name: z.string().max(100), }) +export const s_deleted_radar_value_list = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("radar.value_list"), +}) + export const s_PostRadarValueListsValueListRequestBody = z.object({ alias: z.string().max(100).optional(), expand: z.array(z.string().max(5000)).optional(), @@ -38682,6 +38305,18 @@ export const s_PostReportingReportRunsRequestBody = z.object({ report_type: z.string(), }) +export const s_reporting_report_type = z.object({ + data_available_end: z.coerce.number(), + data_available_start: z.coerce.number(), + default_columns: z.array(z.string().max(5000)).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("reporting.report_type"), + updated: z.coerce.number(), + version: z.coerce.number(), +}) + export const s_review: z.ZodType = z.object({ billing_zip: z.string().max(5000).nullable().optional(), charge: z @@ -41164,6 +40799,15 @@ export const s_PostSigmaSavedQueriesIdRequestBody = z.object({ sql: z.string().max(100000).optional(), }) +export const s_sigma_sigma_api_query = z.object({ + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("sigma.sigma_api_query"), + sql: z.string().max(5000), +}) + export const s_scheduled_query_run: z.ZodType = z.object( { created: z.coerce.number(), @@ -43106,6 +42750,17 @@ export const s_PostSubscriptionsSubscriptionResumeRequestBody = z.object({ proration_date: z.coerce.number().optional(), }) +export const s_tax_association = z.object({ + calculation: z.string().max(5000), + id: z.string().max(5000), + object: z.literal("tax.association"), + payment_intent: z.string().max(5000), + tax_transaction_attempts: z + .array(s_tax_product_resource_tax_association_transaction_attempts) + .nullable() + .optional(), +}) + export const s_PostTaxCalculationsRequestBody = z.object({ currency: z.string(), customer: z.string().max(5000).optional(), @@ -43290,6 +42945,69 @@ export const s_PostTaxCalculationsRequestBody = z.object({ tax_date: z.coerce.number().optional(), }) +export const s_tax_calculation = z.object({ + amount_total: z.coerce.number(), + currency: z.string().max(5000), + customer: z.string().max(5000).nullable().optional(), + customer_details: s_tax_product_resource_customer_details, + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000).nullable().optional(), + line_items: z + .object({ + data: z.array(s_tax_calculation_line_item), + has_more: PermissiveBoolean, + object: z.literal("list"), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/calculations/[^/]+/line_items")), + }) + .nullable() + .optional(), + livemode: PermissiveBoolean, + object: z.literal("tax.calculation"), + ship_from_details: s_tax_product_resource_ship_from_details + .nullable() + .optional(), + shipping_cost: s_tax_product_resource_tax_calculation_shipping_cost + .nullable() + .optional(), + tax_amount_exclusive: z.coerce.number(), + tax_amount_inclusive: z.coerce.number(), + tax_breakdown: z.array(s_tax_product_resource_tax_breakdown), + tax_date: z.coerce.number(), +}) + +export const s_tax_calculation_line_item = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + object: z.literal("tax.calculation_line_item"), + product: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number(), + reference: z.string().max(5000), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_breakdown: z + .array(s_tax_product_resource_line_item_tax_breakdown) + .nullable() + .optional(), + tax_code: z.string().max(5000), +}) + +export const s_tax_registration = z.object({ + active_from: z.coerce.number(), + country: z.string().max(5000), + country_options: s_tax_product_registrations_resource_country_options, + created: z.coerce.number(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("tax.registration"), + status: z.enum(["active", "expired", "scheduled"]), +}) + export const s_PostTaxRegistrationsRequestBody = z.object({ active_from: z.union([z.literal("now"), z.coerce.number()]), country: z.string().max(5000), @@ -44127,6 +43845,17 @@ export const s_PostTaxRegistrationsIdRequestBody = z.object({ .optional(), }) +export const s_tax_settings = z.object({ + defaults: s_tax_product_resource_tax_settings_defaults, + head_office: s_tax_product_resource_tax_settings_head_office + .nullable() + .optional(), + livemode: PermissiveBoolean, + object: z.literal("tax.settings"), + status: z.enum(["active", "pending"]), + status_details: s_tax_product_resource_tax_settings_status_details, +}) + export const s_PostTaxSettingsRequestBody = z.object({ defaults: z .object({ @@ -44159,6 +43888,42 @@ export const s_PostTaxTransactionsCreateFromCalculationRequestBody = z.object({ reference: z.string().max(500), }) +export const s_tax_transaction = z.object({ + created: z.coerce.number(), + currency: z.string().max(5000), + customer: z.string().max(5000).nullable().optional(), + customer_details: s_tax_product_resource_customer_details, + id: z.string().max(5000), + line_items: z + .object({ + data: z.array(s_tax_transaction_line_item), + has_more: PermissiveBoolean, + object: z.literal("list"), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/transactions/[^/]+/line_items")), + }) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + object: z.literal("tax.transaction"), + posted_at: z.coerce.number(), + reference: z.string().max(5000), + reversal: s_tax_product_resource_tax_transaction_resource_reversal + .nullable() + .optional(), + ship_from_details: s_tax_product_resource_ship_from_details + .nullable() + .optional(), + shipping_cost: s_tax_product_resource_tax_transaction_shipping_cost + .nullable() + .optional(), + tax_date: z.coerce.number(), + type: z.enum(["reversal", "transaction"]), +}) + export const s_PostTaxTransactionsCreateReversalRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), flat_amount: z.coerce.number().optional(), @@ -44183,6 +43948,24 @@ export const s_PostTaxTransactionsCreateReversalRequestBody = z.object({ .optional(), }) +export const s_tax_transaction_line_item = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + object: z.literal("tax.transaction_line_item"), + product: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number(), + reference: z.string().max(5000), + reversal: s_tax_product_resource_tax_transaction_line_item_resource_reversal + .nullable() + .optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_code: z.string().max(5000), + type: z.enum(["reversal", "transaction"]), +}) + export const s_PostTaxIdsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), owner: z @@ -44647,6 +44430,12 @@ export const s_PostTerminalConfigurationsRequestBody = z.object({ .optional(), }) +export const s_deleted_terminal_configuration = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("terminal.configuration"), +}) + export const s_PostTerminalConfigurationsConfigurationRequestBody = z.object({ bbpos_wisepad3: z .union([ @@ -44909,6 +44698,27 @@ export const s_PostTerminalConnectionTokensRequestBody = z.object({ location: z.string().max(5000).optional(), }) +export const s_terminal_connection_token = z.object({ + location: z.string().max(5000).optional(), + object: z.literal("terminal.connection_token"), + secret: z.string().max(5000), +}) + +export const s_terminal_location = z.object({ + address: s_address, + address_kana: s_legal_entity_japan_address.optional(), + address_kanji: s_legal_entity_japan_address.optional(), + configuration_overrides: z.string().max(5000).optional(), + display_name: z.string().max(5000), + display_name_kana: z.string().max(5000).optional(), + display_name_kanji: z.string().max(5000).optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + object: z.literal("terminal.location"), + phone: z.string().max(5000).optional(), +}) + export const s_PostTerminalLocationsRequestBody = z.object({ address: z .object({ @@ -44953,6 +44763,12 @@ export const s_PostTerminalLocationsRequestBody = z.object({ phone: z.string().optional(), }) +export const s_deleted_terminal_location = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("terminal.location"), +}) + export const s_PostTerminalLocationsLocationRequestBody = z.object({ address: z .object({ @@ -45013,6 +44829,14 @@ export const s_PostTerminalOnboardingLinksRequestBody = z.object({ on_behalf_of: z.string().max(5000).optional(), }) +export const s_terminal_onboarding_link = z.object({ + link_options: s_terminal_onboarding_link_link_options, + link_type: z.literal("apple_terms_and_conditions"), + object: z.literal("terminal.onboarding_link"), + on_behalf_of: z.string().max(5000).nullable().optional(), + redirect_url: z.string().max(5000), +}) + export const s_terminal_reader: z.ZodType = z.object({ action: z .lazy(() => s_terminal_reader_reader_resource_reader_action) @@ -45065,6 +44889,34 @@ export const s_PostTerminalReadersRequestBody = z.object({ registration_code: z.string().max(5000), }) +export const s_deleted_terminal_reader = z.object({ + deleted: PermissiveLiteralTrue, + device_type: z.enum([ + "bbpos_chipper2x", + "bbpos_wisepad3", + "bbpos_wisepos_e", + "mobile_phone_reader", + "simulated_stripe_s700", + "simulated_stripe_s710", + "simulated_verifone_m425", + "simulated_verifone_p630", + "simulated_verifone_ux700", + "simulated_verifone_v660p", + "simulated_wisepos_e", + "stripe_m2", + "stripe_s700", + "stripe_s710", + "verifone_P400", + "verifone_m425", + "verifone_p630", + "verifone_ux700", + "verifone_v660p", + ]), + id: z.string().max(5000), + object: z.literal("terminal.reader"), + serial_number: z.string().max(5000), +}) + export const s_PostTerminalReadersReaderRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), label: z.union([z.string().max(5000), z.literal("")]).optional(), @@ -45211,6 +45063,8 @@ export const s_PostTerminalRefundsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_terminal_refund = z.record(z.string(), z.unknown()) + export const s_PostTestHelpersConfirmationTokensRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), payment_method: z.string().max(5000).optional(), @@ -47238,6 +47092,18 @@ export const s_PostTestHelpersTerminalReadersReaderSucceedInputCollectionRequest export const s_PostTestHelpersTerminalReadersReaderTimeoutInputCollectionRequestBody = z.object({expand: z.array(z.string().max(5000)).optional()}) +export const s_test_helpers_test_clock = z.object({ + created: z.coerce.number(), + deletes_after: z.coerce.number(), + frozen_time: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000).nullable().optional(), + object: z.literal("test_helpers.test_clock"), + status: z.enum(["advancing", "internal_failure", "ready"]), + status_details: s_billing_clocks_resource_status_details_status_details, +}) + export const s_PostTestHelpersTestClocksRequestBody = z.object({ customer: z.string().max(5000).optional(), expand: z.array(z.string().max(5000)).optional(), @@ -47245,6 +47111,12 @@ export const s_PostTestHelpersTestClocksRequestBody = z.object({ name: z.string().max(300).optional(), }) +export const s_deleted_test_helpers_test_clock = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("test_helpers.test_clock"), +}) + export const s_PostTestHelpersTestClocksTestClockAdvanceRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), frozen_time: z.coerce.number(), @@ -47305,7 +47177,7 @@ export const s_treasury_inbound_transfer: z.ZodType status_transitions: s_treasury_inbound_transfers_resource_inbound_transfer_resource_status_transitions, transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .union([z.string().max(5000), s_treasury_transaction]) .nullable() .optional(), }) @@ -47367,10 +47239,7 @@ export const s_treasury_outbound_payment: z.ZodType s_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details .nullable() .optional(), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_treasury_transaction), - ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), }) export const s_PostTestHelpersTreasuryOutboundPaymentsIdFailRequestBody = @@ -47448,10 +47317,7 @@ export const s_treasury_outbound_transfer: z.ZodType s_treasury_transaction), - ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), }) export const s_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBody = @@ -47535,7 +47401,7 @@ export const s_treasury_received_credit: z.ZodType = .optional(), status: z.enum(["failed", "succeeded"]), transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .union([z.string().max(5000), s_treasury_transaction]) .nullable() .optional(), }) @@ -47561,40 +47427,39 @@ export const s_PostTestHelpersTreasuryReceivedDebitsRequestBody = z.object({ network: z.literal("ach"), }) -export const s_treasury_received_debit: z.ZodType = - z.object({ - amount: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - description: z.string().max(5000), - failure_code: z - .enum([ - "account_closed", - "account_frozen", - "insufficient_funds", - "international_transaction", - "other", - ]) - .nullable() - .optional(), - financial_account: z.string().max(5000).nullable().optional(), - hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - initiating_payment_method_details: - s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details.optional(), - linked_flows: s_treasury_received_debits_resource_linked_flows, - livemode: PermissiveBoolean, - network: z.enum(["ach", "card", "stripe"]), - object: z.literal("treasury.received_debit"), - reversal_details: s_treasury_received_debits_resource_reversal_details - .nullable() - .optional(), - status: z.enum(["failed", "succeeded"]), - transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) - .nullable() - .optional(), - }) +export const s_treasury_received_debit = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000), + failure_code: z + .enum([ + "account_closed", + "account_frozen", + "insufficient_funds", + "international_transaction", + "other", + ]) + .nullable() + .optional(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + initiating_payment_method_details: + s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details.optional(), + linked_flows: s_treasury_received_debits_resource_linked_flows, + livemode: PermissiveBoolean, + network: z.enum(["ach", "card", "stripe"]), + object: z.literal("treasury.received_debit"), + reversal_details: s_treasury_received_debits_resource_reversal_details + .nullable() + .optional(), + status: z.enum(["failed", "succeeded"]), + transaction: z + .union([z.string().max(5000), s_treasury_transaction]) + .nullable() + .optional(), +}) export const s_PostTokensRequestBody = z.object({ account: z @@ -48235,26 +48100,25 @@ export const s_PostTransfersTransferReversalsIdRequestBody = z.object({ .optional(), }) -export const s_treasury_credit_reversal: z.ZodType = - z.object({ - amount: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - financial_account: z.string().max(5000), - hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - network: z.enum(["ach", "stripe"]), - object: z.literal("treasury.credit_reversal"), - received_credit: z.string().max(5000), - status: z.enum(["canceled", "posted", "processing"]), - status_transitions: s_treasury_received_credits_resource_status_transitions, - transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) - .nullable() - .optional(), - }) +export const s_treasury_credit_reversal = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + financial_account: z.string().max(5000), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + network: z.enum(["ach", "stripe"]), + object: z.literal("treasury.credit_reversal"), + received_credit: z.string().max(5000), + status: z.enum(["canceled", "posted", "processing"]), + status_transitions: s_treasury_received_credits_resource_status_transitions, + transaction: z + .union([z.string().max(5000), s_treasury_transaction]) + .nullable() + .optional(), +}) export const s_PostTreasuryCreditReversalsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), @@ -48262,30 +48126,28 @@ export const s_PostTreasuryCreditReversalsRequestBody = z.object({ received_credit: z.string().max(5000), }) -export const s_treasury_debit_reversal: z.ZodType = - z.object({ - amount: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - financial_account: z.string().max(5000).nullable().optional(), - hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - linked_flows: - s_treasury_received_debits_resource_debit_reversal_linked_flows - .nullable() - .optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - network: z.enum(["ach", "card"]), - object: z.literal("treasury.debit_reversal"), - received_debit: z.string().max(5000), - status: z.enum(["failed", "processing", "succeeded"]), - status_transitions: s_treasury_received_debits_resource_status_transitions, - transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) - .nullable() - .optional(), - }) +export const s_treasury_debit_reversal = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + linked_flows: s_treasury_received_debits_resource_debit_reversal_linked_flows + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + network: z.enum(["ach", "card"]), + object: z.literal("treasury.debit_reversal"), + received_debit: z.string().max(5000), + status: z.enum(["failed", "processing", "succeeded"]), + status_transitions: s_treasury_received_debits_resource_status_transitions, + transaction: z + .union([z.string().max(5000), s_treasury_transaction]) + .nullable() + .optional(), +}) export const s_PostTreasuryDebitReversalsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), @@ -48293,6 +48155,80 @@ export const s_PostTreasuryDebitReversalsRequestBody = z.object({ received_debit: z.string().max(5000), }) +export const s_treasury_financial_account = z.object({ + active_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + balance: s_treasury_financial_accounts_resource_balance, + country: z.string().max(5000), + created: z.coerce.number(), + features: s_treasury_financial_account_features.optional(), + financial_addresses: z.array( + s_treasury_financial_accounts_resource_financial_address, + ), + id: z.string().max(5000), + is_default: PermissiveBoolean.optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + nickname: z.string().max(5000).nullable().optional(), + object: z.literal("treasury.financial_account"), + pending_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + platform_restrictions: + s_treasury_financial_accounts_resource_platform_restrictions + .nullable() + .optional(), + restricted_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + status: z.enum(["closed", "open"]), + status_details: s_treasury_financial_accounts_resource_status_details, + supported_currencies: z.array(z.string()), +}) + export const s_PostTreasuryFinancialAccountsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), features: z @@ -48392,6 +48328,24 @@ export const s_PostTreasuryFinancialAccountsFinancialAccountCloseRequestBody = .optional(), }) +export const s_treasury_financial_account_features = z.object({ + card_issuing: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + deposit_insurance: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + financial_addresses: + s_treasury_financial_accounts_resource_financial_addresses_features.optional(), + inbound_transfers: + s_treasury_financial_accounts_resource_inbound_transfers.optional(), + intra_stripe_flows: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + object: z.literal("treasury.financial_account_features"), + outbound_payments: + s_treasury_financial_accounts_resource_outbound_payments.optional(), + outbound_transfers: + s_treasury_financial_accounts_resource_outbound_transfers.optional(), +}) + export const s_PostTreasuryFinancialAccountsFinancialAccountFeaturesRequestBody = z.object({ card_issuing: z.object({requested: PermissiveBoolean}).optional(), @@ -48553,10 +48507,7 @@ export const s_treasury_transaction_entry: z.ZodType s_treasury_transaction), - ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), type: z.enum([ "credit_reversal", "credit_reversal_posting", @@ -48590,7 +48541,7 @@ export const s_treasury_transaction: z.ZodType = description: z.string().max(5000), entries: z .object({ - data: z.array(z.lazy(() => s_treasury_transaction_entry)), + data: z.array(s_treasury_transaction_entry), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -49633,6 +49584,14 @@ export const s_payment_pages_checkout_session_total_details: z.ZodType = z.object({amount: z.coerce.number(), discount: z.lazy(() => s_discount)}) +export const s_climate_removals_order_deliveries = z.object({ + delivered_at: z.coerce.number(), + location: s_climate_removals_location.nullable().optional(), + metric_tons: z.string().max(5000), + registry_url: z.string().max(5000).nullable().optional(), + supplier: s_climate_supplier, +}) + export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType = z.object({ acss_debit: s_payment_method_acss_debit.optional(), @@ -49773,10 +49732,7 @@ export const s_credit_notes_pretax_credit_amount: z.ZodType s_billing_credit_balance_transaction), - ]) + .union([z.string().max(5000), s_billing_credit_balance_transaction]) .optional(), discount: z .union([ @@ -49979,6 +49935,18 @@ export const s_bank_connections_resource_accountholder: z.ZodType = z.object({ charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]).optional(), @@ -50059,10 +50027,7 @@ export const s_invoices_resource_pretax_credit_amount: z.ZodType s_billing_credit_balance_transaction), - ]) + .union([z.string().max(5000), s_billing_credit_balance_transaction]) .nullable() .optional(), discount: z @@ -50503,25 +50468,21 @@ export const s_outbound_payments_payment_method_details: z.ZodType = - z.object({ - code: z.enum([ - "account_closed", - "account_frozen", - "bank_account_restricted", - "bank_ownership_changed", - "declined", - "incorrect_account_holder_name", - "invalid_account_number", - "invalid_currency", - "no_account", - "other", - ]), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_treasury_transaction), - ]), - }) +export const s_treasury_outbound_payments_resource_returned_status = z.object({ + code: z.enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), +}) export const s_outbound_transfers_payment_method_details: z.ZodType = z.object({ @@ -50534,8 +50495,8 @@ export const s_outbound_transfers_payment_method_details: z.ZodType = - z.object({ +export const s_treasury_outbound_transfers_resource_returned_details = z.object( + { code: z.enum([ "account_closed", "account_frozen", @@ -50548,11 +50509,9 @@ export const s_treasury_outbound_transfers_resource_returned_details: z.ZodType< "no_account", "other", ]), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_treasury_transaction), - ]), - }) + transaction: z.union([z.string().max(5000), s_treasury_transaction]), + }, +) export const s_treasury_received_credits_resource_linked_flows: z.ZodType = z.object({ @@ -50567,28 +50526,27 @@ export const s_treasury_received_credits_resource_linked_flows: z.ZodType = - z.object({ - credit_reversal: z.lazy(() => s_treasury_credit_reversal.optional()), - debit_reversal: z.lazy(() => s_treasury_debit_reversal.optional()), - inbound_transfer: z.lazy(() => s_treasury_inbound_transfer.optional()), - issuing_authorization: z.lazy(() => s_issuing_authorization.optional()), - outbound_payment: z.lazy(() => s_treasury_outbound_payment.optional()), - outbound_transfer: z.lazy(() => s_treasury_outbound_transfer.optional()), - received_credit: z.lazy(() => s_treasury_received_credit.optional()), - received_debit: z.lazy(() => s_treasury_received_debit.optional()), - type: z.enum([ - "credit_reversal", - "debit_reversal", - "inbound_transfer", - "issuing_authorization", - "other", - "outbound_payment", - "outbound_transfer", - "received_credit", - "received_debit", - ]), - }) +export const s_treasury_transactions_resource_flow_details = z.object({ + credit_reversal: s_treasury_credit_reversal.optional(), + debit_reversal: s_treasury_debit_reversal.optional(), + inbound_transfer: s_treasury_inbound_transfer.optional(), + issuing_authorization: s_issuing_authorization.optional(), + outbound_payment: s_treasury_outbound_payment.optional(), + outbound_transfer: s_treasury_outbound_transfer.optional(), + received_credit: s_treasury_received_credit.optional(), + received_debit: s_treasury_received_debit.optional(), + type: z.enum([ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ]), +}) export const s_legal_entity_company_verification: z.ZodType = z.object({ @@ -51506,9 +51464,9 @@ export const s_outbound_transfers_payment_method_details_us_bank_account: z.ZodT export const s_treasury_received_credits_resource_source_flows_details: z.ZodType = z.object({ - credit_reversal: z.lazy(() => s_treasury_credit_reversal.optional()), - outbound_payment: z.lazy(() => s_treasury_outbound_payment.optional()), - outbound_transfer: z.lazy(() => s_treasury_outbound_transfer.optional()), + credit_reversal: s_treasury_credit_reversal.optional(), + outbound_payment: s_treasury_outbound_payment.optional(), + outbound_transfer: s_treasury_outbound_transfer.optional(), payout: z.lazy(() => s_payout.optional()), type: z.enum([ "credit_reversal", diff --git a/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts b/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts index efc598844..538cd7b36 100644 --- a/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts +++ b/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts @@ -834,13 +834,13 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), - result: s_Widget.optional(), + error: s_Azure_Core_Foundations_Error.optional(), + result: z.lazy(() => s_Widget.optional()), }), z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ]), ], @@ -1069,7 +1069,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ], ], @@ -1332,7 +1332,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), result: s_WidgetRepairRequest.optional(), }), ], @@ -1404,7 +1404,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), result: z .object({ requestState: s_WidgetRepairState, @@ -1497,8 +1497,8 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), - result: s_WidgetPart.optional(), + error: s_Azure_Core_Foundations_Error.optional(), + result: z.lazy(() => s_WidgetPart.optional()), }), ], ], @@ -1842,7 +1842,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ], ], @@ -1918,8 +1918,8 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), - result: s_Manufacturer.optional(), + error: s_Azure_Core_Foundations_Error.optional(), + result: z.lazy(() => s_Manufacturer.optional()), }), ], ], @@ -2153,7 +2153,7 @@ export function createRouter( z.object({ id: z.string(), status: s_Azure_Core_Foundations_OperationState, - error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + error: s_Azure_Core_Foundations_Error.optional(), }), ], ], diff --git a/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/schemas.ts b/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/schemas.ts index f07316aef..f4eb2a136 100644 --- a/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/schemas.ts +++ b/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/schemas.ts @@ -4,20 +4,11 @@ import {z} from "zod/v4" import type { - t_Azure_Core_Foundations_Error, - t_Azure_Core_Foundations_ErrorResponse, - t_Azure_Core_Foundations_InnerError, + t_PagedManufacturer, + t_PagedWidget, + t_PagedWidgetPart, } from "./models" -export const s_Azure_Core_Foundations_OperationState = z.union([ - z.enum(["NotStarted", "Running", "Succeeded", "Failed", "Canceled"]), - z.string(), -]) - -export const s_Azure_Core_eTag = z.string() - -export const s_Azure_Core_uuid = z.string() - export const s_WidgetAnalytics = z.object({ id: z.literal("current"), useCount: z.coerce.number(), @@ -41,11 +32,36 @@ export const s_WidgetRepairState = z.union([ z.enum(["Succeeded", "Failed", "Canceled", "SentToManufacturer"]), ]) -export const s_Manufacturer = z.object({ - id: z.string(), - name: z.string(), - address: z.string(), - etag: s_Azure_Core_eTag, +export const s_WidgetCreateOrUpdate = z.object({ + color: s_WidgetColor.optional(), + manufacturerId: z.string().optional(), +}) + +export const s_WidgetRepairRequest = z.object({ + requestState: s_WidgetRepairState, + scheduledDateTime: z.iso.datetime({offset: true}), + createdDateTime: z.iso.datetime({offset: true}), + updatedDateTime: z.iso.datetime({offset: true}), + completedDateTime: z.iso.datetime({offset: true}), +}) + +export const s_Azure_Core_uuid = z.string() + +export const s_Azure_Core_Foundations_ErrorResponse = z.object({ + error: s_Azure_Core_Foundations_Error, +}) + +export const s_Azure_Core_Foundations_OperationState = z.union([ + z.enum(["NotStarted", "Running", "Succeeded", "Failed", "Canceled"]), + z.string(), +]) + +export const s_Azure_Core_Foundations_Error = z.object({ + code: z.string(), + message: z.string(), + target: z.string().optional(), + details: z.array(s_Azure_Core_Foundations_Error).optional(), + innererror: s_Azure_Core_Foundations_InnerError.optional(), }) export const s_Widget = z.object({ @@ -55,9 +71,9 @@ export const s_Widget = z.object({ etag: s_Azure_Core_eTag, }) -export const s_WidgetCreateOrUpdate = z.object({ - color: s_WidgetColor.optional(), - manufacturerId: z.string().optional(), +export const s_PagedWidget: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_Widget)), + nextLink: z.string().optional(), }) export const s_WidgetPart = z.object({ @@ -67,43 +83,26 @@ export const s_WidgetPart = z.object({ etag: s_Azure_Core_eTag, }) -export const s_WidgetRepairRequest = z.object({ - requestState: s_WidgetRepairState, - scheduledDateTime: z.iso.datetime({offset: true}), - createdDateTime: z.iso.datetime({offset: true}), - updatedDateTime: z.iso.datetime({offset: true}), - completedDateTime: z.iso.datetime({offset: true}), +export const s_PagedWidgetPart: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_WidgetPart)), + nextLink: z.string().optional(), }) -export const s_PagedManufacturer = z.object({ - value: z.array(s_Manufacturer), - nextLink: z.string().optional(), +export const s_Manufacturer = z.object({ + id: z.string(), + name: z.string(), + address: z.string(), + etag: s_Azure_Core_eTag, }) -export const s_PagedWidget = z.object({ - value: z.array(s_Widget), +export const s_PagedManufacturer: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_Manufacturer)), nextLink: z.string().optional(), }) -export const s_PagedWidgetPart = z.object({ - value: z.array(s_WidgetPart), - nextLink: z.string().optional(), +export const s_Azure_Core_Foundations_InnerError = z.object({ + code: z.string().optional(), + innererror: s_Azure_Core_Foundations_InnerError.optional(), }) -export const s_Azure_Core_Foundations_ErrorResponse: z.ZodType = - z.object({error: z.lazy(() => s_Azure_Core_Foundations_Error)}) - -export const s_Azure_Core_Foundations_Error: z.ZodType = - z.object({ - code: z.string(), - message: z.string(), - target: z.string().optional(), - details: z.array(z.lazy(() => s_Azure_Core_Foundations_Error)).optional(), - innererror: z.lazy(() => s_Azure_Core_Foundations_InnerError.optional()), - }) - -export const s_Azure_Core_Foundations_InnerError: z.ZodType = - z.object({ - code: z.string().optional(), - innererror: z.lazy(() => s_Azure_Core_Foundations_InnerError.optional()), - }) +export const s_Azure_Core_eTag = z.string() diff --git a/integration-tests/typescript-koa/src/generated/azure-resource-manager.tsp/schemas.ts b/integration-tests/typescript-koa/src/generated/azure-resource-manager.tsp/schemas.ts index 37a70c2cd..36ab88583 100644 --- a/integration-tests/typescript-koa/src/generated/azure-resource-manager.tsp/schemas.ts +++ b/integration-tests/typescript-koa/src/generated/azure-resource-manager.tsp/schemas.ts @@ -3,10 +3,7 @@ /* eslint-disable */ import {z} from "zod/v4" -import type { - t_Azure_ResourceManager_CommonTypes_ErrorDetail, - t_Azure_ResourceManager_CommonTypes_ErrorResponse, -} from "./models" +import type {t_EmployeeListResult} from "./models" export const PermissiveBoolean = z.preprocess((value) => { if (typeof value === "string" && (value === "true" || value === "false")) { @@ -17,38 +14,6 @@ export const PermissiveBoolean = z.preprocess((value) => { return value }, z.boolean()) -export const s_Azure_Core_armResourceType = z.string() - -export const s_Azure_Core_azureLocation = z.string() - -export const s_Azure_Core_uuid = z.string() - -export const s_Azure_ResourceManager_CommonTypes_ActionType = z.union([ - z.literal("Internal"), - z.string(), -]) - -export const s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = z.object( - {type: z.string().optional(), info: z.unknown().optional()}, -) - -export const s_Azure_ResourceManager_CommonTypes_OperationDisplay = z.object({ - provider: z.string().optional(), - resource: z.string().optional(), - operation: z.string().optional(), - description: z.string().optional(), -}) - -export const s_Azure_ResourceManager_CommonTypes_Origin = z.union([ - z.enum(["user", "system", "user,system"]), - z.string(), -]) - -export const s_Azure_ResourceManager_CommonTypes_createdByType = z.union([ - z.enum(["User", "Application", "ManagedIdentity", "Key"]), - z.string(), -]) - export const s_EmployeeUpdateProperties = z.object({ age: z.coerce.number().optional(), city: z.string().optional(), @@ -72,24 +37,6 @@ export const s_ProvisioningState = z.union([ ]), ]) -export const s_Azure_ResourceManager_CommonTypes_Operation = z.object({ - name: z.string().optional(), - isDataAction: PermissiveBoolean.optional(), - display: s_Azure_ResourceManager_CommonTypes_OperationDisplay.optional(), - origin: s_Azure_ResourceManager_CommonTypes_Origin.optional(), - actionType: s_Azure_ResourceManager_CommonTypes_ActionType.optional(), -}) - -export const s_Azure_ResourceManager_CommonTypes_SystemData = z.object({ - createdBy: z.string().optional(), - createdByType: s_Azure_ResourceManager_CommonTypes_createdByType.optional(), - createdAt: z.iso.datetime({offset: true}).optional(), - lastModifiedBy: z.string().optional(), - lastModifiedByType: - s_Azure_ResourceManager_CommonTypes_createdByType.optional(), - lastModifiedAt: z.iso.datetime({offset: true}).optional(), -}) - export const s_EmployeeProperties = z.object({ age: z.coerce.number().optional(), city: z.string().optional(), @@ -102,50 +49,94 @@ export const s_EmployeeUpdate = z.object({ properties: s_EmployeeUpdateProperties.optional(), }) -export const s_Azure_ResourceManager_CommonTypes_Resource = z.object({ - id: z.string().optional(), - name: z.string().optional(), - type: s_Azure_Core_armResourceType.optional(), - systemData: s_Azure_ResourceManager_CommonTypes_SystemData.optional(), -}) - export const s_OperationListResult = z.object({ value: z.array(s_Azure_ResourceManager_CommonTypes_Operation), nextLink: z.string().optional(), }) -export const s_Azure_ResourceManager_CommonTypes_TrackedResource = - s_Azure_ResourceManager_CommonTypes_Resource.extend({ - tags: z.record(z.string(), z.string()).optional(), - location: s_Azure_Core_azureLocation, - }) +export const s_Azure_ResourceManager_CommonTypes_ErrorResponse = z.object({ + error: s_Azure_ResourceManager_CommonTypes_ErrorDetail.optional(), +}) + +export const s_Azure_Core_uuid = z.string() export const s_Employee = z.intersection( s_Azure_ResourceManager_CommonTypes_TrackedResource, z.object({properties: s_EmployeeProperties.optional()}), ) -export const s_EmployeeListResult = z.object({ - value: z.array(s_Employee), +export const s_EmployeeListResult: z.ZodType = z.object({ + value: z.array(z.lazy(() => s_Employee)), nextLink: z.string().optional(), }) -export const s_Azure_ResourceManager_CommonTypes_ErrorResponse: z.ZodType = - z.object({ - error: z.lazy(() => - s_Azure_ResourceManager_CommonTypes_ErrorDetail.optional(), - ), - }) +export const s_Azure_ResourceManager_CommonTypes_Operation = z.object({ + name: z.string().optional(), + isDataAction: PermissiveBoolean.optional(), + display: s_Azure_ResourceManager_CommonTypes_OperationDisplay.optional(), + origin: s_Azure_ResourceManager_CommonTypes_Origin.optional(), + actionType: s_Azure_ResourceManager_CommonTypes_ActionType.optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_ErrorDetail = z.object({ + code: z.string().optional(), + message: z.string().optional(), + target: z.string().optional(), + details: z.array(s_Azure_ResourceManager_CommonTypes_ErrorDetail).optional(), + additionalInfo: z + .array(s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo) + .optional(), +}) -export const s_Azure_ResourceManager_CommonTypes_ErrorDetail: z.ZodType = - z.object({ - code: z.string().optional(), - message: z.string().optional(), - target: z.string().optional(), - details: z - .array(z.lazy(() => s_Azure_ResourceManager_CommonTypes_ErrorDetail)) - .optional(), - additionalInfo: z - .array(s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo) - .optional(), +export const s_Azure_ResourceManager_CommonTypes_TrackedResource = + s_Azure_ResourceManager_CommonTypes_Resource.extend({ + tags: z.record(z.string(), z.string()).optional(), + location: s_Azure_Core_azureLocation, }) + +export const s_Azure_ResourceManager_CommonTypes_OperationDisplay = z.object({ + provider: z.string().optional(), + resource: z.string().optional(), + operation: z.string().optional(), + description: z.string().optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_Origin = z.union([ + z.enum(["user", "system", "user,system"]), + z.string(), +]) + +export const s_Azure_ResourceManager_CommonTypes_ActionType = z.union([ + z.literal("Internal"), + z.string(), +]) + +export const s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = z.object( + {type: z.string().optional(), info: z.unknown().optional()}, +) + +export const s_Azure_ResourceManager_CommonTypes_Resource = z.object({ + id: z.string().optional(), + name: z.string().optional(), + type: s_Azure_Core_armResourceType.optional(), + systemData: s_Azure_ResourceManager_CommonTypes_SystemData.optional(), +}) + +export const s_Azure_Core_azureLocation = z.string() + +export const s_Azure_Core_armResourceType = z.string() + +export const s_Azure_ResourceManager_CommonTypes_SystemData = z.object({ + createdBy: z.string().optional(), + createdByType: s_Azure_ResourceManager_CommonTypes_createdByType.optional(), + createdAt: z.iso.datetime({offset: true}).optional(), + lastModifiedBy: z.string().optional(), + lastModifiedByType: + s_Azure_ResourceManager_CommonTypes_createdByType.optional(), + lastModifiedAt: z.iso.datetime({offset: true}).optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_createdByType = z.union([ + z.enum(["User", "Application", "ManagedIdentity", "Key"]), + z.string(), +]) diff --git a/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts b/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts index bb0ee3688..295442686 100644 --- a/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts @@ -18842,7 +18842,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_billing_alert)), + data: z.array(s_billing_alert), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000).regex(new RegExp("^/v1/billing/alerts")), @@ -19283,7 +19283,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_billing_credit_balance_transaction)), + data: z.array(s_billing_credit_balance_transaction), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -19473,7 +19473,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_billing_credit_grant)), + data: z.array(s_billing_credit_grant), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -21559,7 +21559,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_checkout_session)), + data: z.array(s_checkout_session), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -28994,7 +28994,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_financial_connections_account)), + data: z.array(s_financial_connections_account), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -32572,7 +32572,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_authorization)), + data: z.array(s_issuing_authorization), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -32929,7 +32929,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_cardholder)), + data: z.array(s_issuing_cardholder), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -33231,7 +33231,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_card)), + data: z.array(s_issuing_card), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000).regex(new RegExp("^/v1/issuing/cards")), @@ -33526,7 +33526,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_dispute)), + data: z.array(s_issuing_dispute), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000).regex(new RegExp("^/v1/issuing/disputes")), @@ -33848,7 +33848,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_personalization_design)), + data: z.array(s_issuing_personalization_design), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -34445,7 +34445,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_token)), + data: z.array(s_issuing_token), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -34682,7 +34682,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_issuing_transaction)), + data: z.array(s_issuing_transaction), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -35037,7 +35037,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_financial_connections_account)), + data: z.array(s_financial_connections_account), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -39632,7 +39632,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(s_product_feature), + data: z.array(z.lazy(() => s_product_feature)), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -40835,7 +40835,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_radar_early_fraud_warning)), + data: z.array(s_radar_early_fraud_warning), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -41966,7 +41966,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_reporting_report_run)), + data: z.array(s_reporting_report_run), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -46924,7 +46924,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_terminal_configuration)), + data: z.array(s_terminal_configuration), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -47113,10 +47113,7 @@ export function createRouter( [ [ "200", - z.union([ - z.lazy(() => s_terminal_configuration), - s_deleted_terminal_configuration, - ]), + z.union([s_terminal_configuration, s_deleted_terminal_configuration]), ], ], s_error, @@ -47183,10 +47180,7 @@ export function createRouter( [ [ "200", - z.union([ - z.lazy(() => s_terminal_configuration), - s_deleted_terminal_configuration, - ]), + z.union([s_terminal_configuration, s_deleted_terminal_configuration]), ], ], s_error, @@ -47648,7 +47642,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_terminal_reader)), + data: z.array(s_terminal_reader), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -47832,12 +47826,7 @@ export function createRouter( }) const getTerminalReadersReaderResponseValidator = responseValidationFactory( - [ - [ - "200", - z.union([z.lazy(() => s_terminal_reader), s_deleted_terminal_reader]), - ], - ], + [["200", z.union([s_terminal_reader, s_deleted_terminal_reader])]], s_error, ) @@ -47893,12 +47882,7 @@ export function createRouter( }) const postTerminalReadersReaderResponseValidator = responseValidationFactory( - [ - [ - "200", - z.union([z.lazy(() => s_terminal_reader), s_deleted_terminal_reader]), - ], - ], + [["200", z.union([s_terminal_reader, s_deleted_terminal_reader])]], s_error, ) @@ -51609,7 +51593,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_credit_reversal)), + data: z.array(s_treasury_credit_reversal), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -51825,7 +51809,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_debit_reversal)), + data: z.array(s_treasury_debit_reversal), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -52520,7 +52504,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_inbound_transfer)), + data: z.array(s_treasury_inbound_transfer), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -52796,7 +52780,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_outbound_payment)), + data: z.array(s_treasury_outbound_payment), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -53079,7 +53063,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_outbound_transfer)), + data: z.array(s_treasury_outbound_transfer), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -53355,7 +53339,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_received_credit)), + data: z.array(s_treasury_received_credit), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -53532,7 +53516,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_received_debit)), + data: z.array(s_treasury_received_debit), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), @@ -53722,7 +53706,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_transaction_entry)), + data: z.array(s_treasury_transaction_entry), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -53956,7 +53940,7 @@ export function createRouter( [ "200", z.object({ - data: z.array(z.lazy(() => s_treasury_transaction)), + data: z.array(s_treasury_transaction), has_more: PermissiveBoolean, object: z.literal("list"), url: z.string().max(5000), diff --git a/integration-tests/typescript-koa/src/generated/stripe.yaml/schemas.ts b/integration-tests/typescript-koa/src/generated/stripe.yaml/schemas.ts index 5c6547af6..a2f7b1b42 100644 --- a/integration-tests/typescript-koa/src/generated/stripe.yaml/schemas.ts +++ b/integration-tests/typescript-koa/src/generated/stripe.yaml/schemas.ts @@ -31,6 +31,7 @@ import type { t_charge, t_charge_transfer_data, t_checkout_session, + t_climate_order, t_confirmation_token, t_confirmation_tokens_resource_payment_method_preview, t_connect_account_reference, @@ -76,7 +77,6 @@ import type { t_invoices_resource_from_invoice, t_invoices_resource_pretax_credit_amount, t_issuing_authorization, - t_issuing_card, t_issuing_cardholder, t_issuing_cardholder_id_document, t_issuing_cardholder_individual, @@ -92,7 +92,6 @@ import type { t_issuing_dispute_other_evidence, t_issuing_dispute_service_not_as_described_evidence, t_issuing_personalization_design, - t_issuing_token, t_issuing_transaction, t_item, t_legal_entity_company, @@ -203,20 +202,14 @@ import type { t_transfer, t_transfer_data, t_transfer_reversal, - t_treasury_credit_reversal, - t_treasury_debit_reversal, t_treasury_inbound_transfer, t_treasury_outbound_payment, - t_treasury_outbound_payments_resource_returned_status, t_treasury_outbound_transfer, - t_treasury_outbound_transfers_resource_returned_details, t_treasury_received_credit, t_treasury_received_credits_resource_linked_flows, t_treasury_received_credits_resource_source_flows_details, - t_treasury_received_debit, t_treasury_transaction, t_treasury_transaction_entry, - t_treasury_transactions_resource_flow_details, } from "./models" export const PermissiveBoolean = z.preprocess((value) => { @@ -647,26 +640,6 @@ export const s_billing_credit_grants_resource_monetary_amount = z.object({ value: z.coerce.number(), }) -export const s_billing_meter_event = z.object({ - created: z.coerce.number(), - event_name: z.string().max(100), - identifier: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("billing.meter_event"), - payload: z.record(z.string(), z.string().max(100)), - timestamp: z.coerce.number(), -}) - -export const s_billing_meter_event_summary = z.object({ - aggregated_value: z.coerce.number(), - end_time: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - meter: z.string().max(5000), - object: z.literal("billing.meter_event_summary"), - start_time: z.coerce.number(), -}) - export const s_billing_meter_resource_aggregation_settings = z.object({ formula: z.enum(["count", "last", "sum"]), }) @@ -1222,18 +1195,6 @@ export const s_deleted_product_feature = z.object({ object: z.literal("product_feature"), }) -export const s_deleted_radar_value_list = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("radar.value_list"), -}) - -export const s_deleted_radar_value_list_item = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("radar.value_list_item"), -}) - export const s_deleted_subscription_item = z.object({ deleted: PermissiveLiteralTrue, id: z.string().max(5000), @@ -1246,52 +1207,6 @@ export const s_deleted_tax_id = z.object({ object: z.literal("tax_id"), }) -export const s_deleted_terminal_configuration = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("terminal.configuration"), -}) - -export const s_deleted_terminal_location = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("terminal.location"), -}) - -export const s_deleted_terminal_reader = z.object({ - deleted: PermissiveLiteralTrue, - device_type: z.enum([ - "bbpos_chipper2x", - "bbpos_wisepad3", - "bbpos_wisepos_e", - "mobile_phone_reader", - "simulated_stripe_s700", - "simulated_stripe_s710", - "simulated_verifone_m425", - "simulated_verifone_p630", - "simulated_verifone_ux700", - "simulated_verifone_v660p", - "simulated_wisepos_e", - "stripe_m2", - "stripe_s700", - "stripe_s710", - "verifone_P400", - "verifone_m425", - "verifone_p630", - "verifone_ux700", - "verifone_v660p", - ]), - id: z.string().max(5000), - object: z.literal("terminal.reader"), - serial_number: z.string().max(5000), -}) - -export const s_deleted_test_helpers_test_clock = z.object({ - deleted: PermissiveLiteralTrue, - id: z.string().max(5000), - object: z.literal("test_helpers.test_clock"), -}) - export const s_deleted_webhook_endpoint = z.object({ deleted: PermissiveLiteralTrue, id: z.string().max(5000), @@ -1365,16 +1280,6 @@ export const s_email_sent = z.object({ email_sent_to: z.string().max(5000), }) -export const s_entitlements_feature = z.object({ - active: PermissiveBoolean, - id: z.string().max(5000), - livemode: PermissiveBoolean, - lookup_key: z.string().max(5000), - metadata: z.record(z.string(), z.string().max(500)), - name: z.string().max(80), - object: z.literal("entitlements.feature"), -}) - export const s_ephemeral_key = z.object({ created: z.coerce.number(), expires: z.coerce.number(), @@ -1398,17 +1303,6 @@ export const s_fee = z.object({ type: z.string().max(5000), }) -export const s_financial_connections_account_owner = z.object({ - email: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - name: z.string().max(5000), - object: z.literal("financial_connections.account_owner"), - ownership: z.string().max(5000), - phone: z.string().max(5000).nullable().optional(), - raw_address: z.string().max(5000).nullable().optional(), - refreshed_at: z.coerce.number().nullable().optional(), -}) - export const s_financial_reporting_finance_report_run_run_parameters = z.object( { columns: z.array(z.string().max(5000)).optional(), @@ -2903,26 +2797,6 @@ export const s_issuing_physical_bundle_features = z.object({ second_line: z.enum(["optional", "required", "unsupported"]), }) -export const s_issuing_settlement = z.object({ - bin: z.string().max(5000), - clearing_date: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - id: z.string().max(5000), - interchange_fees_amount: z.coerce.number(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - net_total_amount: z.coerce.number(), - network: z.enum(["maestro", "mastercard", "visa"]), - network_fees_amount: z.coerce.number(), - network_settlement_identifier: z.string().max(5000), - object: z.literal("issuing.settlement"), - settlement_service: z.string().max(5000), - status: z.enum(["complete", "pending"]), - transaction_amount: z.coerce.number(), - transaction_count: z.coerce.number(), -}) - export const s_issuing_transaction_amount_details = z.object({ atm_fee: z.coerce.number().nullable().optional(), cashback_amount: z.coerce.number().nullable().optional(), @@ -6119,16 +5993,6 @@ export const s_radar_review_resource_session = z.object({ version: z.string().max(5000).nullable().optional(), }) -export const s_radar_value_list_item = z.object({ - created: z.coerce.number(), - created_by: z.string().max(5000), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("radar.value_list_item"), - value: z.string().max(5000), - value_list: z.string().max(5000), -}) - export const s_received_payment_method_details_financial_account = z.object({ id: z.string().max(5000), network: z.literal("stripe"), @@ -6218,18 +6082,6 @@ export const s_refund_destination_details_us_bank_transfer = z.object({ reference_status: z.string().max(5000).nullable().optional(), }) -export const s_reporting_report_type = z.object({ - data_available_end: z.coerce.number(), - data_available_start: z.coerce.number(), - default_columns: z.array(z.string().max(5000)).nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("reporting.report_type"), - updated: z.coerce.number(), - version: z.coerce.number(), -}) - export const s_reserve_transaction = z.object({ amount: z.coerce.number(), currency: z.string(), @@ -6489,15 +6341,6 @@ export const s_sigma_scheduled_query_run_error = z.object({ message: z.string().max(5000), }) -export const s_sigma_sigma_api_query = z.object({ - created: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("sigma.sigma_api_query"), - sql: z.string().max(5000), -}) - export const s_smor_resource_managed_payments = z.object({ enabled: PermissiveBoolean, }) @@ -7175,12 +7018,6 @@ export const s_terminal_configuration_configuration_resource_personal_psk_wifi = export const s_terminal_configuration_configuration_resource_reboot_window = z.object({end_hour: z.coerce.number(), start_hour: z.coerce.number()}) -export const s_terminal_connection_token = z.object({ - location: z.string().max(5000).optional(), - object: z.literal("terminal.connection_token"), - secret: z.string().max(5000), -}) - export const s_terminal_onboarding_link_apple_terms_and_conditions = z.object({ allow_relinking: PermissiveBoolean.nullable().optional(), merchant_display_name: z.string().max(5000), @@ -7255,8 +7092,6 @@ export const s_terminal_reader_reader_resource_toggle = z.object({ value: z.enum(["disabled", "enabled"]).nullable().optional(), }) -export const s_terminal_refund = z.record(z.string(), z.unknown()) - export const s_three_d_secure_details = z.object({ authentication_flow: z .enum(["challenge", "frictionless"]) @@ -7759,18 +7594,6 @@ export const s_amazon_pay_underlying_payment_method_funding_details = z.object({ type: z.literal("card").nullable().optional(), }) -export const s_apps_secret = z.object({ - created: z.coerce.number(), - deleted: PermissiveBoolean.optional(), - expires_at: z.coerce.number().nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("apps.secret"), - payload: z.string().max(5000).nullable().optional(), - scope: s_secret_service_resource_scope, -}) - export const s_balance_amount = z.object({ amount: z.coerce.number(), currency: z.string(), @@ -7859,33 +7682,6 @@ export const s_billing_details = z.object({ tax_id: z.string().max(5000).nullable().optional(), }) -export const s_billing_meter = z.object({ - created: z.coerce.number(), - customer_mapping: s_billing_meter_resource_customer_mapping_settings, - default_aggregation: s_billing_meter_resource_aggregation_settings, - display_name: z.string().max(5000), - event_name: z.string().max(5000), - event_time_window: z.enum(["day", "hour"]).nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("billing.meter"), - status: z.enum(["active", "inactive"]), - status_transitions: s_billing_meter_resource_billing_meter_status_transitions, - updated: z.coerce.number(), - value_settings: s_billing_meter_resource_billing_meter_value, -}) - -export const s_billing_meter_event_adjustment = z.object({ - cancel: s_billing_meter_resource_billing_meter_event_adjustment_cancel - .nullable() - .optional(), - event_name: z.string().max(100), - livemode: PermissiveBoolean, - object: z.literal("billing.meter_event_adjustment"), - status: z.enum(["complete", "pending"]), - type: z.literal("cancel"), -}) - export const s_cash_balance = z.object({ available: z.record(z.string(), z.coerce.number()).nullable().optional(), customer: z.string().max(5000), @@ -7994,21 +7790,6 @@ export const s_checkout_upi_payment_method_options = z.object({ setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), }) -export const s_climate_supplier = z.object({ - id: z.string().max(5000), - info_url: z.string().max(5000), - livemode: PermissiveBoolean, - locations: z.array(s_climate_removals_location), - name: z.string().max(5000), - object: z.literal("climate.supplier"), - removal_pathway: z.enum([ - "biomass_carbon_removal_and_storage", - "direct_air_capture", - "enhanced_weathering", - "marine_carbon_removal", - ]), -}) - export const s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance = z.object({ online: @@ -8240,14 +8021,6 @@ export const s_dispute_visa_compelling_evidence3_prior_undisputed_transaction = .optional(), }) -export const s_entitlements_active_entitlement = z.object({ - feature: z.union([z.string().max(5000), s_entitlements_feature]), - id: z.string().max(5000), - livemode: PermissiveBoolean, - lookup_key: z.string().max(5000), - object: z.literal("entitlements.active_entitlement"), -}) - export const s_event = z.object({ account: z.string().max(5000).optional(), api_version: z.string().max(5000).nullable().optional(), @@ -8269,34 +8042,6 @@ export const s_external_account_requirements = z.object({ pending_verification: z.array(z.string().max(5000)).nullable().optional(), }) -export const s_financial_connections_account_ownership = z.object({ - created: z.coerce.number(), - id: z.string().max(5000), - object: z.literal("financial_connections.account_ownership"), - owners: z.object({ - data: z.array(s_financial_connections_account_owner), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z.string().max(5000), - }), -}) - -export const s_financial_connections_transaction = z.object({ - account: z.string().max(5000), - amount: z.coerce.number(), - currency: z.string().max(5000), - description: z.string().max(5000), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("financial_connections.transaction"), - status: z.enum(["pending", "posted", "void"]), - status_transitions: - s_bank_connections_resource_transaction_resource_status_transitions, - transacted_at: z.coerce.number(), - transaction_refresh: z.string().max(5000), - updated: z.coerce.number(), -}) - export const s_forwarded_request_details = z.object({ body: z.string().max(5000), headers: z.array(s_forwarded_request_header), @@ -9956,16 +9701,6 @@ export const s_issuing_network_token_wallet_provider = z.object({ suggested_decision_version: z.string().max(5000).optional(), }) -export const s_issuing_physical_bundle = z.object({ - features: s_issuing_physical_bundle_features, - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000), - object: z.literal("issuing.physical_bundle"), - status: z.enum(["active", "inactive", "review"]), - type: z.enum(["custom", "standard"]), -}) - export const s_issuing_transaction_fleet_reported_breakdown = z.object({ fuel: s_issuing_transaction_fleet_fuel_price_data.nullable().optional(), non_fuel: s_issuing_transaction_fleet_non_fuel_price_data @@ -10662,13 +10397,6 @@ export const s_portal_subscription_update_product = z.object({ product: z.string().max(5000), }) -export const s_product_feature = z.object({ - entitlement_feature: s_entitlements_feature, - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("product_feature"), -}) - export const s_promotion_codes_resource_restrictions = z.object({ currency_options: z .record(z.string(), s_promotion_code_currency_option) @@ -10683,37 +10411,6 @@ export const s_quotes_resource_subscription_data_billing_mode = z.object({ type: z.enum(["classic", "flexible"]), }) -export const s_radar_value_list = z.object({ - alias: z.string().max(5000), - created: z.coerce.number(), - created_by: z.string().max(5000), - id: z.string().max(5000), - item_type: z.enum([ - "account", - "card_bin", - "card_fingerprint", - "case_sensitive_string", - "country", - "crypto_fingerprint", - "customer_id", - "email", - "ip_address", - "sepa_debit_fingerprint", - "string", - "us_bank_account_fingerprint", - ]), - list_items: z.object({ - data: z.array(s_radar_value_list_item), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z.string().max(5000), - }), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - name: z.string().max(5000), - object: z.literal("radar.value_list"), -}) - export const s_refund_destination_details = z.object({ affirm: s_destination_details_unimplemented.optional(), afterpay_clearpay: s_destination_details_unimplemented.optional(), @@ -11130,24 +10827,6 @@ export const s_tax_rate = z.object({ .optional(), }) -export const s_tax_transaction_line_item = z.object({ - amount: z.coerce.number(), - amount_tax: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("tax.transaction_line_item"), - product: z.string().max(5000).nullable().optional(), - quantity: z.coerce.number(), - reference: z.string().max(5000), - reversal: s_tax_product_resource_tax_transaction_line_item_resource_reversal - .nullable() - .optional(), - tax_behavior: z.enum(["exclusive", "inclusive"]), - tax_code: z.string().max(5000), - type: z.enum(["reversal", "transaction"]), -}) - export const s_terminal_configuration_configuration_resource_tipping = z.object( { aed: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), @@ -11185,21 +10864,6 @@ export const s_terminal_configuration_configuration_resource_wifi_config = type: z.enum(["enterprise_eap_peap", "enterprise_eap_tls", "personal_psk"]), }) -export const s_terminal_location = z.object({ - address: s_address, - address_kana: s_legal_entity_japan_address.optional(), - address_kanji: s_legal_entity_japan_address.optional(), - configuration_overrides: z.string().max(5000).optional(), - display_name: z.string().max(5000), - display_name_kana: z.string().max(5000).optional(), - display_name_kanji: z.string().max(5000).optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - object: z.literal("terminal.location"), - phone: z.string().max(5000).optional(), -}) - export const s_terminal_onboarding_link_link_options = z.object({ apple_terms_and_conditions: s_terminal_onboarding_link_apple_terms_and_conditions.nullable().optional(), @@ -11375,29 +11039,6 @@ export const s_checkout_us_bank_account_payment_method_options = z.object({ verification_method: z.enum(["automatic", "instant"]).optional(), }) -export const s_climate_product = z.object({ - created: z.coerce.number(), - current_prices_per_metric_ton: z.record( - z.string(), - s_climate_removals_products_price, - ), - delivery_year: z.coerce.number().nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metric_tons_available: z.string(), - name: z.string().max(5000), - object: z.literal("climate.product"), - suppliers: z.array(s_climate_supplier), -}) - -export const s_climate_removals_order_deliveries = z.object({ - delivered_at: z.coerce.number(), - location: s_climate_removals_location.nullable().optional(), - metric_tons: z.string().max(5000), - registry_url: z.string().max(5000).nullable().optional(), - supplier: s_climate_supplier, -}) - export const s_confirmation_tokens_resource_mandate_data = z.object({ customer_acceptance: s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance, @@ -11497,28 +11138,6 @@ export const s_dispute_evidence_details = z.object({ submission_count: z.coerce.number(), }) -export const s_forwarding_request = z.object({ - created: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("forwarding.request"), - payment_method: z.string().max(5000), - replacements: z.array( - z.enum([ - "card_cvc", - "card_expiry", - "card_number", - "cardholder_name", - "request_signature", - ]), - ), - request_context: s_forwarded_request_context.nullable().optional(), - request_details: s_forwarded_request_details.nullable().optional(), - response_details: s_forwarded_response_details.nullable().optional(), - url: z.string().max(5000).nullable().optional(), -}) - export const s_funding_instructions_bank_transfer_financial_address = z.object({ aba: s_funding_instructions_bank_transfer_aba_record.optional(), iban: s_funding_instructions_bank_transfer_iban_record.optional(), @@ -11543,23 +11162,6 @@ export const s_funding_instructions_bank_transfer_financial_address = z.object({ zengin: s_funding_instructions_bank_transfer_zengin_record.optional(), }) -export const s_identity_verification_report = z.object({ - client_reference_id: z.string().max(5000).nullable().optional(), - created: z.coerce.number(), - document: s_gelato_document_report.optional(), - email: s_gelato_email_report.optional(), - id: z.string().max(5000), - id_number: s_gelato_id_number_report.optional(), - livemode: PermissiveBoolean, - object: z.literal("identity.verification_report"), - options: s_gelato_verification_report_options.optional(), - phone: s_gelato_phone_report.optional(), - selfie: s_gelato_selfie_report.optional(), - type: z.enum(["document", "id_number", "verification_flow"]), - verification_flow: z.string().max(5000).optional(), - verification_session: z.string().max(5000).nullable().optional(), -}) - export const s_insights_resources_payment_evaluation_event = z.object({ dispute_opened: s_insights_resources_payment_evaluation_dispute_opened.optional(), @@ -12246,35 +11848,6 @@ export const s_source_order = z.object({ shipping: s_shipping.optional(), }) -export const s_tax_association = z.object({ - calculation: z.string().max(5000), - id: z.string().max(5000), - object: z.literal("tax.association"), - payment_intent: z.string().max(5000), - tax_transaction_attempts: z - .array(s_tax_product_resource_tax_association_transaction_attempts) - .nullable() - .optional(), -}) - -export const s_tax_calculation_line_item = z.object({ - amount: z.coerce.number(), - amount_tax: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("tax.calculation_line_item"), - product: z.string().max(5000).nullable().optional(), - quantity: z.coerce.number(), - reference: z.string().max(5000), - tax_behavior: z.enum(["exclusive", "inclusive"]), - tax_breakdown: z - .array(s_tax_product_resource_line_item_tax_breakdown) - .nullable() - .optional(), - tax_code: z.string().max(5000), -}) - export const s_tax_product_registrations_resource_country_options_united_states = z.object({ local_amusement_tax: @@ -12328,61 +11901,6 @@ export const s_tax_product_resource_tax_calculation_shipping_cost = z.object({ tax_code: z.string().max(5000), }) -export const s_tax_settings = z.object({ - defaults: s_tax_product_resource_tax_settings_defaults, - head_office: s_tax_product_resource_tax_settings_head_office - .nullable() - .optional(), - livemode: PermissiveBoolean, - object: z.literal("tax.settings"), - status: z.enum(["active", "pending"]), - status_details: s_tax_product_resource_tax_settings_status_details, -}) - -export const s_tax_transaction = z.object({ - created: z.coerce.number(), - currency: z.string().max(5000), - customer: z.string().max(5000).nullable().optional(), - customer_details: s_tax_product_resource_customer_details, - id: z.string().max(5000), - line_items: z - .object({ - data: z.array(s_tax_transaction_line_item), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z - .string() - .max(5000) - .regex(new RegExp("^/v1/tax/transactions/[^/]+/line_items")), - }) - .nullable() - .optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - object: z.literal("tax.transaction"), - posted_at: z.coerce.number(), - reference: z.string().max(5000), - reversal: s_tax_product_resource_tax_transaction_resource_reversal - .nullable() - .optional(), - ship_from_details: s_tax_product_resource_ship_from_details - .nullable() - .optional(), - shipping_cost: s_tax_product_resource_tax_transaction_shipping_cost - .nullable() - .optional(), - tax_date: z.coerce.number(), - type: z.enum(["reversal", "transaction"]), -}) - -export const s_terminal_onboarding_link = z.object({ - link_options: s_terminal_onboarding_link_link_options, - link_type: z.literal("apple_terms_and_conditions"), - object: z.literal("terminal.onboarding_link"), - on_behalf_of: z.string().max(5000).nullable().optional(), - redirect_url: z.string().max(5000), -}) - export const s_terminal_reader_reader_resource_input = z.object({ custom_text: s_terminal_reader_reader_resource_custom_text .nullable() @@ -12408,18 +11926,6 @@ export const s_terminal_reader_reader_resource_set_reader_display_action = type: z.literal("cart"), }) -export const s_test_helpers_test_clock = z.object({ - created: z.coerce.number(), - deletes_after: z.coerce.number(), - frozen_time: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - name: z.string().max(5000).nullable().optional(), - object: z.literal("test_helpers.test_clock"), - status: z.enum(["advancing", "internal_failure", "ready"]), - status_details: s_billing_clocks_resource_status_details_status_details, -}) - export const s_treasury_financial_accounts_resource_financial_addresses_features = z.object({ aba: s_treasury_financial_accounts_resource_aba_toggle_settings.optional(), @@ -12577,40 +12083,6 @@ export const s_checkout_session_payment_method_options = z.object({ us_bank_account: s_checkout_us_bank_account_payment_method_options.optional(), }) -export const s_climate_order = z.object({ - amount_fees: z.coerce.number(), - amount_subtotal: z.coerce.number(), - amount_total: z.coerce.number(), - beneficiary: s_climate_removals_beneficiary.optional(), - canceled_at: z.coerce.number().nullable().optional(), - cancellation_reason: z - .enum(["expired", "product_unavailable", "requested"]) - .nullable() - .optional(), - certificate: z.string().max(5000).nullable().optional(), - confirmed_at: z.coerce.number().nullable().optional(), - created: z.coerce.number(), - currency: z.string().max(5000), - delayed_at: z.coerce.number().nullable().optional(), - delivered_at: z.coerce.number().nullable().optional(), - delivery_details: z.array(s_climate_removals_order_deliveries), - expected_delivery_year: z.coerce.number(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - metric_tons: z.string(), - object: z.literal("climate.order"), - product: z.union([z.string().max(5000), s_climate_product]), - product_substituted_at: z.coerce.number().nullable().optional(), - status: z.enum([ - "awaiting_funds", - "canceled", - "confirmed", - "delivered", - "open", - ]), -}) - export const s_confirmation_tokens_resource_payment_method_options = z.object({ card: s_confirmation_tokens_resource_payment_method_options_resource_card .nullable() @@ -12631,32 +12103,6 @@ export const s_funding_instructions_bank_transfer = z.object({ type: z.enum(["eu_bank_transfer", "jp_bank_transfer"]), }) -export const s_identity_verification_session = z.object({ - client_reference_id: z.string().max(5000).nullable().optional(), - client_secret: z.string().max(5000).nullable().optional(), - created: z.coerce.number(), - id: z.string().max(5000), - last_error: s_gelato_session_last_error.nullable().optional(), - last_verification_report: z - .union([z.string().max(5000), s_identity_verification_report]) - .nullable() - .optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - object: z.literal("identity.verification_session"), - options: s_gelato_verification_session_options.nullable().optional(), - provided_details: s_gelato_provided_details.nullable().optional(), - redaction: s_verification_session_redaction.nullable().optional(), - related_customer: z.string().max(5000).nullable().optional(), - related_customer_account: z.string().max(5000).nullable().optional(), - related_person: s_gelato_related_person.optional(), - status: z.enum(["canceled", "processing", "requires_input", "verified"]), - type: z.enum(["document", "id_number", "verification_flow"]), - url: z.string().max(5000).nullable().optional(), - verification_flow: z.string().max(5000).optional(), - verified_outputs: s_gelato_verified_outputs.nullable().optional(), -}) - export const s_invoices_payment_method_options = z.object({ acss_debit: s_invoice_payment_method_options_acss_debit.nullable().optional(), bancontact: s_invoice_payment_method_options_bancontact.nullable().optional(), @@ -13310,39 +12756,6 @@ export const s_subscriptions_resource_payment_method_options = z.object({ .optional(), }) -export const s_tax_calculation = z.object({ - amount_total: z.coerce.number(), - currency: z.string().max(5000), - customer: z.string().max(5000).nullable().optional(), - customer_details: s_tax_product_resource_customer_details, - expires_at: z.coerce.number().nullable().optional(), - id: z.string().max(5000).nullable().optional(), - line_items: z - .object({ - data: z.array(s_tax_calculation_line_item), - has_more: PermissiveBoolean, - object: z.literal("list"), - url: z - .string() - .max(5000) - .regex(new RegExp("^/v1/tax/calculations/[^/]+/line_items")), - }) - .nullable() - .optional(), - livemode: PermissiveBoolean, - object: z.literal("tax.calculation"), - ship_from_details: s_tax_product_resource_ship_from_details - .nullable() - .optional(), - shipping_cost: s_tax_product_resource_tax_calculation_shipping_cost - .nullable() - .optional(), - tax_amount_exclusive: z.coerce.number(), - tax_amount_inclusive: z.coerce.number(), - tax_breakdown: z.array(s_tax_product_resource_tax_breakdown), - tax_date: z.coerce.number(), -}) - export const s_tax_product_registrations_resource_country_options = z.object({ ae: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), al: s_tax_product_registrations_resource_country_options_default.optional(), @@ -13454,44 +12867,6 @@ export const s_terminal_reader_reader_resource_collect_inputs_action = z.object( }, ) -export const s_treasury_financial_account_features = z.object({ - card_issuing: - s_treasury_financial_accounts_resource_toggle_settings.optional(), - deposit_insurance: - s_treasury_financial_accounts_resource_toggle_settings.optional(), - financial_addresses: - s_treasury_financial_accounts_resource_financial_addresses_features.optional(), - inbound_transfers: - s_treasury_financial_accounts_resource_inbound_transfers.optional(), - intra_stripe_flows: - s_treasury_financial_accounts_resource_toggle_settings.optional(), - object: z.literal("treasury.financial_account_features"), - outbound_payments: - s_treasury_financial_accounts_resource_outbound_payments.optional(), - outbound_transfers: - s_treasury_financial_accounts_resource_outbound_transfers.optional(), -}) - -export const s_billing_portal_configuration = z.object({ - active: PermissiveBoolean, - application: z - .union([z.string().max(5000), s_application, s_deleted_application]) - .nullable() - .optional(), - business_profile: s_portal_business_profile, - created: z.coerce.number(), - default_return_url: z.string().max(5000).nullable().optional(), - features: s_portal_features, - id: z.string().max(5000), - is_default: PermissiveBoolean, - livemode: PermissiveBoolean, - login_page: s_portal_login_page, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - name: z.string().max(5000).nullable().optional(), - object: z.literal("billing_portal.configuration"), - updated: z.coerce.number(), -}) - export const s_funding_instructions = z.object({ bank_transfer: s_funding_instructions_bank_transfer, currency: z.string().max(5000), @@ -13677,161 +13052,6 @@ export const s_subscriptions_resource_payment_settings = z.object({ .optional(), }) -export const s_tax_registration = z.object({ - active_from: z.coerce.number(), - country: z.string().max(5000), - country_options: s_tax_product_registrations_resource_country_options, - created: z.coerce.number(), - expires_at: z.coerce.number().nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - object: z.literal("tax.registration"), - status: z.enum(["active", "expired", "scheduled"]), -}) - -export const s_treasury_financial_account = z.object({ - active_features: z - .array( - z.enum([ - "card_issuing", - "deposit_insurance", - "financial_addresses.aba", - "financial_addresses.aba.forwarding", - "inbound_transfers.ach", - "intra_stripe_flows", - "outbound_payments.ach", - "outbound_payments.us_domestic_wire", - "outbound_transfers.ach", - "outbound_transfers.us_domestic_wire", - "remote_deposit_capture", - ]), - ) - .optional(), - balance: s_treasury_financial_accounts_resource_balance, - country: z.string().max(5000), - created: z.coerce.number(), - features: s_treasury_financial_account_features.optional(), - financial_addresses: z.array( - s_treasury_financial_accounts_resource_financial_address, - ), - id: z.string().max(5000), - is_default: PermissiveBoolean.optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), - nickname: z.string().max(5000).nullable().optional(), - object: z.literal("treasury.financial_account"), - pending_features: z - .array( - z.enum([ - "card_issuing", - "deposit_insurance", - "financial_addresses.aba", - "financial_addresses.aba.forwarding", - "inbound_transfers.ach", - "intra_stripe_flows", - "outbound_payments.ach", - "outbound_payments.us_domestic_wire", - "outbound_transfers.ach", - "outbound_transfers.us_domestic_wire", - "remote_deposit_capture", - ]), - ) - .optional(), - platform_restrictions: - s_treasury_financial_accounts_resource_platform_restrictions - .nullable() - .optional(), - restricted_features: z - .array( - z.enum([ - "card_issuing", - "deposit_insurance", - "financial_addresses.aba", - "financial_addresses.aba.forwarding", - "inbound_transfers.ach", - "intra_stripe_flows", - "outbound_payments.ach", - "outbound_payments.us_domestic_wire", - "outbound_transfers.ach", - "outbound_transfers.us_domestic_wire", - "remote_deposit_capture", - ]), - ) - .optional(), - status: z.enum(["closed", "open"]), - status_details: s_treasury_financial_accounts_resource_status_details, - supported_currencies: z.array(z.string()), -}) - -export const s_billing_portal_session = z.object({ - configuration: z.union([ - z.string().max(5000), - s_billing_portal_configuration, - ]), - created: z.coerce.number(), - customer: z.string().max(5000), - customer_account: z.string().max(5000).nullable().optional(), - flow: s_portal_flows_flow.nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - locale: z - .enum([ - "auto", - "bg", - "cs", - "da", - "de", - "el", - "en", - "en-AU", - "en-CA", - "en-GB", - "en-IE", - "en-IN", - "en-NZ", - "en-SG", - "es", - "es-419", - "et", - "fi", - "fil", - "fr", - "fr-CA", - "hr", - "hu", - "id", - "it", - "ja", - "ko", - "lt", - "lv", - "ms", - "mt", - "nb", - "nl", - "pl", - "pt", - "pt-BR", - "ro", - "ru", - "sk", - "sl", - "sv", - "th", - "tr", - "vi", - "zh", - "zh-HK", - "zh-TW", - ]) - .nullable() - .optional(), - object: z.literal("billing_portal.session"), - on_behalf_of: z.string().max(5000).nullable().optional(), - return_url: z.string().max(5000).nullable().optional(), - url: z.string().max(5000), -}) - export const s_account: z.ZodType = z.object({ business_profile: s_account_business_profile.nullable().optional(), business_type: z @@ -16588,6 +15808,18 @@ export const s_PostApplicationFeesIdRefundsRequestBody = z.object({ metadata: z.record(z.string(), z.string()).optional(), }) +export const s_apps_secret = z.object({ + created: z.coerce.number(), + deleted: PermissiveBoolean.optional(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("apps.secret"), + payload: z.string().max(5000).nullable().optional(), + scope: s_secret_service_resource_scope, +}) + export const s_PostAppsSecretsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), expires_at: z.coerce.number().optional(), @@ -16637,9 +15869,9 @@ export const s_balance_transaction: z.ZodType = z.object( z.lazy(() => s_customer_cash_balance_transaction), z.lazy(() => s_dispute), z.lazy(() => s_fee_refund), - z.lazy(() => s_issuing_authorization), - z.lazy(() => s_issuing_dispute), - z.lazy(() => s_issuing_transaction), + s_issuing_authorization, + s_issuing_dispute, + s_issuing_transaction, z.lazy(() => s_payout), z.lazy(() => s_refund), s_reserve_transaction, @@ -16845,10 +16077,7 @@ export const s_billing_credit_balance_transaction: z.ZodType s_billing_credit_grants_resource_balance_credit) .nullable() .optional(), - credit_grant: z.union([ - z.string().max(5000), - z.lazy(() => s_billing_credit_grant), - ]), + credit_grant: z.union([z.string().max(5000), s_billing_credit_grant]), debit: z .lazy(() => s_billing_credit_grants_resource_balance_debit) .nullable() @@ -16937,6 +16166,17 @@ export const s_PostBillingMeterEventAdjustmentsRequestBody = z.object({ type: z.literal("cancel"), }) +export const s_billing_meter_event_adjustment = z.object({ + cancel: s_billing_meter_resource_billing_meter_event_adjustment_cancel + .nullable() + .optional(), + event_name: z.string().max(100), + livemode: PermissiveBoolean, + object: z.literal("billing.meter_event_adjustment"), + status: z.enum(["complete", "pending"]), + type: z.literal("cancel"), +}) + export const s_PostBillingMeterEventsRequestBody = z.object({ event_name: z.string().max(100), expand: z.array(z.string().max(5000)).optional(), @@ -16945,6 +16185,32 @@ export const s_PostBillingMeterEventsRequestBody = z.object({ timestamp: z.coerce.number().optional(), }) +export const s_billing_meter_event = z.object({ + created: z.coerce.number(), + event_name: z.string().max(100), + identifier: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("billing.meter_event"), + payload: z.record(z.string(), z.string().max(100)), + timestamp: z.coerce.number(), +}) + +export const s_billing_meter = z.object({ + created: z.coerce.number(), + customer_mapping: s_billing_meter_resource_customer_mapping_settings, + default_aggregation: s_billing_meter_resource_aggregation_settings, + display_name: z.string().max(5000), + event_name: z.string().max(5000), + event_time_window: z.enum(["day", "hour"]).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("billing.meter"), + status: z.enum(["active", "inactive"]), + status_transitions: s_billing_meter_resource_billing_meter_status_transitions, + updated: z.coerce.number(), + value_settings: s_billing_meter_resource_billing_meter_value, +}) + export const s_PostBillingMetersRequestBody = z.object({ customer_mapping: z .object({event_payload_key: z.string().max(100), type: z.literal("by_id")}) @@ -16966,10 +16232,40 @@ export const s_PostBillingMetersIdDeactivateRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_billing_meter_event_summary = z.object({ + aggregated_value: z.coerce.number(), + end_time: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + meter: z.string().max(5000), + object: z.literal("billing.meter_event_summary"), + start_time: z.coerce.number(), +}) + export const s_PostBillingMetersIdReactivateRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_billing_portal_configuration = z.object({ + active: PermissiveBoolean, + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + business_profile: s_portal_business_profile, + created: z.coerce.number(), + default_return_url: z.string().max(5000).nullable().optional(), + features: s_portal_features, + id: z.string().max(5000), + is_default: PermissiveBoolean, + livemode: PermissiveBoolean, + login_page: s_portal_login_page, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + object: z.literal("billing_portal.configuration"), + updated: z.coerce.number(), +}) + export const s_PostBillingPortalConfigurationsRequestBody = z.object({ business_profile: z .object({ @@ -17344,6 +16640,75 @@ export const s_PostBillingPortalSessionsRequestBody = z.object({ return_url: z.string().optional(), }) +export const s_billing_portal_session = z.object({ + configuration: z.union([ + z.string().max(5000), + s_billing_portal_configuration, + ]), + created: z.coerce.number(), + customer: z.string().max(5000), + customer_account: z.string().max(5000).nullable().optional(), + flow: s_portal_flows_flow.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + locale: z + .enum([ + "auto", + "bg", + "cs", + "da", + "de", + "el", + "en", + "en-AU", + "en-CA", + "en-GB", + "en-IE", + "en-IN", + "en-NZ", + "en-SG", + "es", + "es-419", + "et", + "fi", + "fil", + "fr", + "fr-CA", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "ms", + "mt", + "nb", + "nl", + "pl", + "pt", + "pt-BR", + "ro", + "ru", + "sk", + "sl", + "sv", + "th", + "tr", + "vi", + "zh", + "zh-HK", + "zh-TW", + ]) + .nullable() + .optional(), + object: z.literal("billing_portal.session"), + on_behalf_of: z.string().max(5000).nullable().optional(), + return_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000), +}) + export const s_charge: z.ZodType = z.object({ amount: z.coerce.number(), amount_captured: z.coerce.number(), @@ -19571,6 +18936,40 @@ export const s_item: z.ZodType = z.object({ taxes: z.array(s_line_items_tax_amount).optional(), }) +export const s_climate_order: z.ZodType = z.object({ + amount_fees: z.coerce.number(), + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + beneficiary: s_climate_removals_beneficiary.optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_reason: z + .enum(["expired", "product_unavailable", "requested"]) + .nullable() + .optional(), + certificate: z.string().max(5000).nullable().optional(), + confirmed_at: z.coerce.number().nullable().optional(), + created: z.coerce.number(), + currency: z.string().max(5000), + delayed_at: z.coerce.number().nullable().optional(), + delivered_at: z.coerce.number().nullable().optional(), + delivery_details: z.array(z.lazy(() => s_climate_removals_order_deliveries)), + expected_delivery_year: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + metric_tons: z.string(), + object: z.literal("climate.order"), + product: z.union([z.string().max(5000), s_climate_product]), + product_substituted_at: z.coerce.number().nullable().optional(), + status: z.enum([ + "awaiting_funds", + "canceled", + "confirmed", + "delivered", + "open", + ]), +}) + export const s_PostClimateOrdersRequestBody = z.object({ amount: z.coerce.number().optional(), beneficiary: z.object({public_name: z.string().max(5000)}).optional(), @@ -19596,6 +18995,36 @@ export const s_PostClimateOrdersOrderCancelRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_climate_product = z.object({ + created: z.coerce.number(), + current_prices_per_metric_ton: z.record( + z.string(), + s_climate_removals_products_price, + ), + delivery_year: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metric_tons_available: z.string(), + name: z.string().max(5000), + object: z.literal("climate.product"), + suppliers: z.array(s_climate_supplier), +}) + +export const s_climate_supplier = z.object({ + id: z.string().max(5000), + info_url: z.string().max(5000), + livemode: PermissiveBoolean, + locations: z.array(s_climate_removals_location), + name: z.string().max(5000), + object: z.literal("climate.supplier"), + removal_pathway: z.enum([ + "biomass_carbon_removal_and_storage", + "direct_air_capture", + "enhanced_weathering", + "marine_carbon_removal", + ]), +}) + export const s_confirmation_token: z.ZodType = z.object({ created: z.coerce.number(), expires_at: z.coerce.number().nullable().optional(), @@ -20310,7 +19739,7 @@ export const s_customer_balance_transaction: z.ZodType s_checkout_session)]) + .union([z.string().max(5000), s_checkout_session]) .nullable() .optional(), created: z.coerce.number(), @@ -22336,6 +21765,24 @@ export const s_PostDisputesDisputeCloseRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_entitlements_active_entitlement = z.object({ + feature: z.union([z.string().max(5000), s_entitlements_feature]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000), + object: z.literal("entitlements.active_entitlement"), +}) + +export const s_entitlements_feature = z.object({ + active: PermissiveBoolean, + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000), + metadata: z.record(z.string(), z.string().max(500)), + name: z.string().max(80), + object: z.literal("entitlements.feature"), +}) + export const s_PostEntitlementsFeaturesRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), lookup_key: z.string().max(80), @@ -22522,6 +21969,17 @@ export const s_financial_connections_account: z.ZodType s_financial_connections_account)), + data: z.array(s_financial_connections_account), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -22604,6 +22062,44 @@ export const s_financial_connections_session: z.ZodType = "swipe", ]), balance_transactions: z.array(z.lazy(() => s_balance_transaction)), - card: z.lazy(() => s_issuing_card), + card: s_issuing_card, card_presence: z.enum(["not_present", "present"]).nullable().optional(), cardholder: z - .union([z.string().max(5000), z.lazy(() => s_issuing_cardholder)]) + .union([z.string().max(5000), s_issuing_cardholder]) .nullable() .optional(), created: z.coerce.number(), @@ -24861,10 +24400,10 @@ export const s_issuing_authorization: z.ZodType = request_history: z.array(s_issuing_authorization_request), status: z.enum(["closed", "expired", "pending", "reversed"]), token: z - .union([z.string().max(5000), z.lazy(() => s_issuing_token)]) + .union([z.string().max(5000), s_issuing_token]) .nullable() .optional(), - transactions: z.array(z.lazy(() => s_issuing_transaction)), + transactions: z.array(s_issuing_transaction), treasury: s_issuing_authorization_treasury.nullable().optional(), verification_data: s_issuing_authorization_verification_data, verified_by_fraud_challenge: PermissiveBoolean.nullable().optional(), @@ -26900,13 +26439,13 @@ export const s_PostIssuingCardholdersCardholderRequestBody = z.object({ status: z.enum(["active", "inactive"]).optional(), }) -export const s_issuing_card: z.ZodType = z.object({ +export const s_issuing_card = z.object({ brand: z.string().max(5000), cancellation_reason: z .enum(["design_rejected", "fulfillment_error", "lost", "stolen"]) .nullable() .optional(), - cardholder: z.lazy(() => s_issuing_cardholder), + cardholder: s_issuing_cardholder, created: z.coerce.number(), currency: z.string(), cvc: z.string().max(5000).optional(), @@ -26922,18 +26461,15 @@ export const s_issuing_card: z.ZodType = z.object({ number: z.string().max(5000).optional(), object: z.literal("issuing.card"), personalization_design: z - .union([ - z.string().max(5000), - z.lazy(() => s_issuing_personalization_design), - ]) + .union([z.string().max(5000), s_issuing_personalization_design]) .nullable() .optional(), replaced_by: z - .union([z.string().max(5000), z.lazy(() => s_issuing_card)]) + .union([z.string().max(5000), s_issuing_card]) .nullable() .optional(), replacement_for: z - .union([z.string().max(5000), z.lazy(() => s_issuing_card)]) + .union([z.string().max(5000), s_issuing_card]) .nullable() .optional(), replacement_reason: z @@ -28937,10 +28473,7 @@ export const s_issuing_dispute: z.ZodType = z.object({ metadata: z.record(z.string(), z.string().max(500)), object: z.literal("issuing.dispute"), status: z.enum(["expired", "lost", "submitted", "unsubmitted", "won"]), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_issuing_transaction), - ]), + transaction: z.union([z.string().max(5000), s_issuing_transaction]), treasury: s_issuing_dispute_treasury.nullable().optional(), }) @@ -29355,13 +28888,43 @@ export const s_PostIssuingPersonalizationDesignsPersonalizationDesignRequestBody transfer_lookup_key: PermissiveBoolean.optional(), }) +export const s_issuing_physical_bundle = z.object({ + features: s_issuing_physical_bundle_features, + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("issuing.physical_bundle"), + status: z.enum(["active", "inactive", "review"]), + type: z.enum(["custom", "standard"]), +}) + +export const s_issuing_settlement = z.object({ + bin: z.string().max(5000), + clearing_date: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + id: z.string().max(5000), + interchange_fees_amount: z.coerce.number(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + net_total_amount: z.coerce.number(), + network: z.enum(["maestro", "mastercard", "visa"]), + network_fees_amount: z.coerce.number(), + network_settlement_identifier: z.string().max(5000), + object: z.literal("issuing.settlement"), + settlement_service: z.string().max(5000), + status: z.enum(["complete", "pending"]), + transaction_amount: z.coerce.number(), + transaction_count: z.coerce.number(), +}) + export const s_PostIssuingSettlementsSettlementRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), metadata: z.record(z.string(), z.string()).optional(), }) -export const s_issuing_token: z.ZodType = z.object({ - card: z.union([z.string().max(5000), z.lazy(() => s_issuing_card)]), +export const s_issuing_token = z.object({ + card: z.union([z.string().max(5000), s_issuing_card]), created: z.coerce.number(), device_fingerprint: z.string().max(5000).nullable().optional(), id: z.string().max(5000), @@ -29387,22 +28950,22 @@ export const s_issuing_transaction: z.ZodType = z.object( amount: z.coerce.number(), amount_details: s_issuing_transaction_amount_details.nullable().optional(), authorization: z - .union([z.string().max(5000), z.lazy(() => s_issuing_authorization)]) + .union([z.string().max(5000), s_issuing_authorization]) .nullable() .optional(), balance_transaction: z .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) .nullable() .optional(), - card: z.union([z.string().max(5000), z.lazy(() => s_issuing_card)]), + card: z.union([z.string().max(5000), s_issuing_card]), cardholder: z - .union([z.string().max(5000), z.lazy(() => s_issuing_cardholder)]) + .union([z.string().max(5000), s_issuing_cardholder]) .nullable() .optional(), created: z.coerce.number(), currency: z.string(), dispute: z - .union([z.string().max(5000), z.lazy(() => s_issuing_dispute)]) + .union([z.string().max(5000), s_issuing_dispute]) .nullable() .optional(), id: z.string().max(5000), @@ -29417,7 +28980,7 @@ export const s_issuing_transaction: z.ZodType = z.object( .nullable() .optional(), token: z - .union([z.string().max(5000), z.lazy(() => s_issuing_token)]) + .union([z.string().max(5000), s_issuing_token]) .nullable() .optional(), treasury: s_issuing_transaction_treasury.nullable().optional(), @@ -37408,6 +36971,13 @@ export const s_PostProductsIdRequestBody = z.object({ url: z.union([z.string(), z.literal("")]).optional(), }) +export const s_product_feature = z.object({ + entitlement_feature: s_entitlements_feature, + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("product_feature"), +}) + export const s_PostProductsProductFeaturesRequestBody = z.object({ entitlement_feature: z.string().max(5000), expand: z.array(z.string().max(5000)).optional(), @@ -37940,12 +37510,59 @@ export const s_radar_payment_evaluation: z.ZodType = signals: s_insights_resources_payment_evaluation_signals, }) +export const s_radar_value_list_item = z.object({ + created: z.coerce.number(), + created_by: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("radar.value_list_item"), + value: z.string().max(5000), + value_list: z.string().max(5000), +}) + export const s_PostRadarValueListItemsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), value: z.string().max(800), value_list: z.string().max(5000), }) +export const s_deleted_radar_value_list_item = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("radar.value_list_item"), +}) + +export const s_radar_value_list = z.object({ + alias: z.string().max(5000), + created: z.coerce.number(), + created_by: z.string().max(5000), + id: z.string().max(5000), + item_type: z.enum([ + "account", + "card_bin", + "card_fingerprint", + "case_sensitive_string", + "country", + "crypto_fingerprint", + "customer_id", + "email", + "ip_address", + "sepa_debit_fingerprint", + "string", + "us_bank_account_fingerprint", + ]), + list_items: z.object({ + data: z.array(s_radar_value_list_item), + has_more: PermissiveBoolean, + object: z.literal("list"), + url: z.string().max(5000), + }), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + name: z.string().max(5000), + object: z.literal("radar.value_list"), +}) + export const s_PostRadarValueListsRequestBody = z.object({ alias: z.string().max(100), expand: z.array(z.string().max(5000)).optional(), @@ -37969,6 +37586,12 @@ export const s_PostRadarValueListsRequestBody = z.object({ name: z.string().max(100), }) +export const s_deleted_radar_value_list = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("radar.value_list"), +}) + export const s_PostRadarValueListsValueListRequestBody = z.object({ alias: z.string().max(100).optional(), expand: z.array(z.string().max(5000)).optional(), @@ -38682,6 +38305,18 @@ export const s_PostReportingReportRunsRequestBody = z.object({ report_type: z.string(), }) +export const s_reporting_report_type = z.object({ + data_available_end: z.coerce.number(), + data_available_start: z.coerce.number(), + default_columns: z.array(z.string().max(5000)).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("reporting.report_type"), + updated: z.coerce.number(), + version: z.coerce.number(), +}) + export const s_review: z.ZodType = z.object({ billing_zip: z.string().max(5000).nullable().optional(), charge: z @@ -41164,6 +40799,15 @@ export const s_PostSigmaSavedQueriesIdRequestBody = z.object({ sql: z.string().max(100000).optional(), }) +export const s_sigma_sigma_api_query = z.object({ + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.literal("sigma.sigma_api_query"), + sql: z.string().max(5000), +}) + export const s_scheduled_query_run: z.ZodType = z.object( { created: z.coerce.number(), @@ -43106,6 +42750,17 @@ export const s_PostSubscriptionsSubscriptionResumeRequestBody = z.object({ proration_date: z.coerce.number().optional(), }) +export const s_tax_association = z.object({ + calculation: z.string().max(5000), + id: z.string().max(5000), + object: z.literal("tax.association"), + payment_intent: z.string().max(5000), + tax_transaction_attempts: z + .array(s_tax_product_resource_tax_association_transaction_attempts) + .nullable() + .optional(), +}) + export const s_PostTaxCalculationsRequestBody = z.object({ currency: z.string(), customer: z.string().max(5000).optional(), @@ -43290,6 +42945,69 @@ export const s_PostTaxCalculationsRequestBody = z.object({ tax_date: z.coerce.number().optional(), }) +export const s_tax_calculation = z.object({ + amount_total: z.coerce.number(), + currency: z.string().max(5000), + customer: z.string().max(5000).nullable().optional(), + customer_details: s_tax_product_resource_customer_details, + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000).nullable().optional(), + line_items: z + .object({ + data: z.array(s_tax_calculation_line_item), + has_more: PermissiveBoolean, + object: z.literal("list"), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/calculations/[^/]+/line_items")), + }) + .nullable() + .optional(), + livemode: PermissiveBoolean, + object: z.literal("tax.calculation"), + ship_from_details: s_tax_product_resource_ship_from_details + .nullable() + .optional(), + shipping_cost: s_tax_product_resource_tax_calculation_shipping_cost + .nullable() + .optional(), + tax_amount_exclusive: z.coerce.number(), + tax_amount_inclusive: z.coerce.number(), + tax_breakdown: z.array(s_tax_product_resource_tax_breakdown), + tax_date: z.coerce.number(), +}) + +export const s_tax_calculation_line_item = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + object: z.literal("tax.calculation_line_item"), + product: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number(), + reference: z.string().max(5000), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_breakdown: z + .array(s_tax_product_resource_line_item_tax_breakdown) + .nullable() + .optional(), + tax_code: z.string().max(5000), +}) + +export const s_tax_registration = z.object({ + active_from: z.coerce.number(), + country: z.string().max(5000), + country_options: s_tax_product_registrations_resource_country_options, + created: z.coerce.number(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.literal("tax.registration"), + status: z.enum(["active", "expired", "scheduled"]), +}) + export const s_PostTaxRegistrationsRequestBody = z.object({ active_from: z.union([z.literal("now"), z.coerce.number()]), country: z.string().max(5000), @@ -44127,6 +43845,17 @@ export const s_PostTaxRegistrationsIdRequestBody = z.object({ .optional(), }) +export const s_tax_settings = z.object({ + defaults: s_tax_product_resource_tax_settings_defaults, + head_office: s_tax_product_resource_tax_settings_head_office + .nullable() + .optional(), + livemode: PermissiveBoolean, + object: z.literal("tax.settings"), + status: z.enum(["active", "pending"]), + status_details: s_tax_product_resource_tax_settings_status_details, +}) + export const s_PostTaxSettingsRequestBody = z.object({ defaults: z .object({ @@ -44159,6 +43888,42 @@ export const s_PostTaxTransactionsCreateFromCalculationRequestBody = z.object({ reference: z.string().max(500), }) +export const s_tax_transaction = z.object({ + created: z.coerce.number(), + currency: z.string().max(5000), + customer: z.string().max(5000).nullable().optional(), + customer_details: s_tax_product_resource_customer_details, + id: z.string().max(5000), + line_items: z + .object({ + data: z.array(s_tax_transaction_line_item), + has_more: PermissiveBoolean, + object: z.literal("list"), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/transactions/[^/]+/line_items")), + }) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + object: z.literal("tax.transaction"), + posted_at: z.coerce.number(), + reference: z.string().max(5000), + reversal: s_tax_product_resource_tax_transaction_resource_reversal + .nullable() + .optional(), + ship_from_details: s_tax_product_resource_ship_from_details + .nullable() + .optional(), + shipping_cost: s_tax_product_resource_tax_transaction_shipping_cost + .nullable() + .optional(), + tax_date: z.coerce.number(), + type: z.enum(["reversal", "transaction"]), +}) + export const s_PostTaxTransactionsCreateReversalRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), flat_amount: z.coerce.number().optional(), @@ -44183,6 +43948,24 @@ export const s_PostTaxTransactionsCreateReversalRequestBody = z.object({ .optional(), }) +export const s_tax_transaction_line_item = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + object: z.literal("tax.transaction_line_item"), + product: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number(), + reference: z.string().max(5000), + reversal: s_tax_product_resource_tax_transaction_line_item_resource_reversal + .nullable() + .optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_code: z.string().max(5000), + type: z.enum(["reversal", "transaction"]), +}) + export const s_PostTaxIdsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), owner: z @@ -44647,6 +44430,12 @@ export const s_PostTerminalConfigurationsRequestBody = z.object({ .optional(), }) +export const s_deleted_terminal_configuration = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("terminal.configuration"), +}) + export const s_PostTerminalConfigurationsConfigurationRequestBody = z.object({ bbpos_wisepad3: z .union([ @@ -44909,6 +44698,27 @@ export const s_PostTerminalConnectionTokensRequestBody = z.object({ location: z.string().max(5000).optional(), }) +export const s_terminal_connection_token = z.object({ + location: z.string().max(5000).optional(), + object: z.literal("terminal.connection_token"), + secret: z.string().max(5000), +}) + +export const s_terminal_location = z.object({ + address: s_address, + address_kana: s_legal_entity_japan_address.optional(), + address_kanji: s_legal_entity_japan_address.optional(), + configuration_overrides: z.string().max(5000).optional(), + display_name: z.string().max(5000), + display_name_kana: z.string().max(5000).optional(), + display_name_kanji: z.string().max(5000).optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + object: z.literal("terminal.location"), + phone: z.string().max(5000).optional(), +}) + export const s_PostTerminalLocationsRequestBody = z.object({ address: z .object({ @@ -44953,6 +44763,12 @@ export const s_PostTerminalLocationsRequestBody = z.object({ phone: z.string().optional(), }) +export const s_deleted_terminal_location = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("terminal.location"), +}) + export const s_PostTerminalLocationsLocationRequestBody = z.object({ address: z .object({ @@ -45013,6 +44829,14 @@ export const s_PostTerminalOnboardingLinksRequestBody = z.object({ on_behalf_of: z.string().max(5000).optional(), }) +export const s_terminal_onboarding_link = z.object({ + link_options: s_terminal_onboarding_link_link_options, + link_type: z.literal("apple_terms_and_conditions"), + object: z.literal("terminal.onboarding_link"), + on_behalf_of: z.string().max(5000).nullable().optional(), + redirect_url: z.string().max(5000), +}) + export const s_terminal_reader: z.ZodType = z.object({ action: z .lazy(() => s_terminal_reader_reader_resource_reader_action) @@ -45065,6 +44889,34 @@ export const s_PostTerminalReadersRequestBody = z.object({ registration_code: z.string().max(5000), }) +export const s_deleted_terminal_reader = z.object({ + deleted: PermissiveLiteralTrue, + device_type: z.enum([ + "bbpos_chipper2x", + "bbpos_wisepad3", + "bbpos_wisepos_e", + "mobile_phone_reader", + "simulated_stripe_s700", + "simulated_stripe_s710", + "simulated_verifone_m425", + "simulated_verifone_p630", + "simulated_verifone_ux700", + "simulated_verifone_v660p", + "simulated_wisepos_e", + "stripe_m2", + "stripe_s700", + "stripe_s710", + "verifone_P400", + "verifone_m425", + "verifone_p630", + "verifone_ux700", + "verifone_v660p", + ]), + id: z.string().max(5000), + object: z.literal("terminal.reader"), + serial_number: z.string().max(5000), +}) + export const s_PostTerminalReadersReaderRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), label: z.union([z.string().max(5000), z.literal("")]).optional(), @@ -45211,6 +45063,8 @@ export const s_PostTerminalRefundsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), }) +export const s_terminal_refund = z.record(z.string(), z.unknown()) + export const s_PostTestHelpersConfirmationTokensRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), payment_method: z.string().max(5000).optional(), @@ -47238,6 +47092,18 @@ export const s_PostTestHelpersTerminalReadersReaderSucceedInputCollectionRequest export const s_PostTestHelpersTerminalReadersReaderTimeoutInputCollectionRequestBody = z.object({expand: z.array(z.string().max(5000)).optional()}) +export const s_test_helpers_test_clock = z.object({ + created: z.coerce.number(), + deletes_after: z.coerce.number(), + frozen_time: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000).nullable().optional(), + object: z.literal("test_helpers.test_clock"), + status: z.enum(["advancing", "internal_failure", "ready"]), + status_details: s_billing_clocks_resource_status_details_status_details, +}) + export const s_PostTestHelpersTestClocksRequestBody = z.object({ customer: z.string().max(5000).optional(), expand: z.array(z.string().max(5000)).optional(), @@ -47245,6 +47111,12 @@ export const s_PostTestHelpersTestClocksRequestBody = z.object({ name: z.string().max(300).optional(), }) +export const s_deleted_test_helpers_test_clock = z.object({ + deleted: PermissiveLiteralTrue, + id: z.string().max(5000), + object: z.literal("test_helpers.test_clock"), +}) + export const s_PostTestHelpersTestClocksTestClockAdvanceRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), frozen_time: z.coerce.number(), @@ -47305,7 +47177,7 @@ export const s_treasury_inbound_transfer: z.ZodType status_transitions: s_treasury_inbound_transfers_resource_inbound_transfer_resource_status_transitions, transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .union([z.string().max(5000), s_treasury_transaction]) .nullable() .optional(), }) @@ -47367,10 +47239,7 @@ export const s_treasury_outbound_payment: z.ZodType s_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details .nullable() .optional(), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_treasury_transaction), - ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), }) export const s_PostTestHelpersTreasuryOutboundPaymentsIdFailRequestBody = @@ -47448,10 +47317,7 @@ export const s_treasury_outbound_transfer: z.ZodType s_treasury_transaction), - ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), }) export const s_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBody = @@ -47535,7 +47401,7 @@ export const s_treasury_received_credit: z.ZodType = .optional(), status: z.enum(["failed", "succeeded"]), transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .union([z.string().max(5000), s_treasury_transaction]) .nullable() .optional(), }) @@ -47561,40 +47427,39 @@ export const s_PostTestHelpersTreasuryReceivedDebitsRequestBody = z.object({ network: z.literal("ach"), }) -export const s_treasury_received_debit: z.ZodType = - z.object({ - amount: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - description: z.string().max(5000), - failure_code: z - .enum([ - "account_closed", - "account_frozen", - "insufficient_funds", - "international_transaction", - "other", - ]) - .nullable() - .optional(), - financial_account: z.string().max(5000).nullable().optional(), - hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - initiating_payment_method_details: - s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details.optional(), - linked_flows: s_treasury_received_debits_resource_linked_flows, - livemode: PermissiveBoolean, - network: z.enum(["ach", "card", "stripe"]), - object: z.literal("treasury.received_debit"), - reversal_details: s_treasury_received_debits_resource_reversal_details - .nullable() - .optional(), - status: z.enum(["failed", "succeeded"]), - transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) - .nullable() - .optional(), - }) +export const s_treasury_received_debit = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000), + failure_code: z + .enum([ + "account_closed", + "account_frozen", + "insufficient_funds", + "international_transaction", + "other", + ]) + .nullable() + .optional(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + initiating_payment_method_details: + s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details.optional(), + linked_flows: s_treasury_received_debits_resource_linked_flows, + livemode: PermissiveBoolean, + network: z.enum(["ach", "card", "stripe"]), + object: z.literal("treasury.received_debit"), + reversal_details: s_treasury_received_debits_resource_reversal_details + .nullable() + .optional(), + status: z.enum(["failed", "succeeded"]), + transaction: z + .union([z.string().max(5000), s_treasury_transaction]) + .nullable() + .optional(), +}) export const s_PostTokensRequestBody = z.object({ account: z @@ -48235,26 +48100,25 @@ export const s_PostTransfersTransferReversalsIdRequestBody = z.object({ .optional(), }) -export const s_treasury_credit_reversal: z.ZodType = - z.object({ - amount: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - financial_account: z.string().max(5000), - hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - network: z.enum(["ach", "stripe"]), - object: z.literal("treasury.credit_reversal"), - received_credit: z.string().max(5000), - status: z.enum(["canceled", "posted", "processing"]), - status_transitions: s_treasury_received_credits_resource_status_transitions, - transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) - .nullable() - .optional(), - }) +export const s_treasury_credit_reversal = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + financial_account: z.string().max(5000), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + network: z.enum(["ach", "stripe"]), + object: z.literal("treasury.credit_reversal"), + received_credit: z.string().max(5000), + status: z.enum(["canceled", "posted", "processing"]), + status_transitions: s_treasury_received_credits_resource_status_transitions, + transaction: z + .union([z.string().max(5000), s_treasury_transaction]) + .nullable() + .optional(), +}) export const s_PostTreasuryCreditReversalsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), @@ -48262,30 +48126,28 @@ export const s_PostTreasuryCreditReversalsRequestBody = z.object({ received_credit: z.string().max(5000), }) -export const s_treasury_debit_reversal: z.ZodType = - z.object({ - amount: z.coerce.number(), - created: z.coerce.number(), - currency: z.string(), - financial_account: z.string().max(5000).nullable().optional(), - hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), - id: z.string().max(5000), - linked_flows: - s_treasury_received_debits_resource_debit_reversal_linked_flows - .nullable() - .optional(), - livemode: PermissiveBoolean, - metadata: z.record(z.string(), z.string().max(500)), - network: z.enum(["ach", "card"]), - object: z.literal("treasury.debit_reversal"), - received_debit: z.string().max(5000), - status: z.enum(["failed", "processing", "succeeded"]), - status_transitions: s_treasury_received_debits_resource_status_transitions, - transaction: z - .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) - .nullable() - .optional(), - }) +export const s_treasury_debit_reversal = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + linked_flows: s_treasury_received_debits_resource_debit_reversal_linked_flows + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)), + network: z.enum(["ach", "card"]), + object: z.literal("treasury.debit_reversal"), + received_debit: z.string().max(5000), + status: z.enum(["failed", "processing", "succeeded"]), + status_transitions: s_treasury_received_debits_resource_status_transitions, + transaction: z + .union([z.string().max(5000), s_treasury_transaction]) + .nullable() + .optional(), +}) export const s_PostTreasuryDebitReversalsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), @@ -48293,6 +48155,80 @@ export const s_PostTreasuryDebitReversalsRequestBody = z.object({ received_debit: z.string().max(5000), }) +export const s_treasury_financial_account = z.object({ + active_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + balance: s_treasury_financial_accounts_resource_balance, + country: z.string().max(5000), + created: z.coerce.number(), + features: s_treasury_financial_account_features.optional(), + financial_addresses: z.array( + s_treasury_financial_accounts_resource_financial_address, + ), + id: z.string().max(5000), + is_default: PermissiveBoolean.optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string(), z.string().max(500)).nullable().optional(), + nickname: z.string().max(5000).nullable().optional(), + object: z.literal("treasury.financial_account"), + pending_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + platform_restrictions: + s_treasury_financial_accounts_resource_platform_restrictions + .nullable() + .optional(), + restricted_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + status: z.enum(["closed", "open"]), + status_details: s_treasury_financial_accounts_resource_status_details, + supported_currencies: z.array(z.string()), +}) + export const s_PostTreasuryFinancialAccountsRequestBody = z.object({ expand: z.array(z.string().max(5000)).optional(), features: z @@ -48392,6 +48328,24 @@ export const s_PostTreasuryFinancialAccountsFinancialAccountCloseRequestBody = .optional(), }) +export const s_treasury_financial_account_features = z.object({ + card_issuing: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + deposit_insurance: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + financial_addresses: + s_treasury_financial_accounts_resource_financial_addresses_features.optional(), + inbound_transfers: + s_treasury_financial_accounts_resource_inbound_transfers.optional(), + intra_stripe_flows: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + object: z.literal("treasury.financial_account_features"), + outbound_payments: + s_treasury_financial_accounts_resource_outbound_payments.optional(), + outbound_transfers: + s_treasury_financial_accounts_resource_outbound_transfers.optional(), +}) + export const s_PostTreasuryFinancialAccountsFinancialAccountFeaturesRequestBody = z.object({ card_issuing: z.object({requested: PermissiveBoolean}).optional(), @@ -48553,10 +48507,7 @@ export const s_treasury_transaction_entry: z.ZodType s_treasury_transaction), - ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), type: z.enum([ "credit_reversal", "credit_reversal_posting", @@ -48590,7 +48541,7 @@ export const s_treasury_transaction: z.ZodType = description: z.string().max(5000), entries: z .object({ - data: z.array(z.lazy(() => s_treasury_transaction_entry)), + data: z.array(s_treasury_transaction_entry), has_more: PermissiveBoolean, object: z.literal("list"), url: z @@ -49633,6 +49584,14 @@ export const s_payment_pages_checkout_session_total_details: z.ZodType = z.object({amount: z.coerce.number(), discount: z.lazy(() => s_discount)}) +export const s_climate_removals_order_deliveries = z.object({ + delivered_at: z.coerce.number(), + location: s_climate_removals_location.nullable().optional(), + metric_tons: z.string().max(5000), + registry_url: z.string().max(5000).nullable().optional(), + supplier: s_climate_supplier, +}) + export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType = z.object({ acss_debit: s_payment_method_acss_debit.optional(), @@ -49773,10 +49732,7 @@ export const s_credit_notes_pretax_credit_amount: z.ZodType s_billing_credit_balance_transaction), - ]) + .union([z.string().max(5000), s_billing_credit_balance_transaction]) .optional(), discount: z .union([ @@ -49979,6 +49935,18 @@ export const s_bank_connections_resource_accountholder: z.ZodType = z.object({ charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]).optional(), @@ -50059,10 +50027,7 @@ export const s_invoices_resource_pretax_credit_amount: z.ZodType s_billing_credit_balance_transaction), - ]) + .union([z.string().max(5000), s_billing_credit_balance_transaction]) .nullable() .optional(), discount: z @@ -50503,25 +50468,21 @@ export const s_outbound_payments_payment_method_details: z.ZodType = - z.object({ - code: z.enum([ - "account_closed", - "account_frozen", - "bank_account_restricted", - "bank_ownership_changed", - "declined", - "incorrect_account_holder_name", - "invalid_account_number", - "invalid_currency", - "no_account", - "other", - ]), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_treasury_transaction), - ]), - }) +export const s_treasury_outbound_payments_resource_returned_status = z.object({ + code: z.enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]), + transaction: z.union([z.string().max(5000), s_treasury_transaction]), +}) export const s_outbound_transfers_payment_method_details: z.ZodType = z.object({ @@ -50534,8 +50495,8 @@ export const s_outbound_transfers_payment_method_details: z.ZodType = - z.object({ +export const s_treasury_outbound_transfers_resource_returned_details = z.object( + { code: z.enum([ "account_closed", "account_frozen", @@ -50548,11 +50509,9 @@ export const s_treasury_outbound_transfers_resource_returned_details: z.ZodType< "no_account", "other", ]), - transaction: z.union([ - z.string().max(5000), - z.lazy(() => s_treasury_transaction), - ]), - }) + transaction: z.union([z.string().max(5000), s_treasury_transaction]), + }, +) export const s_treasury_received_credits_resource_linked_flows: z.ZodType = z.object({ @@ -50567,28 +50526,27 @@ export const s_treasury_received_credits_resource_linked_flows: z.ZodType = - z.object({ - credit_reversal: z.lazy(() => s_treasury_credit_reversal.optional()), - debit_reversal: z.lazy(() => s_treasury_debit_reversal.optional()), - inbound_transfer: z.lazy(() => s_treasury_inbound_transfer.optional()), - issuing_authorization: z.lazy(() => s_issuing_authorization.optional()), - outbound_payment: z.lazy(() => s_treasury_outbound_payment.optional()), - outbound_transfer: z.lazy(() => s_treasury_outbound_transfer.optional()), - received_credit: z.lazy(() => s_treasury_received_credit.optional()), - received_debit: z.lazy(() => s_treasury_received_debit.optional()), - type: z.enum([ - "credit_reversal", - "debit_reversal", - "inbound_transfer", - "issuing_authorization", - "other", - "outbound_payment", - "outbound_transfer", - "received_credit", - "received_debit", - ]), - }) +export const s_treasury_transactions_resource_flow_details = z.object({ + credit_reversal: s_treasury_credit_reversal.optional(), + debit_reversal: s_treasury_debit_reversal.optional(), + inbound_transfer: s_treasury_inbound_transfer.optional(), + issuing_authorization: s_issuing_authorization.optional(), + outbound_payment: s_treasury_outbound_payment.optional(), + outbound_transfer: s_treasury_outbound_transfer.optional(), + received_credit: s_treasury_received_credit.optional(), + received_debit: s_treasury_received_debit.optional(), + type: z.enum([ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ]), +}) export const s_legal_entity_company_verification: z.ZodType = z.object({ @@ -51506,9 +51464,9 @@ export const s_outbound_transfers_payment_method_details_us_bank_account: z.ZodT export const s_treasury_received_credits_resource_source_flows_details: z.ZodType = z.object({ - credit_reversal: z.lazy(() => s_treasury_credit_reversal.optional()), - outbound_payment: z.lazy(() => s_treasury_outbound_payment.optional()), - outbound_transfer: z.lazy(() => s_treasury_outbound_transfer.optional()), + credit_reversal: s_treasury_credit_reversal.optional(), + outbound_payment: s_treasury_outbound_payment.optional(), + outbound_transfer: s_treasury_outbound_transfer.optional(), payout: z.lazy(() => s_payout.optional()), type: z.enum([ "credit_reversal", diff --git a/integration-tests/typescript-plain/package.json b/integration-tests/typescript-plain/package.json new file mode 100644 index 000000000..e09dbb251 --- /dev/null +++ b/integration-tests/typescript-plain/package.json @@ -0,0 +1,23 @@ +{ + "name": "@integration/typescript-plain", + "version": "0.0.1", + "main": "./dist/index.js", + "author": "Michael Nahkies", + "license": "MIT", + "private": true, + "scripts": { + "clean": "rm -rf ./dist && rm -rf ./src/generated", + "validate": "tsc -p ./tsconfig.json" + }, + "type": "module", + "dependencies": { + "@nahkies/typescript-fetch-runtime": "workspace:*", + "dotenv": "^17.4.2", + "tslib": "^2.8.1", + "zod": "^4.3.6" + }, + "devDependencies": { + "@types/node": "^22.20.0", + "typescript": "catalog:typescript7" + } +} diff --git a/integration-tests/typescript-plain/tsconfig.json b/integration-tests/typescript-plain/tsconfig.json new file mode 100644 index 000000000..f5dfc4a4c --- /dev/null +++ b/integration-tests/typescript-plain/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.integration.base.json", + "compilerOptions": { + "exactOptionalPropertyTypes": true, + "noUnusedLocals": true + } +} diff --git a/package.json b/package.json index 92e01be5e..9836ebe4a 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "remark": "^15.0.1", "remark-toc": "^9.0.0", "typescript": "catalog:typescript7", + "tsx": "catalog:", "vitest": "catalog:" }, "workspaces": [ diff --git a/packages/documentation/src/lib/playground/load-runtime-types.tsx b/packages/documentation/src/lib/playground/load-runtime-types.tsx index 57cfd3310..dc185f5ac 100644 --- a/packages/documentation/src/lib/playground/load-runtime-types.tsx +++ b/packages/documentation/src/lib/playground/load-runtime-types.tsx @@ -20,7 +20,8 @@ export const loadRuntimeTypes = async ( | "typescript-fetch" | "typescript-axios" | "typescript-koa" - | "typescript-express", + | "typescript-express" + | "typescript-plain", ) => { const fileRootPath = "file:///" @@ -119,6 +120,7 @@ export const loadRuntimeTypes = async ( path: "/node_modules/@nahkies/typescript-express-runtime/joi.d.mts", }, ], + "typescript-plain": [], } for (const file of files[template]) { diff --git a/packages/openapi-code-generator/src/cli.ts b/packages/openapi-code-generator/src/cli.ts index afa7a8025..ac8e8abe0 100644 --- a/packages/openapi-code-generator/src/cli.ts +++ b/packages/openapi-code-generator/src/cli.ts @@ -40,7 +40,7 @@ const program = new Command() .addOption( new Option("--input-type ", "type of input specification") .env("OPENAPI_INPUT_TYPE") - .choices(["openapi3", "typespec"] as const) + .choices(["openapi3", "typespec", "json-schema"] as const) .default("openapi3" as const) .makeOptionMandatory(), ) diff --git a/packages/openapi-code-generator/src/config.ts b/packages/openapi-code-generator/src/config.ts index 1123b81dd..d01778b66 100644 --- a/packages/openapi-code-generator/src/config.ts +++ b/packages/openapi-code-generator/src/config.ts @@ -8,7 +8,7 @@ import type {ServerImplementationMethod} from "./templates.types.ts" export type Config = { input: string - inputType: "openapi3" | "typespec" + inputType: "openapi3" | "typespec" | "json-schema" overrideSpecificationTitle?: string | undefined output: string template: @@ -17,6 +17,7 @@ export type Config = { | "typescript-angular" | "typescript-koa" | "typescript-express" + | "typescript-plain" schemaBuilder: "zod-v3" | "zod-v4" | "joi" enableRuntimeResponseValidation: boolean enableTypedBasePaths: boolean @@ -46,7 +47,7 @@ const tsServerImplementationSchema = z.enum([ export const configSchema = z.object({ input: z.string(), - inputType: z.enum(["openapi3", "typespec"]), + inputType: z.enum(["openapi3", "typespec", "json-schema"]), overrideSpecificationTitle: z.string().optional(), output: z.string(), template: templatesSchema, diff --git a/packages/openapi-code-generator/src/core/dependency-graph.ts b/packages/openapi-code-generator/src/core/dependency-graph.ts index f5bff5291..58854b96e 100644 --- a/packages/openapi-code-generator/src/core/dependency-graph.ts +++ b/packages/openapi-code-generator/src/core/dependency-graph.ts @@ -110,7 +110,13 @@ export function buildDependencyGraph( const order: string[] = [] // TODO: this may miss extracted in-line schemas - for (const [name, schema] of Object.entries(schemaProvider.allSchemas())) { + for (const [name, schema] of Object.entries( + schemaProvider.allSchemas(), + ).concat( + schemaProvider + .allJsonSchemaDocuments() + .map((it) => [it.filename, it.schema]), + )) { remaining.set( getNameForRef({$ref: name}), getDependenciesFromSchema(schema, getNameForRef), diff --git a/packages/openapi-code-generator/src/core/file-system/fs-adaptor.ts b/packages/openapi-code-generator/src/core/file-system/fs-adaptor.ts index 9115a663c..ac25b502b 100644 --- a/packages/openapi-code-generator/src/core/file-system/fs-adaptor.ts +++ b/packages/openapi-code-generator/src/core/file-system/fs-adaptor.ts @@ -7,6 +7,10 @@ export interface IFsAdaptor { existsSync(path: string): boolean + isDir(path: string): Promise + + readDir(path: string): Promise + mkDir(path: string, recursive: boolean): Promise resolve(request: string, fromDir: string): string diff --git a/packages/openapi-code-generator/src/core/file-system/node-fs-adaptor.ts b/packages/openapi-code-generator/src/core/file-system/node-fs-adaptor.ts index de15d3d20..87335b3ab 100644 --- a/packages/openapi-code-generator/src/core/file-system/node-fs-adaptor.ts +++ b/packages/openapi-code-generator/src/core/file-system/node-fs-adaptor.ts @@ -15,8 +15,8 @@ export class NodeFsAdaptor implements IFsAdaptor { async exists(path: string) { try { - const stat = await fs.stat(path) - return stat.isFile() + await fs.stat(path) + return true } catch (err) { if ( typeof err === "object" && @@ -33,6 +33,27 @@ export class NodeFsAdaptor implements IFsAdaptor { return existsSync(path) } + async isDir(path: string) { + try { + const stat = await fs.stat(path) + return stat.isDirectory() + } catch (err) { + if ( + typeof err === "object" && + err !== null && + Reflect.get(err, "code") === "ENOENT" + ) { + return false + } + throw err + } + } + + async readDir(path: string) { + const files = await fs.readdir(path, {recursive: true}) + return files.map((file) => pathModule.join(path, file)) + } + async mkDir(path: string, recursive = true) { await fs.mkdir(path, {recursive}) } diff --git a/packages/openapi-code-generator/src/core/file-system/web-fs-adaptor.ts b/packages/openapi-code-generator/src/core/file-system/web-fs-adaptor.ts index 9de8c0de2..c42383e81 100644 --- a/packages/openapi-code-generator/src/core/file-system/web-fs-adaptor.ts +++ b/packages/openapi-code-generator/src/core/file-system/web-fs-adaptor.ts @@ -32,6 +32,23 @@ export class WebFsAdaptor implements IFsAdaptor { return this.files.has(path) } + async isDir(path: string) { + const prefix = path.endsWith("/") ? path : `${path}/` + return Array.from(this.files.keys()).some((it) => it.startsWith(prefix)) + } + + async readDir(path: string) { + const prefix = path.endsWith("/") ? path : `${path}/` + return Array.from( + new Set( + Array.from(this.files.keys()) + .filter((it) => it.startsWith(prefix)) + .map((it) => it.slice(prefix.length).split("/")[0]) + .filter((it): it is string => !!it), + ), + ) + } + async mkDir() { /*noop*/ } diff --git a/packages/openapi-code-generator/src/core/input.ts b/packages/openapi-code-generator/src/core/input.ts index b7d767458..cc2cd62ce 100644 --- a/packages/openapi-code-generator/src/core/input.ts +++ b/packages/openapi-code-generator/src/core/input.ts @@ -40,6 +40,7 @@ export type InputConfig = { export interface ISchemaProvider { schema(maybeRef: MaybeIRModel | Reference): IRModel allSchemas(): Record + allJsonSchemaDocuments(): {filename: string; schema: IRModel}[] preprocess(maybePreprocess: Reference | xInternalPreproccess): IRPreprocess } @@ -65,10 +66,23 @@ export class Input implements ISchemaProvider { return this.normalizeServers(coalesce(this.loader.entryPoint.servers, [])) } - allSchemas(): Record { - const allDocuments = this.loader.allDocuments() + entryPoint() { + return this.loader.entryPoint + } + + allDocuments() { + return this.loader.allDocuments() + } + + allJsonSchemaDocuments(): {filename: string; schema: IRModel}[] { + return this.loader.allJsonSchemas().map((it) => ({ + filename: it.filename, + schema: this.schemaNormalizer.normalize(it.schema), + })) + } - const schemas = allDocuments.reduce( + allSchemas(documents = this.allDocuments()): Record { + const schemas = documents.reduce( (acc, it) => { return Object.assign(acc, it.components?.schemas ?? {}) }, diff --git a/packages/openapi-code-generator/src/core/loaders/generic.loader.ts b/packages/openapi-code-generator/src/core/loaders/generic.loader.ts index 9c80a8571..b98ef3be8 100644 --- a/packages/openapi-code-generator/src/core/loaders/generic.loader.ts +++ b/packages/openapi-code-generator/src/core/loaders/generic.loader.ts @@ -28,7 +28,7 @@ export function headersForRemoteUri( export class GenericLoader { constructor( - private readonly fsAdaptor: IFsAdaptor, + readonly fsAdaptor: IFsAdaptor, private readonly requestHeaders: GenericLoaderRequestHeaders = {}, ) {} diff --git a/packages/openapi-code-generator/src/core/loaders/openapi-loader.ts b/packages/openapi-code-generator/src/core/loaders/openapi-loader.ts index 9c216e3cf..c0b05fab0 100644 --- a/packages/openapi-code-generator/src/core/loaders/openapi-loader.ts +++ b/packages/openapi-code-generator/src/core/loaders/openapi-loader.ts @@ -21,6 +21,7 @@ import {isRemote} from "./utils.ts" export class OpenapiLoader { private readonly virtualLibrary = new Map() private readonly library = new Map() + private readonly jsonSchemas = new Map() private constructor( private readonly entryPointKey: string, @@ -56,6 +57,13 @@ export class OpenapiLoader { return Array.from(this.library.values()) } + allJsonSchemas(): {filename: string; schema: Schema}[] { + return Array.from(this.jsonSchemas.entries()).map(([key, value]) => ({ + filename: key, + schema: value, + })) + } + paths(maybeRef: Reference | Path): Path { return isRef(maybeRef) ? this.$ref(maybeRef) : maybeRef } @@ -88,7 +96,7 @@ export class OpenapiLoader { const [key, objPath] = $ref.split("#") // biome-ignore lint/suspicious/noExplicitAny: dynamic - const obj: any = key && this.library.get(key) + const obj: any = key && (this.library.get(key) ?? this.jsonSchemas.get(key)) if (!obj) { throw new Error(`could not load $ref, key not loaded. $ref: '${$ref}'`) @@ -148,6 +156,24 @@ export class OpenapiLoader { } } + private async loadJsonSchema(file: string) { + if (this.jsonSchemas.has(file)) { + return + } + const [loadedFrom, definition] = await this.genericLoader.loadFile(file) + await this.validator.validate( + loadedFrom, + definition, + undefined, + "json-schema", + ) + + // biome-ignore lint/suspicious/noExplicitAny: dynamic + this.jsonSchemas.set(loadedFrom, definition as any) + + await this.normalizeRefs(loadedFrom, definition) + } + // biome-ignore lint/suspicious/noExplicitAny: dynamic private async normalizeRefs(loadedFrom: string, obj: any) { for (const key in obj) { @@ -194,7 +220,7 @@ export class OpenapiLoader { static async create( config: { entryPoint: string - fileType: "openapi3" | "typespec" + fileType: "openapi3" | "typespec" | "json-schema" titleOverride: string | undefined }, validator: IOpenapiValidator, @@ -224,6 +250,44 @@ export class OpenapiLoader { await loader.loadFileContent(entryPoint, openapi) break } + case "json-schema": { + const isDir = + !isRemote(entryPoint) && + (await genericLoader.fsAdaptor.isDir(entryPoint)) + + const files = isDir + ? (await genericLoader.fsAdaptor.readDir(entryPoint)).filter( + (it) => + it.endsWith(".json") || + it.endsWith(".yaml") || + it.endsWith(".yml"), + ) + : [entryPoint] + + for (const file of files) { + await loader.loadJsonSchema(file) + } + // + // const openapi: OpenapiDocument = { + // openapi: "3.0.3", + // info: { + // title: config.titleOverride ?? path.basename(entryPoint), + // version: "1.0.0", + // }, + // paths: {}, + // components: { + // schemas: Object.fromEntries( + // files.map((file) => { + // const name = path.parse(file).name + // return [name, {$ref: `${path.join(entryPoint, file)}#`}] + // }), + // ), + // }, + // } + // await loader.loadFileContent(entryPoint, openapi) + + break + } default: { throw new Error(`unsupported file type '${config.fileType}'`) } diff --git a/packages/openapi-code-generator/src/core/openapi-utils.ts b/packages/openapi-code-generator/src/core/openapi-utils.ts index 7d9e1f8c8..ce4ad6e4a 100644 --- a/packages/openapi-code-generator/src/core/openapi-utils.ts +++ b/packages/openapi-code-generator/src/core/openapi-utils.ts @@ -1,3 +1,4 @@ +import path from "node:path" import type {Reference} from "./openapi-types.ts" export function isRef(it: unknown | Reference): it is Reference { @@ -8,6 +9,10 @@ export function isRef(it: unknown | Reference): it is Reference { } export function getRawNameFromRef({$ref}: Reference): string { + if (!$ref.includes("#")) { + return path.basename($ref, path.extname($ref)) + } + const name = $ref.split("/").pop() if (!name) { diff --git a/packages/openapi-code-generator/src/core/openapi-validator.ts b/packages/openapi-code-generator/src/core/openapi-validator.ts index ac6463391..4aaa2c057 100644 --- a/packages/openapi-code-generator/src/core/openapi-validator.ts +++ b/packages/openapi-code-generator/src/core/openapi-validator.ts @@ -3,6 +3,7 @@ import type { OutputFormat, ValidationOptions, } from "@hyperjump/json-schema" +import {validate as validateJsonSchema202012} from "@hyperjump/json-schema/draft-2020-12" import {validate as validate3_0} from "@hyperjump/json-schema/openapi-3-0" import {validate as validate3_1} from "@hyperjump/json-schema/openapi-3-1" import { @@ -13,17 +14,27 @@ import {logger} from "./logger.ts" import type {ValidateFunction} from "./schemas/IValidateFunction.ts" export interface IOpenapiValidator { - validate(filename: string, schema: unknown, strict?: boolean): Promise + validate( + filename: string, + schema: unknown, + strict?: boolean, + type?: "openapi" | "json-schema", + ): Promise } export class OpenapiValidator implements IOpenapiValidator { private constructor( private readonly validate3_1: ValidateFunction, private readonly validate3_0: ValidateFunction, + private readonly validateJsonSchema: ValidateFunction, private readonly onValidationFailed: (filename: string) => Promise, ) {} private validationFunction(version: string): ValidateFunction { + if (version === "json-schema") { + logger.info("Validating against JSON Schema") + return this.validateJsonSchema + } if (version.startsWith("3.0")) { logger.info("Validating against 3.0") return this.validate3_0 @@ -42,12 +53,14 @@ export class OpenapiValidator implements IOpenapiValidator { filename: string, schema: unknown, strict = false, + type: "openapi" | "json-schema" = "openapi", ): Promise { const version = - (schema && - typeof schema === "object" && - Reflect.get(schema, "openapi")) || - "unknown" + type === "openapi" + ? schema && typeof schema === "object" && Reflect.get(schema, "openapi") + : type === "json-schema" + ? "json-schema" + : "unknown" const validate = this.validationFunction(version) const {isValid, errors} = await validate(schema) @@ -100,6 +113,10 @@ export class OpenapiValidator implements IOpenapiValidator { return new OpenapiValidator( wrapHyperjump(validate3_1, "https://spec.openapis.org/oas/3.1/schema"), wrapHyperjump(validate3_0, "https://spec.openapis.org/oas/3.0/schema"), + wrapHyperjump( + validateJsonSchema202012, + "https://json-schema.org/draft/2020-12/schema", + ), onValidationFailed, ) } diff --git a/packages/openapi-code-generator/src/templates.ts b/packages/openapi-code-generator/src/templates.ts index 83183ca4e..9d57f073f 100644 --- a/packages/openapi-code-generator/src/templates.ts +++ b/packages/openapi-code-generator/src/templates.ts @@ -3,6 +3,7 @@ import type {OpenapiGenerator} from "./templates.types.ts" import {generateTypescriptAngular} from "./typescript/client/typescript-angular/typescript-angular.generator.ts" import {generateTypescriptAxios} from "./typescript/client/typescript-axios/typescript-axios.generator.ts" import {generateTypescriptFetch} from "./typescript/client/typescript-fetch/typescript-fetch.generator.ts" +import {generateTypescriptPlainSchema} from "./typescript/other/typescript-plain/typescript-plain.generator.ts" import {generateTypescriptExpress} from "./typescript/server/typescript-express/typescript-express.generator.ts" import {generateTypescriptKoa} from "./typescript/server/typescript-koa/typescript-koa.generator.ts" @@ -37,6 +38,12 @@ export const templates = { run: generateTypescriptExpress, syntheticNameGenerator: defaultSyntheticNameGenerator, }, + "typescript-plain": { + language: "typescript", + type: "client", // Doesn't matter much for this template + run: generateTypescriptPlainSchema, + syntheticNameGenerator: defaultSyntheticNameGenerator, + }, } satisfies {[key: string]: OpenapiGenerator} export const templateNames = [ @@ -45,4 +52,5 @@ export const templateNames = [ "typescript-angular", "typescript-koa", "typescript-express", + "typescript-plain", ] as const satisfies Array diff --git a/packages/openapi-code-generator/src/test/fake-schema-provider.ts b/packages/openapi-code-generator/src/test/fake-schema-provider.ts index 3bbe39130..d55ce6275 100644 --- a/packages/openapi-code-generator/src/test/fake-schema-provider.ts +++ b/packages/openapi-code-generator/src/test/fake-schema-provider.ts @@ -9,14 +9,21 @@ import {getRawNameFromRef, isRef} from "../core/openapi-utils.ts" export class FakeSchemaProvider implements ISchemaProvider { private readonly testRefs: Record = {} + private readonly testJsonSchemaDocuments: Record = {} registerTestRef(ref: IRRef, model: IRModel) { this.testRefs[ref.$ref] = model } + registerJsonSchemaDocument(filename: string, schema: IRModel) { + this.testJsonSchemaDocuments[filename] = schema + } + schema(maybeRef: MaybeIRModel): IRModel { if (isRef(maybeRef)) { - const result = this.testRefs[maybeRef.$ref] + const result = + this.testRefs[maybeRef.$ref] ?? + this.testJsonSchemaDocuments[maybeRef.$ref] if (!result) { throw new Error( @@ -38,6 +45,14 @@ export class FakeSchemaProvider implements ISchemaProvider { ) } + allJsonSchemaDocuments() { + return Object.entries(this.testJsonSchemaDocuments).map( + ([filename, schema]) => { + return {filename, schema} + }, + ) + } + preprocess(): IRPreprocess { return {} } diff --git a/packages/openapi-code-generator/src/typescript/common/import-builder.ts b/packages/openapi-code-generator/src/typescript/common/import-builder.ts index 1566131c4..840d62694 100644 --- a/packages/openapi-code-generator/src/typescript/common/import-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/import-builder.ts @@ -99,7 +99,7 @@ export class ImportBuilder { > = {} private readonly importAll: Record = {} - constructor(private readonly config: ImportBuilderConfig) { + constructor(public readonly config: ImportBuilderConfig) { if (this.config.unit?.filename) { this.config.unit.filename = normalizeToUnix(this.config.unit.filename) } @@ -205,6 +205,10 @@ export class ImportBuilder { // biome-ignore lint/style/noParameterAssign: normalization from = this.normalizeFrom(from) + if (this.config.unit?.filename === from) { + throw new Error(`cannot import from self: ${from}`) + } + if (!this.imports[from]) { this.imports[from] = { values: new Set(), diff --git a/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts b/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts index 2ff0451f1..20227bd14 100644 --- a/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts @@ -24,6 +24,7 @@ import type {SchemaBuilderType} from "./schema-builder.ts" export type SchemaBuilderConfig = { allowAny: boolean + refToFilename?: ($ref: string) => string } export abstract class AbstractSchemaBuilder< @@ -61,15 +62,29 @@ export abstract class AbstractSchemaBuilder< abstract withImports(imports: ImportBuilder): SubClass private add(reference: Reference): string { - this.parent?.add(reference) + const {$ref} = reference const name = this.getSchemaNameFromRef(reference) - this.referenced[name] = reference if (this.imports) { - this.imports.addSingle(name, this.filename, false) + const ref = $ref.split("#")[0] + const from = ref && this.config.refToFilename?.(ref) + + if (from && from !== this.filename) { + this.parent?.add(reference) + this.referenced[name] = reference + this.imports.addSingle(name, from, false) + return name + } else if ( + this.imports.config.unit?.filename !== (from || this.filename) + ) { + this.imports?.addSingle(name, from || this.filename, false) + } } + this.parent?.add(reference) + this.referenced[name] = reference + return name } diff --git a/packages/openapi-code-generator/src/typescript/common/type-builder/type-builder.ts b/packages/openapi-code-generator/src/typescript/common/type-builder/type-builder.ts index e9380dd77..15fff76c5 100644 --- a/packages/openapi-code-generator/src/typescript/common/type-builder/type-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/type-builder/type-builder.ts @@ -32,6 +32,7 @@ type StaticType = keyof typeof staticTypes export type TypeBuilderConfig = { allowAny: boolean + refToFilename?: ($ref: string) => string } type IRTypeIntersection = {type: "type-intersection"; types: IRType[]} @@ -139,13 +140,24 @@ export class TypeBuilder implements ICompilable { return getNameFromRef(reference, "t_") } - protected add({$ref}: Reference): string { - this.parent?.add({$ref}) - this.referenced.add($ref) + private add(reference: Reference): string { + const {$ref} = reference - const name = this.getTypeNameFromRef({$ref}) + const name = this.getTypeNameFromRef(reference) - this.imports?.addSingle(name, this.filename, true) + const ref = $ref.split("#")[0] + const from = ref && this.config.refToFilename?.(ref) + + if (from && from !== this.filename) { + this.imports?.addSingle(name, from, true) + } else { + if (this.imports?.config.unit?.filename !== (from || this.filename)) { + this.imports?.addSingle(name, from || this.filename, true) + } + + this.parent?.add(reference) + this.referenced.add($ref) + } return name } diff --git a/packages/openapi-code-generator/src/typescript/other/typescript-plain/typescript-plain.generator.ts b/packages/openapi-code-generator/src/typescript/other/typescript-plain/typescript-plain.generator.ts new file mode 100644 index 000000000..a05e9cd67 --- /dev/null +++ b/packages/openapi-code-generator/src/typescript/other/typescript-plain/typescript-plain.generator.ts @@ -0,0 +1,68 @@ +import path from "node:path" +import type {OpenapiTypescriptGeneratorConfig} from "../../../templates.types.ts" +import {CompilationUnit} from "../../common/compilation-units.ts" +import {ImportBuilder} from "../../common/import-builder.ts" +import {schemaBuilderFactory} from "../../common/schema-builders/schema-builder.ts" +import {TypeBuilder} from "../../common/type-builder/type-builder.ts" + +export async function generateTypescriptPlainSchema( + config: OpenapiTypescriptGeneratorConfig, +): Promise { + const {input, emitter, allowAny} = config + const importBuilderConfig = {includeFileExtensions: config.isEsmProject} + + const units: CompilationUnit[] = [] + const documents = input.allJsonSchemaDocuments() + + const fileNameForSchema = (filename: string) => { + return `./${path.basename(filename, path.extname(filename))}.ts` + } + + for (const document of documents) { + const filename = fileNameForSchema(document.filename) + + const imports = new ImportBuilder({ + ...importBuilderConfig, + unit: {filename}, + }) + + const typeBuilder = ( + await TypeBuilder.fromSchemaProvider( + filename, + input, + config.compilerOptions, + {allowAny, refToFilename: fileNameForSchema}, + ) + ).withImports(imports) + + const schemaBuilder = ( + await schemaBuilderFactory( + filename, + input, + config.schemaBuilder, + {allowAny, refToFilename: fileNameForSchema}, + imports, + typeBuilder, + ) + ).withImports(imports) + + const ref = { + $ref: `${path.basename(document.filename)}`, + } + + // reference the schema so it's included in the type builder compilation unit + void typeBuilder.schemaObjectToType(ref) + // reference the schema so it's included in the schema builder compilation unit + void schemaBuilder.fromModel(ref, true) + + const unit = CompilationUnit.merge( + filename, + typeBuilder.toCompilationUnit(), + schemaBuilder.toCompilationUnit(), + ) + + units.push(unit) + } + + await emitter.emitGenerationResult(units) +} diff --git a/packages/openapi-code-generator/src/typescript/other/typescript-plain/typescript-plain.generator.unit.spec.ts b/packages/openapi-code-generator/src/typescript/other/typescript-plain/typescript-plain.generator.unit.spec.ts new file mode 100644 index 000000000..84f49d249 --- /dev/null +++ b/packages/openapi-code-generator/src/typescript/other/typescript-plain/typescript-plain.generator.unit.spec.ts @@ -0,0 +1,93 @@ +import {describe, expect, it} from "vitest" +import {testFsAdaptor} from "../../../core/file-system/test-fs-adaptor.ts" +import type {Input} from "../../../core/input.ts" +import {FakeSchemaProvider} from "../../../test/fake-schema-provider.ts" +import {irFixture as ir} from "../../../test/ir-model.fixtures.test-utils.ts" +import {TypescriptEmitter} from "../../common/typescript-emitter.ts" +import {TypescriptFormatterBiome} from "../../common/typescript-formatter.biome.ts" +import {generateTypescriptPlainSchema} from "./typescript-plain.generator.ts" + +describe("generateTypescriptJsonSchema", () => { + it("should not import from itself", async () => { + const input = new FakeSchemaProvider() + const formatter = await TypescriptFormatterBiome.createNodeFormatter() + const fs = testFsAdaptor({}) + const emitter = new TypescriptEmitter(fs, formatter, { + allowUnusedImports: false, + destinationDirectory: "/dist/", + }) + + const addressFilename = "address.json" + const userFilename = "user.json" + + input.registerJsonSchemaDocument( + addressFilename, + ir.object({ + properties: { + street: ir.string(), + }, + }), + ) + + input.registerJsonSchemaDocument( + userFilename, + ir.object({ + properties: { + name: ir.string(), + address: {$ref: addressFilename}, + self: {$ref: userFilename}, + }, + }), + ) + + await generateTypescriptPlainSchema({ + enableRuntimeResponseValidation: false, + enableTypedBasePaths: false, + filenameConvention: "snake-case", + groupingStrategy: "none", + serverImplementationMethod: "type", + input: input as unknown as Input, + emitter, + schemaBuilder: "zod-v4", + compilerOptions: {}, + allowAny: false, + isEsmProject: true, + }) + + expect(fs.files.get("/dist/user.ts")).toMatchInlineSnapshot(` + "/** AUTOGENERATED - DO NOT EDIT **/ + /* tslint:disable */ + /* eslint-disable */ + + import { z } from "zod/v4" + import { s_address, type t_address } from "./address.ts" + + export type t_user = { + address?: t_address + name?: string + self?: t_user + } + + export const s_user: z.ZodType = z.object({ + name: z.string().optional(), + address: s_address.optional(), + self: z.lazy(() => s_user.optional()), + }) + " + `) + expect(fs.files.get("/dist/address.ts")).toMatchInlineSnapshot(` + "/** AUTOGENERATED - DO NOT EDIT **/ + /* tslint:disable */ + /* eslint-disable */ + + import { z } from "zod/v4" + + export type t_address = { + street?: string + } + + export const s_address = z.object({ street: z.string().optional() }) + " + `) + }) +}) diff --git a/packages/openapi-code-generator/src/typescript/server/typescript-koa/typescript-koa.generator.ts b/packages/openapi-code-generator/src/typescript/server/typescript-koa/typescript-koa.generator.ts index 47276a12e..e68fca79e 100644 --- a/packages/openapi-code-generator/src/typescript/server/typescript-koa/typescript-koa.generator.ts +++ b/packages/openapi-code-generator/src/typescript/server/typescript-koa/typescript-koa.generator.ts @@ -24,14 +24,14 @@ export async function generateTypescriptKoa( "./models.ts", input, config.compilerOptions, - {allowAny}, + {allowAny, refToFilename: () => "./models.ts"}, ) const rootSchemaBuilder = await schemaBuilderFactory( "./schemas.ts", input, config.schemaBuilder, - {allowAny}, + {allowAny, refToFilename: () => "./schemas.ts"}, schemaBuilderImports, rootTypeBuilder, ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d3a19d321..3532ef3bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -206,6 +206,9 @@ importers: remark-toc: specifier: ^9.0.0 version: 9.0.0 + tsx: + specifier: 'catalog:' + version: 4.23.0 typescript: specifier: catalog:typescript7 version: 7.0.2 @@ -402,6 +405,28 @@ importers: specifier: catalog:typescript7 version: 7.0.2 + integration-tests/typescript-plain: + dependencies: + '@nahkies/typescript-fetch-runtime': + specifier: workspace:* + version: link:../../packages/typescript-fetch-runtime + dotenv: + specifier: ^17.4.2 + version: 17.4.2 + tslib: + specifier: ^2.8.1 + version: 2.8.1 + zod: + specifier: ^4.3.6 + version: 4.4.3 + devDependencies: + '@types/node': + specifier: ^22.20.0 + version: 22.20.0 + typescript: + specifier: catalog:typescript7 + version: 7.0.2 + packages/documentation: dependencies: '@hookform/resolvers': diff --git a/scripts/generate.mjs b/scripts/generate.mjs index 72ee88975..31e79a3c5 100755 --- a/scripts/generate.mjs +++ b/scripts/generate.mjs @@ -26,7 +26,9 @@ const templates = execSync( .map((it) => it.trim()) .filter(Boolean) -const definitions = execSync("find ./integration-tests-definitions -type f") +const definitions = execSync( + "find ./integration-tests-definitions -type f -maxdepth 1", +) .toString("utf-8") .split("\n") .map((it) => it.trim()) @@ -42,7 +44,11 @@ const filteredSpec = config.spec ? path.normalize(config.spec) : undefined console.info("filters", {filteredTemplate, filteredSpec}) Promise.all( templates - .filter((it) => !filteredTemplate || it.includes(filteredTemplate)) + .filter( + (it) => + (!it.includes("typescript-plain") && !filteredTemplate) || + it.includes(filteredTemplate), + ) .flatMap((templatePath) => definitions .filter( @@ -50,6 +56,12 @@ Promise.all( ) .map((definition) => runSingle(templatePath, definition)), ), + // .concat( + // runSingle( + // "./integration-tests/typescript-plain", + // "./integration-tests-definitions/json-schemas", + // ), + // ), ) .then(() => { console.log("success!") @@ -61,7 +73,10 @@ Promise.all( }) async function runSingle(templatePath, input) { - const inputType = input.endsWith(".tsp") ? "typespec" : "openapi3" + let inputType = input.endsWith(".tsp") ? "typespec" : "openapi3" + if (input.includes("json-schemas")) { + inputType = "json-schema" + } const filename = path.basename(input) const template = path.basename(templatePath) @@ -75,7 +90,7 @@ async function runSingle(templatePath, input) { try { const result = await runCmd( - `node ./packages/openapi-code-generator/dist/esm/cli.mjs ${args.join(" ")}`, + `pnpm exec tsx ./packages/openapi-code-generator/src/cli.ts ${args.join(" ")}`, ) for (const it of result) { console.info(`[${template} - ${filename}] ${it}`)