UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

90 lines 4.93 kB
import { DataToExport, ExportData, ExportedFile, FileGenerator, MergedExportDetails, SeriesExportParams } from '../../datapoints-export-selector.model'; import { UtilsService } from './utils.service'; import * as i0 from "@angular/core"; export declare class DataProcessingService { private fileGenerators; private utils; mergeMapping: {}; fileTypesConfigs: { [key: string]: { extension: string; mimeType: string; acceptType: string; }; }; constructor(fileGenerators: FileGenerator[], utils: UtilsService); setGenerators(fileGenerators: FileGenerator[]): void; /** * Transforms the data into a structured format for an export. * * @param dataToExport - An array of processed measurement data combined with the respective properties of the datapoint. * @returns Provides a two-dimensional array of ExportData, * where each inner array contains ExportData entries representing the transformed measurements and metadata of each datapoint. */ transformToExportFileStructure(dataToExport: DataToExport[]): ExportData[][]; /** * Transforms the input datapoints with values into a structured format for a preview. * * @param dataToExport - An array of processed measurement data combined with the respective properties of the datapoint. * @returns Provides an array of up to 5 ExportData elements (no more is needed for a preview) or an empty array, */ transformToExportFileStructureForPreview(dataToExport: DataToExport[]): ExportData[]; /** * Processes a single dataToExport and transforms it into an array of ExportData. * * Used further for creating series data based export and also for measurements and series data based preview. * Series data provides min and max values for each timestamp. * * @param dataToExport - A processed measurement or series data combined with the respective properties of the datapoint to be precessed * @returns An array of ExportData representing the processed datapoint, * that can be used as a row data in the exported files or for preview. */ processDataToExport(dataToExport: DataToExport): ExportData[]; createExportData(dataToExport: DataToExport, time: string, isMeasurement: boolean, value: number, valueMax?: number): ExportData; /** * Exports the given data to merged CSV or Excel files. * * @param exportData - An array containing ExportData objects that will be used as parts of the merged file. * @param fileType - Indicates the type of the file to be exported. * @param mergedExportDetails - An object containing the date range from which the export was created and aggregation type. * @returns An objects containing file name and its respective content as Blob. * * Example of exported merged file structure: * date from date to * 2024-04-15T12:14:00.000Z 2024-07-16T14:14:28+02:00 * time G6Fit -> c8y_Acceleration.accelerationX [G] G6Fit -> c8y_Acceleration.accelerationY [G] * 2024-05-13T13:45:10.500+02:00 0.0109026359624273 0.789461628278069 * * Example of exported file name format: * 04dec231240-06dec232350.xlsx */ exportSeriesDataToMergedFiles(exportData: ExportData[], fileType: string, mergedExportDetails: MergedExportDetails): Promise<ExportedFile>; /** * Zips all created files. * * @param files - An array of objects containing file names and their respective content as Blobs. * @returns A Promise that resolves to a Blob representing the generated zip file. */ zipFiles(files: ExportedFile[]): Promise<Blob>; /** * Exports the given data to CSV or Excel files. * * @param params - An object containing all the necessary parameters for the export and zip process. * @returns A Promise that resolves to a Blob representing the exported file. */ exportSeriesData(params: SeriesExportParams): Promise<Blob>; createFileName(source: string | number, fragmentSeries: string, fileExtension: string): string; /** * Generates a zip blob using the provided zip object. * * @param zip - The zip object used for generating the blob. * @param compressionType - The compression type for the zip file. 'STORE' is no compression, 'DEFLATE' is compression. * @param compressionLevel - The compression level for the zip file. * Level 1 is quickest, 9 is best compressed. * @returns A Promise that resolves to a Blob containing the generated zip file. */ private generateZipBlob; static ɵfac: i0.ɵɵFactoryDeclaration<DataProcessingService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<DataProcessingService>; } //# sourceMappingURL=data-processing.service.d.ts.map