@things-factory/process 8.0.40 → 9.0.0-9.0.0-beta.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist-client/tsconfig.tsbuildinfo +1 -1
  2. package/dist-server/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +11 -14
  4. package/client/actions/main.ts +0 -1
  5. package/client/bootstrap.ts +0 -8
  6. package/client/index.ts +0 -1
  7. package/client/pages/event/event-importer.ts +0 -86
  8. package/client/pages/event/event-list-page.ts +0 -324
  9. package/client/pages/gateway/gateway-importer.ts +0 -87
  10. package/client/pages/gateway/gateway-list-page.ts +0 -323
  11. package/client/pages/main.ts +0 -25
  12. package/client/pages/process/process-importer.ts +0 -87
  13. package/client/pages/process/process-list-page.ts +0 -324
  14. package/client/pages/process-instance/process-instance-importer.ts +0 -87
  15. package/client/pages/process-instance/process-instance-list-page.ts +0 -323
  16. package/client/pages/process-thread/process-thread-importer.ts +0 -87
  17. package/client/pages/process-thread/process-thread-list-page.ts +0 -323
  18. package/client/reducers/main.ts +0 -17
  19. package/client/route.ts +0 -27
  20. package/client/tsconfig.json +0 -13
  21. package/server/controllers/common.ts +0 -90
  22. package/server/controllers/index.ts +0 -0
  23. package/server/controllers/process-instance/abort.ts +0 -75
  24. package/server/controllers/process-instance/end.ts +0 -74
  25. package/server/controllers/process-instance/index.ts +0 -2
  26. package/server/controllers/process-thread/_abort.ts +0 -20
  27. package/server/controllers/process-thread/abort.ts +0 -48
  28. package/server/controllers/process-thread/end.ts +0 -54
  29. package/server/controllers/process-thread/index.ts +0 -3
  30. package/server/controllers/process-thread/start.ts +0 -49
  31. package/server/index.ts +0 -4
  32. package/server/middlewares/index.ts +0 -3
  33. package/server/migrations/index.ts +0 -9
  34. package/server/routes.ts +0 -80
  35. package/server/service/index.ts +0 -44
  36. package/server/service/process/event-subscriber.ts +0 -17
  37. package/server/service/process/index.ts +0 -9
  38. package/server/service/process/process-history.ts +0 -108
  39. package/server/service/process/process-mutation.ts +0 -210
  40. package/server/service/process/process-query.ts +0 -120
  41. package/server/service/process/process-search-key-item-type.ts +0 -16
  42. package/server/service/process/process-type.ts +0 -65
  43. package/server/service/process/process.ts +0 -97
  44. package/server/service/process-instance/event-subscriber.ts +0 -44
  45. package/server/service/process-instance/index.ts +0 -10
  46. package/server/service/process-instance/process-instance-history.ts +0 -154
  47. package/server/service/process-instance/process-instance-mutation.ts +0 -33
  48. package/server/service/process-instance/process-instance-query.ts +0 -141
  49. package/server/service/process-instance/process-instance-subscription.ts +0 -46
  50. package/server/service/process-instance/process-instance-type.ts +0 -71
  51. package/server/service/process-instance/process-instance.ts +0 -147
  52. package/server/service/process-stats/index.ts +0 -3
  53. package/server/service/process-stats/process-stats-query.ts +0 -57
  54. package/server/service/process-stats/process-stats-type.ts +0 -31
  55. package/server/service/process-thread/event-subscriber.ts +0 -31
  56. package/server/service/process-thread/index.ts +0 -9
  57. package/server/service/process-thread/process-thread-mutation.ts +0 -34
  58. package/server/service/process-thread/process-thread-query.ts +0 -61
  59. package/server/service/process-thread/process-thread-subscription.ts +0 -42
  60. package/server/service/process-thread/process-thread-type.ts +0 -15
  61. package/server/service/process-thread/process-thread.ts +0 -90
  62. package/server/tsconfig.json +0 -10
@@ -1,323 +0,0 @@
1
- import '@operato/data-grist'
2
-
3
- import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
- import { PageView, store } from '@operato/shell'
5
- import { css, html } from 'lit'
6
- import { customElement, property, query } from 'lit/decorators.js'
7
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
- import { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'
9
- import { client } from '@operato/graphql'
10
- import { i18next, localize } from '@operato/i18n'
11
- import { notify, openPopup } from '@operato/layout'
12
- import { isMobileDevice } from '@operato/utils'
13
-
14
- import { connect } from 'pwa-helpers/connect-mixin'
15
- import gql from 'graphql-tag'
16
-
17
- import { ProcessThreadImporter } from './process-thread-importer'
18
-
19
- @customElement('process-thread-list-page')
20
- export class ProcessThreadListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
21
- static styles = [
22
- ScrollbarStyles,
23
- CommonGristStyles,
24
- CommonHeaderStyles,
25
- css`
26
- :host {
27
- display: flex;
28
-
29
- width: 100%;
30
-
31
- --grid-record-emphasized-background-color: #8b0000;
32
- --grid-record-emphasized-color: #ff6b6b;
33
- }
34
-
35
- ox-grist {
36
- overflow-y: auto;
37
- flex: 1;
38
- }
39
-
40
- ox-filters-form {
41
- flex: 1;
42
- }
43
- `
44
- ]
45
-
46
- static get scopedElements() {
47
- return {
48
- 'process-thread-importer': ProcessThreadImporter
49
- }
50
- }
51
-
52
- @property({ type: Object }) gristConfig: any
53
- @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
54
-
55
- @query('ox-grist') private grist!: DataGrist
56
-
57
- get context() {
58
- return {
59
- title: i18next.t('title.process-thread list'),
60
- search: {
61
- handler: (search: string) => {
62
- this.grist.searchText = search
63
- },
64
- value: this.grist?.searchText || ''
65
- },
66
- filter: {
67
- handler: () => {
68
- this.grist.toggleHeadroom()
69
- }
70
- },
71
- help: 'process/process-thread',
72
- actions: [
73
- {
74
- title: i18next.t('button.save'),
75
- action: this._updateProcessThread.bind(this),
76
- ...CommonButtonStyles.save
77
- },
78
- {
79
- title: i18next.t('button.delete'),
80
- action: this._deleteProcessThread.bind(this),
81
- ...CommonButtonStyles.delete
82
- }
83
- ],
84
- exportable: {
85
- name: i18next.t('title.process-thread list'),
86
- data: this.exportHandler.bind(this)
87
- },
88
- importable: {
89
- handler: this.importHandler.bind(this)
90
- }
91
- }
92
- }
93
-
94
- render() {
95
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
96
-
97
- return html`
98
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
99
- <div slot="headroom" class="header">
100
- <div class="filters">
101
- <ox-filters-form autofocus></ox-filters-form>
102
-
103
- <div id="modes">
104
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
105
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
106
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
107
- </div>
108
- </div>
109
- </div>
110
- </ox-grist>
111
- `
112
- }
113
-
114
- async pageInitialized(lifecycle: any) {
115
- this.gristConfig = {
116
- list: {
117
- fields: ['name', 'description'],
118
- details: ['active', 'updatedAt']
119
- },
120
- columns: [
121
- { type: 'gutter', gutterName: 'sequence' },
122
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
123
- {
124
- type: 'string',
125
- name: 'name',
126
- header: i18next.t('field.name'),
127
- record: {
128
- editable: true
129
- },
130
- filter: 'search',
131
- sortable: true,
132
- width: 150
133
- },
134
- {
135
- type: 'string',
136
- name: 'description',
137
- header: i18next.t('field.description'),
138
- record: {
139
- editable: true
140
- },
141
- filter: 'search',
142
- width: 200
143
- },
144
- {
145
- type: 'checkbox',
146
- name: 'active',
147
- label: true,
148
- header: i18next.t('field.active'),
149
- record: {
150
- editable: true
151
- },
152
- filter: true,
153
- sortable: true,
154
- width: 60
155
- },
156
- {
157
- type: 'resource-object',
158
- name: 'updater',
159
- header: i18next.t('field.updater'),
160
- record: {
161
- editable: false
162
- },
163
- sortable: true,
164
- width: 120
165
- },
166
- {
167
- type: 'datetime',
168
- name: 'updatedAt',
169
- header: i18next.t('field.updated_at'),
170
- record: {
171
- editable: false
172
- },
173
- sortable: true,
174
- width: 180
175
- }
176
- ],
177
- rows: {
178
- selectable: {
179
- multiple: true
180
- }
181
- },
182
- sorters: [
183
- {
184
- name: 'name'
185
- }
186
- ]
187
- }
188
- }
189
-
190
- async pageUpdated(changes: any, lifecycle: any) {
191
- if (this.active) {
192
- // do something here when this page just became as active
193
- }
194
- }
195
-
196
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
197
- const response = await client.query({
198
- query: gql`
199
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
200
- responses: processThreads(filters: $filters, pagination: $pagination, sortings: $sortings) {
201
- items {
202
- id
203
- name
204
- description
205
- active
206
- updater {
207
- id
208
- name
209
- }
210
- updatedAt
211
- }
212
- total
213
- }
214
- }
215
- `,
216
- variables: {
217
- filters,
218
- pagination: { page, limit },
219
- sortings
220
- }
221
- })
222
-
223
- return {
224
- total: response.data.responses.total || 0,
225
- records: response.data.responses.items || []
226
- }
227
- }
228
-
229
- async _deleteProcessThread() {
230
- if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
231
- const ids = this.grist.selected.map(record => record.id)
232
- if (ids && ids.length > 0) {
233
- const response = await client.mutate({
234
- mutation: gql`
235
- mutation ($ids: [String!]!) {
236
- deleteProcessThreads(ids: $ids)
237
- }
238
- `,
239
- variables: {
240
- ids
241
- }
242
- })
243
-
244
- if (!response.errors) {
245
- this.grist.fetch()
246
- notify({
247
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
248
- })
249
- }
250
- }
251
- }
252
- }
253
-
254
- async _updateProcessThread() {
255
- let patches = this.grist.dirtyRecords
256
- if (patches && patches.length) {
257
- patches = patches.map(patch => {
258
- let patchField: any = patch.id ? { id: patch.id } : {}
259
- const dirtyFields = patch.__dirtyfields__
260
- for (let key in dirtyFields) {
261
- patchField[key] = dirtyFields[key].after
262
- }
263
- patchField.cuFlag = patch.__dirty__
264
-
265
- return patchField
266
- })
267
-
268
- const response = await client.mutate({
269
- mutation: gql`
270
- mutation ($patches: [ProcessThreadPatch!]!) {
271
- updateMultipleProcessThread(patches: $patches) {
272
- name
273
- }
274
- }
275
- `,
276
- variables: {
277
- patches
278
- }
279
- })
280
-
281
- if (!response.errors) {
282
- this.grist.fetch()
283
- }
284
- }
285
- }
286
-
287
- async exportHandler() {
288
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
289
- const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
290
-
291
- return exportTargets.map(processThread => {
292
- let tempObj = {}
293
- for (const field of targetFieldSet) {
294
- tempObj[field] = processThread[field]
295
- }
296
-
297
- return tempObj
298
- })
299
- }
300
-
301
- async importHandler(records) {
302
- const popup = openPopup(
303
- html`
304
- <process-thread-importer
305
- .processThreads=${records}
306
- @imported=${() => {
307
- history.back()
308
- this.grist.fetch()
309
- }}
310
- ></process-thread-importer>
311
- `,
312
- {
313
- backdrop: true,
314
- size: 'large',
315
- title: i18next.t('title.import process-thread')
316
- }
317
- )
318
-
319
- popup.onclosed = () => {
320
- this.grist.fetch()
321
- }
322
- }
323
- }
@@ -1,17 +0,0 @@
1
- import { UPDATE_PROCESS } from '../actions/main'
2
-
3
- const INITIAL_STATE = {
4
- process: 'ABC'
5
- }
6
-
7
- const process = (state = INITIAL_STATE, action) => {
8
- switch (action.type) {
9
- case UPDATE_PROCESS:
10
- return { ...state }
11
-
12
- default:
13
- return state
14
- }
15
- }
16
-
17
- export default process
package/client/route.ts DELETED
@@ -1,27 +0,0 @@
1
- export default function route(page: string) {
2
- switch (page) {
3
- case 'process-main':
4
- import('./pages/main')
5
- return page
6
-
7
- case 'process-list':
8
- import('./pages/process/process-list-page')
9
- return page
10
-
11
- case 'process-instance-list':
12
- import('./pages/process-instance/process-instance-list-page')
13
- return page
14
-
15
- case 'process-thread-list':
16
- import('./pages/process-thread/process-thread-list-page')
17
- return page
18
-
19
- case 'event-list':
20
- import('./pages/event/event-list-page')
21
- return page
22
-
23
- case 'gateway-list':
24
- import('./pages/gateway/gateway-list-page')
25
- return page
26
- }
27
- }
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig-base.json",
3
- "compilerOptions": {
4
- "experimentalDecorators": true,
5
- "skipLibCheck": true,
6
- "strict": true,
7
- "declaration": true,
8
- "module": "esnext",
9
- "outDir": "../dist-client",
10
- "baseUrl": "./"
11
- },
12
- "include": ["./**/*"]
13
- }
@@ -1,90 +0,0 @@
1
- import { Role, User } from '@things-factory/auth-base'
2
-
3
- import { ProcessSearchKeyItem } from '../service/process/process-search-key-item-type'
4
- import { ProcessInstance, ProcessInstanceStatus } from '../service/process-instance/process-instance'
5
- import { ProcessThread, ProcessThreadStatus } from '../service/process-thread/process-thread'
6
-
7
- export async function updateProcessInstanceState(id: string, context: ResolverContext) {
8
- const { tx } = context.state
9
-
10
- var processInstance = await tx.getRepository(ProcessInstance).findOne({
11
- where: { id },
12
- relations: ['domain', 'process', 'assigneeRole', 'supervisoryRole', 'updater', 'creator', 'starter', 'terminator']
13
- })
14
-
15
- processInstance = await tx.getRepository(ProcessInstance).save({
16
- ...processInstance,
17
- transaction: 'thread' /* change by transaction of process thread */,
18
- ...(await evalProcessInstanceState(id, context))
19
- })
20
- }
21
-
22
- export async function evalProcessInstanceState(
23
- id: string,
24
- context: ResolverContext
25
- ): Promise<Partial<ProcessInstance>> {
26
- const { tx, user } = context.state
27
-
28
- const processInstance = await tx.getRepository(ProcessInstance).findOne({
29
- where: { id },
30
- relations: ['processThreads', 'process']
31
- })
32
- const { processThreads, state } = processInstance
33
-
34
- switch (true) {
35
- case state === ProcessInstanceStatus.Ended:
36
- case state === ProcessInstanceStatus.Aborted:
37
- return {}
38
- default:
39
- return {
40
- state: processThreads.find(thread => thread.state == ProcessThreadStatus.Aborted)
41
- ? ProcessInstanceStatus.Aborted
42
- : ProcessInstanceStatus.Ended,
43
- reason: '',
44
- terminatedAt: new Date()
45
- }
46
- }
47
- }
48
-
49
- export async function createProcessThreadForUser(
50
- transaction: string,
51
- processInstance: ProcessInstance,
52
- assignee: User,
53
- context: ResolverContext
54
- ): Promise<ProcessThread> {
55
- const { domain, user, tx } = context.state
56
-
57
- const threadRepo = tx.getRepository(ProcessThread)
58
- const now = new Date()
59
-
60
- const result = await threadRepo.save({
61
- domain,
62
- assignee,
63
- state: ProcessThreadStatus.Assigned,
64
- processInstance,
65
- transaction,
66
- dueAt: processInstance.dueAt,
67
- assignedAt: now,
68
- creator: user,
69
- updater: user,
70
- createdAt: now
71
- })
72
-
73
- await updateProcessInstanceState(processInstance.id, context)
74
-
75
- return result
76
- }
77
-
78
- export function fillProcessSearchKeys(searchKeys: ProcessSearchKeyItem[], input: { [key: string]: any }) {
79
- if (!input || typeof input !== 'object') {
80
- return
81
- }
82
-
83
- return searchKeys?.reduce((sum, key, index) => {
84
- const value = input[key.inputKey]
85
- if (value != null) {
86
- sum[`key0${index + 1}`] = value instanceof Array ? value[0] : value
87
- }
88
- return sum
89
- }, {})
90
- }
File without changes
@@ -1,75 +0,0 @@
1
- import { ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
- import { ProcessInstance, ProcessInstanceStatus } from '../../service/process-instance/process-instance'
3
- import { evalProcessInstanceState } from '../common'
4
-
5
- import { _abort as abortProcessThread } from '../process-thread/_abort'
6
-
7
- export async function abort(
8
- { id, reason }: { id: string; reason: string },
9
- context: ResolverContext
10
- ): Promise<ProcessInstance> {
11
- const { domain, user, tx } = context.state
12
-
13
- var repository = tx.getRepository(ProcessInstance)
14
-
15
- var processInstance = await repository.findOne({
16
- where: { domain: { id: domain.id }, id },
17
- relations: [
18
- 'domain',
19
- 'process',
20
- 'processThreads',
21
- 'assigneeRole',
22
- 'supervisoryRole',
23
- 'updater',
24
- 'creator',
25
- 'starter',
26
- 'terminator'
27
- ]
28
- })
29
-
30
- if (!processInstance) {
31
- throw new Error(
32
- context.t('error.process-instance not found', {
33
- processInstance: id
34
- })
35
- )
36
- }
37
-
38
- /*
39
- Prerequisites for a Task to Be Aborted.
40
- - The previous state of the task must not be End or Aborted.
41
- */
42
- if (processInstance.state == ProcessInstanceStatus.Aborted || processInstance.state == ProcessInstanceStatus.Ended) {
43
- throw new Error(
44
- context.t(`error.process-instance is already terminated`, {
45
- id,
46
- state: processInstance.state
47
- })
48
- )
49
- }
50
-
51
- /*
52
- Actions to be processed when a task is aborted
53
- - All related process threads must be aborted.
54
- */
55
-
56
- const TERMINATED = [ProcessThreadStatus.Aborted, ProcessThreadStatus.Delegated, ProcessThreadStatus.Ended]
57
-
58
- for (let processThread of processInstance.processThreads) {
59
- if (TERMINATED.includes(processThread.state)) {
60
- continue
61
- }
62
-
63
- await abortProcessThread({ processThread, reason }, context)
64
- }
65
-
66
- return await repository.save({
67
- ...processInstance,
68
- reason,
69
- ...(await evalProcessInstanceState(id, context)),
70
- transaction: 'abort',
71
- updater: user,
72
- terminatedAt: new Date(),
73
- terminator: user
74
- })
75
- }
@@ -1,74 +0,0 @@
1
- import { ProcessInstance, ProcessInstanceStatus } from '../../service/process-instance/process-instance'
2
- import { ProcessThreadStatus } from '../../service/process-thread/process-thread'
3
- import { evalProcessInstanceState } from '../common'
4
-
5
- export async function end(
6
- { id, output, reason }: { id: string; output?: object; reason?: string },
7
- context: ResolverContext
8
- ): Promise<ProcessInstance> {
9
- const { domain, user, tx } = context.state
10
- const repository = tx.getRepository(ProcessInstance)
11
-
12
- var processInstance = await repository.findOne({
13
- where: { domain: { id: domain.id }, id },
14
- relations: [
15
- 'domain',
16
- 'process',
17
- 'processThreads',
18
- 'assigneeRole',
19
- 'supervisoryRole',
20
- 'updater',
21
- 'creator',
22
- 'starter',
23
- 'terminator'
24
- ]
25
- })
26
-
27
- if (!processInstance) {
28
- throw new Error(
29
- context.t('error.process-instance not found', {
30
- processInstance: id
31
- })
32
- )
33
- }
34
-
35
- /*
36
- Prerequisites for a Task to Be End.
37
- - The previous state of the task must not be End or Aborted.
38
- - There should be no unfinished process threads.
39
- */
40
- if (processInstance.state == ProcessInstanceStatus.Aborted || processInstance.state == ProcessInstanceStatus.Ended) {
41
- throw new Error(
42
- context.t(`error.process-instance is already terminated`, {
43
- id,
44
- state: processInstance.state
45
- })
46
- )
47
- }
48
-
49
- const TERMINATED = [ProcessThreadStatus.Aborted, ProcessThreadStatus.Delegated, ProcessThreadStatus.Ended]
50
-
51
- for (let processThread of processInstance.processThreads) {
52
- if (TERMINATED.includes(processThread.state)) {
53
- continue
54
- }
55
-
56
- throw new Error(
57
- context.t(`error.all process threads should be terminated`, {
58
- processThread: processThread.id,
59
- state: processInstance.state
60
- })
61
- )
62
- }
63
-
64
- return await repository.save({
65
- ...processInstance,
66
- reason,
67
- output,
68
- transaction: 'end',
69
- state: await evalProcessInstanceState(id, context),
70
- updater: user,
71
- terminatedAt: new Date(),
72
- terminator: user
73
- } as any)
74
- }
@@ -1,2 +0,0 @@
1
- export * from './abort'
2
- export * from './end'
@@ -1,20 +0,0 @@
1
- import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
-
3
- export async function _abort(
4
- { processThread, reason }: { processThread: ProcessThread; reason: string },
5
- context: ResolverContext
6
- ): Promise<ProcessThread> {
7
- const { domain, user, tx } = context.state
8
-
9
- var repository = tx.getRepository(ProcessThread)
10
-
11
- return await repository.save({
12
- ...processThread,
13
- reason,
14
- state: ProcessThreadStatus.Aborted,
15
- transaction: 'abort',
16
- updater: user,
17
- terminatedAt: new Date(),
18
- terminator: user
19
- })
20
- }
@@ -1,48 +0,0 @@
1
- import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
- import { updateProcessInstanceState } from '../common'
3
- import { _abort } from './_abort'
4
-
5
- export async function abort(
6
- { id, reason }: { id: string; reason: string },
7
- context: ResolverContext
8
- ): Promise<ProcessThread> {
9
- const { domain, user, tx } = context.state
10
-
11
- var repository = tx.getRepository(ProcessThread)
12
-
13
- var processThread = await repository.findOne({
14
- where: { domain: { id: domain.id }, id },
15
- relations: ['domain', 'processInstance', 'assignee', 'creator', 'updater']
16
- })
17
-
18
- if (!processThread) {
19
- throw new Error(
20
- context.t('error.process-thread not found', {
21
- processThread: id
22
- })
23
- )
24
- }
25
-
26
- /*
27
- Prerequisites for a process thread to Be Aborted.
28
- - The previous state of the process thread must not be End or Aborted.
29
- */
30
- if (
31
- processThread.state == ProcessThreadStatus.Aborted ||
32
- processThread.state == ProcessThreadStatus.Ended ||
33
- processThread.state == ProcessThreadStatus.Delegated
34
- ) {
35
- throw new Error(
36
- context.t(`error.process-thread is already terminated`, {
37
- id,
38
- state: processThread.state
39
- })
40
- )
41
- }
42
-
43
- const result = await _abort({ processThread, reason }, context)
44
-
45
- await updateProcessInstanceState(processThread.processInstanceId, context)
46
-
47
- return result
48
- }