OpenForm

organization

Last updated on

Build and validate organization information

Build and validate organization information. The Organization primitive captures business entity details including legal names, registration numbers, and jurisdiction.

Examples

Creating organizations

// Object pattern
const org = open.organization({
  name: 'Acme Corporation'
})

// Builder pattern
const org = open.organization()
  .name('Acme Corporation')
  .legalName('Acme Corporation, Inc.')
  .domicile('Delaware')
  .entityType('corporation')
  .entityId('12345678')
  .taxId('12-3456789')
  .build()

// Copy and modify
const updated = open.organization()
  .from(org)
  .domicile('Nevada')
  .build()

Parsing external data

// Parse unknown input (throws on error)
const org = open.organization.parse(jsonData)

// Safe parsing (returns result object)
const result = open.organization.safeParse(jsonData)
if (result.success) {
  console.log(`Organization: ${result.data.name}`)
} else {
  console.error(result.error.message)
}

Using with forms

const form = open.form({
  name: 'vendor',
  fields: {
    company: { type: 'organization', label: 'Company Information' }
  }
})

const filled = form.fill({
  fields: {
    company: open.organization()
      .name('Tech Solutions LLC')
      .entityType('llc')
      .domicile('California')
      .build()
  }
})

API

Object Pattern

open.organization(input: Organization): Organization

Pass an Organization object for validation. Returns the validated Organization or throws on error.

const org = open.organization({ name: 'Global Enterprises' })

Builder Pattern

Chain methods to build an Organization value incrementally:

All methods return OrganizationBuilder and are chainable.

open.organization()
name: (value: string) => OrganizationBuilder
Set organization display name
legalName: (value: string | undefined) => OrganizationBuilder
Set full legal name
domicile: (value: string | undefined) => OrganizationBuilder
Set jurisdiction of incorporation
entityType: (value: string | undefined) => OrganizationBuilder
Set entity type (corporation, llc, etc.)
entityId: (value: string | undefined) => OrganizationBuilder
Set registration/entity ID number
taxId: (value: string | undefined) => OrganizationBuilder
Set tax identification number
from: (value: Organization) => OrganizationBuilder
Initialize from existing Organization
build: () => Organization
Build and validate

Static Methods

parse: (input: unknown) => Organization
Parse unknown input (throws on error)
safeParse: (input: unknown) => Result<Organization>
Parse unknown input (returns result object)

Properties

name: string
Organization display name.
legalName: string?
Full legal name as registered.
domicile: string?
Jurisdiction of incorporation or registration.
entityType: string?
Type of legal entity.
entityId: string?
Registration or entity identification number.
taxId: string?
Tax identification number (EIN, VAT, etc.).

Common Entity Types

TypeDescription
corporationC-Corporation
s_corpS-Corporation
llcLimited Liability Company
llpLimited Liability Partnership
partnershipGeneral Partnership
sole_proprietorshipSole Proprietorship
nonprofitNon-profit Organization
trustTrust Entity

Validation

The Organization primitive validates:

  • name must be a non-empty string
  • All other fields are optional
// Valid
open.organization({ name: 'Acme Inc' })
open.organization({
  name: 'Acme Inc',
  legalName: 'Acme Incorporated',
  entityType: 'corporation',
  domicile: 'Delaware'
})

// Invalid - throws Error
open.organization({})
// Error: Invalid Organization: name is required

open.organization({ name: '' })
// Error: Invalid Organization: name cannot be empty

Related

On this page