/** * Ports (driven interfaces). Domain owns them; infrastructure implements them. * All operations are scoped by userId so ownership is enforced in the query. */ import type { CustomerListOptions, CustomerListResult, CustomerSummary, Profile, ProfilePatch, } from './profile.js'; import type { Address, AddressPatch, NewAddress } from './address.js'; export interface ProfileRepository { findByUserId(userId: string): Promise; /** Idempotent upsert; only provided fields change. */ upsert(userId: string, patch: ProfilePatch): Promise; list(): Promise; listCustomers(opts: CustomerListOptions): Promise; findCustomerById(userId: string): Promise; } export interface AddressRepository { listByUserId(userId: string): Promise; create(userId: string, input: NewAddress): Promise
; /** Returns undefined when the address does not belong to userId. */ update(userId: string, addressId: string, patch: AddressPatch): Promise
; /** Returns false when the address does not belong to userId. */ delete(userId: string, addressId: string): Promise; }