Document
Document protocol schemas
Source: packages/spec/src/data/document.zod.ts
import { DocumentSchema, DocumentTemplateSchema, DocumentVersionSchema, ESignatureConfigSchema } from '@objectstack/spec/data';
import type { Document, DocumentTemplate, DocumentVersion, ESignatureConfig } from '@objectstack/spec/data';
// Validate data
const result = DocumentSchema.parse(data);
| Property | Type | Required | Description |
|---|
| id | string | ✅ | Document ID |
| name | string | ✅ | Document name |
| description | string | optional | Document description |
| fileType | string | ✅ | File MIME type |
| fileSize | number | ✅ | File size in bytes |
| category | string | optional | Document category |
| tags | string[] | optional | Document tags |
| versioning | { enabled: boolean; versions: object[]; majorVersion: number; minorVersion: number } | optional | Version control |
| template | { id: string; name: string; description?: string; fileUrl: string; … } | optional | Document template |
| eSignature | { provider: Enum<'docusign' | 'adobe-sign' | 'hellosign' | 'custom'>; enabled: boolean; signers: object[]; expirationDays: number; … } | optional | E-signature config |
| access | { isPublic: boolean; sharedWith?: string[]; expiresAt?: number } | optional | Access control |
| metadata | Record<string, any> | optional | Custom metadata |
| Property | Type | Required | Description |
|---|
| enabled | boolean | ✅ | Versioning enabled |
| versions | { versionNumber: number; createdAt: number; createdBy: string; size: number; … }[] | ✅ | Version history |
| majorVersion | number | ✅ | Major version |
| minorVersion | number | ✅ | Minor version |
| Property | Type | Required | Description |
|---|
| id | string | ✅ | Template ID |
| name | string | ✅ | Template name |
| description | string | optional | Template description |
| fileUrl | string | ✅ | Template file URL |
| fileType | string | ✅ | File MIME type |
| placeholders | { key: string; label: string; type: Enum<'text' | 'number' | 'date' | 'image'>; required: boolean }[] | ✅ | Template placeholders |
| Property | Type | Required | Description |
|---|
| provider | Enum<'docusign' | 'adobe-sign' | 'hellosign' | 'custom'> | ✅ | E-signature provider |
| enabled | boolean | optional (default: false) | E-signature enabled |
| signers | { email: string; name: string; role: string; order: number }[] | ✅ | Document signers |
| expirationDays | number | optional (default: 30) | Expiration days |
| reminderDays | number | optional (default: 7) | Reminder interval days |
| Property | Type | Required | Description |
|---|
| isPublic | boolean | optional (default: false) | Public access |
| sharedWith | string[] | optional | Shared with |
| expiresAt | number | optional | Access expiration |
| Property | Type | Required | Description |
|---|
| id | string | ✅ | Template ID |
| name | string | ✅ | Template name |
| description | string | optional | Template description |
| fileUrl | string | ✅ | Template file URL |
| fileType | string | ✅ | File MIME type |
| placeholders | { key: string; label: string; type: Enum<'text' | 'number' | 'date' | 'image'>; required: boolean }[] | ✅ | Template placeholders |
| Property | Type | Required | Description |
|---|
| key | string | ✅ | Placeholder key |
| label | string | ✅ | Placeholder label |
| type | Enum<'text' | 'number' | 'date' | 'image'> | ✅ | Placeholder type |
| required | boolean | optional (default: false) | Is required |
| Property | Type | Required | Description |
|---|
| versionNumber | number | ✅ | Version number |
| createdAt | number | ✅ | Creation timestamp |
| createdBy | string | ✅ | Creator user ID |
| size | number | ✅ | File size in bytes |
| checksum | string | ✅ | File checksum |
| downloadUrl | string | ✅ | Download URL |
| isLatest | boolean | optional (default: false) | Is latest version |
| Property | Type | Required | Description |
|---|
| provider | Enum<'docusign' | 'adobe-sign' | 'hellosign' | 'custom'> | ✅ | E-signature provider |
| enabled | boolean | optional (default: false) | E-signature enabled |
| signers | { email: string; name: string; role: string; order: number }[] | ✅ | Document signers |
| expirationDays | number | optional (default: 30) | Expiration days |
| reminderDays | number | optional (default: 7) | Reminder interval days |
| Property | Type | Required | Description |
|---|
| email | string | ✅ | Signer email |
| name | string | ✅ | Signer name |
| role | string | ✅ | Signer role |
| order | number | ✅ | Signing order |