import { Semaphore } from "./semaphore.mjs"; import { IncompletePartInfo, TusUploadMetadata } from "../../../types/index.mjs"; import { S3MetadataManager } from "./metadataManager.mjs"; import { S3FileOperations } from "./fileOperations.mjs"; import stream, { Readable } from "node:stream"; import AWS, { S3 } from "@aws-sdk/client-s3"; import fs from "node:fs"; //#region src/tus/stores/s3/partsManager.d.ts type RetrievePartsArgs = { id: string; partNumberMarker?: string; }; type FinishMultipartUploadArgs = { metadata: TusUploadMetadata; parts: Array; }; type GetIncompletePartArgs = { id: string; }; type GetIncompletePartSizeArgs = { id: string; }; type DeleteIncompletePartArgs = { id: string; }; type DownloadIncompletePartArgs = { id: string; }; type UploadIncompletePartArgs = { id: string; readStream: fs.ReadStream | Readable; }; type UploadPartArgs = { metadata: TusUploadMetadata; readStream: fs.ReadStream | Readable; partNumber: number; }; type UploadPartsArgs = { metadata: TusUploadMetadata; readStream: stream.Readable; currentPartNumber: number; offset: number; }; declare class S3PartsManager { private client; private bucket; private minPartSize; private partUploadSemaphore; private metadataManager; private fileOperations; private generateCompleteTag; constructor(client: S3, bucket: string, minPartSize: number, partUploadSemaphore: Semaphore, metadataManager: S3MetadataManager, fileOperations: S3FileOperations, generateCompleteTag: (value: 'false' | 'true') => string | undefined); /** * Gets the number of complete parts/chunks already uploaded to S3. * Retrieves only consecutive parts. * @param args - The function arguments * @param args.id - The upload ID * @param args.partNumberMarker - Marker for pagination (optional) * @returns Promise that resolves to array of uploaded parts */ retrieveParts(args: RetrievePartsArgs): Promise>; /** * Completes a multipart upload on S3. * This is where S3 concatenates all the uploaded parts. * @param args - The function arguments * @param args.metadata - The upload metadata * @param args.parts - Array of uploaded parts to complete * @returns Promise that resolves to the location URL (optional) */ finishMultipartUpload(args: FinishMultipartUploadArgs): Promise; /** * Gets incomplete part from S3 * @param args - The function arguments * @param args.id - The upload ID * @returns Promise that resolves to readable stream or undefined if not found */ getIncompletePart(args: GetIncompletePartArgs): Promise; /** * Gets the size of an incomplete part * @param args - The function arguments * @param args.id - The upload ID * @returns Promise that resolves to part size or undefined if not found */ getIncompletePartSize(args: GetIncompletePartSizeArgs): Promise; /** * Deletes an incomplete part * @param args - The function arguments * @param args.id - The upload ID * @returns Promise that resolves when deletion is complete */ deleteIncompletePart(args: DeleteIncompletePartArgs): Promise; /** * Downloads incomplete part to temporary file * @param args - The function arguments * @param args.id - The upload ID * @returns Promise that resolves to incomplete part info or undefined if not found */ downloadIncompletePart(args: DownloadIncompletePartArgs): Promise; /** * Uploads an incomplete part * @param args - The function arguments * @param args.id - The upload ID * @param args.readStream - The stream to read data from * @returns Promise that resolves to the ETag of the uploaded part */ uploadIncompletePart(args: UploadIncompletePartArgs): Promise; /** * Uploads a single part * @param args - The function arguments * @param args.metadata - The upload metadata * @param args.readStream - The stream to read data from * @param args.partNumber - The part number to upload * @returns Promise that resolves to the ETag of the uploaded part */ uploadPart(args: UploadPartArgs): Promise; /** * Uploads a stream to s3 using multiple parts * @param args - The function arguments * @param args.metadata - The upload metadata * @param args.readStream - The stream to read data from * @param args.currentPartNumber - The current part number to start from * @param args.offset - The byte offset to start from * @returns Promise that resolves to the number of bytes uploaded */ uploadParts(args: UploadPartsArgs): Promise; } //#endregion export { S3PartsManager }; //# sourceMappingURL=partsManager.d.mts.map