A stream that is guarded from emitting errors when there are no listeners. If an error occurs while no listener is attached, it will store the error and emit it once a listener is added (or a timeout occurs).
An incoming HTTP request;
An outgoing HTTP response;
Different log levels, from most important to least important.
A data interface indicating which permissions are required (based on the context).
A single entry of a ValuePreferences object. Useful when doing operations on such an object.
Represents preferred values along a single content negotiation dimension.
The number represents how preferred this value is from 0 to 1. Follows the quality values rule from RFC 7231: "The weight is normalized to a real number in the range 0 through 1, where 0.001 is the least preferred and 1 is the most preferred; a value of 0 means "not acceptable"."
A placeholder for the path to the @solid/community-server
module root.
The resolveAssetPath
function will replace this string with the actual path.
Resolves a path to its absolute form. Absolute inputs will not be changed (except changing Windows to POSIX). Relative inputs will be interpreted relative to process.cwd().
Path to check (POSIX or Windows).
The potentially changed path (POSIX).
Generates resources with the given generator and adds them to the given store.
Identifier of the pod.
Settings from which the pod is being created.
Generator to be used.
Store to be updated.
The amount of resources that were added.
Adds a header value without overriding previous values.
Helper function to generate type quads for a Container or Resource.
Metadata to add to.
If the identifier corresponds to a container.
The generated quads.
Links a template file with a given content-type to the metadata using the SOLID_META.template predicate.
Metadata to update.
Path to the template.
Content-type of the template after it is rendered.
Obtains the values of all fulfilled promises.
If there are rejections (and ignoreErrors
is false), throws a combined error of all rejected promises.
Asserts that the input is a native error. If not the input will be re-thrown.
Asserts that password
is a string that matches confirmPassword
.
Will throw an Error otherwise.
Password to assert.
Confirmation of password to match.
Cleans incoming preferences to prevent unwanted behaviour. Makes sure internal types have weight 0, unless specifically requested in the preferences, and interprets empty preferences as accepting everything.
Preferences that need to be updated.
A copy of the the preferences with the necessary updates.
Helper function to clone a representation, the original representation can still be used. This function loads the entire stream in memory.
The representation to clone.
The cloned representation.
Combines a list of errors into a single HttpErrors. Status code depends on the input errors. If they all share the same status code that code will be re-used. If they are all within the 4xx range, 400 will be used, otherwise 500.
Errors to combine.
Prefix for the aggregate error message. Will be followed with an array of all the messages.
Creates a function that expands local names from the given base URI, and exports the given local names as properties on the returned object.
Creates a regular expression that matches URLs containing the given baseUrl, or a subdomain of the given baseUrl. In case there is a subdomain, the first match of the regular expression will be that subdomain.
Examples with baseUrl http://test.com/foo/
:
http://test.com/foo/
http://test.com/foo/bar/baz
http://alice.bob.test.com/foo/bar/baz
, first match result will be alice.bob
http://test.com/
http://alicetest.com/foo/
Base URL for the regular expression.
Creates a function that expands local names from the given base URI into named nodes, and exports the given local names as properties on the returned object.
Creates a function that expands local names from the given base URI into string,
and exports the given local names as properties on the returned object.
Under the terms
property, it exposes the expanded local names as named nodes.
Creates a function that expands local names from the given base URI into strings, and exports the given local names as properties on the returned object.
Decodes all components of a URI path.
Encodes all (non-slash) special characters in a URI path.
Makes sure the input path has exactly 1 slash at the end. Multiple slashes will get merged into one. If there is no slash it will be added.
Path to check.
The potentially changed path.
Splits a URL (or similar) string into a part containing its scheme and one containing the rest.
E.g., http://test.com/
results in { scheme: 'http://', rest: 'test.com/' }
.
String to parse.
Fetches an RDF dataset from the given URL.
Response will be a Representation with content-type internal/quads.
Filters a list of handlers to only keep those that can handle the input. Will error if no matching handlers are found.
Handlers to filter.
Input that needs to be supported.
Finds a handler that can handle the given input data. Otherwise an error gets thrown.
List of handlers to search in.
The input data.
A promise resolving to a handler that supports the data or otherwise rejecting.
Finds the type from the given types that has the best match with the given preferences, based on the calculated weight.
Types for which we want to find the best match.
Preferences to match the types against.
A ValuePreference containing the best match and the corresponding weight. Undefined if there is no match.
For a media type converter that can generate the given types, this function tries to find the type that best matches the given preferences.
This function combines several other conversion utility functions to determine what output a converter should generate: it cleans the preferences with cleanPreferences to support empty preferences and to prevent the accidental generation of internal types, after which the best match gets found based on the weights.
Media types that can be converted to.
Preferences for output type.
The best match. Undefined if there is no match.
Generates an ETag based on the last modified date of a resource.
Metadata of the resource.
the generated ETag. Undefined if no last modified date was found.
Extracts the extension (without dot) from a path.
Custom function since path.extname
does not work on all cases (e.g. ".acl")
Input path to parse.
Gets a logger instance for the given class instance.
The returned type of logger depends on the configured LoggerFactory in {@link Setup}.
The following shows a typical pattern on how to create loggers:
class MyClass {
protected readonly logger = getLoggerFor(this);
}
If no class is applicable, a logger can also be created as follows:
const logger = getLoggerFor('MyFunction');
A class instance or a class string name.
Returns the folder corresponding to the root of the Community Solid Server module
Creates a relative URL by removing the base URL. Will throw an error in case the resulting target is not withing the base URL scope.
Base URL.
Incoming request of which the target needs to be extracted.
Will extract the target from the request.
Converts the stream to a single object. This assumes the stream is in object mode and only contains a single element, otherwise an error will be thrown.
Object stream with single entry.
Returns the HTTP status code corresponding to the error.
Returns the absolute path to the template. Returns undefined if the input does not contain a file path.
Tries to match the given type to the given preferences. In case there are multiple matches the most specific one will be chosen as per RFC 7231.
Type for which the matching weight is needed.
Preferences to match the type to.
The corresponding weight from the preferences or 0 if there is no match.
Measures the weights for all the given types when matched against the given preferences. Results will be sorted by weight. Weights of 0 indicate that no match is possible.
Types for which we want to calculate the weights.
Preferences to match the types against.
An array with a ValuePreference object for every input type, sorted by calculated weight.
Makes sure that listeners always receive the error event of a stream, even if it was thrown before the listener was attached.
When guarding a stream it is assumed that error listeners already attached should be ignored, only error listeners attached after the stream is guarded will prevent an error from being logged.
If the input is already guarded the guard will be reset, which means ignoring error listeners already attached.
Stream that can potentially throw an error.
The stream.
Checks if the identifier corresponds to a container identifier.
Identifier to check.
Checks if the path corresponds to a container path (ending in a /).
Path to check.
Checks if the input is an {@link Error}.
Determines whether the stream is guarded from emitting errors.
Checks if the given stream is an HttpRequest.
Checks if the given content type is an internal content type such as internal/quads.
Response will be false
if the input type is undefined.
Do not use this for media ranges.
Type to check.
Determines whether the object is a RepresentationMetadata
.
Determines whether the object is a ResourceIdentifier
.
Checks if this is a {@link Term}.
Checks if the given variable is one that is supported. This can be used to weed out irrelevant parameters in an object.
Adds the paths to the base path.
The base path (POSIX or Windows).
Subpaths to attach (POSIX).
The potentially changed path (POSIX).
Concatenates all the given strings into a normalized URL. Will place slashes between input strings if necessary.
Concatenates all the given strings into a normalized URL. Will place slashes between input strings if necessary.
Checks if the given type matches the given preferences.
Type to match.
Preferences to match against.
Checks if the given two media types/ranges match each other. Takes wildcards into account.
Media type to match.
Media type to match.
True if the media type patterns can match each other.
Creates a path starting from the @solid/community-server
module root,
to be resolved by the resolveAssetPath
function.
Resolves relative segments in the path.
Path to check (POSIX or Windows).
The potentially changed path (POSIX).
Parses an Accept-Charset header string.
The Accept-Charset header string.
An array of AcceptCharset objects, sorted by weight.
Parses an Accept-DateTime header string.
The Accept-DateTime header string.
An array with a single AcceptDatetime object.
Parses an Accept-Encoding header string.
The Accept-Encoding header string.
An array of AcceptEncoding objects, sorted by weight.
Parses an Accept-Language header string.
The Accept-Language header string.
An array of AcceptLanguage objects, sorted by weight.
Parses the Content-Type header.
The media type of the content-type header
The parsed media type of the content-type
Parses a Forwarded header value and will fall back to X-Forwarded-* headers.
The incoming HTTP headers.
The parsed Forwarded header.
Parses a list of split parameters and checks their validity.
A list of split parameters (token [ "=" ( token / quoted-string ) ])
The double quoted strings that need to be replaced.
An array of name/value objects corresponding to the parameters.
Helper function to convert a Readable into an array of quads.
The readable object.
Options for the parser.
A promise containing the array of quads.
Pipes one stream into another and emits errors of the first stream with the second. In case of an error in the first stream the second one will be destroyed with the given error. This will also make the stream Guarded.
Initial readable stream.
The destination for writing data.
Optional function that takes the error and converts it to a new error.
The destination stream.
Serializes a preferences object to a string for display purposes.
Preferences to serialize
A function that simulates the Array.some behaviour but on an array of Promises. Returns true if at least one promise returns true. Returns false if all promises return false or error.
Interprets the stream as JSON and converts it to a Dict.
Stream of JSON data.
The parsed object.
Reads the template and returns it as a string.
Imports quads from a stream into a Store.
Stream of quads.
A Store containing all the quads.
Joins all strings of a stream.
Stream of strings.
The joined string.
Resets the global logger factory to undefined.
This typically only needs to be called during testing. Call this at your own risk.
Converts file path inputs into absolute paths.
Works similar to absoluteFilePath
but paths that start with the modulePathPlaceholder
will be relative to the module directory instead of the cwd.
Creates an absolute path starting from the @solid/community-server
module root.
Converts a given Response (from a request that was already made) to an RDF dataset. In case the given Response object was already parsed its body can be passed along as a string.
The converter will be used to convert the response body to RDF.
Response will be a Representation with content-type internal/quads.
Helper function for serializing an array of quads, with as result a Readable object.
The array of quads.
The content-type to serialize to.
The Readable object.
Sets the global logger factory. This will cause all loggers created by getLoggerFor to be delegated to a logger from the given factory.
A logger factory.
Splits the input string on commas, trims all parts and filters out empty ones.
Input header string.
Converts the incoming name (URI or shorthand) to a named node. The generated terms get cached to reduce the number of created nodes, so only use this for internal constants!
Predicate to potentially transform.
Converts a URI path to the canonical version by splitting on slashes, decoding any percent-based encodings, and then encoding any special characters.
Creates a literal by first converting the dataType string to a named node.
Object value.
Object data type (as string).
Converts a string to a named node when needed.
Subject to potentially transform.
Converts an object term when needed.
Object to potentially transform.
Whether strings are converted to literals or named nodes.
Replaces all double quoted strings in the input string with "0"
, "1"
, etc.
The Accept header string.
The transformed string and a map with keys "0"
, etc. and values the original string that was there.
Transforms a stream, ensuring that all errors are forwarded.
The stream to be transformed
The transformation options
The transformed stream
Makes sure the input path has no slashes at the end.
Path to check.
The potentially changed path.
Filter out duplicate quads from an array.
Quads to filter.
A new array containing the unique quads.
Updates the dc:modified time to the given time.
Metadata to update.
Last modified date. Defaults to current time.
A combination of multiple credentials, where their group is specified by the key.