Class: SolidContainer
Represents the current status of a specific container on a Pod as known by LDO.
Example
Hierarchy
↳ SolidContainer
Constructors
constructor
• new SolidContainer(uri, context): SolidContainer
Parameters
| Name | Type | Description |
|---|---|---|
uri |
SolidContainerUri |
The uri of the container |
context |
ConnectedContext\<SolidConnectedPlugin[]> |
SolidLdoDatasetContext for the parent dataset |
Returns
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:96
Properties
absent
• Protected absent: undefined | boolean
True if this resource has been fetched but does not exist
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:104
context
• Protected Readonly context: ConnectedContext\<SolidConnectedPlugin[]>
The ConnectedContext from the Parent Dataset
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:69
didInitialFetch
• Protected didInitialFetch: boolean = false
True if this resource has been fetched at least once
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:98
isError
• Readonly isError: false
Indicates that this resource is not an error
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:80
notificationSubscription
• Protected notificationSubscription: NotificationSubscription\<SolidConnectedPlugin, SolidNotificationMessage>
Handles notification subscriptions
Inherited from
SolidResource.notificationSubscription
Defined in
packages/connected-solid/src/resources/SolidResource.ts:122
requester
• Protected requester: ContainerBatchedRequester
Batched Requester for the Container
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:64
rootContainer
• Protected rootContainer: undefined | boolean
True if this is the root container, false if not, undefined if unknown
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:70
status
• status: CheckRootContainerSuccess | ContainerReadSuccess | AbsentReadSuccess\<SolidContainer> | ServerHttpError\<SolidContainer> | UnexpectedHttpError\<SolidContainer> | UnauthenticatedHttpError\<SolidContainer> | UnauthorizedHttpError\<SolidContainer> | NoncompliantPodError\<SolidContainer> | UnexpectedResourceError\<SolidContainer> | CreateSuccess\<SolidContainer> | Unfetched\<SolidContainer> | DeleteSuccess\<SolidContainer>
The status of the last request made for this container
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:85
type
• Readonly type: "SolidContainer"
Indicates that this resource is a container resource
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:75
uri
• Readonly uri: SolidContainerUri
The URI of the container
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:58
wacRule
• Protected Optional wacRule: WacRule
If a wac rule was fetched, it is cached here
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:116
wacUri
• Protected Optional wacUri: SolidLeafUri
If a wac uri is fetched, it is cached here
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:110
Methods
checkIfIsRootContainer
▸ checkIfIsRootContainer(): Promise\<CheckRootResult>
Checks if this container is a root container by making a request
Returns
Promise\<CheckRootResult>
CheckRootResult
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:219
child
▸ child(slug): SolidContainer
Returns a child resource with a given name (slug)
Parameters
| Name | Type | Description |
|---|---|---|
slug |
SolidContainerSlug |
the given name for that child resource |
Returns
the child resource (either a Leaf or Container depending on the name)
Example
const root = solidLdoDataset.getResource("https://example.com/");
const container = solidLdoDataset.child("container/");
// Logs "https://example.com/container/"
console.log(container.uri);
const resource = container.child("resource.ttl");
// Logs "https://example.com/container/resource.ttl"
console.log(resource.uri);
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:339
▸ child(slug): SolidLeaf
Parameters
| Name | Type |
|---|---|
slug |
SolidLeafSlug |
Returns
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:340
▸ child(slug): SolidContainer | SolidLeaf
Parameters
| Name | Type |
|---|---|
slug |
string |
Returns
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:341
children
▸ children(): (SolidContainer | SolidLeaf)[]
Lists the currently cached children of this container (no request is made)
Returns
(SolidContainer | SolidLeaf)[]
An array of children
const result = await container.read();
if (!result.isError) {
const children = container.children();
children.forEach((child) => {
console.log(child.uri);
});
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:308
clear
▸ clear(): Promise\<AggregateSuccess\<DeleteSuccess\<SolidContainer | SolidLeaf>> | AggregateError\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf>>>
Deletes all contents in this container
Returns
Promise\<AggregateSuccess\<DeleteSuccess\<SolidContainer | SolidLeaf>> | AggregateError\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf>>>
An AggregateSuccess or Aggregate error corresponding with all the deleted resources
Example
const result = container.clear();
if (!result.isError) {
console.log("All deleted resources:");
result.results.forEach((result) => console.log(result.uri));
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:488
createAndOverwrite
▸ createAndOverwrite(): Promise\<ContainerCreateAndOverwriteResult>
Creates a container at this URI and overwrites any that already exists
Returns
Promise\<ContainerCreateAndOverwriteResult>
ContainerCreateAndOverwriteResult
Example
Overrides
SolidResource.createAndOverwrite
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:556
createChildAndOverwrite
▸ createChildAndOverwrite(slug): Promise\<ContainerCreateAndOverwriteResult>
Creates a resource and overwrites any existing resource that existed at the URI
Parameters
| Name | Type | Description |
|---|---|---|
slug |
SolidContainerSlug |
the name of the resource |
Returns
Promise\<ContainerCreateAndOverwriteResult>
the result of creating that resource
Example
const container = solidLdoDataset
.getResource("https://example.com/container/");
cosnt result = await container.createChildAndOverwrite("resource.ttl");
if (!result.isError) {
// Do something
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:371
▸ createChildAndOverwrite(slug): Promise\<LeafCreateAndOverwriteResult>
Parameters
| Name | Type |
|---|---|
slug |
SolidLeafSlug |
Returns
Promise\<LeafCreateAndOverwriteResult>
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:374
▸ createChildAndOverwrite(slug): Promise\<ContainerCreateAndOverwriteResult | LeafCreateAndOverwriteResult>
Parameters
| Name | Type |
|---|---|
slug |
string |
Returns
Promise\<ContainerCreateAndOverwriteResult | LeafCreateAndOverwriteResult>
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:377
createChildIfAbsent
▸ createChildIfAbsent(slug): Promise\<ContainerCreateIfAbsentResult>
Creates a resource only if that resource doesn't already exist on the Solid Pod
Parameters
| Name | Type | Description |
|---|---|---|
slug |
SolidContainerSlug |
the name of the resource |
Returns
Promise\<ContainerCreateIfAbsentResult>
the result of creating that resource
Example
const container = solidLdoDataset
.getResource("https://example.com/container/");
cosnt result = await container.createChildIfAbsent("resource.ttl");
if (!result.isError) {
// Do something
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:403
▸ createChildIfAbsent(slug): Promise\<LeafCreateIfAbsentResult>
Parameters
| Name | Type |
|---|---|
slug |
SolidLeafSlug |
Returns
Promise\<LeafCreateIfAbsentResult>
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:406
▸ createChildIfAbsent(slug): Promise\<ContainerCreateIfAbsentResult | LeafCreateIfAbsentResult>
Parameters
| Name | Type |
|---|---|
slug |
string |
Returns
Promise\<ContainerCreateIfAbsentResult | LeafCreateIfAbsentResult>
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:407
createIfAbsent
▸ createIfAbsent(): Promise\<ContainerCreateIfAbsentResult>
Creates a container at this URI if the container doesn't already exist
Returns
Promise\<ContainerCreateIfAbsentResult>
ContainerCreateIfAbsentResult
Example
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:575
delete
▸ delete(): Promise\<DeleteResult\<SolidContainer> | AggregateError\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf>>>
Deletes this container and all its contents
Returns
Promise\<DeleteResult\<SolidContainer> | AggregateError\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf>>>
A Delete result for this container
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:526
emitThisAndParent
▸ emitThisAndParent(): void
Emits an update event for both this resource and the parent
Returns
void
Inherited from
SolidResource.emitThisAndParent
Defined in
packages/connected-solid/src/resources/SolidResource.ts:367
getParentContainer
▸ getParentContainer(): Promise\<undefined | SolidContainer | CheckRootResultError>
Gets the parent container for this container by making a request
Returns
Promise\<undefined | SolidContainer | CheckRootResultError>
The parent container or undefined if there is no parent container because this container is the root container
Example
Suppose the root container is at https://example.com/
const root = solidLdoDataset.getResource("https://example.com/");
const container = solidLdoDataset
.getResource("https://example.com/container");
const rootParent = await root.getParentContainer();
console.log(rootParent); // Logs "undefined"
const containerParent = await container.getParentContainer();
if (!containerParent.isError) {
// Logs "https://example.com/"
console.log(containerParent.uri);
}
Overrides
SolidResource.getParentContainer
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:279
getRootContainer
▸ getRootContainer(): Promise\<SolidContainer | CheckRootResultError | NoRootContainerError\<SolidContainer>>
Gets the root container of this container. If this container is the root container, this function returns itself.
Returns
Promise\<SolidContainer | CheckRootResultError | NoRootContainerError\<SolidContainer>>
The root container for this container or undefined if there is no root container.
Example
Suppose the root container is at https://example.com/
const container = ldoSolidDataset
.getResource("https://example.com/container/");
const rootContainer = await container.getRootContainer();
if (!rootContainer.isError) {
// logs "https://example.com/"
console.log(rootContainer.uri);
}
Overrides
SolidResource.getRootContainer
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:247
getWac
▸ getWac(options?): Promise\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf> | NotFoundHttpError\<SolidContainer | SolidLeaf> | GetWacRuleSuccess\<SolidContainer | SolidLeaf> | WacRuleAbsent\<SolidContainer | SolidLeaf>>
Retrieves web access control (WAC) rules for this resource
Parameters
| Name | Type | Description |
|---|---|---|
options? |
Object |
set the "ignoreCache" field to true to ignore any cached information on WAC rules. |
options.ignoreCache |
boolean |
- |
Returns
Promise\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf> | NotFoundHttpError\<SolidContainer | SolidLeaf> | GetWacRuleSuccess\<SolidContainer | SolidLeaf> | WacRuleAbsent\<SolidContainer | SolidLeaf>>
WAC Rules results
Example
const resource = ldoSolidDataset
.getResource("https://example.com/container/resource.ttl");
const wacRulesResult = await resource.getWac();
if (!wacRulesResult.isError) {
const wacRules = wacRulesResult.wacRule;
// True if the resource is publicly readable
console.log(wacRules.public.read);
// True if authenticated agents can write to the resource
console.log(wacRules.authenticated.write);
// True if the given WebId has append access
console.log(
wacRules.agent[https://example.com/person1/profile/card#me].append
);
// True if the given WebId has control access
console.log(
wacRules.agent[https://example.com/person1/profile/card#me].control
);
}
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:648
getWacUri
▸ getWacUri(options?): Promise\<GetWacUriResult\<SolidContainer | SolidLeaf>>
Retrieves the URI for the web access control (WAC) rules for this resource
Parameters
| Name | Type | Description |
|---|---|---|
options? |
Object |
set the "ignoreCache" field to true to ignore any cached information on WAC rules. |
options.ignoreCache |
boolean |
- |
Returns
Promise\<GetWacUriResult\<SolidContainer | SolidLeaf>>
WAC Rules results
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:601
handleCreateAndOverwrite
▸ handleCreateAndOverwrite(): Promise\<ContainerCreateAndOverwriteResult | LeafCreateAndOverwriteResult>
Helper method that handles the core functions for creating and overwriting a resource
Returns
Promise\<ContainerCreateAndOverwriteResult | LeafCreateAndOverwriteResult>
DeleteResult
Inherited from
SolidResource.handleCreateAndOverwrite
Defined in
packages/connected-solid/src/resources/SolidResource.ts:503
handleCreateIfAbsent
▸ handleCreateIfAbsent(): Promise\<ContainerCreateIfAbsentResult | LeafCreateIfAbsentResult>
Helper method that handles the core functions for creating a resource if absent
Returns
Promise\<ContainerCreateIfAbsentResult | LeafCreateIfAbsentResult>
DeleteResult
Inherited from
SolidResource.handleCreateIfAbsent
Defined in
packages/connected-solid/src/resources/SolidResource.ts:536
handleDelete
▸ handleDelete(): Promise\<DeleteResult\<SolidContainer>>
Helper method that handles the core functions for deleting a resource
Returns
Promise\<DeleteResult\<SolidContainer>>
DeleteResult
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:540
handleRead
▸ handleRead(): Promise\<ReadContainerResult | ReadLeafResult>
A helper method that handles the core functions for reading
Returns
Promise\<ReadContainerResult | ReadLeafResult>
ReadResult
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:397
isAbsent
▸ isAbsent(): undefined | boolean
Is this resource currently absent (it does not exist)
Returns
undefined | boolean
true if the resource is absent, false if not, undefined if unknown
Example
// Logs "undefined"
console.log(resource.isAbsent());
const result = await resource.read();
if (!result.isError) {
// False if the resource exists, true if it does not
console.log(resource.isAbsent());
}
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:319
isCreating
▸ isCreating(): boolean
Checks to see if this resource is being created
Returns
boolean
true if the resource is currently being created
Example
resource.read().then(() => {
// Logs "false"
console.log(resource.isCreating())
});
// Logs "true"
console.log(resource.isCreating());
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:183
isDeleting
▸ isDeleting(): boolean
Checks to see if this resource is being deleted
Returns
boolean
true if the resource is currently being deleted
Example
resource.read().then(() => {
// Logs "false"
console.log(resource.isDeleting())
});
// Logs "true"
console.log(resource.isDeleting());
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:219
isDoingInitialFetch
▸ isDoingInitialFetch(): boolean
Checks to see if this resource is being read for the first time
Returns
boolean
true if the resource is currently being read for the first time
Example
resource.read().then(() => {
// Logs "false"
console.log(resource.isDoingInitialFetch())
});
// Logs "true"
console.log(resource.isDoingInitialFetch());
Inherited from
SolidResource.isDoingInitialFetch
Defined in
packages/connected-solid/src/resources/SolidResource.ts:237
isFetched
▸ isFetched(): boolean
Check to see if this resource has been fetched
Returns
boolean
true if this resource has been fetched before
Example
// Logs "false"
console.log(resource.isFetched());
const result = await resource.read();
if (!result.isError) {
// Logs "true"
console.log(resource.isFetched());
}
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:281
isLoading
▸ isLoading(): boolean
Checks to see if this resource is loading in any way
Returns
boolean
true if the resource is currently loading
Example
resource.read().then(() => {
// Logs "false"
console.log(resource.isLoading())
});
// Logs "true"
console.log(resource.isLoading());
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:165
isPresent
▸ isPresent(): undefined | boolean
Is this resource currently present on the Pod
Returns
undefined | boolean
false if the resource is absent, true if not, undefined if unknown
Example
// Logs "undefined"
console.log(resource.isPresent());
const result = await resource.read();
if (!result.isError) {
// True if the resource exists, false if it does not
console.log(resource.isPresent());
}
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:338
isReading
▸ isReading(): boolean
Checks to see if this resource is being read
Returns
boolean
true if the resource is currently being read
Example
resource.read().then(() => {
// Logs "false"
console.log(resource.isReading())
});
// Logs "true"
console.log(resource.isReading());
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:201
isReloading
▸ isReloading(): boolean
Checks to see if this resource is being read for a subsequent time
Returns
boolean
true if the resource is currently being read for a subsequent time
Example
await resource.read();
resource.read().then(() => {
// Logs "false"
console.log(resource.isCreating())
});
// Logs "true"
console.log(resource.isCreating());
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:256
isRootContainer
▸ isRootContainer(): undefined | boolean
Checks if this container is a root container
Returns
undefined | boolean
true if this container is a root container, false if not, and undefined if this is unknown at the moment.
Example
// Returns "undefined" when the container is unfetched
console.log(container.isRootContainer());
const result = await container.read();
if (!result.isError) {
// Returns true or false
console.log(container.isRootContainer());
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:122
isSubscribedToNotifications
▸ isSubscribedToNotifications(): boolean
Is this resource currently listening to notifications from this document
Returns
boolean
true if the resource is subscribed to notifications, false if not
Example
await resource.subscribeToNotifications();
// Logs "true"
console.log(resource.isSubscribedToNotifications());
Inherited from
SolidResource.isSubscribedToNotifications
Defined in
packages/connected-solid/src/resources/SolidResource.ts:353
isUnfetched
▸ isUnfetched(): boolean
Check to see if this resource is currently unfetched
Returns
boolean
true if the resource is currently unfetched
Example
// Logs "true"
console.log(resource.isUnetched());
const result = await resource.read();
if (!result.isError) {
// Logs "false"
console.log(resource.isUnfetched());
}
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:300
onNotification
▸ onNotification(message): Promise\<void>
Function that triggers whenever a notification is recieved.
Parameters
| Name | Type |
|---|---|
message |
SolidNotificationMessage |
Returns
Promise\<void>
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:799
read
▸ read(): Promise\<ReadContainerResult>
Reads the container
Returns
Promise\<ReadContainerResult>
A read result
Example
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:158
readIfUnfetched
▸ readIfUnfetched(): Promise\<ReadContainerResult>
Makes a request to read this container if it hasn't been fetched yet. If it has, return the cached informtation
Returns
Promise\<ReadContainerResult>
a ReadContainerResult
Example
const result = await container.read();
if (!result.isError) {
// Will execute without making a request
const result2 = await container.readIfUnfetched();
}
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:204
setWac
▸ setWac(wacRule): Promise\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf> | NotFoundHttpError\<SolidContainer | SolidLeaf> | SetWacRuleSuccess\<SolidContainer | SolidLeaf>>
Sets access rules for a specific resource
Parameters
| Name | Type | Description |
|---|---|---|
wacRule |
WacRule |
the access rules to set |
Returns
Promise\<ServerHttpError\<SolidContainer | SolidLeaf> | UnexpectedHttpError\<SolidContainer | SolidLeaf> | UnauthenticatedHttpError\<SolidContainer | SolidLeaf> | UnauthorizedHttpError\<SolidContainer | SolidLeaf> | NoncompliantPodError\<SolidContainer | SolidLeaf> | UnexpectedResourceError\<SolidContainer | SolidLeaf> | NotFoundHttpError\<SolidContainer | SolidLeaf> | SetWacRuleSuccess\<SolidContainer | SolidLeaf>>
SetWacRuleResult
Example
const resource = ldoSolidDataset
.getResource("https://example.com/container/resource.ttl");
const wacRulesResult = await resource.setWac({
public: {
read: true,
write: false,
append: false,
control: false
},
authenticated: {
read: true,
write: false,
append: true,
control: false
},
agent: {
"https://example.com/person1/profile/card#me": {
read: true,
write: true,
append: true,
control: true
}
}
});
Inherited from
Defined in
packages/connected-solid/src/resources/SolidResource.ts:724
subscribeToNotifications
▸ subscribeToNotifications(callbacks?): Promise\<string>
Activates Websocket subscriptions on this resource. Updates, deletions, and creations on this resource will be tracked and all changes will be relected in LDO's resources and graph.
Parameters
| Name | Type |
|---|---|
callbacks? |
SubscriptionCallbacks\<SolidNotificationMessage> |
Returns
Promise\<string>
SubscriptionId: A string to use to unsubscribe
Example
const resource = solidLdoDataset
.getResource("https://example.com/spiderman");
// A listener for if anything about spiderman in the global dataset is
// changed. Note that this will also listen for any local changes as well
// as changes to remote resources to which you have notification
// subscriptions enabled.
solidLdoDataset.addListener(
[namedNode("https://example.com/spiderman#spiderman"), null, null, null],
() => {
// Triggers when the file changes on the Pod or locally
console.log("Something changed about SpiderMan");
},
);
// Subscribe
const subscriptionId = await testContainer.subscribeToNotifications({
// These are optional callbacks. A subscription will automatically keep
// the dataset in sync. Use these callbacks for additional functionality.
onNotification: (message) => console.log(message),
onNotificationError: (err) => console.log(err.message)
});
// ... From there you can wait for a file to be changed on the Pod.
#### Inherited from
[SolidResource](SolidResource.md).[subscribeToNotifications](SolidResource.md#subscribetonotifications)
#### Defined in
[packages/connected-solid/src/resources/SolidResource.ts:787](https://github.com/o-development/ldo/blob/db87958cb6f858f6cf7340ba5d9536a3a794d587/packages/connected-solid/src/resources/SolidResource.ts#L787)
___
### toReadResult
▸ **toReadResult**(): [`ReadContainerResult`](../types/ReadContainerResult.md)
Converts the current state of this container to a readResult
#### Returns
[`ReadContainerResult`](../types/ReadContainerResult.md)
a ReadContainerResult
#### Overrides
[SolidResource](SolidResource.md).[toReadResult](SolidResource.md#toreadresult)
#### Defined in
[packages/connected-solid/src/resources/SolidContainer.ts:169](https://github.com/o-development/ldo/blob/db87958cb6f858f6cf7340ba5d9536a3a794d587/packages/connected-solid/src/resources/SolidContainer.ts#L169)
___
### unsubscribeFromAllNotifications
▸ **unsubscribeFromAllNotifications**(): `Promise`\<`void`\>
Unsubscribes from all notifications on this resource
#### Returns
`Promise`\<`void`\>
UnsubscribeResult[]
**`Example`**
```typescript
const subscriptionResult = await testContainer.subscribeToNotifications();
await testContainer.unsubscribeFromAllNotifications();
Inherited from
SolidResource.unsubscribeFromAllNotifications
Defined in
packages/connected-solid/src/resources/SolidResource.ts:851
unsubscribeFromNotifications
▸ unsubscribeFromNotifications(subscriptionId): Promise\<void>
Unsubscribes from changes made to this resource on the Pod
Parameters
| Name | Type |
|---|---|
subscriptionId |
string |
Returns
Promise\<void>
UnsubscribeResult
Example
const subscriptionId = await testContainer.subscribeToNotifications();
await testContainer.unsubscribeFromNotifications(subscriptionId);
Inherited from
SolidResource.unsubscribeFromNotifications
Defined in
packages/connected-solid/src/resources/SolidResource.ts:834
update
▸ update(_datasetChanges): Promise\<IgnoredInvalidUpdateSuccess\<SolidContainer>>
You cannot update a Container, so we return an IgnoredInvalidUpdateSuccess
Parameters
| Name | Type |
|---|---|
_datasetChanges |
DatasetChanges\<BaseQuad> |
Returns
Promise\<IgnoredInvalidUpdateSuccess\<SolidContainer>>
Overrides
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:585
updateWithCreateSuccess
▸ updateWithCreateSuccess(result): void
A helper method updates this resource's internal state upon create success
Parameters
| Name | Type |
|---|---|
result |
ResourceSuccess\<Resource\<string>> |
Returns
void
Inherited from
SolidResource.updateWithCreateSuccess
Defined in
packages/connected-solid/src/resources/SolidResource.ts:473
updateWithDeleteSuccess
▸ updateWithDeleteSuccess(_result): void
A helper method updates this resource's internal state upon delete success
Parameters
| Name | Type |
|---|---|
_result |
DeleteSuccess\<SolidResource> |
Returns
void
Inherited from
SolidResource.updateWithDeleteSuccess
Defined in
packages/connected-solid/src/resources/SolidResource.ts:442
updateWithReadSuccess
▸ updateWithReadSuccess(result): void
A helper method updates this container's internal state upon read success
Parameters
| Name | Type | Description |
|---|---|---|
result |
ContainerReadSuccess | ReadSuccess\<SolidContainer> |
the result of the read success |
Returns
void
Overrides
SolidResource.updateWithReadSuccess
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:137
uploadChildAndOverwrite
▸ uploadChildAndOverwrite(slug, blob, mimeType): Promise\<LeafCreateAndOverwriteResult>
Creates a new binary resource and overwrites any existing resource that existed at the URI
Parameters
| Name | Type | Description |
|---|---|---|
slug |
SolidLeafSlug |
the name of the resource |
blob |
Blob |
- |
mimeType |
string |
- |
Returns
Promise\<LeafCreateAndOverwriteResult>
the result of creating that resource
Example
const container = solidLdoDataset
.getResource("https://example.com/container/");
cosnt result = await container.uploadChildAndOverwrite(
"resource.txt",
new Blob("some text."),
"text/txt",
);
if (!result.isError) {
// Do something
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:437
uploadChildIfAbsent
▸ uploadChildIfAbsent(slug, blob, mimeType): Promise\<LeafCreateIfAbsentResult>
Creates a new binary resource and overwrites any existing resource that existed at the URI
Parameters
| Name | Type | Description |
|---|---|---|
slug |
SolidLeafSlug |
the name of the resource |
blob |
Blob |
- |
mimeType |
string |
- |
Returns
Promise\<LeafCreateIfAbsentResult>
the result of creating that resource
Example
const container = solidLdoDataset
.getResource("https://example.com/container/");
cosnt result = await container.uploadChildIfAbsent(
"resource.txt",
new Blob("some text."),
"text/txt",
);
if (!result.isError) {
// Do something
}
Defined in
packages/connected-solid/src/resources/SolidContainer.ts:466