import { Semaphore } from "./semaphore.mjs"; import { S3StoreConfig } from "../../../types/index.mjs"; import { S3MetadataManager } from "./metadataManager.mjs"; import { S3ExpirationManager } from "./expirationManager.mjs"; import { S3FileOperations } from "./fileOperations.mjs"; import { S3PartsManager } from "./partsManager.mjs"; import stream, { Readable } from "node:stream"; import { S3 } from "@aws-sdk/client-s3"; import { DataStore, Upload } from "@tus/utils"; //#region src/tus/stores/s3/s3Store.d.ts declare class S3Store extends DataStore { client: S3; bucket: string; partSize: number; minPartSize: number; maxMultipartParts: number; maxUploadSize: 5497558138880; useTags: boolean; expirationPeriodInMilliseconds: number; protected acl?: string; protected partUploadSemaphore: Semaphore; protected metadataManager: S3MetadataManager; protected fileOperations: S3FileOperations; protected partsManager: S3PartsManager; protected expirationManager: S3ExpirationManager; protected customEndpoint: string; constructor(options: S3StoreConfig); /** * Helper method to check if expiration tags should be used * @returns True if expiration tags should be used */ protected shouldUseExpirationTags(): boolean; /** * Generates a tag for marking complete/incomplete uploads * @param value - Either 'false' or 'true' to mark completion status * @returns The tag string or undefined if tags shouldn’t be used */ protected generateCompleteTag(value: 'false' | 'true'): string | undefined; /** * Creates a multipart upload on S3 attaching any metadata to it. * Also, a `${file_id}.info` file is created which holds some information * about the upload itself like: `upload-id`, `upload-length`, etc. * @param upload - The upload object to create * @return Promise that resolves to the created upload object with storage information */ create(upload: Upload): Promise; /** * Writes `buffer` to the file specified by the upload’s `id` at `offset` * @param readable - The readable stream to write * @param id - The upload ID * @param offset - The byte offset to write at * @return Promise that resolves to the new offset after writing the data */ write(readable: stream.Readable, id: string, offset: number): Promise; /** * Returns the current state of the upload, i.e how much data has been * uploaded and if the upload is complete. * @param id - The upload ID to retrieve * @returns Promise that resolves to the upload object with current offset and storage information */ getUpload(id: string): Promise; /** * Reads the file specified by the upload’s `id` and returns a readable stream * @param id - The upload ID to read * @returns Promise that resolves to a readable stream of the file's contents */ read(id: string): Promise; /** * * Moves the file specified by its `oldKey` to `newKey`. * @param oldKey - The current S3 key of the file to be moved * @param newKey - The new S3 key to move the file to * @return Promise that resolves when the file has been successfully moved, or rejects with an error if the move operation fails */ copy(oldKey: string, newKey: string): Promise; /** * Removes files specified by the upload’s `id` * @param id - The upload ID to remove * @returns Promise that resolves when the file and its metadata have been removed */ remove(id: string): Promise; /** * Removes the .info file specified by the upload’s `id` * @param id - The upload ID to clean up * @returns Promise that resolves when the metadata file has been removed */ cleanup(id: string): Promise; /** * Combine all multipart uploads into a single object * @param id - The upload ID to complete * @returns Promise that resolves to the completed upload object with storage information */ completeMultipartUpload(id: string): Promise; /** * Get the full S3 URL for an uploaded file * @param id - The upload ID to get the URL for * @returns The full URL to access the uploaded file on S3 */ getUrl(id: string): string; /** * Deletes expired incomplete uploads. * Returns the number of deleted uploads. * @returns Promise that resolves to the number of deleted uploads */ deleteExpired(): Promise; /** * Returns the expiration period in milliseconds * @return The expiration period in milliseconds */ getExpiration(): number; } //#endregion export { S3Store }; //# sourceMappingURL=s3Store.d.mts.map