UNPKG

@andrejs1979/document

Version:

MongoDB-compatible document database for NoSQL

94 lines 3.1 kB
/** * NoSQL - Document Module Exports * MongoDB-compatible document database with vector integration */ // Main classes export { EdgeDocumentDB } from './edge-document-db'; // Storage and operations export { DocumentStorage } from './storage/document-storage'; export { MongoQueryEngine } from './operations/query-engine'; export { HybridSearchEngine } from './operations/hybrid-search'; export { BulkOperationsManager, DocumentStream } from './operations/bulk-operations'; // Index and relationship management export { DocumentIndexManager } from './indexes/index-manager'; export { RelationshipManager } from './relationships/relationship-manager'; // Metadata and tagging export { TaggingSystem } from './metadata/tagging-system'; // Types and interfaces export * from './types'; // Convenience factory functions export async function createDocumentDatabase(config) { return EdgeDocumentDB.create(config); } // Type guards and utilities export function isDocument(obj) { return obj && typeof obj === 'object' && typeof obj._id === 'string'; } export function isObjectId(value) { return typeof value === 'string' && value.length > 0; } export function generateObjectId() { const timestamp = Math.floor(Date.now() / 1000).toString(16); const random = Math.random().toString(16).substring(2, 10); const counter = Math.random().toString(16).substring(2, 8); return timestamp + random + counter; } // Query helpers export function buildTextSearchFilter(searchText) { return { $text: { $search: searchText } }; } export function buildTagFilter(tags, operator = 'or') { if (operator === 'and') { return { tags: { $all: tags } }; } else { return { tags: { $in: tags } }; } } export function buildDateRangeFilter(field, startDate, endDate) { const filter = {}; if (startDate || endDate) { filter[field] = {}; if (startDate) filter[field].$gte = startDate; if (endDate) filter[field].$lte = endDate; } return filter; } // Configuration helpers export function createDefaultConfig(name, d1Database) { return { name, d1Database, maxDocumentSize: 16 * 1024 * 1024, queryTimeout: 30000, batchSize: 100, enableQueryCache: true, queryCacheTTL: 300, cacheSize: 100, enableAutoIndexing: true, autoIndexThreshold: 1000, maxIndexedFields: 20, vectorConfig: { enabled: true, defaultDimensions: 1536, defaultModel: 'text-embedding-ada-002', autoEmbedding: false, embeddingFields: ['content', 'text', 'description'] }, enableValidation: true, enableSchemaEvolution: true, enableChangeStreams: true, maxChangeStreamConnections: 1000, enableQueryLogging: false, enablePerformanceMetrics: true, enableRelationships: true, populateDepth: 3, bulkWriteBatchSize: 1000, bulkWriteParallelism: 4 }; } //# sourceMappingURL=index.js.map