import { PinataService } from './pinata.service.js'; import { CidCalculatorService } from './cid-calculator.service.js'; import { IPLDCanonicalizerService } from './ipld-canonicalizer.service.js'; import { JsonCanonicalizerService } from './json-canonicalizer.service.cjs'; export interface IPLDConversionResult { originalData: any; convertedData: any; hasLinks: boolean; linkedCIDs: string[]; dagCborCID?: string; } export interface SchemaInfo { format?: string; type?: string | string[]; } export declare class IPLDConverterService { private baseDirectory?; private pinataService?; private cidCalculatorService; private canonicalizerService; constructor(baseDirectory?: string, pinataService?: PinataService, cidCalculatorService?: CidCalculatorService, canonicalizerService?: IPLDCanonicalizerService | JsonCanonicalizerService); /** * Convert data with file path links to IPLD DAG-JSON format * Uploads referenced files to IPFS and replaces paths with CIDs * @param data The data to convert * @param currentFilePath Optional path of the file containing this data (for relative path resolution) * @param schema Optional schema information for format-aware processing */ convertToIPLD(data: any, currentFilePath?: string, schema?: any): Promise; /** * Recursively process data to convert file paths to IPFS CIDs */ private processDataForIPLD; /** * Check if a file is an image based on its extension */ private isImageFile; /** * Get MIME type for an image file */ private getImageMimeType; /** * Upload a file to IPFS and return its CID * Uses CID v1 with appropriate codec based on file type * @param filePath The file path to upload * @param currentFilePath Optional path of the file containing the reference (for relative path resolution) * @param linkedCIDs Array to collect all linked CIDs found during processing * @param isIpfsUriFormat Whether the schema indicates format: ipfs_uri (for images) */ private uploadFileAndGetCID; /** * Encode data as DAG-JSON */ encodeAsDAGJSON(data: any): Uint8Array; /** * Decode DAG-JSON data */ decodeDAGJSON(bytes: Uint8Array): any; /** * Encode data as DAG-CBOR (more efficient binary format) */ encodeAsDAGCBOR(data: any): Uint8Array; /** * Calculate CID for DAG-CBOR encoded data */ calculateDAGCBORCid(data: any): Promise; /** * Calculate CID v1 for DAG-JSON encoded data * This returns the proper CID format for DAG-JSON * Note: Currently not used for uploads due to Pinata compatibility */ calculateDAGJSONCid(data: any): Promise; /** * Check if data contains any IPLD links */ hasIPLDLinks(data: any, schema?: any, fieldName?: string): boolean; /** * Helper to check if a string is a valid CID */ private isValidCID; } //# sourceMappingURL=ipld-converter.service.d.ts.map