Object
Object protocol schemas
API Operations Enum
Source: packages/spec/src/data/object.zod.ts
TypeScript Usage
import { ApiMethod, CDCConfig, Index, ObjectCapabilities, ObjectExtension, ObjectOwnershipEnum, PartitioningConfig, SoftDeleteConfig, TenancyConfig, VersioningConfig } from '@objectstack/spec/data';
import type { ApiMethod, CDCConfig, Index, ObjectCapabilities, ObjectExtension, ObjectOwnershipEnum, PartitioningConfig, SoftDeleteConfig, TenancyConfig, VersioningConfig } from '@objectstack/spec/data';
// Validate data
const result = ApiMethod.parse(data);ApiMethod
Allowed Values
getlistcreateupdatedeleteupsertbulkaggregatehistorysearchrestorepurgeimportexport
CDCConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Enable Change Data Capture |
| events | Enum<'insert' | 'update' | 'delete'>[] | ✅ | Event types to capture |
| destination | string | ✅ | Destination endpoint (e.g., "kafka://topic", "webhook://url") |
Index
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Index name (auto-generated if not provided) |
| fields | string[] | ✅ | Fields included in the index |
| type | Enum<'btree' | 'hash' | 'gin' | 'gist' | 'fulltext'> | ✅ | Index algorithm type |
| unique | boolean | ✅ | Whether the index enforces uniqueness |
| partial | string | optional | Partial index condition (SQL WHERE clause for conditional indexes) |
ObjectCapabilities
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| trackHistory | boolean | ✅ | Enable field history tracking for audit compliance |
| searchable | boolean | ✅ | Index records for global search |
| apiEnabled | boolean | ✅ | Expose object via automatic APIs |
| apiMethods | Enum<'get' | 'list' | 'create' | 'update' | 'delete' | 'upsert' | 'bulk' | 'aggregate' | 'history' | 'search' | 'restore' | 'purge' | 'import' | 'export'>[] | optional | Whitelist of allowed API operations |
| files | boolean | ✅ | Enable file attachments and document management |
| feeds | boolean | ✅ | Enable social feed, comments, and mentions (Chatter-like) |
| activities | boolean | ✅ | Enable standard tasks and events tracking |
| trash | boolean | ✅ | Enable soft-delete with restore capability |
| mru | boolean | ✅ | Track Most Recently Used (MRU) list for users |
| clone | boolean | ✅ | Allow record deep cloning |
ObjectExtension
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| extend | string | ✅ | Target object name (FQN) to extend |
| fields | Record<string, Object> | optional | Fields to add/override |
| label | string | optional | Override label for the extended object |
| pluralLabel | string | optional | Override plural label for the extended object |
| description | string | optional | Override description for the extended object |
| validations | [__schema0](./__schema0)[] | optional | Additional validation rules to merge into the target object |
| indexes | Object[] | optional | Additional indexes to merge into the target object |
| priority | integer | ✅ | Merge priority (higher = applied later) |
ObjectOwnershipEnum
Allowed Values
ownextend
PartitioningConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Enable table partitioning |
| strategy | Enum<'range' | 'hash' | 'list'> | ✅ | Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values) |
| key | string | ✅ | Field name to partition by |
| interval | string | optional | Partition interval for range strategy (e.g., "1 month", "1 year") |
SoftDeleteConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Enable soft delete (trash/recycle bin) |
| field | string | ✅ | Field name for soft delete timestamp |
| cascadeDelete | boolean | ✅ | Cascade soft delete to related records |
TenancyConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Enable multi-tenancy for this object |
| strategy | Enum<'shared' | 'isolated' | 'hybrid'> | ✅ | Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix) |
| tenantField | string | ✅ | Field name for tenant identifier |
| crossTenantAccess | boolean | ✅ | Allow cross-tenant data access (with explicit permission) |
VersioningConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Enable record versioning |
| strategy | Enum<'snapshot' | 'delta' | 'event-sourcing'> | ✅ | Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log) |
| retentionDays | number | optional | Number of days to retain old versions (undefined = infinite) |
| versionField | string | ✅ | Field name for version number/timestamp |