@inrupt/solid-client

Globals / “resource/solidDataset”

Module: “resource/solidDataset”

Functions

changeLogAsMarkdown

changeLogAsMarkdown(solidDataset: SolidDataset & WithChangeLog): string

Defined in src/resource/solidDataset.ts:687

Gets a human-readable representation of the local changes to a Resource to aid debugging.

Note that changes to the exact format of the return value are not considered a breaking change; it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.

since 0.3.0

Parameters:

Name

Type

Description

solidDataset

SolidDataset & WithChangeLog

The Resource of which to get a human-readable representation of the changes applied to it locally.

Returns: string


createContainerAt

createContainerAt(url: UrlString | Url, options?: Partial<typeof internal_defaultFetchOptions>): Promise<SolidDataset & WithServerResourceInfo>

Defined in src/resource/solidDataset.ts:325

Create an empty Container at the given URL.

Throws an error if creating the Container failed, e.g. because the current user does not have permissions to, or because the Container already exists.

since 0.2.0

Parameters:

Name

Type

Default value

Description

url

UrlString | Url

-

URL of the empty Container that is to be created.

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns: Promise<SolidDataset & WithServerResourceInfo>


createContainerInContainer

createContainerInContainer(containerUrl: UrlString | Url, options?: SaveInContainerOptions): Promise<SolidDataset & WithResourceInfo>

Defined in src/resource/solidDataset.ts:558

Create an empty Container inside the Container at the given URL.

Throws an error if creating the Container failed, e.g. because the current user does not have permissions to.

since 0.2.0

Parameters:

Name

Type

Default value

Description

containerUrl

UrlString | Url

-

URL of the Container in which the empty Container is to be created.

options

SaveInContainerOptions

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns: Promise<SolidDataset & WithResourceInfo>


createSolidDataset

createSolidDataset(): SolidDataset

Defined in src/resource/solidDataset.ts:70

Initialise a new SolidDataset in memory.

Returns: SolidDataset

An empty SolidDataset.


deleteContainer

deleteContainer(container: Url | UrlString | WithResourceInfo, options?: Partial<typeof internal_defaultFetchOptions>): Promise<void>

Defined in src/resource/solidDataset.ts:615

Deletes the Container at a given URL.

since 0.6.0

Parameters:

Name

Type

Default value

container

Url | UrlString | WithResourceInfo

-

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

Returns: Promise<void>


deleteSolidDataset

deleteSolidDataset(solidDataset: Url | UrlString | WithResourceInfo, options?: Partial<typeof internal_defaultFetchOptions>): Promise<void>

Defined in src/resource/solidDataset.ts:292

Deletes the SolidDataset at a given URL.

since 0.6.0

Parameters:

Name

Type

Default value

solidDataset

Url | UrlString | WithResourceInfo

-

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

Returns: Promise<void>


getSolidDataset

getSolidDataset(url: UrlString | Url, options?: Partial<typeof internal_defaultFetchOptions>): Promise<SolidDataset & WithServerResourceInfo>

Defined in src/resource/solidDataset.ts:81

Fetch a SolidDataset from the given URL. Currently requires the SolidDataset to be available as Turtle.

Parameters:

Name

Type

Default value

Description

url

UrlString | Url

-

URL to fetch a SolidDataset from.

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns: Promise<SolidDataset & WithServerResourceInfo>

Promise resolving to a SolidDataset containing the data at the given Resource, or rejecting if fetching it failed.


getSolidDatasetWithAcl

getSolidDatasetWithAcl(url: UrlString | Url, options?: Partial<typeof internal_defaultFetchOptions>): Promise<SolidDataset & WithServerResourceInfo & WithAcl>

Defined in src/resource/solidDataset.ts:138

Experimental: fetch a SolidDataset and its associated Access Control List.

This is an experimental function that fetches both a Resource, the linked ACL Resource (if available), and the ACL that applies to it if the linked ACL Resource is not available. This can result in many HTTP requests being executed, in lieu of the Solid spec mandating servers to provide this info in a single request. Therefore, and because this function is still experimental, prefer getSolidDataset instead.

If the Resource does not advertise the ACL Resource (because the authenticated user does not have access to it), the acl property in the returned value will be null. acl.resourceAcl will be undefined if the Resource’s linked ACL Resource could not be fetched (because it does not exist), and acl.fallbackAcl will be null if the applicable Container’s ACL is not accessible to the authenticated user.

Parameters:

Name

Type

Default value

Description

url

UrlString | Url

-

URL of the SolidDataset to fetch.

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns: Promise<SolidDataset & WithServerResourceInfo & WithAcl>

A SolidDataset and the ACLs that apply to it, if available to the authenticated user.


saveSolidDatasetAt

saveSolidDatasetAt<Dataset>(url: UrlString | Url, solidDataset: Dataset, options?: Partial<typeof internal_defaultFetchOptions>): Promise<Dataset & WithServerResourceInfo & WithChangeLog>

Defined in src/resource/solidDataset.ts:232

Given a SolidDataset, store it in a Solid Pod (overwriting the existing data at the given URL).

A SolidDataset keeps track of the data changes compared to the data in the Pod; i.e., the changelog tracks both the old value and new values of the property being modified. This function applies the changes to the current SolidDataset. If the old value specified in the changelog does not correspond to the value currently in the Pod, this function will throw an error. The SolidDataset returned by this function will contain the data sent to the Pod, and a ChangeLog up-to-date with the saved data. Note that if the data on the server was modified in between the first fetch and saving it, the updated data will not be reflected in the returned SolidDataset. To make sure you have the latest data, call getSolidDataset again after saving the data.

Type parameters:

Name

Type

Dataset

SolidDataset

Parameters:

Name

Type

Default value

Description

url

UrlString | Url

-

URL to save solidDataset to.

solidDataset

Dataset

-

The SolidDataset to save.

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns: Promise<Dataset & WithServerResourceInfo & WithChangeLog>

A Promise resolving to a SolidDataset containing the stored data, or rejecting if saving it failed.


saveSolidDatasetInContainer

saveSolidDatasetInContainer(containerUrl: UrlString | Url, solidDataset: SolidDataset, options?: SaveInContainerOptions): Promise<SolidDataset & WithResourceInfo>

Defined in src/resource/solidDataset.ts:482

Given a SolidDataset, store it in a Solid Pod in a new Resource inside a Container.

Parameters:

Name

Type

Default value

Description

containerUrl

UrlString | Url

-

URL of the Container in which to create a new Resource.

solidDataset

SolidDataset

-

The SolidDataset to save to a new Resource in the given Container.

options

SaveInContainerOptions

internal_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns: Promise<SolidDataset & WithResourceInfo>

A Promise resolving to a SolidDataset containing the saved data. The Promise rejects if the save failed.


solidDatasetAsMarkdown

solidDatasetAsMarkdown(solidDataset: SolidDataset): string

Defined in src/resource/solidDataset.ts:653

Gets a human-readable representation of the given SolidDataset to aid debugging.

Note that changes to the exact format of the return value are not considered a breaking change; it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.

since 0.3.0

Parameters:

Name

Type

Description

solidDataset

SolidDataset

The SolidDataset to get a human-readable representation of.

Returns: string