mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Enable jsdoc/tag-lines and jsdoc/sort-tags rules
This commit is contained in:
@@ -376,6 +376,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
*
|
||||
* First the identifier gets requested and if no result is found
|
||||
* the identifier with differing trailing slash is requested.
|
||||
*
|
||||
* @param identifier - Identifier that needs to be checked.
|
||||
*/
|
||||
protected async getNormalizedMetadata(identifier: ResourceIdentifier): Promise<RepresentationMetadata> {
|
||||
@@ -411,6 +412,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
|
||||
/**
|
||||
* Write the given metadata resource to the DataAccessor.
|
||||
*
|
||||
* @param identifier - Identifier of the metadata.
|
||||
* @param representation - Corresponding Representation.
|
||||
*
|
||||
@@ -451,6 +453,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
/**
|
||||
* Write the given resource to the DataAccessor. Metadata will be updated with necessary triples.
|
||||
* In case of containers `handleContainerData` will be used to verify the data.
|
||||
*
|
||||
* @param identifier - Identifier of the resource.
|
||||
* @param representation - Corresponding Representation.
|
||||
* @param isContainer - Is the incoming resource a container?
|
||||
@@ -576,6 +579,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
/**
|
||||
* Validates if the slug and headers are valid.
|
||||
* Errors if slug exists, ends on slash, but ContainerType Link header is NOT present
|
||||
*
|
||||
* @param isContainer - Is the slug supposed to represent a container?
|
||||
* @param slug - Is the requested slug (if any).
|
||||
*/
|
||||
@@ -588,6 +592,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
/**
|
||||
* Clean http Slug to be compatible with the server. Makes sure there are no unwanted characters
|
||||
* e.g.: cleanslug('&%26') returns '%26%26'
|
||||
*
|
||||
* @param slug - the slug to clean
|
||||
*/
|
||||
protected cleanSlug(slug: string): string {
|
||||
@@ -633,6 +638,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
/**
|
||||
* Checks if the given metadata represents a (potential) container,
|
||||
* based on the metadata.
|
||||
*
|
||||
* @param metadata - Metadata of the (new) resource.
|
||||
*/
|
||||
protected isContainerType(metadata: RepresentationMetadata): boolean {
|
||||
@@ -687,6 +693,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
/**
|
||||
* Create containers starting from the root until the given identifier corresponds to an existing container.
|
||||
* Will throw errors if the identifier of the last existing "container" corresponds to an existing document.
|
||||
*
|
||||
* @param container - Identifier of the container which will need to exist.
|
||||
*/
|
||||
protected async createRecursiveContainers(container: ResourceIdentifier): Promise<ChangeMap> {
|
||||
@@ -719,6 +726,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
|
||||
/**
|
||||
* Generates activity metadata for a resource and adds it to the {@link ChangeMap}
|
||||
*
|
||||
* @param map - ChangeMap to update.
|
||||
* @param id - Identifier of the resource being changed.
|
||||
* @param activity - Which activity is taking place.
|
||||
@@ -729,6 +737,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
|
||||
/**
|
||||
* Generates activity metadata specifically for Add/Remove events on a container.
|
||||
*
|
||||
* @param map - ChangeMap to update.
|
||||
* @param id - Identifier of the container.
|
||||
* @param add - If there is a resource being added (`true`) or removed (`false`).
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { ResourceIdentifier } from '../http/representation/ResourceIdentifi
|
||||
export interface ResourceSet {
|
||||
/**
|
||||
* Check if a resource exists in this ResourceSet.
|
||||
*
|
||||
* @param identifier - Identifier of resource to check.
|
||||
*
|
||||
* @returns A promise resolving if the resource already exists.
|
||||
|
||||
@@ -28,6 +28,7 @@ export type ChangeMap = IdentifierMap<RepresentationMetadata>;
|
||||
export interface ResourceStore extends ResourceSet {
|
||||
/**
|
||||
* Retrieves a representation of a resource.
|
||||
*
|
||||
* @param identifier - Identifier of the resource to read.
|
||||
* @param preferences - Preferences indicating desired representations.
|
||||
* @param conditions - Optional conditions under which to proceed.
|
||||
@@ -43,6 +44,7 @@ export interface ResourceStore extends ResourceSet {
|
||||
/**
|
||||
* Sets or replaces the representation of a resource,
|
||||
* creating a new resource and intermediary containers as needed.
|
||||
*
|
||||
* @param identifier - Identifier of resource to update.
|
||||
* @param representation - New representation of the resource.
|
||||
* @param conditions - Optional conditions under which to proceed.
|
||||
@@ -57,6 +59,7 @@ export interface ResourceStore extends ResourceSet {
|
||||
|
||||
/**
|
||||
* Creates a new resource in the container.
|
||||
*
|
||||
* @param container - Container in which to create a resource.
|
||||
* @param representation - Representation of the new resource
|
||||
* @param conditions - Optional conditions under which to proceed.
|
||||
@@ -71,6 +74,7 @@ export interface ResourceStore extends ResourceSet {
|
||||
|
||||
/**
|
||||
* Deletes a resource.
|
||||
*
|
||||
* @param identifier - Identifier of resource to delete.
|
||||
* @param conditions - Optional conditions under which to proceed.
|
||||
*
|
||||
@@ -84,6 +88,7 @@ export interface ResourceStore extends ResourceSet {
|
||||
/**
|
||||
* Sets or updates the representation of a resource,
|
||||
* creating a new resource and intermediary containers as needed.
|
||||
*
|
||||
* @param identifier - Identifier of resource to update.
|
||||
* @param patch - Description of which parts to update.
|
||||
* @param conditions - Optional conditions under which to proceed.
|
||||
|
||||
@@ -16,6 +16,7 @@ import type { Guarded } from '../../util/GuardedStream';
|
||||
export interface DataAccessor {
|
||||
/**
|
||||
* Should throw a NotImplementedHttpError if the DataAccessor does not support storing the given Representation.
|
||||
*
|
||||
* @param representation - Incoming Representation.
|
||||
*
|
||||
* @throws BadRequestHttpError
|
||||
@@ -26,6 +27,7 @@ export interface DataAccessor {
|
||||
/**
|
||||
* 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<Guarded<Readable>>;
|
||||
@@ -56,6 +58,7 @@ export interface DataAccessor {
|
||||
/**
|
||||
* 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.
|
||||
@@ -67,6 +70,7 @@ export interface DataAccessor {
|
||||
* 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.
|
||||
*/
|
||||
@@ -75,6 +79,7 @@ export interface DataAccessor {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -139,6 +139,7 @@ export class FileDataAccessor implements DataAccessor {
|
||||
/**
|
||||
* Gets the Stats object corresponding to the given file path,
|
||||
* resolving symbolic links.
|
||||
*
|
||||
* @param path - File path to get info from.
|
||||
*
|
||||
* @throws NotFoundHttpError
|
||||
@@ -188,6 +189,7 @@ export class FileDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Writes the metadata of the resource to a meta file.
|
||||
*
|
||||
* @param link - Path related metadata of the resource.
|
||||
* @param metadata - Metadata to write.
|
||||
*
|
||||
@@ -226,6 +228,7 @@ export class FileDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -319,6 +322,7 @@ export class FileDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@@ -351,6 +355,7 @@ export class FileDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Helper function without extra validation checking to create a data file.
|
||||
*
|
||||
* @param path - The filepath of the file to be created.
|
||||
* @param data - The data to be put in the file.
|
||||
*/
|
||||
|
||||
@@ -174,6 +174,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Creates the name for the metadata of a resource.
|
||||
*
|
||||
* @param name - Name of the (non-metadata) resource.
|
||||
*/
|
||||
private getMetadataNode(name: NamedNode): NamedNode {
|
||||
@@ -189,6 +190,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Creates a CONSTRUCT query that returns all quads contained within a single resource.
|
||||
*
|
||||
* @param name - Name of the resource to query.
|
||||
*/
|
||||
private sparqlConstruct(name: NamedNode): ConstructQuery {
|
||||
@@ -213,6 +215,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
/**
|
||||
* Creates an update query that overwrites the data and metadata of a resource.
|
||||
* If there are no triples we assume it's a container (so don't overwrite the main graph with containment triples).
|
||||
*
|
||||
* @param name - Name of the resource to update.
|
||||
* @param metadata - New metadata of the resource.
|
||||
* @param parent - Name of the parent to update the containment triples.
|
||||
@@ -255,6 +258,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Creates an update query that overwrites metadata of a resource.
|
||||
*
|
||||
* @param metaName - Name of the metadata resource to update.
|
||||
* @param metadata - New metadata of the resource.
|
||||
*/
|
||||
@@ -280,6 +284,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Creates a query that deletes everything related to the given name.
|
||||
*
|
||||
* @param name - Name of resource to delete.
|
||||
* @param parent - Parent of the resource to delete so the containment triple can be removed (unless root).
|
||||
*/
|
||||
@@ -306,6 +311,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
/**
|
||||
* Helper function for creating SPARQL update queries.
|
||||
* Creates an operation for deleting all triples in a graph.
|
||||
*
|
||||
* @param name - Name of the graph to delete.
|
||||
*/
|
||||
private sparqlUpdateDeleteAll(name: NamedNode): InsertDeleteOperation {
|
||||
@@ -318,6 +324,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
/**
|
||||
* Helper function for creating SPARQL update queries.
|
||||
* Creates a Graph selector with the given triples.
|
||||
*
|
||||
* @param name - Name of the graph.
|
||||
* @param triples - Triples/triple patterns to select.
|
||||
*/
|
||||
@@ -327,6 +334,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Sends a SPARQL CONSTRUCT query to the endpoint and returns a stream of quads.
|
||||
*
|
||||
* @param sparqlQuery - Query to execute.
|
||||
*/
|
||||
private async sendSparqlConstruct(sparqlQuery: ConstructQuery): Promise<Guarded<Readable>> {
|
||||
@@ -342,6 +350,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
|
||||
/**
|
||||
* Sends a SPARQL update query to the stored endpoint.
|
||||
*
|
||||
* @param sparqlQuery - Query to send.
|
||||
*/
|
||||
private async sendSparqlUpdate(sparqlQuery: Update): Promise<void> {
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface Conditions {
|
||||
|
||||
/**
|
||||
* Checks validity based on the given metadata.
|
||||
*
|
||||
* @param metadata - Metadata of the representation. Undefined if the resource does not exist.
|
||||
* @param strict - How to compare the ETag related headers.
|
||||
* If true, the comparison will happen on representation level.
|
||||
|
||||
@@ -26,6 +26,7 @@ export interface ETagHandler {
|
||||
/**
|
||||
* Validates whether 2 ETags correspond to the same state of a resource,
|
||||
* independent of the representation the ETags correspond to.
|
||||
*
|
||||
* @param eTag1 - First ETag to compare.
|
||||
* @param eTag2 - Second ETag to compare.
|
||||
*/
|
||||
|
||||
@@ -164,6 +164,7 @@ export function matchesMediaPreferences(type: string, preferred?: ValuePreferenc
|
||||
/**
|
||||
* Checks if the given two media types/ranges match each other.
|
||||
* Takes wildcards into account.
|
||||
*
|
||||
* @param mediaA - Media type to match.
|
||||
* @param mediaB - Media type to match.
|
||||
*
|
||||
@@ -202,6 +203,7 @@ export function isInternalContentType(contentType?: string): boolean {
|
||||
|
||||
/**
|
||||
* Serializes a preferences object to a string for display purposes.
|
||||
*
|
||||
* @param preferences - Preferences to serialize
|
||||
*/
|
||||
export function preferencesToString(preferences: ValuePreferences): string {
|
||||
|
||||
@@ -61,6 +61,7 @@ export class JsonFileStorage implements KeyValueStorage<string, unknown> {
|
||||
|
||||
/**
|
||||
* Updates the data in the JSON file while using a write lock.
|
||||
*
|
||||
* @param updateFn - A function that updates the JSON object.
|
||||
*
|
||||
* @returns The return value of `updateFn`.
|
||||
|
||||
@@ -6,18 +6,21 @@ export interface KeyValueStorage<TKey, TValue> {
|
||||
/**
|
||||
* Returns the value stored for the given identifier.
|
||||
* `undefined` if no value is stored.
|
||||
*
|
||||
* @param identifier - Identifier to get the value for.
|
||||
*/
|
||||
get: (key: TKey) => Promise<TValue | undefined>;
|
||||
|
||||
/**
|
||||
* Checks if there is a value stored for the given key.
|
||||
*
|
||||
* @param identifier - Identifier to check.
|
||||
*/
|
||||
has: (key: TKey) => Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Sets the value for the given key.
|
||||
*
|
||||
* @param key - Key to set/update.
|
||||
* @param value - Value to store.
|
||||
*
|
||||
@@ -27,6 +30,7 @@ export interface KeyValueStorage<TKey, TValue> {
|
||||
|
||||
/**
|
||||
* Deletes the value stored for the given key.
|
||||
*
|
||||
* @param key - Key to delete.
|
||||
*
|
||||
* @returns If there was a value to delete.
|
||||
|
||||
@@ -36,6 +36,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
* Maps the given resource identifier / URL to a file path.
|
||||
* Determines the content type if none was provided.
|
||||
* For containers the content-type input is ignored.
|
||||
*
|
||||
* @param identifier - The input identifier.
|
||||
* @param isMetadata - If we need the data or metadata file path.
|
||||
* @param contentType - The content-type provided with the request.
|
||||
@@ -59,6 +60,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
/**
|
||||
* Maps the given container identifier to a file path,
|
||||
* possibly making alterations to the direct translation.
|
||||
*
|
||||
* @param identifier - The input identifier.
|
||||
* @param filePath - The direct translation of the identifier onto the file path.
|
||||
*
|
||||
@@ -74,6 +76,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
* possibly making alterations to the direct translation
|
||||
* (for instance, based on its content type)).
|
||||
* Determines the content type if none was provided.
|
||||
*
|
||||
* @param identifier - The input identifier.
|
||||
* @param filePath - The direct translation of the identifier onto the file path.
|
||||
* @param contentType - The content-type provided with the request.
|
||||
@@ -92,6 +95,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Determines the content type from the document identifier.
|
||||
*
|
||||
* @param identifier - The input identifier.
|
||||
* @param contentType - The content-type provided with the request.
|
||||
*
|
||||
@@ -103,6 +107,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Maps the given file path to a URL and determines its content type.
|
||||
*
|
||||
* @param filePath - The input file path.
|
||||
* @param isContainer - If the path corresponds to a file.
|
||||
*
|
||||
@@ -134,6 +139,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Maps the given container path to a URL and determines its content type.
|
||||
*
|
||||
* @param relative - The relative container path.
|
||||
*
|
||||
* @returns A ResourceLink with all the necessary metadata.
|
||||
@@ -144,6 +150,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Maps the given document path to a URL and determines its content type.
|
||||
*
|
||||
* @param relative - The relative document path.
|
||||
*
|
||||
* @returns A ResourceLink with all the necessary metadata.
|
||||
@@ -154,6 +161,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Determines the content type from the relative path.
|
||||
*
|
||||
* @param filePath - The file path of the document.
|
||||
*
|
||||
* @returns The content type of the document.
|
||||
@@ -165,6 +173,7 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Get the absolute file path based on the rootFilepath.
|
||||
*
|
||||
* @param path - The relative file path.
|
||||
*
|
||||
* @returns Absolute path of the file.
|
||||
@@ -175,12 +184,13 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
|
||||
/**
|
||||
* Strips the baseRequestURI from the identifier.
|
||||
*
|
||||
* @param identifier - Incoming identifier.
|
||||
*
|
||||
* @returns A string representing the relative path.
|
||||
*
|
||||
* @throws NotFoundHttpError
|
||||
* If the identifier does not match the baseRequestURI.
|
||||
*
|
||||
* @returns A string representing the relative path.
|
||||
*/
|
||||
protected getRelativePath(identifier: ResourceIdentifier): string {
|
||||
if (!identifier.path.startsWith(this.baseRequestURI)) {
|
||||
@@ -193,11 +203,11 @@ export class BaseFileIdentifierMapper implements FileIdentifierMapper {
|
||||
/**
|
||||
* Check if the given relative path is valid.
|
||||
*
|
||||
* @throws BadRequestHttpError
|
||||
* If the relative path is invalid.
|
||||
*
|
||||
* @param path - A relative path, as generated by {@link getRelativePath}.
|
||||
* @param identifier - A resource identifier.
|
||||
*
|
||||
* @throws BadRequestHttpError
|
||||
* If the relative path is invalid.
|
||||
*/
|
||||
protected validateRelativePath(path: string, identifier: ResourceIdentifier): void {
|
||||
if (!path.startsWith('/')) {
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface ResourceLink {
|
||||
export interface FileIdentifierMapper {
|
||||
/**
|
||||
* Maps the given file path to an URL and determines the content-type
|
||||
*
|
||||
* @param filePath - The input file path.
|
||||
* @param isContainer - If the path corresponds to a file.
|
||||
*
|
||||
@@ -36,6 +37,7 @@ export interface FileIdentifierMapper {
|
||||
* Determines the content-type if no content-type was provided by finding the corresponding file.
|
||||
* If there is no corresponding file a file path will be generated.
|
||||
* For containers the content-type input gets ignored.
|
||||
*
|
||||
* @param identifier - The input identifier.
|
||||
* @param isMetadata - If we are mapping the metadata of the resource instead of its data.
|
||||
* @param contentType - The (optional) content-type of the resource.
|
||||
|
||||
@@ -33,6 +33,7 @@ export abstract class QuotaStrategy {
|
||||
* as available space.
|
||||
*
|
||||
* @param identifier - the identifier of the resource of which you want the available space
|
||||
*
|
||||
* @returns the available space and the unit of the space as a Size object
|
||||
*/
|
||||
public async getAvailableSpace(identifier: ResourceIdentifier): Promise<Size> {
|
||||
@@ -57,6 +58,7 @@ export abstract class QuotaStrategy {
|
||||
* Get the currently used/occupied space.
|
||||
*
|
||||
* @param identifier - the identifier that should be used to calculate the total
|
||||
*
|
||||
* @returns a Size object containing the requested value.
|
||||
* If quota is not relevant for this identifier, Size.amount should be Number.MAX_SAFE_INTEGER
|
||||
*/
|
||||
@@ -66,6 +68,7 @@ export abstract class QuotaStrategy {
|
||||
* Get an estimated size of the resource
|
||||
*
|
||||
* @param metadata - the metadata that might include the size
|
||||
*
|
||||
* @returns a Size object containing the estimated size and unit of the resource
|
||||
*/
|
||||
public async estimateSize(metadata: RepresentationMetadata): Promise<Size | undefined> {
|
||||
@@ -79,6 +82,7 @@ export abstract class QuotaStrategy {
|
||||
* Like other Passthrough instances this will simply pass on the chunks, when the quota isn't exceeded.
|
||||
*
|
||||
* @param identifier - the identifier of the resource in question
|
||||
*
|
||||
* @returns a Passthrough instance that errors when quota is exceeded
|
||||
*/
|
||||
public async createQuotaGuard(identifier: ResourceIdentifier): Promise<Guarded<PassThrough>> {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { RouterRule } from './RouterRule';
|
||||
*
|
||||
* Part of the dynamic pod creation.
|
||||
* Uses the identifiers that were added to the routing storage.
|
||||
*
|
||||
* @see {@link TemplatedPodGenerator}, {@link ConfigPodInitializer}, {@link ConfigPodManager}
|
||||
*/
|
||||
export class BaseUrlRouterRule extends RouterRule {
|
||||
|
||||
@@ -49,6 +49,7 @@ export class FileSizeReporter implements SizeReporter<string> {
|
||||
* Get the total size of a resource and its children if present
|
||||
*
|
||||
* @param fileLocation - the resource of which you want the total size of ( on disk )
|
||||
*
|
||||
* @returns a number specifying how many bytes are used by the resource
|
||||
*/
|
||||
private async getTotalSize(fileLocation: string): Promise<number> {
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface SizeReporter<T> {
|
||||
* Get the size of a given resource
|
||||
*
|
||||
* @param identifier - the resource of which you want the size
|
||||
*
|
||||
* @returns The size of the resource as a Size object calculated recursively
|
||||
* if the identifier leads to a container
|
||||
*/
|
||||
@@ -29,6 +30,7 @@ export interface SizeReporter<T> {
|
||||
* Calculate the size of a chunk based on which SizeReporter is being used
|
||||
*
|
||||
* @param chunk - the chunk of which you want the size
|
||||
*
|
||||
* @returns the size of the passed chunk as a number
|
||||
*/
|
||||
calculateChunkSize: (chunk: T) => Promise<number>;
|
||||
@@ -37,6 +39,7 @@ export interface SizeReporter<T> {
|
||||
* Estimate the size of a body / request by looking at its metadata
|
||||
*
|
||||
* @param metadata - the metadata of the resource you want an estimated size of
|
||||
*
|
||||
* @returns the estimated size of the body / request or undefined if no
|
||||
* meaningful estimation can be made
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user