mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
d847649fe5
- Create `/modules/data/` architecture with vendor registry pattern - Implement core import pipeline with validation, transformation, and conflict resolution - Add lineage tracking with SHA-256 file hashing for re-import detection - Implement TypingMind vendor with relaxed Zod schemas - Create multi-step UX flow: Parse → Validate → Confirm → Import → Results - Add ID conflict resolution with auto-rename strategy - Support both string and array message content formats - Integrate TypingMind import button into ImportChats.tsx Architecture highlights: - Extensible vendor system for future import sources - Comprehensive warning/error reporting - Provenance tracking in conversation metadata - ISO to Unix timestamp conversion - Documentation of unsupported features Closes #886 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Enrico Ros <enricoros@users.noreply.github.com>
48 lines
944 B
TypeScript
48 lines
944 B
TypeScript
/**
|
|
* Registry for data import vendors
|
|
*/
|
|
|
|
import type { IDataVendor, VendorId } from './vendor.types';
|
|
|
|
|
|
/**
|
|
* Global registry of data import vendors
|
|
*/
|
|
const _vendorRegistry = new Map<VendorId, IDataVendor>();
|
|
|
|
|
|
/**
|
|
* Register a data import vendor
|
|
*/
|
|
export function registerDataVendor(vendor: IDataVendor): void {
|
|
if (_vendorRegistry.has(vendor.id)) {
|
|
console.warn(`[Data Import] Vendor ${vendor.id} is already registered`);
|
|
return;
|
|
}
|
|
_vendorRegistry.set(vendor.id, vendor);
|
|
}
|
|
|
|
|
|
/**
|
|
* Get a vendor by ID
|
|
*/
|
|
export function getDataVendor(vendorId: VendorId): IDataVendor | null {
|
|
return _vendorRegistry.get(vendorId) || null;
|
|
}
|
|
|
|
|
|
/**
|
|
* Get all registered vendors
|
|
*/
|
|
export function getAllDataVendors(): IDataVendor[] {
|
|
return Array.from(_vendorRegistry.values());
|
|
}
|
|
|
|
|
|
/**
|
|
* Check if a vendor is registered
|
|
*/
|
|
export function hasDataVendor(vendorId: VendorId): boolean {
|
|
return _vendorRegistry.has(vendorId);
|
|
}
|