OperationProtocol Interface

Packages > @anticrm/domains > OperationProtocol

Define operations with object modifications.

Signature:

export interface OperationProtocol 

Properties

List of properties of this interface
Property Type Description
create Doc>(_class: Ref<Class>, values: DocumentValue) => Promise Perform creation of new document and store it into storage. Object ID will be automatically generated and assigned to object.
remove Doc>(doc: T) => Promise Perform remove of object.
update Doc>(doc: T, value: PartialDoc>>) => Promise Perform update of document properties.
updateWith Doc>(doc: T, builder: (s: TxBuilder) => TxOperation | TxOperation[]) => Promise 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>;