// Copyright © 2025 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 { Card, MasterTag } from '@hcengineering/card' import { Employee } from '@hcengineering/contact' import { Class, Doc, DocumentUpdate, ObjQueryType, Ref, Tx } from '@hcengineering/core' import { Asset, IntlString, Plugin, plugin } from '@hcengineering/platform' import { ToDo } from '@hcengineering/time' import { AnyComponent } from '@hcengineering/ui' import { AttributeCategory } from '@hcengineering/view' /** * @public */ export const processId = 'process' as Plugin export interface Process extends Doc { masterTag: Ref name: string description: string states: Ref[] } export interface Execution extends Doc { process: Ref assignee: Ref | null currentToDo: Ref | null currentState: Ref | null card: Ref done: boolean rollback: Record, Tx[]> } export interface ProcessToDo extends ToDo { execution: Ref state: Ref } export type MethodParams = { [P in keyof T]?: ObjQueryType | string } & DocumentUpdate export interface State extends Doc { process: Ref title: string actions: Step[] endAction?: Step | null } export interface Step { methodId: Ref> params: MethodParams } export interface Method extends Doc { label: IntlString objectClass: Ref> requiredParams: string[] systemOnly: boolean description?: IntlString editor?: AnyComponent presenter?: AnyComponent } // add impl in server export interface ProcessFunction extends Doc { of: Ref> category?: AttributeCategory label: IntlString } export * from './types' export * from './utils' export default plugin(processId, { class: { Process: '' as Ref>, Execution: '' as Ref>, ProcessToDo: '' as Ref>, Method: '' as Ref>>, State: '' as Ref>, ProcessFunction: '' as Ref> }, method: { RunSubProcess: '' as Ref>, CreateToDo: '' as Ref>, UpdateCard: '' as Ref> }, string: { Method: '' as IntlString, Execution: '' as IntlString, Process: '' as IntlString, Step: '' as IntlString }, icon: { Process: '' as Asset, Steps: '' as Asset, States: '' as Asset }, function: { FirstValue: '' as Ref, LastValue: '' as Ref, Random: '' as Ref, UpperCase: '' as Ref, LowerCase: '' as Ref, Trim: '' as Ref } })