The extending Model InstanceType.
Readonly
prototypeOverridden prototype
signature.
Static commit method. Calling this method on a class extending the
abstract Model base class, while supplying an operation
and all
its embedded variables
, will dispatch the Querier.Operation to
the respective Model repository through the highest priority
Querier or, if no Querier is compatible, an error is
thrown. This method is the entry point for all Model-related data
transferral and is internally called by all other distinct methods of the
Model.
The extending Model InstanceType.
The explicit static polymorphic this
parameter.
The Querier.Operation to be committed.
Optional
variables: VariablesAny Querier.Variables within the operation
.
An Observable of the commitmed operation
.
An Observable ReferenceError on incompatibility.
commit a query
-type operation:
import { ExampleModel } from './example-model';
ExampleModel.commit(`query queryExample(variable: $variable) {
result {
field
}
}`, {
variable: 'value'
}).subscribe(console.log);
Static deleteAll method. Calling this method on a class extending the
Model, while supplying an array of uuids
, will dispatch the
deletion of all Model instances identified by these UUIDs to the
respective Model repository by internally calling commit
with suitable arguments. Through this method, bulk-deletions from the
respective Model repository can be achieved.
The extending Model InstanceType.
An Observable of the deletion.
Drop all model instances by UUIDs:
import { ExampleModel } from './example-model';
ExampleModel.deleteAll([
'b050d63f-cede-46dd-8634-a80d0563ead8',
'a0164132-cd9b-4859-927e-ba68bc20c0ae',
'b3fca31e-95cd-453a-93ae-969d3b120712'
]).subscribe(console.log);
Static deleteOne method. Calling this method on a class extending the
Model, while supplying an uuid
, will dispatch the deletion of the
Model instance identified by this UUID to the respective repository
by internally calling the commit operation with suitable arguments.
Through this method, the deletion of a single Model instance from
the respective Model repository can be achieved.
The extending Model InstanceType.
An Observable of the deletion.
Drop one model instance by UUID:
import { ExampleModel } from './example-model';
ExampleModel.deleteOne(
'18f3aa99-afa5-40f4-90c2-71a2ecc25651'
).subscribe(console.log);
Static findAll method. Calling this method on a class extending the
abstract Model base class, while supplying a filter
to match
Model instances by and a graph
containing the fields to be
included in the result, will dispatch a lookup operation to the respective
repository by internally calling the commit operation with suitable
arguments. Through this method, the bulk-lookup of Model instances
from the respective Model repository can be achieved.
The extending Model InstanceType.
The explicit static polymorphic this
parameter.
A Model.Filter to find Model instances by.
A Model.Graph of fields to be returned.
An Observable of the find operation.
Lookup all UUIDs for model instances modified between two dates:
import { ExampleModel } from './example-model';
ExampleModel.findAll({
expression: {
conjunction: {
operands: [
{
entity: {
operator: 'GREATER_OR_EQUAL',
path: 'modified',
value: new Date('2021-01-01')
}
},
{
entity: {
operator: 'LESS_OR_EQUAL',
path: 'modified',
value: new Date('2021-12-12')
}
}
],
operator: 'AND'
}
}
}, [
'uuid',
'field'
]).subscribe(console.log);
Static findOne method. Calling this method on a class extending the
abstract Model base class, while supplying the shape
to match the
Model instance by and a graph
describing the fields to be
included in the result, will dispatch the lookup operation to the
respective repository by internally calling the commit operation
with suitable arguments. Through this method, the retrieval of one specific
Model instance from the respective Model repository can be
achieved.
The extending Model InstanceType.
The explicit static polymorphic this
parameter.
The Model.Shape of instance to find.
A Model.Graph of fields to be returned.
An Observable of the find operation.
Lookup one model instance by UUID:
import { ExampleModel } from './example-model';
ExampleModel.findOne({
id: '2cfe7609-c4d9-4e4f-9a8b-ad72737db48a'
}, [
'uuid',
'modified',
'field'
]).subscribe(console.log);
Static saveAll method. Calling this method on a class extending the
abstract Model base class, while supplying a list of models
which
to save and a graph
describing the fields to be returned in the result,
will dispatch the save operation to the respective Model repository
by internally calling the commit operation with suitable arguments.
Through this method, bulk-persistance of Model instances from the
respective Model repository can be achieved.
The extending Model InstanceType.
An Observable of the save operation.
Persist multiple Models:
import { ExampleModel } from './example-model';
ExampleModel.saveAll([
new ExampleModel({ field: 'example_1' }),
new ExampleModel({ field: 'example_2' }),
new ExampleModel({ field: 'example_3' })
], [
'uuid',
'modified',
'field'
]).subscribe(console.log);
Static saveOne method. Calling this method on a class extending the
abstract Model base class, while supplying a model
which to save
and a graph
describing the fields to be returned in the result, will
dispatch the save operation to the respective Model repository by
internally calling the commit operation with suitable arguments.
Through this method, persistance of one specific Model instance
from the respective Model repository can be achieved.
The extending Model InstanceType.
An Observable of the save operation.
Persist a model:
import { ExampleModel } from './example-model';
ExampleModel.saveOne(new ExampleModel({ field: 'example' }), [
'uuid',
'modified',
'field'
]).subscribe(console.log);
Static serialize method. Calling this method on a class extending the
Model, while supplying a model
which to serialize and
optionally enabling shallow
serialization, will return the serialized
Model.Shape of the Model, i.e., a plain JSON representation
of all Model fields, or undefined
, if the supplied model
does
not contain any fields or values. By serializing shallow
ly, only such
properties defined on the supplied model
are included (which means, all
one-to-one and one-to-many associations are ignored). Through this method,
the serialization of one specific Model instance from the
respective Model repository can be achieved.
The extending Model InstanceType.
The Model.Shape of the Model or undefined
.
serialize a model:
import { ExampleModel } from './example-model';
const model = new ExampleModel({ field: 'example' });
const shape = ExampleModel.serialize(model);
console.log(shape); // { field: 'example' }
Static treemap method. Calling this method on a class extending the
abstract Model base class, while supplying a model
which to
treemap and optionally enabling shallow
treemapping, will return
a Model.Graph describing the fields which are declared and defined
on the supplied model
, or undefined
, if the supplied model
does not
contain any fields or values. By treemapping shallow
ly, only
properties defined on the supplied model
are included (which means, all
one-to-one and one-to-many associations are ignored). Through this method,
the Model.Graph for one specific Model instance from the
respective Model repository can be retrieved.
The extending Model InstanceType.
The Model.Graph of the Model or undefined
.
treemap a Model:
import { ExampleModel } from './example-model';
const model = new ExampleModel({ field: 'example' });
const graph = ExampleModel.treemap(model);
console.log(graph); // ['field']
Static unravel method. Calling this method on a class extending the
abstract Model base class, while supplying a graph
describing the
fields which to unravel, will return the Model.Graph as raw
string. Through this method, the Model.Graph for one specific
Model instance from the respective Model repository can be
unraveled into a raw string. This unraveled Model.Graph can
then be consumed by, e.g., the commit method.
The extending Model InstanceType.
The unraveled Model.Graph as raw string.
unravel a Model.Graph:
import { ExampleModel } from './example-model';
const unraveled = ExampleModel.unravel([
'uuid',
'modified',
'field'
]);
console.log(unraveled); // '{id modified field}'
Static valuate method. Calling this method on a class extending the
abstract Model base class, while supplying a model
and a field
which to valuate, will return the preprocessed value (e.g., primitive
representation of JavaScript Dates) of the supplied field
of the supplied
model
. Through this method, the preprocessed field
value of one
specific Model instance from the respective Model
repository can be retrieved.
The extending Model InstanceType.
The valuated field
value.
valuate a field
:
import { ExampleModel } from './example-model';
const model = new ExampleModel({ created: new Date(0) });
const value = ExampleModel.valuate(model, 'created');
console.log(value); // '1970-01-01T00:00:00.000+00:00'
Generated using TypeDoc
Interface describing the Type, i.e., static constructable context, of classes extending the abstract Model base class.