-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Have ExtensionBasedMapper handle extensions correctly
- Loading branch information
Showing
5 changed files
with
382 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
import type { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier'; | ||
|
||
export interface ResourceLink { | ||
/** | ||
* Identifier of a resource. | ||
*/ | ||
identifier: ResourceIdentifier; | ||
/** | ||
* File path of a resource. | ||
*/ | ||
filePath: string; | ||
/** | ||
* Content-type for a data resource (not defined for containers). | ||
*/ | ||
contentType?: string; | ||
} | ||
|
||
/** | ||
* Supports mapping a file to an URL and back. | ||
*/ | ||
export interface FileIdentifierMapper { | ||
/** | ||
* Maps the given file path to an URL. | ||
* @param file - The input file path. | ||
* 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. | ||
* | ||
* @returns The URL as a string. | ||
* @returns A ResourceLink with all the necessary metadata. | ||
*/ | ||
mapFilePathToUrl: (filePath: string) => string; | ||
mapFilePathToUrl: (filePath: string, isContainer: boolean) => Promise<ResourceLink>; | ||
/** | ||
* Maps the given resource identifier / URL to a file path. | ||
* @param url - The input URL. | ||
* Determines the content-type if no content-type was provided. | ||
* For containers the content-type input gets ignored. | ||
* @param identifier - The input identifier. | ||
* @param contentType - The (optional) content-type of the resource. | ||
* | ||
* @returns The file path as a string. | ||
* @returns A ResourceLink with all the necessary metadata. | ||
*/ | ||
mapUrlToFilePath: (identifier: ResourceIdentifier) => string; | ||
mapUrlToFilePath: (identifier: ResourceIdentifier, contentType?: string) => Promise<ResourceLink>; | ||
} |
Oops, something went wrong.