Beta
Private
_agentThe Web5Agent instance that handles DWNs requests.
Private
Optional
_attestationAttestation JWS signature.
Private
_authorThe DID of the entity that authored the record.
Private
Optional
_authorizationAuthorization signature(s).
Private
_connectedThe DID of the DWN tenant under which operations are being performed.
Private
Optional
_contextContext ID associated with the record.
Private
_descriptorDescriptor detailing the record's schema, format, and other metadata.
Private
Optional
_encodedEncoded data of the record, if available.
Private
Optional
_encryptionEncryption details for the record, if the data is encrypted.
Private
_initialInitial state of the record before any updates.
Private
_initialFlag indicating if the initial write has been signed by the owner.
Private
_initialFlag indicating if the initial write has been stored, to prevent duplicates.
Private
_protocolRole under which the record is written.
Private
Optional
_readableStream of the record's data.
Private
_recordUnique identifier of the record.
Private
Optional
_remoteThe origin DID if the record was fetched from a remote DWN.
Private
Static
_sendCache to minimize the amount of redundant two-phase commits we do in store() and send() Retains awareness of the last 100 records stored/sent for up to 100 target DIDs each.
Record's signatures attestation
DID that signed the record.
Record's signatures attestation
Record's context ID
Beta
Returns the data of the current record. If the record data is not available, it attempts to fetch the data from the DWN.
a data stream with convenience methods such as blob()
, json()
, text()
, and stream()
, similar to the fetch API response
Attaches a rejection handler callback to the Promise
returned by the stream()
method.
This method is a shorthand for .then(undefined, onRejected)
, specifically designed for handling
rejection cases in the promise chain initiated by accessing the record's data. It ensures that
errors during data retrieval or processing can be caught and handled appropriately.
Optional
onRejected: ((reason) => PromiseLike<never>)A function to asynchronously execute when the stream()
promise
becomes rejected.
A Promise
that resolves to the value of the callback if it is called, or to its
original fulfillment value if the promise is instead fulfilled.
Attaches callbacks for the resolution and/or rejection of the Promise
returned by
stream()
.
This method is a proxy to the then
method of the Promise
returned by stream()
,
allowing for a seamless integration with promise-based workflows.
Optional
onFulfilled: ((value) => Readable | PromiseLike<Readable>)A function to asynchronously execute when the stream()
promise
becomes fulfilled.
Optional
onRejected: ((reason) => PromiseLike<never>)A function to asynchronously execute when the stream()
promise
becomes rejected.
A Promise
for the completion of which ever callback is executed.
Error
if the record has already been deleted.
Record's CID
Record's data format
Record's data size
Record's creation date
Record's modified date
Record's published date
Record's encryption
Record's ID
Record's initial write if the record has been updated
Interface is always Records
Record's published status
Method is always Write
Record's parent ID
Record's protocol
Record's protocol path
Role under which the author is writing the record
Record's published status (true/false)
Private
rawReturns a copy of the raw RecordsWriteMessage
that was used to create the current Record
instance.
Record's recipient
Record's schema
Beta
Signs the current record state as well as any initial write and optionally stores it to the owner's DWN. This is useful when importing a record that was signed by someone else into your own DWN.
if true, the record will be stored to the owner's DWN after signing. Defaults to true.
the status of the import request
Private
processHandles the various conditions around there being an initial write, whether to store initial/current state, and whether to add an owner signature to the initial write to enable storage when protocol rules require it.
Private
readBeta
Fetches the record's data from the specified DWN.
This private method is called when the record data is not available in-memory
and needs to be fetched from either a local or a remote DWN.
It makes a read request to the specified DWN and processes the response to provide
a Node.js Readable
stream of the record's data.
Parameters for fetching the record's data.
Indicates whether the target DWN is a remote node.
The DID of the DWN to fetch the data from.
A Promise that resolves to a Node.js Readable
stream of the record's data.
If there is an error while fetching or processing the data from the DWN.
Beta
Send the current record to a remote DWN by specifying their DID If no DID is specified, the target is assumed to be the owner (connectedDID). If an initial write is present and the Record class send cache has no awareness of it, the initial write is sent first (vs waiting for the regular DWN sync)
Optional
target: stringthe optional DID to send the record to, if none is set it is sent to the connectedDid
the status of the send record request
Error
if the record has already been deleted.
Beta
Stores the current record state as well as any initial write to the owner's DWN.
if true, the record will signed by the owner before storing it to the owner's DWN. Defaults to false.
the status of the store request
Returns a JSON representation of the Record instance.
It's called by JSON.stringify(...)
automatically.
Beta
Update the current record on the DWN.
Parameters to update the record.
the status of the update request
Error
if the record has already been deleted.
Private
Static
verifyBeta
Verifies if the properties to be mutated are mutable.
This private method is used to ensure that only mutable properties of the Record
instance
are being changed. It checks whether the properties specified for mutation are among the
set of properties that are allowed to be modified. If any of the properties to be mutated
are not in the set of mutable properties, the method throws an error.
An iterable of property names that are intended to be mutated.
A set of property names that are allowed to be mutated.
If any of the properties in propertiesToMutate
are not in mutableDescriptorProperties
.
Generated using TypeDoc
The
Record
class encapsulates a single record's data and metadata, providing a more developer-friendly interface for working with Decentralized Web Node (DWN) records.Methods are provided to read, update, and manage the record's lifecycle, including writing to remote DWNs.