ObjectStackObjectStack

Batch

Batch protocol schemas

Batch Operations API

Provides efficient bulk data operations with transaction support.

Implements P0/P1 requirements for ObjectStack kernel.

Features:

  • Batch create/update/delete operations

  • Atomic transaction support (all-or-none)

  • Partial success handling

  • Detailed error reporting per record

Industry alignment: Salesforce Bulk API, Microsoft Dynamics Bulk Operations

Source: packages/spec/src/api/batch.zod.ts

TypeScript Usage

import { BatchConfig, BatchOperationResult, BatchOperationType, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, DeleteManyRequest, UpdateManyRequest } from '@objectstack/spec/api';
import type { BatchConfig, BatchOperationResult, BatchOperationType, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, DeleteManyRequest, UpdateManyRequest } from '@objectstack/spec/api';

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

BatchConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanEnable batch operations
maxRecordsPerBatchintegerMaximum records per batch
defaultOptionsObjectoptionalDefault batch options

BatchOperationResult

Properties

PropertyTypeRequiredDescription
idstringoptionalRecord ID if operation succeeded
successbooleanWhether this record was processed successfully
errorsObject[]optionalArray of errors if operation failed
dataRecord<string, any>optionalFull record data (if returnRecords=true)
indexnumberoptionalIndex of the record in the request array

BatchOperationType

Allowed Values

  • create
  • update
  • upsert
  • delete

BatchOptions

Properties

PropertyTypeRequiredDescription
atomicbooleanIf true, rollback entire batch on any failure (transaction mode)
returnRecordsbooleanIf true, return full record data in response
continueOnErrorbooleanIf true (and atomic=false), continue processing remaining records after errors
validateOnlybooleanIf true, validate records without persisting changes (dry-run mode)

BatchRecord

Properties

PropertyTypeRequiredDescription
idstringoptionalRecord ID (required for update/delete)
dataRecord<string, any>optionalRecord data (required for create/update/upsert)
externalIdstringoptionalExternal ID for upsert matching

BatchUpdateRequest

Properties

PropertyTypeRequiredDescription
operationEnum<'create' | 'update' | 'upsert' | 'delete'>Type of batch operation
recordsObject[]Array of records to process (max 200 per batch)
optionsObjectoptionalBatch operation options

BatchUpdateResponse

Properties

PropertyTypeRequiredDescription
successbooleanOperation success status
errorObjectoptionalError details if success is false
metaObjectoptionalResponse metadata
operationEnum<'create' | 'update' | 'upsert' | 'delete'>optionalOperation type that was performed
totalnumberTotal number of records in the batch
succeedednumberNumber of records that succeeded
failednumberNumber of records that failed
resultsObject[]Detailed results for each record

DeleteManyRequest

Properties

PropertyTypeRequiredDescription
idsstring[]Array of record IDs to delete (max 200)
optionsObjectoptionalDelete options

UpdateManyRequest

Properties

PropertyTypeRequiredDescription
recordsObject[]Array of records to update (max 200 per batch)
optionsObjectoptionalUpdate options

On this page