Options
All
  • Public
  • Public/Protected
  • All
Menu

Community Solid Server - v2.0.0

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

CredentialSet

CredentialSet: Partial<Record<CredentialGroup, Credential>>

A combination of multiple credentials, where their group is specified by the key.

EmailPasswordData

Expires

Expires<T>: { expires?: string; payload: T }

Type parameters

  • T

Type declaration

  • Optional expires?: string
  • payload: T

Guarded

Guarded<T>: T & Guard

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).

Type parameters

  • T: NodeJS.EventEmitter = NodeJS.EventEmitter

HttpRequest

HttpRequest: Guarded<IncomingMessage>

An incoming HTTP request;

HttpResponse

HttpResponse: ServerResponse

An outgoing HTTP response;

Interaction

Interaction: KoaContextWithOIDC["oidc"]["entities"]["Interaction"]

InteractionHandlerResult

LogLevel

LogLevel: "error" | "warn" | "info" | "verbose" | "debug" | "silly"

Different log levels, from most important to least important.

MetadataGraph

MetadataGraph: NamedNode | BlankNode | DefaultGraph | string

MetadataIdentifier

MetadataIdentifier: ResourceIdentifier | NamedNode | BlankNode

MetadataRecord

MetadataRecord: Record<string, MetadataValue>

MetadataValue

MetadataValue: NamedNode | Literal | string | (NamedNode | Literal | string)[]

Namespace

Namespace<TKey, TValue>: { namespace: TValue } & RecordOf<TKey, TValue>

Type parameters

  • TKey: any[]

  • TValue

PatchHandlerInput

PatchHandlerInput<T>: { identifier: ResourceIdentifier; patch: Patch; source: T }

Type parameters

Type declaration

Permission

Permission: Partial<Record<AccessMode, boolean>>

A data interface indicating which permissions are required (based on the context).

PermissionSet

PermissionSet: Partial<Record<CredentialGroup, Permission>>

Template

TemplateFileName

TemplateFileName: string

TemplatedInteractionResult

TemplatedInteractionResult<T>: T & { templateFiles: Record<string, string> }

Type parameters

ValuePreference

ValuePreference: { value: string; weight: number }

A single entry of a ValuePreferences object. Useful when doing operations on such an object.

Type declaration

  • value: string
  • weight: number

ValuePreferences

ValuePreferences: Record<string, number>

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"."

Variables

ACL

ACL: { namespace: string } & RecordOf<("default" | "accessTo" | "agent" | "agentClass" | "agentGroup" | "AuthenticatedAgent" | "Authorization" | "mode" | "Write" | "Read" | "Append" | "Control")[], string> & { terms: Namespace<("default" | "accessTo" | "agent" | "agentClass" | "agentGroup" | "AuthenticatedAgent" | "Authorization" | "mode" | "Write" | "Read" | "Append" | "Control")[], NamedNode<string>> } = ...

APPLICATION_JSON

APPLICATION_JSON: "application/json" = 'application/json'

APPLICATION_OCTET_STREAM

APPLICATION_OCTET_STREAM: "application/octet-stream" = 'application/octet-stream'

APPLICATION_SPARQL_UPDATE

APPLICATION_SPARQL_UPDATE: "application/sparql-update" = 'application/sparql-update'

APPLICATION_X_WWW_FORM_URLENCODED

APPLICATION_X_WWW_FORM_URLENCODED: "application/x-www-form-urlencoded" = 'application/x-www-form-urlencoded'

AUTH

AUTH: { namespace: string } & RecordOf<("userMode" | "publicMode")[], string> & { terms: Namespace<("userMode" | "publicMode")[], NamedNode<string>> } = ...

CONTENT_TYPE

CONTENT_TYPE: string = ...

CONTENT_TYPE_TERM

CONTENT_TYPE_TERM: NamedNode<string> = ...

DC

DC: { namespace: string } & RecordOf<("description" | "modified" | "title")[], string> & { terms: Namespace<("description" | "modified" | "title")[], NamedNode<string>> } = ...

DEFAULT_CUSTOM_TYPES

DEFAULT_CUSTOM_TYPES: { acl: string; meta: string } = ...

Type declaration

  • acl: string
  • meta: string

FOAF

FOAF: { namespace: string } & RecordOf<"Agent"[], string> & { terms: Namespace<"Agent"[], NamedNode<string>> } = ...

HTTP

HTTP: { namespace: string } & RecordOf<"statusCodeNumber"[], string> & { terms: Namespace<"statusCodeNumber"[], NamedNode<string>> } = ...

INTERNAL_ALL

INTERNAL_ALL: "internal/*" = 'internal/*'

INTERNAL_ERROR

INTERNAL_ERROR: "internal/error" = 'internal/error'

INTERNAL_QUADS

INTERNAL_QUADS: "internal/quads" = 'internal/quads'

LDP

LDP: { namespace: string } & RecordOf<("contains" | "BasicContainer" | "Container" | "Resource")[], string> & { terms: Namespace<("contains" | "BasicContainer" | "Container" | "Resource")[], NamedNode<string>> } = ...

MA

MA: { namespace: string } & RecordOf<"format"[], string> & { terms: Namespace<"format"[], NamedNode<string>> } = ...

OIDC

OIDC: { namespace: string } & RecordOf<"redirect_uris"[], string> & { terms: Namespace<"redirect_uris"[], NamedNode<string>> } = ...

PIM

PIM: { namespace: string } & RecordOf<"Storage"[], string> & { terms: Namespace<"Storage"[], NamedNode<string>> } = ...

POSIX

POSIX: { namespace: string } & RecordOf<("mtime" | "size")[], string> & { terms: Namespace<("mtime" | "size")[], NamedNode<string>> } = ...

PREFERRED_PREFIX

PREFERRED_PREFIX: string = ...

PREFERRED_PREFIX_TERM

PREFERRED_PREFIX_TERM: NamedNode<string> = ...

RDF

RDF: { namespace: string } & RecordOf<"type"[], string> & { terms: Namespace<"type"[], NamedNode<string>> } = ...

SOLID

SOLID: { namespace: string } & RecordOf<("oidcIssuer" | "oidcIssuerRegistrationToken" | "oidcRegistration")[], string> & { terms: Namespace<("oidcIssuer" | "oidcIssuerRegistrationToken" | "oidcRegistration")[], NamedNode<string>> } = ...

SOLID_ERROR

SOLID_ERROR: { namespace: string } & RecordOf<"stack"[], string> & { terms: Namespace<"stack"[], NamedNode<string>> } = ...

SOLID_HTTP

SOLID_HTTP: { namespace: string } & RecordOf<("location" | "slug")[], string> & { terms: Namespace<("location" | "slug")[], NamedNode<string>> } = ...

SOLID_META

SOLID_META: { namespace: string } & RecordOf<("ResponseMetadata" | "template")[], string> & { terms: Namespace<("ResponseMetadata" | "template")[], NamedNode<string>> } = ...

TEMPLATE

TEMPLATE: { namespace: string } & RecordOf<"ResourceStore"[], string> & { terms: Namespace<"ResourceStore"[], NamedNode<string>> } = ...

TEMPLATE_VARIABLE

TEMPLATE_VARIABLE: { namespace: string } & RecordOf<("baseUrl" | "rootFilePath" | "sparqlEndpoint" | "templateConfig")[], string> & { terms: Namespace<("baseUrl" | "rootFilePath" | "sparqlEndpoint" | "templateConfig")[], NamedNode<string>> } = ...

TEXT_HTML

TEXT_HTML: "text/html" = 'text/html'

TEXT_MARKDOWN

TEXT_MARKDOWN: "text/markdown" = 'text/markdown'

TEXT_TURTLE

TEXT_TURTLE: "text/turtle" = 'text/turtle'

VANN

VANN: { namespace: string } & RecordOf<"preferredNamespacePrefix"[], string> & { terms: Namespace<"preferredNamespacePrefix"[], NamedNode<string>> } = ...

VCARD

VCARD: { namespace: string } & RecordOf<"hasMember"[], string> & { terms: Namespace<"hasMember"[], NamedNode<string>> } = ...

XSD

XSD: { namespace: string } & RecordOf<("dateTime" | "integer")[], string> & { terms: Namespace<("dateTime" | "integer")[], NamedNode<string>> } = ...

modulePathPlaceholder

modulePathPlaceholder: "@css:" = '@css:'

A placeholder for the path to the @solid/community-server module root. The resolveAssetPath function will replace this string with the actual path.

Functions

absoluteFilePath

  • absoluteFilePath(path: string): string
  • 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().

    Parameters

    • path: string

      Path to check (POSIX or Windows).

    Returns string

    The potentially changed path (POSIX).

addGeneratedResources

addHeader

  • addHeader(response: ServerResponse, name: string, value: string | string[]): void
  • Adds a header value without overriding previous values.

    Parameters

    • response: ServerResponse
    • name: string
    • value: string | string[]

    Returns void

addResourceMetadata

  • Helper function to generate type quads for a Container or Resource.

    Parameters

    • metadata: RepresentationMetadata

      Metadata to add to.

    • isContainer: boolean

      If the identifier corresponds to a container.

    Returns void

    The generated quads.

addTemplateMetadata

  • Links a template file with a given content-type to the metadata using the SOLID_META.template predicate.

    Parameters

    • metadata: RepresentationMetadata

      Metadata to update.

    • templateFile: string

      Path to the template.

    • contentType: string

      Content-type of the template after it is rendered.

    Returns void

assertError

  • assertError(error: unknown): asserts error is Error
  • Asserts that the input is a native error. If not the input will be re-thrown.

    Parameters

    • error: unknown

    Returns asserts error is Error

assertPassword

  • assertPassword(password: any, confirmPassword: any): asserts password is string

cleanPreferences

  • 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.

    Parameters

    Returns ValuePreferences

    A copy of the the preferences with the necessary updates.

cloneRepresentation

  • Helper function to clone a representation, the original representation can still be used. This function loads the entire stream in memory.

    Parameters

    Returns Promise<BasicRepresentation>

    The cloned representation.

createErrorMessage

  • createErrorMessage(error: unknown): string

createNamespace

  • createNamespace<TKey, TValue>(baseUri: string, toValue: (expanded: string) => TValue, ...localNames: TKey[]): Namespace<typeof localNames, TValue>
  • Creates a function that expands local names from the given base URI, and exports the given local names as properties on the returned object.

    Type parameters

    • TKey: string

    • TValue

    Parameters

    • baseUri: string
    • toValue: (expanded: string) => TValue
        • (expanded: string): TValue
        • Parameters

          • expanded: string

          Returns TValue

    • Rest ...localNames: TKey[]

    Returns Namespace<typeof localNames, TValue>

createSubdomainRegexp

  • createSubdomainRegexp(baseUrl: string): RegExp
  • 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/:

    • Will match http://test.com/foo/
    • Will match http://test.com/foo/bar/baz
    • Will match http://alice.bob.test.com/foo/bar/baz, first match result will be alice.bob
    • Will not match http://test.com/
    • Will not match http://alicetest.com/foo/

    Parameters

    • baseUrl: string

      Base URL for the regular expression.

    Returns RegExp

createTermNamespace

  • createTermNamespace<T>(baseUri: string, ...localNames: T[]): Namespace<typeof localNames, NamedNode>
  • 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.

    Type parameters

    • T: string

    Parameters

    • baseUri: string
    • Rest ...localNames: T[]

    Returns Namespace<typeof localNames, NamedNode>

createUriAndTermNamespace

  • 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.

    Type parameters

    • T: string

    Parameters

    • baseUri: string
    • Rest ...localNames: T[]

    Returns Namespace<typeof localNames, string> & { terms: Namespace<typeof localNames, NamedNode> }

createUriNamespace

  • createUriNamespace<T>(baseUri: string, ...localNames: T[]): Namespace<typeof localNames, string>
  • 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.

    Type parameters

    • T: string

    Parameters

    • baseUri: string
    • Rest ...localNames: T[]

    Returns Namespace<typeof localNames, string>

decodeUriPathComponents

  • decodeUriPathComponents(path: string): string

encodeUriPathComponents

  • encodeUriPathComponents(path: string): string
  • Encodes all (non-slash) special characters in a URI path.

    Parameters

    • path: string

    Returns string

Const endOfStream

  • endOfStream(arg1: Stream): Promise<void>

ensureTrailingSlash

  • ensureTrailingSlash(path: string): string
  • 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.

    Parameters

    • path: string

      Path to check.

    Returns string

    The potentially changed path.

extractScheme

  • extractScheme(url: string): { rest: string; scheme: string }
  • 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/' }.

    Parameters

    • url: string

      String to parse.

    Returns { rest: string; scheme: string }

    • rest: string
    • scheme: string

fetchDataset

getBestPreference

getConversionTarget

  • 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.

    Parameters

    Returns string | undefined

    The best match. Undefined if there is no match.

getETag

  • Generates an ETag based on the last modified date of a resource.

    Parameters

    Returns string | undefined

    the generated ETag. Undefined if no last modified date was found.

getExtension

  • getExtension(path: string): string
  • Extracts the extension (without dot) from a path. Custom function since path.extname does not work on all cases (e.g. ".acl")

    Parameters

    • path: string

      Input path to parse.

    Returns string

getLoggerFor

  • getLoggerFor(loggable: string | Instance): Logger
  • 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');
    

    Parameters

    • loggable: string | Instance

      A class instance or a class string name.

    Returns Logger

getModuleRoot

  • getModuleRoot(): string
  • Returns the folder corresponding to the root of the Community Solid Server module

    Returns string

getRelativeUrl

  • 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.

    Parameters

    • baseUrl: string

      Base URL.

    • request: HttpRequest

      Incoming request of which the target needs to be extracted.

    • targetExtractor: TargetExtractor

      Will extract the target from the request.

    Returns Promise<string>

getSingleItem

  • getSingleItem(stream: Readable): Promise<unknown>
  • 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.

    Parameters

    • stream: Readable

      Object stream with single entry.

    Returns Promise<unknown>

getStatusCode

  • getStatusCode(error: Error): number

getTemplateFilePath

  • getTemplateFilePath(template?: Template): string | undefined

getTypeWeight

  • 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.

    Parameters

    • type: string

      Type for which the matching weight is needed.

    • preferred: ValuePreferences

      Preferences to match the type to.

    Returns number

    The corresponding weight from the preferences or 0 if there is no match.

getWeightedPreferences

guardStream

  • guardStream<T>(stream: T): Guarded<T>
  • 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.

    Type parameters

    • T: EventEmitter<T>

    Parameters

    • stream: T

      Stream that can potentially throw an error.

    Returns Guarded<T>

    The stream.

guardedStreamFrom

  • guardedStreamFrom(contents: string | Iterable<any>, options?: ReadableOptions): Guarded<Readable>
  • Converts a string or array to a stream and applies an error guard so that it is Guarded.

    Parameters

    • contents: string | Iterable<any>

      Data to stream.

    • Optional options: ReadableOptions

      Options to pass to the Readable constructor. See {@link Readable.from}.

    Returns Guarded<Readable>

isContainerIdentifier

isContainerPath

  • isContainerPath(path: string): boolean
  • Checks if the path corresponds to a container path (ending in a /).

    Parameters

    • path: string

      Path to check.

    Returns boolean

isError

  • isError(error: any): error is Error

isGuarded

  • isGuarded<T>(stream: T): stream is Guarded<T>
  • Determines whether the stream is guarded from emitting errors.

    Type parameters

    • T: EventEmitter<T>

    Parameters

    • stream: T

    Returns stream is Guarded<T>

isHttpRequest

isInternalContentType

  • isInternalContentType(contentType?: string): boolean
  • 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.

    Parameters

    • Optional contentType: string

      Type to check.

    Returns boolean

isRepresentationMetadata

isResourceIdentifier

isSystemError

isTerm

  • isTerm(input?: any): input is Term
  • Parameters

    • Optional input: any

      Checks if this is a {@link Term}.

    Returns input is Term

isValidVariable

  • isValidVariable(variable: string): boolean
  • Checks if the given variable is one that is supported. This can be used to weed out irrelevant parameters in an object.

    Parameters

    • variable: string

    Returns boolean

joinFilePath

  • joinFilePath(basePath: string, ...paths: string[]): string
  • Adds the paths to the base path.

    Parameters

    • basePath: string

      The base path (POSIX or Windows).

    • Rest ...paths: string[]

      Subpaths to attach (POSIX).

    Returns string

    The potentially changed path (POSIX).

Const joinUrl

  • joinUrl(...parts: string[]): string
  • joinUrl(parts: string[]): string
  • Concatenates all the given strings into a normalized URL. Will place slashes between input strings if necessary.

    Parameters

    • Rest ...parts: string[]

    Returns string

  • Concatenates all the given strings into a normalized URL. Will place slashes between input strings if necessary.

    Parameters

    • parts: string[]

    Returns string

matchesMediaPreferences

matchesMediaType

  • matchesMediaType(mediaA: string, mediaB: string): boolean
  • Checks if the given two media types/ranges match each other. Takes wildcards into account.

    Parameters

    • mediaA: string

      Media type to match.

    • mediaB: string

      Media type to match.

    Returns boolean

    True if the media type patterns can match each other.

normalizeFilePath

  • normalizeFilePath(path: string): string
  • Resolves relative segments in the path.

    Parameters

    • path: string

      Path to check (POSIX or Windows).

    Returns string

    The potentially changed path (POSIX).

parseAccept

  • parseAccept(input: string): Accept[]

parseAcceptCharset

parseAcceptDateTime

parseAcceptEncoding

parseAcceptLanguage

parseForwarded

  • parseForwarded(headers: IncomingHttpHeaders): Forwarded
  • Parses a Forwarded header value and will fall back to X-Forwarded-* headers.

    Parameters

    • headers: IncomingHttpHeaders

      The incoming HTTP headers.

    Returns Forwarded

    The parsed Forwarded header.

parseParameters

  • parseParameters(parameters: string[], replacements: Record<string, string>): { name: string; value: string }[]
  • Parses a list of split parameters and checks their validity.

    throws

    BadRequestHttpError Thrown on invalid parameter syntax.

    Parameters

    • parameters: string[]

      A list of split parameters (token [ "=" ( token / quoted-string ) ])

    • replacements: Record<string, string>

      The double quoted strings that need to be replaced.

    Returns { name: string; value: string }[]

    An array of name/value objects corresponding to the parameters.

parseQuads

  • parseQuads(readable: Guarded<Readable>, options?: ParserOptions): Promise<Quad[]>
  • Helper function to convert a Readable into an array of quads.

    Parameters

    • readable: Guarded<Readable>

      The readable object.

    • options: ParserOptions = {}

      Options for the parser.

    Returns Promise<Quad[]>

    A promise containing the array of quads.

pipeSafely

  • pipeSafely<T>(readable: ReadableStream, destination: T, mapError?: (error: Error) => Error): Guarded<T>
  • 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.

    Type parameters

    • T: Writable<T>

    Parameters

    • readable: ReadableStream

      Initial readable stream.

    • destination: T

      The destination for writing data.

    • Optional mapError: (error: Error) => Error

      Optional function that takes the error and converts it to a new error.

        • (error: Error): Error
        • Parameters

          • error: Error

          Returns Error

    Returns Guarded<T>

    The destination stream.

promiseSome

  • promiseSome(predicates: Promise<boolean>[]): Promise<boolean>
  • 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.

    remarks

    Predicates provided as input must be implemented considering the following points:

    1. if they throw an error, it won't be propagated;
    2. throwing an error should be logically equivalent to returning false.

    Parameters

    • predicates: Promise<boolean>[]

    Returns Promise<boolean>

readJsonStream

  • readJsonStream(stream: Readable): Promise<NodeJS.Dict<any>>
  • Interprets the stream as JSON and converts it to a Dict.

    Parameters

    • stream: Readable

      Stream of JSON data.

    Returns Promise<NodeJS.Dict<any>>

    The parsed object.

readTemplate

  • readTemplate(template?: Template): Promise<string>

readableToQuads

  • readableToQuads(stream: Readable): Promise<Store>
  • Imports quads from a stream into a Store.

    Parameters

    • stream: Readable

      Stream of quads.

    Returns Promise<Store>

    A Store containing all the quads.

readableToString

  • readableToString(stream: Readable): Promise<string>
  • Joins all strings of a stream.

    Parameters

    • stream: Readable

      Stream of strings.

    Returns Promise<string>

    The joined string.

resetGlobalLoggerFactory

  • resetGlobalLoggerFactory(): void
  • Resets the global logger factory to undefined.

    This typically only needs to be called during testing. Call this at your own risk.

    Returns void

resolveAssetPath

  • resolveAssetPath(path?: string): string
  • 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.

    Parameters

    • path: string = ...

    Returns string

serializeQuads

  • serializeQuads(quads: Quad[], contentType?: string): Guarded<Readable>

setGlobalLoggerFactory

splitAndClean

  • splitAndClean(input: string): string[]
  • Splits the input string on commas, trims all parts and filters out empty ones.

    Parameters

    • input: string

      Input header string.

    Returns string[]

toCachedNamedNode

  • toCachedNamedNode(name: string | NamedNode<string>): NamedNode
  • 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!

    Parameters

    • name: string | NamedNode<string>

      Predicate to potentially transform.

    Returns NamedNode

toCanonicalUriPath

  • toCanonicalUriPath(path: string): string
  • Converts a URI path to the canonical version by splitting on slashes, decoding any percent-based encodings, and then encoding any special characters.

    Parameters

    • path: string

    Returns string

toLiteral

  • toLiteral(object: string | number, dataType: NamedNode<string>): Literal
  • Creates a literal by first converting the dataType string to a named node.

    Parameters

    • object: string | number

      Object value.

    • dataType: NamedNode<string>

      Object data type (as string).

    Returns Literal

toNamedTerm

  • toNamedTerm(subject: string): NamedNode
  • toNamedTerm<T>(subject: T): T
  • toNamedTerm<T>(subject: string | T): T | NamedNode
  • Converts a string to a named node when needed.

    Parameters

    • subject: string

      Subject to potentially transform.

    Returns NamedNode

  • Type parameters

    • T: Term

    Parameters

    • subject: T

    Returns T

  • Type parameters

    • T: Term

    Parameters

    • subject: string | T

    Returns T | NamedNode

toObjectTerm

  • toObjectTerm(object: string, preferLiteral?: boolean): NamedNode
  • toObjectTerm<T>(object: T, preferLiteral?: boolean): T
  • toObjectTerm<T>(object: string | T, preferLiteral?: boolean): T | NamedNode
  • Converts an object term when needed.

    Parameters

    • object: string

      Object to potentially transform.

    • Optional preferLiteral: boolean

      Whether strings are converted to literals or named nodes.

    Returns NamedNode

  • Type parameters

    • T: Term

    Parameters

    • object: T
    • Optional preferLiteral: boolean

    Returns T

  • Type parameters

    • T: Term

    Parameters

    • object: string | T
    • Optional preferLiteral: boolean

    Returns T | NamedNode

Const toPredicateTerm

  • toPredicateTerm(subject: string): NamedNode
  • toPredicateTerm<T>(subject: T): T
  • toPredicateTerm<T>(subject: string | T): T | NamedNode

transformQuotedStrings

  • transformQuotedStrings(input: string): { replacements: Record<string, string>; result: string }
  • Replaces all double quoted strings in the input string with "0", "1", etc.

    Parameters

    • input: string

      The Accept header string.

    Returns { replacements: Record<string, string>; result: string }

    The transformed string and a map with keys "0", etc. and values the original string that was there.

    • replacements: Record<string, string>
    • result: string

transformSafely

  • Transforms a stream, ensuring that all errors are forwarded.

    Type parameters

    • T = any

    Parameters

    Returns Guarded<Transform>

    The transformed stream

trimTrailingSlashes

  • trimTrailingSlashes(path: string): string
  • Makes sure the input path has no slashes at the end.

    Parameters

    • path: string

      Path to check.

    Returns string

    The potentially changed path.

updateModifiedDate