refactor: support inrupt coding standards

This commit is contained in:
Joachim Van Herwegen
2020-05-20 17:27:54 +02:00
parent 5def53180c
commit f8e136cadb
25 changed files with 722 additions and 604 deletions

View File

@@ -0,0 +1,8 @@
import { Representation } from './Representation';
/**
* A representation containing binary data.
*/
export interface BinaryRepresentation extends Representation {
dataType: 'binary';
}

View File

@@ -0,0 +1,9 @@
import { Representation } from './Representation';
import { ResourceIdentifier } from './ResourceIdentifier';
export interface NamedRepresentation extends Representation {
/**
* The identifier of this representation.
*/
identifier?: ResourceIdentifier;
}

4
src/ldp/http/Patch.ts Normal file
View File

@@ -0,0 +1,4 @@
/**
* Represents the changes needed for a PATCH request.
*/
export interface Patch {}

View File

@@ -0,0 +1,8 @@
import { Representation } from './Representation';
/**
* A representation containing quads as data.
*/
export interface QuadRepresentation extends Representation {
dataType: 'quad';
}

View File

@@ -0,0 +1,20 @@
import { Readable } from 'stream';
import { RepresentationMetadata } from './RepresentationMetadata';
/**
* A representation of a resource.
*/
export interface Representation {
/**
* The corresponding metadata.
*/
metadata: RepresentationMetadata;
/**
* The raw data stream for this representation.
*/
data: Readable;
/**
* The data type of the contents in the data stream.
*/
dataType: string;
}

View File

@@ -0,0 +1,35 @@
/**
* Contains metadata relevant to a representation.
*/
import { Quad } from 'rdf-js';
export interface RepresentationMetadata {
/**
* All metadata triples of the resource.
*/
raw: Quad[];
/**
* The metadata profiles.
*/
profiles: string[];
/**
* Optional size of the representation.
*/
byteSize?: number;
/**
* Optional content type of the representation.
*/
contentType?: string;
/**
* Optional encoding of the representation.
*/
encoding?: string;
/**
* Optional language of the representation.
*/
language?: string;
/**
* Optional timestamp of the representation.
*/
dateTime?: Date;
}

View File

@@ -0,0 +1,4 @@
/**
* Contains the preferences of which kind of representation is requested.
*/
export interface RepresentationPreferences {}

View File

@@ -0,0 +1,4 @@
/**
* The unique identifier of a resource.
*/
export interface ResourceIdentifier {}