Skip to content

Latest commit

 

History

History
1240 lines (751 loc) · 33.5 KB

File metadata and controls

1240 lines (751 loc) · 33.5 KB
title Protocol
description Protocol protocol schemas

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

ObjectStack Protocol - Zod Schema Definitions

Defines the runtime-validated contract for interacting with ObjectStack metadata and data.

Used by API adapters (HTTP, WebSocket, gRPC) to fetch data/metadata without knowing engine internals.

This protocol enables:

  • Runtime request/response validation at API gateway level

  • Automatic API documentation generation

  • Type-safe RPC communication between microservices

  • Client SDK generation from schemas

Architecture Alignment:

  • Salesforce: REST API Request/Response schemas

  • Kubernetes: API Resource schemas with runtime validation

  • GraphQL: Schema-first API design

**Source:** `packages/spec/src/api/protocol.zod.ts`

TypeScript Usage

import { AiInsightsRequest, AiInsightsResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AutomationTriggerRequest, AutomationTriggerResponse, BatchDataRequest, BatchDataResponse, CheckPermissionRequest, CheckPermissionResponse, CreateDataRequest, CreateDataResponse, CreateManyDataRequest, CreateManyDataResponse, DeleteDataRequest, DeleteDataResponse, DeleteManyDataRequest, DeleteManyDataResponse, DeleteViewRequest, DeleteViewResponse, FindDataRequest, FindDataResponse, GetDataRequest, GetDataResponse, GetDiscoveryRequest, GetDiscoveryResponse, GetEffectivePermissionsRequest, GetEffectivePermissionsResponse, GetFieldLabelsRequest, GetFieldLabelsResponse, GetLocalesRequest, GetLocalesResponse, GetMetaItemCachedRequest, GetMetaItemCachedResponse, GetMetaItemRequest, GetMetaItemResponse, GetMetaItemsRequest, GetMetaItemsResponse, GetMetaTypesRequest, GetMetaTypesResponse, GetNotificationPreferencesRequest, GetNotificationPreferencesResponse, GetObjectPermissionsRequest, GetObjectPermissionsResponse, GetPresenceRequest, GetPresenceResponse, GetTranslationsRequest, GetTranslationsResponse, GetUiViewRequest, GetViewRequest, GetWorkflowConfigRequest, GetWorkflowConfigResponse, GetWorkflowStateRequest, GetWorkflowStateResponse, HttpFindQueryParams, ListNotificationsRequest, ListNotificationsResponse, ListViewsRequest, MarkAllNotificationsReadRequest, MarkAllNotificationsReadResponse, MarkNotificationsReadRequest, MarkNotificationsReadResponse, NotificationPreferences, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeDisconnectRequest, RealtimeDisconnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, RealtimeUnsubscribeRequest, RealtimeUnsubscribeResponse, RegisterDeviceRequest, RegisterDeviceResponse, SaveMetaItemRequest, SaveMetaItemResponse, SetPresenceRequest, SetPresenceResponse, UnregisterDeviceRequest, UnregisterDeviceResponse, UpdateDataRequest, UpdateDataResponse, UpdateManyDataRequest, UpdateManyDataResponse, UpdateNotificationPreferencesRequest, UpdateNotificationPreferencesResponse, WorkflowApproveRequest, WorkflowApproveResponse, WorkflowRejectRequest, WorkflowRejectResponse, WorkflowState, WorkflowTransitionRequest, WorkflowTransitionResponse } from '@objectstack/spec/api';
import type { AiInsightsRequest, AiInsightsResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AutomationTriggerRequest, AutomationTriggerResponse, BatchDataRequest, BatchDataResponse, CheckPermissionRequest, CheckPermissionResponse, CreateDataRequest, CreateDataResponse, CreateManyDataRequest, CreateManyDataResponse, DeleteDataRequest, DeleteDataResponse, DeleteManyDataRequest, DeleteManyDataResponse, DeleteViewRequest, DeleteViewResponse, FindDataRequest, FindDataResponse, GetDataRequest, GetDataResponse, GetDiscoveryRequest, GetDiscoveryResponse, GetEffectivePermissionsRequest, GetEffectivePermissionsResponse, GetFieldLabelsRequest, GetFieldLabelsResponse, GetLocalesRequest, GetLocalesResponse, GetMetaItemCachedRequest, GetMetaItemCachedResponse, GetMetaItemRequest, GetMetaItemResponse, GetMetaItemsRequest, GetMetaItemsResponse, GetMetaTypesRequest, GetMetaTypesResponse, GetNotificationPreferencesRequest, GetNotificationPreferencesResponse, GetObjectPermissionsRequest, GetObjectPermissionsResponse, GetPresenceRequest, GetPresenceResponse, GetTranslationsRequest, GetTranslationsResponse, GetUiViewRequest, GetViewRequest, GetWorkflowConfigRequest, GetWorkflowConfigResponse, GetWorkflowStateRequest, GetWorkflowStateResponse, HttpFindQueryParams, ListNotificationsRequest, ListNotificationsResponse, ListViewsRequest, MarkAllNotificationsReadRequest, MarkAllNotificationsReadResponse, MarkNotificationsReadRequest, MarkNotificationsReadResponse, NotificationPreferences, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeDisconnectRequest, RealtimeDisconnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, RealtimeUnsubscribeRequest, RealtimeUnsubscribeResponse, RegisterDeviceRequest, RegisterDeviceResponse, SaveMetaItemRequest, SaveMetaItemResponse, SetPresenceRequest, SetPresenceResponse, UnregisterDeviceRequest, UnregisterDeviceResponse, UpdateDataRequest, UpdateDataResponse, UpdateManyDataRequest, UpdateManyDataResponse, UpdateNotificationPreferencesRequest, UpdateNotificationPreferencesResponse, WorkflowApproveRequest, WorkflowApproveResponse, WorkflowRejectRequest, WorkflowRejectResponse, WorkflowState, WorkflowTransitionRequest, WorkflowTransitionResponse } from '@objectstack/spec/api';

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

AiInsightsRequest

Properties

Property Type Required Description
object string Object name to analyze
recordId string optional Specific record to analyze
type Enum<'summary' | 'trends' | 'anomalies' | 'recommendations'> optional Type of insight

AiInsightsResponse

Properties

Property Type Required Description
insights Object[] Generated insights

AiNlqRequest

Properties

Property Type Required Description
query string Natural language query string
object string optional Target object context
conversationId string optional Conversation ID for multi-turn queries

AiNlqResponse

Properties

Property Type Required Description
query any Generated structured query (AST)
explanation string optional Human-readable explanation of the query
confidence number optional Confidence score (0-1)
suggestions string[] optional Suggested follow-up queries

AiSuggestRequest

Properties

Property Type Required Description
object string Object name for context
field string optional Field to suggest values for
recordId string optional Record ID for context
partial string optional Partial input for completion

AiSuggestResponse

Properties

Property Type Required Description
suggestions Object[] Suggested values

AutomationTriggerRequest

Properties

Property Type Required Description
trigger string
payload Record<string, any>

AutomationTriggerResponse

Properties

Property Type Required Description
success boolean
jobId string optional
result any optional

BatchDataRequest

Properties

Property Type Required Description
object string Object name
request Object Batch operation request

BatchDataResponse

Properties

Property Type Required Description
success boolean Operation success status
error Object optional Error details if success is false
meta Object optional Response metadata
operation Enum<'create' | 'update' | 'upsert' | 'delete'> optional Operation type that was performed
total number Total number of records in the batch
succeeded number Number of records that succeeded
failed number Number of records that failed
results Object[] Detailed results for each record

CheckPermissionRequest

Properties

Property Type Required Description
object string Object name to check permissions for
action Enum<'create' | 'read' | 'edit' | 'delete' | 'transfer' | 'restore' | 'purge'> Action to check
recordId string optional Specific record ID (for record-level checks)
field string optional Specific field name (for field-level checks)

CheckPermissionResponse

Properties

Property Type Required Description
allowed boolean Whether the action is permitted
reason string optional Reason if denied

CreateDataRequest

Properties

Property Type Required Description
object string The object name.
data Record<string, any> The dictionary of field values to insert.

CreateDataResponse

Properties

Property Type Required Description
object string The object name.
id string The ID of the newly created record.
record Record<string, any> The created record, including server-generated fields (created_at, owner).

CreateManyDataRequest

Properties

Property Type Required Description
object string Object name
records Record<string, any>[] Array of records to create

CreateManyDataResponse

Properties

Property Type Required Description
object string Object name
records Record<string, any>[] Created records
count number Number of records created

DeleteDataRequest

Properties

Property Type Required Description
object string Object name
id string Record ID to delete

DeleteDataResponse

Properties

Property Type Required Description
object string Object name
id string Deleted record ID
success boolean Whether deletion succeeded

DeleteManyDataRequest

Properties

Property Type Required Description
object string Object name
ids string[] Array of record IDs to delete
options Object optional Delete options

DeleteManyDataResponse

Properties

Property Type Required Description
success boolean Operation success status
error Object optional Error details if success is false
meta Object optional Response metadata
operation Enum<'create' | 'update' | 'upsert' | 'delete'> optional Operation type that was performed
total number Total number of records in the batch
succeeded number Number of records that succeeded
failed number Number of records that failed
results Object[] Detailed results for each record

DeleteViewRequest

Properties

Property Type Required Description
object string Object name (snake_case)
viewId string View identifier to delete

DeleteViewResponse

Properties

Property Type Required Description
object string Object name
viewId string Deleted view identifier
success boolean Whether deletion succeeded

FindDataRequest

Properties

Property Type Required Description
object string The unique machine name of the object to query (e.g. "account").
query [__schema0](./__schema0) optional Structured query definition (filter, sort, select, pagination).

FindDataResponse

Properties

Property Type Required Description
object string The object name for the returned records.
records Record<string, any>[] The list of matching records.
total number optional Total number of records matching the filter (if requested).
nextCursor string optional Cursor for the next page of results (cursor-based pagination).
hasMore boolean optional True if there are more records available (pagination).

GetDataRequest

Properties

Property Type Required Description
object string The object name.
id string The unique record identifier (primary key).
select string[] optional Fields to include in the response (allowlisted query param).
expand string[] optional Lookup/master_detail field names to expand. The engine resolves these via batch $in queries, replacing foreign key IDs with full objects.

GetDataResponse

Properties

Property Type Required Description
object string The object name.
id string The record ID.
record Record<string, any> The complete record data.

GetDiscoveryRequest

Properties

Property Type Required Description

GetDiscoveryResponse

Properties

Property Type Required Description
name string optional
version string
environment Enum<'production' | 'sandbox' | 'development'> optional
routes Object optional
locale Object optional
services Record<string, Object> optional Per-service availability map keyed by CoreServiceName
capabilities Record<string, Object> optional Hierarchical capability descriptors for frontend intelligent adaptation
schemaDiscovery Object optional Schema discovery endpoints for API toolchain integration
metadata Record<string, any> optional Custom metadata key-value pairs for extensibility
apiName string optional API name (deprecated — use name)

GetEffectivePermissionsRequest

Properties

Property Type Required Description

GetEffectivePermissionsResponse

Properties

Property Type Required Description
objects Record<string, Object> Effective object permissions keyed by object name
systemPermissions string[] Effective system-level permissions

GetFieldLabelsRequest

Properties

Property Type Required Description
object string Object name
locale string BCP-47 locale code

GetFieldLabelsResponse

Properties

Property Type Required Description
object string Object name
locale string Locale code
labels Record<string, Object> Field labels keyed by field name

GetLocalesRequest

Properties

Property Type Required Description

GetLocalesResponse

Properties

Property Type Required Description
locales Object[] Available locales

GetMetaItemCachedRequest

Properties

Property Type Required Description
type string Metadata type name
name string Item name
cacheRequest Object optional Cache validation parameters

GetMetaItemCachedResponse

Properties

Property Type Required Description
data any optional Metadata payload (omitted for 304 Not Modified)
etag Object optional ETag for this resource version
lastModified string optional Last modification timestamp
cacheControl Object optional Cache control directives
notModified boolean True if resource has not been modified (304 response)
version string optional Metadata version identifier

GetMetaItemRequest

Properties

Property Type Required Description
type string Metadata type name
name string Item name (snake_case identifier)
packageId string optional Optional package ID to filter items by

GetMetaItemResponse

Properties

Property Type Required Description
type string Metadata type name
name string Item name
item any Metadata item definition

GetMetaItemsRequest

Properties

Property Type Required Description
type string Metadata type name (e.g., "object", "plugin")
packageId string optional Optional package ID to filter items by

GetMetaItemsResponse

Properties

Property Type Required Description
type string Metadata type name
items any[] Array of metadata items

GetMetaTypesRequest

Properties

Property Type Required Description

GetMetaTypesResponse

Properties

Property Type Required Description
types string[] Available metadata type names (e.g., "object", "plugin", "view")

GetNotificationPreferencesRequest

Properties

Property Type Required Description

GetNotificationPreferencesResponse

Properties

Property Type Required Description
preferences Object Current notification preferences

GetObjectPermissionsRequest

Properties

Property Type Required Description
object string Object name to get permissions for

GetObjectPermissionsResponse

Properties

Property Type Required Description
object string Object name
permissions Object Object-level permissions
fieldPermissions Record<string, Object> optional Field-level permissions keyed by field name

GetPresenceRequest

Properties

Property Type Required Description
channel string Channel to get presence for

GetPresenceResponse

Properties

Property Type Required Description
channel string Channel name
members Object[] Active members and their presence state

GetTranslationsRequest

Properties

Property Type Required Description
locale string BCP-47 locale code
namespace string optional Translation namespace (e.g., objects, apps, messages)
keys string[] optional Specific translation keys to fetch

GetTranslationsResponse

Properties

Property Type Required Description
locale string Locale code
translations Object Translation data

GetUiViewRequest

Properties

Property Type Required Description
object string Object name (snake_case)
type Enum<'list' | 'form'> View type

GetViewRequest

Properties

Property Type Required Description
object string Object name (snake_case)
viewId string View identifier

GetWorkflowConfigRequest

Properties

Property Type Required Description
object string Object name to get workflow config for

GetWorkflowConfigResponse

Properties

Property Type Required Description
object string Object name
workflows Object[] Active workflow rules for this object

GetWorkflowStateRequest

Properties

Property Type Required Description
object string Object name
recordId string Record ID to get workflow state for

GetWorkflowStateResponse

Properties

Property Type Required Description
object string Object name
recordId string Record ID
state Object Current workflow state and available transitions

HttpFindQueryParams

Properties

Property Type Required Description
filter string optional JSON-encoded filter expression (canonical, singular).
filters string optional JSON-encoded filter expression (deprecated plural alias).
select string optional Comma-separated list of fields to retrieve.
sort string optional Sort expression (e.g. "name asc,created_at desc" or "-created_at").
orderBy string optional Alias for sort (OData compatibility).
top number optional Max records to return (limit).
skip number optional Records to skip (offset).
expand string optional Comma-separated list of lookup/master_detail field names to expand. Resolved to populate array and passed to the engine for batch $in expansion.
search string optional Full-text search query.
distinct boolean optional SELECT DISTINCT flag.
count boolean optional Include total count in response.

ListNotificationsRequest

Properties

Property Type Required Description
read boolean optional Filter by read status
type string optional Filter by notification type
limit number Maximum number of notifications to return
cursor string optional Pagination cursor

ListNotificationsResponse

Properties

Property Type Required Description
notifications Object[] List of notifications
unreadCount number Total number of unread notifications
cursor string optional Next page cursor

ListViewsRequest

Properties

Property Type Required Description
object string Object name (snake_case)
type Enum<'list' | 'form'> optional Filter by view type

MarkAllNotificationsReadRequest

Properties

Property Type Required Description

MarkAllNotificationsReadResponse

Properties

Property Type Required Description
success boolean Whether the operation succeeded
readCount number Number of notifications marked as read

MarkNotificationsReadRequest

Properties

Property Type Required Description
ids string[] Notification IDs to mark as read

MarkNotificationsReadResponse

Properties

Property Type Required Description
success boolean Whether the operation succeeded
readCount number Number of notifications marked as read

NotificationPreferences

Properties

Property Type Required Description
email boolean Receive email notifications
push boolean Receive push notifications
inApp boolean Receive in-app notifications
digest Enum<'none' | 'daily' | 'weekly'> Email digest frequency
channels Record<string, Object> optional Per-channel notification preferences

RealtimeConnectRequest

Properties

Property Type Required Description
transport Enum<'websocket' | 'sse' | 'polling'> optional Preferred transport protocol
channels string[] optional Channels to subscribe to on connect
token string optional Authentication token

RealtimeConnectResponse

Properties

Property Type Required Description
connectionId string Unique connection identifier
transport Enum<'websocket' | 'sse' | 'polling'> Negotiated transport protocol
url string optional WebSocket/SSE endpoint URL

RealtimeDisconnectRequest

Properties

Property Type Required Description
connectionId string optional Connection ID to disconnect

RealtimeDisconnectResponse

Properties

Property Type Required Description
success boolean Whether disconnection succeeded

RealtimeSubscribeRequest

Properties

Property Type Required Description
channel string Channel name to subscribe to
events string[] optional Specific event types to listen for
filter Record<string, any> optional Event filter criteria

RealtimeSubscribeResponse

Properties

Property Type Required Description
subscriptionId string Unique subscription identifier
channel string Subscribed channel name

RealtimeUnsubscribeRequest

Properties

Property Type Required Description
subscriptionId string Subscription ID to cancel

RealtimeUnsubscribeResponse

Properties

Property Type Required Description
success boolean Whether unsubscription succeeded

RegisterDeviceRequest

Properties

Property Type Required Description
token string Device push notification token
platform Enum<'ios' | 'android' | 'web'> Device platform
deviceId string optional Unique device identifier
name string optional Device friendly name

RegisterDeviceResponse

Properties

Property Type Required Description
deviceId string Registered device ID
success boolean Whether registration succeeded

SaveMetaItemRequest

Properties

Property Type Required Description
type string Metadata type name
name string Item name
item any Metadata item definition

SaveMetaItemResponse

Properties

Property Type Required Description
success boolean
message string optional

SetPresenceRequest

Properties

Property Type Required Description
channel string Channel to set presence in
state Object Presence state to set

SetPresenceResponse

Properties

Property Type Required Description
success boolean Whether presence was set

UnregisterDeviceRequest

Properties

Property Type Required Description
deviceId string Device ID to unregister

UnregisterDeviceResponse

Properties

Property Type Required Description
success boolean Whether unregistration succeeded

UpdateDataRequest

Properties

Property Type Required Description
object string The object name.
id string The ID of the record to update.
data Record<string, any> The fields to update (partial update).

UpdateDataResponse

Properties

Property Type Required Description
object string Object name
id string Updated record ID
record Record<string, any> Updated record

UpdateManyDataRequest

Properties

Property Type Required Description
object string Object name
records Object[] Array of updates
options Object optional Update options

UpdateManyDataResponse

Properties

Property Type Required Description
success boolean Operation success status
error Object optional Error details if success is false
meta Object optional Response metadata
operation Enum<'create' | 'update' | 'upsert' | 'delete'> optional Operation type that was performed
total number Total number of records in the batch
succeeded number Number of records that succeeded
failed number Number of records that failed
results Object[] Detailed results for each record

UpdateNotificationPreferencesRequest

Properties

Property Type Required Description
preferences Object Preferences to update

UpdateNotificationPreferencesResponse

Properties

Property Type Required Description
preferences Object Updated notification preferences

WorkflowApproveRequest

Properties

Property Type Required Description
object string Object name
recordId string Record ID
comment string optional Approval comment
data Record<string, any> optional Additional data

WorkflowApproveResponse

Properties

Property Type Required Description
object string Object name
recordId string Record ID
success boolean Whether the approval succeeded
state Object New workflow state after approval

WorkflowRejectRequest

Properties

Property Type Required Description
object string Object name
recordId string Record ID
reason string Rejection reason
comment string optional Additional comment

WorkflowRejectResponse

Properties

Property Type Required Description
object string Object name
recordId string Record ID
success boolean Whether the rejection succeeded
state Object New workflow state after rejection

WorkflowState

Properties

Property Type Required Description
currentState string Current workflow state name
availableTransitions Object[] Available transitions from current state
history Object[] optional State transition history

WorkflowTransitionRequest

Properties

Property Type Required Description
object string Object name
recordId string Record ID
transition string Transition name to execute
comment string optional Optional comment for the transition
data Record<string, any> optional Additional data for the transition

WorkflowTransitionResponse

Properties

Property Type Required Description
object string Object name
recordId string Record ID
success boolean Whether the transition succeeded
state Object New workflow state after transition