Document Store
Interfaces
Interfaces
AppConfig
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
port | number | Yes | |
jwtSecret | string | Yes | |
trustProxyAuth | boolean | Yes | |
s3 | S3Config | Yes | |
redis | { url: string; host: string; port: number; queuePrefix: string; } | Yes | |
surreal | SurrealConfig | Yes | |
embedding | EmbeddingServiceConfig | Yes | |
rag | { enabled: boolean; concurrency: number; } | Yes | |
rxdb | { serverUrl: string; } | Yes |
ServerOptions
Server options for creating the Express application
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
ragQueue | RAGQueue | undefined | No | Optional RAGQueue instance for enqueueing RAG sync jobs |
ChunkOptions
Options for chunking documents
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
maxTokens | number | Yes | Maximum tokens per chunk |
overlapTokens | number | Yes | Number of tokens to overlap between chunks |
DocumentChunk
A single chunk of a document
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document identifier |
chunkIndex | number | Yes | Index of this chunk (0-based) |
text | string | Yes | Text content of the chunk |
tokens | number | Yes | Estimated token count |
startLine | number | Yes | Starting line number in original document (1-indexed) |
endLine | number | Yes | Ending line number in original document (1-indexed) |
context | string | undefined | No | Contextual information (e.g., header name, function name) |
ChunkedDocument
Result of chunking a document
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document identifier |
chunks | DocumentChunk[] | Yes | Array of chunks |
totalChunks | number | Yes | Total number of chunks |
totalTokens | number | Yes | Total estimated tokens across all chunks |
Section
Represents a section within structured content (code or markdown)
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Section type (e.g., 'function', 'class', 'header') |
name | string | Yes | Section name/title |
startLine | number | Yes | Starting line number (1-indexed) |
endLine | number | Yes | Ending line number (1-indexed) |
text | string | Yes | Text content of the section |
ContentMetadata
Metadata about extracted content
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
wordCount | number | Yes | Total word count |
lineCount | number | Yes | Total line count |
encoding | string | Yes | Detected or provided encoding |
language | string | undefined | No | Programming language or content type |
ExtractedContent
Extracted content with text, structure, and metadata
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Raw text content |
contentType | string | undefined | No | High-level content type (e.g., 'code', 'markdown', 'text') |
structure | { sections: Section[]; } | undefined | No | Structured sections (for code/markdown) |
metadata | ContentMetadata | Yes | Content metadata |
AuthUser
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | |
domainId | string | undefined | No | |
sub | string | Yes |
AuthMiddlewareOptions
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
jwtSecret | string | Yes | |
trustProxyAuth | boolean | Yes |
RedisConfig
Redis connection configuration
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
host | string | undefined | No | |
port | number | undefined | No | |
password | string | undefined | No | |
db | number | undefined | No |
RAGQueueConfig
RAGQueue configuration options
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
queueName | string | undefined | No | Name of the queue (default: 'rag-sync') |
redis | RedisConfig | Yes | Redis connection configuration |
defaultJobOptions | Partial<JobsOptions> | undefined | No | Default job options |
RAGSyncJob
Job payload for RAG sync operations
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Unique document identifier |
workspaceId | string | Yes | Workspace identifier |
codebaseId | string | Yes | Codebase identifier |
s3Key | string | Yes | S3 object key |
s3Bucket | string | Yes | S3 bucket name |
filename | string | Yes | Original filename |
mimeType | string | Yes | MIME type of the document |
language | string | undefined | No | Programming language (if applicable) |
metadata | Record<string, unknown> | undefined | No | Additional metadata |
RAGSyncResult
Result of a RAG sync job
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document identifier |
success | boolean | Yes | Whether the sync was successful |
chunkCount | number | undefined | No | Number of chunks created |
error | string | undefined | No | Error message if failed |
QueueStats
Queue statistics
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
waiting | number | Yes | Number of jobs waiting to be processed |
active | number | Yes | Number of jobs currently being processed |
completed | number | Yes | Number of successfully completed jobs |
failed | number | Yes | Number of failed jobs |
EnqueueOptions
Options for enqueueing a job
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
priority | number | undefined | No | Job priority (lower number = higher priority) |
delay | number | undefined | No | Delay before job can be processed (milliseconds) |
attempts | number | undefined | No | Number of retry attempts |
DocumentsRouterOptions
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
config | AppConfig | Yes | |
ragQueue | RAGQueue | undefined | No |
EmbeddingServiceConfig
Configuration for EmbeddingService
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
ollamaUrl | string | Yes | Ollama server URL (e.g., 'http://localhost:11434') |
model | string | Yes | Embedding model to use (e.g., 'nomic-embed-text') |
timeout | number | undefined | No | Request timeout in milliseconds (default: 120000 = 2 minutes) |
S3Config
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
provider | "minio" | "digitalocean" | "aws" | Yes | |
endpoint | string | Yes | |
publicEndpoint | string | undefined | No | Public endpoint for presigned URLs (when S3 is behind Docker network) |
region | string | Yes | |
accessKeyId | string | Yes | |
secretAccessKey | string | Yes | |
bucket | string | Yes | |
forcePathStyle | boolean | undefined | No | |
cdnDomain | string | undefined | No |
PresignedUploadUrl
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
uploadUrl | string | Yes | |
fields | Record<string, string> | undefined | No |
PresignedDownloadUrl
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
downloadUrl | string | Yes |
GitWatcherConfig
Configuration for a git repository watcher
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace ID for document isolation |
codebaseId | string | Yes | Codebase ID linking to codebase collection |
repoPath | string | Yes | Local file system path to repository root |
branch | string | undefined | No | Git branch to watch (default: current branch) |
include | string[] | undefined | No | Include glob patterns (default: all text files) |
exclude | string[] | undefined | No | Exclude glob patterns (default: .gitignore rules) |
debounceMs | number | undefined | No | Debounce milliseconds for batch processing (default: 300000 = 5 min) |
GitFileChange
A single file change detected in watched repository
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
filePath | string | Yes | Relative path from repo root |
operation | "add" | "modify" | "delete" | Yes | Operation type: 'add', 'modify', 'delete' |
commitHash | string | Yes | Git commit hash (from 'git log -1' for this file) |
branch | string | Yes | Git branch name |
author | string | Yes | Commit author name |
committedAt | string | Yes | Commit timestamp ISO string |
GitWatcherBatch
Batch of file changes to be processed as one RAG sync job
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
repoPath | string | Yes | Local repo path |
codebaseId | string | Yes | Codebase ID for workspace isolation |
workspaceId | string | Yes | Workspace ID |
changes | GitFileChange[] | Yes | Array of file changes in this batch |
triggeredAt | string | Yes | When batch was triggered (ISO string) |
GitWatcherStatus
Git watcher instance status
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
codebaseId | string | Yes | |
repoPath | string | Yes | |
status | "active" | "paused" | "error" | Yes | |
lastSync | string | undefined | No | |
filesIndexed | number | Yes | |
errorMessage | string | undefined | No |
RedisConfig
Redis connection configuration
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
host | string | undefined | No | |
port | number | undefined | No | |
password | string | undefined | No | |
db | number | undefined | No |
RAGWorkerConfig
Configuration for RAGWorker
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
redis | RedisConfig | Yes | Redis connection configuration |
s3 | S3Config | Yes | S3 storage configuration |
surreal | SurrealConfig | Yes | SurrealDB configuration |
embedding | EmbeddingServiceConfig | Yes | Embedding service configuration |
chunking | ChunkOptions | Yes | Chunking options |
queueName | string | undefined | No | Queue name (default: 'rag-sync') |
concurrency | number | undefined | No | Worker concurrency (default: 5) |
SurrealConfig
Configuration for SurrealDB connection
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
endpoint | string | Yes | SurrealDB endpoint URL (e.g., 'ws://localhost:8000/rpc') |
namespace | string | Yes | Namespace |
database | string | Yes | Database name |
auth | { username: string; password: string; } | undefined | No | Authentication credentials |
VectorRecord
Vector record to be stored in SurrealDB
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier for the vector (format: documentId:chunkIndex) |
documentId | string | Yes | Document identifier |
workspaceId | string | Yes | Workspace identifier |
codebaseId | string | Yes | Codebase identifier |
chunkIndex | number | Yes | Chunk index |
text | string | Yes | Text content of the chunk |
embedding | number[] | Yes | Vector embedding (768 dimensions for nomic-embed-text) |
tokens | number | Yes | Estimated token count |
startLine | number | Yes | Starting line number in original document |
endLine | number | Yes | Ending line number in original document |
context | string | undefined | No | Contextual information (e.g., header name, function name) |
metadata | Record<string, unknown> | undefined | No | Additional metadata |
createdAt | Date | Yes | Timestamp when record was created |