Carbon LDP JavaScript SDK API Reference

Exported Elements




Interfaces

I
CarbonLDP.AccessPoint
Model that represents a c:AccessPoint.
I
CarbonLDP.AccessPointFactory
Factory, decorator and utils of a CarbonLDP.AccessPoint object.
I
I
CarbonLDP.TransientAccessPoint
The in-memory model that represents a c:AccessPoint.
I
CarbonLDP.TransientAccessPointFactory
Factory, decorator and utils for CarbonLDP.TransientAccessPoint objects.

Properties




Model that represents a c:AccessPoint.


Properties

.hasMemberRelation
: CarbonLDP.Pointer

The relation the access point manages.


.insertedContentRelation
: CarbonLDP.Pointer

The inserted content relation the access point have.


.isMemberOfRelation
: CarbonLDP.Pointer

The optional inverted relation the access point also manages.


.membershipResource
: CarbonLDP.Document

The resource the access point belongs to.





Factory, decorator and utils of a CarbonLDP.AccessPoint object.


Properties

Methods

.is()
: value is CarbonLDP.AccessPoint


is( value:any ):value is AccessPoint

Returns true if the value provided is considered an CarbonLDP.AccessPoint.


Param Type Default Description
value any

Element to be checked.





Basic properties to construct a CarbonLDP.TransientAccessPoint.


Properties

.hasMemberRelation
: string | CarbonLDP.Pointer

The relation the access point will manage.


.insertedContentRelation
: string | CarbonLDP.Pointer

The inserted content relation the access point will have.


.isMemberOfRelation
: string | CarbonLDP.Pointer

The optional inverted relation the access point will manage.


.membershipResource
: CarbonLDP.Pointer

The parent resource the access point will manage the determined relation.





The in-memory model that represents a c:AccessPoint.


Properties

.hasMemberRelation
: CarbonLDP.Pointer

The relation the access point will manage.


.insertedContentRelation
: CarbonLDP.Pointer

The inserted content relation the access point will have.


.isMemberOfRelation
: CarbonLDP.Pointer

The optional inverted relation the access point will manage.





Factory, decorator and utils for CarbonLDP.TransientAccessPoint objects.


Properties

Methods

.create()
: T & CarbonLDP.TransientAccessPoint


create<T extends object>( data:T & BaseAccessPoint ):T & TransientAccessPoint

Create a CarbonLDP.TransientAccessPoint object with the base data specified.


Param Type Default Description
data T & BaseAccessPoint

Data to create the transient access point.



.createFrom()
: T & CarbonLDP.TransientAccessPoint


createFrom<T extends object>( object:T & BaseAccessPoint ):T & TransientAccessPoint

Create a CarbonLDP.TransientAccessPoint object from the object specified containing the base data.


Param Type Default Description
object T & BaseAccessPoint

Object with the base data that will be converted into an access point.



.is()
: value is CarbonLDP.TransientAccessPoint


is( value:any ):value is TransientAccessPoint

Returns true if the value provided is considered a CarbonLDP.TransientAccessPoint.


Param Type Default Description
value any




Classes

C
CarbonLDP
The main class of the SDK.




CarbonLDP
Class

The main class of the SDK. Create an instance with the information of the platform to communicate.

The class contains, as static members, the references to all the reexported submodules in the SDK.


Constructor


CarbonLDP( url:string )

Creates the instance of the SDK with the URL of the platform to communicate.


Param Type Default Description
url string

The URL of the of the platform.



CarbonLDP( settings:CarbonLDPSettings )

Creates the instance of the SDK with all the configurable settings of the SDK.


Param Type Default Description
settings CarbonLDPSettings

Object to fully configure the instance.


Properties

#AbstractContext
: typeof AbstractContext


#AccessPoint
: typeof AccessPoint


#ContainerType
: typeof ContainerType


#DigestedObjectSchema
: typeof DigestedObjectSchema


#DigestedObjectSchemaProperty
: typeof DigestedObjectSchemaProperty


#Document
: typeof Document


#Errors
: typeof Errors


#Fragment
: typeof Fragment


#FreeResources
: typeof FreeResources


#GlobalContext
: typeof GlobalContext


#HTTP
: typeof HTTP


#JSONLD
: typeof JSONLD


#LDP
: typeof LDP


#LDPatch
: typeof LDPatch


#Messaging
: typeof Messaging


#ObjectSchemaDigester
: typeof ObjectSchemaDigester


#ObjectSchemaUtils
: typeof ObjectSchemaUtils


#Pointer
: typeof Pointer


#PointerType
: typeof PointerType


#RDF
: typeof RDF


#Resource
: typeof Resource


#SHACL
: typeof SHACL


#SPARQL
: typeof SPARQL


#System
: typeof System


#TransientAccessPoint
: typeof TransientAccessPoint


#TransientFragment
: typeof TransientFragment


#Utils
: typeof Utils


#Vocabularies
: typeof Vocabularies


#version
: string

Version of the SDK.


.documents
: CarbonLDP.Document

The root document of the platform.


.version
: string


Methods

.getPlatformMetadata()
: Promise<CarbonLDP.System.PlatformMetadata>


getPlatformMetadata():Promise<System.PlatformMetadata>

Retrieves the metadata document of the platform.






Interfaces

I
CarbonLDP.CarbonLDPSettings
Interface of the possible settings used by the Carbon class.




Extends:
DocumentsContextSettings

Interface of the possible settings used by the Carbon class.


Properties

.host
: string

The host of the platform to connect to.


.port
: number

The optional port of the host to connect to.


.ssl
: boolean

Flag that indicates is the server is under a secure connection or not. By default it will be set to true, making the host to be resolved as https://





Classes

C
CarbonLDP.AbstractContext
Abstract class used to define any context of the SDK.
C
CarbonLDP.GlobalContext
Shared context used by every CarbonLDP context as its parent.

Interfaces

I
CarbonLDP.Context
Interface that every context in the SDK must implement.




Implements:

Abstract class used to define any context of the SDK.


Constructor


AbstractContext( parentContext?:PARENT )

Create the context with an optional associated parent.


Param Type Default Description
parentContext PARENT

The optional parent context to be associated to the context.


Properties

Methods

.__extendGeneralSchema()
: this


__extendGeneralSchema( objectSchema:ObjectSchema ):this

Param Type Default Description
objectSchema ObjectSchema


.__extendTypeSchema()
: this


__extendTypeSchema( objectSchema:ObjectSchema, type:string ):this

Param Type Default Description
objectSchema ObjectSchema
type string


.__getInheritGeneralSchema()
: CarbonLDP.DigestedObjectSchema


__getInheritGeneralSchema():DigestedObjectSchema



.__getInheritTypeSchema()
: CarbonLDP.DigestedObjectSchema


__getInheritTypeSchema( type:string ):DigestedObjectSchema

Param Type Default Description
type string


.__getObjectSchemasTypes()
: string[]


__getObjectSchemasTypes():string[]



.__resolveTypeURI()
: string


__resolveTypeURI( uri:string ):string

Param Type Default Description
uri string


._getTypeObjectSchemas()
: CarbonLDP.DigestedObjectSchema[]


_getTypeObjectSchemas( excepts:string[] ):DigestedObjectSchema[]

Returns all the typed schemas including the ones from the parent contexts.


Param Type Default Description
excepts string[]

Optional types to exclude in the returning of the stored schemas.



.clearObjectSchema()
: void


clearObjectSchema( type?:string ):void

Param Type Default Description
type string


.extendObjectSchema()
: this


extendObjectSchema( type:string, objectSchema:ObjectSchema ):this

Param Type Default Description
type string
objectSchema ObjectSchema


extendObjectSchema( modelSchema:ModelSchema<string> ):this

Param Type Default Description
modelSchema ModelSchema<string>


extendObjectSchema( objectSchema:ObjectSchema ):this

Param Type Default Description
objectSchema ObjectSchema


extendObjectSchema( schemas:(ObjectSchema | ModelSchema<string>)[] ):this

Param Type Default Description
schemas (ObjectSchema | ModelSchema<string>)[]


.getObjectSchema()
: CarbonLDP.DigestedObjectSchema


getObjectSchema( type?:string ):DigestedObjectSchema

Param Type Default Description
type string


.hasObjectSchema()
: boolean


hasObjectSchema( type:string ):boolean

Param Type Default Description
type string


.resolve()
: string


resolve( relativeURI:string ):string

Param Type Default Description
relativeURI string




CarbonLDP.Context
Interface

Interface that every context in the SDK must implement.


Properties

.baseURI
: string

Base URI of the resources that can be used by the context.


.jsonldConverter
: CarbonLDP.JSONLD.JSONLDConverter

Converter of JSONLD objects associated to the current context.


.parentContext
: CarbonLDP.Context | undefined

Parent context from where the context inherit some data, configurations and more.


.registry
: CarbonLDP.GeneralRegistry<REGISTRY> | undefined

Registry where the context stores its associated resources.


.repository
: CarbonLDP.GeneralRepository<REPOSITORY> | undefined

Repository that can fetch the data of the resources of the context.


Methods

.clearObjectSchema()
: void


clearObjectSchema( type?:string ):void

Remove the schema of a specific type if provided, or clear the general schema if no type is provided.


Param Type Default Description
type string

The URI of the type to remove its schema.



.extendObjectSchema()
: this


extendObjectSchema( objectSchema:ObjectSchema ):this

Extends the general object schema.

If the first extension, the general schema of the parent context will be duplicated into the current before its extended.


Param Type Default Description
objectSchema ObjectSchema

The schema data from where to extend the general schema.



extendObjectSchema( type:string, objectSchema:ObjectSchema ):this

Extends the schema of the type specified.

If the first extension, the typed schema of the parent context will be duplicated into the current before its extended.


Param Type Default Description
type string

The URI of the type to extend its schema.

objectSchema ObjectSchema

The schema data from where to extend the typed schema.



extendObjectSchema( modelSchema:ModelSchema<string> ):this

Extends the schema of the type specified.

The signature behaves as the previous one but uses CarbonLDP.Model.ModelSchema.TYPE as the type and CarbonLDP.Model.ModelSchema.SCHEMA as the schema data extender.


Param Type Default Description
modelSchema ModelSchema<string>

The object with the type and the schema to extend.



extendObjectSchema( schemas:(ObjectSchema | ModelSchema<string>)[] ):this

Extends a multiple of typed schemas using the interface CarbonLDP.Model.ModelSchema or also extends the general schema when a direct object schema is provided.


Param Type Default Description
schemas (ObjectSchema | ModelSchema<string>)[]

The array of typed schemas and/or schemas to extend.



.getObjectSchema()
: CarbonLDP.DigestedObjectSchema


getObjectSchema( type?:string ):DigestedObjectSchema

Returns the object schema for the specified type if provided, otherwise the general object schema will be the one returned.


Param Type Default Description
type string

The URI of the type to look for tis schema.



.hasObjectSchema()
: boolean


hasObjectSchema( type:string ):boolean

Returns true if there is an object schema fot the specified type.


Param Type Default Description
type string

The URI of the type to check if has a schema.



.resolve()
: string


resolve( relativeURI:string ):string

Resolved the relative URI provided with the base URI of the context.


Param Type Default Description
relativeURI string

The URI to be resolved.





Context to manage CarbonLDP.Document's.


Constructor


DocumentsContext( url:string )

Create an instance of the document context with the URL as the base URI.


Param Type Default Description
url string

URL to be set as the base URI of the context.


Properties

._baseURI
: string


._settings
: DocumentsContextSettings


.messaging
: CarbonLDP.Messaging.MessagingService

Messaging service with the raw methods to configure and connect a notification broker by Sock.js using the STOMP and AMQP protocols.


.registry
: CarbonLDP.DocumentsRegistry

Registry that can only stores CarbonLDP.Document's.


.repository
: CarbonLDP.DocumentsRepository

Repository to fetch the CarbonLDP.Document's data.


Methods

#__mergePaths()
: Paths


__mergePaths( target:Paths, source:Paths ):Paths

Param Type Default Description
target Paths
source Paths

._extendPaths()
: void


_extendPaths( paths:Paths ):void

Param Type Default Description
paths Paths


._extendsSettings()
: void


_extendsSettings( settings:DocumentsContextSettings ):void

Param Type Default Description
settings DocumentsContextSettings


._resolvePath()
: string


_resolvePath( path:string ):string

Resolves the path provided into an URL using the path settings of the context. If such path does hasn't been declared an CarbonLDP.Errors.IllegalStateError will be thrown.

Example: The path system.platform with the default setting:

{
paths: {
system: {
slug: ".system/",
paths: { platform: "platform/" }
}
}
}

This should resolve to something like https://example.com/.system/platform/.


Param Type Default Description
path string

The dot notation string that refers the path declared in the settings of the context.





Extends:

Shared context used by every CarbonLDP context as its parent.

This context contains the shared schemas of the Platform and all the references to external resources.


Constructor


GlobalContext()


Properties

#instance
: CarbonLDP.GlobalContext

Singleton instance of the CarbonLDP.GlobalContext. This exact instance is used as parent by every CarbonLDP instance.


._baseURI
: ""


.registry
: CarbonLDP.GeneralRegistry<CarbonLDP.RegisteredPointer>

Registry that stores the external resources of any CarbonLDP instance.


.repository
: undefined

Undefined repository since external resources cannot be fetched.


Methods

.__registerDefaultDecorators()
: void


__registerDefaultDecorators():void



.__registerDefaultObjectSchemas()
: void


__registerDefaultObjectSchemas():void





Interfaces

I
CarbonLDP.BaseDocument
Base configurable properties of a CarbonLDP.Document.
I
CarbonLDP.Document
Model that represents a c:Document.
I
CarbonLDP.TransientDocument
In-memory model that represents a c:Document.

Type Aliases

T
CarbonLDP.DocumentFactory
Factory, decorator and utils for CarbonLDP.Document objects.
T
CarbonLDP.TransientDocumentFactory
Factory, decorator and utils for CarbonLDP.TransientDocument objects.

Reexports


Properties




Base configurable properties of a CarbonLDP.Document.


Properties

.defaultInteractionModel
: string | CarbonLDP.Pointer

Default interaction model the document will have when no Prefer interaction header is set in a request.


.hasMemberRelation
: string | CarbonLDP.Pointer

Member relation the document will have.


.insertedContentRelation
: string | CarbonLDP.Pointer

Inserted relation the document will have.


.isMemberOfRelation
: string | CarbonLDP.Pointer

Optional inverted relation the document will have.





CarbonLDP.Document
Interface

Model that represents a c:Document.


Properties

.$__modelDecorator
: CarbonLDP.Model.ModelDecorator<CarbonLDP.Fragment>


.$__resourcesMap
: Map<string, CarbonLDP.Fragment>


.$__savedFragments
: CarbonLDP.Fragment[]

Array with the fragments that has been persisted.


.$registry
: CarbonLDP.DocumentsRegistry

Registry where the document exists.


.$repository
: CarbonLDP.DocumentsRepository

Repository where the document can manage its data.


.accessPoints
: CarbonLDP.AccessPoint[]

Set with the access points of the document.


.contains
: CarbonLDP.Document[]

Set with the children of the document.


.created
: Date

Datetime when the document was persisted.


.modified
: Date

Last datetime when the document was modified.


Methods

.$_syncSavedFragments()
: void


$_syncSavedFragments():void

Makes all the current fragments in the document as fragments that has been persisted in the served.




.$createFragment()
: T & CarbonLDP.Fragment


$createFragment<T extends object>( object:T, id?:string ):T & Fragment

Param Type Default Description
object T
id string


$createFragment( slug?:string ):Fragment

Param Type Default Description
slug string


.$delete()
: Promise<void>


$delete( requestOptions?:RequestOptions ):Promise<void>

Deletes the current document.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$delete( uri:string, requestOptions?:RequestOptions ):Promise<void>

Deletes the document of the specified URI.


Param Type Default Description
uri string

URI of the document to be deleted.

requestOptions RequestOptions

Customizable options for the request.



.$exists()
: Promise<boolean>


$exists( requestOptions?:RequestOptions ):Promise<boolean>

Checks if the current document exists.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>

Checks if the document of the specified URI exists.


Param Type Default Description
uri string

The URI of the document to check its existence.

requestOptions RequestOptions

Customizable options for the request.



.$get()
: Promise<T & CarbonLDP.Document>


$get<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
uri string
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
uri string
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Param Type Default Description
uris string[]
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Param Type Default Description
uris string[]
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


.$getFragment()
: (T & CarbonLDP.Fragment) | null


$getFragment<T extends object>( id:string ):(T & Fragment) | null

Param Type Default Description
id string


.$getFragments()
: CarbonLDP.Fragment[]


$getFragments():Fragment[]



.$getPointer()
: CarbonLDP.RegisteredPointer


$getPointer( id:string ):RegisteredPointer

Param Type Default Description
id string


$getPointer( id:string, local:true ):Fragment

Param Type Default Description
id string
local true


.$getPointers()
: CarbonLDP.RegisteredPointer[]


$getPointers():RegisteredPointer[]



$getPointers( local:true ):Fragment[]

Param Type Default Description
local true


.$refresh()
: Promise<T & this>


$refresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this>

Refreshes with the latest data of the current document. If the document was retrieved partially, only the partial properties will be refreshed.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Refreshes with the latest data of the specified document. If the document was retrieved partially, only the partial properties will be refreshed.


Param Type Default Description
document Document

The document to be refreshed.

requestOptions RequestOptions

Customizable options for the request.



.$removeFragment()
: boolean


$removeFragment( slugOrFragment:string | Fragment ):boolean

Param Type Default Description
slugOrFragment string | Fragment


.$resolve()
: Promise<T & this & CarbonLDP.Document>


$resolve<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>

Param Type Default Description
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$resolve<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>

Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
document Document
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
document Document
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


.$save()
: Promise<T & this>


$save<T extends object>( requestOptions?:RequestOptions ):Promise<T & this>

Saves the changes of the current document.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Saves the changes of the specified document.


Param Type Default Description
document Document

The document to be saved.

requestOptions RequestOptions

Customizable options for the request.



.$saveAndRefresh()
: Promise<T & this>


$saveAndRefresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this>

Saves the changes of the current document and retrieves its latest changes. If the document was retrieved partially, only the partial properties will be refreshed.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Saves the changes of the specified document and retrieves its latest changes. If the document was retrieved partially, only the partial properties will be refreshed.


Param Type Default Description
document Document

The resource to saved and refreshed.

requestOptions RequestOptions

Customizable options for the request.





Factory, decorator and utils for CarbonLDP.Document objects.


type DocumentFactory = ModelSchema<C["Document"]> & ModelPrototype<Document, SPARQLDocumentTrait & EventEmitterDocumentTrait & QueryableDocumentTrait, OverriddenMembers> & ModelDecorator<Document, BaseResolvableDocument> & ModelTypeGuard<Document> & ModelFactory<TransientDocument, BaseDocument>



In-memory model that represents a c:Document.


Properties

Methods

.$_getLocalID()
: string


$_getLocalID( id:string ):string

Param Type Default Description
id string


.$_normalize()
: void


$_normalize():void

Search over the document for normal object and converted them into fragments. If unused fragments with BNode label as ID are detected, they will be removed from the document.




.$createFragment()
: T & CarbonLDP.TransientFragment


$createFragment<T extends object>( object:T, id?:string ):T & TransientFragment

Creates a CarbonLDP.TransientFragment from the object and ID specified.


Param Type Default Description
object T

The object to be converted into a fragment.

id string

Optional ID to be set for the fragment, if no provided a random BNode label will be assigned.



$createFragment( id?:string ):TransientFragment

Creates a CarbonLDP.TransientFragment with the ID specified.


Param Type Default Description
id string

Optional ID to be set for the fragment, if no provided a random BNode label will be assigned.



.$getFragment()
: (T & CarbonLDP.TransientFragment) | null


$getFragment<T extends object>( id:string ):(T & TransientFragment) | null

Returns the fragment with the ID specified. If no fragment exists, null will be returned.


Param Type Default Description
id string

The ID of the fragment to look for.



.$getFragments()
: CarbonLDP.TransientFragment[]


$getFragments():TransientFragment[]

Returns an array with all the fragments in the document.




.$hasFragment()
: boolean


$hasFragment( id:string ):boolean

Returns true if the document has a fragment with the ID specified.


Param Type Default Description
id string

The ID of the fragment to check if exists.



.$removeFragment()
: boolean


$removeFragment( idOrFragment:string | TransientFragment ):boolean

Removes the fragment provided from the document. If a string is provided, it will be used as the ID of the fragment to be removed.


Param Type Default Description
idOrFragment string | TransientFragment


.toJSON()
: CarbonLDP.RDF.RDFDocument


toJSON( contextOrKey?:string | Context<RegisteredPointer, ResolvablePointer> ):RDFDocument

Returns the JSON-LD representation of the current document.


Param Type Default Description
contextOrKey string | Context<RegisteredPointer, ResolvablePointer>

A specific context to use for expand the data into JSON-LD instead of the internal one.








Interfaces

I
CarbonLDP.Document.Traits.EventEmitterDocumentTrait
Trait of a CarbonLDP.Document with methods for event subscriptions.
I
CarbonLDP.Document.Traits.LDPDocumentTrait
Trait of a CarbonLDP.Document with methods for LDP related requests.
I
CarbonLDP.Document.Traits.QueryableDocumentTrait
Trait of a CarbonLDP.Document with methods for advanced reading requests.
I
CarbonLDP.Document.Traits.SPARQLDocumentTrait
Trait of a CarbonLDP.Document with methods for SPARQL requests.

Type Aliases


Properties




Trait of a CarbonLDP.Document with methods for event subscriptions.


Properties

.$repository
: CarbonLDP.DocumentsRepository.Traits.EventEmitterDocumentsRepositoryTrait

Repository trait that actually executes the request of the current trait.


Methods

.$off()
: void


$off( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the child created event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.CHILD_CREATED

Child created event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that was used to subscribe to the child created event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.CHILD_CREATED, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the child created event and onEvent callback for the current document.


Param Type Default Description
event Event.CHILD_CREATED

Child created event of the subscription to be removed.

onEvent (message: ChildCreatedEvent) => void

Callback that was used to subscribe to the child created event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the document modified event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that was used to subscribe to the document modified event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.DOCUMENT_MODIFIED, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the document modified event and onEvent callback for the current document.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event of the subscription to be removed.

onEvent (message: DocumentModifiedEvent) => void

Callback that was used to subscribe to the document modified event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the document deleted event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that was used to subscribe to the document deleted event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.DOCUMENT_DELETED, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the document deleted event and onEvent callback for the current document.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event of the subscription to be removed.

onEvent (message: DocumentDeletedEvent) => void

Callback that was used to subscribe to the document deleted event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the member added event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that was used to subscribe to the member added event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.MEMBER_ADDED, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the member added event and onEvent callback for the current document.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event of the subscription to be removed.

onEvent (message: MemberAddedEvent) => void

Callback that was used to subscribe to the member added event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the member removed event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that was used to subscribe to the member removed event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:Event.MEMBER_REMOVED, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the member removed event and onEvent callback for the current document.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event of the subscription to be removed.

onEvent (message: MemberRemovedEvent) => void

Callback that was used to subscribe to the member removed event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Removes the subscription of the specified event and onEvent callback for the desired URI pattern.


Param Type Default Description
event string

Event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: EventMessage) => void

Callback that was used to subscribe to the specified event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



$off( event:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Removes the subscription of the specified event and onEvent callback for the current document.


Param Type Default Description
event string

Event of the subscription to be removed.

onEvent (message: EventMessage) => void

Callback that was used to subscribe to the specified event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



.$on()
: void


$on( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the child created event for the desired URI pattern.


Param Type Default Description
event Event.CHILD_CREATED

Child created event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.CHILD_CREATED, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the child created event for the current document.


Param Type Default Description
event Event.CHILD_CREATED

Child created event to subscribe for its notifications.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document modified event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.DOCUMENT_MODIFIED, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document modified event for the current document.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event to subscribe for its notifications.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document deleted event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.DOCUMENT_DELETED, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document deleted event for the current document.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event to subscribe for its notifications.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member added event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.MEMBER_ADDED, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member added event for the current document.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event to subscribe for its notifications.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member removed event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:Event.MEMBER_REMOVED, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member removed event for the current document.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event to subscribe for its notifications.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Subscribe to the specified event for the desired URI pattern.


Param Type Default Description
event string

Event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: EventMessage) => void

Callback that will receive the notification message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$on( event:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Subscribe to the specified event for the current document.


Param Type Default Description
event string

Event to subscribe for its notifications.

onEvent (message: EventMessage) => void

Callback that will receive the notification message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.$onChildCreated()
: void


$onChildCreated( uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the child created event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$onChildCreated( onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the child created event for the current document.


Param Type Default Description
onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.$onDocumentDeleted()
: void


$onDocumentDeleted( uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document deleted event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$onDocumentDeleted( onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document deleted event for the current document.


Param Type Default Description
onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.$onDocumentModified()
: void


$onDocumentModified( uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document modified event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$onDocumentModified( onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document modified event for the current document.


Param Type Default Description
onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.$onMemberAdded()
: void


$onMemberAdded( uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member added event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$onMemberAdded( onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member added event for the current document.


Param Type Default Description
onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.$onMemberRemoved()
: void


$onMemberRemoved( uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member removed event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$onMemberRemoved( onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member removed event for the current document.


Param Type Default Description
onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.$one()
: void


$one( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the child created event for the desired URI pattern.


Param Type Default Description
event Event.CHILD_CREATED

Child created event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.CHILD_CREATED, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the child created event for the current document.


Param Type Default Description
event Event.CHILD_CREATED

Child created event to subscribe for one notification.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the document modified event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.DOCUMENT_MODIFIED, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the document modified event for the current document.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event to subscribe for one notification.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the document deleted event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.DOCUMENT_DELETED, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the document deleted event for the current document.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event to subscribe for one notification.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the member added event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.MEMBER_ADDED, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the member added event for the current document.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event to subscribe for one notification.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the member removed event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:Event.MEMBER_REMOVED, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the member removed event for the current document.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event to subscribe for one notification.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the specified event for the desired URI pattern.


Param Type Default Description
event string

Event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: EventMessage) => void

Callback that will receive the notification message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



$one( event:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the specified event for the current document.


Param Type Default Description
event string

Event to subscribe for one notification.

onEvent (message: EventMessage) => void

Callback that will receive the notification message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.








Trait of a CarbonLDP.Document with methods for LDP related requests.


Properties

.$repository
: CarbonLDP.DocumentsRepository.Traits.LDPDocumentsRepositoryTrait

Repository trait that actually executes the request of the current trait.


Methods

.$addMember()
: Promise<void>


$addMember( member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>

Adds the provided resource as member of the current document.


Param Type Default Description
member string | Pointer

Resource to be added as member.

requestOptions RequestOptions

Customizable options for the request.



$addMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>

Adds the provided resource as member of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to add the member.

member string | Pointer

Resource to be added as member.

requestOptions RequestOptions

Customizable options for the request.



.$addMembers()
: Promise<void>


$addMembers( members:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>

Adds the provided resources as members of the current document.


Param Type Default Description
members (string | Pointer)[]

Resources to be added as members.

requestOptions RequestOptions

Customizable options for the request.



$addMembers( uri:string, members:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>

Adds the provided resources as members of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to add the members.

members (string | Pointer)[]

Resources to be added as members.

requestOptions RequestOptions

Customizable options for the request.



.$create()
: Promise<(T & CarbonLDP.Document)[]>


$create<T extends object>( children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the current document.


Param Type Default Description
children T[]

Objects to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the current document.


Param Type Default Description
children T[]

Objects to be persisted.

slugs string[]

Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( child:T, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the current document.


Param Type Default Description
child T

Object to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the current document.


Param Type Default Description
child T

Object to be persisted.

slug string

Suggested slug for the child URI.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

slugs string[]

Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$create<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

slug string

Suggested slug for the child URI.

requestOptions RequestOptions

Customizable options for the request.



.$createAndRetrieve()
: Promise<(T & CarbonLDP.Document)[]>


$createAndRetrieve<T extends object>( children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the current document and retrieves the updated data from the server.


Param Type Default Description
children T[]

Objects to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the current document and retrieves the updated data from the server.


Param Type Default Description
children T[]

Objects to be persisted.

slugs string[]

Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( child:T, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the current document and retrieves the updated data from the server.


Param Type Default Description
child T

Object to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the current document and retrieves the updated data from the server.


Param Type Default Description
child T

Object to be persisted.

slug string

Suggested slug for the child URI.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

slugs string[]

Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

requestOptions RequestOptions

Customizable options for the request.



$createAndRetrieve<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

slug string

Suggested slug for the child URI.

requestOptions RequestOptions

Customizable options for the request.



.$removeMember()
: Promise<void>


$removeMember( member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>

Removes the provided resource as member of the current document.


Param Type Default Description
member string | Pointer

Resource to be removed as member.

requestOptions RequestOptions

Customizable options for the request.



$removeMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>

Removes the provided resource as member of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to remove the member.

member string | Pointer

Resource to be removed as member.

requestOptions RequestOptions

Customizable options for the request.



.$removeMembers()
: Promise<void>


$removeMembers( members?:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>

Removes the provided resources as members of the current document. IF no members is provided all the members of the current document will be removed.


Param Type Default Description
members (string | Pointer)[]

Resources to be removed as members.

requestOptions RequestOptions

Customizable options for the request.



$removeMembers( requestOptions?:RequestOptions ):Promise<void>

Removes all the members of the current document.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$removeMembers( uri:string, members?:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>

Removes the provided resources as members of the document of the specified URI. IF no members is provided all the members of the specified document will be removed.


Param Type Default Description
uri string

URI of the document to remove the members.

members (string | Pointer)[]

Resources to be removed as members.

requestOptions RequestOptions

Customizable options for the request.



$removeMembers( uri:string, requestOptions?:RequestOptions ):Promise<void>

Removes all the members of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to remove its members.

requestOptions RequestOptions

Customizable options for the request.








Trait of a CarbonLDP.Document with methods for advanced reading requests.


Properties

.$repository
: CarbonLDP.DocumentsRepository.Traits.QueryableDocumentsRepositoryTrait

Repository trait that actually executes the request of the current trait.


Methods

.$get()
: Promise<T & CarbonLDP.Document>


$get<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Retrieves the specific properties of the current document set by the query function.


Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be retrieved.



$get<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Retrieves the entire current document or only the properties set by the query function when provided.


Param Type Default Description
requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be retrieved.



$get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Retrieves the properties of the document of the URI specified set by the query function.


Param Type Default Description
uri string

URI of the document to be retrieved.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be retrieved.



$get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Retrieves the entire document of the URI specified or only the properties set by the query function when provided.


Param Type Default Description
uri string

URI of the document to be retrieved.

requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be retrieved.



$get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Retrieves the properties set by the query function, of the documents specified.


Param Type Default Description
uris string[]

URIs of the documents to be retrieved.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the documents to be retrieved.



$get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Retrieves the entire documents of the URIs specified or only the properties set by the query function when provided.


Param Type Default Description
uris string[]

URIs of the documents to be retrieved.

requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the documents to be retrieved.



.$getChildren()
: Promise<(T & CarbonLDP.Document)[]>


$getChildren<T extends object>( requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entire children of the current document or only the properties set by the query function.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the children to be retrieved.



$getChildren<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entry children of the current document or only the properties set by the query function.


Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the children to be retrieved.



$getChildren<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entire children of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its children.

requestOptions RequestOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the children to be retrieved.



$getChildren<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieved the entire children of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its children.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the children to be retrieved.



.$getMembers()
: Promise<(T & CarbonLDP.Document)[]>


$getMembers<T extends object>( requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entire members of the current document or only the properties set by the query function.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the members to be retrieved.



$getMembers<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entry members of the current document or only the properties set by the query function.


Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the members to be retrieved.



$getMembers<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entire members of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its members.

requestOptions RequestOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the members to be retrieved.



$getMembers<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieved the entire members of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its members.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the members to be retrieved.



.$listChildren()
: Promise<(T & CarbonLDP.Document)[]>


$listChildren<T extends object>( requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Retrieves the shallow children of the current document.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$listChildren<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Retrieves the shallow children of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to retrieve its shallow children.

requestOptions RequestOptions

Customizable options for the request.



.$listMembers()
: Promise<(T & CarbonLDP.Document)[]>


$listMembers<T extends object>( requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Retrieves the shallow members of the current document.


Param Type Default Description
requestOptions RequestOptions

Customizable options for the request.



$listMembers<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Retrieves the shallow members of the document of the specified URI


Param Type Default Description
uri string

URI of the document to retrieve its shallow members.

requestOptions RequestOptions

Customizable options for the request.



.$resolve()
: Promise<T & this & CarbonLDP.Document>


$resolve<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>

Resolves the specific properties of the current document set by the query function.


Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be resolved.



$resolve<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>

Resolves the entire current document or only the properties set by the query function when provided.


Param Type Default Description
requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be resolved.



$resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Resolves the properties of the document of the URI specified set by the query function.


Param Type Default Description
document Document

Document to be resolved.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be resolved.



$resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Resolves the entire document of the URI specified or only the properties set by the query function when provided.


Param Type Default Description
document Document

Document to be resolved.

requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be resolved.








Trait of a CarbonLDP.Document with methods for SPARQL requests.


Properties

.$repository
: CarbonLDP.DocumentsRepository.Traits.SPARQLDocumentsRepositoryTrait

Repository trait that actually executes the request of the current trait.


Methods

.$executeASKQuery()
: Promise<boolean>


$executeASKQuery( uri:string, askQuery:string, requestOptions?:RequestOptions ):Promise<boolean>

Executes an ASK query on the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to execute the query.

askQuery string

ASK query to be executed.

requestOptions RequestOptions

Customizable options for the request.



$executeASKQuery( askQuery:string, requestOptions?:RequestOptions ):Promise<boolean>

Execute an ASK query on the current document.


Param Type Default Description
askQuery string

ASK query to be executed.

requestOptions RequestOptions

Customizable options for the request.



.$executeSELECTQuery()
: Promise<CarbonLDP.SPARQL.SPARQLSelectResults<T>>


$executeSELECTQuery<T extends object>( uri:string, selectQuery:string, requestOptions?:RequestOptions ):Promise<SPARQLSelectResults<T>>

Executes a SELECT query on the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to execute the query.

selectQuery string

SELECT query to be executed.

requestOptions RequestOptions

Customizable options for the request.



$executeSELECTQuery<T extends object>( selectQuery:string, requestOptions?:RequestOptions ):Promise<SPARQLSelectResults<T>>

Executes a SELECT query in the current document.


Param Type Default Description
selectQuery string

SELECT query to be executed.

requestOptions RequestOptions

Customizable options for the request.



.$executeUPDATE()
: Promise<void>


$executeUPDATE( uri:string, update:string, requestOptions?:RequestOptions ):Promise<void>

Executes an UPDATE in the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to execute the update.

update string

UPDATE to be executed.

requestOptions RequestOptions

Customizable options for the request.



$executeUPDATE( update:string, requestOptions?:RequestOptions ):Promise<void>

Executes an UPDATE in the current document.


Param Type Default Description
update string

UPDATE to be executed.

requestOptions RequestOptions

Customizable options for the request.



.$sparql()
: QueryClause<CarbonLDP.SPARQL.FinishSPARQLSelect, CarbonLDP.SPARQL.FinishSPARQLAsk>


$sparql( uri?:string ):QueryClause<FinishSPARQLSelect, FinishSPARQLAsk>

Creates an instance of SPARQLER builder for the current document or the one specified by the URI.


Param Type Default Description
uri string

URI of the document from where to create the query builder.











Properties for creating a CarbonLDP.DocumentsRegistry.


Properties

.context
: CarbonLDP.DocumentsContext

Context from where the registry is been created.





Registry that manages CarbonLDP.Document's.


Properties

.context
: CarbonLDP.DocumentsContext

Context where the registry belongs to.


Methods

.register()
: CarbonLDP.Document


register( id:string ):Document

Register a document endpoint that already exists in the platform.


Param Type Default Description
id string

The URI of the document to be registered.








Interfaces

I
CarbonLDP.DocumentsRepository
Repository for request related to CarbonLDP.Document's.

Type Aliases


Reexports


Properties

Methods

#_getErrorResponseParserFn()
: (error: CarbonLDP.HTTP.Errors.HTTPError | Error) => Promise<never>


_getErrorResponseParserFn( registry:DocumentsRegistry ):(error: HTTPError | Error) => Promise<never>

Returns a function that can parse a CarbonLDP.HTTP.Errors.HTTPError into a CarbonLDP.LDP.ErrorResponse inside a rejected Promise.


Param Type Default Description
registry DocumentsRegistry

The registry from where to get the information to convert the CarbonLDP.HTTP.Errors.HTTPError.response's data.



#_parseResourceParams()
: { _resource: CarbonLDP.ResolvablePointer; _args: any[]; }


_parseResourceParams<T>( resource:ResolvablePointer, $resource?:ResolvablePointer | T, args?:IArguments ):{
									    _resource: ResolvablePointer;
									    _args: any[];
									}

Parse the arguments of a relative repository method detecting if has a valid resource if not, the resource will be the one provided by the param resource.


Param Type Default Description
resource ResolvablePointer

The resource from where is executing the repository method.

$resource ResolvablePointer | T

The possible target resource to be selected or another argument.

args IArguments

All the arguments of the repository method that is been executed.



#_parseURIParams()
: { _uri: string; _args: any[]; }


_parseURIParams<T>( resource:ResolvablePointer, uri?:string | T, args?:IArguments ):{
									    _uri: string;
									    _args: any[];
									}

Parse the arguments of a relative repository method detecting if has a valid URI if not, the URI will be taken from the resource provided.


Param Type Default Description
resource ResolvablePointer

The resource from where is executing the repository method.

uri string | T

The possible URI to be selected or another argument.

args IArguments

All the arguments of the repository method that is been executed.





Properties for creating a CarbonLDP.DocumentsRepository.


Properties

.context
: CarbonLDP.DocumentsContext

Context from where the repository will be created.





Repository for request related to CarbonLDP.Document's.


Properties

.context
: CarbonLDP.DocumentsContext

Context where the repository belongs to.


Methods

.delete()
: Promise<void>


delete( uri:string, requestOptions?:RequestOptions ):Promise<void>

Param Type Default Description
uri string
requestOptions RequestOptions


.exists()
: Promise<boolean>


exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>

Param Type Default Description
uri string
requestOptions RequestOptions


.get()
: Promise<T & CarbonLDP.Document>


get<T extends object>( uri:string, requestOptions?:GETOptions ):Promise<T & Document>

Param Type Default Description
uri string
requestOptions GETOptions


get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
uri string
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


get<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
uri string
requestOptions RequestOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Param Type Default Description
uris string[]
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Param Type Default Description
uris string[]
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


.refresh()
: Promise<T & CarbonLDP.Document>


refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Param Type Default Description
document Document
requestOptions RequestOptions


.resolve()
: Promise<T & CarbonLDP.Document>


resolve<T extends object>( document:Document, requestOptions?:GETOptions ):Promise<T & Document>

Param Type Default Description
document Document
requestOptions GETOptions


resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
document Document
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


resolve<T extends object>( document:Document, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Param Type Default Description
document Document
requestOptions RequestOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


.save()
: Promise<T & CarbonLDP.Document>


save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Param Type Default Description
document Document
requestOptions RequestOptions


.saveAndRefresh()
: Promise<T & CarbonLDP.Document>


saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Param Type Default Description
document Document
requestOptions RequestOptions







Interfaces


Type Aliases


Properties




Trait of a CarbonLDP.DocumentsRepository with methods for event subscriptions.


Properties

.context
: CarbonLDP.DocumentsContext

Context from where the repository is created.


Methods

.off()
: void


off( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the child created event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.CHILD_CREATED

Child created event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that was used to subscribe to the child created event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



off( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the document modified event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that was used to subscribe to the document modified event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



off( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the document deleted event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that was used to subscribe to the document deleted event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



off( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the member added event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that was used to subscribe to the member added event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



off( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Removes the subscription of the member removed event and onEvent callback for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that was used to subscribe to the member removed event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



off( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Removes the subscription of the specified event and onEvent callback for the desired URI pattern.


Param Type Default Description
event string

Event of the subscription to be removed.

uriPattern string

URI or pattern of the resources to unsubscribe for.

onEvent (message: EventMessage) => void

Callback that was used to subscribe to the specified event.

onError (error: Error) => void

Callback that will receive any error in the subscription removal.



.on()
: void


on( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the child created event for the desired URI pattern.


Param Type Default Description
event Event.CHILD_CREATED

Child created event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



on( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document modified event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



on( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document deleted event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



on( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member added event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



on( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member removed event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



on( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Subscribe to the specified event for the desired URI pattern.


Param Type Default Description
event string

Event to subscribe for its notifications.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: EventMessage) => void

Callback that will receive the notification message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.onChildCreated()
: void


onChildCreated( uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the child created event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.onDocumentDeleted()
: void


onDocumentDeleted( uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document deleted event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.onDocumentModified()
: void


onDocumentModified( uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the document modified event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.onMemberAdded()
: void


onMemberAdded( uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member added event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.onMemberRemoved()
: void


onMemberRemoved( uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to the member removed event for the desired URI pattern.


Param Type Default Description
uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed event message when an event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



.one()
: void


one( event:Event.CHILD_CREATED, uriPattern:string, onEvent:(message: ChildCreatedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the child created event for the desired URI pattern.


Param Type Default Description
event Event.CHILD_CREATED

Child created event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: ChildCreatedEvent) => void

Callback that will receive the child created event message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



one( event:Event.DOCUMENT_MODIFIED, uriPattern:string, onEvent:(message: DocumentModifiedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the document modified event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_MODIFIED

Document modified event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentModifiedEvent) => void

Callback that will receive the document modified message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



one( event:Event.DOCUMENT_DELETED, uriPattern:string, onEvent:(message: DocumentDeletedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the document deleted event for the desired URI pattern.


Param Type Default Description
event Event.DOCUMENT_DELETED

Document deleted event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: DocumentDeletedEvent) => void

Callback that will receive the document deleted message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



one( event:Event.MEMBER_ADDED, uriPattern:string, onEvent:(message: MemberAddedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the member added event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_ADDED

Member added event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberAddedEvent) => void

Callback that will receive the member added message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



one( event:Event.MEMBER_REMOVED, uriPattern:string, onEvent:(message: MemberRemovedEvent) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the member removed event for the desired URI pattern.


Param Type Default Description
event Event.MEMBER_REMOVED

Member removed event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: MemberRemovedEvent) => void

Callback that will receive the member removed message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.



one( event:string, uriPattern:string, onEvent:(message: EventMessage) => void, onError?:(error: Error) => void ):void

Subscribe to only one notification of the specified event for the desired URI pattern.


Param Type Default Description
event string

Event to subscribe for one notification.

uriPattern string

URI or pattern of the resources to subscribe for.

onEvent (message: EventMessage) => void

Callback that will receive the notification message when the event occurs.

onError (error: Error) => void

Callback that will receive any error in the subscription.








Extends:

Trait of a CarbonLDP.DocumentsRepository with base methods of every REST repository.


Properties

.context
: CarbonLDP.Context<MODEL & CarbonLDP.RegisteredPointer, MODEL>

Context from where the repository is created.


Methods

._parseResponseData()
: Promise<T & MODEL>


_parseResponseData<T extends object>( response:Response, id:string ):Promise<T & MODEL>

Method that parses the CarbonLDP.HTTP.Response of a retrieval request into the desired resource model. This method must be overridden in the specialized repositories in accordance of its model since, the current behaviour only creates a shallow pointer in the associated CarbonLDP.Registry.


Param Type Default Description
response Response

The response to be parsed into a resource model.

id string

The identification of the resource, commonly the URL of the resource.



.delete()
: Promise<void>


delete( uri:string, requestOptions?:RequestOptions ):Promise<void>

Deletes the resource of the specified URI.


Param Type Default Description
uri string

URI of the resource to be deleted.

requestOptions RequestOptions

Customizable options for the request.



.exists()
: Promise<boolean>


exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>

Checks if the resource of the specified URI exists.


Param Type Default Description
uri string

The URI of the resource to check its existence.

requestOptions RequestOptions

Customizable options for the request.



.get()
: Promise<T & MODEL>


get<T extends object>( uri:string, requestOptions?:GETOptions ):Promise<T & MODEL>

Retrieves the resource of the specified URI.


Param Type Default Description
uri string

The URI of the resource to be retrieved.

requestOptions GETOptions

Customizable options for the request.



.refresh()
: Promise<T & MODEL>


refresh<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>

Refreshes with the latest data of the specified resource.


Param Type Default Description
resource MODEL

The resource to be refreshed.

requestOptions RequestOptions

Customizable options for the request.



.resolve()
: Promise<T & MODEL>


resolve<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>

Resolves the specified resource.


Param Type Default Description
resource MODEL

The resource to be resolved.

requestOptions RequestOptions

Customizable options for the request.



.save()
: Promise<T & MODEL>


save<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>

Saves the changes of the specified resource.


Param Type Default Description
resource MODEL

The resource to be saved.

requestOptions RequestOptions

Customizable options for the request.



.saveAndRefresh()
: Promise<T & MODEL>


saveAndRefresh<T extends object>( resource:MODEL, requestOptions?:RequestOptions ):Promise<T & MODEL>

Saves the changes of the specified resource and retrieves its latest changes.


Param Type Default Description
resource MODEL

The resource to saved and refreshed.

requestOptions RequestOptions

Customizable options for the request.








Trait of a CarbonLDP.DocumentsRepository with methods for LDP related requests.


Properties

.context
: CarbonLDP.DocumentsContext

Context from where the repository is created.


Methods

._parseResponseData()
: Promise<T & CarbonLDP.Document>


_parseResponseData<T extends object>( response:Response, id:string ):Promise<T & Document>

Override method to parse the data that is a JSON-LD Document into the CarbonLDP.Document model.


Param Type Default Description
response Response
id string


.addMember()
: Promise<void>


addMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>

Adds the provided resource as member of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to add the member.

member string | Pointer

Resource to be added as member.

requestOptions RequestOptions

Customizable options for the request.



.addMembers()
: Promise<void>


addMembers( uri:string, members:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>

Adds the provided resources as members of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to add the members.

members (string | Pointer)[]

Resources to be added as members.

requestOptions RequestOptions

Customizable options for the request.



.create()
: Promise<(T & CarbonLDP.Document)[]>


create<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

requestOptions RequestOptions

Customizable options for the request.



create<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

slugs string[]

Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided.

requestOptions RequestOptions

Customizable options for the request.



create<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

requestOptions RequestOptions

Customizable options for the request.



create<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

slug string

Suggested slug for the child URI.

requestOptions RequestOptions

Customizable options for the request.



.createAndRetrieve()
: Promise<(T & CarbonLDP.Document)[]>


createAndRetrieve<T extends object>( uri:string, children:T[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

requestOptions RequestOptions

Customizable options for the request.



createAndRetrieve<T extends object>( uri:string, children:T[], slugs?:string[], requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Persists multiple objects as children of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the children.

children T[]

Objects to be persisted.

slugs string[]

Suggested slugs for every child URI of the children provided. The slug will be assigned in the order they are provided.

requestOptions RequestOptions

Customizable options for the request.



createAndRetrieve<T extends object>( uri:string, child:T, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

requestOptions RequestOptions

Customizable options for the request.



createAndRetrieve<T extends object>( uri:string, child:T, slug?:string, requestOptions?:RequestOptions ):Promise<T & Document>

Persists the object as a child of the document of the specified URI and retrieves the updated data from the server.


Param Type Default Description
uri string

URI of the document where to create the child.

child T

Object to be persisted.

slug string

Suggested slug for the child URI.

requestOptions RequestOptions

Customizable options for the request.



.delete()
: Promise<void>


delete( uri:string, requestOptions?:RequestOptions ):Promise<void>

Deletes the document of the specified URI.


Param Type Default Description
uri string

URI of the document to be deleted.

requestOptions RequestOptions

Customizable options for the request.



.get()
: Promise<T & CarbonLDP.Document>


get<T extends object>( uri:string, requestOptions?:GETOptions ):Promise<T & Document>

Retrieves the entire document of the URI specified.


Param Type Default Description
uri string

URI of the document to be retrieved.

requestOptions GETOptions

Customizable options for the request.



.refresh()
: Promise<T & CarbonLDP.Document>


refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Refreshes with the latest data of the specified document.


Param Type Default Description
document Document

The document to be refreshed.

requestOptions RequestOptions

Customizable options for the request.



.removeMember()
: Promise<void>


removeMember( uri:string, member:string | Pointer, requestOptions?:RequestOptions ):Promise<void>

Removes the provided resource as member of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to remove the member.

member string | Pointer

Resource to be removed as member.

requestOptions RequestOptions

Customizable options for the request.



.removeMembers()
: Promise<void>


removeMembers( uri:string, members?:(string | Pointer)[], requestOptions?:RequestOptions ):Promise<void>

Removes the provided resources as members of the document of the specified URI. IF no members is provided all the members of the specified document will be removed.


Param Type Default Description
uri string

URI of the document to remove the members.

members (string | Pointer)[]

Resources to be removed as members.

requestOptions RequestOptions

Customizable options for the request.



removeMembers( uri:string, requestOptions?:RequestOptions ):Promise<void>

Removes all the members of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to remove its members.

requestOptions RequestOptions

Customizable options for the request.



.resolve()
: Promise<T & CarbonLDP.Document>


resolve<T extends object>( document:Document, requestOptions?:GETOptions ):Promise<T & Document>

Resolves the entire document of the URI specified.


Param Type Default Description
document Document

Document to be resolved.

requestOptions GETOptions

Customizable options for the request.



.save()
: Promise<T & CarbonLDP.Document>


save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Saves the changes of the specified document.


Param Type Default Description
document Document

The document to be saved.

requestOptions RequestOptions

Customizable options for the request.



.saveAndRefresh()
: Promise<T & CarbonLDP.Document>


saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Saves the changes of the specified document and retrieves its latest changes.


Param Type Default Description
document Document

The resource to saved and refreshed.

requestOptions RequestOptions

Customizable options for the request.








Trait of a CarbonLDP.DocumentsRepository with methods for advanced reading requests.


Methods

.get()
: Promise<T & CarbonLDP.Document>


get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Retrieves the properties of the document of the URI specified set by the query function.


Param Type Default Description
uri string

URI of the document to be retrieved.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be retrieved.



get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Retrieves the entire document of the URI specified or only the properties set by the query function when provided.


Param Type Default Description
uri string

URI of the document to be retrieved.

requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be retrieved.



get<T extends object>( uris:string[], queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Retrieves the properties set by the query function, of the documents specified.


Param Type Default Description
uris string[]

URIs of the documents to be retrieved.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the documents to be retrieved.



get<T extends object>( uris:string[], requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<(T & Document)[]>

Retrieves the entire documents of the URIs specified or only the properties set by the query function when provided.


Param Type Default Description
uris string[]

URIs of the documents to be retrieved.

requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the documents to be retrieved.



.getChildren()
: Promise<(T & CarbonLDP.Document)[]>


getChildren<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entire children of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its children.

requestOptions RequestOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the children to be retrieved.



getChildren<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieved the entire children of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its children.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the children to be retrieved.



.getMembers()
: Promise<(T & CarbonLDP.Document)[]>


getMembers<T extends object>( uri:string, requestOptions:RequestOptions, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieves the entire members of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its members.

requestOptions RequestOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the members to be retrieved.



getMembers<T extends object>( uri:string, queryBuilderFn?:(queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder ):Promise<(T & Document)[]>

Retrieved the entire members of the document of the specified URI or only the properties set by the query function.


Param Type Default Description
uri string

URI of the document to retrieve its members.

queryBuilderFn (queryBuilder: QueryDocumentsBuilder) => QueryDocumentsBuilder

Function that specify the structure of the members to be retrieved.



.listChildren()
: Promise<(T & CarbonLDP.Document)[]>


listChildren<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Retrieves the shallow children of the document of the specified URI.


Param Type Default Description
uri string

URI of the document to retrieve its shallow children.

requestOptions RequestOptions

Customizable options for the request.



.listMembers()
: Promise<(T & CarbonLDP.Document)[]>


listMembers<T extends object>( uri:string, requestOptions?:RequestOptions ):Promise<(T & Document)[]>

Retrieves the shallow members of the document of the specified URI


Param Type Default Description
uri string

URI of the document to retrieve its shallow members.

requestOptions RequestOptions

Customizable options for the request.



.refresh()
: Promise<T & CarbonLDP.Document>


refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Refreshes with the latest data of the specified document. If the document was retrieved partially, only the partial properties will be refreshed.


Param Type Default Description
document Document

The document to be refreshed.

requestOptions RequestOptions

Customizable options for the request.



.resolve()
: Promise<T & CarbonLDP.Document>


resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Resolves the properties of the document of the URI specified set by the query function.


Param Type Default Description
document Document

Document to be resolved.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be resolved.



resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Resolves the entire document of the URI specified or only the properties set by the query function when provided.


Param Type Default Description
document Document

Document to be resolved.

requestOptions GETOptions

Customizable options for the request.

queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder

Function that specify the structure of the document to be resolved.



.saveAndRefresh()
: Promise<T & CarbonLDP.Document>


saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Saves the changes of the specified document and retrieves its latest changes. If the document was retrieved partially, only the partial properties will be refreshed.


Param Type Default Description
document Document

The resource to saved and refreshed.

requestOptions RequestOptions

Customizable options for the request.








Trait of a CarbonLDP.DocumentsRepository with methods for SPARQL requests.


Properties

.context
: CarbonLDP.DocumentsContext

Context from where the repository is created.


Methods

.executeASKQuery()
: Promise<boolean>


executeASKQuery( uri:string, askQuery:string, requestOptions?:RequestOptions ):Promise<boolean>

Executes an ASK query on the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to execute the query.

askQuery string

ASK query to be executed.

requestOptions RequestOptions

Customizable options for the request.



.executeSELECTQuery()
: Promise<CarbonLDP.SPARQL.SPARQLSelectResults<T>>


executeSELECTQuery<T extends object>( uri:string, selectQuery:string, requestOptions?:RequestOptions ):Promise<SPARQLSelectResults<T>>

Executes a SELECT query on the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to execute the query.

selectQuery string

SELECT query to be executed.

requestOptions RequestOptions

Customizable options for the request.



.executeUPDATE()
: Promise<void>


executeUPDATE( uri:string, update:string, requestOptions?:RequestOptions ):Promise<void>

Executes an UPDATE in the document of the specified URI.


Param Type Default Description
uri string

URI of the document where to execute the update.

update string

UPDATE to be executed.

requestOptions RequestOptions

Customizable options for the request.



.sparql()
: QueryClause<CarbonLDP.SPARQL.FinishSPARQLSelect, CarbonLDP.SPARQL.FinishSPARQLAsk>


sparql( uri:string ):QueryClause<FinishSPARQLSelect, FinishSPARQLAsk>

Creates an instance of SPARQLER builder for the current document or the one specified by the URI.


Param Type Default Description
uri string

URI of the document from where to create the query builder.








Classes

C
CarbonLDP.Errors.AbstractError
Class that works as template for the custom errors in the SDK.
C
CarbonLDP.Errors.IDAlreadyInUseError
Error class to indicate that an identifier (ID) is already in use.
C
CarbonLDP.Errors.IllegalActionError
Error class to indicate that an action not allowed was attempted.
C
CarbonLDP.Errors.IllegalArgumentError
Error class to indicate that a different argument than the expected was provided.
C
CarbonLDP.Errors.IllegalStateError
Error class to indicate that a task can't be completed because of the lack of pre-required configuration or execution of previous tasks.
C
CarbonLDP.Errors.InvalidJSONLDSyntaxError
Error class to indicate that there an invalid syntax in a JSON-LD object.
C
CarbonLDP.Errors.NotImplementedError
Error class to indicate that an action is not yet implemented.




Extends:
Error

Class that works as template for the custom errors in the SDK.


Constructor


AbstractError( message:string )

Param Type Default Description
message string

Properties

.message
: string


.name
: string





Error class to indicate that an identifier (ID) is already in use.


Properties

.name
: string





Error class to indicate that an action not allowed was attempted.


Properties

.name
: string





Error class to indicate that a different argument than the expected was provided.


Properties

.name
: string





Error class to indicate that a task can't be completed because of the lack of pre-required configuration or execution of previous tasks.


Constructor


IllegalStateError( message?:string )

Param Type Default Description
message string

Properties

.name
: string





Error class to indicate that there an invalid syntax in a JSON-LD object.


Properties

.name
: string





Error class to indicate that an action is not yet implemented.


Constructor


NotImplementedError( message?:string )

Param Type Default Description
message string

Properties

.name
: string





Interfaces

I
CarbonLDP.BaseResolvableFragment
Properties to create a persisted fragment.
I
CarbonLDP.BaseTransientFragment
Properties to create an in-memory fragment.
I
CarbonLDP.Fragment
Model that represents a fragment of a persisted c:Document.
I
CarbonLDP.TransientFragment
In-memory model that represents a fragment of c:Document.

Type Aliases

T
CarbonLDP.FragmentFactory
Factory, decorator and utils for CarbonLDP.Fragment.

Properties




Properties to create a persisted fragment.


Properties

.$registry
: CarbonLDP.Document

Registry the fragment will belong to.





Properties to create an in-memory fragment.


Properties

.$registry
: CarbonLDP.TransientDocument

Registry the fragment will belong to.





CarbonLDP.Fragment
Interface

Model that represents a fragment of a persisted c:Document.


Properties

.$document
: CarbonLDP.Document

The document the fragment belongs to.


.$registry
: CarbonLDP.Document

Registry where the fragment belongs to.


.$repository
: CarbonLDP.Document

Repository where the fragment can make requests.


Methods

.$delete()
: Promise<void>


$delete( requestOptions?:RequestOptions ):Promise<void>

Accessor to the CarbonLDP.Document.$delete method of the document where the fragment belongs to.


Param Type Default Description
requestOptions RequestOptions


$delete( uri:string, requestOptions?:RequestOptions ):Promise<void>

Accessor to the CarbonLDP.Document.$delete method of the document where the fragment belongs to.


Param Type Default Description
uri string
requestOptions RequestOptions


.$exists()
: Promise<boolean>


$exists( requestOptions?:RequestOptions ):Promise<boolean>

Accessor to the CarbonLDP.Document.$exists method of the document where the fragment belongs to.


Param Type Default Description
requestOptions RequestOptions


$exists( uri:string, requestOptions?:RequestOptions ):Promise<boolean>

Accessor to the CarbonLDP.Document.$exists method of the document where the fragment belongs to.


Param Type Default Description
uri string
requestOptions RequestOptions


.$get()
: Promise<T & CarbonLDP.Document>


$get<T extends object>( queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$get method of the document where the fragment belongs to.


Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$get method of the document where the fragment belongs to.


Param Type Default Description
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( uri:string, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$get method of the document where the fragment belongs to.


Param Type Default Description
uri string
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$get<T extends object>( uri:string, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$get method of the document where the fragment belongs to.


Param Type Default Description
uri string
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


.$refresh()
: Promise<T & this & CarbonLDP.Document>


$refresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this & Document>

Accessor to the CarbonLDP.Document.$refresh method of the document where the fragment belongs to.


Param Type Default Description
requestOptions RequestOptions


$refresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$refresh method of the document where the fragment belongs to.


Param Type Default Description
document Document
requestOptions RequestOptions


.$resolve()
: Promise<T & this & CarbonLDP.Document>


$resolve<T extends object>( requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>

Accessor to the CarbonLDP.Document.$resolve method of the document where the fragment belongs to.


Param Type Default Description
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$resolve<T extends object>( queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & this & Document>

Accessor to the CarbonLDP.Document.$resolve method of the document where the fragment belongs to.


Param Type Default Description
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$resolve<T extends object>( document:Document, queryBuilderFn:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$resolve method of the document where the fragment belongs to.


Param Type Default Description
document Document
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


$resolve<T extends object>( document:Document, requestOptions?:GETOptions, queryBuilderFn?:(queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$resolve method of the document where the fragment belongs to.


Param Type Default Description
document Document
requestOptions GETOptions
queryBuilderFn (queryBuilder: QueryDocumentBuilder) => QueryDocumentBuilder


.$save()
: Promise<T & this & CarbonLDP.Document>


$save<T extends object>( requestOptions?:RequestOptions ):Promise<T & this & Document>

Accessor to the CarbonLDP.Document.$save method of the document where the fragment belongs to.


Param Type Default Description
requestOptions RequestOptions


$save<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$save method of the document where the fragment belongs to.


Param Type Default Description
document Document
requestOptions RequestOptions


.$saveAndRefresh()
: Promise<T & this & CarbonLDP.Document>


$saveAndRefresh<T extends object>( requestOptions?:RequestOptions ):Promise<T & this & Document>

Accessor to the CarbonLDP.Document.$saveAndRefresh method of the document where the fragment belongs to.


Param Type Default Description
requestOptions RequestOptions


$saveAndRefresh<T extends object>( document:Document, requestOptions?:RequestOptions ):Promise<T & Document>

Accessor to the CarbonLDP.Document.$saveAndRefresh method of the document where the fragment belongs to.


Param Type Default Description
document Document
requestOptions RequestOptions







In-memory model that represents a fragment of c:Document.


Properties

.$document
: CarbonLDP.TransientDocument

The document the fragment belongs to.


.$registry
: CarbonLDP.TransientDocument

Registry where the fragment belongs to.














Model that represents resources that doesn't have a context.


Properties

.registry
: CarbonLDP.GeneralRegistry<any>

Registry where the CarbonLDP.FreeResources scope is in.


Methods

._addPointer()
: T & CarbonLDP.Resource


_addPointer<T extends object>( base:T & Partial<Pointer> ):T & Resource

Param Type Default Description
base T & Partial<Pointer>


._getLocalID()
: string


_getLocalID( id:string ):string

Param Type Default Description
id string


.toJSON()
: CarbonLDP.RDF.RDFNode[]


toJSON( contextOrKey?:string | Context<RegisteredPointer, ResolvablePointer> ):RDFNode[]

Returns the JSON-LD representation of the every resources inside an array.


Param Type Default Description
contextOrKey string | Context<RegisteredPointer, ResolvablePointer>

A specific context to use for expand the data into JSON-LD instead of the internal one.









Methods

.parseFreeNodes()
: CarbonLDP.FreeResources


parseFreeNodes( registry:GeneralRegistry<any>, freeNodes:RDFNode[] ):FreeResources

Param Type Default Description
registry GeneralRegistry<any>
freeNodes RDFNode[]







Extends:
BaseRegistry

Properties for create a CarbonLDP.GeneralRegistry.


Properties

.context
: CarbonLDP.Context

Context where the registry will belong to.


.registry
: CarbonLDP.GeneralRegistry | undefined

Optional parent registry used to inherit resources and more data.





Base registry used by CarbonLDP.Context.


Properties

.__modelDecorators
: Map<string, CarbonLDP.TypedModelDecorator>

Map that stores the decorators in the registry.


.context
: CarbonLDP.Context<M>

Context where the registry belongs to.


.registry
: CarbonLDP.GeneralRegistry | undefined

Parent registry used to inherit resources and more data.


Methods

._addPointer()
: T & M


_addPointer<T extends object>( pointer:T & Pointer ):T & M

Param Type Default Description
pointer T & Pointer


._getLocalID()
: string


_getLocalID( id:string ):string

Param Type Default Description
id string


.addDecorator()
: this


addDecorator( decorator:TypedModelDecorator ):this

Stores a decorator in the current registry.


Param Type Default Description
decorator TypedModelDecorator

The information of the decorator to store.



.decorate()
: void


decorate( object:{ types?: string[]; } ):void

Applies the corresponding decorators in the entire registry tree.


Param Type Default Description
object { types?: string[]; }

with an array of types used to match the decorator to be applied.








Extends:

Object that has implements a model decorator for an specific type defined by the property CarbonLDP.TypedModelDecorator.TYPE.


Properties

.TYPE
: string

The type associated to the model decorator methods.








Properties for create a CarbonLDP.GeneralRepository


Properties

.context
: CarbonLDP.Context<MODEL & CarbonLDP.RegisteredPointer, MODEL>

Context where the repository will belong to.





Extends:

Base repository used by CarbonLDP.Context.


Properties

.context
: CarbonLDP.Context<MODEL & CarbonLDP.RegisteredPointer, MODEL>

Context where the repository belongs to.








Classes

C
CarbonLDP.HTTP.Header
Class to manage the values in an HTTP header.
C
CarbonLDP.HTTP.JSONParser
Wrapper class for the native JSON.parse() function using the Promise pattern.
C
CarbonLDP.HTTP.RequestService
Service with static methods to send HTTP request.
C
CarbonLDP.HTTP.RequestUtils
Service with static utils methods for elements related to requests.
C
CarbonLDP.HTTP.Response
Class that represents an HTTP response.
C
CarbonLDP.HTTP.StringParser
Parser that only wraps the response body into a Promise.

Interfaces

I
CarbonLDP.HTTP.GETOptions
Customizable options for a GET request.
I
CarbonLDP.HTTP.Parser
Interface that represents a what a parser must contains to be used when converting the response of a request.
I
CarbonLDP.HTTP.RequestOptions
Customizable options that can change the behaviour of a request.
I
CarbonLDP.HTTP.RetrievalPreferences
Object used by CarbonLDP.HTTP.RequestUtils#setRetrievalPreferences which specifies the behaviour of a request when using an ldp:Container interaction model.

Reexports


.HTTPMethod
: enum

Enum for the HTTP/1.1 methods.

Enumeration Description
CarbonLDP.HTTP.HTTPMethod.OPTIONS

Identifies the OPTIONS HTTP/1.1 method, which allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

CarbonLDP.HTTP.HTTPMethod.HEAD

Identifies the HEAD HTTP/1.1 method, which returns only the headers of a GET HTTP request.

CarbonLDP.HTTP.HTTPMethod.GET

Identifies the GET HTTP/1.1 method, which returns whatever information is identified by the request URI.

CarbonLDP.HTTP.HTTPMethod.POST

Identifies the POST HTTP/1.1 method, which requests to the server to create a new entity.

CarbonLDP.HTTP.HTTPMethod.PUT

Identifies the PUT HTTP/1.1 method, which allows you to replace an entirely entity, or to send a signal to a resource.

CarbonLDP.HTTP.HTTPMethod.PATCH

Identifies the PATCH HTTP/1.1 method, which allows you to update specified fields of an entity.

CarbonLDP.HTTP.HTTPMethod.DELETE

Identifies the DELETE HTTP/1.1 method, which allows you to request the deletion of a resource identified by the request URI.

.StatusCode
: enum

Enum with the HTTP/1.1 status codes.

Enumeration Description
CarbonLDP.HTTP.StatusCode.CONTINUE

Identifies the HTTP/1.1 100 status code.

CarbonLDP.HTTP.StatusCode.SWITCHING_PROTOCOLS

Identifies the HTTP/1.1 101 status code.

CarbonLDP.HTTP.StatusCode.OK

Identifies the HTTP/1.1 200 status code.

CarbonLDP.HTTP.StatusCode.CREATED

Identifies the HTTP/1.1 201 status code.

CarbonLDP.HTTP.StatusCode.ACCEPTED

Identifies the HTTP/1.1 202 status code.

CarbonLDP.HTTP.StatusCode.NON_AUTHORITATIVE_INFORMATION

Identifies the HTTP/1.1 203 status code.

CarbonLDP.HTTP.StatusCode.NO_CONTENT

Identifies the HTTP/1.1 204 status code.

CarbonLDP.HTTP.StatusCode.RESET_CONTENT

Identifies the HTTP/1.1 205 status code.

CarbonLDP.HTTP.StatusCode.PARTIAL_CONTENT

Identifies the HTTP/1.1 206 status code.

CarbonLDP.HTTP.StatusCode.MULTIPLE_CHOICES

Identifies the HTTP/1.1 300 status code.

CarbonLDP.HTTP.StatusCode.MOVED_PERMANENTLY

Identifies the HTTP/1.1 301 status code.

CarbonLDP.HTTP.StatusCode.FOUND

Identifies the HTTP/1.1 302 status code.

CarbonLDP.HTTP.StatusCode.SEE_OTHER

Identifies the HTTP/1.1 303 status code.

CarbonLDP.HTTP.StatusCode.NOT_MODIFIED

Identifies the HTTP/1.1 304 status code.

CarbonLDP.HTTP.StatusCode.USE_PROXY

Identifies the HTTP/1.1 305 status code.

CarbonLDP.HTTP.StatusCode.TEMPORARY_REDIRECT

Identifies the HTTP/1.1 307 status code.

CarbonLDP.HTTP.StatusCode.BAD_REQUEST

Identifies the HTTP/1.1 400 status code.

CarbonLDP.HTTP.StatusCode.UNAUTHORIZED

Identifies the HTTP/1.1 401 status code.

CarbonLDP.HTTP.StatusCode.PAYMENT_REQUIRED

Identifies the HTTP/1.1 402 status code.

CarbonLDP.HTTP.StatusCode.FORBIDDEN

Identifies the HTTP/1.1 403 status code.

CarbonLDP.HTTP.StatusCode.NOT_FOUND

Identifies the HTTP/1.1 404 status code.

CarbonLDP.HTTP.StatusCode.METHOD_NOT_ALLOWED

Identifies the HTTP/1.1 405 status code.

CarbonLDP.HTTP.StatusCode.NOT_ACCEPTABLE

Identifies the HTTP/1.1 406 status code.

CarbonLDP.HTTP.StatusCode.PROXY_AUTHENTICATION_REQUIRED

Identifies the HTTP/1.1 407 status code.

CarbonLDP.HTTP.StatusCode.REQUEST_TIME_OUT

Identifies the HTTP/1.1 408 status code.

CarbonLDP.HTTP.StatusCode.CONFLICT

Identifies the HTTP/1.1 409 status code.

CarbonLDP.HTTP.StatusCode.GONE

Identifies the HTTP/1.1 410 status code.

CarbonLDP.HTTP.StatusCode.LENGTH_REQUIRED

Identifies the HTTP/1.1 411 status code.

CarbonLDP.HTTP.StatusCode.PRECONDITION_FAILED

Identifies the HTTP/1.1 412 status code.

CarbonLDP.HTTP.StatusCode.REQUEST_ENTITY_TOO_LARGE

Identifies the HTTP/1.1 413 status code.

CarbonLDP.HTTP.StatusCode.REQUEST_URI_TOO_LARGE

Identifies the HTTP/1.1 414 status code.

CarbonLDP.HTTP.StatusCode.UNSUPPORTED_MEDIA_TYPE

Identifies the HTTP/1.1 415 status code.

CarbonLDP.HTTP.StatusCode.REQUESTED_RANGE_NOT_SATISFIABLE

Identifies the HTTP/1.1 416 status code.

CarbonLDP.HTTP.StatusCode.EXPECTATION_FAILED

Identifies the HTTP/1.1 417 status code.

CarbonLDP.HTTP.StatusCode.INTERNAL_SERVER_ERROR

Identifies the HTTP/1.1 500 status code.

CarbonLDP.HTTP.StatusCode.NOT_IMPLEMENTED

Identifies the HTTP/1.1 501 status code.

CarbonLDP.HTTP.StatusCode.BAD_GATEWAY

Identifies the HTTP/1.1 502 status code.

CarbonLDP.HTTP.StatusCode.SERVICE_UNAVAILABLE

Identifies the HTTP/1.1 503 status code.

CarbonLDP.HTTP.StatusCode.GATEWAY_TIME_OUT

Identifies the HTTP/1.1 504 status code.

CarbonLDP.HTTP.StatusCode.HTTP_VERSION_NOT_SUPPORTED

Identifies the HTTP/1.1 505 status code.




Customizable options for a GET request.


Properties

.ensureLatest
: boolean

Flag that ignores the cache of the SDK and ensures to make a request.





Class to manage the values in an HTTP header.


Constructor


Header( values?:string | string[] )

Create an instance with an array of values or a string that will be parsed into the multiple values that may contain.


Param Type Default Description
values string | string[]

The array of values of the string to be parsed.


Properties

.values
: string[]

Array with each value of the header.


Methods

#__parseValues()
: string[]


__parseValues( strValues:string ):string[]

Param Type Default Description
strValues string


#parseHeaders()
: Map<string, CarbonLDP.HTTP.Header>


parseHeaders( headersString:string ):Map<string, Header>

Returns a Map which relates all header names with a CarbonLDP.HTTP.Header object containing their values.


Param Type Default Description
headersString string

The string to be parsed into a map of name -> Header.


.addValue()
: void


addValue( value:string ):void

Parse and add the string value(s) into the current header.


Param Type Default Description
value string

Value or values to add.



.hasValue()
: boolean


hasValue( value:string ):boolean

Returns true when the specified value exists in the values stored.


Param Type Default Description
value string

The value to check if is stored.



.toString()
: string


toString():string

Returns the string representation of all the values of the headers.






Implements:

Wrapper class for the native JSON.parse() function using the Promise pattern.


Methods

.parse()
: Promise<object>


parse( body:string ):Promise<object>

Parses a JSON string into JavaScript object.


Param Type Default Description
body string

The JSON string to be parsed.





Interface that represents a what a parser must contains to be used when converting the response of a request.


Methods

.parse()
: Promise<T>


parse( body:string ):Promise<T>

Parses the provided string to a specified T element.


Param Type Default Description
body string

The body string of the request to parse.





Customizable options that can change the behaviour of a request.


Properties

.headers
: Map<string, CarbonLDP.HTTP.Header>

Map that contains the headers to include in the request.


.request
: XMLHttpRequest

Specific XMLHttpRequest to be used for the request.


.sendCredentialsOnCORS
: boolean

Flag that enables Cross-Origin Resource Sharing (CORS).


.timeout
: number

Timeout of the request.





Service with static methods to send HTTP request.


Properties

Methods

#__contentTypeIsAccepted()
: boolean


__contentTypeIsAccepted( requestOptions:RequestOptions, response:Response ):boolean

Param Type Default Description
requestOptions RequestOptions
response Response


#__handleGETResponse()
: Promise<CarbonLDP.HTTP.Response>


__handleGETResponse( url:string, requestOptions:RequestOptions, response:Response ):Promise<Response>

GET requests can be affected by previously cached resources that were originally requested with a different Accept header. This method identifies that and retries the request with headers that force browsers to ignore cache.


Param Type Default Description
url string
requestOptions RequestOptions
response Response


#__isChromiumAgent()
: boolean


__isChromiumAgent():boolean



#__setFalseETag()
: void


__setFalseETag( requestOptions:RequestOptions ):void

Param Type Default Description
requestOptions RequestOptions


#__setNoCacheHeaders()
: void


__setNoCacheHeaders( requestOptions:RequestOptions ):void

Param Type Default Description
requestOptions RequestOptions


#delete()
: any


delete( url:string, options?:RequestOptions ):Promise<Response>

Sends an DELETE request.


Param Type Default Description
url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.



delete( url:string, body:string, options?:RequestOptions ):Promise<Response>

Sends an DELETE request.


Param Type Default Description
url string

URL of the request to be sent.

body string

Body to be sent int he request.

options RequestOptions

Customizable options for the request.



delete<T>( url:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Sends an DELETE request and parses its response data.


Param Type Default Description
url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



delete<T>( url:string, body:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Sends an DELETE request and parses its response data.


Param Type Default Description
url string

URL of the request to be sent.

body string

Body to be sent int he request.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



#get()
: any


get( url:string, options?:RequestOptions ):Promise<Response>

Sends an GET request.


Param Type Default Description
url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.



get<T>( url:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Sends an GET request and parses its response data.


Param Type Default Description
url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



#head()
: Promise<CarbonLDP.HTTP.Response>


head( url:string, options:RequestOptions ):Promise<Response>

Sends an HEAD request.


Param Type Default Description
url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.



#options()
: Promise<CarbonLDP.HTTP.Response>


options( url:string, options:RequestOptions ):Promise<Response>

Sends an OPTIONS request.


Param Type Default Description
url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.



#patch()
: any


patch( url:string, body:string, options?:RequestOptions ):Promise<Response>

Sends an PATCH request.


Param Type Default Description
url string

URL of the request to be sent.

body string

Body to be sent int he request.

options RequestOptions

Customizable options for the request.



patch<T>( url:string, body:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Sends an PATCH request and parses its response data.


Param Type Default Description
url string

URL of the request to be sent.

body string

Body to be sent int he request.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



#post()
: any


post( url:string, body:any, options?:RequestOptions ):Promise<Response>

Sends an POST request.


Param Type Default Description
url string

URL of the request to be sent.

body any

Body to be sent int he request.

options RequestOptions

Customizable options for the request.



post<T>( url:string, body:any, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Sends an POST request and parses its response data.


Param Type Default Description
url string

URL of the request to be sent.

body any

Body to be sent int he request.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



#put()
: any


put( url:string, body:string, options?:RequestOptions ):Promise<Response>

Sends an PUT request.


Param Type Default Description
url string

URL of the request to be sent.

body string

Body to be sent int he request.

options RequestOptions

Customizable options for the request.



put<T>( url:string, body:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Sends an PUT request and parses its response data.


Param Type Default Description
url string

URL of the request to be sent.

body string

Body to be sent int he request.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



#send()
: any


send( method:string | HTTPMethod, url:string, options?:RequestOptions ):Promise<Response>

Generic send method, to be used by the others methods in the class.


Param Type Default Description
method string | HTTPMethod

The method of the request to be sent.

url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.



send( method:string | HTTPMethod, url:string, body:any, options?:RequestOptions ):Promise<Response>

Generic send method, to be used by the others methods in the class.


Param Type Default Description
method string | HTTPMethod

The method of the request to be sent.

url string

URL of the request to be sent.

body any

Body to be sent int he request.

options RequestOptions

Customizable options for the request.



send<T>( method:string | HTTPMethod, url:string, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Generic send method, to be used by the others methods in the class.


Param Type Default Description
method string | HTTPMethod

The method of the request to be sent.

url string

URL of the request to be sent.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.



send<T>( method:string | HTTPMethod, url:string, body:any, options?:RequestOptions, parser?:Parser<T> ):Promise<[T, Response]>

Generic send method, to be used by the others methods in the class.


Param Type Default Description
method string | HTTPMethod

The method of the request to be sent.

url string

URL of the request to be sent.

body any

Body to be sent int he request.

options RequestOptions

Customizable options for the request.

parser Parser<T>

Parser to be used in the response body of the request.





Service with static utils methods for elements related to requests.


Methods

#__addHeaderValue()
: void


__addHeaderValue( headerName:string, headerValue:string, requestOptions:RequestOptions ):void

Param Type Default Description
headerName string
headerValue string
requestOptions RequestOptions


#cloneOptions()
: CarbonLDP.HTTP.RequestOptions


cloneOptions( options:RequestOptions ):RequestOptions

Clones the options into a new object including coping the headers map into a different map.


Param Type Default Description
options RequestOptions

The options to be clones.



#getHeader()
: CarbonLDP.HTTP.Header | undefined


getHeader( headerName:string, requestOptions:RequestOptions, initialize?:true ):Header | undefined

Returns the header object inside an options object. Returns undefined if the header doesn't exists. If initialize flag is provided with true, an empty header will be created if not exits.


Param Type Default Description
headerName string

The name of the header to return/create.

requestOptions RequestOptions

The options where to look/create the header.

initialize true

Flag to create the header of not exists.



#isOptions()
: value is CarbonLDP.HTTP.RequestOptions


isOptions( value:any ):value is RequestOptions

Checks if the value provided can be considered a CarbonLDP.HTTP.RequestOptions.


Param Type Default Description
value any

The value to be checked.



#setAcceptHeader()
: CarbonLDP.HTTP.RequestOptions


setAcceptHeader( accept:string, requestOptions:RequestOptions ):RequestOptions

Sets an accept header in the options object request.


Param Type Default Description
accept string

The accept header value to be set.

requestOptions RequestOptions

The options where to set the header.



#setContentTypeHeader()
: CarbonLDP.HTTP.RequestOptions


setContentTypeHeader( contentType:string, requestOptions:RequestOptions ):RequestOptions

Sets a content-type header in the options object request.


Param Type Default Description
contentType string

The content-type header value to be set.

requestOptions RequestOptions

The options where to set the header.



#setIfMatchHeader()
: CarbonLDP.HTTP.RequestOptions


setIfMatchHeader( eTag:string, requestOptions:RequestOptions ):RequestOptions

Sets an if-match header in the options object request.


Param Type Default Description
eTag string

The if-match header value to be set.

requestOptions RequestOptions

The options where to set the header.



#setIfNoneMatchHeader()
: CarbonLDP.HTTP.RequestOptions


setIfNoneMatchHeader( eTag:string, requestOptions:RequestOptions ):RequestOptions

Sets an if-none header in the options object request.


Param Type Default Description
eTag string

The if-none header value to be set.

requestOptions RequestOptions

The options where to set the header.



#setPreferredInteractionModel()
: CarbonLDP.HTTP.RequestOptions


setPreferredInteractionModel( interactionModelURI:string, requestOptions:RequestOptions ):RequestOptions

Sets a prefer header with rel=interaction-model in the options object request.


Param Type Default Description
interactionModelURI string

The interaction-model value to be set.

requestOptions RequestOptions

The options where to set the header.



#setPreferredRetrieval()
: CarbonLDP.HTTP.RequestOptions


setPreferredRetrieval( retrievalType:"representation" | "minimal", requestOptions:RequestOptions ):RequestOptions

Sets a prefer header with return in the options object request.


Param Type Default Description
retrievalType "representation" | "minimal"

The return value to be set.

requestOptions RequestOptions

The options where to set the header.



#setRetrievalPreferences()
: CarbonLDP.HTTP.RequestOptions


setRetrievalPreferences( preferences:RetrievalPreferences, requestOptions:RequestOptions ):RequestOptions

Sets a prefer header with include/omit preferences in the options object request.


Param Type Default Description
preferences RetrievalPreferences

The preferences to be set.

requestOptions RequestOptions

The options where to set the header.



#setSlug()
: CarbonLDP.HTTP.RequestOptions


setSlug( slug:string, requestOptions:RequestOptions ):RequestOptions

Sets an slug header in the options object request.


Param Type Default Description
slug string

The slug header value to be set.

requestOptions RequestOptions

The options where to set the header.





Class that represents an HTTP response.


Constructor


Response( request:XMLHttpRequest )

Creates an instance from a XMLHttpRequest.


Param Type Default Description
request XMLHttpRequest

The XMLHttpRequest used in the Browser request.



Response( request:any, data:string, response?:any )

Creates an instance from a ClientRequest, a data and an IncomingMessage.


Param Type Default Description
request any

The ClientRequest used in the Node.js request.

data string

The full data received in the Node.js request.

response any

The IncomingMessage of the Node.js request.


Properties

.data
: string

The RAW body of the request.


.headers
: Map<string, CarbonLDP.HTTP.Header>

A map object containing the headers of the request's response.


.request
: XMLHttpRequest | ClientRequest

The XMLHttpRequest or ClientRequest provided in the constructor.


.status
: number

The status code of the request.


Methods

.getETag()
: string


getETag():string

Returns the eTag header value. If no such header exists a CarbonLDP.HTTP.Errors.BadResponseError will be thrown.




.getHeader()
: CarbonLDP.HTTP.Header | null


getHeader( name:string ):Header | null

Returns the Header object referred by the name specified. If no header exists null will be returned.


Param Type Default Description
name string

The name of the header to look for.





Object used by CarbonLDP.HTTP.RequestUtils#setRetrievalPreferences which specifies the behaviour of a request when using an ldp:Container interaction model.


Properties

.include
: string[]

Prefer URIs that indicates some specific information should be returned in the request's response.


.omit
: string[]

Prefer URIs that indicates some specific information should NOT be included in the request's response.





Implements:

Parser that only wraps the response body into a Promise.


Methods

.parse()
: Promise<string>


parse( body:string ):Promise<string>

Gets a string and returns a Promise with the same string.


Param Type Default Description
body string

The string to be wrapped.





Classes

C
CarbonLDP.HTTP.Errors.BadGatewayError
Error class to indicate that the server was acting as a gateway or proxy and received an invalid response from the upstream server.
C
CarbonLDP.HTTP.Errors.BadRequestError
Error class to indicate that a malformed request has been sent.
C
CarbonLDP.HTTP.Errors.BadResponseError
Error class to indicate that the response obtained isn't the expected or can't be interpreted.
C
CarbonLDP.HTTP.Errors.ConflictError
Error class to indicate that the request could not be processed because of a conflict, such as an ID conflict.
C
CarbonLDP.HTTP.Errors.ForbiddenError
Error class to indicate that the current user doesn't have permissions to fulfill the request.
C
CarbonLDP.HTTP.Errors.GatewayTimeoutError
Error class to indicate that the server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
C
CarbonLDP.HTTP.Errors.HTTPError
Generic error class that defines any type of HTTP Error used in the SDK.
C
CarbonLDP.HTTP.Errors.HTTPVersionNotSupportedError
Error class to indicate that the server doesn't support the HTTP protocol version used in the request.
C
CarbonLDP.HTTP.Errors.InternalServerErrorError
Error class to indicate that the server encountered an unexpected condition.
C
CarbonLDP.HTTP.Errors.MethodNotAllowedError
Error class to indicate that the method used in the request is not allowed for that URI.
C
CarbonLDP.HTTP.Errors.NotAcceptableError
Error class to indicate that the server cannot respond with the data type specified by the accept header of the request.
C
CarbonLDP.HTTP.Errors.NotFoundError
Error class to indicate that the resource was not found.
C
CarbonLDP.HTTP.Errors.NotImplementedError
Error class to indicate that the server doesn't have the ability to fulfill the request yet.
C
CarbonLDP.HTTP.Errors.PreconditionFailedError
Error class to indicate that the precondition header was resolved to false.
C
CarbonLDP.HTTP.Errors.PreconditionRequiredError
Error class to indicate that the request is missing a precondition header.
C
CarbonLDP.HTTP.Errors.RequestEntityTooLargeError
Error class to indicate that the request entity is larger than the server is able to process.
C
CarbonLDP.HTTP.Errors.RequestHeaderFieldsTooLargeError
Error class to indicate that the server is not able to process the request because its header fields are too large.
C
CarbonLDP.HTTP.Errors.RequestURITooLongError
Error class to indicate that the server is not able to process the request because the URI is too long.
C
CarbonLDP.HTTP.Errors.ServiceUnavailableError
Error class to indicate that the server is currently unavailable (because it's overloaded or down for maintenance).
C
CarbonLDP.HTTP.Errors.TooManyRequestsError
Error class to indicate that the current user has sent too many request in a given amount of time.
C
CarbonLDP.HTTP.Errors.UnauthorizedError
Error class to indicate that authentication is required or has failed.
C
CarbonLDP.HTTP.Errors.UnknownError
Error class that defines any HTTP error that could not be identified.
C
CarbonLDP.HTTP.Errors.UnsupportedMediaTypeError
Error class to indicate that the request has a media-type not supported by the server.

Properties

#statusCodeMap
: any

Map where all the HTTP Status Codes used in the SDK are assigned to their specific error class.





Error class to indicate that the server was acting as a gateway or proxy and received an invalid response from the upstream server.


Properties

#statusCode
: number


.name
: string





Error class to indicate that a malformed request has been sent.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the response obtained isn't the expected or can't be interpreted.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the request could not be processed because of a conflict, such as an ID conflict.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the current user doesn't have permissions to fulfill the request.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.


Properties

#statusCode
: number


.name
: string





Generic error class that defines any type of HTTP Error used in the SDK.


Constructor


HTTPError( message:string, response:Response )

Param Type Default Description
message string
response Response

Properties

#statusCode
: number

Status code of the HTTP error.


.name
: string


.response
: CarbonLDP.HTTP.Response

Response that was received with the HTTP error.





Error class to indicate that the server doesn't support the HTTP protocol version used in the request.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server encountered an unexpected condition. This generic error is given when no other specific error is suitable.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the method used in the request is not allowed for that URI.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server cannot respond with the data type specified by the accept header of the request.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the resource was not found.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server doesn't have the ability to fulfill the request yet.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the precondition header was resolved to false.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the request is missing a precondition header.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the request entity is larger than the server is able to process.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server is not able to process the request because its header fields are too large.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server is not able to process the request because the URI is too long.


Properties

#statusCode
: number


.name
: string





Error class to indicate that the server is currently unavailable (because it's overloaded or down for maintenance).


Properties

#statusCode
: number


.name
: string





Error class to indicate that the current user has sent too many request in a given amount of time.


Properties

#statusCode
: number


.name
: string





Error class to indicate that authentication is required or has failed.


Properties

#statusCode
: number


.name
: string





Error class that defines any HTTP error that could not be identified.


Properties

.name
: string





Error class to indicate that the request has a media-type not supported by the server.


Properties

#statusCode
: number


.name
: string





Classes

C
CarbonLDP.JSONLD.JSONLDConverter
Service with that can convert expanded JSON-LD objects to compacted resources and viceversa.
C
CarbonLDP.JSONLD.JSONLDParser
Parser that normalises JSON-LD objects into a complete expanded form.
C
CarbonLDP.JSONLD.JSONLDProcessor
Service that has methods to process JSON-LD objects.

Methods

#_guessXSDType()
: string


_guessXSDType( value:any ):string

Returns the guessed CarbonLDP.Vocabularies.XSD type from the specified value.


Param Type Default Description
value any

the value to check its matching CarbonLDP.Vocabularies.XSD type.





Service with that can convert expanded JSON-LD objects to compacted resources and viceversa.


Constructor


JSONLDConverter( literalSerializers?:any )

Creates a JSONLD Converter from optional literal serializers.


Param Type Default Description
literalSerializers any

Serializers to be set in the instance.


Properties

._literalSerializers
: Map<string, CarbonLDP.RDF.Serializer>


.literalSerializers
: Map<string, CarbonLDP.RDF.Serializer>

Map object with data-type/serializer pairs for stringify the data of a resource when expanding it.


Methods

#getDefaultSerializers()
: Map<string, CarbonLDP.RDF.Serializer>


getDefaultSerializers():Map<string, Serializer>


.__compactPropertyLiteral()
: any[]


__compactPropertyLiteral( propertyValues:any[], definition:DigestedObjectSchemaProperty, digestedSchema:DigestedObjectSchema ):any[]

Param Type Default Description
propertyValues any[]
definition DigestedObjectSchemaProperty
digestedSchema DigestedObjectSchema


.__compactSingle()
: void


__compactSingle( expandedObject:any, targetObject:any, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary, strict?:boolean ):void

Param Type Default Description
expandedObject any
targetObject any
digestedSchema DigestedObjectSchema
pointerLibrary PointerLibrary | $PointerLibrary
strict boolean


.__expandLiteralValue()
: any


__expandLiteralValue( literalValue:any, literalType:string ):any

Param Type Default Description
literalValue any
literalType string


.__expandPointerValue()
: CarbonLDP.RDF.RDFNode


__expandPointerValue( propertyValue:any, digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):RDFNode

Param Type Default Description
propertyValue any
digestedSchema DigestedObjectSchema
generalSchema DigestedObjectSchema


.__expandProperty()
: any[]


__expandProperty( propertyName:string, propertyValue:any, digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any[]

Param Type Default Description
propertyName string
propertyValue any
digestedSchema DigestedObjectSchema
generalSchema DigestedObjectSchema


.__expandPropertyLanguageMap()
: any


__expandPropertyLanguageMap( propertyValue:any ):any

Param Type Default Description
propertyValue any


.__expandPropertyLiteral()
: any[]


__expandPropertyLiteral( propertyValue:any[], definition:DigestedObjectSchemaProperty, digestedSchema:DigestedObjectSchema ):any[]

Param Type Default Description
propertyValue any[]
definition DigestedObjectSchemaProperty
digestedSchema DigestedObjectSchema


.__expandPropertyPointer()
: any[]


__expandPropertyPointer( propertyValue:any[], digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any[]

Param Type Default Description
propertyValue any[]
digestedSchema DigestedObjectSchema
generalSchema DigestedObjectSchema


.__expandPropertyValue()
: any[]


__expandPropertyValue( propertyValue:any[], digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any[]

Param Type Default Description
propertyValue any[]
digestedSchema DigestedObjectSchema
generalSchema DigestedObjectSchema


.__expandSingle()
: CarbonLDP.RDF.RDFNode


__expandSingle( compactedObject:Object, generalSchema:DigestedObjectSchema, digestedSchema:DigestedObjectSchema ):RDFNode

Param Type Default Description
compactedObject Object
generalSchema DigestedObjectSchema
digestedSchema DigestedObjectSchema


.__expandValue()
: any


__expandValue( propertyValue:any, digestedSchema:DigestedObjectSchema, generalSchema:DigestedObjectSchema ):any

Param Type Default Description
propertyValue any
digestedSchema DigestedObjectSchema
generalSchema DigestedObjectSchema


.__getProperties()
: any[] | undefined


__getProperties( propertyValues:any[], pointerLibrary:PointerLibrary | $PointerLibrary ):any[] | undefined

Param Type Default Description
propertyValues any[]
pointerLibrary PointerLibrary | $PointerLibrary


.__getPropertyContainerType()
: CarbonLDP.ContainerType


__getPropertyContainerType( propertyValues:any ):ContainerType

Param Type Default Description
propertyValues any


.__getPropertyPointers()
: any[] | undefined


__getPropertyPointers( propertyValues:any[], pointerLibrary:PointerLibrary | $PointerLibrary ):any[] | undefined

Param Type Default Description
propertyValues any[]
pointerLibrary PointerLibrary | $PointerLibrary


.__getPropertyURINameMap()
: Map<string, string>


__getPropertyURINameMap( digestedSchema:DigestedObjectSchema ):Map<string, string>

Param Type Default Description
digestedSchema DigestedObjectSchema


.__getPropertyValue()
: any


__getPropertyValue( propertyName:string, propertyValues:any[], digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):any

Param Type Default Description
propertyName string
propertyValues any[]
digestedSchema DigestedObjectSchema
pointerLibrary PointerLibrary | $PointerLibrary


.compact()
: any


compact( expandedObjects:object[], targetObjects:object[], digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):object[]

Assigns the data of the expanded JSON-LD objects to the target objects in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.


Param Type Default Description
expandedObjects object[]

The JSON-LD objects to compact.

targetObjects object[]

The target objects where will be added the compact data of the expanded object.

digestedSchema DigestedObjectSchema

The schema that describes how compact the expanded object.

pointerLibrary PointerLibrary | $PointerLibrary

An object from where one can obtain the pointers of resources.



compact( expandedObject:object, targetObject:object, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary, strict?:boolean ):object

Assigns the data of the expanded JSON-LD object to the target object in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.


Param Type Default Description
expandedObject object

The JSON-LD object to compact.

targetObject object

The target object where will be added the compact data of the expanded object.

digestedSchema DigestedObjectSchema

The schema that describes how compact the expanded object.

pointerLibrary PointerLibrary | $PointerLibrary

An object from where one can obtain the pointers of resources.

strict boolean

Flag to ignore the compaction of properties that are not defined in the schema.



compact( expandedObjects:object[], digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):object[]

Assigns the data of the expanded JSON-LD objects into new objects in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.


Param Type Default Description
expandedObjects object[]

The JSON-LD objects to compact.

digestedSchema DigestedObjectSchema

The schema that describes how compact the expanded object.

pointerLibrary PointerLibrary | $PointerLibrary

An object from where one can obtain the pointers of resources.



compact( expandedObject:object, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary ):object

Assigns the data of the expanded JSON-LD object into a new object in a friendly mode. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.


Param Type Default Description
expandedObject object

The JSON-LD object to compact.

digestedSchema DigestedObjectSchema

The schema that describes how compact the expanded object.

pointerLibrary PointerLibrary | $PointerLibrary

An object from where one can obtain the pointers of resources.



.expand()
: any


expand( compactedObjects:object[], generalSchema:DigestedObjectSchema, digestedSchema:DigestedObjectSchema ):RDFNode[]

Creates an expanded JSON-LD object from the compacted objects in accordance to the schema provided.


Param Type Default Description
compactedObjects object[]

The compacted resources to expand.

generalSchema DigestedObjectSchema

The general schema that applies to any compacted resource.

digestedSchema DigestedObjectSchema

The specific schema that applies to the compacted resources.



expand( compactedObject:object, generalSchema:DigestedObjectSchema, digestedSchema:DigestedObjectSchema ):RDFNode

Creates an expanded JSON-LD object from the compacted object in accordance to the schema provided.


Param Type Default Description
compactedObject object

The compacted resource to expand.

generalSchema DigestedObjectSchema

The general schema that applies to any compacted resource.

digestedSchema DigestedObjectSchema

The specific schema that applies to the compacted resource.



.update()
: void


update( target:object, node:RDFNode, digestedSchema:DigestedObjectSchema, pointerLibrary:PointerLibrary | $PointerLibrary, strict?:boolean ):void

Compacts and updates the data of the expanded JSON-LD object into the target object. i.e. without the JSON-LD Syntax Tokens and parsed values, in accordance to the schema provided.


Param Type Default Description
target object

Object to be updated from the expanded one.

node RDFNode

The expanded object to be compacted and updated into the target

digestedSchema DigestedObjectSchema

The schema that describes how compact the expanded object.

pointerLibrary PointerLibrary | $PointerLibrary

An object from where one can obtain the pointers of resources.

strict boolean

Flag to ignore the compaction of properties that are not defined in the schema.





Implements:

Parser that normalises JSON-LD objects into a complete expanded form.


Methods

.parse()
: Promise<object[]>


parse( input:string ):Promise<object[]>

Parse the string provided using the CarbonLDP.JSONLD.JSONLDProcessor#expand` method.


Param Type Default Description
input string

The JSON-LD string to parse.





Service that has methods to process JSON-LD objects.


Methods

#__addValue()
: void


__addValue( element:Object, propertyName:string, value:any, options:{ propertyIsArray: boolean; } ):void

Param Type Default Description
element Object
propertyName string
value any
options { propertyIsArray: boolean; }


#__compareValues()
: boolean


__compareValues( value1:any, value2:any ):boolean

Param Type Default Description
value1 any
value2 any


#__expandLanguageMap()
: any


__expandLanguageMap( languageMap:any ):any

Param Type Default Description
languageMap any


#__expandURI()
: string


__expandURI( schema:DigestedObjectSchema, uri:string, relativeTo?:{ vocab?: boolean; base?: boolean; } ):string

Param Type Default Description
schema DigestedObjectSchema
uri string
relativeTo { vocab?: boolean; base?: boolean; }


#__expandValue()
: any


__expandValue( context:DigestedObjectSchema, value:any, propertyName:string ):any

Param Type Default Description
context DigestedObjectSchema
value any
propertyName string


#__findContextURLs()
: boolean


__findContextURLs( input:Object, contexts:{ [index: string]: Object; }, base:string, replace:boolean ):boolean

Param Type Default Description
input Object
contexts { [index: string]: Object; }
base string
replace boolean


#__getContainer()
: CarbonLDP.ContainerType


__getContainer( context:DigestedObjectSchema, property:string ):ContainerType

Param Type Default Description
context DigestedObjectSchema
property string


#__getTargetFromLinkHeader()
: string


__getTargetFromLinkHeader( header:Header ):string

Param Type Default Description
header Header


#__hasProperty()
: boolean


__hasProperty( element:Object, propertyName:string ):boolean

Param Type Default Description
element Object
propertyName string


#__hasValue()
: boolean


__hasValue( element:Object, propertyName:string, value:any ):boolean

Param Type Default Description
element Object
propertyName string
value any


#__isKeyword()
: boolean


__isKeyword( value:string ):boolean

Param Type Default Description
value string


#__isValidType()
: boolean


__isValidType( value:any ):boolean

Param Type Default Description
value any


#__process()
: Object


__process( context:DigestedObjectSchema, element:Object, activeProperty?:string, insideList?:boolean ):Object

Param Type Default Description
context DigestedObjectSchema
element Object
activeProperty string
insideList boolean


#__retrieveContexts()
: Promise<void>


__retrieveContexts( input:Object, contextsRequested:{ [index: string]: boolean; }, base:string ):Promise<void>

Param Type Default Description
input Object
contextsRequested { [index: string]: boolean; }
base string


#expand()
: Promise<object[]>


expand( input:object ):Promise<object[]>

Expands a compact JSON-LD object. This expansion understands local or remotes @context entities.


Param Type Default Description
input object

The JSON-LD object to expand.





carbonldp/LDP
Module

Interfaces

I
CarbonLDP.LDP.AddMemberAction
Model that represents a c:AddMemberAction.
I
CarbonLDP.LDP.DirectContainer
Model that represents a ldp:DirectContainer.
I
CarbonLDP.LDP.DocumentMetadata
Model that represents a c:DocumentMetadata.
I
CarbonLDP.LDP.Error
Model that represents a c:Error.
I
CarbonLDP.LDP.ErrorFactory
Factory, decorator and utils for CarbonLDP.LDP.Error.
I
CarbonLDP.LDP.ErrorResponse
Model that represents a c:ErrorResponse.
I
CarbonLDP.LDP.Map
Model that represents a c:Map.
I
CarbonLDP.LDP.MapEntry
Model that represents an entry of a c:Map.
I
CarbonLDP.LDP.MapEntryFactory
Factory, decorator and utils for CarbonLDP.LDP.MapEntry.
I
CarbonLDP.LDP.MapFactory
Factory, decorator and utils for CarbonLDP.LDP.Map.
I
CarbonLDP.LDP.RemoveMemberAction
Model that represents a c:RemoveMemberAction.
I
CarbonLDP.LDP.ResponseMetadata
Model that represents a c:ResponseMetadata.
I
CarbonLDP.LDP.TransientDirectContainer
The in-memory model that represents a ldp:DirectContainer.
I
CarbonLDP.LDP.ValidationError
Model that represents a c:ValidationError.
I
CarbonLDP.LDP.VolatileResource
Model that represents a c:VolatileResource.

Properties




Model that represents a c:AddMemberAction. This model is used as a request body for adding members.


Properties

.targetMembers
: CarbonLDP.Pointer[]

Resources to add as members.





Factory, decorator and utils for CarbonLDP.LDP.AddMemberAction.


Properties

Methods

.create()
: T & CarbonLDP.LDP.AddMemberAction


create<T extends object>( data:T & BaseAddMemberAction ):T & AddMemberAction

Param Type Default Description
data T & BaseAddMemberAction


.createFrom()
: T & CarbonLDP.LDP.AddMemberAction


createFrom<T extends object>( data:T & BaseAddMemberAction ):T & AddMemberAction

Param Type Default Description
data T & BaseAddMemberAction


.is()
: value is CarbonLDP.LDP.AddMemberAction


is( value:any ):value is AddMemberAction

Param Type Default Description
value any




Base properties for a CarbonLDP.LDP.AddMemberAction.


Properties

.targetMembers
: CarbonLDP.Pointer[]

The resources to be added as members.






Properties

.hasMemberRelation
: string | CarbonLDP.Pointer

The relation the direct container will manage.


.isMemberOfRelation
: string | CarbonLDP.Pointer

The optional inverted relation the direct container will manage.


.membershipResource
: CarbonLDP.Pointer

The resource the direct container belongs to.








Model that represents a ldp:DirectContainer.








Model that represents a c:DocumentMetadata. This model contains volatile information about an specific resource.


Properties

.bNodesMap
: CarbonLDP.LDP.Map<CarbonLDP.Pointer, CarbonLDP.Pointer>

c:Map that contains the changed IDs when persisting BNodes.


.relatedDocument
: CarbonLDP.Document

Resource the metadata refers to.








Model that represents a c:Error. This model is returned by the server when an error occurs.


Properties

.errorCode
: string

Code that indicates the type of error ocurred.


.errorMessage
: string

Message that explains the error.


.errorParameters
: CarbonLDP.LDP.Map<string, any>

c:Map that contains the specific elements that generated the error.








Model that represents a c:ErrorResponse. This model is returned as the response of a request when any error occurs.


Properties

.errors
: CarbonLDP.LDP.Error[]

Set of all the errors that the request generated.


.requestID
: string

String that identifies the request that caused the error.


.statusCode
: number

The HTTP status code for the general error of the request.





Factory, decorator and utils for CarbonLDP.LDP.ErrorResponse.


Properties

Methods

.getMessage()
: string


getMessage( errorResponse:ErrorResponse ):string

Param Type Default Description
errorResponse ErrorResponse


.is()
: value is CarbonLDP.LDP.ErrorResponse


is( value:any ):value is ErrorResponse

Param Type Default Description
value any




CarbonLDP.LDP.Map
Interface

Model that represents a c:Map. This model contains a set of entries in a form of a key/value pair.


Properties

.entries
: CarbonLDP.LDP.MapEntry<K, V>[]

Array of the entries's pairs.





Model that represents an entry of a c:Map.


Properties

.entryKey
: K

The key element of the entry's pair.


.entryValue
: V

The value element of the entry's pair.








Factory, decorator and utils for CarbonLDP.LDP.Map.


Properties

Methods

.is()
: object is CarbonLDP.LDP.Map<any, any>


is( object:object ):object is Map<any, any>

Param Type Default Description
object object




Model that represents a c:RemoveMemberAction. This model is used as a request body for removing members.


Properties

.targetMembers
: CarbonLDP.Pointer[]

The resources to remove as members.





Factory, decorator and utils for CarbonLDP.LDP.RemoveMemberAction.


Properties

Methods

.create()
: T & CarbonLDP.LDP.RemoveMemberAction


create<T extends object>( data:T & BaseRemoveMemberAction ):T & RemoveMemberAction

Param Type Default Description
data T & BaseRemoveMemberAction


.createFrom()
: T & CarbonLDP.LDP.RemoveMemberAction


createFrom<T extends object>( object:T & BaseRemoveMemberAction ):T & RemoveMemberAction

Param Type Default Description
object T & BaseRemoveMemberAction


.is()
: value is CarbonLDP.LDP.RemoveMemberAction


is( value:any ):value is RemoveMemberAction

Param Type Default Description
value any




Model that represents a c:ResponseMetadata. This model is returned in the response of a request when volatile metadata needs to be returned.


Properties

.documentsMetadata
: CarbonLDP.LDP.DocumentMetadata[]

Array with metadata of resources affected by the request.





Factory, decorator and utils for CarbonLDP.LDP.ResponseMetadata.


Properties

Methods

.is()
: object is CarbonLDP.LDP.ResponseMetadata


is( object:object ):object is ResponseMetadata

Param Type Default Description
object object




The in-memory model that represents a ldp:DirectContainer.


Properties

.hasMemberRelation
: CarbonLDP.Pointer

The relation the direct container will manage.


.membershipResource
: CarbonLDP.Pointer

The resource the direct container belongs to.





Factory, decorator and utils for CarbonLDP.LDP.TransientDirectContainer.


Properties

Methods

.create()
: T & CarbonLDP.LDP.TransientDirectContainer


create<T extends object>( data:T & BaseDirectContainer ):T & TransientDirectContainer

Param Type Default Description
data T & BaseDirectContainer


.createFrom()
: T & CarbonLDP.LDP.TransientDirectContainer


createFrom<T extends object>( object:T & BaseDirectContainer ):T & TransientDirectContainer

Param Type Default Description
object T & BaseDirectContainer


.is()
: value is CarbonLDP.LDP.TransientDirectContainer


is( value:any ):value is TransientDirectContainer

Param Type Default Description
value any




Model that represents a c:ValidationError. This model is used in a c:Error when that error was caused by a failed SHACL validation.