Replica re-defines the default value of the autoCommit
property to true
.
Indicates the default commit mode, which is used in autoCommit.
Add several entity instances to the replica
Add entity instance to the replica
Adds an identifier to this graph. Optionally writes the proposedValue
to it afterwards.
Creates a new branch of this graph. Only committed data will be "visible" in the new branch.
const graph2 = ChronoGraph.new()
const variable13 : Variable<number> = graph2.variable(5)
const branch2 = graph2.branch()
branch2.write(variable13, 10)
const value13_1 = graph2.read(variable13) // 5
const value13_2 = branch2.read(variable13) // 10
When using the branching feature in Replica, you need to reference the field values by yielding their corresponding identifiers. This is because ChronoGraph need to know in context of which branch the calculation happens and this information is encoded in the outer context. This may improve in the future.
class Author extends Entity.mix(Base) {
@calculate('fullName')
calculateFullName (Y) : string {
return Y(this.$.firstName) + ' ' + Y(this.$.lastName)
}
@calculate('fullName')
* calculateFullName (Y) : CalculationIterator<string> {
return (yield this.$.firstName) + ' ' + (yield this.$.lastName)
}
}
Configuration object for the new graph instance.
Synchronously commit the state of the graph. All potentially changed strict identifiers will be calculated during this call. If any of such identifiers will be async, an exception will be thrown.
This call marks a "stable" state of the graph and a transaction border. Using the undo call one can revert to the previous state.
See also reject.
Asynchronously commit the state of the replica. All potentially changed strict identifiers (see Identifier.lazy) will be calculated during this call.
This call marks a "stable" state of the graph and a transaction border. Using the undo call one can revert to the previous state.
See also reject.
Read the value of the identifier either synchronously or asynchronously, depending on its type (see Identifier.sync)
Tests, whether this graph has given identifier.
Returns boolean, indicating whether the auto-commit is pending.
Creates an identifier based on the given calculation function and adds it to this graph. Depending form the type of the function (sync/generator) either CalculatedValueGen or CalculatedValueSync will be created.
To have full control on the identifier creation, instantiate it yourself and add to graph using the ChronoGraph.addIdentifier call.
The calculation function of the identifier.
The context property of the newly created identifier
Creates a named identifier based on the given calculation function and adds it to this graph. Depending form the type of the function (sync/generator) either CalculatedValueGen or CalculatedValueSync will be created.
To have full control on the identifier creation, instantiate it yourself and add to graph using the ChronoGraph.addIdentifier call.
The Identifier.name property of the newly created identifier
The calculation function of the identifier.
The Identifier.context property of the newly created identifier
This method applies its 1st argument (if any) to the current instance using Object.assign()
.
Supposed to be overridden in the subclasses to customize the instance creation process.
Synchronously read the value of the given identifier from the graph.
Synchronous read can not calculate asynchronous identifiers and will throw exception
Asynchronously read the value of the given identifier from the graph.
Asynchronous read can calculate both synchronous and asynchronous identifiers
Advance the replica to the state of next transaction (marked with the commit call). Only meaningful if a undo call has been made earlier.
To enable this feature, you need to opt-in using the historyLimit configuration property.
Returns boolean, indicating whether the state transition actually happened.
Rejects the current changes in the graph and revert it to the state of the previous commit.
See also RejectEffect.
Any value, describing why reject has happened
Remove several entity instances from the replica
Remove entity instance from the replica
Removes an identifier from this graph.
Revert the replica to the state of previous transaction (marked with the commit call).
To enable this feature, you need to opt-in using the historyLimit configuration property.
Returns boolean, indicating whether the state transition actually happened.
Creates a variable identifier with the given initial value and adds it to graph.
The initial value. The undefined
value will be converted to null
Creates a named variable identifier with the given initial value and adds it to graph.
The Variable.name property of the newly created variable
The initial value. The undefined
value will be converted to null
Writes a value to the given identifier
.
This is a type-safe static constructor method, accepting a single argument, with the object, corresponding to the class properties. It will generate a compilation error, if unknown property is provided.
For example:
class MyClass extends Base {
prop : string
}
const instance : MyClass = MyClass.new({ prop : 'prop', wrong : 11 })
will produce:
TS2345: Argument of type '{ prop: string; wrong: number; }' is not assignable to parameter of type 'Partial<MyClass>'.
Object literal may only specify known properties, and 'wrong' does not exist in type 'Partial<MyClass>'
The only thing this constructor does is create an instance and call the initialize method on it, forwarding the first argument. The customization of instance is supposed to be performed in that method.
Generated using TypeDoc
An extension of Replica, specialized for interaction with project.