Skip to content

Class: SolidLeaf

Represents the current status of a specific Leaf on a Pod as known by LDO.

Example

const leaf = solidLdoDataset
  .getResource("https://example.com/container/resource.ttl");

Hierarchy

SolidLeaf

Constructors

constructor

new SolidLeaf(uri, context): SolidLeaf

Parameters

Name Type Description
uri SolidLeafUri The uri of the leaf
context ConnectedContext\<SolidConnectedPlugin[]> SolidLdoDatasetContext for the parent dataset

Returns

SolidLeaf

Overrides

SolidResource.constructor

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:80

Properties

absent

Protected absent: undefined | boolean

True if this resource has been fetched but does not exist

Inherited from

SolidResource.absent

Defined in

packages/connected-solid/src/resources/SolidResource.ts:104


binaryData

Protected binaryData: undefined | { blob: Blob ; mimeType: string }

The raw binary data if this leaf is a Binary resource

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:74


context

Protected Readonly context: ConnectedContext\<SolidConnectedPlugin[]>

The ConnectedContext from the Parent Dataset

Inherited from

SolidResource.context

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

SolidResource.didInitialFetch

Defined in

packages/connected-solid/src/resources/SolidResource.ts:98


isError

Readonly isError: false

Indicates that this resource is not an error

Overrides

SolidResource.isError

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:58


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: LeafBatchedRequester

Batched Requester for the Leaf

Overrides

SolidResource.requester

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:48


status

status: BinaryReadSuccess | Unfetched\<SolidLeaf> | DeleteSuccess\<SolidLeaf> | ServerHttpError\<SolidLeaf> | UnexpectedHttpError\<SolidLeaf> | UnauthenticatedHttpError\<SolidLeaf> | UnauthorizedHttpError\<SolidLeaf> | UnexpectedResourceError\<SolidLeaf> | CreateSuccess\<SolidLeaf> | DataReadSuccess | AbsentReadSuccess\<SolidLeaf> | NoncompliantPodError\<SolidLeaf> | UpdateSuccess\<SolidLeaf>

The status of the last request made for this leaf

Overrides

SolidResource.status

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:63


type

Readonly type: "SolidLeaf"

Indicates that this resource is a leaf resource

Overrides

SolidResource.type

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:53


uri

Readonly uri: SolidLeafUri

The URI of the leaf

Overrides

SolidResource.uri

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:42


wacRule

Protected Optional wacRule: WacRule

If a wac rule was fetched, it is cached here

Inherited from

SolidResource.wacRule

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

SolidResource.wacUri

Defined in

packages/connected-solid/src/resources/SolidResource.ts:110

Methods

createAndOverwrite

createAndOverwrite(): Promise\<LeafCreateAndOverwriteResult>

Creates a leaf at this URI and overwrites any that already exists

Returns

Promise\<LeafCreateAndOverwriteResult>

LeafCreateAndOverwriteResult

Example

const result = await leaf.createAndOverwrite();
if (!result.isError) {
  // Do something
}

Overrides

SolidResource.createAndOverwrite

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:405


createIfAbsent

createIfAbsent(): Promise\<LeafCreateIfAbsentResult>

Creates a leaf at this URI if the leaf doesn't already exist

Returns

Promise\<LeafCreateIfAbsentResult>

LeafCreateIfAbsentResult

Example

const result = await leaf.createIfAbsent();
if (!result.isError) {
  // Do something
}

Overrides

SolidResource.createIfAbsent

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:424


delete

delete(): Promise\<DeleteResult\<SolidLeaf>>

Deletes this leaf and all its contents

Returns

Promise\<DeleteResult\<SolidLeaf>>

A Delete result for this leaf

const result = await container.leaf();
if (!result.isError) {
  // Do something
}

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:368


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


getBlob

getBlob(): undefined | Blob

If this resource is a binary resource, returns the Blob

Returns

undefined | Blob

The Blob if this resource is a binary resource, undefined otherwise

Example

// Logs "some text."
console.log(leaf.getBlob()?.toString());

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:160


getMimeType

getMimeType(): undefined | string

If this resource is a binary resource, returns the mime type

Returns

undefined | string

The mime type if this resource is a binary resource, undefined otherwise

Example

// Logs "text/txt"
console.log(leaf.getMimeType());

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:145


getParentContainer

getParentContainer(): Promise\<SolidContainer>

Gets the parent container for this leaf by making a request

Returns

Promise\<SolidContainer>

The parent container

Example

const leaf = solidLdoDataset
  .getResource("https://example.com/container/resource.ttl");
const leafParent = await leaf.getParentContainer();
if (!leafParent.isError) {
  // Logs "https://example.com/container/"
  console.log(leafParent.uri);
}

Overrides

SolidResource.getParentContainer

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:309


getRootContainer

getRootContainer(): Promise\<SolidContainer | CheckRootResultError | NoRootContainerError\<SolidContainer>>

Gets the root container for this leaf.

Returns

Promise\<SolidContainer | CheckRootResultError | NoRootContainerError\<SolidContainer>>

The root container for this leaf

Example

Suppose the root container is at https://example.com/

const leaf = ldoSolidDataset
  .getResource("https://example.com/container/resource.ttl");
const rootContainer = await leaf.getRootContainer();
if (!rootContainer.isError) {
  // logs "https://example.com/"
  console.log(rootContainer.uri);
}

Overrides

SolidResource.getRootContainer

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:331


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

SolidResource.getWac

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

SolidResource.getWacUri

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\<SolidLeaf>>

Returns

Promise\<DeleteResult\<SolidLeaf>>

Overrides

SolidResource.handleDelete

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:375


handleRead

handleRead(): Promise\<ReadContainerResult | ReadLeafResult>

A helper method that handles the core functions for reading

Returns

Promise\<ReadContainerResult | ReadLeafResult>

ReadResult

Inherited from

SolidResource.handleRead

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

SolidResource.isAbsent

Defined in

packages/connected-solid/src/resources/SolidResource.ts:319


isBinary

isBinary(): undefined | boolean

Check if this resource is a binary resource

Returns

undefined | boolean

True if this resource is a binary resource, false if not, undefined if unknown

Example

// Logs "undefined"
console.log(leaf.isBinary());
const result = await leaf.read();
if (!result.isError) {
  // Logs "true"
  console.log(leaf.isBinary());
}

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:180


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

SolidResource.isCreating

Defined in

packages/connected-solid/src/resources/SolidResource.ts:183


isDataResource

isDataResource(): undefined | boolean

Check if this resource is a data (RDF) resource

Returns

undefined | boolean

True if this resource is a data resource, false if not, undefined if unknown

Example

// Logs "undefined"
console.log(leaf.isDataResource());
const result = await leaf.read();
if (!result.isError) {
  // Logs "true"
  console.log(leaf.isDataResource());
}

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:203


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

SolidResource.isDeleting

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

SolidResource.isFetched

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

SolidResource.isLoading

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

SolidResource.isPresent

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

SolidResource.isReading

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

SolidResource.isReloading

Defined in

packages/connected-solid/src/resources/SolidResource.ts:256


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

SolidResource.isUnfetched

Defined in

packages/connected-solid/src/resources/SolidResource.ts:300


isUpdating

isUpdating(): boolean

Checks to see if the resource is currently updating data

Returns

boolean

true if the current resource is updating

Example

leaf.update(datasetChanges).then(() => {
  // Logs "false"
  console.log(leaf.isUpdating())
});
// Logs "true"
console.log(leaf.isUpdating());

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:130


isUploading

isUploading(): boolean

Checks to see if the resource is currently uploading data

Returns

boolean

true if the current resource is uploading

Example

leaf.uploadAndOverwrite(new Blob("some text"), "text/txt").then(() => {
  // Logs "false"
  console.log(leaf.isUploading())
});
// Logs "true"
console.log(leaf.isUploading());

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:112


onNotification

onNotification(message): Promise\<void>

Function that triggers whenever a notification is recieved.

Parameters

Name Type
message SolidNotificationMessage

Returns

Promise\<void>

Inherited from

SolidResource.onNotification

Defined in

packages/connected-solid/src/resources/SolidResource.ts:799


read

read(): Promise\<ReadLeafResult>

Reads the leaf by making a request

Returns

Promise\<ReadLeafResult>

A read result

Example

const result = await leaf.read();
if (result.isError) {
  // Do something
}

Overrides

SolidResource.read

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:244


readIfUnfetched

readIfUnfetched(): Promise\<ReadLeafResult>

Makes a request to read this leaf if it hasn't been fetched yet. If it has, return the cached informtation

Returns

Promise\<ReadLeafResult>

a ReadLeafResult

Example

const result = await leaf.read();
if (!result.isError) {
  // Will execute without making a request
  const result2 = await leaf.readIfUnfetched();
}

Overrides

SolidResource.readIfUnfetched

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:284


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

SolidResource.setWac

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**(): [`ReadLeafResult`](../types/ReadLeafResult.md)

Converts the current state of this leaf to a readResult

#### Returns

[`ReadLeafResult`](../types/ReadLeafResult.md)

a ReadLeafResult

#### Overrides

[SolidResource](SolidResource.md).[toReadResult](SolidResource.md#toreadresult)

#### Defined in

[packages/connected-solid/src/resources/SolidLeaf.ts:255](https://github.com/o-development/ldo/blob/db87958cb6f858f6cf7340ba5d9536a3a794d587/packages/connected-solid/src/resources/SolidLeaf.ts#L255)

___

### 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(changes): Promise\<UpdateResult\<SolidLeaf>>

Updates a data resource with the changes provided

Parameters

Name Type Description
changes DatasetChanges\<Quad> Dataset changes that will be applied to the resoruce

Returns

Promise\<UpdateResult\<SolidLeaf>>

An UpdateResult

Example

import {
  updateDataResource,
  transactionChanges,
  changeData,
  createSolidLdoDataset,
} from "@ldo/solid";

//...

// Get a Linked Data Object
const profile = solidLdoDataset
  .usingType(ProfileShapeType)
  .fromSubject("https://example.com/profile#me");
cosnt resource = solidLdoDataset
  .getResource("https://example.com/profile");
// Create a transaction to change data
const cProfile = changeData(profile, resource);
cProfile.name = "John Doe";
// Get data in "DatasetChanges" form
const datasetChanges = transactionChanges(someLinkedDataObject);
// Use "update" to apply the changes
cosnt result = resource.update(datasetChanges);

Overrides

SolidResource.update

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:538


updateWithCreateSuccess

updateWithCreateSuccess(_result): void

A helper method updates this leaf's internal state upon create success

Parameters

Name Type Description
_result ResourceSuccess\<SolidLeaf> the result of the create success

Returns

void

Overrides

SolidResource.updateWithCreateSuccess

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:389


updateWithDeleteSuccess

updateWithDeleteSuccess(result): void

A helper method updates this leaf's internal state upon delete success

Parameters

Name Type Description
result DeleteSuccess\<SolidLeaf> the result of the delete success

Returns

void

Overrides

SolidResource.updateWithDeleteSuccess

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:352


updateWithReadSuccess

updateWithReadSuccess(result): void

A helper method updates this leaf's internal state upon read success

Parameters

Name Type Description
result BinaryReadSuccess | DataReadSuccess | AbsentReadSuccess\<SolidLeaf> the result of the read success

Returns

void

Overrides

SolidResource.updateWithReadSuccess

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:221


uploadAndOverwrite

uploadAndOverwrite(blob, mimeType): Promise\<LeafCreateAndOverwriteResult>

Uploads a binary resource to this URI. If there is already a resource present at this URI, it will be overwritten

Parameters

Name Type Description
blob Blob the Blob of the binary
mimeType string the MimeType of the binary

Returns

Promise\<LeafCreateAndOverwriteResult>

A LeafCreateAndOverwriteResult

Example

const result = await leaf.uploadAndOverwrite(
  new Blob("some text."),
  "text/txt",
);
if (!result.isError) {
  // Do something
}

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:456


uploadIfAbsent

uploadIfAbsent(blob, mimeType): Promise\<LeafCreateIfAbsentResult>

Uploads a binary resource to this URI tf there not is already a resource present at this URI.

Parameters

Name Type Description
blob Blob the Blob of the binary
mimeType string the MimeType of the binary

Returns

Promise\<LeafCreateIfAbsentResult>

A LeafCreateIfAbsentResult

Example

const result = await leaf.uploadIfAbsent(
  new Blob("some text."),
  "text/txt",
);
if (!result.isError) {
  // Do something
}

Defined in

packages/connected-solid/src/resources/SolidLeaf.ts:488