Skip to content

Latest commit

 

History

History
165 lines (111 loc) · 5.21 KB

File metadata and controls

165 lines (111 loc) · 5.21 KB
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

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

TypeScript Usage

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

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