bb-inspired
Version:
Core library for BB-inspired NestJS backend
94 lines (93 loc) • 2.39 kB
TypeScript
export interface DataTransferMetadata {
version: string;
timestamp: string;
format: string;
source?: string;
description?: string;
tags?: string[];
[key: string]: any;
}
export interface ExportOptions {
format?: 'json' | 'csv' | 'xml';
pretty?: boolean;
encrypt?: boolean;
encryptionKey?: string;
compress?: boolean;
includeMetadata?: boolean;
customMetadata?: Record<string, any>;
filter?: Record<string, any> | ((item: any) => boolean);
destination?: 'file' | 'memory' | 'stream' | 'http';
filename?: string;
path?: string;
url?: string;
headers?: Record<string, string>;
[key: string]: any;
}
export interface ImportOptions {
format?: 'json' | 'csv' | 'xml';
validate?: boolean;
validateOptions?: any;
decrypt?: boolean;
decryptionKey?: string;
decompress?: boolean;
source?: 'file' | 'memory' | 'stream' | 'http';
filename?: string;
path?: string;
url?: string;
headers?: Record<string, string>;
mergeStrategy?: 'replace' | 'merge' | 'skip';
transformers?: Array<(data: any) => any>;
[key: string]: any;
}
export interface ExportResult<T = any> {
data: T;
metadata: DataTransferMetadata;
format: string;
size?: number;
path?: string;
url?: string;
success: boolean;
errors?: Error[];
warnings?: string[];
}
export interface ImportResult<T = any> {
data: T;
metadata: DataTransferMetadata;
format: string;
totalItems: number;
importedItems: number;
skippedItems: number;
failedItems: number;
success: boolean;
errors?: Error[];
warnings?: string[];
}
export interface DataExportPackage<T = any> {
data: T;
metadata: DataTransferMetadata;
schema?: any;
checksum?: string;
version: string;
}
export interface SchemaDefinition {
type: string;
version: string;
properties: Record<string, SchemaProperty>;
required?: string[];
additionalProperties?: boolean;
}
export interface SchemaProperty {
type: string;
format?: string;
description?: string;
default?: any;
enum?: any[];
minimum?: number;
maximum?: number;
minLength?: number;
maxLength?: number;
pattern?: string;
items?: SchemaProperty | SchemaProperty[];
properties?: Record<string, SchemaProperty>;
[key: string]: any;
}