mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-30 12:20:00 +00:00
fix triggers
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
e25d9ed618
commit
e1f87b97ea
@ -19,6 +19,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.7",
|
||||
"@anticrm/platform": "~0.6.3"
|
||||
"@anticrm/platform": "~0.6.3",
|
||||
"@anticrm/server-core": "~0.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -13,17 +13,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type {
|
||||
Tx,
|
||||
Ref,
|
||||
Doc,
|
||||
Class,
|
||||
DocumentQuery,
|
||||
FindResult,
|
||||
FindOptions
|
||||
} from '@anticrm/core'
|
||||
import type { Tx, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions } from '@anticrm/core'
|
||||
import { getResource } from '@anticrm/platform'
|
||||
import core, { ModelDb, TxDb, Hierarchy, DOMAIN_TX, TxFactory } from '@anticrm/core'
|
||||
import serverCore from '@anticrm/server-core'
|
||||
|
||||
import * as txJson from './model.tx.json'
|
||||
|
||||
@ -66,7 +59,8 @@ class DevStorage implements ServerStorage {
|
||||
}
|
||||
await Promise.all([this.modeldb.tx(tx), this.txdb.tx(tx)])
|
||||
// invoke triggers
|
||||
const triggers = this.hierarchy.getClass(tx.objectClass).triggers
|
||||
const clazz = this.hierarchy.getClass(tx.objectClass)
|
||||
const triggers = this.hierarchy.as(clazz, serverCore.mixin.Triggers).triggers
|
||||
if (triggers !== undefined) {
|
||||
const derived: Tx[] = []
|
||||
for (const trigger of triggers) {
|
||||
|
@ -1,28 +1,45 @@
|
||||
//
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021 Hardcore Engineering Inc.
|
||||
//
|
||||
//
|
||||
// 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 type { Resource } from '@anticrm/platform'
|
||||
import type { Class, Obj, Arr, Tx, TxFactory } from '@anticrm/core'
|
||||
import type { Resource, Plugin } from '@anticrm/platform'
|
||||
import { plugin } from '@anticrm/platform'
|
||||
import type { Class, Obj, Arr, Tx, TxFactory, Mixin, Ref } from '@anticrm/core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type Trigger = Resource<(tx: Tx, txFactory: TxFactory) => Promise<Tx[]>>
|
||||
|
||||
export type Trigger = Resource<(tx: Tx, txFactory: TxFactory) => Promise<Tx[]>>
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Triggers extends Class<Obj> {
|
||||
triggers: Arr<Resource
|
||||
}
|
||||
triggers: Arr<Trigger>
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const serverCoreId = 'server-core' as Plugin
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export default plugin(serverCoreId, {
|
||||
mixin: {
|
||||
Triggers: '' as Ref<Mixin<Triggers>>
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user