Skip to main content
An object type is a typed noun, such as Customer or Invoice. It maps a model’s columns to properties, and names the property that keys it. Handlers, policies, analytics SQL, and agent tools all use the object’s property names.

Define an object type

ontology/sales.ts

Property types

Chain .optional() for nullable values, .describe(text) for documentation, and .id(name) to keep a stored name when you rename a property.

Who owns a property

Every property has one owner.
  • Source-owned properties .map() a SQL expression over the object’s model. Only the source system changes them.
  • Ontology-owned properties are .owned(). Only the ontology’s actions change them, and Tilde keeps every edit in an audited log.
An object with no source is entirely ontology-owned, and its properties need no .owned(). Actions create and delete it, such as a note or a follow-up task. Its key is always a string.
Actions cannot edit source-owned properties. To change one, an action calls the source system, and can show the expected value as pending until the source confirms it. See Pending values. A link is a relationship between two object types.
List links in ontology({ links }).

Entity resolution

The same customer often appears in several systems. A resolution matches members of different object types into one entity, with deterministic rules and optional fuzzy matching.
Each feature names a normalizer: exact, text, email, domain, or phone. List resolutions in ontology({ resolutions }).

History

Set history: true on an object to keep every change of its properties from then on, by your actions or in the source system. Add historyAt to date source-side changes with one of the object’s own timestamps.
A read declares history(Invoice) to query it. Each row has the key, the property, its value before and after, when it changed, and whether an action or the source changed it.