import {z} from 'zod' export type CbdType = 'hemp' | 'marijuana'; export type HempActivities = 'cultivation' | 'manufacturing_products' | 'processing' | 'retail_sale' | 'other'; export type StateCode = 'AL' | 'AK' | 'AZ' | 'AR' | 'CA' | 'CO' | 'CT' | 'DC' | 'DE' | 'FL' | 'GA' | 'HI' | 'ID' | 'IL' | 'IN' | 'IA' | 'KS' | 'KY' | 'LA' | 'ME' | 'MD' | 'MA' | 'MI' | 'MN' | 'MS' | 'MO' | 'MT' | 'NE' | 'NV' | 'NH' | 'NJ' | 'NM' | 'NY' | 'NC' | 'ND' | 'OH' | 'OK' | 'OR' | 'PA' | 'RI' | 'SC' | 'SD' | 'TN' | 'TX' | 'UT' | 'VT' | 'VA' | 'WA' | 'WV' | 'WI' | 'WY' | 'PR'; export type HempCultivationLocation = {name: string, physical_address: string, date_of_last_harvest: string, state_license: boolean}; export type CannabisCultivatorDueDiligence = {hemp_cultivation_location_details: Array, harvest_testing_processes: string, non_compliant_plants_disposal: string, customer_base_product_acquisition: string, purchase_controls: string}; export type ProductContainsThc = 'no' | 'low' | 'high'; export type CannabisProcessorManufacturerDueDiligence = {plant_sources: string, final_products: string, products_contain_thc: ProductContainsThc, cbd_type: Array, product_testing_processes: string, customer_base: string, how_products_sold: string, purchase_controls: string}; export type CannabisRetailSaleMethod = 'online' | 'non_proprietary_store' | 'proprietary_store'; export type AcceptedPaymentMethods = 'cash' | 'check' | 'credit_card' | 'electronic_transfer'; export type CannabisRetailSaleDueDiligence = {products_description: string, products_contain_thc: ProductContainsThc, cbd_type: Array, product_sources: string, product_compliance: string, sale_method: Array, online_sales_tracking?: (string | null) | undefined, physical_store_locations?: (Array | null) | undefined, accepted_payment_methods: Array}; export type HempCbdDueDiligence = {activities: Array, operation_states: Array, cultivation?: (CannabisCultivatorDueDiligence | null) | undefined, manufacturing_products?: (CannabisProcessorManufacturerDueDiligence | null) | undefined, processing?: (CannabisProcessorManufacturerDueDiligence | null) | undefined, retail_sale?: (CannabisRetailSaleDueDiligence | null) | undefined}; export type MarijuanaActivities = 'Directly manufacture, distribute, and/or dispense marijuana.' | 'Provide product(s)/service(s) to companies that directly manufacture, distribute, and/or dispense marijuana.'; export type AtmOwner = 'financial_institution' | 'contractor' | 'business'; export type AtmFunding = 'armored_car' | 'store_proceeds' | 'other'; export type MrbDueDiligence = {marijuana_activities: Array, marijuana_percentage_revenue: number | string, product_service_description: string, customer_base_revenue: string, accepted_payment_methods: Array, business_physical_locations?: (Array | null) | undefined, business_states: Array, atm_on_site: boolean, atm_owner?: (AtmOwner | null) | undefined, atm_owner_name?: (string | null) | undefined, atm_funding?: (AtmFunding | null) | undefined}; export type CannabisDueDiligence = {compounds: Array, hemp_cbd?: (HempCbdDueDiligence | null) | undefined, mrb?: (MrbDueDiligence | null) | undefined}; export type CannabisEddFormRequest = {form_type: 'cannabis', form_data: CannabisDueDiligence}; export type ExpectedTransactionQuantity = 'very_low' | 'low' | 'medium' | 'high' | 'very_high'; export type ExpectedTransactionQuantities = {dollar_amount?: (ExpectedTransactionQuantity | null) | undefined, volume?: (ExpectedTransactionQuantity | null) | undefined}; export type ExpectedTransactionsNetwork = {inbound?: (ExpectedTransactionQuantities | null) | undefined, outbound?: (ExpectedTransactionQuantities | null) | undefined}; export type ExpectedTransactionsRegion = {ach?: (ExpectedTransactionsNetwork | null) | undefined, wire?: (ExpectedTransactionsNetwork | null) | undefined}; export type ExpectedActivity = {local?: (ExpectedTransactionsRegion | null) | undefined, intl?: (ExpectedTransactionsRegion | null) | undefined}; export type CryptoDueDiligence = {business_overview: string, revenue_source: string, product_service_description: string, customer_base: string, source_of_funds: string, anticipated_day_one_balance?: (string | null) | undefined, is_money_service_business: boolean, received_legal_opinion?: (boolean | null) | undefined, requires_license_money_transmitter: boolean, custodies_cryptocurrency_nfts: boolean, operations?: (Array | null) | undefined, operations_details?: (string | null) | undefined, aml_sanctions_compliance_policy?: (boolean | null) | undefined, screening_for_sanctions?: (boolean | null) | undefined, third_party_screening?: (boolean | null) | undefined, third_party_screening_details?: (string | null) | undefined, sanctions_screening_process?: (string | null) | undefined, subject_to_regulatory_actions?: (boolean | null) | undefined, regulatory_actions_explanation?: (string | null) | undefined, international_transactions?: (boolean | null) | undefined, international_transactions_description?: (string | null) | undefined, anticipated_account_use?: (string | null) | undefined, expected_activity: ExpectedActivity, multiple_locations?: boolean | undefined, locations_list?: (Array | null) | undefined, has_adverse_media?: boolean | undefined, adverse_media_explanation?: (string | null) | undefined, has_adverse_media_related_issues?: boolean | undefined, adverse_media_related_issues_explanation?: (string | null) | undefined, funding_sources?: (string | null) | undefined, grant_disbursement_criteria?: (string | null) | undefined, affiliations?: (string | null) | undefined, attestation?: boolean | undefined}; export type CryptoEddFormRequest = {form_type: 'crypto', form_data: CryptoDueDiligence}; export type CountryCodeAlpha2 = 'AW' | 'AF' | 'AO' | 'AI' | 'AX' | 'AL' | 'AD' | 'AE' | 'AR' | 'AM' | 'AS' | 'AQ' | 'TF' | 'AG' | 'AU' | 'AT' | 'AZ' | 'BI' | 'BE' | 'BJ' | 'BQ' | 'BF' | 'BD' | 'BG' | 'BH' | 'BS' | 'BA' | 'BL' | 'BY' | 'BZ' | 'BM' | 'BO' | 'BR' | 'BB' | 'BN' | 'BT' | 'BV' | 'BW' | 'CF' | 'CA' | 'CC' | 'CH' | 'CL' | 'CN' | 'CI' | 'CM' | 'CD' | 'CG' | 'CK' | 'CO' | 'KM' | 'CV' | 'CR' | 'CU' | 'CW' | 'CX' | 'KY' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DM' | 'DK' | 'DO' | 'DZ' | 'EC' | 'EG' | 'ER' | 'EH' | 'ES' | 'EE' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FR' | 'FO' | 'FM' | 'GA' | 'GB' | 'GE' | 'GG' | 'GH' | 'GI' | 'GN' | 'GP' | 'GM' | 'GW' | 'GQ' | 'GR' | 'GD' | 'GL' | 'GT' | 'GF' | 'GU' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IM' | 'IN' | 'IO' | 'IE' | 'IR' | 'IQ' | 'IS' | 'IL' | 'IT' | 'JM' | 'JE' | 'JO' | 'JP' | 'KZ' | 'KE' | 'KG' | 'KH' | 'KI' | 'KN' | 'KR' | 'KW' | 'LA' | 'LB' | 'LR' | 'LY' | 'LC' | 'LI' | 'LK' | 'LS' | 'LT' | 'LU' | 'LV' | 'MO' | 'MF' | 'MA' | 'MC' | 'MD' | 'MG' | 'MV' | 'MX' | 'MH' | 'MK' | 'ML' | 'MT' | 'MM' | 'ME' | 'MN' | 'MP' | 'MZ' | 'MR' | 'MS' | 'MQ' | 'MU' | 'MW' | 'MY' | 'YT' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NU' | 'NL' | 'NO' | 'NP' | 'NR' | 'NZ' | 'OM' | 'PK' | 'PA' | 'PN' | 'PE' | 'PH' | 'PW' | 'PG' | 'PL' | 'PR' | 'KP' | 'PT' | 'PY' | 'PS' | 'PF' | 'QA' | 'RE' | 'RO' | 'RU' | 'RW' | 'SA' | 'SD' | 'SN' | 'SG' | 'GS' | 'SH' | 'SJ' | 'SB' | 'SL' | 'SV' | 'SM' | 'SO' | 'PM' | 'RS' | 'SS' | 'ST' | 'SR' | 'SK' | 'SI' | 'SE' | 'SZ' | 'SX' | 'SC' | 'SY' | 'TC' | 'TD' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TM' | 'TL' | 'TO' | 'TT' | 'TN' | 'TR' | 'TV' | 'TW' | 'TZ' | 'UG' | 'UA' | 'UM' | 'UY' | 'US' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'ZA' | 'ZM' | 'ZW'; export type InvestorType = 'accredited_investors' | 'qualified_purchasers' | 'institutional_firms'; export type InvestorsDueDiligence = {type_of_investors: Array, international_investors: boolean, investor_countries?: (Array | null) | undefined, investor_verification_process: string, additional_investors_due_diligence?: (string | null) | undefined}; export type InvestmentsDueDiligence = {overview: string, international_investments: boolean, countries_invested?: (Array | null) | undefined, registered_sec: boolean, current_portfolio_value: number | string, works_with_investors?: (boolean | null) | undefined, investors?: (InvestorsDueDiligence | null) | undefined}; export type InvestmentsEddFormRequest = {form_type: 'investments', form_data: InvestmentsDueDiligence}; export type HoldingTypeInput = 'investor' | 'real_estate'; export type HoldingEntityType = 'businesses' | 'individuals' | 'investors'; export type PropertyType = 'residential' | 'single_family' | 'commercial_use'; export type RealEstateHoldingDueDiligence = {property_types: Array, restricted_purpose?: boolean | undefined}; export type HoldingsDueDiligence = {holding_type: HoldingTypeInput, holding_entity_type: Array, real_estate?: (RealEstateHoldingDueDiligence | null) | undefined, investors?: (InvestorsDueDiligence | null) | undefined}; export type HoldingsEddFormRequest = {form_type: 'holdings', form_data: HoldingsDueDiligence}; export type MpmServicesOffered = 'fundraising' | 'portfolio_management' | 'fractional_executive_services' | 'financing' | 'loan_syndication' | 'underwriting' | 'advisory_services'; export type MpmDueDiligence = {overview: string, services_offered: Array, international_businesses?: (boolean | null) | undefined, other_countries_operations?: (Array | null) | undefined, works_with_investors?: (boolean | null) | undefined, investors?: (InvestorsDueDiligence | null) | undefined}; export type MpmEddFormRequest = {form_type: 'mpm', form_data: MpmDueDiligence}; export type LoanType = 'bridge_short_term_financing' | 'construction_loans' | 'property_rehab_loans' | 'other'; export type RealEstateDueDiligence = {overview: string, collects_rent_payments: boolean, property_types: Array, restricted_purpose?: (boolean | null) | undefined, other_countries_invested?: (Array | null) | undefined, works_with_investors?: (boolean | null) | undefined, investors?: (InvestorsDueDiligence | null) | undefined, loan_types?: (Array | null) | undefined, other_loan_types?: (string | null) | undefined}; export type RealEstateEddFormRequest = {form_type: 'real_estate', form_data: RealEstateDueDiligence}; export type NoWebsiteDueDiligence = {previous_experience: string, industry_certs_licenses: boolean, product_service_revenue: string, accepted_payment_methods: Array, customer_base: string}; export type NoWebsiteEddFormRequest = {form_type: 'no_website', form_data: NoWebsiteDueDiligence}; export type PhysicalPresenceInUsType = 'no_physical_presence' | 'remote_employees_in_us' | 'physical_presence_in_us' | 'third_party_operations_partnership'; export type NonUSUbosDueDiligence = {has_us_based_beneficial_owners: boolean, currently_has_us_based_operations?: (boolean | null) | undefined, us_based_operations_start_date?: (string | null) | undefined, physical_presence_in_us?: (PhysicalPresenceInUsType | null) | undefined, physical_presence_in_us_address?: (string | null) | undefined, physical_presence_in_us_description?: (string | null) | undefined, products_and_services_offered_in_us?: (string | null) | undefined, how_do_you_attract_us_customers?: (string | null) | undefined}; export type NonUSUbosEddFormRequest = {form_type: 'non_us_ubos', form_data: NonUSUbosDueDiligence}; export type RelatedEntity = {legal_name: string, jurisdiction_of_formation: CountryCodeAlpha2, primary_functional_role: string}; export type WalletProductType = 'third_party_integrated' | 'proprietary'; export type WalletCustodyModel = 'non_custodial' | 'custodial' | 'mpc_shared_control' | 'other'; export type WalletSafeguardingAnswer = 'yes' | 'no' | 'na'; export type WalletOverviewCustody = {operator_entity: string, operator_jurisdiction?: (CountryCodeAlpha2 | null) | undefined, product_name: string, access_description: string, wallet_type: WalletProductType, provider_infrastructure?: (string | null) | undefined, custody_model: WalletCustodyModel, entity_or_third_party_asset_control: boolean, asset_control_details?: (string | null) | undefined, user_assets_segregated?: (WalletSafeguardingAnswer | null) | undefined, user_assets_rehypothecated?: (WalletSafeguardingAnswer | null) | undefined, user_assets_held_one_to_one?: (WalletSafeguardingAnswer | null) | undefined, third_party_custodians?: (string | null) | undefined}; export type WalletSupportedAssetsNetworks = {networks_supported: string, asset_types_supported: string}; export type WalletFunctionalityServices = {send_receive_transfers: boolean, in_wallet_swaps: boolean, staking_yield: boolean, bridging_cross_chain: boolean, fiat_on_ramp: boolean, fiat_off_ramp: boolean, card_payment: boolean, lending_borrowing: boolean, third_party_dapps: boolean, third_party_providers?: (string | null) | undefined}; export type WalletUsersControls = {requires_kyc: boolean, kyc_details?: (string | null) | undefined, wallet_limits: string}; export type TokenBasics = {token_name: string, ticker_symbol: string, blockchain_network: string, date_of_deployment?: (string | null) | undefined}; export type TokenIssuer = {issuer_legal_entity: string, issuer_jurisdiction: CountryCodeAlpha2, issuer_acted_as_principal: boolean}; export type TokenSupply = {supply_type: string, total_supply?: (string | null) | undefined, distribution_description: string, primary_sale_occurred: boolean, primary_sale_entity?: (string | null) | undefined, jurisdictional_restrictions_applied?: (boolean | null) | undefined}; export type TokenFunction = {primary_function: string, holders_receive_equity?: (boolean | null) | undefined, holders_receive_revenue_share?: (boolean | null) | undefined, holders_receive_dividends?: (boolean | null) | undefined, holders_receive_contractual_claim?: (boolean | null) | undefined}; export type TokenCustody = {issuance_authority: string, third_party_conducts_sales: boolean, third_party_sales_details?: (string | null) | undefined, entity_maintains_custody: boolean, custody_entity?: (string | null) | undefined}; export type ProtocolEcosystemDueDiligence = {protocol_name: string, related_entities?: (Array | null) | undefined, corporate_structure_description?: (string | null) | undefined, protocol_upgrade_process: string, treasury_authority: string, has_unilateral_authority: boolean, unilateral_authority_details?: (string | null) | undefined, fund_flows_description: string, has_contractual_arrangements: boolean, protocol_generates_fees: boolean, fee_accrual_destination?: (string | null) | undefined, fee_control_entity?: (string | null) | undefined, interface_operator_entity?: (string | null) | undefined, website_url?: (string | null) | undefined, users_can_interact_directly: boolean, interface_implements_screening: boolean, screening_controls_description?: (string | null) | undefined, offers_wallet?: (boolean | null) | undefined, wallet_overview_custody?: (WalletOverviewCustody | null) | undefined, wallet_supported_assets_networks?: (WalletSupportedAssetsNetworks | null) | undefined, wallet_functionality_services?: (WalletFunctionalityServices | null) | undefined, wallet_users_controls?: (WalletUsersControls | null) | undefined, wallet_address_screening: string, ip_geoblocking: string, blocking_sanctioned_jurisdictions: string, blocking_sanctioned_wallets: string, screening_token_sale: string, screening_governance: string, screening_fee_distributions: string, screening_treasury: string, sanctions_implementing_entity?: (string | null) | undefined, sanctions_restricted_countries?: (Array | null) | undefined, has_token: boolean, token_basics?: (TokenBasics | null) | undefined, token_issuer?: (TokenIssuer | null) | undefined, token_supply?: (TokenSupply | null) | undefined, token_function?: (TokenFunction | null) | undefined, token_custody?: (TokenCustody | null) | undefined, obtained_legal_analysis: boolean, legal_analysis_summary?: (string | null) | undefined, registered_as_msb_vasp: boolean, msb_vasp_details?: (string | null) | undefined, registration_not_required: boolean, registration_not_required_details?: (string | null) | undefined}; export type ProtocolEcosystemEddFormRequest = {form_type: 'protocol_ecosystem', form_data: ProtocolEcosystemDueDiligence}; export type InternationalDueDiligence = {business_overview: string, revenue_source: string, product_service_description: string, customer_base: string, source_of_funds: string, multiple_locations: boolean, locations_list?: (Array | null) | undefined, ownership_structure: string, account_purpose: string, anticipated_account_use: string, anticipated_day_one_balance: string, requires_financial_services_license: boolean, incoming_funds_flow: string, outgoing_funds_flow: string, international_transactions_description: string, international_transactions_countries: Array, aml_sanctions_compliance_policy: boolean, sanctions_screening_process?: (string | null) | undefined, subject_to_regulatory_actions: boolean, regulatory_actions_explanation?: (string | null) | undefined, expected_activity: ExpectedActivity, attestation?: boolean | undefined}; export type InternationalEddFormRequest = {form_type: 'international', form_data: InternationalDueDiligence}; export type CreateApiEntitiesEntityIdDueDiligenceArgs = {entity_id: string, body: CannabisEddFormRequest | CryptoEddFormRequest | InvestmentsEddFormRequest | HoldingsEddFormRequest | MpmEddFormRequest | RealEstateEddFormRequest | NoWebsiteEddFormRequest | NonUSUbosEddFormRequest | ProtocolEcosystemEddFormRequest | InternationalEddFormRequest}; export type CreateApiEntitiesEntityIdDueDiligenceOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const onboardingApplicationStatus = z.enum(["pending_document_upload", "pending_user_action", "submitted", "under_review", "approved", "rejected"]); export const timestamp = z.string(); export const publicKybProofType = z.enum(["accredited", "address", "articles_of_organization", "bank_statement", "client_contract", "client_invoice", "beneficial_owner_address", "beneficial_owner_id", "beneficial_owner_id_back", "beneficial_ownership_register", "bylaws", "certificate_of_good_standing", "corporate_resolution", "drivers_license", "due_diligence", "ein", "final_edd_report", "periodic_review_report", "government_issued_business_license", "hemp_cultivator_state_license", "incorporation", "industry_related_license", "lease_agreement", "llc_resolution", "money_service_business_license", "money_transmitter_registration", "mortgage_statement", "national_id", "org_chart", "partnership_agreement", "partnership_agreement_due_diligence", "partnership_resolution", "personal_address", "remote_employees_due_diligence", "signed_ss4", "tax_exemption_certificate", "uk_officer_passport", "officer_registry", "uk_registry", "shareholder_registry", "uk_w8_en", "utility_bill", "us_based_office_proof_of_address_due_diligence", "pitch_deck", "active_business_registration", "proof_of_ownership_or_banking_authorization", "non_profit_bylaws", "operating_agreement", "flow_of_funds", "aml_sanction", "registration_or_license", "sec_filing", "legal_opinion", "certificate_of_formation_master_llc", "series_operating_agreement", "share_subscription_agreement", "fund_subscription_agreement", "safe_agreement", "convertible_note_agreement", "loan_promissory_note", "token_purchase_agreement", "saft_agreement", "deal_memo_hybrid_agreement", "issuer_due_diligence_report", "protocol_ecosystem_questionnaire", "investment_company_due_diligence_form", "us_based_operations_due_diligence_form", "register_of_directors", "articles_of_association", "memorandum_of_association", "non_profit_status", "ofac_sanctions_screening_policy", "aml_kyc_policy", "w8_bene", "corporate_structure_chart", "custody_safeguarding_agreement", "reserve_attestation", "sanctions_vendor_service_agreement", "contractual_fund_flow_agreements"]); export const onboardingDocumentStatus = z.object({proof_type: publicKybProofType, file_name: z.string().nullable(), representative_id: z.string().nullable().optional()}); export const onboardingKycStatus = z.enum(["not_started", "pending", "action_required", "approved", "rejected"]); export const publicOnboardingType = z.enum(["api", "smb", "mcp", "partner"]); export const publicOnboardingStep = z.enum(["gather_business_context", "collect_user_info", "collect_business_addresses", "collect_business_details", "collect_additional_details", "complete_due_diligence", "upload_documents", "manage_representatives", "complete_identity_verification", "accept_terms", "submit_application", "monitor_review", "resolve_info_requests", "onboarding_complete"]); export const onboardingPhase = z.enum(["business_info", "ready_to_submit", "submitted"]); export const publicOutstandingItemKind = z.enum(["document", "answers", "tin"]); export const publicOutstandingItem = z.object({kind: publicOutstandingItemKind, proof_type: publicKybProofType.nullable().optional(), detail: z.string()}); export const onboardingInfoRequest = z.object({request_id: z.string(), required_proof_types: z.array(publicKybProofType), questions_pending: z.boolean(), outstanding: z.array(publicOutstandingItem), note: z.string().nullable(), expires_at: timestamp.nullable()}); export const onboardingNextStep = z.object({step: publicOnboardingStep, phase: onboardingPhase, missing: z.array(z.string()), required_proof_types: z.array(publicKybProofType).optional(), can_submit: z.boolean(), info_requests: z.array(onboardingInfoRequest).optional()}); export const onboardingKycFailedCheck = z.enum(["accept_tos", "verify_sms", "kyc_check", "documentary_verification", "selfie_check", "watchlist_screening", "risk_check"]); export const onboardingRepresentativeKyc = z.object({representative_id: z.string(), first_name: z.string().nullable(), last_name: z.string().nullable(), email: z.string(), is_primary: z.boolean(), is_beneficial_owner: z.boolean(), percent_ownership: z.string().nullable(), kyc_status: onboardingKycStatus, failed_checks: z.array(onboardingKycFailedCheck)}); export const onboardingConsentStatus = z.enum(["pending", "viewed", "completed"]); export const agenticOnboardingConsentType = z.enum(["patriot_act", "application_attestation", "stripe_connected_account", "stripe_issuing_accountholder", "lead_bank_prepaid_card", "lead_bank_privacy", "meow_privacy_policy", "meow_terms_of_service", "grasshopper_terms_of_service", "grasshopper_ics_deposit_placement"]); export const onboardingConsentState = z.object({status: onboardingConsentStatus, consented_items: z.array(agenticOnboardingConsentType), remaining_items: z.array(agenticOnboardingConsentType), viewed_at: timestamp.nullable(), completed_at: timestamp.nullable()}); export const entityOnboardingStatusResponse = z.object({entity_id: z.string(), status: onboardingApplicationStatus, business_name: z.string().nullable(), created_at: timestamp, updated_at: timestamp, documents: z.array(onboardingDocumentStatus), kyc_status: onboardingKycStatus, onboarding_type: publicOnboardingType, next_step: onboardingNextStep, representatives: z.array(onboardingRepresentativeKyc), consent_url: z.string().nullable(), consent: onboardingConsentState.nullable()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Submit Due Diligence Form * * POST /entities/{entity_id}/due-diligence */ export const createApiEntitiesEntityIdDueDiligence = async (args: CreateApiEntitiesEntityIdDueDiligenceArgs, options?: CreateApiEntitiesEntityIdDueDiligenceOptions) => { const {baseUrl = "https://api.meow.com/v1", fetch: fetchFn = fetch, apiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (apiKeyAuth !== undefined) headers.set("x-api-key", apiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/entities/${encodeURIComponent(String(args.entity_id))}/due-diligence${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(entityOnboardingStatusResponse, await res.json()) };