// // Copyright © 2020, 2021 Anticrm Platform Contributors. // // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may // obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // limitations under the License. // import { AttachedDoc, Class, Data, Doc, DocumentClassQuery, DocumentUpdate, DOMAIN_TX, IndexKind, Mixin, MixinUpdate, Ref, Space, Tx, TxApplyIf, TxCollectionCUD, TxCreateDoc, TxCUD, TxMixin, TxRemoveDoc, TxUpdateDoc } from '@hcengineering/core' import { Hidden, Index, Model, Prop, TypeRef } from '@hcengineering/model' import core from './component' import { TDoc } from './core' // T R A N S A C T I O N S @Model(core.class.Tx, core.class.Doc, DOMAIN_TX) export class TTx extends TDoc implements Tx { @Prop(TypeRef(core.class.Space), core.string.Space) @Index(IndexKind.Indexed) @Hidden() objectSpace!: Ref } @Model(core.class.TxModelUpgrade, core.class.Tx, DOMAIN_TX) export class TTxModelUpgrade extends TTx {} @Model(core.class.TxCUD, core.class.Tx) export class TTxCUD extends TTx implements TxCUD { @Prop(TypeRef(core.class.Doc), core.string.Object) @Index(IndexKind.Indexed) @Hidden() objectId!: Ref @Prop(TypeRef(core.class.Class), core.string.ClassLabel) @Index(IndexKind.Indexed) @Hidden() objectClass!: Ref> } @Model(core.class.TxCreateDoc, core.class.TxCUD) export class TTxCreateDoc extends TTxCUD implements TxCreateDoc { attributes!: Data } @Model(core.class.TxCollectionCUD, core.class.TxCUD) export class TTxCollectionCUD extends TTxCUD implements TxCollectionCUD { collection!: string tx!: TxCUD

} @Model(core.class.TxMixin, core.class.TxCUD) export class TTxMixin extends TTxCUD implements TxMixin { mixin!: Ref> attributes!: MixinUpdate } @Model(core.class.TxUpdateDoc, core.class.TxCUD) export class TTxUpdateDoc extends TTxCUD implements TxUpdateDoc { operations!: DocumentUpdate } @Model(core.class.TxRemoveDoc, core.class.TxCUD) export class TTxRemoveDoc extends TTxCUD implements TxRemoveDoc {} @Model(core.class.TxApplyIf, core.class.Tx) export class TTxApplyIf extends TTx implements TxApplyIf { scope!: string // All matches should be true with at least one document. match!: DocumentClassQuery[] txes!: TxCUD[] }