Type export/import (#10373)

* Type export/import

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>

* Fix formatting

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>

* Fix ID attributes

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>

---------

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2026-01-08 11:15:11 +07:00
committed by GitHub
parent b89613780d
commit 90b93b97c8
26 changed files with 347 additions and 35 deletions
+22
View File
@@ -0,0 +1,22 @@
import { type MasterTag } from '@hcengineering/card'
import { type Class, type Doc, type Ref } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import process from './plugin'
export function exportProcess (_id: Ref<MasterTag>): {
docs: Doc[]
required: Array<Ref<Class<Doc>>>
} {
const docs: Doc[] = []
const client = getClient()
const m = client.getModel()
const processes = m.findAllSync(process.class.Process, { masterTag: _id })
for (const proc of processes) {
docs.push(proc)
docs.push(...m.findAllSync(process.class.State, { process: proc._id }))
docs.push(...m.findAllSync(process.class.Transition, { process: proc._id }))
}
return { docs, required: [] }
}
+2
View File
@@ -89,6 +89,7 @@ import {
eventCheck
} from './utils'
import FieldChangesEditor from './components/settings/FieldChangesEditor.svelte'
import { exportProcess } from './exporter'
export * from './query'
@@ -178,6 +179,7 @@ export default async (): Promise<Resources> => ({
OnEventCheck: eventCheck
},
function: {
ExportProcess: exportProcess,
ShowDoneQuery: showDoneQuery,
// eslint-disable-next-line @typescript-eslint/unbound-method
CreateMiddleware: ProcessMiddleware.create