Arke
ReferenceSchemas

Type Profiles

How type profiles extend the base Eidos schema with type-specific validation.

Overview

Type profiles layer on top of the base Eidos schema. They define what goes inside the envelope:

  • Required and optional properties for this type
  • Typed TypeScript interfaces for the manifest
  • Expected relationships and predicates
  • Type-specific validation rules
  • Protected properties that require special endpoints

How Profiles Extend Eidos

Each profile defines a typed manifest interface that extends CurrentEidos:

// Example: Collection profile
export interface CollectionManifest extends CurrentEidos {
  type: 'collection';
  properties: CollectionProperties;
}

// Example: File profile
export interface FileManifest extends CurrentEidos {
  type: 'file';
  properties: FileProperties & Record<string, unknown>;
}

The CurrentEidos type automatically tracks the current schema version (currently arke/eidos@v1), so profiles adapt when the base schema evolves.

How Profiles Work

When an entity is created or updated:

  1. Base Eidos validation runs first (envelope structure)
  2. The entity's type field determines which profile applies
  3. Profile-specific validation runs (required properties, relationship rules)
  4. If the type is unknown, only base validation applies

Profile operations also:

  • Define typed input interfaces (CreateXxxInput, UpdateXxxInput)
  • Return typed result interfaces (XxxResult, UpdateXxxResult)
  • Provide type-specific operations (e.g., addRole for collections, uploadFileContent for files)

Protected Properties

Some profiles define protected properties that cannot be modified via the generic PUT /entities/{id} endpoint. These properties have security implications and require type-specific endpoints with proper validation.

Entity TypeProtected PropertiesReason
collectionrolesMust use role management endpoints

Use the type-specific endpoints (e.g., role management endpoints) to modify protected properties.

Available Profiles

ProfileType ConstantDescription
CollectioncollectionPermission container with roles and role assignments
FilefileUploaded file with binary content in R2
FolderfolderHierarchical container with parent/child relationships
UseruserHuman or service account identity

Profile Structure

Each profile in src/profiles/ typically includes:

FilePurpose
types.tsType constants, interfaces, input/result types
index.tsPublic exports
operations.tsCRUD and type-specific operations
validation.tsValidation functions (if complex validation needed)

Extensibility

You can create new entity types without modifying the base schema:

  1. Define types: Create a manifest interface extending CurrentEidos with your type constant and properties interface
  2. Create operations: Implement CRUD operations using the base entity operations
  3. Register protected properties: Add to PROTECTED_PROPERTIES registry if needed
  4. Export from profiles index: Add exports to src/profiles/index.ts

The base Eidos schema is open for properties, relationships, and types -- only the envelope structure is fixed.

On this page