Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions content/docs/references/api/batch.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
title: Batch
description: Batch protocol schemas
---

# Batch

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

## TypeScript Usage

```typescript
import { BatchOperationResultSchema, BatchOperationTypeSchema, BatchOptionsSchema, BatchRecordSchema, BatchUpdateRequestSchema, BatchUpdateResponseSchema, DeleteManyRequestSchema, UpdateManyRequestSchema } from '@objectstack/spec/api';
import type { BatchOperationResult, BatchOperationType, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, DeleteManyRequest, UpdateManyRequest } from '@objectstack/spec/api';

// Validate data
const result = BatchOperationResultSchema.parse(data);
```

---

## BatchOperationResult

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **id** | `string` | optional | Record ID if operation succeeded |
| **success** | `boolean` | ✅ | Whether this record was processed successfully |
| **errors** | `object[]` | optional | Array of errors if operation failed |
| **data** | `Record<string, any>` | optional | Full record data (if returnRecords=true) |
| **index** | `number` | optional | Index of the record in the request array |

---

## BatchOperationType

### Allowed Values

* `create`
* `update`
* `upsert`
* `delete`

---

## BatchOptions

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **atomic** | `boolean` | optional | If true, rollback entire batch on any failure (transaction mode) |
| **returnRecords** | `boolean` | optional | If true, return full record data in response |
| **continueOnError** | `boolean` | optional | If true (and atomic=false), continue processing remaining records after errors |
| **validateOnly** | `boolean` | optional | If true, validate records without persisting changes (dry-run mode) |

---

## BatchRecord

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **id** | `string` | optional | Record ID (required for update/delete) |
| **data** | `Record<string, any>` | optional | Record data (required for create/update/upsert) |
| **externalId** | `string` | optional | External ID for upsert matching |

---

## BatchUpdateRequest

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **operation** | `Enum<'create' \| 'update' \| 'upsert' \| 'delete'>` | ✅ | Type of batch operation |
| **records** | `object[]` | ✅ | Array of records to process (max 200 per batch) |
| **options** | `object` | optional | Batch operation options |

---

## BatchUpdateResponse

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

---

## DeleteManyRequest

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **ids** | `string[]` | ✅ | Array of record IDs to delete (max 200) |
| **options** | `object` | optional | Delete options |

---

## UpdateManyRequest

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **records** | `object[]` | ✅ | Array of records to update (max 200 per batch) |
| **options** | `object` | optional | Update options |

123 changes: 123 additions & 0 deletions content/docs/references/api/cache.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: Cache
description: Cache protocol schemas
---

# Cache

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

## TypeScript Usage

```typescript
import { CacheControlSchema, CacheDirectiveSchema, CacheInvalidationRequestSchema, CacheInvalidationResponseSchema, CacheInvalidationTargetSchema, ETagSchema, MetadataCacheRequestSchema, MetadataCacheResponseSchema } from '@objectstack/spec/api';
import type { CacheControl, CacheDirective, CacheInvalidationRequest, CacheInvalidationResponse, CacheInvalidationTarget, ETag, MetadataCacheRequest, MetadataCacheResponse } from '@objectstack/spec/api';

// Validate data
const result = CacheControlSchema.parse(data);
```

---

## CacheControl

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **directives** | `Enum<'public' \| 'private' \| 'no-cache' \| 'no-store' \| 'must-revalidate' \| 'max-age'>[]` | ✅ | Cache control directives |
| **maxAge** | `number` | optional | Maximum cache age in seconds |
| **staleWhileRevalidate** | `number` | optional | Allow serving stale content while revalidating (seconds) |
| **staleIfError** | `number` | optional | Allow serving stale content on error (seconds) |

---

## CacheDirective

### Allowed Values

* `public`
* `private`
* `no-cache`
* `no-store`
* `must-revalidate`
* `max-age`

---

## CacheInvalidationRequest

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **target** | `Enum<'all' \| 'object' \| 'field' \| 'permission' \| 'layout' \| 'custom'>` | ✅ | What to invalidate |
| **identifiers** | `string[]` | optional | Specific resources to invalidate (e.g., object names) |
| **cascade** | `boolean` | optional | If true, invalidate dependent resources |
| **pattern** | `string` | optional | Pattern for custom invalidation (supports wildcards) |

---

## CacheInvalidationResponse

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **success** | `boolean` | ✅ | Whether invalidation succeeded |
| **invalidated** | `number` | ✅ | Number of cache entries invalidated |
| **targets** | `string[]` | optional | List of invalidated resources |

---

## CacheInvalidationTarget

### Allowed Values

* `all`
* `object`
* `field`
* `permission`
* `layout`
* `custom`

---

## ETag

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **value** | `string` | ✅ | ETag value (hash or version identifier) |
| **weak** | `boolean` | optional | Whether this is a weak ETag |

---

## MetadataCacheRequest

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **ifNoneMatch** | `string` | optional | ETag value for conditional request (If-None-Match header) |
| **ifModifiedSince** | `string` | optional | Timestamp for conditional request (If-Modified-Since header) |
| **cacheControl** | `object` | optional | Client cache control preferences |

---

## MetadataCacheResponse

### 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` | optional | True if resource has not been modified (304 response) |
| **version** | `string` | optional | Metadata version identifier |

32 changes: 32 additions & 0 deletions content/docs/references/api/connector.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Connector
description: Connector protocol schemas
---

# Connector

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

## TypeScript Usage

```typescript
import { RetryStrategySchema } from '@objectstack/spec/api';
import type { RetryStrategy } from '@objectstack/spec/api';

// Validate data
const result = RetryStrategySchema.parse(data);
```

---

## RetryStrategy

### Allowed Values

* `no_retry`
* `retry_immediate`
* `retry_backoff`
* `retry_after`

1 change: 1 addition & 0 deletions content/docs/references/api/contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const result = ApiErrorSchema.parse(data);
| **object** | `string` | ✅ | Object name (e.g. account) |
| **fields** | `string \| object[]` | optional | Fields to retrieve |
| **where** | `any` | optional | Filtering criteria (WHERE) |
| **search** | `object` | optional | Full-text search configuration ($search parameter) |
| **orderBy** | `object[]` | optional | Sorting instructions (ORDER BY) |
| **limit** | `number` | optional | Max records to return (LIMIT) |
| **offset** | `number` | optional | Records to skip (OFFSET) |
Expand Down
Loading
Loading