Skip to content
Open
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
10 changes: 5 additions & 5 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"class-variance-authority": "^0.7.1",
"client-only": "^0.0.1",
"clsx": "^2.1.1",
"fumadocs-core": "^16.4.7",
"fumadocs-mdx": "^14.2.5",
"fumadocs-ui": "^16.4.7",
"lucide-react": "^0.562.0",
"next": "^16.1.3",
"fumadocs-core": "^16.4.9",
"fumadocs-mdx": "^14.2.6",
"fumadocs-ui": "^16.4.9",
"lucide-react": "^0.563.0",
"next": "^16.1.6",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"server-only": "^0.0.1",
Expand Down
94 changes: 94 additions & 0 deletions content/docs/references/data/mapping.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
title: Mapping
description: Mapping protocol schemas
---

# Mapping

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

## TypeScript Usage

```typescript
import { MappingSchema, FieldMappingSchema, TransformType } from '@objectstack/spec/data';
import type { Mapping, FieldMapping } from '@objectstack/spec/data';

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

---

## FieldMapping

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **source** | `string \| string[]` | ✅ | Source column header(s) |
| **target** | `string \| string[]` | ✅ | Target object field(s) |
| **transform** | `Enum<'none' \| 'constant' \| 'lookup' \| 'split' \| 'join' \| 'javascript' \| 'map'>` | optional | Transformation type (default: 'none') |
| **params** | `object` | optional | Configuration for transform |

### Transform Params Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **value** | `any` | optional | Value for constant transform |
| **object** | `string` | optional | Lookup Object for lookup transform |
| **fromField** | `string` | optional | Match on field (e.g. "name") for lookup |
| **toField** | `string` | optional | Value to take (e.g. "_id") for lookup |
| **autoCreate** | `boolean` | optional | Create if missing for lookup |
| **valueMap** | `Record<string, any>` | optional | Value mapping for map transform (e.g. { "Open": "draft" }) |
| **separator** | `string` | optional | Separator for split/join transforms |

---

## Mapping

Defines a reusable data mapping configuration for ETL operations.

**NAMING CONVENTION:**
Mapping names are machine identifiers and must be lowercase snake_case.

**Examples of good mapping names:**
- `salesforce_to_crm`
- `csv_import_contacts`
- `api_sync_orders`

**Examples of bad mapping names (will be rejected):**
- `SalesforceToCRM` (PascalCase)
- `CSV Import` (spaces)

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **name** | `string` | ✅ | Mapping unique name (lowercase snake_case) |
| **label** | `string` | optional | Human readable label |
| **sourceFormat** | `Enum<'csv' \| 'json' \| 'xml' \| 'sql'>` | optional | Source data format (default: 'csv') |
| **targetObject** | `string` | ✅ | Target Object Name |
| **fieldMapping** | `object[]` | ✅ | Column Mappings |
| **mode** | `Enum<'insert' \| 'update' \| 'upsert'>` | optional | Data operation mode (default: 'insert') |
| **upsertKey** | `string[]` | optional | Fields to match for upsert (e.g. email) |
| **extractQuery** | `object` | optional | Query to run for export only |
| **errorPolicy** | `Enum<'skip' \| 'abort' \| 'retry'>` | optional | Error handling strategy (default: 'skip') |
| **batchSize** | `number` | optional | Batch size for operations (default: 1000) |

---

## TransformType

Built-in helpers for converting data during import.

### Allowed Values

* `none` - Direct copy
* `constant` - Use a hardcoded value
* `lookup` - Resolve FK (Name → ID)
* `split` - "John Doe" → ["John", "Doe"]
* `join` - ["John", "Doe"] → "John Doe"
* `javascript` - Custom script (Review security!)
* `map` - Value mapping (e.g. "Active" → "active")
152 changes: 152 additions & 0 deletions content/docs/references/ui/block.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
title: Block
description: Block protocol schemas
---

# Block

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

## TypeScript Usage

```typescript
import {
PageHeaderProps,
PageTabsProps,
PageCardProps,
RecordDetailsProps,
RecordRelatedListProps,
RecordHighlightsProps,
ComponentPropsMap
} from '@objectstack/spec/ui';

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

---

## Component Props Map

Maps Component Type to its Property Schema. Available component types:

### Structure Components

* `page:header`
* `page:tabs`
* `page:card`
* `page:footer`
* `page:sidebar`
* `page:accordion`
* `page:section`

### Record Components

* `record:details`
* `record:related_list`
* `record:highlights`
* `record:activity`
* `record:chatter`
* `record:path`

### Navigation Components

* `app:launcher`
* `nav:menu`
* `nav:breadcrumb`

### Utility Components

* `global:search`
* `global:notifications`
* `user:profile`

### AI Components

* `ai:chat_window`
* `ai:suggestion`

---

## PageHeaderProps

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **title** | `string` | ✅ | Page title |
| **subtitle** | `string` | optional | Page subtitle |
| **icon** | `string` | optional | Icon name |
| **breadcrumb** | `boolean` | optional | Show breadcrumb (default: true) |
| **actions** | `string[]` | optional | Action IDs to show in header |

---

## PageTabsProps

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `Enum<'line' \| 'card' \| 'pill'>` | optional | Tab type (default: 'line') |
| **position** | `Enum<'top' \| 'left'>` | optional | Tab position (default: 'top') |
| **items** | `object[]` | ✅ | Tab items |

### Tab Item Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **label** | `string` | ✅ | Tab label |
| **icon** | `string` | optional | Tab icon |
| **children** | `any[]` | ✅ | Child components |

---

## PageCardProps

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **title** | `string` | optional | Card title |
| **bordered** | `boolean` | optional | Show border (default: true) |
| **actions** | `string[]` | optional | Action IDs |
| **children** | `any[]` | ✅ | Card content |

---

## RecordDetailsProps

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **columns** | `Enum<'1' \| '2' \| '3' \| '4'>` | optional | Number of columns (default: '2') |
| **layout** | `Enum<'auto' \| 'custom'>` | optional | Layout mode (default: 'auto') |
| **sections** | `string[]` | optional | Section IDs to show (for custom layout) |

---

## RecordRelatedListProps

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **objectName** | `string` | ✅ | Related object name |
| **relationshipField** | `string` | ✅ | Field on related object that points to this record |
| **columns** | `string[]` | ✅ | Fields to display |
| **sort** | `string` | optional | Sort order |
| **limit** | `number` | optional | Maximum number of records (default: 5) |

---

## RecordHighlightsProps

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **fields** | `string[]` | ✅ | Key fields to highlight (minimum 1, maximum 7) |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typescript": "^5.3.0"
},
"dependencies": {
"lucide-react": "^0.562.0"
"lucide-react": "^0.563.0"
},
"engines": {
"node": ">=18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-hono-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@objectstack/spec": "workspace:*",
"@objectstack/types": "workspace:*",
"@objectstack/runtime": "workspace:*",
"hono": "^4.0.0"
"hono": "^4.11.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
Expand Down
Loading
Loading