rspace-online/shared/local-first/index.ts

76 lines
1.7 KiB
TypeScript

/**
* Local-First Data Infrastructure for rSpace
*
* 7-layer architecture:
* 1. Crypto — PRF key derivation, AES-256-GCM per-document encryption
* 2. Document — Automerge documents with typed schemas
* 3. Storage — Encrypted multi-document IndexedDB
* 4. Sync — Multi-doc WebSocket sync (client-side)
* 5. Compute — Deterministic transforms (local or server-delegated)
* 6. Query — Materialized views + full-text search
* 7. Application (module-specific, not in this package)
*
* Plus: Memory Card interchange format for cross-module data exchange.
*/
// Layer 1: Crypto
export { DocCrypto, type EncryptedBlob } from './crypto';
// Layer 2: Document
export {
type DocumentId,
type ParsedDocumentId,
type DocSchema,
type DocMeta,
parseDocumentId,
makeDocumentId,
DocumentManager,
} from './document';
// Layer 3: Storage
export { EncryptedDocStore } from './storage';
// Layer 4: Sync (client)
export {
DocSyncManager,
type DocSyncManagerOptions,
type SyncMessage,
type SubscribeMessage,
type UnsubscribeMessage,
type AwarenessMessage,
type WireMessage,
} from './sync';
// Layer 5: Compute
export {
type Transform,
ComputeEngine,
type ComputeEngineOptions,
localTransform,
serverTransform,
} from './compute';
// Layer 6: Query
export {
type MaterializedView,
type SearchResult,
ViewEngine,
LocalSearchEngine,
} from './query';
// Memory Card interchange
export {
type MemoryCard,
type MemoryCardType,
type CardExporter,
createCard,
filterByType,
filterByTag,
filterByModule,
sortByNewest,
searchCards,
registerExporter,
getExporter,
getAllExporters,
} from './memory-card';