import type { DataAccessor } from '@solid/community-server'; import type { Readable } from 'node:stream'; import { RepresentationMetadata } from '@solid/community-server'; import type { Guarded } from '@solid/community-server'; import type { FileIdentifierMapper, ResourceLink } from '@solid/community-server'; import type { ResourceIdentifier, Representation, MetadataRecord } from '@solid/community-server'; export declare class MinioDataAccessor implements DataAccessor { protected readonly logger: import("global-logger-factory").Logger; protected readonly resourceMapper: FileIdentifierMapper; private readonly client; private readonly bucketName; constructor(resourceMapper: FileIdentifierMapper, accessKey: string, secretKey: string, endpoint: string, bucketName: string); private objectName; private containerObjectName; /** * Should throw a NotImplementedHttpError if the DataAccessor does not support storing the given Representation. * * @param representation - Incoming Representation. * * @throws BadRequestHttpError * If it does not support the incoming data. */ canHandle(representation: Representation): Promise; /** * Returns a data stream stored for the given identifier. * It can be assumed that the incoming identifier will always correspond to a document. * * @param identifier - Identifier for which the data is requested. */ getData(identifier: ResourceIdentifier): Promise>; /** * Generate a presigned GET URL for the given resource. * @param identifier - Resource identifier. * @param expires - URL expiry in seconds (default 3600). */ getPresignedUrl(identifier: ResourceIdentifier, expires?: number): Promise; /** * Returns the metadata corresponding to the identifier. * If possible, it is suggested to add a `posix:size` triple to the metadata indicating the binary size. * This is necessary for range requests. * * @param identifier - Identifier for which the metadata is requested. */ getMetadata(identifier: ResourceIdentifier): Promise; /** * Returns metadata for all resources in the requested container. * This should not be all metadata of those resources (but it can be), * but instead the main metadata you want to show in situations * where all these resources are presented simultaneously. * Generally this would be metadata that is present for all of these resources, * such as resource type or last modified date. * * It can be safely assumed that the incoming identifier will always correspond to a container. * * @param identifier - Identifier of the parent container. */ getChildren(identifier: ResourceIdentifier): AsyncIterableIterator; /** * Writes data and metadata for a document. * If any data and/or metadata exist for the given identifier, it should be overwritten. * * @param identifier - Identifier of the resource. * @param data - Data to store. * @param metadata - Metadata to store. */ writeDocument(identifier: ResourceIdentifier, data: Guarded, metadata: RepresentationMetadata): Promise; /** * Writes metadata for a container. * If the container does not exist yet it should be created, * if it does its metadata should be overwritten, except for the containment triples. * * @param identifier - Identifier of the container. * @param metadata - Metadata to store. */ writeContainer(identifier: ResourceIdentifier, metadata: RepresentationMetadata): Promise; /** * Writes metadata for a resource. * It can safely be assumed that the subject resource already exists. * * @param identifier - Identifier of the subject resource. * @param metadata - Metadata to store. */ writeMetadata(identifier: ResourceIdentifier, metadata: RepresentationMetadata): Promise; /** * Deletes the resource and its corresponding metadata. * * Solid, ยง5.4: "When a contained resource is deleted, the server MUST also remove the corresponding containment * triple, which has the effect of removing the deleted resource from the containing container." * https://solid.github.io/specification/protocol#deleting-resources * * @param identifier - Resource to delete. */ deleteResource(identifier: ResourceIdentifier): Promise; /** * Reads and generates all metadata relevant for the given file, * ingesting it into a RepresentationMetadata object. * * @param link - Path related metadata. * @param stats - Stats object of the corresponding file. */ private getFileMetadata; /** * Reads and generates all metadata relevant for the given directory, * ingesting it into a RepresentationMetadata object. * * @param link - Path related metadata. * @param stats - Stats object of the corresponding directory. */ private getDirectoryMetadata; /** * Generates metadata relevant for any resources stored by this accessor. * * @param link - Path related metadata. * @param stats - Stats objects of the corresponding directory. * @param isContainer - If the path points to a container (directory) or not. */ private getBaseMetadata; /** * Helper function to add file system related metadata. * * @param metadata - metadata object to add to * @param stats - Stats of the file/directory corresponding to the resource. */ private addPosixMetadata; /** * encode the metadata of the resource to string. * * @param link - Path related metadata of the resource. * @param metadata - Metadata to write. * * @returns string of metadata. */ protected encodeMetadata(link: ResourceLink, metadata: RepresentationMetadata): object | null; protected decodeMetadata(link: ResourceLink, metadata: MetadataRecord): RepresentationMetadata; private logDuration; }