---
title: Object
description: Object protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

API Operations Enum

<Callout type="info">
**Source:** `packages/spec/src/data/object.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { ApiMethod, CDCConfig, Index, ObjectCapabilities, ObjectExternalBinding, ObjectOwnershipEnum, PartitioningConfig, SoftDeleteConfig, TenancyConfig, VersioningConfig } from '@objectstack/spec/data';
import type { ApiMethod, CDCConfig, Index, ObjectCapabilities, ObjectExternalBinding, 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

| 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 |


---

## ObjectExternalBinding

External datasource binding (ADR-0015)

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **remoteName** | `string` | optional | Remote table/view name. Defaults to object.name. |
| **remoteSchema** | `string` | optional | Remote schema/database qualifier. |
| **writable** | `boolean` | ✅ | Per-object write opt-in (also requires datasource.external.allowWrites). |
| **columnMap** | `Record<string, string>` | optional | Remote column name → local field name. |
| **introspectedAt** | `string` | optional | Set by `os datasource introspect`; informational. |
| **ignoreColumns** | `string[]` | optional | Remote columns to skip during validation (dev convenience). |


---

## ObjectOwnershipEnum

### Allowed Values

* `own`
* `extend`


---

## 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 |


---

