Class: ConnectedLdoTransactionDataset\<Plugins>
A ConnectedLdoTransactionDataset has all the functionality of a ConnectedLdoDataset and represents a transaction to the parent ConnectedLdoDataset.
It is recommended to use the startTransaction
method on a SolidLdoDataset
to initialize this class
Example
import { createConnectedLdoDataset } from "@ldo/connected";
import { ProfileShapeType } from "./.ldo/profile.shapeTypes.ts"
import { solidConnectedPlugin } from "connected-solid";
// ...
const connectedLdoDataset = createConnectedLdoDataset([
solidConnectedPlugin
]);
const profileDocument = connectedLdoDataset
.getResource("https://example.com/profile");
await profileDocument.read();
const transaction = connectedLdoDataset.startTransaction();
const profile = transaction
.using(ProfileShapeType)
.fromSubject("https://example.com/profile#me");
profile.name = "Some Name";
const result = await transaction.commitToRemote();
if (result.isError) {
// handle error
}
Type parameters
Name | Type |
---|---|
Plugins |
extends ConnectedPlugin [] |
Hierarchy
LdoTransactionDataset
↳ ConnectedLdoTransactionDataset
Implements
IConnectedLdoDataset
\<Plugins
>
Constructors
constructor
• new ConnectedLdoTransactionDataset\<Plugins
>(parentDataset
, context
, datasetFactory
, transactionDatasetFactory
): ConnectedLdoTransactionDataset
\<Plugins
>
Type parameters
Name | Type |
---|---|
Plugins |
extends ConnectedPlugin \<any , any , any , any , any >[] |
Parameters
Name | Type | Description |
---|---|---|
parentDataset |
IConnectedLdoDataset \<Plugins > |
- |
context |
ConnectedContext \<Plugins > |
SolidLdoDatasetContext |
datasetFactory |
DatasetFactory \<Quad , Quad , Dataset \<Quad , Quad >> |
An optional dataset factory |
transactionDatasetFactory |
ITransactionDatasetFactory \<Quad > |
A factory for creating transaction datasets |
Returns
ConnectedLdoTransactionDataset
\<Plugins
>
Overrides
LdoTransactionDataset.constructor
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:83
Properties
context
• context: ConnectedContext
\<Plugins
>
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:68
dataset
• Protected
dataset: DatasetCore
\<Quad
, Quad
>
Implementation of
Inherited from
LdoTransactionDataset.dataset
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:3
datasetCoreFactory
• Protected
datasetCoreFactory: DatasetCoreFactory
\<Quad
, Quad
, DatasetCore
\<Quad
, Quad
>>
Implementation of
IConnectedLdoDataset.datasetCoreFactory
Inherited from
LdoTransactionDataset.datasetCoreFactory
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:4
datasetFactory
• Protected
datasetFactory: DatasetFactory
\<Quad
, Quad
, Dataset
\<Quad
, Quad
>>
Implementation of
IConnectedLdoDataset.datasetFactory
Inherited from
LdoTransactionDataset.datasetFactory
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:8
eventEmitter
• Protected
eventEmitter: EventEmitter
\<DefaultEventMap
>
Implementation of
IConnectedLdoDataset.eventEmitter
Inherited from
LdoTransactionDataset.eventEmitter
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:9
parentDataset
• Readonly
parentDataset: Dataset
\<Quad
, Quad
>
Inherited from
LdoTransactionDataset.parentDataset
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:6
resourceMap
• Protected
resourceMap: Map
\<string
, Plugins
[number
]["types"
]["resource"
]>
Serves no purpose
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:74
transactionDatasetFactory
• Protected
transactionDatasetFactory: ITransactionDatasetFactory
\<Quad
>
Implementation of
IConnectedLdoDataset.transactionDatasetFactory
Inherited from
LdoTransactionDataset.transactionDatasetFactory
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:10
Accessors
size
• get
size(): number
Returns
number
Implementation of
IConnectedLdoDataset.size
Inherited from
LdoTransactionDataset.size
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:14
Methods
[iterator]
▸ [iterator](): Iterator
\<Quad
, any
, undefined
>
Returns
Iterator
\<Quad
, any
, undefined
>
Implementation of
IConnectedLdoDataset.[iterator]
Inherited from
LdoTransactionDataset.[iterator]
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:18
add
▸ add(quad
): this
Parameters
Name | Type |
---|---|
quad |
Quad |
Returns
this
Implementation of
Inherited from
LdoTransactionDataset.add
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:15
addAll
▸ addAll(quads
): this
Parameters
Name | Type |
---|---|
quads |
Quad [] | Dataset \<Quad , Quad > |
Returns
this
Implementation of
Inherited from
LdoTransactionDataset.addAll
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:10
addListener
▸ addListener(eventName
, listener
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
IConnectedLdoDataset.addListener
Inherited from
LdoTransactionDataset.addListener
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:20
bulk
▸ bulk(changes
): this
Parameters
Name | Type |
---|---|
changes |
DatasetChanges \<Quad > |
Returns
this
Implementation of
Inherited from
LdoTransactionDataset.bulk
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:11
commit
▸ commit(): void
Returns
void
Inherited from
LdoTransactionDataset.commit
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:22
commitToRemote
▸ commitToRemote(): Promise
\<AggregateSuccess
\<UpdateDefaultGraphSuccess
| Extract
\<Awaited
\<ReturnType
\<...[...]["types"
]["resource"
]["update"
]>>, { isError
: false
}> | IgnoredInvalidUpdateSuccess
\<Plugins
[number
]["types"
]["resource"
]>> | AggregateError
\<Extract
\<Awaited
\<ReturnType
\<Plugins
[number
]["types"
]["resource"
]["update"
]>>, { isError
: true
}>>>
Commits all changes made in this transaction to the remote connected platforms as well as the parent dataset.
Returns
Promise
\<AggregateSuccess
\<UpdateDefaultGraphSuccess
| Extract
\<Awaited
\<ReturnType
\<...[...]["types"
]["resource"
]["update"
]>>, { isError
: false
}> | IgnoredInvalidUpdateSuccess
\<Plugins
[number
]["types"
]["resource"
]>> | AggregateError
\<Extract
\<Awaited
\<ReturnType
\<Plugins
[number
]["types"
]["resource"
]["update"
]>>, { isError
: true
}>>>
A success or failure
Example
import { createConnectedLdoDataset } from "@ldo/connected";
import { ProfileShapeType } from "./.ldo/profile.shapeTypes.ts"
import { solidConnectedPlugin } from "connected-solid";
// ...
const connectedLdoDataset = createConnectedLdoDataset([solidConnectedPlugin]);
const profileDocument = connectedLdoDataset
.getResource("https://example.com/profile");
await profileDocument.read();
const transaction = connectedLdoDataset.startTransaction();
const profile = transaction
.using(ProfileShapeType)
.fromSubject("https://example.com/profile#me");
profile.name = "Some Name";
const result = await transaction.commitToRemote();
if (result.isError) {
// handle error
}
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:163
contains
▸ contains(other
): boolean
Parameters
Name | Type |
---|---|
other |
Dataset \<Quad , Quad > |
Returns
boolean
Implementation of
Inherited from
LdoTransactionDataset.contains
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:8
createResource
▸ createResource\<Name
, Plugin
>(name
): Promise
\<ReturnType
\<Plugin
["createResource"
]>>
Generates a random uri and creates a resource.
Type parameters
Name | Type |
---|---|
Name |
extends any |
Plugin |
extends ConnectedPlugin \<any , any , any , any , any > |
Parameters
Name | Type |
---|---|
name |
Name |
Returns
Promise
\<ReturnType
\<Plugin
["createResource"
]>>
A created resource or an error
Example
Implementation of
IConnectedLdoDataset.createResource
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:101
delete
▸ delete(quad
): this
Parameters
Name | Type |
---|---|
quad |
Quad |
Returns
this
Implementation of
Inherited from
LdoTransactionDataset.delete
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:16
deleteMatches
▸ deleteMatches(subject?
, predicate?
, object?
, graph?
): this
Parameters
Name | Type |
---|---|
subject? |
Term |
predicate? |
Term |
object? |
Term |
graph? |
Term |
Returns
this
Implementation of
IConnectedLdoDataset.deleteMatches
Inherited from
LdoTransactionDataset.deleteMatches
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:12
difference
▸ difference(other
): Dataset
\<Quad
, Quad
>
Parameters
Name | Type |
---|---|
other |
DatasetCore \<Quad , Quad > |
Returns
Dataset
\<Quad
, Quad
>
Implementation of
IConnectedLdoDataset.difference
Inherited from
LdoTransactionDataset.difference
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:10
emit
▸ emit(eventName
, changes
): boolean
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
changes |
DatasetChanges \<Quad > |
Returns
boolean
Implementation of
Inherited from
LdoTransactionDataset.emit
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:21
equals
▸ equals(other
): boolean
Parameters
Name | Type |
---|---|
other |
Dataset \<Quad , Quad > |
Returns
boolean
Implementation of
Inherited from
LdoTransactionDataset.equals
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:11
eventNames
▸ eventNames(): QuadMatch
[]
Returns
QuadMatch
[]
Implementation of
IConnectedLdoDataset.eventNames
Inherited from
LdoTransactionDataset.eventNames
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:22
every
▸ every(iteratee
): boolean
Parameters
Name | Type |
---|---|
iteratee |
(quad : Quad , dataset : this ) => boolean |
Returns
boolean
Implementation of
Inherited from
LdoTransactionDataset.every
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:12
filter
▸ filter(iteratee
): Dataset
\<Quad
, Quad
>
Parameters
Name | Type |
---|---|
iteratee |
(quad : Quad , dataset : this ) => boolean |
Returns
Dataset
\<Quad
, Quad
>
Implementation of
Inherited from
LdoTransactionDataset.filter
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:13
forEach
▸ forEach(iteratee
): void
Parameters
Name | Type |
---|---|
iteratee |
(quad : Quad , dataset : this ) => void |
Returns
void
Implementation of
Inherited from
LdoTransactionDataset.forEach
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:14
forgetAllResources
▸ forgetAllResources(): void
Removes all resources from memory
Returns
void
Example
Implementation of
IConnectedLdoDataset.forgetAllResources
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:118
forgetResource
▸ forgetResource(uri
): boolean
Removes a resource from local memory
Parameters
Name | Type | Description |
---|---|---|
uri |
string |
the URI of the resource to remove |
Returns
boolean
true if the resource was present before removal
Example
Implementation of
IConnectedLdoDataset.forgetResource
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:115
getChanges
▸ getChanges(): DatasetChanges
\<Quad
>
Returns
DatasetChanges
\<Quad
>
Inherited from
LdoTransactionDataset.getChanges
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:24
getMaxListeners
▸ getMaxListeners(): number
Returns
number
Implementation of
IConnectedLdoDataset.getMaxListeners
Inherited from
LdoTransactionDataset.getMaxListeners
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:23
getResource
▸ getResource\<Name
, Plugin
, UriType
>(uri
, pluginName?
): GetResourceReturnType
\<Plugin
, UriType
>
Retireves a representation of a Resource at the given URI. This resource represents the current state of the resource: whether it is currently fetched or in the process of fetching as well as some information about it.
Type parameters
Name | Type |
---|---|
Name |
extends any |
Plugin |
extends ConnectedPlugin \<any , any , any , any , any > |
UriType |
extends string |
Parameters
Name | Type | Description |
---|---|---|
uri |
UriType |
the URI of the resource |
pluginName? |
Name |
optionally, force this function to choose a specific plugin to use rather than perform content negotiation. |
Returns
GetResourceReturnType
\<Plugin
, UriType
>
a Resource
Example
Implementation of
IConnectedLdoDataset.getResource
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:93
has
▸ has(quad
): boolean
Parameters
Name | Type |
---|---|
quad |
Quad |
Returns
boolean
Implementation of
Inherited from
LdoTransactionDataset.has
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:17
import
▸ import(stream
): Promise
\<ConnectedLdoTransactionDataset
\<Plugins
>>
Parameters
Name | Type |
---|---|
stream |
Stream \<Quad > |
Returns
Promise
\<ConnectedLdoTransactionDataset
\<Plugins
>>
Implementation of
Inherited from
LdoTransactionDataset.import
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:15
intersection
▸ intersection(other
): Dataset
\<Quad
, Quad
>
Parameters
Name | Type |
---|---|
other |
Dataset \<Quad , Quad > |
Returns
Dataset
\<Quad
, Quad
>
Implementation of
IConnectedLdoDataset.intersection
Inherited from
LdoTransactionDataset.intersection
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:16
listenerCount
▸ listenerCount(eventName
): number
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
Returns
number
Implementation of
IConnectedLdoDataset.listenerCount
Inherited from
LdoTransactionDataset.listenerCount
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:24
listeners
▸ listeners(eventName
): nodeEventListener
\<Quad
>[]
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
Returns
nodeEventListener
\<Quad
>[]
Implementation of
IConnectedLdoDataset.listeners
Inherited from
LdoTransactionDataset.listeners
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:25
map
▸ map(iteratee
): Dataset
\<Quad
, Quad
>
Parameters
Name | Type |
---|---|
iteratee |
(quad : Quad , dataset : this ) => Quad |
Returns
Dataset
\<Quad
, Quad
>
Implementation of
Inherited from
LdoTransactionDataset.map
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:17
match
▸ match(subject?
, predicate?
, object?
, graph?
): Dataset
\<Quad
, Quad
>
Parameters
Name | Type |
---|---|
subject? |
null | Term |
predicate? |
null | Term |
object? |
null | Term |
graph? |
null | Term |
Returns
Dataset
\<Quad
, Quad
>
Implementation of
Inherited from
LdoTransactionDataset.match
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:13
off
▸ off(eventName
, listener
): void
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
void
Implementation of
Inherited from
LdoTransactionDataset.off
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:26
on
▸ on(eventName
, listener
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
Inherited from
LdoTransactionDataset.on
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:27
once
▸ once(eventName
, listener
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
Inherited from
LdoTransactionDataset.once
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:28
prependListener
▸ prependListener(eventName
, listener
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
IConnectedLdoDataset.prependListener
Inherited from
LdoTransactionDataset.prependListener
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:29
prependOnceListener
▸ prependOnceListener(eventName
, listener
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
IConnectedLdoDataset.prependOnceListener
Inherited from
LdoTransactionDataset.prependOnceListener
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:30
rawListeners
▸ rawListeners(eventName
): nodeEventListener
\<Quad
>[]
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
Returns
nodeEventListener
\<Quad
>[]
Implementation of
IConnectedLdoDataset.rawListeners
Inherited from
LdoTransactionDataset.rawListeners
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:35
reduce
▸ reduce\<A
>(iteratee
, initialValue?
): A
Type parameters
Name | Type |
---|---|
A |
unknown |
Parameters
Name | Type |
---|---|
iteratee |
(accumulator : A , quad : Quad , dataset : this ) => A |
initialValue? |
A |
Returns
A
Implementation of
Inherited from
LdoTransactionDataset.reduce
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:18
removeAllListeners
▸ removeAllListeners(eventName
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
Returns
this
Implementation of
IConnectedLdoDataset.removeAllListeners
Inherited from
LdoTransactionDataset.removeAllListeners
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:31
removeListener
▸ removeListener(eventName
, listener
): this
Parameters
Name | Type |
---|---|
eventName |
QuadMatch |
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
IConnectedLdoDataset.removeListener
Inherited from
LdoTransactionDataset.removeListener
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:32
removeListenerFromAllEvents
▸ removeListenerFromAllEvents(listener
): this
Parameters
Name | Type |
---|---|
listener |
nodeEventListener \<Quad > |
Returns
this
Implementation of
IConnectedLdoDataset.removeListenerFromAllEvents
Inherited from
LdoTransactionDataset.removeListenerFromAllEvents
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:33
rollback
▸ rollback(): void
Returns
void
Inherited from
LdoTransactionDataset.rollback
Defined in
packages/subscribable-dataset/dist/TransactionDataset.d.ts:23
setContext
▸ setContext\<Name
, Plugin
>(name
, context
): void
Sets conetext for a specific plugin
Type parameters
Name | Type |
---|---|
Name |
extends any |
Plugin |
extends ConnectedPlugin \<any , any , any , any , any > |
Parameters
Name | Type | Description |
---|---|---|
name |
Name |
- |
context |
Plugin ["types" ]["context" ] |
the context for this specific plugin |
Returns
void
Implementation of
IConnectedLdoDataset.setContext
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:108
setMaxListeners
▸ setMaxListeners(n
): this
Parameters
Name | Type |
---|---|
n |
number |
Returns
this
Implementation of
IConnectedLdoDataset.setMaxListeners
Inherited from
LdoTransactionDataset.setMaxListeners
Defined in
packages/subscribable-dataset/dist/SubscribableDataset.d.ts:34
some
▸ some(iteratee
): boolean
Parameters
Name | Type |
---|---|
iteratee |
(quad : Quad , dataset : this ) => boolean |
Returns
boolean
Implementation of
Inherited from
LdoTransactionDataset.some
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:19
startTransaction
▸ startTransaction(): ConnectedLdoTransactionDataset
\<Plugins
>
Returns
ConnectedLdoTransactionDataset
\<Plugins
>
Implementation of
IConnectedLdoDataset.startTransaction
Overrides
LdoTransactionDataset.startTransaction
Defined in
packages/connected/src/ConnectedLdoTransactionDataset.ts:122
toArray
▸ toArray(): Quad
[]
Returns
Quad
[]
Implementation of
Inherited from
LdoTransactionDataset.toArray
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:20
toCanonical
▸ toCanonical(): string
Returns
string
Implementation of
IConnectedLdoDataset.toCanonical
Inherited from
LdoTransactionDataset.toCanonical
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:21
toStream
▸ toStream(): Stream
\<Quad
>
Returns
Stream
\<Quad
>
Implementation of
Inherited from
LdoTransactionDataset.toStream
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:22
toString
▸ toString(): string
Returns
string
Implementation of
Inherited from
LdoTransactionDataset.toString
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:23
union
▸ union(other
): Dataset
\<Quad
, Quad
>
Parameters
Name | Type |
---|---|
other |
Dataset \<Quad , Quad > |
Returns
Dataset
\<Quad
, Quad
>
Implementation of
Inherited from
LdoTransactionDataset.union
Defined in
packages/dataset/dist/ExtendedDataset.d.ts:24
usingType
▸ usingType\<Type
>(shapeType
): LdoBuilder
\<Type
>
Type parameters
Name | Type |
---|---|
Type |
extends LdoBase |
Parameters
Name | Type |
---|---|
shapeType |
ShapeType \<Type > |
Returns
LdoBuilder
\<Type
>
Implementation of
IConnectedLdoDataset.usingType
Inherited from
LdoTransactionDataset.usingType
Defined in
packages/ldo/dist/LdoTransactionDataset.d.ts:8