ObjectStackObjectStack

Object

Object protocol schemas

API Operations Enum

Source: packages/spec/src/data/object.zod.ts

TypeScript Usage

import { ApiMethod, CDCConfig, Index, Object, ObjectCapabilities, ObjectExtension, ObjectOwnershipEnum, PartitioningConfig, SoftDeleteConfig, TenancyConfig, VersioningConfig } from '@objectstack/spec/data';
import type { ApiMethod, CDCConfig, Index, Object, ObjectCapabilities, ObjectExtension, ObjectOwnershipEnum, PartitioningConfig, SoftDeleteConfig, TenancyConfig, VersioningConfig } from '@objectstack/spec/data';

// Validate data
const result = ApiMethod.parse(data);

ApiMethod

Allowed Values

  • get
  • list
  • create
  • update
  • delete
  • upsert
  • bulk
  • aggregate
  • history
  • search
  • restore
  • purge
  • import
  • export

CDCConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanEnable Change Data Capture
eventsEnum<'insert' | 'update' | 'delete'>[]Event types to capture
destinationstringDestination endpoint (e.g., "kafka://topic", "webhook://url")

Index

Properties

PropertyTypeRequiredDescription
namestringoptionalIndex name (auto-generated if not provided)
fieldsstring[]Fields included in the index
typeEnum<'btree' | 'hash' | 'gin' | 'gist' | 'fulltext'>Index algorithm type
uniquebooleanWhether the index enforces uniqueness
partialstringoptionalPartial index condition (SQL WHERE clause for conditional indexes)

Object

Properties

PropertyTypeRequiredDescription
namestringMachine unique key (snake_case). Immutable.
labelstringoptionalHuman readable singular label (e.g. "Account")
pluralLabelstringoptionalHuman readable plural label (e.g. "Accounts")
descriptionstringoptionalDeveloper documentation / description
iconstringoptionalIcon name (Lucide/Material) for UI representation
tagsstring[]optionalCategorization tags (e.g. "sales", "system", "reference")
activebooleanIs the object active and usable
isSystembooleanIs system object (protected from deletion)
abstractbooleanIs abstract base object (cannot be instantiated)
datasourcestringTarget Datasource ID. "default" is the primary DB.
tableNamestringoptionalPhysical table/collection name in the target datasource
fieldsRecord<string, Object>Field definitions map. Keys must be snake_case identifiers.
indexesObject[]optionalDatabase performance indexes
tenancyObjectoptionalMulti-tenancy configuration for SaaS applications
softDeleteObjectoptionalSoft delete (trash/recycle bin) configuration
versioningObjectoptionalRecord versioning and history tracking configuration
partitioningObjectoptionalTable partitioning configuration for performance
cdcObjectoptionalChange Data Capture (CDC) configuration for real-time data streaming
validations[__schema0](./__schema0)[]optionalObject-level validation rules
stateMachinesRecord<string, Object>optionalNamed state machines for parallel lifecycles (e.g., status, payment, approval)
displayNameFieldstringoptionalField to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.
recordNameObjectoptionalRecord name generation configuration (Salesforce pattern)
titleFormatstringoptionalTitle expression (e.g. "{name} - {code}"). Overrides displayNameField.
compactLayoutstring[]optionalPrimary fields for hover/cards/lookups
searchObjectoptionalSearch engine configuration
enableObjectoptionalEnabled system features modules
recordTypesstring[]optionalRecord type names for this object
sharingModelEnum<'private' | 'read' | 'read_write' | 'full'>optionalDefault sharing model
keyPrefixstringoptionalShort prefix for record IDs (e.g., "001" for Account)

ObjectCapabilities

Properties

PropertyTypeRequiredDescription
trackHistorybooleanEnable field history tracking for audit compliance
searchablebooleanIndex records for global search
apiEnabledbooleanExpose object via automatic APIs
apiMethodsEnum<'get' | 'list' | 'create' | 'update' | 'delete' | 'upsert' | 'bulk' | 'aggregate' | 'history' | 'search' | 'restore' | 'purge' | 'import' | 'export'>[]optionalWhitelist of allowed API operations
filesbooleanEnable file attachments and document management
feedsbooleanEnable social feed, comments, and mentions (Chatter-like)
activitiesbooleanEnable standard tasks and events tracking
trashbooleanEnable soft-delete with restore capability
mrubooleanTrack Most Recently Used (MRU) list for users
clonebooleanAllow record deep cloning

ObjectExtension

Properties

PropertyTypeRequiredDescription
extendstringTarget object name (FQN) to extend
fieldsRecord<string, Object>optionalFields to add/override
labelstringoptionalOverride label for the extended object
pluralLabelstringoptionalOverride plural label for the extended object
descriptionstringoptionalOverride description for the extended object
validations[__schema0](./__schema0)[]optionalAdditional validation rules to merge into the target object
indexesObject[]optionalAdditional indexes to merge into the target object
priorityintegerMerge priority (higher = applied later)

ObjectOwnershipEnum

Allowed Values

  • own
  • extend

PartitioningConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanEnable table partitioning
strategyEnum<'range' | 'hash' | 'list'>Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)
keystringField name to partition by
intervalstringoptionalPartition interval for range strategy (e.g., "1 month", "1 year")

SoftDeleteConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanEnable soft delete (trash/recycle bin)
fieldstringField name for soft delete timestamp
cascadeDeletebooleanCascade soft delete to related records

TenancyConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanEnable multi-tenancy for this object
strategyEnum<'shared' | 'isolated' | 'hybrid'>Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)
tenantFieldstringField name for tenant identifier
crossTenantAccessbooleanAllow cross-tenant data access (with explicit permission)

VersioningConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanEnable record versioning
strategyEnum<'snapshot' | 'delta' | 'event-sourcing'>Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)
retentionDaysnumberoptionalNumber of days to retain old versions (undefined = infinite)
versionFieldstringField name for version number/timestamp

On this page