Operation
type Operation =
| {
model: string;
object: string;
properties: Map<string, any>;
type: "CREATE";
}
| {
model: string;
object: string;
properties: Map<string, any>;
type: "UPDATE";
}
| {
model: string;
object: string;
type: "DELETE";
}
| {
from: string;
fromModel: string;
relation: string;
to: string;
toModel: string;
type: "CREATE_RELATION";
}
| {
from: string;
fromModel: string;
relation: string;
to: string;
toModel: string;
type: "DELETE_RELATION";
};
Represents an operation that can be performed regarding data type instances.
Type declaration
{
model
: string
;
object
: string
;
properties
: Map
<string
, any
>;
type
: "CREATE"
;
}
model
model: string;
The data type tag of the instance being created.
object
object: string;
The tag of the new instance.
properties?
optional properties: Map<string, any>;
A map that maps the tag of a property to a new/updated value. You may need to parse this value to store it in your data source (e.g. JS date)
type
type: "CREATE";
Creates a new instance of a data type with the given properties.
{
model
: string
;
object
: string
;
properties
: Map
<string
, any
>;
type
: "UPDATE"
;
}
model
model: string;
The data type tag of the instance being updated.
object
object: string;
The tag of the instance being updated.
properties
properties: Map<string, any>;
A map that maps the tag of a property to a new/updated value. You may need to parse this value to store it in your data source (e.g. JS date)
type
type: "UPDATE";
Updates an existing instance of a data type with the given properties.
{
model
: string
;
object
: string
;
type
: "DELETE"
;
}
model
model: string;
The data type tag of the instance being deleted.
object
object: string;
The tag of the instance being deleted.
type
type: "DELETE";
Deletes an existing instance of a data type.
{
from
: string
;
fromModel
: string
;
relation
: string
;
to
: string
;
toModel
: string
;
type
: "CREATE_RELATION"
;
}
from
from: string;
The tag of the starting instance.
fromModel
fromModel: string;
The data type tag of the starting instance.
relation
relation: string;
The tag of the relation being created.
to
to: string;
The tag of the ending instance.
toModel
toModel: string;
The data type tag of the ending instance.
type
type: "CREATE_RELATION";
Creates a new relation between two instances of a data type.
{
from
: string
;
fromModel
: string
;
relation
: string
;
to
: string
;
toModel
: string
;
type
: "DELETE_RELATION"
;
}
from
from: string;
The tag of the starting instance.
fromModel
fromModel: string;
The data type tag of the starting instance.
relation
relation: string;
The tag of the relation being deleted.
to
to: string;
The tag of the ending instance.
toModel
toModel: string;
The data type tag of the ending instance.
type
type: "DELETE_RELATION";
Deletes an existing relation between two instances of a data type.