2021-08-05 06:47:54 +00:00
|
|
|
//
|
|
|
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
|
|
|
// Copyright © 2021 Hardcore Engineering Inc.
|
2021-08-05 09:30:14 +00:00
|
|
|
//
|
2021-08-05 06:47:54 +00:00
|
|
|
// 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
|
2021-08-05 09:30:14 +00:00
|
|
|
//
|
2021-08-05 06:47:54 +00:00
|
|
|
// 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.
|
2021-08-05 09:30:14 +00:00
|
|
|
//
|
2021-08-05 06:47:54 +00:00
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
2021-08-05 09:30:14 +00:00
|
|
|
import type { Resource, Plugin } from '@anticrm/platform'
|
|
|
|
import { plugin } from '@anticrm/platform'
|
2021-08-05 13:19:27 +00:00
|
|
|
import type { Doc, Tx, TxFactory, Class, Ref } from '@anticrm/core'
|
2021-08-05 06:47:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
2021-08-05 13:19:27 +00:00
|
|
|
export type TriggerFunc = (tx: Tx, txFactory: TxFactory) => Promise<Tx[]>
|
2021-08-05 06:47:54 +00:00
|
|
|
|
2021-08-05 09:30:14 +00:00
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
2021-08-05 13:19:27 +00:00
|
|
|
export interface Trigger extends Doc {
|
|
|
|
trigger: Resource<TriggerFunc>
|
2021-08-05 09:30:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export const serverCoreId = 'server-core' as Plugin
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export default plugin(serverCoreId, {
|
2021-08-05 13:19:27 +00:00
|
|
|
class: {
|
|
|
|
Trigger: '' as Ref<Class<Trigger>>
|
2021-08-05 09:30:14 +00:00
|
|
|
}
|
|
|
|
})
|