Skip to content

Interface: Resource\<UriType>

A resource is an abstract representation for a group of data on a remote platform. For example, "Solid" has resources that could be containers or leafs.

Type parameters

Name Type
UriType extends string = string

Hierarchy

Resource

Implemented by

Properties

isError

Readonly isError: false

Indicates that this is not an error

Defined in

packages/connected/src/Resource.ts:27


status

status: ConnectedResult

The most recent result from one of the resource methods.

Defined in

packages/connected/src/Resource.ts:39


type

Readonly type: string

The name of the resource. For example "NextGraphResource"

Defined in

packages/connected/src/Resource.ts:35


uri

Readonly uri: UriType

The uri of the resource

Defined in

packages/connected/src/Resource.ts:31

Methods

addListener

addListener\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.addListener

Defined in

node_modules/typed-emitter/index.d.ts:22


emit

emit\<E>(event, ...args): boolean

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
...args Parameters\<{ notification: () => void ; update: () => void }[E]>

Returns

boolean

Inherited from

ResourceEventEmitter.emit

Defined in

node_modules/typed-emitter/index.d.ts:32


eventNames

eventNames(): (string | symbol)[]

Returns

(string | symbol)[]

Inherited from

ResourceEventEmitter.eventNames

Defined in

node_modules/typed-emitter/index.d.ts:34


getMaxListeners

getMaxListeners(): number

Returns

number

Inherited from

ResourceEventEmitter.getMaxListeners

Defined in

node_modules/typed-emitter/index.d.ts:39


isAbsent

isAbsent(): undefined | boolean

Returns true if its confirmed that this resource doesn't exist. Returns undefined if that is currently unknown.

Returns

undefined | boolean

Defined in

packages/connected/src/Resource.ts:65


isDoingInitialFetch

isDoingInitialFetch(): boolean

Returns true if this resource is currently performing its first fetch

Returns

boolean

Defined in

packages/connected/src/Resource.ts:55


isFetched

isFetched(): boolean

Returns true if this resource has performed a fetch at least once

Returns

boolean

Defined in

packages/connected/src/Resource.ts:47


isLoading

isLoading(): boolean

Returns true if this resource is currently loading.

Returns

boolean

Defined in

packages/connected/src/Resource.ts:43


isPresent

isPresent(): undefined | boolean

Returns true if this resource exists. Returns undefined if that is currently unknown.

Returns

undefined | boolean

Defined in

packages/connected/src/Resource.ts:60


isSubscribedToNotifications

isSubscribedToNotifications(): boolean

Returns true if this resource is currently subscribed to notifications.

Returns

boolean

Defined in

packages/connected/src/Resource.ts:69


isUnfetched

isUnfetched(): boolean

Returns true if this reosource has not performed a fetch at least once

Returns

boolean

Defined in

packages/connected/src/Resource.ts:51


listenerCount

listenerCount\<E>(event): number

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E

Returns

number

Inherited from

ResourceEventEmitter.listenerCount

Defined in

node_modules/typed-emitter/index.d.ts:37


listeners

listeners\<E>(event): { notification: () => void ; update: () => void }[E][]

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E

Returns

{ notification: () => void ; update: () => void }[E][]

Inherited from

ResourceEventEmitter.listeners

Defined in

node_modules/typed-emitter/index.d.ts:36


off

off\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.off

Defined in

node_modules/typed-emitter/index.d.ts:28


on

on\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.on

Defined in

node_modules/typed-emitter/index.d.ts:23


once

once\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.once

Defined in

node_modules/typed-emitter/index.d.ts:24


prependListener

prependListener\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.prependListener

Defined in

node_modules/typed-emitter/index.d.ts:25


prependOnceListener

prependOnceListener\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.prependOnceListener

Defined in

node_modules/typed-emitter/index.d.ts:26


rawListeners

rawListeners\<E>(event): { notification: () => void ; update: () => void }[E][]

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E

Returns

{ notification: () => void ; update: () => void }[E][]

Inherited from

ResourceEventEmitter.rawListeners

Defined in

node_modules/typed-emitter/index.d.ts:35


read

read(): Promise\<ReadSuccess\<any> | ResourceError\<any>>

Fetches the resource.

Returns

Promise\<ReadSuccess\<any> | ResourceError\<any>>

Defined in

packages/connected/src/Resource.ts:73


readIfUnfetched

readIfUnfetched(): Promise\<ReadSuccess\<any> | ResourceError\<any>>

Fetches the resource if it hasn't been fetched yet.

Returns

Promise\<ReadSuccess\<any> | ResourceError\<any>>

Defined in

packages/connected/src/Resource.ts:77


removeAllListeners

removeAllListeners\<E>(event?): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event? E

Returns

this

Inherited from

ResourceEventEmitter.removeAllListeners

Defined in

node_modules/typed-emitter/index.d.ts:29


removeListener

removeListener\<E>(event, listener): this

Type parameters

Name Type
E extends "update" | "notification"

Parameters

Name Type
event E
listener { notification: () => void ; update: () => void }[E]

Returns

this

Inherited from

ResourceEventEmitter.removeListener

Defined in

node_modules/typed-emitter/index.d.ts:30


setMaxListeners

setMaxListeners(maxListeners): this

Parameters

Name Type
maxListeners number

Returns

this

Inherited from

ResourceEventEmitter.setMaxListeners

Defined in

node_modules/typed-emitter/index.d.ts:40


subscribeToNotifications

subscribeToNotifications(callbacks?): Promise\<string>

Begins a subscription to this resource

Parameters

Name Type Description
callbacks? Object optional set of callbacks to be called when this resource is updated
callbacks.onNotification (message: any) => void -
callbacks.onNotificationError (err: Error) => void -

Returns

Promise\<string>

Defined in

packages/connected/src/Resource.ts:92


unsubscribeFromAllNotifications

unsubscribeFromAllNotifications(): Promise\<void>

Unsubscribes from all notifications.

Returns

Promise\<void>

Defined in

packages/connected/src/Resource.ts:104


unsubscribeFromNotifications

unsubscribeFromNotifications(subscriptionId): Promise\<void>

Unsubscribes from notifications on this resource

Parameters

Name Type Description
subscriptionId string the Id of the subscription to unsubscribe

Returns

Promise\<void>

Defined in

packages/connected/src/Resource.ts:100


update

update(datasetChanges): Promise\<ResourceError\<any> | UpdateSuccess\<any> | IgnoredInvalidUpdateSuccess\<any>>

Applies updates to this resource.

Parameters

Name Type Description
datasetChanges DatasetChanges\<BaseQuad> A list of changes to data

Returns

Promise\<ResourceError\<any> | UpdateSuccess\<any> | IgnoredInvalidUpdateSuccess\<any>>

Defined in

packages/connected/src/Resource.ts:82