Create a customer together with its primary organization in one transaction.
The Customer↔Organization mutual FK (customer.organization_id ⇄
organization.customer_id) means neither row can be inserted standalone
with both ends populated. This method inserts the customer (with
organizationId NULL), inserts the organization with the new customer's
id, then updates the customer to point at the organization — all inside
a single transaction. Under READ COMMITTED (the Postgres default) no
other session can observe the intermediate state: the in-flight tx
doesn't publish its writes until commit, and get()/search()
inner-join organization so a customer with NULL organizationId would
be filtered out anyway.
When organization.verificationProfileId is set, the org is created
ACTIVE and an organization.organization.created event is published
after commit — matching the deleted OrganizationAdminService.createVerified
path. When omitted, the org is PENDING_VERIFICATION and no event is
published; callers must drive verification through OrganizationService.
Optionalid?: stringOptional pre-generated external id (cust_…). When provided it's inserted
as externalId, overriding the nanoId("cust") column default — lets a
caller (e.g. createCustomerWorkflow) mint the id up front and reuse it as
the Temporal workflowId. Omit to auto-generate.
Optionalline2?: stringOptionalregionCode?: stringe.g. US state
Optionaldescription?: stringOptionalemail?: stringOptionalphone?: E164PhoneOptionalreferenceId?: stringOptionalverificationProfileId?: stringWhen set, the organization is created as ACTIVE with this id stored in
data.verificationProfileId (mirroring OrganizationAdminService.createVerified).
When omitted, the organization is created PENDING_VERIFICATION and the
caller is expected to drive verification through OrganizationService.verify.
OptionalwebsiteUrl?: stringOptionalids?: string[]Optionalname?: stringOptionalnameLike?: stringOptionalorderBy?: DbOrderByCriterion<Optionalpage?: numberDefaults to 1
OptionalpageSize?: numberDefaults to 50
OptionalpropelauthWorkspaceIds?: string[]Optionalq?: stringUnified free-text search. Case-insensitive substring match against the
customer name, the customer external id (cust_…), or the legal entity
(organization) name. Whitespace-only values are a no-op.
eventPublisheris optional because most consumers only useget/search/updateand never need to publish.create()does publishorganization.organization.createdon the verified path and asserts the publisher is wired — wire it in main.ts for any service that callscreate()(today: internal-dashboard's createCustomer flow).