mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-31 20:57:31 +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) {
|
||||
|
@ -14,15 +14,32 @@
|
||||
// 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