Interface AuxiliaryStrategy

A strategy for handling one or more types of auxiliary resources. References to "an auxiliary resource" implicitly imply a specific type of auxiliary resources supported by this strategy.

interface AuxiliaryStrategy {
    addMetadata: ((metadata: RepresentationMetadata) => Promise<void>);
    getAuxiliaryIdentifier: ((identifier: ResourceIdentifier) => ResourceIdentifier);
    getAuxiliaryIdentifiers: ((identifier: ResourceIdentifier) => ResourceIdentifier[]);
    getSubjectIdentifier: ((identifier: ResourceIdentifier) => ResourceIdentifier);
    isAuxiliaryIdentifier: ((identifier: ResourceIdentifier) => boolean);
    isRequiredInRoot: ((identifier: ResourceIdentifier) => boolean);
    usesOwnAuthorization: ((identifier: ResourceIdentifier) => boolean);
    validate: ((representation: Representation) => Promise<void>);
}

Hierarchy (view full)

Implemented by

Properties

addMetadata: ((metadata: RepresentationMetadata) => Promise<void>)

Adds metadata related to this auxiliary resource, in case this is required for this type of auxiliary resource. The metadata that is added depends on the given identifier being an auxiliary or subject resource: the metadata will be used to link to the other one, and potentially add extra typing info.

Used for: Solid, §4.3.1: "For any defined auxiliary resource available for a given Solid resource, all representations of that resource MUST include an HTTP Link header pointing to the location of each auxiliary resource." https://solid.github.io/specification/protocol#auxiliary-resources-server

The above is an example of how that metadata would only be added in case the input is the subject identifier.

Type declaration

getAuxiliaryIdentifier: ((identifier: ResourceIdentifier) => ResourceIdentifier)

Returns the identifier of the auxiliary resource corresponding to the given resource. This does not guarantee that this auxiliary resource exists.

Should error if there are multiple results: see getAuxiliaryIdentifiers.

Type declaration

getAuxiliaryIdentifiers: ((identifier: ResourceIdentifier) => ResourceIdentifier[])

Returns all the identifiers of corresponding auxiliary resources. This can be used when there are potentially multiple results. In the case of a single result this should be an array containing the result of getAuxiliaryIdentifier.

Type declaration

getSubjectIdentifier: ((identifier: ResourceIdentifier) => ResourceIdentifier)

Returns the identifier of the resource which this auxiliary resource is referring to. This does not guarantee that this resource exists.

Type declaration

isAuxiliaryIdentifier: ((identifier: ResourceIdentifier) => boolean)

Checks if the input identifier corresponds to an auxiliary resource. This does not check if that auxiliary resource exists, only if the identifier indicates that there could be an auxiliary resource there.

Type declaration

    • (identifier): boolean
    • Parameters

      Returns boolean

      true if the input identifier points to an auxiliary resource.

isRequiredInRoot: ((identifier: ResourceIdentifier) => boolean)

Whether the root storage container requires this auxiliary resource to be present. If yes, this means they can't be deleted individually from such a container.

Type declaration

    • (identifier): boolean
    • Parameters

      Returns boolean

usesOwnAuthorization: ((identifier: ResourceIdentifier) => boolean)

Whether this auxiliary resources uses its own authorization instead of the subject resource authorization.

Type declaration

    • (identifier): boolean
    • Parameters

      Returns boolean

validate: ((representation: Representation) => Promise<void>)

Validates if the representation contains valid data for an auxiliary resource. Should throw an error in case the data is invalid.

Type declaration

    • (representation): Promise<void>
    • Parameters

      • representation: Representation

        Representation of the auxiliary resource.

      Returns Promise<void>