OperationProtocol Interface
Packages > @anticrm/domains > OperationProtocol
Define operations with object modifications.
Signature:
export interface OperationProtocol
Properties
Property | Type | Description |
---|---|---|
create | Perform creation of new document and store it into storage. Object ID will be automatically generated and assigned to object. | |
remove | Perform remove of object. | |
update | Perform update of document properties. | |
updateWith | Perform update of document/embedded document properties using a builder pattern.It is possible to do a set, pull, push for different field values.push and pull are applicable only for array attributes. |
Events
create
Perform creation of new document and store it into storage. Object ID will be automatically generated and assigned to object.
Signature:
create: <T extends Doc>(_class: Ref<Class<T>>, values: DocumentValue<T>) => Promise<T>;
remove
Perform remove of object.
Signature:
remove: <T extends Doc>(doc: T) => Promise<T>;
update
Perform update of document properties.
Signature:
update: <T extends Doc>(doc: T, value: Partial<Omit<T, keyof Doc>>) => Promise<T>;
updateWith
Perform update of document/embedded document properties using a builder pattern.
It is possible to do a set, pull, push for different field values.
push and pull are applicable only for array attributes.
Signature:
updateWith: <T extends Doc>(doc: T, builder: (s: TxBuilder<T>) => TxOperation | TxOperation[]) => Promise<T>;